René's URL Explorer Experiment


Title: Data race creating `types.GenericAlias.__parameters__` lazily under free-threading · Issue #153298 · python/cpython · GitHub

Open Graph Title: Data race creating `types.GenericAlias.__parameters__` lazily under free-threading · Issue #153298 · python/cpython

X Title: Data race creating `types.GenericAlias.__parameters__` lazily under free-threading · Issue #153298 · python/cpython

Description: Bug report Bug description: In the free-threaded build, reading __parameters__ on a shared types.GenericAlias (e.g. list[T]) from multiple threads races on the lazy creation of the cached parameters tuple. ga_parameters checks and fills ...

Open Graph Description: Bug report Bug description: In the free-threaded build, reading __parameters__ on a shared types.GenericAlias (e.g. list[T]) from multiple threads races on the lazy creation of the cached parameter...

X Description: Bug report Bug description: In the free-threaded build, reading __parameters__ on a shared types.GenericAlias (e.g. list[T]) from multiple threads races on the lazy creation of the cached parameter...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Data race creating `types.GenericAlias.__parameters__` lazily under free-threading","articleBody":"# Bug report\n\n### Bug description:\n\nIn the free-threaded build, reading `__parameters__` on a shared `types.GenericAlias` (e.g. `list[T]`) from multiple threads races on the lazy creation of the cached `parameters` tuple. \n`ga_parameters` checks and fills `alias->parameters` with plain accesses.\n\nhttps://github.com/python/cpython/blob/a74280e6696125acb7628facc577d0f975c4d69e/Objects/genericaliasobject.c#L843-L853\n\nTwo threads that both observe `parameters == NULL` both compute and store the tuple, racing on the cache pointer.\n\nReproducer:\n```python\nfrom threading import Thread\nfrom typing import TypeVar\n\nT = TypeVar('T')\nslot = [list[T]]\n\ndef thread1():\n    for _ in range(20000):\n        try:\n            _ = slot[0].__parameters__\n        except Exception:\n            pass\n\ndef thread2():\n    for _ in range(20000):\n        slot[0] = list[T]            # fresh GenericAlias (parameters == NULL)\n\nthreads  = [Thread(target=thread1)  for _ in range(6)]\nthreads += [Thread(target=thread2) for _ in range(2)]\nfor t in threads: t.start()\nfor t in threads: t.join()\n```\n\nTSAN Report:\n```\n==================\nWARNING: ThreadSanitizer: data race (pid=48591)\n  Write of size 8 at 0x7fffd00d0580 by thread T4:\n    #0 ga_parameters /cpython/Objects/genericaliasobject.c:848:27 \n    #1 getset_get /cpython/Objects/descrobject.c:194:16 \n    #2 _PyObject_GenericGetAttrWithDict /cpython/Objects/object.c:1926:19 \n    #3 PyObject_GenericGetAttr /cpython/Objects/object.c:2012:12 \n    #4 ga_getattro /cpython/Objects/genericaliasobject.c:708:12 \n    #5 _PyObject_GetAttrStackRef /cpython/Objects/object.c:1369:18 \n    #6 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:8786:28 \n...\n\n  Previous read of size 8 at 0x7fffd00d0580 by thread T3:\n    #0 ga_parameters /cpython/Objects/genericaliasobject.c:847:16 \n    #1 getset_get /cpython/Objects/descrobject.c:194:16 \n    #2 _PyObject_GenericGetAttrWithDict /cpython/Objects/object.c:1926:19 \n    #3 PyObject_GenericGetAttr /cpython/Objects/object.c:2012:12  \n    #4 ga_getattro /cpython/Objects/genericaliasobject.c:708:12 \n    #5 _PyObject_GetAttrStackRef /cpython/Objects/object.c:1369:18 \n    #6 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:8786:28 \n...\n\nSUMMARY: ThreadSanitizer: data race /cpython/Objects/genericaliasobject.c:848:27 in ga_parameters\n==================\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-153318\n* gh-153345\n* gh-153346\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/Naserume","@type":"Person","name":"Naserume"},"datePublished":"2026-07-07T21:51:29Z","url":"https://github.com/python/cpython/issues/153298"}

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:b94a95d7-974e-b9b9-fcd9-a5fe99277897
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAEEA:1087D4:368C84E:48DA71C:6B0214A7
html-safe-noncec98d17321ffeef22fd13deb40b84c2f09acd898eccc95b0fe88fcc0028de29aa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUVBOjEwODdENDozNjhDODRFOjQ4REE3MUM6NkIwMjE0QTciLCJ2aXNpdG9yX2lkIjoiMTU1MjA0ODE2NTc2OTg0Mzg3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca89793e17f6b00794ac4717a0accb6da904645abf32426a9108bae841861f4f1
hovercard-subject-tagissue:4832500494
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/153298/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b01bbadc87798c76dbdfb609c082abd60767521cc256a4267ad6515cbe74ca6/python/cpython/issues/153298
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b01bbadc87798c76dbdfb609c082abd60767521cc256a4267ad6515cbe74ca6/python/cpython/issues/153298
og:image:altBug report Bug description: In the free-threaded build, reading __parameters__ on a shared types.GenericAlias (e.g. list[T]) from multiple threads races on the lazy creation of the cached parameter...
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/153298#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F153298
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%2F153298
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/153298
Reloadhttps://github.com/python/cpython/issues/153298
Reloadhttps://github.com/python/cpython/issues/153298
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/153298
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/153298
Data race creating types.GenericAlias.__parameters__ lazily under free-threadinghttps://github.com/python/cpython/issues/153298#top
https://github.com/sobolevn
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
topic-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%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 Jul 7, 2026https://github.com/python/cpython/issues/153298#issue-4832500494
cpython/Objects/genericaliasobject.chttps://github.com/python/cpython/blob/a74280e6696125acb7628facc577d0f975c4d69e/Objects/genericaliasobject.c#L843-L853
a74280ehttps://github.com/python/cpython/commit/a74280e6696125acb7628facc577d0f975c4d69e
gh-153298: Fix data race in GenericAlias parameter initialization on FT #153318https://github.com/python/cpython/pull/153318
[3.15] gh-153298: Fix data race in GenericAlias parameter initialization on FT (GH-153318) #153345https://github.com/python/cpython/pull/153345
[3.14] gh-153298: Fix data race in GenericAlias parameter initialization on FT (GH-153318) #153346https://github.com/python/cpython/pull/153346
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 Jul 7, 2026https://github.com/python/cpython/issues/153298#event-27687331468
aiskhttps://github.com/aisk
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Jul 8, 2026https://github.com/python/cpython/issues/153298#event-27696635134
sobolevnhttps://github.com/sobolevn
topic-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%22
on Jul 8, 2026https://github.com/python/cpython/issues/153298#event-27708676628
sobolevnhttps://github.com/sobolevn
on Jul 8, 2026https://github.com/python/cpython/issues/153298#event-27708676959
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Jul 8, 2026https://github.com/python/cpython/issues/153298#issuecomment-4913594160
sobolevnhttps://github.com/sobolevn
on Jul 8, 2026https://github.com/python/cpython/issues/153298#event-27721745271
gh-153298: Fix data race in `GenericAlias` parameter initialization o…https://github.com/python/cpython/commit/68abf17fa926db94dc17f01a7095bdcee2a52314
gh-153298https://github.com/python/cpython/issues/153298
68abf17https://github.com/python/cpython/commit/68abf17fa926db94dc17f01a7095bdcee2a52314
[3.14] gh-153298: Fix data race in `GenericAlias` parameter initializ…https://github.com/python/cpython/commit/3d8f2aa8fda5a420d546ad216dd25baebdeaee82
gh-153298https://github.com/python/cpython/issues/153298
3d8f2aahttps://github.com/python/cpython/commit/3d8f2aa8fda5a420d546ad216dd25baebdeaee82
[3.15] gh-153298: Fix data race in `GenericAlias` parameter initializ…https://github.com/python/cpython/commit/288e3cedd1d5761b132eec9e72d952c3f2bf469b
gh-153298https://github.com/python/cpython/issues/153298
288e3cehttps://github.com/python/cpython/commit/288e3cedd1d5761b132eec9e72d952c3f2bf469b
sobolevnhttps://github.com/sobolevn
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 8, 2026https://github.com/python/cpython/issues/153298#event-27723349604
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/153298
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/153298
sobolevnhttps://github.com/sobolevn
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
topic-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%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.