_PyObject_Dump(): print the type of the object. This is by far the
authorGuido van Rossum <guido@python.org>
Fri, 14 Sep 2001 15:50:08 +0000 (15:50 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 14 Sep 2001 15:50:08 +0000 (15:50 +0000)
most frequently interesting information IMO.  Also tidy up the output.

Objects/object.c

index 718dddf7cfe31057341bab8a296019269a22d10e..30263ba0f1ee8cf58df8a189d9fe7143760e816d 100644 (file)
@@ -194,9 +194,15 @@ void _PyObject_Dump(PyObject* op)
        if (op == NULL)
                fprintf(stderr, "NULL\n");
        else {
+               fprintf(stderr, "object  : ");
                (void)PyObject_Print(op, stderr, 0);
-               fprintf(stderr, "\nrefcounts: %d\n", op->ob_refcnt);
-               fprintf(stderr, "address    : %p\n", op);
+               fprintf(stderr, "\n"
+                       "type    : %s\n"
+                       "refcount: %d\n"
+                       "address : %p\n",
+                       op->ob_type==NULL ? "NULL" : op->ob_type->tp_name,
+                       op->ob_refcnt,
+                       op);
        }
 }