From 4c1937de1bf9916e2c1cb90abc5c52df885fa14f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 21 Oct 2024 12:23:33 +0100 Subject: [PATCH] gh-125703: Correctly honour tracemalloc hooks on more PyDECREF specialized paths --- Python/ceval.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index 55e5eba25eaa21..ca75646b585f07 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -99,6 +99,11 @@ } \ _Py_DECREF_STAT_INC(); \ if (--op->ob_refcnt == 0) { \ + 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); \ + } \ destructor d = (destructor)(dealloc); \ d(op); \ } \