Amaury Forgeot d'Arc <amaur...@gmail.com> added the comment:

Tested on Linux:
Python 2.7.2+ (2.7:16c4137a413c+, Dec  4 2011, 22:56:38) 
[GCC 4.4.3] on linux2
>>> import sys
>>> sys.setrecursionlimit((1<<31)-1)
>>> import xx
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' 
in <type 'exceptions.ImportError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' 
in <type 'exceptions.ImportError'> ignored
Traceback (most recent call last):

This comes from PyErr_GivenExceptionMatches() which tries to "Temporarily bump 
the recursion limit", and calls Py_SetRecursionLimit(reclimit + 5); without any 
consideration for 32bit int overflow... and PyErr_WriteUnraisable() is called 
to display the error.

IDLE crashes (with a real stack overflow) because sys.stderr is a special 
RPCProxy object whose methods are found through a __getattr__. But __getattr__ 
is called when __getattribute__ raises AttributeError, right?  To implement 
this, PyErr_GivenExceptionMatches() is called again, fails again, call 
PyErr_WriteUnraisable()... recursively.

The fix should be easy: do not bump the recursion limit when it's already too 
high.

----------
resolution: wont fix -> 
stage: committed/rejected -> needs patch
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13546>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to