[3.13] gh-123142: fix too wide source location of GET_ITER/GET_AITER (GH-123420). (#123435)

(cherry picked from commit 61bef6245c)
This commit is contained in:
Irit Katriel 2024-08-28 18:41:22 +01:00 committed by GitHub
parent 19a1f18740
commit d379a92ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 9 deletions

View file

@ -3160,7 +3160,7 @@ compiler_async_for(struct compiler *c, stmt_ty s)
NEW_JUMP_TARGET_LABEL(c, end);
VISIT(c, expr, s->v.AsyncFor.iter);
ADDOP(c, loc, GET_AITER);
ADDOP(c, LOC(s->v.AsyncFor.iter), GET_AITER);
USE_LABEL(c, start);
RETURN_IF_ERROR(compiler_push_fblock(c, loc, FOR_LOOP, start, end, NULL));
@ -5484,7 +5484,7 @@ compiler_async_comprehension_generator(struct compiler *c, location loc,
else {
/* Sub-iter - calculate on the fly */
VISIT(c, expr, gen->iter);
ADDOP(c, loc, GET_AITER);
ADDOP(c, LOC(gen->iter), GET_AITER);
}
}
@ -5774,15 +5774,14 @@ pop_inlined_comprehension_state(struct compiler *c, location loc,
}
static inline int
compiler_comprehension_iter(struct compiler *c, location loc,
comprehension_ty comp)
compiler_comprehension_iter(struct compiler *c, comprehension_ty comp)
{
VISIT(c, expr, comp->iter);
if (comp->is_async) {
ADDOP(c, loc, GET_AITER);
ADDOP(c, LOC(comp->iter), GET_AITER);
}
else {
ADDOP(c, loc, GET_ITER);
ADDOP(c, LOC(comp->iter), GET_ITER);
}
return SUCCESS;
}
@ -5808,7 +5807,7 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
outermost = (comprehension_ty) asdl_seq_GET(generators, 0);
if (is_inlined) {
if (compiler_comprehension_iter(c, loc, outermost)) {
if (compiler_comprehension_iter(c, outermost)) {
goto error;
}
if (push_inlined_comprehension_state(c, loc, entry, &inline_state)) {
@ -5894,7 +5893,7 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
}
Py_CLEAR(co);
if (compiler_comprehension_iter(c, loc, outermost)) {
if (compiler_comprehension_iter(c, outermost)) {
goto error;
}