Skip to content

Commit 65cca7d

Browse files
committed
Reduce AST depth to get WASI test to pass.
1 parent 7e21a74 commit 65cca7d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Lib/test/test_ast.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,9 @@ def next(self):
816816

817817
@support.cpython_only
818818
def test_ast_recursion_limit(self):
819-
fail_depth = sys.getrecursionlimit() * 3
820-
crash_depth = sys.getrecursionlimit() * 300
821-
success_depth = int(fail_depth * 0.75)
819+
fail_depth = 5000
820+
crash_depth = 100_000
821+
success_depth = 1200
822822

823823
def check_limit(prefix, repeated):
824824
expect_ok = prefix + repeated * success_depth

Lib/test/test_dynamic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ class MyGlobals(dict):
140140
def __missing__(self, key):
141141
return int(key.removeprefix("_number_"))
142142

143-
# 1,000 on most systems
144-
limit = sys.getrecursionlimit()
145-
code = "lambda: " + "+".join(f"_number_{i}" for i in range(limit))
143+
# Need more than 256 variables to use EXTENDED_ARGS
144+
variables = 400
145+
code = "lambda: " + "+".join(f"_number_{i}" for i in range(variables))
146146
sum_func = eval(code, MyGlobals())
147-
expected = sum(range(limit))
147+
expected = sum(range(variables))
148148
# Warm up the the function for quickening (PEP 659)
149149
for _ in range(30):
150150
self.assertEqual(sum_func(), expected)

0 commit comments

Comments
 (0)