mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
In addition, fix some other minor violations of C99.
This commit is contained in:
parent
ae2c32f32b
commit
1a2252ed39
11 changed files with 26 additions and 24 deletions
|
|
@ -385,7 +385,7 @@ PyObject_Print(PyObject *op, FILE *fp, int flags)
|
|||
universally available */
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
fprintf(fp, "<refcnt %ld at %p>",
|
||||
(long)op->ob_refcnt, op);
|
||||
(long)op->ob_refcnt, (void *)op);
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
else {
|
||||
|
|
@ -499,7 +499,7 @@ _PyObject_Dump(PyObject* op)
|
|||
"address : %p\n",
|
||||
Py_TYPE(op)==NULL ? "NULL" : Py_TYPE(op)->tp_name,
|
||||
(long)op->ob_refcnt,
|
||||
op);
|
||||
(void *)op);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
|
@ -1894,7 +1894,7 @@ _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] ", op, op->ob_refcnt);
|
||||
fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", (void *)op, op->ob_refcnt);
|
||||
if (PyObject_Print(op, fp, 0) != 0)
|
||||
PyErr_Clear();
|
||||
putc('\n', fp);
|
||||
|
|
@ -1910,7 +1910,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", op,
|
||||
fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", (void *)op,
|
||||
op->ob_refcnt, Py_TYPE(op)->tp_name);
|
||||
}
|
||||
|
||||
|
|
@ -2167,7 +2167,7 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
|
|||
fprintf(stderr, "<object: ob_type=NULL>\n");
|
||||
}
|
||||
else if (_PyObject_IsFreed((PyObject *)Py_TYPE(obj))) {
|
||||
fprintf(stderr, "<object: freed type %p>\n", Py_TYPE(obj));
|
||||
fprintf(stderr, "<object: freed type %p>\n", (void *)Py_TYPE(obj));
|
||||
}
|
||||
else {
|
||||
/* Diplay the traceback where the object has been allocated.
|
||||
|
|
|
|||
|
|
@ -2354,7 +2354,7 @@ _PyObject_DebugDumpAddress(const void *p)
|
|||
}
|
||||
|
||||
tail = q + nbytes;
|
||||
fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, tail);
|
||||
fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, (void *)tail);
|
||||
ok = 1;
|
||||
for (i = 0; i < SST; ++i) {
|
||||
if (tail[i] != FORBIDDENBYTE) {
|
||||
|
|
|
|||
|
|
@ -1251,7 +1251,7 @@ void *_PyUnicode_compact_data(void *unicode_raw) {
|
|||
}
|
||||
void *_PyUnicode_data(void *unicode_raw) {
|
||||
PyObject *unicode = _PyObject_CAST(unicode_raw);
|
||||
printf("obj %p\n", unicode);
|
||||
printf("obj %p\n", (void*)unicode);
|
||||
printf("compact %d\n", PyUnicode_IS_COMPACT(unicode));
|
||||
printf("compact ascii %d\n", PyUnicode_IS_COMPACT_ASCII(unicode));
|
||||
printf("ascii op %p\n", ((void*)((PyASCIIObject*)(unicode) + 1)));
|
||||
|
|
@ -1282,14 +1282,14 @@ _PyUnicode_Dump(PyObject *op)
|
|||
|
||||
if (ascii->wstr == data)
|
||||
printf("shared ");
|
||||
printf("wstr=%p", ascii->wstr);
|
||||
printf("wstr=%p", (void *)ascii->wstr);
|
||||
|
||||
if (!(ascii->state.ascii == 1 && ascii->state.compact == 1)) {
|
||||
printf(" (%" PY_FORMAT_SIZE_T "u), ", compact->wstr_length);
|
||||
if (!ascii->state.compact && compact->utf8 == unicode->data.any)
|
||||
printf("shared ");
|
||||
printf("utf8=%p (%" PY_FORMAT_SIZE_T "u)",
|
||||
compact->utf8, compact->utf8_length);
|
||||
(void *)compact->utf8, compact->utf8_length);
|
||||
}
|
||||
printf(", data=%p\n", data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue