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:
Antoine Pitrou 2009-03-13 19:25:20 +00:00
parent ae2dbe2543
commit 652e7076fe
3 changed files with 49 additions and 7 deletions

View file

@ -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;\