_PyObject_Dump(): print the type of the object. This is by far the

most frequently interesting information IMO.  Also tidy up the output.
This commit is contained in:
Guido van Rossum 2001-09-14 15:50:08 +00:00
parent 4441001b56
commit 5f5512d246
1 changed files with 8 additions and 2 deletions

View File

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