gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (#123173)

This commit is contained in:
Irit Katriel 2024-08-21 19:12:05 +01:00 committed by GitHub
parent a4fd7aa4a6
commit ec89620e5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 122 additions and 22 deletions

View file

@ -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);