Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46390

Re: Fatal Python error

References <CAN1F8qXPEM4B=2e7KOhWeTKzxmeeb_w_S97wYiHCMXH3jfzL6g@mail.gmail.com> <CAHVvXxTxzZjhsmDw3x0Wm-wyLmdx5VehzKahnfkTSNrmigKMUA@mail.gmail.com> <51A5FC7D.8080202@davea.name>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date 2013-05-29 16:17 +0100
Subject Re: Fatal Python error
Newsgroups comp.lang.python
Message-ID <mailman.2362.1369840706.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 29 May 2013 14:02, Dave Angel <davea@davea.name> wrote:
> On 05/29/2013 08:45 AM, Oscar Benjamin wrote:
>
> More likely a bug in the 2.x interpreter.  Once inside an exception handler,
> that frame must be held somehow.  If not on the stack, then in some separate
> list.  So the logic will presumably fill memory, it just may take longer on
> 2.x .

I'm not so sure. 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
stack overflow errors in 3.2 and 3.3:

$ 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
...

I would expect this to give "RuntimeError: maximum recursion depth
exceeded" in all three cases.


Oscar

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fatal Python error Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-05-29 16:17 +0100

csiph-web