[Python-Dev] Two possible fixes for isinstance nested tuples
Brett Cannon
bac at OCF.Berkeley.EDU
Sat Mar 20 11:09:16 EST 2004
Bug #858016 brought up the issue of deeply nested tuples of classes
segfaulting isinstance and issubclass. There is a patch with the bug
report that adds a check to make sure the tuple is completely shallow.
For Python 2.3, though, that doesn't work since it breaks code. So I have
coded up something that calls Py_GetRecursionLimit and makes sure the
depth never goes past that.
The question is which solution to use for Python 2.4 . I did some
benchmarking on as-is and with the recursion check and the performance
difference is no worse than 2% (granted this was before I made the
recursion functions static, but that should just help performance).
Would people rather do the recursion check or force people to use a
shallow tuple in 2.4?
-Brett
More information about the Python-Dev
mailing list