mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion (gh-131561)
The `sys_tracing_threads` variable should be read inside `LOCK_SETUP()`.
This commit is contained in:
parent
3e2cceaa87
commit
0de5e0c544
1 changed files with 1 additions and 1 deletions
|
@ -594,10 +594,10 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
|
||||||
if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) {
|
if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
assert(tstate->interp->sys_tracing_threads >= 0);
|
|
||||||
// needs to be decref'd outside of the lock
|
// needs to be decref'd outside of the lock
|
||||||
PyObject *old_traceobj;
|
PyObject *old_traceobj;
|
||||||
LOCK_SETUP();
|
LOCK_SETUP();
|
||||||
|
assert(tstate->interp->sys_tracing_threads >= 0);
|
||||||
Py_ssize_t tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj);
|
Py_ssize_t tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj);
|
||||||
UNLOCK_SETUP();
|
UNLOCK_SETUP();
|
||||||
Py_XDECREF(old_traceobj);
|
Py_XDECREF(old_traceobj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue