]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141794: Reduce size of compiler stress tests to fix Android warnings (#142263)
authorMalcolm Smith <smith@chaquo.com>
Sun, 7 Dec 2025 20:01:01 +0000 (20:01 +0000)
committerGitHub <noreply@github.com>
Sun, 7 Dec 2025 20:01:01 +0000 (22:01 +0200)
Lib/test/test_ast/test_ast.py
Lib/test/test_compile.py

index 608ffdfad1209a22fe147e0080419b25c64dd7ff..d2b76b46dbe2eba06679ef4f01404ef1b9c88637 100644 (file)
@@ -992,7 +992,8 @@ class AST_Tests(unittest.TestCase):
     @skip_wasi_stack_overflow()
     @skip_emscripten_stack_overflow()
     def test_ast_recursion_limit(self):
-        crash_depth = 500_000
+        # Android test devices have less memory.
+        crash_depth = 100_000 if sys.platform == "android" else 500_000
         success_depth = 200
         if _testinternalcapi is not None:
             remaining = _testinternalcapi.get_c_recursion_remaining()
index 30f21875b22ab3825bce98e5a459a2625330c69a..fa611f480d60fd461ebc3f84cc026af537029d58 100644 (file)
@@ -728,7 +728,8 @@ class TestSpecifics(unittest.TestCase):
     def test_compiler_recursion_limit(self):
         # Compiler frames are small
         limit = 100
-        crash_depth = limit * 5000
+        # Android test devices have less memory.
+        crash_depth = limit * (1000 if sys.platform == "android" else 5000)
         success_depth = limit
 
         def check_limit(prefix, repeated, mode="single"):
@@ -1036,11 +1037,13 @@ class TestSpecifics(unittest.TestCase):
         # An implicit test for PyUnicode_FSDecoder().
         compile("42", FakePath("test_compile_pathlike"), "single")
 
+    # bpo-31113: Stack overflow when compile a long sequence of
+    # complex statements.
     @support.requires_resource('cpu')
     def test_stack_overflow(self):
-        # bpo-31113: Stack overflow when compile a long sequence of
-        # complex statements.
-        compile("if a: b\n" * 200000, "<dummy>", "exec")
+        # Android test devices have less memory.
+        size = 100_000 if sys.platform == "android" else 200_000
+        compile("if a: b\n" * size, "<dummy>", "exec")
 
     # Multiple users rely on the fact that CPython does not generate
     # bytecode for dead code blocks. See bpo-37500 for more context.