Skip to content

Commit 7a7ba3d

Browse files
authored
bpo-43495 : Push missing frame block in compile.c (GH-24865)
1 parent e35dd55 commit 7a7ba3d

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;
@@ -1700,6 +1701,7 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
17001701
switch (info->fb_type) {
17011702
case WHILE_LOOP:
17021703
case EXCEPTION_HANDLER:
1704+
case ASYNC_COMPREHENSION_GENERATOR:
17031705
return 1;
17041706

17051707
case FOR_LOOP:
@@ -4573,6 +4575,11 @@ compiler_async_comprehension_generator(struct compiler *c,
45734575
}
45744576

45754577
compiler_use_next_block(c, start);
4578+
/* Runtime will push a block here, so we need to account for that */
4579+
if (!compiler_push_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start,
4580+
NULL, NULL)) {
4581+
return 0;
4582+
}
45764583

45774584
ADDOP_JUMP(c, SETUP_FINALLY, except);
45784585
ADDOP(c, GET_ANEXT);
@@ -4627,6 +4634,8 @@ compiler_async_comprehension_generator(struct compiler *c,
46274634
compiler_use_next_block(c, if_cleanup);
46284635
ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
46294636

4637+
compiler_pop_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start);
4638+
46304639
compiler_use_next_block(c, except);
46314640
ADDOP(c, END_ASYNC_FOR);
46324641

0 commit comments

Comments
 (0)