This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oscarbenjamin
Recipients oscarbenjamin
Date 2013-06-03.22:18:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1370297932.54.0.350896209872.issue18129@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-06-03 22:18:52oscarbenjaminsetrecipients: + oscarbenjamin
2013-06-03 22:18:52oscarbenjaminsetmessageid: <1370297932.54.0.350896209872.issue18129@psf.upfronthosting.co.za>
2013-06-03 22:18:52oscarbenjaminlinkissue18129 messages
2013-06-03 22:18:52oscarbenjamincreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.