Skip to content

Commit b04003c

Browse files
committed
gh-129824: Fix data race on runtime->gilstate.check_enabled
The new_interpreter() function can be called concurrently.
1 parent 9a3263f commit b04003c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ new_interpreter(PyThreadState **tstate_p,
24352435

24362436
/* Issue #10915, #15751: The GIL API doesn't work with multiple
24372437
interpreters: disable PyGILState_Check(). */
2438-
runtime->gilstate.check_enabled = 0;
2438+
_Py_atomic_store_int_relaxed(&runtime->gilstate.check_enabled, 0);
24392439

24402440
// XXX Might new_interpreter() have been called without the GIL held?
24412441
PyThreadState *save_tstate = _PyThreadState_GET();

0 commit comments

Comments
 (0)