René's URL Explorer Experiment


Title: PyErr_GivenExceptionMatches crashes with SIGSEGV on deeply nested tuple targets · Issue #156204 · python/cpython · GitHub

Open Graph Title: PyErr_GivenExceptionMatches crashes with SIGSEGV on deeply nested tuple targets · Issue #156204 · python/cpython

X Title: PyErr_GivenExceptionMatches crashes with SIGSEGV on deeply nested tuple targets · Issue #156204 · python/cpython

Description: Crash report What happened? Problem Description PyErr_GivenExceptionMatches(err, exc) in Python/errors.c recursively iterates through nested tuple exception targets without guarding recursion depth via Py_EnterRecursiveCall() / Py_LeaveR...

Open Graph Description: Crash report What happened? Problem Description PyErr_GivenExceptionMatches(err, exc) in Python/errors.c recursively iterates through nested tuple exception targets without guarding recursion depth...

X Description: Crash report What happened? Problem Description PyErr_GivenExceptionMatches(err, exc) in Python/errors.c recursively iterates through nested tuple exception targets without guarding recursion depth...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PyErr_GivenExceptionMatches crashes with SIGSEGV on deeply nested tuple targets","articleBody":"# Crash report\n\n### What happened?\n\n### Problem Description\n\n`PyErr_GivenExceptionMatches(err, exc)` in `Python/errors.c` recursively iterates through nested tuple exception targets without guarding recursion depth via `Py_EnterRecursiveCall()` / `Py_LeaveRecursiveCall()`.\n\nWhen evaluating deeply nested tuple structures passed through C API extensions or dynamic tuple composition, unbounded native C call stack growth leads to stack exhaustion and an immediate `SIGSEGV` crash.\n\n### Steps to Reproduce\n\n```python\nimport ctypes\n\nlib = ctypes.pythonapi\nlib.PyErr_GivenExceptionMatches.argtypes = [ctypes.py_object, ctypes.py_object]\nlib.PyErr_GivenExceptionMatches.restype = ctypes.c_int\n\n# Construct deeply nested tuple target\ntup = (1, ValueError)\nfor _ in range(1_000_000):\n    tup = (1, tup)\n\n# Trigger exception matching traversal\nres = lib.PyErr_GivenExceptionMatches(TypeError(), tup)\n```\n\n### Actual Result\n\n`Segmentation fault (core dumped)`\n\n```text\nProgram received signal SIGSEGV, Segmentation fault.\nPyTuple_Size (op=op@entry=0x7ffff2beda30) at Objects/tupleobject.c:100\n100             return Py_SIZE(op);\n#0  PyTuple_Size (op=op@entry=0x7ffff2beda30) at Objects/tupleobject.c:100\n#1  0x0000555555824f63 in PyErr_GivenExceptionMatches (err=err@entry=0x7ffff78ea900, exc=0x7ffff2beda30) at Python/errors.c:339\n#2  0x0000555555824fb0 in PyErr_GivenExceptionMatches (err=err@entry=0x7ffff78ea900, exc=0x7ffff2beda90) at Python/errors.c:342\n#3  0x0000555555824fb0 in PyErr_GivenExceptionMatches (err=err@entry=0x7ffff78ea900, exc=0x7ffff2bedaf0) at Python/errors.c:342\n#4  0x0000555555824fb0 in PyErr_GivenExceptionMatches (err=err@entry=0x7ffff78ea900, exc=0x7ffff2bedb50) at Python/errors.c:342\n...\nrsp             0x7fffff7ff000      0x7fffff7ff000\n```\n\n### Expected Result\n\n`PyErr_GivenExceptionMatches` should guard recursion with `Py_EnterRecursiveCall()` / `Py_LeaveRecursiveCall()`, setting a `RecursionError` and returning `0` safely when recursion depth is exceeded instead of crashing the interpreter.\n\n### CPython versions tested on:\n\nCPython 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/fix-err-given-exception-matches-recursion:999a046b24c, Aug 21 2026, 18:34:) [GCC 13.3.0]\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156205\n* gh-158622\n* gh-158623\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/BHUVANSH855","@type":"Person","name":"BHUVANSH855"},"datePublished":"2026-08-21T18:42:58Z","url":"https://github.com/python/cpython/issues/156204"}

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:2df40165-5066-a7f2-0998-43ed9fc2ffe5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCB08:14EB6E:1906266:20E01BB:6B020B51
html-safe-nonceb48b68308feecc8d724dbde8634f35d23e4baa9fdd7fe2a3d8842e6c43442fb7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjA4OjE0RUI2RToxOTA2MjY2OjIwRTAxQkI6NkIwMjBCNTEiLCJ2aXNpdG9yX2lkIjoiNzYzNjUzNjgzNDMwNjIxNDczNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf87631ce8084a9165160f9e91ec7a6a94e3e9badb4ceaa66b2ca7db8d5996d3e
hovercard-subject-tagissue:5217146819
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/156204/issue_layout
twitter:imagehttps://opengraph.githubassets.com/368f4124f207a028b854e88d289bab6219e999149188fc58b50b8988e895a49a/python/cpython/issues/156204
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/368f4124f207a028b854e88d289bab6219e999149188fc58b50b8988e895a49a/python/cpython/issues/156204
og:image:altCrash report What happened? Problem Description PyErr_GivenExceptionMatches(err, exc) in Python/errors.c recursively iterates through nested tuple exception targets without guarding recursion depth...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameBHUVANSH855
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/156204#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F156204
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%2F156204
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/156204
Reloadhttps://github.com/python/cpython/issues/156204
Reloadhttps://github.com/python/cpython/issues/156204
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/156204
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/156204
PyErr_GivenExceptionMatches crashes with SIGSEGV on deeply nested tuple targetshttps://github.com/python/cpython/issues/156204#top
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
https://github.com/BHUVANSH855
BHUVANSH855https://github.com/BHUVANSH855
on Aug 21, 2026https://github.com/python/cpython/issues/156204#issue-5217146819
gh-156204: Guard recursion in PyErr_GivenExceptionMatches #156205https://github.com/python/cpython/pull/156205
[3.15] gh-156204: Guard recursion in PyErr_GivenExceptionMatches (GH-156205) #158622https://github.com/python/cpython/pull/158622
[3.14] gh-156204: Guard recursion in PyErr_GivenExceptionMatches (GH-156205) #158623https://github.com/python/cpython/pull/158623
BHUVANSH855https://github.com/BHUVANSH855
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
on Aug 21, 2026https://github.com/python/cpython/issues/156204#event-29822126675
BHUVANSH855https://github.com/BHUVANSH855
on Aug 21, 2026https://github.com/python/cpython/issues/156204#event-29824024440
pythongh-156204: Safely skip ctypes test on mobile/wasm and reduce tu…https://github.com/BHUVANSH855/cpython/commit/d0d85956659696e101e3c5d0645395ab197faee9
pythongh-156204https://github.com/python/cpython/issues/156204
d0d8595https://github.com/BHUVANSH855/cpython/commit/d0d85956659696e101e3c5d0645395ab197faee9
StanFromIrelandhttps://github.com/StanFromIreland
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Aug 21, 2026https://github.com/python/cpython/issues/156204#event-29825700645
BHUVANSH855https://github.com/BHUVANSH855
on Aug 21, 2026https://github.com/python/cpython/issues/156204#event-29826081607
pythongh-156204: address review feedbackhttps://github.com/BHUVANSH855/cpython/commit/b6be6c5d9015c774bc82cadf63e2901894f3d54e
pythongh-156204https://github.com/python/cpython/issues/156204
b6be6c5https://github.com/BHUVANSH855/cpython/commit/b6be6c5d9015c774bc82cadf63e2901894f3d54e
pythongh-156204: drop docs changehttps://github.com/BHUVANSH855/cpython/commit/170d3c961eaf6fa7193ef697b78e2a0479871982
pythongh-156204https://github.com/python/cpython/issues/156204
170d3c9https://github.com/BHUVANSH855/cpython/commit/170d3c961eaf6fa7193ef697b78e2a0479871982
https://github.com/picnixz
picnixzhttps://github.com/picnixz
on Aug 22, 2026https://github.com/python/cpython/issues/156204#issuecomment-5381745381
BHUVANSH855https://github.com/BHUVANSH855
on Sep 24, 2026https://github.com/python/cpython/issues/156204#event-31763009157
pythongh-156204: convert test helper to Argument Clinichttps://github.com/BHUVANSH855/cpython/commit/12ce58fd9bf59b29a3eee285f2bf7d074d9f777d
pythongh-156204https://github.com/python/cpython/issues/156204
12ce58fhttps://github.com/BHUVANSH855/cpython/commit/12ce58fd9bf59b29a3eee285f2bf7d074d9f777d
pythongh-156204: remove commenthttps://github.com/BHUVANSH855/cpython/commit/e7c80b9cbc2b4187de6e5b5c90a89583dbce159f
pythongh-156204https://github.com/python/cpython/issues/156204
e7c80b9https://github.com/BHUVANSH855/cpython/commit/e7c80b9cbc2b4187de6e5b5c90a89583dbce159f
pythongh-156204: report recursion overflow as unraisablehttps://github.com/BHUVANSH855/cpython/commit/141b18193ba4e7aa54ce6a290da4a52eb451c2ed
pythongh-156204https://github.com/python/cpython/issues/156204
141b181https://github.com/BHUVANSH855/cpython/commit/141b18193ba4e7aa54ce6a290da4a52eb451c2ed
ZeroIntensityhttps://github.com/ZeroIntensity
on Oct 2, 2026https://github.com/python/cpython/issues/156204#event-32363174597
gh-156204: Guard recursion in `PyErr_GivenExceptionMatches` (GH-156205)https://github.com/python/cpython/commit/20d5e67fc51eee8cbf7e38d75830e5edd140d37e
gh-156204https://github.com/python/cpython/issues/156204
GH-156205https://github.com/python/cpython/pull/156205
20d5e67https://github.com/python/cpython/commit/20d5e67fc51eee8cbf7e38d75830e5edd140d37e
[3.14] gh-156204: Guard recursion in `PyErr_GivenExceptionMatches` (G…https://github.com/python/cpython/commit/a9eeb9f2f517046fc1fae061dee0e6856a414077
gh-156204https://github.com/python/cpython/issues/156204
G…https://github.com/python/cpython/pull/156205
a9eeb9fhttps://github.com/python/cpython/commit/a9eeb9f2f517046fc1fae061dee0e6856a414077
https://github.com/ZeroIntensity
ZeroIntensityhttps://github.com/ZeroIntensity
on Oct 2, 2026https://github.com/python/cpython/issues/156204#issuecomment-5961267675
@BHUVANSH855https://github.com/BHUVANSH855
ZeroIntensityhttps://github.com/ZeroIntensity
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 2, 2026https://github.com/python/cpython/issues/156204#event-32364820626
ZeroIntensityhttps://github.com/ZeroIntensity
on Oct 11, 2026https://github.com/python/cpython/issues/156204#event-32975453819
[3.15] gh-156204: Guard recursion in `PyErr_GivenExceptionMatches` (G…https://github.com/python/cpython/commit/ae21cb7ccfe03180435920c05d5db4d55f27c336
gh-156204https://github.com/python/cpython/issues/156204
G…https://github.com/python/cpython/pull/156205
ae21cb7https://github.com/python/cpython/commit/ae21cb7ccfe03180435920c05d5db4d55f27c336
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/156204
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/156204
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
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.