Skip to content

Outdated post PEP-709 comment in Python/codegen.c #125832

Closed

Description

@Eclips4

Bug report

Bug description:

After the implementation of https://peps.python.org/pep-0709/, this comment looks wrong:

cpython/Python/codegen.c

Lines 4079 to 4090 in 57e3c59

/* 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.
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
flagged in symtable.c as a generator, so it returns the generator object
when the function is called.
Possible cleanups:
- iterate over the generator sequence instead of using recursion
*/

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. picnixz commented on Oct 22, 2024

    @picnixz
    Member

    Haven't checked in the code yet but generator expressions do not seem to be concerned by the inlining:

    Generator expressions are currently not inlined in the reference implementation of this PEP. In the future, some generator expressions may be inlined, where the returned generator object does not leak.

  2. rimi0108 commented on Nov 2, 2024

    @rimi0108
    Contributor

    I will take a look :)

  3. corona10 commented on Nov 2, 2024

    @corona10
    Member

    @willingc

    @rimi0108 is going to take a look at this issue during the KR sprint too :)

  4. changed the title [-]Outdated comment in `Python/codegen.c`[/-] [+]Outdated post PEP-709 comment in `Python/codegen.c`[/+] on Nov 2, 2024
  5. added a commit that references this issue on Nov 2, 2024
  6. corona10 commented on Nov 3, 2024

    @corona10
    Member

    Thanks for the contribution! @rimi0108

  7. corona10 commented on Nov 3, 2024

    @corona10
    Member

    We need to handle backport patch as well.

  8. added 6 commits that reference this issue on Nov 3, 2024
  9. added 2 commits that reference this issue on Dec 8, 2024
  10. added 2 commits that reference this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions