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/object.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/object.c')
-rw-r--r-- | Objects/object.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/object.c b/Objects/object.c index 623ee52..10cbd1b 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -66,8 +66,7 @@ _Py_GetRefTotal(void) void _PyDebug_PrintTotalRefs(void) { fprintf(stderr, - "[%" PY_FORMAT_SIZE_T "d refs, " - "%" PY_FORMAT_SIZE_T "d blocks]\n", + "[%zd refs, %zd blocks]\n", _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); } #endif /* Py_REF_DEBUG */ @@ -1876,9 +1875,10 @@ _Py_PrintReferences(FILE *fp) PyObject *op; fprintf(fp, "Remaining objects:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { - fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", (void *)op, Py_REFCNT(op)); - if (PyObject_Print(op, fp, 0) != 0) + fprintf(fp, "%p [%zd] ", (void *)op, Py_REFCNT(op)); + if (PyObject_Print(op, fp, 0) != 0) { PyErr_Clear(); + } putc('\n', fp); } } @@ -1892,7 +1892,7 @@ _Py_PrintReferenceAddresses(FILE *fp) PyObject *op; fprintf(fp, "Remaining object addresses:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) - fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", (void *)op, + fprintf(fp, "%p [%zd] %s\n", (void *)op, Py_REFCNT(op), Py_TYPE(op)->tp_name); } |