mirror of
https://github.com/python/cpython.git
synced 2026-04-13 23:31:02 +00:00
gh-129824: Fix data race on runtime->gilstate.check_enabled (gh-143530)
This commit is contained in:
parent
228d95582e
commit
f11f5ebfe6
2 changed files with 2 additions and 2 deletions
|
|
@ -2435,7 +2435,7 @@ new_interpreter(PyThreadState **tstate_p,
|
|||
|
||||
/* Issue #10915, #15751: The GIL API doesn't work with multiple
|
||||
interpreters: disable PyGILState_Check(). */
|
||||
runtime->gilstate.check_enabled = 0;
|
||||
_Py_atomic_store_int_relaxed(&runtime->gilstate.check_enabled, 0);
|
||||
|
||||
// XXX Might new_interpreter() have been called without the GIL held?
|
||||
PyThreadState *save_tstate = _PyThreadState_GET();
|
||||
|
|
|
|||
|
|
@ -2832,7 +2832,7 @@ int
|
|||
PyGILState_Check(void)
|
||||
{
|
||||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
if (!runtime->gilstate.check_enabled) {
|
||||
if (!_Py_atomic_load_int_relaxed(&runtime->gilstate.check_enabled)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue