Skip to content

Commit

Permalink
pythongh-117657: Fix some simple races in instrumentation.c (pythonGH…
Browse files Browse the repository at this point in the history
…-120118)

* stop the world when setting local events
  • Loading branch information
Fidget-Spinner authored and noahbkim committed Jul 11, 2024
1 parent 090ed6f commit bdfa241
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 bdfa241

Please sign in to comment.