diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index ed7dd829d4b6f0..d5500b1751e096 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -227,7 +227,7 @@ struct _ts { # define Py_C_RECURSION_LIMIT 1200 #else // This value is duplicated in Lib/test/support/__init__.py -# define Py_C_RECURSION_LIMIT 8000 +# define Py_C_RECURSION_LIMIT 4000 #endif diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index e5fb725a30b5b8..ded30cea1cc08f 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2377,7 +2377,7 @@ def _get_c_recursion_limit(): return _testcapi.Py_C_RECURSION_LIMIT except (ImportError, AttributeError): # Originally taken from Include/cpython/pystate.h . - return 8000 + return 4000 # The default C recursion limit. Py_C_RECURSION_LIMIT = _get_c_recursion_limit() diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 0ef45d3c670e85..6e45c0babc2de4 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1876,8 +1876,7 @@ def fib(n): if not support.Py_DEBUG: with support.infinite_recursion(): - fib(2500) - + self.assertRaises(RecursionError, fib, 2000) @py_functools.lru_cache() def py_cached_func(x, y):