Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ensure that :c:func:`PyRefTracer_SetTracer` and
:c:func:`PyRefTracer_GetTracer` sync with all existing threads when called
to avoid races in the free threaded build. Patch by Pablo Galindo
Comment thread
pablogsal marked this conversation as resolved.
Outdated
7 changes: 6 additions & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -3286,17 +3286,22 @@ _Py_SetRefcnt(PyObject *ob, Py_ssize_t refcnt)

int PyRefTracer_SetTracer(PyRefTracer tracer, void *data) {
_Py_AssertHoldsTstate();
_PyEval_StopTheWorldAll(&_PyRuntime);
Comment thread
pablogsal marked this conversation as resolved.
_PyRuntime.ref_tracer.tracer_func = tracer;
Comment thread
pablogsal marked this conversation as resolved.
_PyRuntime.ref_tracer.tracer_data = data;
_PyEval_StartTheWorldAll(&_PyRuntime);
Comment thread
pablogsal marked this conversation as resolved.
return 0;
}

PyRefTracer PyRefTracer_GetTracer(void** data) {
_Py_AssertHoldsTstate();
_PyEval_StopTheWorldAll(&_PyRuntime);
Comment thread
pablogsal marked this conversation as resolved.
Outdated
Comment thread
pablogsal marked this conversation as resolved.
Outdated
if (data != NULL) {
*data = _PyRuntime.ref_tracer.tracer_data;
}
return _PyRuntime.ref_tracer.tracer_func;
PyRefTracer tracer = _PyRuntime.ref_tracer.tracer_func;
_PyEval_StartTheWorldAll(&_PyRuntime);
Comment thread
ZeroIntensity marked this conversation as resolved.
Outdated
Comment thread
pablogsal marked this conversation as resolved.
Outdated
return tracer;
}


Expand Down
Loading