https://github.com/python/cpython/commit/b1b61dc4cee43920ef2b08d5ac94ddf08119c507
commit: b1b61dc4cee43920ef2b08d5ac94ddf08119c507
branch: main
author: Ken Jin <ken...@python.org>
committer: Fidget-Spinner <kenjin4...@gmail.com>
date: 2024-06-13T17:31:21+08:00
summary:

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

* stop the world when setting local events

files:
M Python/instrumentation.c

diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index a5211ee5428cf8..ae790a1441b933 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;
 }
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to