diff options
| author | Jeff Epler <jepler@gmail.com> | 2025-07-18 06:06:42 -0500 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-07-25 11:01:42 +1000 |
| commit | ab620f40844a837546497252849933ef2f685f4d (patch) | |
| tree | 42c0a1335d49c5c9a03415f19f318f9a9a2477f7 | |
| parent | 87b7a9d7349c28b3acb13815bb63484d12203895 (diff) | |
py/mpprint: Fix printing pointers with upper bit set.
On a build like nanbox, `mp_uint_t` is wider than `u/intptr_t`. Using a
signed type for fetching pointer values resulted in erroneous results: like
`<function f at 0xfffffffff7a60bc0>` instead of
`<function f at 0xf7a60bc0>`.
Signed-off-by: Jeff Epler <jepler@gmail.com>
| -rw-r--r-- | py/mpprint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/mpprint.c b/py/mpprint.c index e56b949dd..f1d8bd0c5 100644 --- a/py/mpprint.c +++ b/py/mpprint.c @@ -530,7 +530,7 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) { char fmt_chr = *fmt; mp_uint_t val; if (fmt_chr == 'p' || fmt_chr == 'P') { - val = va_arg(args, intptr_t); + val = va_arg(args, uintptr_t); } #if SUPPORT_LL_FORMAT else if (long_long_arg) { |
