Skip to content

Commit 42e22ba

Browse files
committed
bpo-43495 : Push missing frame block in compile.c
1 parent 5e29021 commit 42e22ba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Python/compile.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ compiler IR.
116116
*/
117117

118118
enum fblocktype { WHILE_LOOP, FOR_LOOP, TRY_EXCEPT, FINALLY_TRY, FINALLY_END,
119-
WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER };
119+
WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER,
120+
ASYNC_COMPREHENSION_GENERATOR };
120121

121122
struct fblockinfo {
122123
enum fblocktype fb_type;
@@ -1713,6 +1714,7 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
17131714
switch (info->fb_type) {
17141715
case WHILE_LOOP:
17151716
case EXCEPTION_HANDLER:
1717+
case ASYNC_COMPREHENSION_GENERATOR:
17161718
return 1;
17171719

17181720
case FOR_LOOP:
@@ -4580,6 +4582,11 @@ compiler_async_comprehension_generator(struct compiler *c,
45804582
}
45814583

45824584
compiler_use_next_block(c, start);
4585+
/* Runtime will push a block here, so we need to account for that */
4586+
if (!compiler_push_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start,
4587+
NULL, NULL)) {
4588+
return 0;
4589+
}
45834590

45844591
ADDOP_JUMP(c, SETUP_FINALLY, except);
45854592
ADDOP(c, GET_ANEXT);
@@ -4634,6 +4641,8 @@ compiler_async_comprehension_generator(struct compiler *c,
46344641
compiler_use_next_block(c, if_cleanup);
46354642
ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
46364643

4644+
compiler_pop_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start);
4645+
46374646
compiler_use_next_block(c, except);
46384647
ADDOP(c, END_ASYNC_FOR);
46394648

0 commit comments

Comments
 (0)