| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…nder free-threading 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. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks @zangjiucheng for the PR, and @nascheme for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
|
Thanks @zangjiucheng for the PR, and @nascheme for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
|
GH-153789 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
|
GH-153790 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
…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 cde31ec) Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…under free-threading (gh-151768) (gh-153789) 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 cde31ec) Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
In free-threading builds, concurrent calls to sys.getdlopenflags() and
sys.setdlopenflags() race on interp->imports.dlopenflags — a plain int
field read and written with no synchronisation.
Fix
Replace the bare load/store in _PyImport_GetDLOpenFlags /
_PyImport_SetDLOpenFlags with FT_ATOMIC_LOAD_INT_RELAXED /
FT_ATOMIC_STORE_INT_RELAXED.
Atomics are preferred over PyMutex (used for the analogou
because each access is a single load or store — no multi-field consistency
guarantee is needed. Relaxed ordering is correct: dlopenfl standalone config integer with no ordering relationship to other memory, consistent with how lazy_imports_modeandpystats_enable
in the same file.