From c373c86f6bccef1113408a3c45ceace0a10ef5ba Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 21 Oct 2024 15:39:05 +0100 Subject: [PATCH] [3.13] gh-125703: Correctly honour tracemalloc hooks on more PyDECREF specialized paths (GH-125712) (cherry picked from commit 3d1df3d84e5c75a52b6f1379cd7f2809fc50befa) Co-authored-by: Pablo Galindo Salgado --- Python/ceval.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index 351ddd2666caf6..0c6cb5076de0fa 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -95,6 +95,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); \ } \