diff options
author | Mark Shannon <mark@hotpy.org> | 2021-07-15 14:54:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 14:54:38 (GMT) |
commit | 47695e3c88343e794d37333853b2ba3f16505c5d (patch) | |
tree | d0d21e371cf56948daa5069be6b3f1078c86d55b /Python | |
parent | 2ce8af3cbcb368a35a05a5a9f97a09405124f239 (diff) | |
download | cpython-47695e3c88343e794d37333853b2ba3f16505c5d.zip cpython-47695e3c88343e794d37333853b2ba3f16505c5d.tar.gz cpython-47695e3c88343e794d37333853b2ba3f16505c5d.tar.bz2 |
bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160) (GH-27163)
(cherry picked from commit f333ab0f2edec26a769ed558263ac662e5475451)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 0508ea1..9b7ce19 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2923,7 +2923,9 @@ compiler_async_for(struct compiler *c, stmt_ty s) /* Except block for __anext__ */ compiler_use_next_block(c, except); - c->u->u_lineno = -1; + /* Use same line number as the iterator, + * as the END_ASYNC_FOR succeeds the `for`, not the body. */ + SET_LOC(c, s->v.AsyncFor.iter); ADDOP(c, END_ASYNC_FOR); /* `else` block */ |