Skip to content

Commit

Permalink
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
Browse files Browse the repository at this point in the history
* stop the world when setting local events
  • Loading branch information
Fidget-Spinner authored Jun 13, 2024
1 parent eebae2c commit b1b61dc
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit b1b61dc

Please sign in to comment.