Skip to content

Commit ec1036f

Browse files
committed
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>
1 parent befa045 commit ec1036f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

py/objcode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static inline const void *mp_code_get_proto_fun(mp_obj_code_t *self) {
7272

7373
#include "py/emitglue.h"
7474

75-
#define MP_CODE_QSTR_MAP(context, idx) (context->constants.qstr_table[idx])
75+
#define MP_CODE_QSTR_MAP(context, idx) (qstr)(context->constants.qstr_table[idx])
7676

7777
typedef struct _mp_obj_code_t {
7878
// TODO this was 4 words

py/profile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
8080
"<frame at 0x%p, file '%q', line %d, code %q>",
8181
frame,
8282
MP_CODE_QSTR_MAP(code->context, 0),
83-
frame->lineno,
83+
(int)frame->lineno,
8484
MP_CODE_QSTR_MAP(code->context, prelude->qstr_block_name_idx)
8585
);
8686
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy