From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:31:21 +0000 (+0100) Subject: [3.11] gh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026... X-Git-Tag: v3.11.8~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=804037ee4a282be0c65698a94505cc8a45f327aa;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026) (GH-114407) It is no longer silently passed if RecursionError was raised for low recursion depth. (cherry picked from commit db1c18eb6220653290a3ba9ebbe1df44394a3f19) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py index 6b457440be54..95b7a649774d 100644 --- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -908,12 +908,13 @@ class TestBinaryPlistlib(unittest.TestCase): self.assertIs(b['x'], b) def test_deep_nesting(self): - for N in [300, 100000]: + tests = [50, 100_000] if support.is_wasi else [50, 300, 100_000] + for N in tests: chunks = [b'\xa1' + (i + 1).to_bytes(4, 'big') for i in range(N)] try: result = self.decode(*chunks, b'\x54seed', offset_size=4, ref_size=4) except RecursionError: - pass + self.assertGreater(N, sys.getrecursionlimit()//3) else: for i in range(N): self.assertIsInstance(result, list)