[3.12] gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (GH-123173). (#123210)

(cherry picked from commit ec89620e5e)
This commit is contained in:
Irit Katriel 2024-08-22 10:22:43 +01:00 committed by GitHub
parent 8edfa0b0b4
commit fbbde4dc6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 122 additions and 21 deletions

View file

@ -5272,14 +5272,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);