From b5eb234c98f65435208f0edb638361501a72df3c Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Thu, 13 Mar 2025 16:40:23 +0000 Subject: [PATCH] Handle trace refs in specialized decref --- Include/refcount.h | 6 ++++++ 1 file changed, 6 insertions(+) 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); } }