mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Issue #5392: when a very low recursion limit was set, the interpreter would
abort with a fatal error after the recursion limit was hit twice.
This commit is contained in:
parent
ae2dbe2543
commit
652e7076fe
3 changed files with 49 additions and 7 deletions
|
@ -92,11 +92,10 @@ PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
|||
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
||||
#endif
|
||||
|
||||
#ifdef USE_STACKCHECK
|
||||
# define _Py_MakeEndRecCheck(x) (--(x) < _Py_CheckRecursionLimit - 50)
|
||||
#else
|
||||
# define _Py_MakeEndRecCheck(x) (--(x) < _Py_CheckRecursionLimit - 50)
|
||||
#endif
|
||||
#define _Py_MakeEndRecCheck(x) \
|
||||
(--(x) < ((_Py_CheckRecursionLimit > 100) \
|
||||
? (_Py_CheckRecursionLimit - 50) \
|
||||
: (3 * (_Py_CheckRecursionLimit >> 2))))
|
||||
|
||||
#define Py_ALLOW_RECURSION \
|
||||
do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue