issubclass() accept types (extension types and new-style classes),
classic classes and arbitrary objects with the __bases__ attribute as
its arguments. The latter was added in issue464992 [1] to support the
Zope extension ExtensionClass.

I tested the current code of ExtensionClass [2], and seems it does not
need that special support. Tests are passed on modified master which
uses tp_bases instead of dynamical look up of __bases__,
ExtensionClass.ExtensionClass is a subclass of type and
ExtensionClass.Base is an instance of type, the code does not have the
__bases__ property and does not set the __bases__ attribute explicitly.

On other hand, the code in the Python core has a non-zero maintenance
cost. It was rewritten several times for 19 years, there is a gigantic
comment larger that the current code explaining it (and it is slightly
outdated), and there was several bugs related to it [3] [4].

Should we continue to support non-type objects with __bases__ in
issubclass()? If no, can we remove their support in 3.10 (it would fix a
crash in issue41909) or after passing a deprecation period?

[1] https://bugs.python.org/issue464992
[2] https://github.com/zopefoundation/ExtensionClass
[3] https://bugs.python.org/issue39382
[4] https://bugs.python.org/issue41909
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2S2FM2J44H2FQTZZOC7MINFVMZMQKCOP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to