mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-138794: Communicate to PyRefTracer when they are being replaced (#138797)
This commit is contained in:
parent
baf7470515
commit
f01181b595
5 changed files with 54 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue