Skip to content

__getattr__ and __getattribute__ don't work on metaclasses #2677

@DetachHead

Description

@DetachHead

Summary

class Foo(type):
    def __getattribute__(cls, name: str, /) -> int:
        return 1

class Bar(metaclass=Foo): ...

asdf = Bar.asdf # error: unresolved-attribute

https://play.ty.dev/08a0a6ef-d3fa-429d-a811-b07da37a79e5

Version

ty 0.0.14 (16597f5 2026-01-26)

Metadata

Metadata

Assignees

Labels

attribute accessInstance attributes, class attributes, etc.bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions