GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PEP 709: Comprehension iteration variable leaks into outer locals() · Issue #104619 · python/cpython

PEP 709: Comprehension iteration variable leaks into outer locals() #104619

New issue
Copy link
New issue
Copy link
Closed
#104637
Closed
PEP 709: Comprehension iteration variable leaks into outer locals()#104619
#104637
Copy link
Assignees
carljm
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@JelleZijlstra
JelleZijlstra
opened on May 18, 2023
Issue body actions

Code:

def __b():
    [__a for __b in [__b] for _ in []]
    return locals()

On #104603, calling this gives:

>>> __b()
{'__b': <function __b at 0x100e3e390>}

But on 3.11:

>>> __b()
{}

So the locals() in the outer function can now include comprehension variables from the inner comprehension. cc @carljm

Linked PRs

  • gh-104619: never leak comprehension locals to outer locals() #104637

Activity

  1. JelleZijlstra
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 18, 2023
  2. JelleZijlstra
    changed the title [-]PEP 709: [/-] [+]PEP 709: Comprehension iteration variable leaks into outer locals()[/+] on May 18, 2023
  3. carljm
    self-assigned this
    on May 18, 2023
  4. carljm
    added a commit that references this issue on May 19, 2023

    pythongh-104619: never leak comprehension locals to outer locals()

    58b7d96
  5. carljm
    linked a pull request that will close this issuegh-104619: never leak comprehension locals to outer locals() #104637on May 19, 2023
  6. JelleZijlstra
    closed this as completedin #104637on May 19, 2023
  7. JelleZijlstra
    added a commit that references this issue on May 19, 2023

    gh-104619: never leak comprehension locals to outer locals() (#104637)

    70c7796
  8. carljm
    added a commit that references this issue on May 20, 2023

    Merge branch 'main' into gsallam/main

    ea5965a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @carljm
    carljm

Labels

type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.