René's URL Explorer Experiment


Title: Parser stack overflow: deeply-nested source causes SIGSEGV instead of SyntaxError · Issue #7655 · RustPython/RustPython · GitHub

Open Graph Title: Parser stack overflow: deeply-nested source causes SIGSEGV instead of SyntaxError · Issue #7655 · RustPython/RustPython

X Title: Parser stack overflow: deeply-nested source causes SIGSEGV instead of SyntaxError · Issue #7655 · RustPython/RustPython

Description: Summary Parsing deeply-nested Python source (brackets, parens, etc.) crashes the interpreter with SIGSEGV at ~4000 levels of nesting. CPython caps this at 200 via SyntaxError: too many nested parentheses from the parser's internal depth ...

Open Graph Description: Summary Parsing deeply-nested Python source (brackets, parens, etc.) crashes the interpreter with SIGSEGV at ~4000 levels of nesting. CPython caps this at 200 via SyntaxError: too many nested paren...

X Description: Summary Parsing deeply-nested Python source (brackets, parens, etc.) crashes the interpreter with SIGSEGV at ~4000 levels of nesting. CPython caps this at 200 via SyntaxError: too many nested paren...

Opengraph URL: https://github.com/RustPython/RustPython/issues/7655

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parser stack overflow: deeply-nested source causes SIGSEGV instead of SyntaxError","articleBody":"## Summary\n\nParsing deeply-nested Python source (brackets, parens, etc.) crashes the interpreter with SIGSEGV at ~4000 levels of nesting. CPython caps this at 200 via `SyntaxError: too many nested parentheses` from the parser's internal depth limit.\n\nThe crash is in the parser itself (`rustpython-ruff_python_parser` 0.15.8): `compile(src, '\u003cs>', 'exec')` (parser + codegen, does NOT go through `_ast::ast_to_object`) and `ast.parse()` crash at the identical depth threshold, showing the shared component is the parser, not post-parse conversion.\n\nThis is the parser-layer root cause of the class of bugs tracked in #2796. #4857 also still reproduces on current main (closed as fixed in 2023).\n\n## Expected\n\nMatches CPython 3.13.4 behavior:\n\n```\n$ python3 -c \"import ast; ast.parse('[' * 5000 + '1' + ']' * 5000)\"\nTraceback (most recent call last):\n  ...\nSyntaxError: too many nested parentheses (\u003cunknown>, line 1)\n```\n\n(CPython's parser rejects at depth 201 via a hard-coded limit, well before the native stack is exhausted.)\n\n## Actual\n\n```\n$ rustpython -c \"import ast; ast.parse('[' * 5000 + '1' + ']' * 5000)\"\n[no output, exit 139 — SIGSEGV]\n\n$ rustpython -c \"src='['*5000+'1'+']'*5000; compile(src,'\u003cs>','exec')\"\n[no output, exit 139 — SIGSEGV]\n\n# #4857's original reproducer also still crashes:\n$ rustpython -c \"import ast; ast.parse('+chr(33)' * 1000000)\"\n[no output, exit 139]\n```\n\n### Threshold\n\n| Depth | `compile()` | `ast.parse()` |\n|---:|:---:|:---:|\n| 3000 | ok | ok |\n| 4000 | SIGSEGV | SIGSEGV |\n| 15000 | SIGSEGV | SIGSEGV |\n\nIdentical thresholds confirm the crash is in the parser, not in post-parse conversion.\n\n## Relation to prior fixes\n\n- #7630 guarded `_ast::ast_from_object` (AST object → Rust IR conversion).\n- #7632 guarded `json.loads()` via `vm.with_recursion`.\n\nBoth fixes live downstream of the parser. The parser's own recursive descent has no depth guard, so any Python source deeply nested in brackets, parens, unary ops, or binary ops reaches the native stack limit first.\n\n## Environment\n\n- RustPython main @ `5a45d41d` (parser: `rustpython-ruff_python_parser` 0.15.8)\n- Compared against: CPython 3.13.4\n- macOS 15.1 / Darwin 24.1.0\n- Rust release build","author":{"url":"https://github.com/changjoon-park","@type":"Person","name":"changjoon-park"},"datePublished":"2026-04-22T13:07:33Z","url":"https://github.com/RustPython/RustPython/issues/7655"}

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:b894da2d-008e-670c-c2cf-809e95333de4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBD8C:2C69FC:FCA873:150B2F7:6B01DE02
html-safe-nonce188c9f08109c7fc3d5399e846db3007a958efd856285f9b2d15cd5210f29b31c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDhDOjJDNjlGQzpGQ0E4NzM6MTUwQjJGNzo2QjAxREUwMiIsInZpc2l0b3JfaWQiOiI3NjY2OTM1Nzg4MTkzNTcwMzA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacced6c91fc4560129ad063b8de628c6f5ca5b26664eb8a875b7c8fdde3780bc6d
hovercard-subject-tagissue:4309208293
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/RustPython/RustPython/7655/issue_layout
twitter:imagehttps://opengraph.githubassets.com/871be9c1494b4800528a3161c2acd3c54676eaa241e43ec30fe24f725c94937e/RustPython/RustPython/issues/7655
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/871be9c1494b4800528a3161c2acd3c54676eaa241e43ec30fe24f725c94937e/RustPython/RustPython/issues/7655
og:image:altSummary Parsing deeply-nested Python source (brackets, parens, etc.) crashes the interpreter with SIGSEGV at ~4000 levels of nesting. CPython caps this at 200 via SyntaxError: too many nested paren...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechangjoon-park
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/RustPython/RustPython/issues/7655#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fissues%2F7655
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%2FRustPython%2FRustPython%2Fissues%2F7655
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=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/issues/7655
Reloadhttps://github.com/RustPython/RustPython/issues/7655
Reloadhttps://github.com/RustPython/RustPython/issues/7655
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
https://github.com/RustPython/RustPython
New issuehttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/7655
New issuehttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/7655
#8827https://github.com/RustPython/RustPython/pull/8827
Parser stack overflow: deeply-nested source causes SIGSEGV instead of SyntaxErrorhttps://github.com/RustPython/RustPython/issues/7655#top
#8827https://github.com/RustPython/RustPython/pull/8827
https://github.com/sigmaith
https://github.com/changjoon-park
changjoon-parkhttps://github.com/changjoon-park
on Apr 22, 2026https://github.com/RustPython/RustPython/issues/7655#issue-4309208293
#2796https://github.com/RustPython/RustPython/issues/2796
#4857https://github.com/RustPython/RustPython/issues/4857
Fix segfault on cyclic or deeply-nested AST in compile() #7630https://github.com/RustPython/RustPython/pull/7630
Fix stack overflow on deeply-nested JSON in json.loads() #7632https://github.com/RustPython/RustPython/pull/7632
https://github.com/sigmaith
sigmaithhttps://github.com/sigmaith
on Aug 17, 2026https://github.com/RustPython/RustPython/issues/7655#issuecomment-5314985030
github-actionshttps://github.com/apps/github-actions
sigmaithhttps://github.com/sigmaith
on Aug 17, 2026https://github.com/RustPython/RustPython/issues/7655#event-29557493172
youknowonehttps://github.com/youknowone
completedhttps://github.com/RustPython/RustPython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
c9c78dbhttps://github.com/RustPython/RustPython/commit/c9c78db91c0ca59fb621e9f7ea4f78f8279a03cf
on Sep 30, 2026https://github.com/RustPython/RustPython/issues/7655#event-32167775061
kangdorahttps://github.com/kangdora
on Oct 1, 2026https://github.com/RustPython/RustPython/issues/7655#event-32211379180
Bound AST nesting so deep source raises instead of crashing (RustPyth…https://github.com/kangdora/RustPython/commit/c9c78db91c0ca59fb621e9f7ea4f78f8279a03cf
RustPyth…https://github.com/RustPython/RustPython/pull/8827
https://docs.github.com/articles/closing-issues-via-commit-messages
c9c78dbhttps://github.com/kangdora/RustPython/commit/c9c78db91c0ca59fb621e9f7ea4f78f8279a03cf
Sign up for freehttps://github.com/signup?return_to=https://github.com/RustPython/RustPython/issues/7655
Sign in to commenthttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/7655
sigmaithhttps://github.com/sigmaith
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.