New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: nested exceptions crash (Cannot recover from stack overflow) #47805
Comments
The following code works[1] on trunk and 2.5.1, but crashes with "Fatal # Python 3.0b2+ (py3k:65676, Aug 14 2008, 14:37:38) import sys
def overflower():
try:
return overflower()
except:
return sys.exc_info()
def f():
try:
return f()
except:
return overflower()
f()
###### Catching RuntimeError crashes, letting it be raised avoids the crash. A smaller test case for hitting the overflow in py3k would be "def f(): [1] "Works" as in "doesn't crash", but both the code above and the |
I'm no expert in recursion checking inside the Python interpreter, but Here how I understand it. When the recursion level exceeds the normal This is actually what happens in your example: when the normal recursion Here is a simpler way to showcase this behaviour, without any nested def f():
try:
return f()
except:
pass
f()
f() Can someone else comment on this? |
Antoine, Thanks for your analysis. I still believe this is a regression for the
It does seem to be working as designed, if that is a desirable behavior
Except that it wasn't an infinite loop in 2.5 and isn't in trunk: it Your showcase is a better way of getting an infinite loop in trunk than |
That's because the stated behaviour is only implemented in 3.0 and not |
Antoine, My last worry is that it'd be kinda easy to get Fatal errors from class rec:
def __str__(self):
return str(self)
def overflower(x):
try:
return overflower(x)
except:
print (x)
list_rec = [100000000001]
for _ in range(12): list_rec = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[list_rec]]]]]]]]]]]]]]]]]]]]]]]]]
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
str_rec = rec()
overflower(1) # OK
overflower(list_rec) # Aborts
overflower(str_rec) # Aborts ============ Thanks for the feedback! |
just submitted a nearly identical bug (bpo-7338) b4 checking for this one. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: