[3.13] gh-93691: fix too broad source locations of for statement iterators (GH-120330) (#120399)

gh-93691: fix too broad source locations of for statement iterators (GH-120330)
(cherry picked from commit 97b69db167)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-06-12 14:18:43 +02:00 committed by GitHub
parent 10821ccf06
commit 39825a7533
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 63 additions and 8 deletions

View file

@ -3101,11 +3101,18 @@ compiler_for(struct compiler *c, stmt_ty s)
RETURN_IF_ERROR(compiler_push_fblock(c, loc, FOR_LOOP, start, end, NULL));
VISIT(c, expr, s->v.For.iter);
loc = LOC(s->v.For.iter);
ADDOP(c, loc, GET_ITER);
USE_LABEL(c, start);
ADDOP_JUMP(c, loc, FOR_ITER, cleanup);
/* Add NOP to ensure correct line tracing of multiline for statements.
* It will be removed later if redundant.
*/
ADDOP(c, LOC(s->v.For.target), NOP);
USE_LABEL(c, body);
VISIT(c, expr, s->v.For.target);
VISIT_SEQ(c, stmt, s->v.For.body);