Skip to content

Commit d2f5a0e

Browse files
[3.14] gh-141794: Reduce size of compiler stress tests to fix Android warnings (GH-142263) (#142386)
gh-141794: Reduce size of compiler stress tests to fix Android warnings (GH-142263) (cherry picked from commit f193c8f) Co-authored-by: Malcolm Smith <[email protected]>
1 parent 7308015 commit d2f5a0e

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
@@ -991,7 +991,8 @@ def next(self):
991991
@skip_wasi_stack_overflow()
992992
@skip_emscripten_stack_overflow()
993993
def test_ast_recursion_limit(self):
994-
crash_depth = 500_000
994+
# Android test devices have less memory.
995+
crash_depth = 100_000 if sys.platform == "android" else 500_000
995996
success_depth = 200
996997
if _testinternalcapi is not None:
997998
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"):
@@ -1030,11 +1031,13 @@ def test_path_like_objects(self):
10301031
# An implicit test for PyUnicode_FSDecoder().
10311032
compile("42", FakePath("test_compile_pathlike"), "single")
10321033

1034+
# bpo-31113: Stack overflow when compile a long sequence of
1035+
# complex statements.
10331036
@support.requires_resource('cpu')
10341037
def test_stack_overflow(self):
1035-
# bpo-31113: Stack overflow when compile a long sequence of
1036-
# complex statements.
1037-
compile("if a: b\n" * 200000, "<dummy>", "exec")
1038+
# Android test devices have less memory.
1039+
size = 100_000 if sys.platform == "android" else 200_000
1040+
compile("if a: b\n" * size, "<dummy>", "exec")
10381041

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

0 commit comments

Comments
 (0)