From dac1da21218a406652b35919aa2118cc32d4c65a Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 12 Jan 2024 16:29:16 -0800 Subject: [PATCH] GH-111798: skip `test_super_deep()` from `test_call` under pydebug builds on WASI (GH-114010) --- Lib/test/test_call.py | 10 ++++------ .../2024-01-12-14-34-24.gh-issue-111798.hd9B_-.rst | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2024-01-12-14-34-24.gh-issue-111798.hd9B_-.rst diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py index b1c78d7136fc9b..3c8fc35e3c116d 100644 --- a/Lib/test/test_call.py +++ b/Lib/test/test_call.py @@ -1,5 +1,6 @@ import unittest -from test.support import cpython_only, requires_limited_api, skip_on_s390x +from test.support import (cpython_only, is_wasi, requires_limited_api, Py_DEBUG, + set_recursion_limit, skip_on_s390x) try: import _testcapi except ImportError: @@ -990,6 +991,7 @@ def case_change_over_substitution(BLuch=None, Luch = None, fluch = None): class TestRecursion(unittest.TestCase): @skip_on_s390x + @unittest.skipIf(is_wasi and Py_DEBUG, "requires deep stack") def test_super_deep(self): def recurse(n): @@ -1010,9 +1012,7 @@ def c_py_recurse(m): if m: _testcapi.pyobject_vectorcall(py_recurse, (1000, m), ()) - depth = sys.getrecursionlimit() - sys.setrecursionlimit(100_000) - try: + with set_recursion_limit(100_000): recurse(90_000) with self.assertRaises(RecursionError): recurse(101_000) @@ -1022,8 +1022,6 @@ def c_py_recurse(m): c_py_recurse(90) with self.assertRaises(RecursionError): c_py_recurse(100_000) - finally: - sys.setrecursionlimit(depth) class TestFunctionWithManyArgs(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Tests/2024-01-12-14-34-24.gh-issue-111798.hd9B_-.rst b/Misc/NEWS.d/next/Tests/2024-01-12-14-34-24.gh-issue-111798.hd9B_-.rst new file mode 100644 index 00000000000000..8cf04b2d8561e0 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2024-01-12-14-34-24.gh-issue-111798.hd9B_-.rst @@ -0,0 +1,2 @@ +Disable ``test_super_deep()`` from ``test_call`` under pydebug builds on +WASI; the stack depth is too small to make the test useful.