mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__ mechanism. In the process, fix a bug where isinstance() and issubclass(), when given a tuple of classes as second argument, were looking up __instancecheck__ / __subclasscheck__ on the tuple rather than on each type object. Reviewed by Benjamin Peterson and Raymond Hettinger.
This commit is contained in:
parent
14cb6bcf2b
commit
0668c62677
8 changed files with 211 additions and 88 deletions
|
@ -113,7 +113,6 @@ PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
|
|||
/* This function must not fail, so print the error here */
|
||||
if (res == -1) {
|
||||
PyErr_WriteUnraisable(err);
|
||||
/* issubclass did not succeed */
|
||||
res = 0;
|
||||
}
|
||||
PyErr_Restore(exception, value, tb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue