From f5e97b72fecff9b9ced35704ec5e6cad29e2825d Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 14 Dec 2020 11:28:39 +0000 Subject: bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761) --- Python/compile.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/compile.c') diff --git a/Python/compile.c b/Python/compile.c index 241e8ffd12..c7a0ae402b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2773,6 +2773,8 @@ compiler_for(struct compiler *c, stmt_ty s) compiler_use_next_block(c, body); VISIT(c, expr, s->v.For.target); VISIT_SEQ(c, stmt, s->v.For.body); + /* Mark jump as artificial */ + c->u->u_lineno = -1; ADDOP_JUMP(c, JUMP_ABSOLUTE, start); compiler_use_next_block(c, cleanup); -- cgit v1.2.1