diff options
| author | Mark Shannon <mark@hotpy.org> | 2021-07-20 10:09:56 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-20 10:09:56 (GMT) |
| commit | 7ebd7465a5a6a5955fbf69316e1bc8b05cd6fbed (patch) | |
| tree | 679ac7666ae98011aa290ec9b8a9cf886c647ca7 /Python | |
| parent | 9ee12cf325d4da2c07919e5e56545feb7e005e08 (diff) | |
| download | cpython-7ebd7465a5a6a5955fbf69316e1bc8b05cd6fbed.zip cpython-7ebd7465a5a6a5955fbf69316e1bc8b05cd6fbed.tar.gz cpython-7ebd7465a5a6a5955fbf69316e1bc8b05cd6fbed.tar.bz2 | |
Set line number of END_ASYNC_FOR so that it doesn't show in traces. (GH-27255)
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/compile.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index 722d52d..f426050 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2816,6 +2816,12 @@ compiler_async_for(struct compiler *c, stmt_ty s) /* Except block for __anext__ */ compiler_use_next_block(c, except); + + /* We don't want to trace the END_ASYNC_FOR, so make sure + * that it has the same lineno as the following instruction. */ + if (asdl_seq_LEN(s->v.For.orelse)) { + SET_LOC(c, (stmt_ty)asdl_seq_GET(s->v.For.orelse, 0)); + } ADDOP(c, END_ASYNC_FOR); /* `else` block */ |
