<div dir="ltr"><div><div>I think the issue here has little to do with classes/objects/properties. See, for example, the code posted by <span name="Oscar Benjamin" class="">Oscar Benjamin.<br><br></span></div><span name="Oscar Benjamin" class="">What that code is trying to do is similar to responding to an "Out Of Memory" error with something that might require more memory allocation.<br>
<br></span></div><div><span name="Oscar Benjamin" class="">Even if we consider the Py3 behavior here a bug, that code is unreliable by design. It's an infinite loop at the best.<br></span></div><span name="Oscar Benjamin" class=""></span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/29 Joshua Landau <span dir="ltr"><<a href="mailto:joshua.landau.ws@gmail.com" target="_blank">joshua.landau.ws@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="im">On 29 May 2013 13:30, Marcel Rodrigues <<a href="mailto:marcelgmr@gmail.com" target="_blank">marcelgmr@gmail.com</a>> wrote:<br>><br>> 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.<br>


> 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.<br><br><br></div>The weirdness of the code is simply as I've taken all the logic and conditionality away, since it was irrelevant. Why, though, does removing any one element make it fail properly? That's what's confusing, largely.<div class="im">
<br>

 <br>><br>>  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.".<br>


><br>> 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).<br>


<br><br></div>What is the expected response here then? Should I ever feel justified in catching a Stack Overflow error? This code was extracted from a file manager after much difficulty, but it should have been "caught" by a global try...except and not crashed the whole program immediately. I'd imagine that's a good enough reason to bring this up.<br>


<br><br><br>Also;<br>This works for the code:<br><br>def loop():<br>    thingwithproperty.prop<br>    loop()<br><br>This does not:<br><br>def loop():<br>    try:<br>        thingwithproperty.prop<br>    except:<br>        pass<br>


loop()<br><br>thingwithproperty.prop NEVER creates an error.<br>(.prop is the new .property)<br></div>
</blockquote></div><br></div>