[Python-Dev] Two possible fixes for isinstance nested tuples

Guido van Rossum guido at python.org
Sat Mar 20 16:18:15 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?

I mentioned in person to Brett to use the same solution in 2.4 as in
2.3.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list