Skip to content

FrameLocalsProxy is not a mapping #120097

Closed
Closed
@markshannon

Description

@markshannon

Bug report

Bug description:

FrameLocalsProxy should be a mapping. I.e. it should subclass collections.abc.Mapping and match {} in a match statement.

from collections.abc import Mapping
import sys

def f():
    return sys._getframe().f_locals

proxy = f()

assert(instance(proxy, Mapping))

match proxy:
    case {}:
        kind = "mapping"
    case _:
        kind = "other"

assert(kind == "mapping")

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions