Skip to content

Commit 8a3dabb

Browse files
committed
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>
1 parent 81867d3 commit 8a3dabb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/mpprint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
530530
char fmt_chr = *fmt;
531531
mp_uint_t val;
532532
if (fmt_chr == 'p' || fmt_chr == 'P') {
533-
val = va_arg(args, intptr_t);
533+
val = va_arg(args, uintptr_t);
534534
}
535535
#if SUPPORT_LL_FORMAT
536536
else if (long_long_arg) {

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