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
{{ message }}
Repository navigation
ABCMeta and its subclasses are treated differently #13561
It is a common practice to create subclasses of ABCMeta for your own abstract metaclasses when you also have other metaclass(es). It helps solving metaclass conflict error.
But, mypy treats ABCMeta and AbstractModel differently:
fromabcimportABCMeta, abstractmethodfromtypingimportProtocolclassA: # OK, has @abstractmethod@abstractmethoddeff(self) ->None:
pass# Expected:classB(A): # E: Class a.B has abstract attributes "f" # N: If it is meant to be abstract, add 'abc.ABCMeta' as an explicit metaclasspassclassC(A, metaclass=ABCMeta): # OK, has ABCMeta as a metaclasspassclassCustomABC(ABCMeta):
pass# Unexpected:classD(A, metaclass=CustomABC): # E: Class a.D has abstract attributes "f" # N: If it is meant to be abstract, add 'abc.ABCMeta' as an explicit metaclasspass
Activity
Treat `ABCMeta` subtypes and abstract metaclasses, refs python#13561
Treat `ABCMeta` subtypes as abstract metaclasses (#13562)