Skip to content

inspect.getclosurevars raises valueerror for an empty closure cellΒ #162206

Open

Description

@tonghuaroot

inspect.getclosurevars raises valueerror when a function has an empty closure cell. empty cells are valid and can be created when a captured variable is deleted.

report the empty cell name in unbound while keeping bound cells in nonlocals.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 18, 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

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions