Skip to content

recent change to type.__dict__ incorrectly causes instances of classes with a metaclass to have readonly __dict__ attribute in pyright #15237

@DetachHead

Description

@DetachHead

Code sample in pyright playground

class FooMetaclass(type): ...

class Foo(metaclass=FooMetaclass): ...

# Cannot access attribute "update" for class "MappingProxyType[str, Any]"
#   Attribute "update" is unknown (reportAttributeAccessIssue)
Foo().__dict__.update(a=1)

this works at runtime, and was not a type error prior to pyright 1.1.408 (which introduced #14951)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions