Thomas Heller <[EMAIL PROTECTED]> added the comment:
Problem found. See issue #2542, which contains a patch that fixes the
failure in test_exceptions; this test now additionally prints
Exception RuntimeError: 'maximum recursion depth exceeded in
__subclasscheck__' in ignored
Exception
Daniel Diniz <[EMAIL PROTECTED]> added the comment:
Thomas: I confirm your patch triggers this behavior. I can reliably get
a __subclasscheck__ error by trying to "import sys" after the bogus
catching happens:
>>> def g():
... try:
... return g()
... except ValueError:
... return sy
Thomas Heller <[EMAIL PROTECTED]> added the comment:
Running Daniels code interactively, with a debug build on Windows,
additionally prints 'XXX undetected error' before the Runtime error is
raised.
I cannot see anything that is wrong with my code. Maybe this, and the
test failure, has to do wi
Daniel Diniz <[EMAIL PROTECTED]> added the comment:
The test fails on this:
def g():
try:
return g()
except ValueError:
return -1
self.assertRaises(RuntimeError, g)
Changing that "return -1" to "return sys.exc_info()" shows that a
RuntimeError was raised indeed. Also, u
Facundo Batista <[EMAIL PROTECTED]> added the comment:
I find similar speedups:
isinstance(42, int) -2%
isinstance(42, type) 45%
isinstance(object, type) -1%
isinstance(object, int) 42%
isinstance(float, int)44%
(both negative ones are actually lower than original, but so low
New submission from Thomas Heller <[EMAIL PROTECTED]>:
This patch implements type.__instancecheck__ and type.__subclasscheck__,
which speeds up isinstance and issubclass calls quite a bit.
See also issue #2303.
Here are the performance figures for the current trunk version:
Current SNV trunk: