]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111808: Fix recursion error on WASM in `test_typing` (GH-111819)
authorNikita Sobolev <mail@sobolevn.me>
Tue, 7 Nov 2023 19:23:57 +0000 (22:23 +0300)
committerGitHub <noreply@github.com>
Tue, 7 Nov 2023 19:23:57 +0000 (11:23 -0800)
Lib/test/test_typing.py

index 9dd637b974769c844fd60f7511d9b9d82896e97e..6ff79e8eeed9aaa1650b64bef53b74140fbb1fe1 100644 (file)
@@ -44,7 +44,7 @@ import typing
 import weakref
 import types
 
-from test.support import captured_stderr, cpython_only
+from test.support import captured_stderr, cpython_only, infinite_recursion
 from test import mod_generics_cache
 from test import _typed_dict_helper
 
@@ -5622,10 +5622,11 @@ class ForwardRefTests(BaseTestCase):
         def cmp(o1, o2):
             return o1 == o2
 
-        r1 = namespace1()
-        r2 = namespace2()
-        self.assertIsNot(r1, r2)
-        self.assertRaises(RecursionError, cmp, r1, r2)
+        with infinite_recursion(25):  # magic number, small but reasonable
+            r1 = namespace1()
+            r2 = namespace2()
+            self.assertIsNot(r1, r2)
+            self.assertRaises(RecursionError, cmp, r1, r2)
 
     def test_union_forward_recursion(self):
         ValueList = List['Value']