Skip to content

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

Open
iritkatriel wants to merge 2 commits into
python:mainfrom
iritkatriel:gh-156091
Open

gh-156091: Fix crash compiling deeply nested inlined comprehensions#156957
iritkatriel wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge 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

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