Skip to content

Commit d9ac6b3

Browse files
[3.13] gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (GH-125704) (#125705)
gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (GH-125704) (cherry picked from commit f8ba9fb) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent 26f1e88 commit d9ac6b3

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
@@ -216,6 +216,11 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
216216
#ifdef Py_TRACE_REFS
217217
_Py_ForgetReference(op);
218218
#endif
219+
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer;
220+
if (tracer->tracer_func != NULL) {
221+
void* data = tracer->tracer_data;
222+
tracer->tracer_func(op, PyRefTracer_DESTROY, data);
223+
}
219224
destruct(op);
220225
}
221226
}
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)