diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-10 16:38:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-10 16:38:05 (GMT) |
commit | d36cf5f1d20ce9f111a8fc997104785086e8eee6 (patch) | |
tree | f452121f147dece783aa9a278f6ce80b012ca0bd /Objects/obmalloc.c | |
parent | 24b8bad6d30ae4fb37ee686a073adfa5308659f9 (diff) | |
download | cpython-d36cf5f1d20ce9f111a8fc997104785086e8eee6.zip cpython-d36cf5f1d20ce9f111a8fc997104785086e8eee6.tar.gz cpython-d36cf5f1d20ce9f111a8fc997104785086e8eee6.tar.bz2 |
bpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)
The PEP 353, written in 2005, introduced PY_FORMAT_SIZE_T. Python no
longer supports macOS 10.4 and Visual Studio 2010, but requires more
recent macOS and Visual Studio versions. In 2020 with Python 3.10, it
is now safe to use directly "%zu" to format size_t and "%zi" to
format Py_ssize_t.
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r-- | Objects/obmalloc.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index eb34f10..03d0e8e 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -2420,8 +2420,7 @@ _PyObject_DebugDumpAddress(const void *p) fprintf(stderr, " API '%c'\n", id); nbytes = read_size_t(q - 2*SST); - fprintf(stderr, " %" PY_FORMAT_SIZE_T "u bytes originally " - "requested\n", nbytes); + fprintf(stderr, " %zu bytes originally requested\n", nbytes); /* In case this is nuts, check the leading pad bytes first. */ fprintf(stderr, " The %d pad bytes at p-%d are ", SST-1, SST-1); @@ -2477,8 +2476,9 @@ _PyObject_DebugDumpAddress(const void *p) #ifdef PYMEM_DEBUG_SERIALNO size_t serial = read_size_t(tail + SST); - fprintf(stderr, " The block was made by call #%" PY_FORMAT_SIZE_T - "u to debug malloc/realloc.\n", serial); + fprintf(stderr, + " The block was made by call #%zu to debug malloc/realloc.\n", + serial); #endif if (nbytes > 0) { @@ -2553,7 +2553,7 @@ _PyDebugAllocatorStats(FILE *out, char buf1[128]; char buf2[128]; PyOS_snprintf(buf1, sizeof(buf1), - "%d %ss * %" PY_FORMAT_SIZE_T "d bytes each", + "%d %ss * %zd bytes each", num_blocks, block_name, sizeof_block); PyOS_snprintf(buf2, sizeof(buf2), "%48s ", buf1); @@ -2694,10 +2694,7 @@ _PyObject_DebugMallocStats(FILE *out) assert(b == 0 && f == 0); continue; } - fprintf(out, "%5u %6u " - "%11" PY_FORMAT_SIZE_T "u " - "%15" PY_FORMAT_SIZE_T "u " - "%13" PY_FORMAT_SIZE_T "u\n", + fprintf(out, "%5u %6u %11zu %15zu %13zu\n", i, size, p, b, f); allocated_bytes += b * size; available_bytes += f * size; @@ -2716,8 +2713,8 @@ _PyObject_DebugMallocStats(FILE *out) (void)printone(out, "# arenas allocated current", narenas); PyOS_snprintf(buf, sizeof(buf), - "%" PY_FORMAT_SIZE_T "u arenas * %d bytes/arena", - narenas, ARENA_SIZE); + "%zu arenas * %d bytes/arena", + narenas, ARENA_SIZE); (void)printone(out, buf, narenas * ARENA_SIZE); fputc('\n', out); |