Skip to content
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 some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
(cherry picked from commit b1b61dc)

Co-authored-by: Ken Jin <kenjin@python.org>
  • Loading branch information
Fidget-Spinner authored and miss-islington committed Jun 13, 2024
commit 958ea0766e1b1ef59354e10f2dd793d410b86994
4 changes: 2 additions & 2 deletions Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
}

int res;
LOCK_CODE(code);
_PyEval_StopTheWorld(interp);
if (allocate_instrumentation_data(code)) {
res = -1;
goto done;
Expand All @@ -1994,7 +1994,7 @@ _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEvent
res = force_instrument_lock_held(code, interp);

done:
UNLOCK_CODE();
_PyEval_StartTheWorld(interp);
return res;
}

Expand Down