Skip to content

Commit 266e5ee

Browse files
committed
Print debug_cycle address with explicit 0x prefix for Windows
1 parent 5771cc4 commit 266e5ee

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎Python/gc.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,8 @@ clear_weakrefs(PyGC_Head *unreachable)
996996
}
997997
}
998998

999-
/* "gc: " + " <" + " " + %p + ">\n" + NUL, excluding msg and tp_name */
999+
/* "gc: " + " <" + " 0x" + 16 hex digits + ">\n" + NUL, excluding msg and
1000+
* tp_name */
10001001
#define DEBUG_LINE_FIXED_LEN 32
10011002

10021003
static char *
@@ -1008,7 +1009,9 @@ debug_cycle(const char *msg, PyObject *op)
10081009
if (line == NULL) {
10091010
return NULL;
10101011
}
1011-
PyOS_snprintf(line, size, "gc: %s <%s %p>\n", msg, name, (void *)op);
1012+
/* Not %p: its output is platform-specific (no "0x" prefix on Windows). */
1013+
PyOS_snprintf(line, size, "gc: %s <%s 0x%" PRIxPTR ">\n",
1014+
msg, name, (uintptr_t)op);
10121015
return line;
10131016
}
10141017

0 commit comments

Comments
 (0)