diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-08-21 18:12:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 18:12:05 (GMT) |
commit | ec89620e5e147ba028a46dd695ef073a72000b84 (patch) | |
tree | 93794373ed1e67fbcfbef9015fc38d94698237f8 /Python/compile.c | |
parent | a4fd7aa4a6420cef1c22ec64eab54d8aea41cc57 (diff) | |
download | cpython-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.c | 5 |
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); |