]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-127705: Handle trace refs in specialized decref (GH-131198)
authorMark Shannon <mark@hotpy.org>
Fri, 14 Mar 2025 12:02:09 +0000 (12:02 +0000)
committerGitHub <noreply@github.com>
Fri, 14 Mar 2025 12:02:09 +0000 (13:02 +0100)
This is missing `_PyReftracerTrack` calls, see gh-131238.
Merging as-is for the 3.14.0a6 release.

Include/refcount.h

index ba14bc6965ce3ef049bad9c3b1eb5b83f7a2c199..3efb7e5fee4a06a3a5e5d738e5d34420dc3bf365 100644 (file)
@@ -416,6 +416,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);
     }
 }
@@ -460,6 +463,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);
     }
 }