https://github.com/python/cpython/commit/d9ac6b3ef7b4116762f2d0308c55044e17f5e66b
commit: d9ac6b3ef7b4116762f2d0308c55044e17f5e66b
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: Yhg1s <[email protected]>
date: 2024-12-02T15:02:20+01:00
summary:

[3.13] gh-125703: Correctly honour tracemalloc hooks on specialized DECREF 
paths (GH-125704) (#125705)

gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths 
(GH-125704)
(cherry picked from commit f8ba9fb2ce6690d2dd05b356583e8e4790badad7)

Co-authored-by: Pablo Galindo Salgado <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2024-10-18-16-00-10.gh-issue-125703.QRoqMo.rst
M Include/internal/pycore_object.h

diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 39f5600f7ae907..d50a688d5b752a 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -216,6 +216,11 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor 
destruct)
 #ifdef Py_TRACE_REFS
         _Py_ForgetReference(op);
 #endif
+        struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer;
+        if (tracer->tracer_func != NULL) {
+            void* data = tracer->tracer_data;
+            tracer->tracer_func(op, PyRefTracer_DESTROY, data);
+        }
         destruct(op);
     }
 }
diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2024-10-18-16-00-10.gh-issue-125703.QRoqMo.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2024-10-18-16-00-10.gh-issue-125703.QRoqMo.rst
new file mode 100644
index 00000000000000..7cbfa725e78cef
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2024-10-18-16-00-10.gh-issue-125703.QRoqMo.rst
@@ -0,0 +1,2 @@
+Correctly honour :mod:`tracemalloc` hooks in specialized ``Py_DECREF``
+paths. Patch by Pablo Galindo

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to