Issue 29923: PEP487 init_subclass incompatible with abc.ABCMeta (original) (raw)
First time issue reporter here. I really love PEP 487, but I'm finding the new init_subclass functionality is not playing nicely with existing abstract class functionality.
For example, taking the Quest example given in PEP 487 but simply adding ABCMeta metaclass results in a runtime error:
class QuestBase(metaclass=abc.ABCMeta):
# this is implicitly a @classmethod (see below for motivation)
def __init_subclass__(cls, swallow, **kwargs):
cls.swallow = swallow
super().__init_subclass__(**kwargs)
class Quest(QuestBase, swallow="african"):
pass
print(Quest.swallow)
Traceback (most recent call last):
File "credentials.py", line 23, in <module>
class Quest(QuestBase, swallow="african"):
TypeError: __new__() got an unexpected keyword argument 'swallow'