@@ -551,6 +551,7 @@ codegen_unwind_fblock(compiler *c, location *ploc,
551551 case COMPILE_FBLOCK_EXCEPTION_HANDLER :
552552 case COMPILE_FBLOCK_EXCEPTION_GROUP_HANDLER :
553553 case COMPILE_FBLOCK_ASYNC_COMPREHENSION_GENERATOR :
554+ case COMPILE_FBLOCK_INLINED_COMPREHENSION :
554555 case COMPILE_FBLOCK_STOP_ITERATION :
555556 return SUCCESS ;
556557
@@ -4976,8 +4977,11 @@ codegen_push_inlined_comprehension_locals(compiler *c, location loc,
49764977 NEW_JUMP_TARGET_LABEL (c , cleanup );
49774978 state -> cleanup = cleanup ;
49784979
4979- // no need to push an fblock for this "virtual" try/finally; there can't
4980- // be return/continue/break inside a comprehension
4980+ // Count against CO_MAXBLOCKS: SETUP_FINALLY consumes an except-stack
4981+ // slot even though return/continue/break cannot appear here.
4982+ RETURN_IF_ERROR (_PyCompile_PushFBlock (
4983+ c , loc , COMPILE_FBLOCK_INLINED_COMPREHENSION ,
4984+ cleanup , NO_LABEL , NULL ));
49814985 ADDOP_JUMP (c , loc , SETUP_FINALLY , cleanup );
49824986 }
49834987 return SUCCESS ;
@@ -5023,6 +5027,8 @@ codegen_pop_inlined_comprehension_locals(compiler *c, location loc,
50235027{
50245028 if (state -> pushed_locals ) {
50255029 ADDOP (c , NO_LOCATION , POP_BLOCK );
5030+ _PyCompile_PopFBlock (c , COMPILE_FBLOCK_INLINED_COMPREHENSION ,
5031+ state -> cleanup );
50265032
50275033 NEW_JUMP_TARGET_LABEL (c , end );
50285034 ADDOP_JUMP (c , NO_LOCATION , JUMP_NO_INTERRUPT , end );
0 commit comments