]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 2 Dec 2024 14:02:20 +0000 (15:02 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Dec 2024 14:02:20 +0000 (15:02 +0100)
gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (GH-125704)
(cherry picked from commit f8ba9fb2ce6690d2dd05b356583e8e4790badad7)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Include/internal/pycore_object.h
Misc/NEWS.d/next/Core_and_Builtins/2024-10-18-16-00-10.gh-issue-125703.QRoqMo.rst [new file with mode: 0644]

index 39f5600f7ae9071912372091652e7439583f04c7..d50a688d5b752a6bc55e5263c8f59c53d1ea6fac 100644 (file)
@@ -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 (file)
index 0000000..7cbfa72
--- /dev/null
@@ -0,0 +1,2 @@
+Correctly honour :mod:`tracemalloc` hooks in specialized ``Py_DECREF``
+paths. Patch by Pablo Galindo