René's URL Explorer Experiment


Title: Data race in `_PyImport_SetDLOpenFlags` when `sys.setdlopenflags()` is called concurrently · Issue #151644 · python/cpython · GitHub

Open Graph Title: Data race in `_PyImport_SetDLOpenFlags` when `sys.setdlopenflags()` is called concurrently · Issue #151644 · python/cpython

X Title: Data race in `_PyImport_SetDLOpenFlags` when `sys.setdlopenflags()` is called concurrently · Issue #151644 · python/cpython

Description: Bug report Bug description: In the free-threaded build, calling sys.setdlopenflags() concurrently from multiple threads (or concurrently with sys.getdlopenflags()) data-races on the per-interpreter dlopenflags field: _PyImport_GetDLOpenF...

Open Graph Description: Bug report Bug description: In the free-threaded build, calling sys.setdlopenflags() concurrently from multiple threads (or concurrently with sys.getdlopenflags()) data-races on the per-interpreter...

X Description: Bug report Bug description: In the free-threaded build, calling sys.setdlopenflags() concurrently from multiple threads (or concurrently with sys.getdlopenflags()) data-races on the per-interpreter...

Opengraph URL: https://github.com/python/cpython/issues/151644

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Data race in `_PyImport_SetDLOpenFlags` when `sys.setdlopenflags()` is called concurrently","articleBody":"# Bug report\n\n### Bug description:\n\nIn the free-threaded build, calling `sys.setdlopenflags()` concurrently from multiple threads (or concurrently with `sys.getdlopenflags()`) data-races on the per-interpreter `dlopenflags` field: `_PyImport_GetDLOpenFlags` / `_PyImport_SetDLOpenFlags` read and write `(interp)-\u003eimports.dlopenflags` with no atomics or lock.\n\nhttps://github.com/python/cpython/blob/9e863fab283eddca9c2a8f9d1ee30f4dc243e314/Python/import.c#L908-L918\n\n`sys.setdlopenflags()` / `sys.getdlopenflags()` expose these directly, so concurrent calls produce a non-atomic write/write (and read/write) race on the field.\n\nReproducer:\n```python\nimport sys\nfrom threading import Thread, Barrier\n\nN = 12\nbarrier = Barrier(N)\n\ndef worker():\n    barrier.wait()\n    for _ in range(20000):\n        d = sys.getdlopenflags()\n        sys.setdlopenflags(d)\n\nif __name__ == \"__main__\":\n    threads = [Thread(target=worker) for _ in range(N)]\n    for t in threads: t.start()\n    for t in threads: t.join()\n```\n\nTSAN Report:\n```\n==================\nWARNING: ThreadSanitizer: data race (pid=2296999)\n  Read of size 4 at 0x555555e3f648 by thread T1:\n    #0 _PyImport_GetDLOpenFlags /cpython/Python/import.c:911:12 \n    #1 sys_getdlopenflags_impl /cpython/./Python/sysmodule.c:1838:13 \n    #2 sys_getdlopenflags /cpython/./Python/clinic/sysmodule.c.h:823:12 \n    #3 cfunction_vectorcall_NOARGS /cpython/Objects/methodobject.c:508:24 \n    #4 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 \n    #5 PyObject_Vectorcall /cpython/Objects/call.c:327:12 \n    #6 _Py_VectorCallInstrumentation_StackRefSteal /cpython/Python/ceval.c:768:11 \n    #7 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:1846:35 \n    ...\n\n  Previous write of size 4 at 0x555555e3f648 by thread T12:\n    #0 _PyImport_SetDLOpenFlags /cpython/Python/import.c:917:25 \n    #1 sys_setdlopenflags_impl /cpython/./Python/sysmodule.c:1819:5 \n    #2 sys_setdlopenflags /cpython/./Python/clinic/sysmodule.c.h:796:20 \n    #3 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2612:35 \n    ...\n\n  Location is global '_PyRuntime' of size 405824 at 0x555555e16c80 \n\nSUMMARY: ThreadSanitizer: data race /cpython/Python/import.c:911:12 in _PyImport_GetDLOpenFlags\n==================\n==================\nWARNING: ThreadSanitizer: data race (pid=2296999)\n  Write of size 4 at 0x555555e3f648 by thread T12:\n    #0 _PyImport_SetDLOpenFlags /cpython/Python/import.c:917:25 \n    #1 sys_setdlopenflags_impl /cpython/./Python/sysmodule.c:1819:5 \n    #2 sys_setdlopenflags /cpython/./Python/clinic/sysmodule.c.h:796:20 \n    #3 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2612:35 \n    ...\n\n  Previous write of size 4 at 0x555555e3f648 by thread T9:\n    #0 _PyImport_SetDLOpenFlags /cpython/Python/import.c:917:25 \n    #1 sys_setdlopenflags_impl /cpython/./Python/sysmodule.c:1819:5 \n    #2 sys_setdlopenflags /cpython/./Python/clinic/sysmodule.c.h:796:20 \n    #3 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2612:35 \n    ...\n\n  Location is global '_PyRuntime' of size 405824 at 0x555555e16c80 \n\nSUMMARY: ThreadSanitizer: data race /cpython/Python/import.c:917:25 in _PyImport_SetDLOpenFlags\n==================\n```\n\n### CPython versions tested on:\n\n3.16\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-151768\n* gh-153789\n* gh-153790\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Naserume","@type":"Person","name":"Naserume"},"datePublished":"2026-06-18T11:09:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/151644/cpython/issues/151644"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1a115a5d-2150-dfa5-95f7-4dba096f8b67
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8856:1FD712:12F9A20:1B788CD:6A58ABFE
html-safe-nonce178976b4014960aea44a2559b3af5a0745bf85e7fdce5eb0c96fc800920112ec
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODU2OjFGRDcxMjoxMkY5QTIwOjFCNzg4Q0Q6NkE1OEFCRkUiLCJ2aXNpdG9yX2lkIjoiNjQ1ODExODIzMDU2NTc1OTk5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac29df9fa89d32ec1195c3e0db95831f05b4f7f2acad07532c687b2e28d495c566
hovercard-subject-tagissue:4691776235
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/151644/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bac8cdec08fdcf9ad9068728107129a168492a88fbe458f525c9aef646d503f3/python/cpython/issues/151644
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bac8cdec08fdcf9ad9068728107129a168492a88fbe458f525c9aef646d503f3/python/cpython/issues/151644
og:image:altBug report Bug description: In the free-threaded build, calling sys.setdlopenflags() concurrently from multiple threads (or concurrently with sys.getdlopenflags()) data-races on the per-interpreter...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNaserume
hostnamegithub.com
expected-hostnamegithub.com
None5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/151644#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151644
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151644
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/151644
Reloadhttps://github.com/python/cpython/issues/151644
Reloadhttps://github.com/python/cpython/issues/151644
Please reload this pagehttps://github.com/python/cpython/issues/151644
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/151644
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Data race in _PyImport_SetDLOpenFlags when sys.setdlopenflags() is called concurrentlyhttps://github.com/python/cpython/issues/151644#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/Naserume
Naserumehttps://github.com/Naserume
on Jun 18, 2026https://github.com/python/cpython/issues/151644#issue-4691776235
cpython/Python/import.chttps://github.com/python/cpython/blob/9e863fab283eddca9c2a8f9d1ee30f4dc243e314/Python/import.c#L908-L918
9e863fahttps://github.com/python/cpython/commit/9e863fab283eddca9c2a8f9d1ee30f4dc243e314
gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading #151768https://github.com/python/cpython/pull/151768
[3.14] gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768) #153789https://github.com/python/cpython/pull/153789
[3.15] gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768) #153790https://github.com/python/cpython/pull/153790
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.