diff --git a/Include/refcount.h b/Include/refcount.h index b8ea5c6281408f..7f09e0de0c84a7 100644 --- a/Include/refcount.h +++ b/Include/refcount.h @@ -420,6 +420,9 @@ static inline void _Py_DECREF_MORTAL_SPECIALIZED(const char *filename, int linen _Py_DECREF_DecRefTotal(); } if (--op->ob_refcnt == 0) { +#ifdef Py_TRACE_REFS + _Py_ForgetReference(op); +#endif destruct(op); } } @@ -464,6 +467,9 @@ static inline void Py_DECREF_MORTAL_SPECIALIZED(PyObject *op, destructor destruc assert(!_Py_IsStaticImmortal(op)); _Py_DECREF_STAT_INC(); if (--op->ob_refcnt == 0) { +#ifdef Py_TRACE_REFS + _Py_ForgetReference(op); +#endif destruct(op); } }