gh-138794: Communicate to PyRefTracer when they are being replaced (#138797)
This commit is contained in:
committed by
GitHub
parent
baf7470515
commit
f01181b595
@@ -3287,6 +3287,12 @@ _Py_SetRefcnt(PyObject *ob, Py_ssize_t refcnt)
|
||||
|
||||
int PyRefTracer_SetTracer(PyRefTracer tracer, void *data) {
|
||||
_Py_AssertHoldsTstate();
|
||||
if (_PyRuntime.ref_tracer.tracer_func != NULL) {
|
||||
_PyReftracerTrack(NULL, PyRefTracer_TRACKER_REMOVED);
|
||||
if (PyErr_Occurred()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
_PyRuntime.ref_tracer.tracer_func = tracer;
|
||||
_PyRuntime.ref_tracer.tracer_data = data;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user