Skip to content

Commit

Permalink
pythongh-113655: Reduce recursion limit to a safe number for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Jan 2, 2024
1 parent fff1e8a commit 5d5ab9f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Include/cpython/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ def fib(n):

if not support.Py_DEBUG:
with support.infinite_recursion():
fib(2500)
fib(1250)


@py_functools.lru_cache()
Expand Down

0 comments on commit 5d5ab9f

Please sign in to comment.