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>
This commit is contained in:
Jeff Epler
2025-07-18 06:06:42 -05:00
committed by Damien George
parent 87b7a9d734
commit ab620f4084

View File

@@ -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) {