diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-13 10:23:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 10:23:19 (GMT) |
commit | 17188270b6e6671ab721235745ad9f3ab0a7a8d8 (patch) | |
tree | 32e6f9669475b54f887a4bf7f18dd29a2458fe4f | |
parent | 3067c62a34eb0a99a01af3e9edaaf082fb7fa0a2 (diff) | |
download | cpython-17188270b6e6671ab721235745ad9f3ab0a7a8d8.zip cpython-17188270b6e6671ab721235745ad9f3ab0a7a8d8.tar.gz cpython-17188270b6e6671ab721235745ad9f3ab0a7a8d8.tar.bz2 |
[3.13] gh-117657: Fix some simple races in instrumentation.c (GH-120118) (#120444)
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
(cherry picked from commit b1b61dc4cee43920ef2b08d5ac94ddf08119c507)
Co-authored-by: Ken Jin <kenjin@python.org>
-rw-r--r-- | Python/instrumentation.c | 4 |
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; } |