Closed
Description
Minimal reproducer:
class MyMeta1(type): ...
class MyMeta2(type): ...
class A(metaclass=MyMeta1): ...
class B(metaclass=MyMeta2): ...
class C(A, B): ...
In runtime it causes:
» python ex.py
Traceback (most recent call last):
File "ex.py", line 5, in <module>
class C(A, B): ...
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
But, mypy is fine with it:
» mypy ex.py --strict
Success: no issues found in 1 source file
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