Author izbyshev
Recipients izbyshev, levkivskyi, methane, serhiy.storchaka
Date 2018-03-05.20:46:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I've also checked that ABC.register() doesn't allow non-classes (and PEP 3119 mentions that).

Looking at PyObject_IsSubclass in Objects/abstract.c, the only case in which its check_class() could be avoided is if there is a custom __subclasscheck__:

>>> class M(type):
...   def __subclasscheck__(cls, c):
...     return c == 1 or super().__subclasscheck__(c)
>>> class A(metaclass=M):
...   pass
>>> issubclass(1, A)

If there is no need to support such weird __subclasscheck__, check_class() could be called earlier.

Note, however, that check_class() treats anything having __bases__ as a class, so moving the check alone is not enough to avoid the crash in all cases.
Date User Action Args
2018-03-05 20:46:38izbyshevsetrecipients: + izbyshev, methane, serhiy.storchaka, levkivskyi
2018-03-05 20:46:38izbyshevsetmessageid: <>
2018-03-05 20:46:38izbyshevlinkissue32999 messages
2018-03-05 20:46:38izbyshevcreate