STINNER Victor added the comment:

Attached patch raises a ValueError if the current recursion depth is higher 
than the new "low-water mark". The low-water mark is the value computed by 
_Py_MakeEndRecCheck() in Py_LeaveRecursiveCall() to decide if we can reset the 
overflowed field of the thread state to 0.

Example of error with the patch:

$ ./python -c 'import sys; sys.setrecursionlimit(2)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: cannot set recursion limit to 2: the minimum recursion limit is 1 
at the recursion depth 1

----------
keywords: +patch
title: "./python -m test test_sys": Fatal Python error: Cannot recover from 
stack overflow -> sys.setrecursionlimit() must fail if the current recursion 
depth is higher than the new low-water mark
Added file: http://bugs.python.org/file40640/sys_setrecursionlimit.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25274>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to