]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141794: Reduce size of compiler stress tests to fix Android warnings (GH...
authorMalcolm Smith <smith@chaquo.com>
Mon, 8 Dec 2025 10:37:53 +0000 (10:37 +0000)
committerGitHub <noreply@github.com>
Mon, 8 Dec 2025 10:37:53 +0000 (12:37 +0200)
(cherry picked from commit f193c8fe9e1d722c9a7f9a2b15f8f1b913755491)

Lib/test/test_compile.py

index 06b5fd5bbc8318498cd4bcba818d504b23f04f92..cdc8d8ef539f81b75d6fa3c89f9aae5f55e209c5 100644 (file)
@@ -993,11 +993,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.