diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-02-28-18-39-49.gh-issue-130382.JPQQZV.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-28-18-39-49.gh-issue-130382.JPQQZV.rst new file mode 100644 index 00000000000000..effa514c713e56 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-28-18-39-49.gh-issue-130382.JPQQZV.rst @@ -0,0 +1,2 @@ +The interpreter now correctly issues :c:data:`PyRefTracer_DESTROY` for +deallocated objects. diff --git a/Python/ceval.c b/Python/ceval.c index 0a3b30513733bd..7f1ee61251ebc4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -80,6 +80,7 @@ } \ _Py_DECREF_STAT_INC(); \ if (--op->ob_refcnt == 0) { \ + _PyReftracerTrack(op, PyRefTracer_DESTROY); \ destructor dealloc = Py_TYPE(op)->tp_dealloc; \ (*dealloc)(op); \ } \