Skip to content

Commit 617c5d4

Browse files
committed
Fix comprehensions comment to inlined by pep 709
1 parent 914356f commit 617c5d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Python/codegen.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,9 +4087,11 @@ codegen_call_helper(compiler *c, location loc,
40874087
return codegen_call_helper_impl(c, loc, n, args, NULL, keywords);
40884088
}
40894089

4090-
/* List and set comprehensions and generator expressions work by creating a
4091-
nested function to perform the actual iteration. This means that the
4092-
iteration variables don't leak into the current scope.
4090+
/* List and set comprehensions work by being inlined at the location where
4091+
they are defined. The isolation of iteration variables is provided by
4092+
pushing/popping clashing locals on the stack. Generator expressions work
4093+
by creating a nested function to perform the actual iteration.
4094+
This means that the iteration variables don't leak into the current scope.
40934095
The defined function is called immediately following its definition, with the
40944096
result of that call being the result of the expression.
40954097
The LC/SC version returns the populated container, while the GE version is

0 commit comments

Comments
 (0)