[issue30230] Move quick test in PyObject_IsSubClass outside of PyType_CheckExact guard

Serhiy Storchaka report at bugs.python.org
Wed May 10 04:31:18 EDT 2017


Serhiy Storchaka added the comment:

Jim doesn't propose to remove fast test, it proposes to add a test for fast path for avoiding invoking __subclasscheck__ (this is slow). This can change semantic, but isinstance() already contains such fast path.

This is similar to testing "elem is seq[i]" before "elem == seq[i]" when search in sequences. This optimization changes semantic for NaNs. Does a "Not-A-Class" class which is not a subclass of itself (issubclass(C, C) returns False) makes any sense?

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30230>
_______________________________________


More information about the Python-bugs-list mailing list