FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor the implementation of inlined comprehensions · Issue #124697 · python/cpython · GitHub

Repository navigation

refactor the implementation of inlined comprehensions #124697

Description

The current implementation of comprehension inlining is a pile of special cases that is quite difficult to understand and debug. The root cause of this is that it attempts to flatten the inlined scope into the enclosing scope in the symbol table, to avoid the compiler needing to generally understand the concept of inlined sub-scopes, but this flattening loses information and requires a number of special cases. And then the compiler implementation of inlining modifies the flattened scope as it traverses the inlined comprehension(s) in order to ensure correct handling of the names within the inlined sub-scope; ideally the compiler would not modify the symbol table as it generates code.

A better implementation would leave the scopes separate in the symbol table, losing no information but just marking the comprehension scope as an inlined sub-scope, and then add explicit support for inlined sub-scopes in the compiler (with appropriate query methods in the symtable.)

Linked PRs

Activity

  1. self-assigned this
    on Sep 27, 2024
  2. carljm commented on Sep 27, 2024

    MemberAuthor
  3. added
    type-refactorCode refactoring (with no changes in behavior)
    and removed
    type-featureA feature request or enhancement
    on Jun 1, 2025
  4. removed their assignment
    on Jan 30, 2026
  5. jeremyhylton commented on Jul 16, 2026

    Contributor

    Still think this is a good idea, Carl?

  6. iritkatriel commented on Jul 16, 2026

    Member

    I do.

  7. carljm commented on Jul 16, 2026

    MemberAuthor

    Yes, I do.

  8. added a commit that references this issue on Sep 2, 2026
  9. terr99pav commented on Sep 2, 2026

  10. added 2 commits that reference this issue on Sep 2, 2026
  11. added a commit that references this issue on Sep 23, 2026
  12. added a commit that references this issue on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL