Fix memory error in test_ucn.
unicode-escape decoder requires memory for result corresponding to input size. Fixes test for issue #16335.
This commit is contained in:
parent
4f5f0e54e0
commit
3b40b71217
|
@ -148,13 +148,14 @@ class UnicodeNamesTest(unittest.TestCase):
|
|||
# very very long bogus character name
|
||||
try:
|
||||
x = b'\\N{SPACE' + b'x' * (_testcapi.UINT_MAX + 1) + b'}'
|
||||
self.assertEqual(len(x), len(b'\\N{SPACE}') +
|
||||
(_testcapi.UINT_MAX + 1))
|
||||
self.assertRaisesRegex(UnicodeError,
|
||||
'unknown Unicode character name',
|
||||
x.decode, 'unicode-escape'
|
||||
)
|
||||
except MemoryError:
|
||||
raise unittest.SkipTest("not enough memory")
|
||||
self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1))
|
||||
self.assertRaisesRegex(UnicodeError,
|
||||
'unknown Unicode character name',
|
||||
x.decode, 'unicode-escape'
|
||||
)
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Reference in New Issue