-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Metaclass lost with slots=True #154
Comments
It's not intentional, it just hasn't come up until now. :) Could you try applying the change, and if the tests pass contribute a PR? It'd be nice to add a test for this as well. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello.
Using a metaclass with slots=True, e.g.
Will lead to
A
being instantiable andtype(A)
being<class 'type'>
(unlike the case with slots=False), as for slots to work the new class is generated in _make.py with:cls = type(cls.__name__, cls.__bases__, cls_dict)
[1]This doesn't happen if this line is changed to:
cls = type(cls)(cls.__name__, cls.__bases__, cls_dict)
[2]With this change
type(A)
is<class 'abc.ABCMeta'>
and A is no longer instantiable.Can the class generation for slots be changed to something like [2] to avoid losing metaclasses or it is intentionally written as it is now and I am missing something?
The text was updated successfully, but these errors were encountered: