You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now there's an inconsistency in how base classes / metaclasses behave when working with Any.
Example:
fromtypingimportAnyMyAny: Any=type('MyAny', (type,), {'a': 1})
classSubclass(MyAny):
passclassWithMeta(metaclass=MyAny):
passreveal_type(Subclass.a) # N: Revealed type is "Any"reveal_type(WithMeta.a) # E: "Type[WithMeta]" has no attribute "a" \# N: Revealed type is "Any"
Both Subclass.a and WithMeta.a return 1 in runtime. But, for some reason metaclass=Any is not recognised.
Activity
Treat `Any` metaclass the same as `Any` base class, refs python#13599
Treat `Any` metaclass the same as `Any` base class (#13605)