René's URL Explorer Experiment


Title: Possible data race in `dictiter_iternext` with with free-threading build · Issue #148873 · python/cpython · GitHub

Open Graph Title: Possible data race in `dictiter_iternext` with with free-threading build · Issue #148873 · python/cpython

X Title: Possible data race in `dictiter_iternext` with with free-threading build · Issue #148873 · python/cpython

Description: Bug description: With free-threading, it is possible to read di->di_dict, while it is being written. cpython/Objects/dictobject.c Lines 5611 to 5615 in f93834f static PyObject* dictiter_iternextkey(PyObject *self) { dictiterobject *di = ...

Open Graph Description: Bug description: With free-threading, it is possible to read di->di_dict, while it is being written. cpython/Objects/dictobject.c Lines 5611 to 5615 in f93834f static PyObject* dictiter_iternextkey...

X Description: Bug description: With free-threading, it is possible to read di->di_dict, while it is being written. cpython/Objects/dictobject.c Lines 5611 to 5615 in f93834f static PyObject* dictiter_iternext...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible data race in `dictiter_iternext` with with free-threading build","articleBody":"### Bug description:\n\nWith free-threading, it is possible to read `di->di_dict`, while it is being written.\n\nhttps://github.com/python/cpython/blob/f93834ff01128774532c101c574e47c6c0418540/Objects/dictobject.c#L5611-L5615\n\nhttps://github.com/python/cpython/blob/f93834ff01128774532c101c574e47c6c0418540/Objects/dictobject.c#L5848-L5862\n\nReproducer: \n```python\nimport threading\n\nd = {str(i): i for i in range(1000)}\nit = iter(d)\n\nbarrier = threading.Barrier(2)\n\n\ndef run():\n    barrier.wait()\n    for _ in range(10000):\n        try:\n            next(it)\n        except StopIteration:\n            pass\n\n\nt1 = threading.Thread(target=run)\nt2 = threading.Thread(target=run)\nt1.start()\nt2.start()\nt1.join()\nt2.join()\n```\n\nTSAN report:\n```\nWARNING: ThreadSanitizer: data race (pid=2919507)\n  Write of size 8 at 0x7fffb66d6bf0 by thread T2:\n    #0 dictiter_iternextitem_lock_held /cpython/Objects/dictobject.c:5859:17 (python3.15t+0x2ada61) \n    #1 dictiter_iternext_threadsafe /cpython/Objects/dictobject.c:5995:11 (python3.15t+0x2ada61)\n    #2 dictiter_iternextkey /cpython/Objects/dictobject.c:5622:9 (python3.15t+0x2a2211) \n    #3 builtin_next /cpython/Python/bltinmodule.c:1764:11 (python3.15t+0x423b62) \n    #4 _Py_BuiltinCallFast_StackRef /cpython/Python/ceval.c:824:11 (python3.15t+0x43223d) \n    #5 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2409:35 (python3.15t+0x43223d)\n    #6 _PyEval_EvalFrame /cpython/./Include/internal/pycore_ceval.h:118:16 (python3.15t+0x429900) \n    #7 _PyEval_Vector /cpython/Python/ceval.c:2124:12 (python3.15t+0x429900)\n    #8 _PyFunction_Vectorcall /cpython/Objects/call.c (python3.15t+0x21131f) \n    #9 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x212e59) \n    #10 _PyObject_VectorcallPrepend /cpython/Objects/call.c:855:20 (python3.15t+0x212e59)\n    #11 method_vectorcall /cpython/Objects/classobject.c:55:12 (python3.15t+0x21638f) \n    #12 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x481401) \n    #13 context_run /cpython/Python/context.c:727:29 (python3.15t+0x481401)\n    #14 method_vectorcall_FASTCALL_KEYWORDS /cpython/Objects/descrobject.c:421:24 (python3.15t+0x22b067) \n    #15 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x210ca3) \n    #16 PyObject_Vectorcall /cpython/Objects/call.c:327:12 (python3.15t+0x210ca3)\n    #17 _Py_VectorCallInstrumentation_StackRefSteal /cpython/Python/ceval.c:775:11 (python3.15t+0x42a52c) \n    #18 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:1846:35 (python3.15t+0x43031e) \n    #19 _PyEval_EvalFrame /cpython/./Include/internal/pycore_ceval.h:118:16 (python3.15t+0x429900) \n    #20 _PyEval_Vector /cpython/Python/ceval.c:2124:12 (python3.15t+0x429900)\n    #21 _PyFunction_Vectorcall /cpython/Objects/call.c (python3.15t+0x21131f) \n    #22 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x212e59) \n    #23 _PyObject_VectorcallPrepend /cpython/Objects/call.c:855:20 (python3.15t+0x212e59)\n    #24 method_vectorcall /cpython/Objects/classobject.c:55:12 (python3.15t+0x21638f) \n    #25 _PyVectorcall_Call /cpython/Objects/call.c:273:16 (python3.15t+0x210fab) \n    #26 _PyObject_Call /cpython/Objects/call.c:348:16 (python3.15t+0x210fab)\n    #27 PyObject_Call /cpython/Objects/call.c:373:12 (python3.15t+0x211015) \n    #28 thread_run /cpython/./Modules/_threadmodule.c:388:21 (python3.15t+0x606be2) \n    #29 pythread_wrapper /cpython/Python/thread_pthread.h:234:5 (python3.15t+0x536447) \n\n  Previous read of size 8 at 0x7fffb66d6bf0 by thread T1:\n    #0 dictiter_iternextkey /cpython/Objects/dictobject.c:5615:27 (python3.15t+0x2a21f9) \n    #1 builtin_next /cpython/Python/bltinmodule.c:1764:11 (python3.15t+0x423b62) \n    #2 _Py_BuiltinCallFast_StackRef /cpython/Python/ceval.c:824:11 (python3.15t+0x43223d) \n    #3 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2409:35 (python3.15t+0x43223d)\n    #4 _PyEval_EvalFrame /cpython/./Include/internal/pycore_ceval.h:118:16 (python3.15t+0x429900) \n    #5 _PyEval_Vector /cpython/Python/ceval.c:2124:12 (python3.15t+0x429900)\n    #6 _PyFunction_Vectorcall /cpython/Objects/call.c (python3.15t+0x21131f) \n    #7 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x212e59) \n    #8 _PyObject_VectorcallPrepend /cpython/Objects/call.c:855:20 (python3.15t+0x212e59)\n    #9 method_vectorcall /cpython/Objects/classobject.c:55:12 (python3.15t+0x21638f) \n    #10 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x481401) \n    #11 context_run /cpython/Python/context.c:727:29 (python3.15t+0x481401)\n    #12 method_vectorcall_FASTCALL_KEYWORDS /cpython/Objects/descrobject.c:421:24 (python3.15t+0x22b067) \n    #13 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x210ca3) \n    #14 PyObject_Vectorcall /cpython/Objects/call.c:327:12 (python3.15t+0x210ca3)\n    #15 _Py_VectorCallInstrumentation_StackRefSteal /cpython/Python/ceval.c:775:11 (python3.15t+0x42a52c) \n    #16 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:1846:35 (python3.15t+0x43031e) \n    #17 _PyEval_EvalFrame /cpython/./Include/internal/pycore_ceval.h:118:16 (python3.15t+0x429900) \n    #18 _PyEval_Vector /cpython/Python/ceval.c:2124:12 (python3.15t+0x429900)\n    #19 _PyFunction_Vectorcall /cpython/Objects/call.c (python3.15t+0x21131f) \n    #20 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11 (python3.15t+0x212e59) \n    #21 _PyObject_VectorcallPrepend /cpython/Objects/call.c:855:20 (python3.15t+0x212e59)\n    #22 method_vectorcall /cpython/Objects/classobject.c:55:12 (python3.15t+0x21638f) \n    #23 _PyVectorcall_Call /cpython/Objects/call.c:273:16 (python3.15t+0x210fab) \n    #24 _PyObject_Call /cpython/Objects/call.c:348:16 (python3.15t+0x210fab)\n    #25 PyObject_Call /cpython/Objects/call.c:373:12 (python3.15t+0x211015) \n    #26 thread_run /cpython/./Modules/_threadmodule.c:388:21 (python3.15t+0x606be2) \n    #27 pythread_wrapper /cpython/Python/thread_pthread.h:234:5 (python3.15t+0x536447) \n```\n\n### CPython versions tested on:\n\nPython 3.15.0a8+ free-threading build (heads/main:f93834ff011, Apr 22 2026, 11:41:06)\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/Naserume","@type":"Person","name":"Naserume"},"datePublished":"2026-04-22T11:47:53Z","url":"https://github.com/python/cpython/issues/148873"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:75cd4cfb-f5e4-e592-de13-5b42950782b5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBEA6:3DCD28:1773FA9:1F11993:6B020988
html-safe-nonce81d7dddebe7b4bc13d53c272670c74e731afa5fe371fb9b4f6068647e7f97ab9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUE2OjNEQ0QyODoxNzczRkE5OjFGMTE5OTM6NkIwMjA5ODgiLCJ2aXNpdG9yX2lkIjoiNjExMzc2ODQ5NjQ1MzQxMDY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac746a45c3e64afcb9349fbde27cb3660283342323399b7b5b2694a61ed75e864f
hovercard-subject-tagissue:4308758061
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/148873/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ece90a8bc30a8c61e61b2064e5159bb722203d825ef99c16d7710521180b0e38/python/cpython/issues/148873
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ece90a8bc30a8c61e61b2064e5159bb722203d825ef99c16d7710521180b0e38/python/cpython/issues/148873
og:image:altBug description: With free-threading, it is possible to read di->di_dict, while it is being written. cpython/Objects/dictobject.c Lines 5611 to 5615 in f93834f static PyObject* dictiter_iternextkey...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNaserume
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/148873#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F148873
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F148873
Sign uphttps://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/148873
Reloadhttps://github.com/python/cpython/issues/148873
Reloadhttps://github.com/python/cpython/issues/148873
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/148873
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/148873
Possible data race in dictiter_iternext with with free-threading buildhttps://github.com/python/cpython/issues/148873#top
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 Apr 22, 2026https://github.com/python/cpython/issues/148873#issue-4308758061
cpython/Objects/dictobject.chttps://github.com/python/cpython/blob/f93834ff01128774532c101c574e47c6c0418540/Objects/dictobject.c#L5611-L5615
f93834fhttps://github.com/python/cpython/commit/f93834ff01128774532c101c574e47c6c0418540
cpython/Objects/dictobject.chttps://github.com/python/cpython/blob/f93834ff01128774532c101c574e47c6c0418540/Objects/dictobject.c#L5848-L5862
f93834fhttps://github.com/python/cpython/commit/f93834ff01128774532c101c574e47c6c0418540
Naserumehttps://github.com/Naserume
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Apr 22, 2026https://github.com/python/cpython/issues/148873#event-24753776718
Naserumehttps://github.com/Naserume
on Apr 22, 2026https://github.com/python/cpython/issues/148873#event-24753835164
sergey-miryanovhttps://github.com/sergey-miryanov
duplicatehttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Aduplicate
Sequence iterator thread-safety #120496https://github.com/python/cpython/issues/120496
on Apr 22, 2026https://github.com/python/cpython/issues/148873#event-24753873484
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/148873
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/148873
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.