Skip to content

Commit f8ba9fb

Browse files
authored
gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (#125704)
1 parent 6d93690 commit f8ba9fb

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
@@ -208,6 +208,11 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
208208
#ifdef Py_TRACE_REFS
209209
_Py_ForgetReference(op);
210210
#endif
211+
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer;
212+
if (tracer->tracer_func != NULL) {
213+
void* data = tracer->tracer_data;
214+
tracer->tracer_func(op, PyRefTracer_DESTROY, data);
215+
}
211216
destruct(op);
212217
}
213218
}
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)