I'm not sure that I understood the bug.
You are testing a function which enters an unlimited loop. You expect to get a RecursionError, but Python does crash.
Well, Python has no perfect protection again stack overflow. It's only best effect. You should change sys.setrecursionlimit() to a lower limit to try to limit the risk of a crash.
It's hard to predict how the stack will be used.
FYI the error message comes from Python/ceval.c:
if (tstate->overflowed) {
if (tstate->recursion_depth > recursion_limit + 50) {
/* Overflowing while handling an overflow. Give up. */
Py_FatalError("Cannot recover from stack overflow.");
}
return 0;
}
I suggest you to use sys.setrecursionlimit() in your test, or remove the test.
Maybe there is a real bug, but if it's the case, it will probably be hard to investigate it. You need to dig into gdb. |