Skip to content

gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion #131561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Changes from all commits
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
gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion
The `sys_tracing_threads` variable should be read inside LOCK_SETUP().
  • Loading branch information
colesbury committed Mar 21, 2025
commit d035a90d9e2d3e67553f39c87013773370074e98
2 changes: 1 addition & 1 deletion Python/legacy_tracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,10 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) {
return -1;
}
assert(tstate->interp->sys_tracing_threads >= 0);
// needs to be decref'd outside of the lock
PyObject *old_traceobj;
LOCK_SETUP();
assert(tstate->interp->sys_tracing_threads >= 0);
Py_ssize_t tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj);
UNLOCK_SETUP();
Py_XDECREF(old_traceobj);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy