bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160) (GH-27163)

(cherry picked from commit f333ab0f2e)
This commit is contained in:
Mark Shannon 2021-07-15 15:54:38 +01:00 committed by GitHub
parent 2ce8af3cbc
commit 47695e3c88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -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 */