Hello.
Using a metaclass with slots=True, e.g.
@attr.s(slots=True)
class A(metaclass=abc.ABCMeta):
@abc.abstractmethod
def f(self):
pass
Will lead to A being instantiable and type(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?
Hello.
Using a metaclass with slots=True, e.g.
Will lead to
Abeing 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?