[3.13] GH-127682: Backport GH-132351 (GH-132384)

Only call `__iter__` once in generator expressions
This commit is contained in:
Mark Shannon 2025-04-29 09:35:29 +01:00 committed by GitHub
parent 7ffef8d07b
commit 132bdf6990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 14 deletions

View file

@ -5910,9 +5910,7 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
}
Py_CLEAR(co);
if (compiler_comprehension_iter(c, outermost)) {
goto error;
}
VISIT(c, expr, outermost->iter);
ADDOP_I(c, loc, CALL, 0);