Commit 970b5764 authored by Tim Peters's avatar Tim Peters

_Py_PrintReferenceAddresses,_Py_PrintReferences:

interpolate PY_FORMAT_SIZE_T for refcount display
instead of casting refcounts to long.

I understand that gcc on some boxes delivers
nuisance warnings about this, but if any new ones
appear because of this they'll get fixed by magic
when the others get fixed.
parent f75cd751
...@@ -1900,9 +1900,7 @@ _Py_PrintReferences(FILE *fp) ...@@ -1900,9 +1900,7 @@ _Py_PrintReferences(FILE *fp)
PyObject *op; PyObject *op;
fprintf(fp, "Remaining objects:\n"); fprintf(fp, "Remaining objects:\n");
for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) {
/* XXX(twouters) cast refcount to long until %zd is fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", op, op->ob_refcnt);
universally available */
fprintf(fp, "%p [%ld] ", op, (long)op->ob_refcnt);
if (PyObject_Print(op, fp, 0) != 0) if (PyObject_Print(op, fp, 0) != 0)
PyErr_Clear(); PyErr_Clear();
putc('\n', fp); putc('\n', fp);
...@@ -1918,10 +1916,8 @@ _Py_PrintReferenceAddresses(FILE *fp) ...@@ -1918,10 +1916,8 @@ _Py_PrintReferenceAddresses(FILE *fp)
PyObject *op; PyObject *op;
fprintf(fp, "Remaining object addresses:\n"); fprintf(fp, "Remaining object addresses:\n");
for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) for (op = refchain._ob_next; op != &refchain; op = op->_ob_next)
/* XXX(twouters) cast refcount to long until %zd is fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", op,
universally available */ op->ob_refcnt, op->ob_type->tp_name);
fprintf(fp, "%p [%ld] %s\n", op, (long)op->ob_refcnt,
op->ob_type->tp_name);
} }
PyObject * PyObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment