Skip to content

Commit 804037e

Browse files
[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 db1c18e) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent a0f30b0 commit 804037e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_plistlib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,13 @@ def test_cycles(self):
908908
self.assertIs(b['x'], b)
909909

910910
def test_deep_nesting(self):
911-
for N in [300, 100000]:
911+
tests = [50, 100_000] if support.is_wasi else [50, 300, 100_000]
912+
for N in tests:
912913
chunks = [b'\xa1' + (i + 1).to_bytes(4, 'big') for i in range(N)]
913914
try:
914915
result = self.decode(*chunks, b'\x54seed', offset_size=4, ref_size=4)
915916
except RecursionError:
916-
pass
917+
self.assertGreater(N, sys.getrecursionlimit()//3)
917918
else:
918919
for i in range(N):
919920
self.assertIsInstance(result, list)

0 commit comments

Comments
 (0)