Skip to content

Commit 9aef6ec

Browse files
committed
Try increasing the C recursion limit
1 parent de8a4e5 commit 9aef6ec

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
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 1500
228+
# define Py_C_RECURSION_LIMIT 4500
229229
#endif
230230

231231

Lib/test/support/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,15 +2374,15 @@ def adjust_int_max_str_digits(max_digits):
23742374
sys.set_int_max_str_digits(current)
23752375

23762376
#For recursion tests, easily exceeds default recursion limit
2377-
EXCEEDS_RECURSION_LIMIT = 5000
2377+
EXCEEDS_RECURSION_LIMIT = 10_000
23782378

23792379
def _get_c_recursion_limit():
23802380
try:
23812381
import _testcapi
23822382
return _testcapi.Py_C_RECURSION_LIMIT
23832383
except (ImportError, AttributeError):
23842384
# Originally taken from Include/cpython/pystate.h .
2385-
return 1500
2385+
return 4500
23862386

23872387
# The default C recursion limit.
23882388
Py_C_RECURSION_LIMIT = _get_c_recursion_limit()

Parser/asdl_c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ class PartingShots(StaticVisitor):
13891389
13901390
int starting_recursion_depth;
13911391
/* Be careful here to prevent overflow. */
1392-
int COMPILER_STACK_FRAME_SCALE = 2;
1392+
int COMPILER_STACK_FRAME_SCALE = 1;
13931393
PyThreadState *tstate = _PyThreadState_GET();
13941394
if (!tstate) {
13951395
return NULL;

Python/Python-ast.c

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ validate_type_params(struct validator *state, asdl_type_param_seq *tps)
10391039

10401040

10411041
/* See comments in symtable.c. */
1042-
#define COMPILER_STACK_FRAME_SCALE 2
1042+
#define COMPILER_STACK_FRAME_SCALE 1
10431043

10441044
int
10451045
_PyAST_Validate(mod_ty mod)

Python/ast_opt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ astfold_type_param(type_param_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat
11011101
#undef CALL_SEQ
11021102

11031103
/* See comments in symtable.c. */
1104-
#define COMPILER_STACK_FRAME_SCALE 2
1104+
#define COMPILER_STACK_FRAME_SCALE 1
11051105

11061106
int
11071107
_PyAST_Optimize(mod_ty mod, PyArena *arena, int optimize, int ff_features)

Python/symtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ symtable_new(void)
389389
/* Using a scaling factor means this should automatically adjust when
390390
the recursion limit is adjusted for small or large C stack allocations.
391391
*/
392-
#define COMPILER_STACK_FRAME_SCALE 2
392+
#define COMPILER_STACK_FRAME_SCALE 1
393393

394394
struct symtable *
395395
_PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)

0 commit comments

Comments
 (0)