mirror of https://github.com/python/cpython
_PyObject_Dump(): If argument is NULL, print "NULL" instead of
crashing.
This commit is contained in:
parent
2da0ea82ba
commit
eefb107a48
|
@ -231,9 +231,13 @@ PyObject_Print(PyObject *op, FILE *fp, int flags)
|
|||
/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */
|
||||
void _PyObject_Dump(PyObject* op)
|
||||
{
|
||||
(void)PyObject_Print(op, stderr, 0);
|
||||
fprintf(stderr, "\nrefcounts: %d\n", op->ob_refcnt);
|
||||
fprintf(stderr, "address : %p\n", op);
|
||||
if (op == NULL)
|
||||
fprintf(stderr, "NULL\n");
|
||||
else {
|
||||
(void)PyObject_Print(op, stderr, 0);
|
||||
fprintf(stderr, "\nrefcounts: %d\n", op->ob_refcnt);
|
||||
fprintf(stderr, "address : %p\n", op);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLE_GC
|
||||
|
|
Loading…
Reference in New Issue