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
I want to create a generic metaclass base which will automatically register all classes under it by their identifiers into a tracking dictionary of the metaclass.
Then, all the real metaclasses and base classes will inherit that, and can do this registration automatically and independently for each metaclass.
However, mypy raises an unexpected error.
$ mypy yard.py --strict
yard.py:39: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
Found 1 error in 1 file (checked 1 source file)
I think the error message means that Meta1, the metaclass of Base1, is not a subclass of ProtoMeta, the metaclass of ProtoBase (parent of Base1).
But as you can see, I have verified that Meta1 is a subclass of ProtoMeta, so I don't think this error is raised (or reported) correctly.
To Reproduce
mypy yard.py --strict
Expected Behavior
No error should be raised, or a different error message should be raised.
Actual Behavior
Get unexpected error message: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc].
Your Environment
Mypy version used: mypy 1.10.0 (compiled: yes)
Mypy command-line flags: --strict --verbose
Mypy configuration options from mypy.ini (and other config files):
Python version used: Python 3.8.19
The text was updated successfully, but these errors were encountered:
Bug Report
I want to create a generic metaclass base which will automatically register all classes under it by their identifiers into a tracking dictionary of the metaclass.
Then, all the real metaclasses and base classes will inherit that, and can do this registration automatically and independently for each metaclass.
However, mypy raises an unexpected error.
I think the error message means that
Meta1
, the metaclass ofBase1
, is not a subclass ofProtoMeta
, the metaclass ofProtoBase
(parent ofBase1
).But as you can see, I have verified that
Meta1
is a subclass ofProtoMeta
, so I don't think this error is raised (or reported) correctly.To Reproduce
Expected Behavior
No error should be raised, or a different error message should be raised.
Actual Behavior
Get unexpected error message:
error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
.Your Environment
mypy 1.10.0 (compiled: yes)
--strict --verbose
mypy.ini
(and other config files):Python 3.8.19
The text was updated successfully, but these errors were encountered: