Something similar has been reported as a bug: https://bugs.python.org/issue42509, with someone commenting that
Catching a RecursionError might be fine sometimes, but the issue is that Program 1 catches a RecursionError and then keeps recursing more rather than stopping.
I think it might have to be the responsibility of the Python user to make sure that if a RecursionError is to be caught, that the program can recover without making things much worse. It's my understanding that the extra buffer of +50 is to make sure that the programmer has room to stop the overflow and do any necessary cleanup [1].
If no attempt is made to clean up, then it seems reasonable to me that Python should crash, unless there's some idea of what could happen that I'm missing. The interpreter could allow arbitrary recursion during the cleanup until the C stack overflows, but that sort of defeats the point of the recursion checker. It could raise some new ExtraSuperRecurionError, but that doesn't fix anything: what if that error is caught ;) ?
https://bugs.python.org/msg382128
Assuming this is a minimally reproducible toy example for a real issue you're facing, you should do:
def Recursion():
try:
raise Exception()
except RecursionError:
raise
except Exception:
Recursion()
Recursion()
RecursionErrorand the way you handle it makes it actually worse.Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.in a terminal.