René's URL Explorer Experiment


Title: _Py_make_parameters recurses without a guard: a self-referential/deeply-nested generic-alias arg crashes the interpreter · Issue #154275 · python/cpython · GitHub

Open Graph Title: _Py_make_parameters recurses without a guard: a self-referential/deeply-nested generic-alias arg crashes the interpreter · Issue #154275 · python/cpython

X Title: _Py_make_parameters recurses without a guard: a self-referential/deeply-nested generic-alias arg crashes the interpreter · Issue #154275 · python/cpython

Description: Crash report What happened? Computing __parameters__ of a generic alias whose argument is a self-referential (or merely very deeply nested) list/tuple crashes the interpreter with a C-stack overflow. _Py_make_parameters (Objects/generica...

Open Graph Description: Crash report What happened? Computing __parameters__ of a generic alias whose argument is a self-referential (or merely very deeply nested) list/tuple crashes the interpreter with a C-stack overflo...

X Description: Crash report What happened? Computing __parameters__ of a generic alias whose argument is a self-referential (or merely very deeply nested) list/tuple crashes the interpreter with a C-stack overflo...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_Py_make_parameters recurses without a guard: a self-referential/deeply-nested generic-alias arg crashes the interpreter","articleBody":"# Crash report\n\n### What happened?\n\nComputing `__parameters__` of a generic alias whose argument is a self-referential (or merely very deeply nested) `list`/`tuple` crashes the interpreter with a C-stack overflow. `_Py_make_parameters` (`Objects/genericaliasobject.c`) recurses into nested `list`/`tuple` args without any recursion guard (`Py_EnterRecursiveCall`), so a cyclic argument recurses forever.\n\nMinimal reproducer:\n\n```python\nL = []\nL.append(L)             # L = [L], self-referential\nlist[L].__parameters__  # SIGSEGV\n```\n\n`list[L]` on its own is fine — `__parameters__` is computed lazily, and the crash is in that computation (anything that triggers it — using the alias as a base class, `typing.get_args()`, etc. — crashes the same way).\n\nA non-cyclic but deeply nested list crashes it too, which shows the path is simply unguarded rather than something cycle-specific:\n\n```python\nx = [0]\nfor _ in range(500_000):\n    x = [x]\nlist[x].__parameters__  # SIGSEGV (C stack overflow)\n```\n\nBacktrace (debug build); the interpreter dies in `_Py_make_parameters` self-recursion at `genericaliasobject.c:231`:\n\n```\n#0  gc_alloc                 Python/gc.c:2013            \u003c- SIGSEGV at the stack guard page\n#1  _PyObject_GC_NewVar      Python/gc.c:2055\n#2  tuple_alloc              Objects/tupleobject.c:57\n#3  PyTuple_FromArray        Objects/tupleobject.c:442\n#4  PyList_AsTuple           Objects/listobject.c:3269\n#5  _Py_make_parameters      Objects/genericaliasobject.c:192\n#6  _Py_make_parameters      Objects/genericaliasobject.c:231   \u003c- unguarded recursion\n#7  _Py_make_parameters      Objects/genericaliasobject.c:231\n    ... (repeats until the C stack overflows) ...\n```\n\n### Analysis\n\n`_Py_make_parameters` collects type parameters from an alias's arguments. For an argument that is a `list`/`tuple` with no `__parameters__`, it recurses into it:\n\n```c\nif (!subparams && (PyTuple_Check(t) || PyList_Check(t))) {\n    // Recursively call _Py_make_parameters for lists/tuples and\n    // add the results to the current parameters.\n    subparams = _Py_make_parameters(t);   // Objects/genericaliasobject.c:231\n    ...\n}\n```\n\nThere is no `Py_EnterRecursiveCall` / `Py_LeaveRecursiveCall` in this function — nor anywhere in `genericaliasobject.c` — so a self-referential argument recurses without bound and overflows the C stack (SIGSEGV) instead of raising `RecursionError`.\n\nFix direction: wrap the recursive descent in `Py_EnterRecursiveCall(...)` / `Py_LeaveRecursiveCall()`, as other recursive C paths do, so the overflow becomes a catchable `RecursionError`.\n\nNot free-threading- or JIT-specific: reproduces on GIL and free-threaded, release and debug builds.\n\n_(Found via fuzzing with [fusil](https://github.com/devdanzin/fusil); the same reproducer also crashes RustPython, whose `make_parameters_from_slice` has the identical unguarded recursion. Reduced and reviewed by hand; draft prepared with Claude Code.)_\n\n\n### CPython versions tested on:\n\n3.14, CPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.16.0a0 (heads/main:a1d580430c8, Jul 18 2026, 20:16:15) [Clang 21.1.8 (6ubuntu1)]\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-154277\n* gh-154306\n* gh-154339\n* gh-154340\n* gh-154341\n* gh-154342\n* gh-154343\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2026-07-20T16:34:38Z","url":"https://github.com/python/cpython/issues/154275"}

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:7466e5b4-8348-4a7e-9563-2f67e2e97e67
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8C46:B53AF:395480B:4C3947B:6B021B48
html-safe-noncedc8cd3d0d40c5c71cccf1ba661e27a276cdd233c3b1d77e271f89ff77d78b051
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzQ2OkI1M0FGOjM5NTQ4MEI6NEMzOTQ3Qjo2QjAyMUI0OCIsInZpc2l0b3JfaWQiOiI0OTQ5MjQwNjQyNjE1MjUzODMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac379bbe2b5b0c6c0ecf393dc15a49e4537657da3bd757710465a0f29e72a17487
hovercard-subject-tagissue:4930973473
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/154275/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6fe76003c9a830a63c54bd51118d0b7c27bb6d468a521e21fe792b8f1bbe000e/python/cpython/issues/154275
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6fe76003c9a830a63c54bd51118d0b7c27bb6d468a521e21fe792b8f1bbe000e/python/cpython/issues/154275
og:image:altCrash report What happened? Computing __parameters__ of a generic alias whose argument is a self-referential (or merely very deeply nested) list/tuple crashes the interpreter with a C-stack overflo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevdanzin
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/154275#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F154275
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%2F154275
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/154275
Reloadhttps://github.com/python/cpython/issues/154275
Reloadhttps://github.com/python/cpython/issues/154275
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/154275
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/154275
_Py_make_parameters recurses without a guard: a self-referential/deeply-nested generic-alias arg crashes the interpreterhttps://github.com/python/cpython/issues/154275#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-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com/devdanzin
devdanzinhttps://github.com/devdanzin
on Jul 20, 2026https://github.com/python/cpython/issues/154275#issue-4930973473
fusilhttps://github.com/devdanzin/fusil
gh-154275: Do not crash on deeply nested __parameters__ in GenericAlias #154277https://github.com/python/cpython/pull/154277
[3.15] gh-154275: Do not crash on deeply nested __parameters__ in GenericAlias (GH-154277) #154306https://github.com/python/cpython/pull/154306
[3.14] gh-154275: Do not crash on deeply nested __parameters__ in GenericAlias (GH-154277) #154339https://github.com/python/cpython/pull/154339
[3.13] gh-154275: Do not crash on deeply nested __parameters__ in GenericAlias (GH-154277) #154340https://github.com/python/cpython/pull/154340
gh-154275: Fix cleanup code in _Py_make_parameters #154341https://github.com/python/cpython/pull/154341
[3.15] gh-154275: Fix cleanup code in _Py_make_parameters (GH-154341) #154342https://github.com/python/cpython/pull/154342
[3.14] gh-154275: Fix cleanup code in _Py_make_parameters (GH-154341) #154343https://github.com/python/cpython/pull/154343
devdanzinhttps://github.com/devdanzin
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
topic-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%22
on Jul 20, 2026https://github.com/python/cpython/issues/154275#event-28223347081
sobolevnhttps://github.com/sobolevn
on Jul 20, 2026https://github.com/python/cpython/issues/154275#event-28223593047
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Jul 20, 2026https://github.com/python/cpython/issues/154275#issuecomment-5024705859
sobolevnhttps://github.com/sobolevn
on Jul 20, 2026https://github.com/python/cpython/issues/154275#event-28237514524
gh-154275: Do not crash on deeply nested `__parameters__` in `Generic…https://github.com/python/cpython/commit/1034e07b7d55642c3a46252e6b0a631c2df588d2
gh-154275https://github.com/python/cpython/issues/154275
1034e07https://github.com/python/cpython/commit/1034e07b7d55642c3a46252e6b0a631c2df588d2
[3.15] gh-154275: Do not crash on deeply nested `__parameters__` in `…https://github.com/python/cpython/commit/d1494f022d2750514c273ab3733f7dd73e7e6fd9
gh-154275https://github.com/python/cpython/issues/154275
d1494f0https://github.com/python/cpython/commit/d1494f022d2750514c273ab3733f7dd73e7e6fd9
[3.14] gh-154275: Do not crash on deeply nested `__parameters__` in `…https://github.com/python/cpython/commit/40657ad12eb76581b8c25ae5ec389de55fc1ba34
gh-154275https://github.com/python/cpython/issues/154275
40657adhttps://github.com/python/cpython/commit/40657ad12eb76581b8c25ae5ec389de55fc1ba34
pythongh-154275: Fix cleanup code in `_Py_make_parameters`https://github.com/sobolevn/cpython/commit/4266cd4da71bec5c7fdb8a6d759cafbbabb8d3f3
pythongh-154275https://github.com/python/cpython/issues/154275
4266cd4https://github.com/sobolevn/cpython/commit/4266cd4da71bec5c7fdb8a6d759cafbbabb8d3f3
gh-154275: Fix cleanup code in `_Py_make_parameters` (#154341)https://github.com/python/cpython/commit/196e16d54f9f06f566c52e7bca3b5213a8a64223
gh-154275https://github.com/python/cpython/issues/154275
#154341https://github.com/python/cpython/pull/154341
196e16dhttps://github.com/python/cpython/commit/196e16d54f9f06f566c52e7bca3b5213a8a64223
[3.13] gh-154275: Do not crash on deeply nested `__parameters__` in `…https://github.com/python/cpython/commit/09424550211089b059ff9ca255ee2e7e9aacc866
gh-154275https://github.com/python/cpython/issues/154275
0942455https://github.com/python/cpython/commit/09424550211089b059ff9ca255ee2e7e9aacc866
[3.14] gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341)…https://github.com/python/cpython/commit/e1eb9e882edf65341689ca4cfca7f31c4038d03d
gh-154275https://github.com/python/cpython/issues/154275
GH-154341https://github.com/python/cpython/pull/154341
e1eb9e8https://github.com/python/cpython/commit/e1eb9e882edf65341689ca4cfca7f31c4038d03d
[3.15] gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341)…https://github.com/python/cpython/commit/b3e046cdb4e9ac869b77022579d47ddb848c4fda
gh-154275https://github.com/python/cpython/issues/154275
GH-154341https://github.com/python/cpython/pull/154341
b3e046chttps://github.com/python/cpython/commit/b3e046cdb4e9ac869b77022579d47ddb848c4fda
sobolevnhttps://github.com/sobolevn
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 21, 2026https://github.com/python/cpython/issues/154275#event-28264123521
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/154275
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/154275
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-typinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-typing%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%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.