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


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

Re: Fatal Python error

Started byMarcel Rodrigues <marcelgmr@gmail.com>
First post2013-05-29 09:30 -0300
Last post2013-05-29 09:30 -0300
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 Marcel Rodrigues <marcelgmr@gmail.com> - 2013-05-29 09:30 -0300

#46371 — Re: Fatal Python error

FromMarcel Rodrigues <marcelgmr@gmail.com>
Date2013-05-29 09:30 -0300
SubjectRe: Fatal Python error
Message-ID<mailman.2351.1369830668.3114.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

I just tried your code with similar results: it does nothing on PyPy
2.0.0-beta2 and Python 2.7.4. But on Python 3.3.1 it caused core dump.
It's a little weird but so is the code. You have defined a function that
calls itself unconditionally. This will cause a stack overflow, which is a
RuntimeError.
 Since you are handling this very exception with a pass statement, we would
expect that no error occurs. But the fatal error message seems pretty
informative at this point: "Cannot recover from stack overflow.".

One thing to note is that while it's reasonable to handle exceptions that
happens at the level of your Python code, like a ValueError, it's not so
reasonable to try to handle something that may disturb the interpreter
itself in a lower level, like a stack overflow (I think that the stack used
by your code is the same stack used by the interpreter code, but I'm not
sure).


2013/5/29 Joshua Landau <joshua.landau.ws@gmail.com>

> Hello all, again. Instead of revising like I'm meant to be, I've been
> delving into a bit of Python and I've come up with this code:
>
> class ClassWithProperty:
>  @property
> def property(self):
> pass
>
> thingwithproperty = ClassWithProperty()
>
> def loop():
> try:
> thingwithproperty.property
>  except:
> pass
>
> loop()
>
> try:
> loop()
> except RuntimeError:
> pass
>
> As you will expect, this does nothing... on Python2.7 and PyPy. Python3.3
> prefers to spit out a "Fatal Python error: Cannot recover from stack
> overflow.", which seems a bit unexpected.
>
> Wuzzup with that?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

[toc] | [standalone]


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


csiph-web