mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
[3.13] gh-126076: Account for relocated objects in tracemalloc (GH-126077) (#127823)
(cherry picked from commit 30aeb00d36
)
This commit is contained in:
parent
78dfc28ff3
commit
eb692d945e
7 changed files with 18 additions and 25 deletions
|
@ -105,6 +105,14 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc(
|
|||
#define _Py_FatalRefcountError(message) \
|
||||
_Py_FatalRefcountErrorFunc(__func__, (message))
|
||||
|
||||
#define _PyReftracerTrack(obj, operation) \
|
||||
do { \
|
||||
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer; \
|
||||
if (tracer->tracer_func != NULL) { \
|
||||
void *data = tracer->tracer_data; \
|
||||
tracer->tracer_func((obj), (operation), data); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#ifdef Py_REF_DEBUG
|
||||
/* The symbol is only exposed in the API for the sake of extensions
|
||||
|
@ -216,11 +224,7 @@ _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
|
|||
#ifdef Py_TRACE_REFS
|
||||
_Py_ForgetReference(op);
|
||||
#endif
|
||||
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);
|
||||
}
|
||||
_PyReftracerTrack(op, PyRefTracer_DESTROY);
|
||||
destruct(op);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue