-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Applying Metaclass to int-derived classes gives 'Inconsistent metaclass structure' error. #3563
Comments
Thanks for reporting! The problem that In the meantime, maybe @elazarg knows some quick workaround? |
I think inheriting from ABCMeta is a working hack from abc import ABCMeta
class BitMaskMeta(ABCMeta):
pass
class BitMask(int, metaclass=BitMaskMeta):
pass Alternatively, you can use class BitMask(int, metaclass=BitMaskMeta): # type: ignore
pass |
Tried that in a similar case, but it didn't work. Going with type ignore for now. |
This is essentially a duplicate of the typeshed issue (or rather the other way around, but the typeshed one has more discussion). I think it doesn't make sense to keep both open. |
On both
0.510-dev
and0.520-dev-94e3f9cfc2510e651a0147de2626e084a7433f6d
, I have been running into the following error:when trying to apply a metaclass to a class derived from
int
(orfloat
). Repro:When I change BitMask to derive from object the error goes away. Is this the expected behavior? Or a potential BUG?
Thank you! :)
The text was updated successfully, but these errors were encountered: