Skip to content

Commit 5d5ab9f

Browse files
committed
pythongh-113655: Reduce recursion limit to a safe number for Windows
1 parent fff1e8a commit 5d5ab9f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Include/cpython/pystate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ struct _ts {
227227
# define Py_C_RECURSION_LIMIT 1200
228228
#else
229229
// This value is duplicated in Lib/test/support/__init__.py
230-
# define Py_C_RECURSION_LIMIT 8000
230+
# define Py_C_RECURSION_LIMIT 4000
231231
#endif
232232

233233

Lib/test/support/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2377,7 +2377,7 @@ def _get_c_recursion_limit():
23772377
return _testcapi.Py_C_RECURSION_LIMIT
23782378
except (ImportError, AttributeError):
23792379
# Originally taken from Include/cpython/pystate.h .
2380-
return 8000
2380+
return 4000
23812381

23822382
# The default C recursion limit.
23832383
Py_C_RECURSION_LIMIT = _get_c_recursion_limit()

Lib/test/test_functools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ def fib(n):
18761876

18771877
if not support.Py_DEBUG:
18781878
with support.infinite_recursion():
1879-
fib(2500)
1879+
fib(1250)
18801880

18811881

18821882
@py_functools.lru_cache()

0 commit comments

Comments
 (0)