summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2024-06-13 09:31:21 (GMT)
committerGitHub <noreply@github.com>2024-06-13 09:31:21 (GMT)
commitb1b61dc4cee43920ef2b08d5ac94ddf08119c507 (patch)
tree90c67b6062c3e9d2db5c44aef544571217421fdc /Python
parenteebae2c460dabdc70dc0d9b6e189368eb1abb716 (diff)
downloadcpython-b1b61dc4cee43920ef2b08d5ac94ddf08119c507.zip
cpython-b1b61dc4cee43920ef2b08d5ac94ddf08119c507.tar.gz
cpython-b1b61dc4cee43920ef2b08d5ac94ddf08119c507.tar.bz2
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
Diffstat (limited to 'Python')
-rw-r--r--Python/instrumentation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index a5211ee..ae790a1 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -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;
@@ -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;
}