summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-07-15 13:37:57 (GMT)
committerGitHub <noreply@github.com>2021-07-15 13:37:57 (GMT)
commitf333ab0f2edec26a769ed558263ac662e5475451 (patch)
tree9b9a6ea59e24e1d7c053d951e2983cdb297bfe69 /Python/compile.c
parentb83861f0265e07207a6ae2c49c40fa8f447893f2 (diff)
downloadcpython-f333ab0f2edec26a769ed558263ac662e5475451.zip
cpython-f333ab0f2edec26a769ed558263ac662e5475451.tar.gz
cpython-f333ab0f2edec26a769ed558263ac662e5475451.tar.bz2
bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 50ff9b0..e21c7a5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3002,7 +3002,9 @@ compiler_async_for(struct compiler *c, stmt_ty s)
/* Except block for __anext__ */
compiler_use_next_block(c, except);
- UNSET_LOC(c);
+ /* 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 */