Skip to content

Commit b1b61dc

Browse files
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
1 parent eebae2c commit b1b61dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/instrumentation.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
19771977
}
19781978

19791979
int res;
1980-
LOCK_CODE(code);
1980+
_PyEval_StopTheWorld(interp);
19811981
if (allocate_instrumentation_data(code)) {
19821982
res = -1;
19831983
goto done;
@@ -1994,7 +1994,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
19941994
res = force_instrument_lock_held(code, interp);
19951995

19961996
done:
1997-
UNLOCK_CODE();
1997+
_PyEval_StartTheWorld(interp);
19981998
return res;
19991999
}
20002000

0 commit comments

Comments
 (0)