Skip to content

Commit a429803

Browse files
committed
Only access interp->sys_tracing_threads within lock
1 parent 3ded9f0 commit a429803

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/legacy_tracing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
522522
static Py_ssize_t
523523
setup_tracing(PyThreadState *tstate, Py_tracefunc func, PyObject *arg, PyObject **old_traceobj)
524524
{
525+
assert(tstate->interp->sys_tracing_threads >= 0);
525526
*old_traceobj = NULL;
526527
/* Setup PEP 669 monitoring callbacks and events. */
527528
if (!tstate->interp->sys_trace_initialized) {
@@ -595,7 +596,6 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
595596
if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) {
596597
return -1;
597598
}
598-
assert(tstate->interp->sys_tracing_threads >= 0);
599599
// needs to be decref'd outside of the lock
600600
PyObject *old_traceobj;
601601
LOCK_SETUP();

0 commit comments

Comments
 (0)