Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.13] gh-125832: Clarify comment for inlined comprehensions as per PEP-709 (gh-126322) #126344

Merged
merged 2 commits into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5315,9 +5315,12 @@ compiler_call_helper(struct compiler *c, location loc,
}


/* List and set comprehensions and generator expressions work by creating a
nested function to perform the actual iteration. This means that the
iteration variables don't leak into the current scope.
/* List and set comprehensions work by being inlined at the location where
they are defined. The isolation of iteration variables is provided by
pushing/popping clashing locals on the stack. Generator expressions work
by creating a nested function to perform the actual iteration.
This means that the iteration variables don't leak into the current scope.
See https://peps.python.org/pep-0709/ for additional information.
The defined function is called immediately following its definition, with the
result of that call being the result of the expression.
The LC/SC version returns the populated container, while the GE version is
Expand Down
Loading