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


Groups > comp.lang.python > #46390 > unrolled thread

Re: Fatal Python error

Started byOscar Benjamin <oscar.j.benjamin@gmail.com>
First post2013-05-29 16:17 +0100
Last post2013-05-29 16:17 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#46390 — Re: Fatal Python error

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2013-05-29 16:17 +0100
SubjectRe: Fatal Python error
Message-ID<mailman.2362.1369840706.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web