summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authortomKPZ <tomKPZ@users.noreply.github.com>2021-04-07 14:43:45 (GMT)
committerGitHub <noreply@github.com>2021-04-07 14:43:45 (GMT)
commit7a7ba3d343d360a03a34bc3901628f9f40a58307 (patch)
treea417c7782f003753e6e88e245c2fd1885ef58688 /Python
parente35dd556e1adb4fc8b83e5b75ac59e428a8b5460 (diff)
downloadcpython-7a7ba3d343d360a03a34bc3901628f9f40a58307.zip
cpython-7a7ba3d343d360a03a34bc3901628f9f40a58307.tar.gz
cpython-7a7ba3d343d360a03a34bc3901628f9f40a58307.tar.bz2
bpo-43495 : Push missing frame block in compile.c (GH-24865)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 65dacc2..85bc87d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -116,7 +116,8 @@ compiler IR.
*/
enum fblocktype { WHILE_LOOP, FOR_LOOP, TRY_EXCEPT, FINALLY_TRY, FINALLY_END,
- WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER };
+ WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER,
+ ASYNC_COMPREHENSION_GENERATOR };
struct fblockinfo {
enum fblocktype fb_type;
@@ -1700,6 +1701,7 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
switch (info->fb_type) {
case WHILE_LOOP:
case EXCEPTION_HANDLER:
+ case ASYNC_COMPREHENSION_GENERATOR:
return 1;
case FOR_LOOP:
@@ -4573,6 +4575,11 @@ compiler_async_comprehension_generator(struct compiler *c,
}
compiler_use_next_block(c, start);
+ /* Runtime will push a block here, so we need to account for that */
+ if (!compiler_push_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start,
+ NULL, NULL)) {
+ return 0;
+ }
ADDOP_JUMP(c, SETUP_FINALLY, except);
ADDOP(c, GET_ANEXT);
@@ -4627,6 +4634,8 @@ compiler_async_comprehension_generator(struct compiler *c,
compiler_use_next_block(c, if_cleanup);
ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
+ compiler_pop_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start);
+
compiler_use_next_block(c, except);
ADDOP(c, END_ASYNC_FOR);