[Python-checkins] bpo-43495 : Push missing frame block in compile.c (GH-24865)
markshannon
webhook-mailer at python.org
Wed Apr 7 10:44:00 EDT 2021
https://github.com/python/cpython/commit/7a7ba3d343d360a03a34bc3901628f9f40a58307
commit: 7a7ba3d343d360a03a34bc3901628f9f40a58307
branch: master
author: tomKPZ <tomKPZ at users.noreply.github.com>
committer: markshannon <mark at hotpy.org>
date: 2021-04-07T15:43:45+01:00
summary:
bpo-43495 : Push missing frame block in compile.c (GH-24865)
files:
M Python/compile.c
diff --git a/Python/compile.c b/Python/compile.c
index 65dacc2da64bd..85bc87dbf6820 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);
More information about the Python-checkins
mailing list