mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Patch #448194: Debuging negative reference counts.
This commit is contained in:
parent
58212724f2
commit
64fbb330dc
1 changed files with 6 additions and 5 deletions
|
@ -489,11 +489,12 @@ extern DL_IMPORT(long) _Py_RefTotal;
|
||||||
#endif /* !Py_TRACE_REFS */
|
#endif /* !Py_TRACE_REFS */
|
||||||
|
|
||||||
#define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++)
|
#define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++)
|
||||||
#define Py_DECREF(op) \
|
/* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */
|
||||||
if (--_Py_RefTotal, (--((op)->ob_refcnt) != 0)) \
|
#define Py_DECREF(op) \
|
||||||
; \
|
if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \
|
||||||
else \
|
else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \
|
||||||
_Py_Dealloc((PyObject *)(op))
|
else (void)fprintf( stderr, "%s:%i negative ref count %i\n", \
|
||||||
|
__FILE__, __LINE__, (op)->ob_refcnt)
|
||||||
#else /* !Py_REF_DEBUG */
|
#else /* !Py_REF_DEBUG */
|
||||||
|
|
||||||
#ifdef COUNT_ALLOCS
|
#ifdef COUNT_ALLOCS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue