mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
_PyObject_Dump(): If argument is NULL, print "NULL" instead of
crashing.
This commit is contained in:
parent
2da0ea82ba
commit
eefb107a48
1 changed files with 7 additions and 3 deletions
|
@ -231,9 +231,13 @@ PyObject_Print(PyObject *op, FILE *fp, int flags)
|
||||||
/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */
|
/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */
|
||||||
void _PyObject_Dump(PyObject* op)
|
void _PyObject_Dump(PyObject* op)
|
||||||
{
|
{
|
||||||
(void)PyObject_Print(op, stderr, 0);
|
if (op == NULL)
|
||||||
fprintf(stderr, "\nrefcounts: %d\n", op->ob_refcnt);
|
fprintf(stderr, "NULL\n");
|
||||||
fprintf(stderr, "address : %p\n", op);
|
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
|
#ifdef WITH_CYCLE_GC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue