diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 10:59:13 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 10:59:13 (GMT) |
commit | 3b40b71217d7b73e59495de8cadd8fe1ad7cc6bc (patch) | |
tree | dce307a51c6e8c43685a7fe75248385f89bd94b9 /Lib/test/test_ucn.py | |
parent | 4f5f0e54e07838b29e3a2e043e9c9b12aeecb12f (diff) | |
download | cpython-3b40b71217d7b73e59495de8cadd8fe1ad7cc6bc.zip cpython-3b40b71217d7b73e59495de8cadd8fe1ad7cc6bc.tar.gz cpython-3b40b71217d7b73e59495de8cadd8fe1ad7cc6bc.tar.bz2 |
Fix memory error in test_ucn.
unicode-escape decoder requires memory for result corresponding to input size.
Fixes test for issue #16335.
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r-- | Lib/test/test_ucn.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py index de36cc3..ebff0e1 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -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(): |