This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Nate Soares
Recipients Nate Soares
Date 2017-02-16.18:54:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I believe I've found a bug (or, at least, critical shortcoming) in the way that python 3.6's __init_subclass__ interacts with abc.ABCMeta (and, presumably, most other metaclasses in the standard library). In short, if a class subclasses both an abstract class and a class-that-uses-__init_subclass__, and the __init_subclass__ uses keyword arguments, then this will often lead to TypeErrors (because the  metaclass gets confused by the keyword arguments to __new__ that were meant for __init_subclass__).

Here's an example of the failure. This code:

from abc import ABCMeta
class Initifier:
    def __init_subclass__(cls, x=None, **kwargs):
        print('got x', x)

class Abstracted(metaclass=ABCMeta):

class Thingy(Abstracted, Initifier, x=1):

thingy = Thingy()

raises this TypeError when run:

Traceback (most recent call last):
  File "<filename>", line 10, in <module>
    class Thingy(Abstracted, Initifier, x=1):
TypeError: __new__() got an unexpected keyword argument 'x'

See for further discussion.
Date User Action Args
2017-02-16 18:54:07Nate Soaressetrecipients: + Nate Soares
2017-02-16 18:54:07Nate Soaressetmessageid: <>
2017-02-16 18:54:07Nate Soareslinkissue29581 messages
2017-02-16 18:54:07Nate Soarescreate