mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
[3.13] gh-117657: Fix TSAN reported race in _PyEval_IsGILEnabled. (GH-119921) (#119939)
The GIL may be disabled concurrently with this call so we need to use a
relaxed atomic load.
(cherry picked from commit f3b89a63cb)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
cf8f292a36
commit
9d3de7b0ed
2 changed files with 2 additions and 2 deletions
|
|
@ -145,7 +145,8 @@ extern void _PyEval_ReleaseLock(PyInterpreterState *, PyThreadState *,
|
|||
static inline int
|
||||
_PyEval_IsGILEnabled(PyThreadState *tstate)
|
||||
{
|
||||
return tstate->interp->ceval.gil->enabled != 0;
|
||||
struct _gil_runtime_state *gil = tstate->interp->ceval.gil;
|
||||
return _Py_atomic_load_int_relaxed(&gil->enabled) != 0;
|
||||
}
|
||||
|
||||
// Enable or disable the GIL used by the interpreter that owns tstate, which
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ race_top:list_get_item_ref
|
|||
race_top:make_pending_calls
|
||||
race_top:set_add_entry
|
||||
race_top:should_intern_string
|
||||
race_top:_PyEval_IsGILEnabled
|
||||
race_top:llist_insert_tail
|
||||
race_top:_Py_slot_tp_getattr_hook
|
||||
race_top:add_threadstate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue