fix output format

This commit is contained in:
blueloveTH 2024-06-09 19:11:54 +08:00
parent a828551eb7
commit 6c055b91b9
6 changed files with 8 additions and 8 deletions

View File

@ -465,7 +465,7 @@ public:
template <typename T> template <typename T>
Type _find_type_in_cxx_typeid_map() { Type _find_type_in_cxx_typeid_map() {
auto it = _cxx_typeid_map.try_get(typeid(T)); auto it = _cxx_typeid_map.try_get(typeid(T));
if(it == nullptr) PK_FATAL_ERROR("T not found in cxx_typeid_map") if(it == nullptr) PK_FATAL_ERROR("T not found in cxx_typeid_map\n")
return *it; return *it;
} }

View File

@ -6,7 +6,7 @@
namespace pkpy { namespace pkpy {
void any::__bad_any_cast(const std::type_index expected, const std::type_index actual) { void any::__bad_any_cast(const std::type_index expected, const std::type_index actual) {
PK_FATAL_ERROR("bad_any_cast: expected %s, got %s", expected.name(), actual.name()) PK_FATAL_ERROR("bad_any_cast: expected %s, got %s\n", expected.name(), actual.name())
} }
any::any(any&& other) noexcept : data(other.data), _vt(other._vt) { any::any(any&& other) noexcept : data(other.data), _vt(other._vt) {

View File

@ -287,8 +287,8 @@ void Pools_debug_info(char* buffer, int size) noexcept {
int arenas = PoolObject._arenas.size(); int arenas = PoolObject._arenas.size();
// print empty arenas count // print empty arenas count
n = snprintf( n = snprintf(
buffer, size, "PoolObject: %d empty arenas, %d total arenas\n", buffer, size, "PoolObject: %d empty arenas, %d arenas\n",
empty_arenas, arenas + empty_arenas empty_arenas, arenas
); );
buffer += n; size -= n; buffer += n; size -= n;
// log each non-empty arena // log each non-empty arena

View File

@ -16,7 +16,7 @@ int utf8len(unsigned char c, bool suppress) {
if((c & 0b11111000) == 0b11110000) return 4; if((c & 0b11111000) == 0b11110000) return 4;
if((c & 0b11111100) == 0b11111000) return 5; if((c & 0b11111100) == 0b11111000) return 5;
if((c & 0b11111110) == 0b11111100) return 6; if((c & 0b11111110) == 0b11111100) return 6;
if(!suppress) PK_FATAL_ERROR("invalid utf8 char") if(!suppress) PK_FATAL_ERROR("invalid utf8 char\n")
return 0; return 0;
} }
@ -379,7 +379,7 @@ StrName StrName::get(std::string_view s) {
// generate new index // generate new index
// https://github.com/python/cpython/blob/3.12/Objects/dictobject.c#L175 // https://github.com/python/cpython/blob/3.12/Objects/dictobject.c#L175
uint16_t index = ((_pesudo_random_index * 5) + 1) & 65535; uint16_t index = ((_pesudo_random_index * 5) + 1) & 65535;
if(index == 0) PK_FATAL_ERROR("StrName index overflow") if(index == 0) PK_FATAL_ERROR("StrName index overflow\n")
auto res = _r_interned().emplace(index, s); auto res = _r_interned().emplace(index, s);
assert(res.second); assert(res.second);
s = std::string_view(res.first->second); s = std::string_view(res.first->second);

View File

@ -764,7 +764,7 @@ void BinaryExpr::emit_(CodeEmitContext* ctx) {
case TK("^"): ctx->emit_(OP_BITWISE_XOR, BC_NOARG, line); break; case TK("^"): ctx->emit_(OP_BITWISE_XOR, BC_NOARG, line); break;
case TK("@"): ctx->emit_(OP_BINARY_MATMUL, BC_NOARG, line); break; case TK("@"): ctx->emit_(OP_BINARY_MATMUL, BC_NOARG, line); break;
default: assert(false); default: PK_FATAL_ERROR("unknown binary operator: %s\n", TK_STR(op));
} }
for(int i: jmps) for(int i: jmps)

View File

@ -116,7 +116,7 @@ bool NameDict::contains(StrName key) const {
PyVar NameDict::operator[] (StrName key) const { PyVar NameDict::operator[] (StrName key) const {
PyVar* val = try_get_2_likely_found(key); PyVar* val = try_get_2_likely_found(key);
if(val == nullptr) PK_FATAL_ERROR("NameDict key not found: %s", key.escape().c_str()) if(val == nullptr) PK_FATAL_ERROR("NameDict key not found: %s\n", key.escape().c_str())
return *val; return *val;
} }