Skip to content

gh-156091: Fix crash compiling deeply nested inlined comprehensions - #156957

Merged
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-156091
Sep 5, 2026
Merged

gh-156091: Fix crash compiling deeply nested inlined comprehensions#156957
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-156091

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Sep 4, 2026

Copy link
Copy Markdown
Member

Count inlined-comprehension SETUP_FINALLY handlers toward CO_MAXBLOCKS so the compiler raises SyntaxError instead of overflowing the except stack.

Fixes #156091.

…ions

Count inlined-comprehension SETUP_FINALLY handlers toward CO_MAXBLOCKS so
the compiler raises SyntaxError instead of overflowing the except stack.

Co-authored-by: Cursor <cursoragent@cursor.com>
@iritkatriel iritkatriel added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes type-crash A hard crash of the interpreter, possibly with a core dump and removed awaiting core review labels Sep 4, 2026
@iritkatriel
iritkatriel enabled auto-merge (squash) September 5, 2026 15:30
@iritkatriel
iritkatriel merged commit 14a93f4 into python:main Sep 5, 2026
54 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

GH-156992 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 5, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @iritkatriel, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 14a93f4d91edf767e7b35413127cfcd6a2806983 3.13

@bedevere-app

bedevere-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

GH-156993 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.13 bugs and security fixes type-crash A hard crash of the interpreter, possibly with a core dump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler crash: inlined comprehensions overflow _PyCfgExceptStack, bypassing the u_nfblocks block-nesting limit

2 participants