Skip to content

Commit dcd6c4d

Browse files
committed
Change max C recursion to 7000
1 parent 5e50b7e commit dcd6c4d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Include/cpython/pystate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct _ts {
225225
# define Py_C_RECURSION_LIMIT 500
226226
#else
227227
// This value is duplicated in Lib/test/support/__init__.py
228-
# define Py_C_RECURSION_LIMIT 4500
228+
# define Py_C_RECURSION_LIMIT 7000
229229
#endif
230230

231231

Lib/test/support/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,9 @@ def set_recursion_limit(limit):
21232123

21242124
def infinite_recursion(max_depth=None):
21252125
if max_depth is None:
2126+
# Pick a number large enough to cause problems
2127+
# but not take too long for code that can handle
2128+
# very deep recursion.
21262129
max_depth = 20_000
21272130
elif max_depth < 3:
21282131
raise ValueError("max_depth must be at least 3, got {max_depth}")
@@ -2371,7 +2374,7 @@ def _get_c_recursion_limit():
23712374
return _testcapi.Py_C_RECURSION_LIMIT
23722375
except (ImportError, AttributeError):
23732376
# Originally taken from Include/cpython/pystate.h .
2374-
return 4500
2377+
return 7000
23752378

23762379
# The default C recursion limit.
23772380
Py_C_RECURSION_LIMIT = _get_c_recursion_limit()

0 commit comments

Comments
 (0)