Title: gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading by zangjiucheng · Pull Request #151768 · python/cpython · GitHub
Open Graph Title: gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading by zangjiucheng · Pull Request #151768 · python/cpython
X Title: gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading by zangjiucheng · Pull Request #151768 · python/cpython
Description: 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. Issue: gh-151644
Open Graph Description: 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 ...
X Description: 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. ...
Opengraph URL: https://github.com/python/cpython/pull/151768
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:104f283a-00e3-967e-7e16-7b328024898e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9E42:2638BB:1C66E7:276E82:6A58411F |
| html-safe-nonce | 5175b8d54ce75e3b35570266c31027f4c24039dd257865b7a95fbd9e453e0afb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTQyOjI2MzhCQjoxQzY2RTc6Mjc2RTgyOjZBNTg0MTFGIiwidmlzaXRvcl9pZCI6IjQ3MjQ1Mjk5MTcwMTY1MDIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8c29b7b96f881a1d2d029a4dc19a41a423686b900add7b804161e187d9ef4113 |
| hovercard-subject-tag | pull_request:3902567616 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/151768/files |
| twitter:image | https://avatars.githubusercontent.com/u/56462380?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/56462380?s=400&v=4 |
| og:image:alt | 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 ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width