summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-08-21 18:12:05 (GMT)
committerGitHub <noreply@github.com>2024-08-21 18:12:05 (GMT)
commitec89620e5e147ba028a46dd695ef073a72000b84 (patch)
tree93794373ed1e67fbcfbef9015fc38d94698237f8 /Python/compile.c
parenta4fd7aa4a6420cef1c22ec64eab54d8aea41cc57 (diff)
downloadcpython-ec89620e5e147ba028a46dd695ef073a72000b84.zip
cpython-ec89620e5e147ba028a46dd695ef073a72000b84.tar.gz
cpython-ec89620e5e147ba028a46dd695ef073a72000b84.tar.bz2
gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (#123173)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index e2cbfb7..93bbea6 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -5183,14 +5183,15 @@ compiler_sync_comprehension_generator(struct compiler *c, location loc,
}
if (IS_LABEL(start)) {
VISIT(c, expr, gen->iter);
- ADDOP(c, loc, GET_ITER);
+ ADDOP(c, LOC(gen->iter), GET_ITER);
}
}
}
+
if (IS_LABEL(start)) {
depth++;
USE_LABEL(c, start);
- ADDOP_JUMP(c, loc, FOR_ITER, anchor);
+ ADDOP_JUMP(c, LOC(gen->iter), FOR_ITER, anchor);
}
VISIT(c, expr, gen->target);