Files
cpython/Python
9fcebd38b5 [3.15] gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768) (#153790)
gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768)

In free-threading builds, concurrent calls to sys.getdlopenflags() and
sys.setdlopenflags() race on interp->imports.dlopenflags.  Fix by
using FT_ATOMIC_LOAD_INT_RELAXED / FT_ATOMIC_STORE_INT_RELAXED in
_PyImport_GetDLOpenFlags and _PyImport_SetDLOpenFlags, consistent with
how analogous interpreter-state integer fields (lazy_imports_mode,
pystats_enabled) are protected.

Relaxed ordering is correct here: dlopenflags is a standalone config
integer with no ordering relationship to other memory.
(cherry picked from commit cde31ec135)

Co-authored-by: Jiucheng(Oliver) <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
2026-07-16 15:53:07 +05:30
..

Miscellaneous source files for the main Python shared library