Skip to content

1.1.408 regression: class instances with a custom metaclass are treated as types #11548

Description

@Viicos

Code sample in pyright playground

class Meta(type):
    pass

class A(metaclass=Meta):  # Remove metaclass to observe the correct behavior
    pass

def func(a: A):
    # The goto definition also goes to type.__dict__, not object.__dict__
    reveal_type(a.__dict__)  # MappingProxyType[str, Any] with metaclass, dict[str, Any] without

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions