mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
gh-93691: fix too broad source locations of for statement iterators (#120330)
This commit is contained in:
parent
755dab719d
commit
97b69db167
6 changed files with 63 additions and 8 deletions
|
@ -3025,11 +3025,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue