Skip to content

Commit

Permalink
Reduce AST depth to get WASI test to pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
markshannon committed Sep 6, 2022
1 parent 7e21a74 commit 65cca7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Lib/test/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,9 @@ def next(self):

@support.cpython_only
def test_ast_recursion_limit(self):
fail_depth = sys.getrecursionlimit() * 3
crash_depth = sys.getrecursionlimit() * 300
success_depth = int(fail_depth * 0.75)
fail_depth = 5000
crash_depth = 100_000
success_depth = 1200

def check_limit(prefix, repeated):
expect_ok = prefix + repeated * success_depth
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ class MyGlobals(dict):
def __missing__(self, key):
return int(key.removeprefix("_number_"))

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

0 comments on commit 65cca7d

Please sign in to comment.