Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5821272 commit 64fbb33Copy full SHA for 64fbb33
1 file changed
Include/object.h
@@ -489,11 +489,12 @@ extern DL_IMPORT(long) _Py_RefTotal;
489
#endif /* !Py_TRACE_REFS */
490
491
#define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++)
492
-#define Py_DECREF(op) \
493
- if (--_Py_RefTotal, (--((op)->ob_refcnt) != 0)) \
494
- ; \
495
- else \
496
- _Py_Dealloc((PyObject *)(op))
+ /* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */
+#define Py_DECREF(op) \
+ if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \
+ else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \
+ else (void)fprintf( stderr, "%s:%i negative ref count %i\n", \
497
+ __FILE__, __LINE__, (op)->ob_refcnt)
498
#else /* !Py_REF_DEBUG */
499
500
#ifdef COUNT_ALLOCS
0 commit comments