summaryrefslogtreecommitdiff
path: root/py/objcell.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-07-05 09:34:29 +0100
committerDamien George <damien@micropython.org>2025-07-25 11:00:41 +1000
commitee4f27affa2a4cbf940081da4bdfa36d22351461 (patch)
treeff8a99b3b7a0147a29c17c03e47a2e0d7a73a5e4 /py/objcell.c
parent4495610f8d5d38bf9f4b82f5568675509019758e (diff)
py/objcell: Fix printing of cell ID/pointer.
On the nanbox build, `o->obj` is a 64-bit type but `%p` formats a 32-bit type, leading to undefined behavior. Print the cell's ID as a hex integer instead. This location was found using an experimental gcc plugin for `mp_printf` error checking. Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'py/objcell.c')
-rw-r--r--py/objcell.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objcell.c b/py/objcell.c
index 95966c791..5c030c740 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -30,7 +30,7 @@
static void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_cell_t *o = MP_OBJ_TO_PTR(o_in);
- mp_printf(print, "<cell %p ", o->obj);
+ mp_printf(print, "<cell " HEX_FMT " ", (mp_uint_t)o->obj);
if (o->obj == MP_OBJ_NULL) {
mp_print_str(print, "(nil)");
} else {