Commit 3b40b712 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fix memory error in test_ucn.

unicode-escape decoder requires memory for result corresponding to input size.
Fixes test for issue #16335.
parent 4f5f0e54
...@@ -148,13 +148,14 @@ class UnicodeNamesTest(unittest.TestCase): ...@@ -148,13 +148,14 @@ class UnicodeNamesTest(unittest.TestCase):
# very very long bogus character name # very very long bogus character name
try: try:
x = b'\\N{SPACE' + b'x' * (_testcapi.UINT_MAX + 1) + b'}' x = b'\\N{SPACE' + b'x' * (_testcapi.UINT_MAX + 1) + b'}'
except MemoryError: self.assertEqual(len(x), len(b'\\N{SPACE}') +
raise unittest.SkipTest("not enough memory") (_testcapi.UINT_MAX + 1))
self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1))
self.assertRaisesRegex(UnicodeError, self.assertRaisesRegex(UnicodeError,
'unknown Unicode character name', 'unknown Unicode character name',
x.decode, 'unicode-escape' x.decode, 'unicode-escape'
) )
except MemoryError:
raise unittest.SkipTest("not enough memory")
def test_main(): def test_main():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment