On 1/19/2021 10:01 AM, Mark Shannon wrote:
The following program will run safely to completion:
I interpreted this to mean 'works now', on whatever system you tested
this on. You question suggests that you meant "fails now but will work
with a successful patch for the PEP".
sys.setrecursionlimit(1_000_000)
On Windows, this recursion limit increase lets the function run about
2160 loops (when run with IDLE) instead of 1000, but makes the behavior
WORSE by replacing the exception with a silent failure. This could be
considered worse than a crash.
def f(n):
if n:
f(n-1)
f(500_000)
I'm not sure whether you are saying that this doesn't work now, that it
can't work, or that it shouldn't work.
If that it doesn't work now, then I agree.
On my Win 10, setting the recursion limit to 2160 (2135 in IDLE, which
bumps it up to account for additional stack space used by IDLE) results
in RecursionError. Much higher and the failure is silent. Always
getting a RecursionError would itself be an improvement.
So I am saying that current recursion limit handling on Windows is
terrible and perhaps worse than on Linux.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/XSPGPFHIP5VWDBEWQHKSU4A55DHFWAGF/
Code of Conduct: http://python.org/psf/codeofconduct/