Minimal reproducer:
classMyMeta1(type): ...
classMyMeta2(type): ...
classA(metaclass=MyMeta1): ...
classB(metaclass=MyMeta2): ...
classC(A, B): ...
In runtime it causes:
» pythonex.pyTraceback (mostrecentcalllast):
File"ex.py", line5, in<module>classC(A, B): ...
TypeError: metaclassconflict: themetaclassofaderivedclassmustbea (non-strict) subclassofthemetaclassesofallitsbases
But, mypy is fine with it:
» mypyex.py--strictSuccess: noissuesfoundin1sourcefile
Important note: I think this should only work outside of stubs, because we do some extra metaclass hackery (like ABCMeta) in stubs. Moreover, in stubs - it won't raise.
Related #13561
Minimal reproducer:
In runtime it causes:
But, mypy is fine with it:
Important note: I think this should only work outside of stubs, because we do some extra metaclass hackery (like
ABCMeta) in stubs. Moreover, in stubs - it won't raise.Related #13561