summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-14 11:28:39 (GMT)
committerGitHub <noreply@github.com>2020-12-14 11:28:39 (GMT)
commitf5e97b72fecff9b9ced35704ec5e6cad29e2825d (patch)
tree34916b20fc3c72265458d8dac99f2f288c24e545 /Python/compile.c
parent56aa20f9eb913c746b7d54b90be328c922639338 (diff)
downloadcpython-f5e97b72fecff9b9ced35704ec5e6cad29e2825d.zip
cpython-f5e97b72fecff9b9ced35704ec5e6cad29e2825d.tar.gz
cpython-f5e97b72fecff9b9ced35704ec5e6cad29e2825d.tar.bz2
bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 241e8ff..c7a0ae4 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);