Skip to content

Commit 55d248a

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 9393378 commit 55d248a

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
@@ -115,6 +115,11 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
115115
#ifdef Py_TRACE_REFS
116116
_Py_ForgetReference(op);
117117
#endif
118+
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer;
119+
if (tracer->tracer_func != NULL) {
120+
void* data = tracer->tracer_data;
121+
tracer->tracer_func(op, PyRefTracer_DESTROY, data);
122+
}
118123
destruct(op);
119124
}
120125
}
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)