Author methane
Recipients izbyshev, jab, levkivskyi, methane, serhiy.storchaka
Date 2018-03-08.12:23:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 1. ABCMeta.register() accepts types only.

Yes.  While ABC.register() and issubclass() have different users (e.g. ABC.register() will be used by  framework author, and issubclass will be used by framework users), it's positive reason to remove non-type support.

> 2. ABCMeta.__subclasscheck__ implicitly requires its arguments to support weak references (regardless of whether __subclasshook__ is called or not). This requirement alone doesn't make sense, so it seems to be an exposed implementation detail stemming from the fact that non-types were not intended to be supported.

Isn't it just a limitation?
Most Python-implemented objects supports weakref. I don't think "requiring weakref support implies it must be type object".

> 3. Some ABC users already expect that the argument of __subclasshook__ is a type (see the example with by OP).

What "by OP" means?
I can't find `if not issubclass(cls, type): raise TypeError` in Reversible implementation.
They do duck-typing, same to ABC.

> 4. Attempting to support arbitrary arguments in ABC.__subclasscheck__ (by returning False instead of raising TypeError or worse) will not solve any 'issubclass' inconsistencies. 'issubclass' is fundamentally "fragmented": issubclass(x, y) may return True/False while issubclass(x, z) may raise TypeError, depending on __subclasscheck__ implementation.

Yes, as I commented above.

> It may be too late to impose stricter requirements for the first argument of issubclass because 'typing' module relies on the support of non-types there.

Of course.

Personally speaking, I dislike magics including ABC, __subclasscheck__, overwriting __class__ with dummy object.  So I'm OK to limit the ability of it.

But I don't know much about how mages use ABC.  I need mages comment before merging the pull request.

BTW, do you think it should be backported to 3.7, or even 3.6?
Can be reverted?
Date User Action Args
2018-03-08 12:23:03methanesetrecipients: + methane, jab, serhiy.storchaka, levkivskyi, izbyshev
2018-03-08 12:23:03methanesetmessageid: <>
2018-03-08 12:23:03methanelinkissue33018 messages
2018-03-08 12:23:03methanecreate