Skip to content

Commit c818188

Browse files
pablogsalmiss-islington
authored andcommitted
pythongh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (pythonGH-125704)
(cherry picked from commit f8ba9fb) Co-authored-by: Pablo Galindo Salgado <[email protected]>
1 parent 8b275e7 commit c818188

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Include/internal/pycore_object.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
4444
#ifdef Py_TRACE_REFS
4545
_Py_ForgetReference(op);
4646
#endif
47+
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer;
48+
if (tracer->tracer_func != NULL) {
49+
void* data = tracer->tracer_data;
50+
tracer->tracer_func(op, PyRefTracer_DESTROY, data);
51+
}
4752
destruct(op);
4853
}
4954
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Correctly honour :mod:`tracemalloc` hooks in specialized ``Py_DECREF``
2+
paths. Patch by Pablo Galindo

0 commit comments

Comments
 (0)