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...@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 > >
-- http://mail.python.org/mailman/listinfo/python-list