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:
Antoine Pitrou 2008-08-26 22:42:08 +00:00
parent 14cb6bcf2b
commit 0668c62677
8 changed files with 211 additions and 88 deletions

View file

@ -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);