Skip to content

Commit f193c8f

Browse files
authored
gh-141794: Reduce size of compiler stress tests to fix Android warnings (#142263)
1 parent 1db9f56 commit f193c8f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Lib/test/test_ast/test_ast.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,8 @@ def next(self):
992992
@skip_wasi_stack_overflow()
993993
@skip_emscripten_stack_overflow()
994994
def test_ast_recursion_limit(self):
995-
crash_depth = 500_000
995+
# Android test devices have less memory.
996+
crash_depth = 100_000 if sys.platform == "android" else 500_000
996997
success_depth = 200
997998
if _testinternalcapi is not None:
998999
remaining = _testinternalcapi.get_c_recursion_remaining()

Lib/test/test_compile.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ def test_yet_more_evil_still_undecodable(self):
728728
def test_compiler_recursion_limit(self):
729729
# Compiler frames are small
730730
limit = 100
731-
crash_depth = limit * 5000
731+
# Android test devices have less memory.
732+
crash_depth = limit * (1000 if sys.platform == "android" else 5000)
732733
success_depth = limit
733734

734735
def check_limit(prefix, repeated, mode="single"):
@@ -1036,11 +1037,13 @@ def test_path_like_objects(self):
10361037
# An implicit test for PyUnicode_FSDecoder().
10371038
compile("42", FakePath("test_compile_pathlike"), "single")
10381039

1040+
# bpo-31113: Stack overflow when compile a long sequence of
1041+
# complex statements.
10391042
@support.requires_resource('cpu')
10401043
def test_stack_overflow(self):
1041-
# bpo-31113: Stack overflow when compile a long sequence of
1042-
# complex statements.
1043-
compile("if a: b\n" * 200000, "<dummy>", "exec")
1044+
# Android test devices have less memory.
1045+
size = 100_000 if sys.platform == "android" else 200_000
1046+
compile("if a: b\n" * size, "<dummy>", "exec")
10441047

10451048
# Multiple users rely on the fact that CPython does not generate
10461049
# bytecode for dead code blocks. See bpo-37500 for more context.

0 commit comments

Comments
 (0)