diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 3879c49c714dd9..ab5b306ff6a7e4 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -53,7 +53,7 @@ from test.support import ( captured_stderr, cpython_only, requires_docstrings, import_helper, run_code, subTests, EqualToForwardRef, - exceeds_recursion_limit, run_with_limited_c_stack, + run_with_limited_c_stack, skip_wasi_stack_overflow, skip_emscripten_stack_overflow, ) from test.typinganndata import ( @@ -5097,12 +5097,14 @@ class MM2(collections.abc.MutableMapping, MutableMapping[str, str]): self.assertEqual(MM2.__bases__, (collections.abc.MutableMapping, Generic)) @cpython_only - @run_with_limited_c_stack() + @run_with_limited_c_stack(500_000) @skip_wasi_stack_overflow() @skip_emscripten_stack_overflow() def test_parameters_deep_recursion(self): + # _Py_make_parameters() has small C frames (48 bytes per level + # on 32-bit ARM), so 150_000 levels can fit in the limited C stack. x = [0] - for _ in range(exceeds_recursion_limit()): + for _ in range(500_000): x = [x] with self.assertRaisesRegex(RecursionError, "in __parameter__ calculation"): list[x].__parameters__ diff --git a/Misc/NEWS.d/next/Tests/2026-11-12-05-39-56.gh-issue-158314.SZiMPV.rst b/Misc/NEWS.d/next/Tests/2026-11-12-05-39-56.gh-issue-158314.SZiMPV.rst new file mode 100644 index 00000000000000..cc547ae93d5773 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-11-12-05-39-56.gh-issue-158314.SZiMPV.rst @@ -0,0 +1,3 @@ +Fix ``test_typing.GenericTests.test_parameters_deep_recursion`` on 32-bit +ARM debug builds, where 150,000 nested lists did not exhaust the limited C +stack.