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>
#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);
}
}
--- /dev/null
+Correctly honour :mod:`tracemalloc` hooks in specialized ``Py_DECREF``
+paths. Patch by Pablo Galindo