https://github.com/python/cpython/commit/d2f5a0e72e0220366ca4ce4184e0011a04d1505f
commit: d2f5a0e72e0220366ca4ce4184e0011a04d1505f
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: Eclips4 <[email protected]>
date: 2025-12-08T09:58:21+02:00
summary:

[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 f193c8fe9e1d722c9a7f9a2b15f8f1b913755491)

Co-authored-by: Malcolm Smith <[email protected]>

files:
M Lib/test/test_ast/test_ast.py
M Lib/test/test_compile.py

diff --git a/Lib/test/test_ast/test_ast.py b/Lib/test/test_ast/test_ast.py
index 361ee508376d2a..c13423edba625e 100644
--- a/Lib/test/test_ast/test_ast.py
+++ b/Lib/test/test_ast/test_ast.py
@@ -991,7 +991,8 @@ def next(self):
     @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()
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index b978be8bc6862b..d37a9db8c8368a 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -728,7 +728,8 @@ def test_yet_more_evil_still_undecodable(self):
     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"):
@@ -1030,11 +1031,13 @@ def test_path_like_objects(self):
         # 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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to