diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-01 05:41:20 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-01 05:41:20 (GMT) |
commit | 8b87a0b5fcc3db361d720c365273114eef5d9467 (patch) | |
tree | f8eb419c2aa688376ebda4a128a3eed3d4f35f29 /Objects/object.c | |
parent | 572a9f32dc1a04ff72d2bcf6389f1db736e0ad8c (diff) | |
download | cpython-8b87a0b5fcc3db361d720c365273114eef5d9467.zip cpython-8b87a0b5fcc3db361d720c365273114eef5d9467.tar.gz cpython-8b87a0b5fcc3db361d720c365273114eef5d9467.tar.bz2 |
Use %ld and casts to long for refcount printing, in absense of a universally
available %zd format character. Mark with an XXX comment so we can fix this,
later.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Objects/object.c b/Objects/object.c index 606b3fc..7b905dc 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -138,9 +138,11 @@ _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op) { char buf[300]; + /* XXX(twouters) cast refcount to long until %zd is universally + available */ PyOS_snprintf(buf, sizeof(buf), - "%s:%i object at %p has negative ref count %i", - fname, lineno, op, op->ob_refcnt); + "%s:%i object at %p has negative ref count %ld", + fname, lineno, op, (long)op->ob_refcnt); Py_FatalError(buf); } @@ -233,8 +235,10 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting) } else { if (op->ob_refcnt <= 0) - fprintf(fp, "<refcnt %u at %p>", - op->ob_refcnt, op); + /* XXX(twouters) cast refcount to long until %zd is + universally available */ + fprintf(fp, "<refcnt %ld at %p>", + (long)op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { PyObject *s; if (flags & Py_PRINT_RAW) @@ -277,12 +281,14 @@ void _PyObject_Dump(PyObject* op) else { fprintf(stderr, "object : "); (void)PyObject_Print(op, stderr, 0); + /* XXX(twouters) cast refcount to long until %zd is + universally available */ fprintf(stderr, "\n" "type : %s\n" - "refcount: %d\n" + "refcount: %ld\n" "address : %p\n", op->ob_type==NULL ? "NULL" : op->ob_type->tp_name, - op->ob_refcnt, + (long)op->ob_refcnt, op); } } @@ -1893,7 +1899,9 @@ _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 [%d] ", op, op->ob_refcnt); + /* XXX(twouters) cast refcount to long until %zd is + universally available */ + fprintf(fp, "%p [%ld] ", op, (long)op->ob_refcnt); if (PyObject_Print(op, fp, 0) != 0) PyErr_Clear(); putc('\n', fp); @@ -1909,7 +1917,9 @@ _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 [%d] %s\n", op, op->ob_refcnt, + /* XXX(twouters) cast refcount to long until %zd is + universally available */ + fprintf(fp, "%p [%ld] %s\n", op, (long)op->ob_refcnt, op->ob_type->tp_name); } |