gh-117657: Fix some simple races in instrumentation.c (GH-120118)

* stop the world when setting local events
This commit is contained in:
Ken Jin 2024-06-13 17:31:21 +08:00 committed by GitHub
parent eebae2c460
commit b1b61dc4ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -1977,7 +1977,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
} }
int res; int res;
LOCK_CODE(code); _PyEval_StopTheWorld(interp);
if (allocate_instrumentation_data(code)) { if (allocate_instrumentation_data(code)) {
res = -1; res = -1;
goto done; goto done;
@ -1994,7 +1994,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
res = force_instrument_lock_held(code, interp); res = force_instrument_lock_held(code, interp);
done: done:
UNLOCK_CODE(); _PyEval_StartTheWorld(interp);
return res; return res;
} }