This is from a thread on python-list that started here:
http://mail.python.org/pipermail/python-list/2013-May/647895.html
There are situations in which the Python 3.2 and 3.3 interpreters crash with "Fatal Python error: Cannot recover from stack overflow."
when I believe the correct response is a RuntimeError (as happens in 2.7). I've attached a file crash.py that demonstrates the problem.
The following gives the same behaviour in 2.7, 3.2 and 3.3:
$ cat tmp.py
def loop():
loop()
loop()
$ py -3.2 tmp.py
Traceback (most recent call last):
File "tmp.py", line 4, in <module>
loop()
File "tmp.py", line 2, in loop
loop()
File "tmp.py", line 2, in loop
loop()
File "tmp.py", line 2, in loop
loop()
File "tmp.py", line 2, in loop
...
However the following leads to a RuntimeError in 2.7 but different
fatal stack overflow errors in 3.2 and 3.3 (tested on Windows XP using 32-bit python.org installers):
$ cat tmp.py
def loop():
try:
(lambda: None)()
except RuntimeError:
pass
loop()
loop()
$ py -2.7 tmp.py
Traceback (most recent call last):
File "tmp.py", line 8, in <module>
loop()
File "tmp.py", line 6, in loop
loop()
File "tmp.py", line 6, in loop
loop()
File "tmp.py", line 6, in loop
loop()
File "tmp.py", line 6, in loop
...
RuntimeError: maximum recursion depth exceeded
$ py -3.2 tmp.py
Fatal Python error: Cannot recover from stack overflow.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
$ py -3.3 tmp.py
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x000005c4:
File "tmp.py", line 3 in loop
File "tmp.py", line 6 in loop
File "tmp.py", line 6 in loop
File "tmp.py", line 6 in loop
File "tmp.py", line 6 in loop
File "tmp.py", line 6 in loop
File "tmp.py", line 6 in loop
...
Also tested on stock Python 3.2.3 on Ubuntu (2.7 gives RuntimeError):
$ python3 tmp.py
Fatal Python error: Cannot recover from stack overflow.
Aborted (core dumped)
I would expect this to give "RuntimeError: maximum recursion depth
exceeded" in all cases.
Oscar
|