GH-127682: Only call __iter__ once in generator expressions. (GH-132351)

This commit is contained in:
Mark Shannon 2025-04-11 09:37:22 +01:00 committed by GitHub
parent bc0b94b30c
commit d87e7f3529
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 15 deletions

View file

@ -4775,10 +4775,7 @@ codegen_comprehension(compiler *c, expr_ty e, int type,
}
Py_CLEAR(co);
if (codegen_comprehension_iter(c, outermost)) {
goto error;
}
VISIT(c, expr, outermost->iter);
ADDOP_I(c, loc, CALL, 0);
if (is_async_comprehension && type != COMP_GENEXP) {