profile: Fix printing frame objects.

The argument corresponding to a `%q` specifier must be of type
`qstr`, not a narrower type like `int16_t`. Not ensuring this
caused an assertion error on one Windows x64 build.

The argument corresponding to a `%d` specifier must be of type
`int`, not a potentially-wider type like `mp_uint_t`. Not ensuring
this prevented the function name from being printed on the
unix nanbox build.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-06-21 09:35:39 +02:00
parent befa0456ca
commit ec1036fa89
2 changed files with 2 additions and 2 deletions

View file

@ -72,7 +72,7 @@ static inline const void *mp_code_get_proto_fun(mp_obj_code_t *self) {
#include "py/emitglue.h" #include "py/emitglue.h"
#define MP_CODE_QSTR_MAP(context, idx) (context->constants.qstr_table[idx]) #define MP_CODE_QSTR_MAP(context, idx) (qstr)(context->constants.qstr_table[idx])
typedef struct _mp_obj_code_t { typedef struct _mp_obj_code_t {
// TODO this was 4 words // TODO this was 4 words

View file

@ -80,7 +80,7 @@ static void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
"<frame at 0x%p, file '%q', line %d, code %q>", "<frame at 0x%p, file '%q', line %d, code %q>",
frame, frame,
MP_CODE_QSTR_MAP(code->context, 0), MP_CODE_QSTR_MAP(code->context, 0),
frame->lineno, (int)frame->lineno,
MP_CODE_QSTR_MAP(code->context, prelude->qstr_block_name_idx) MP_CODE_QSTR_MAP(code->context, prelude->qstr_block_name_idx)
); );
} }