mirror of
https://github.com/python/cpython.git
synced 2026-01-07 07:52:29 +00:00
[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 db1c18eb62)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
a0f30b04fe
commit
804037ee4a
1 changed files with 3 additions and 2 deletions
|
|
@ -908,12 +908,13 @@ def test_cycles(self):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue