diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 11:00:11 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 11:00:11 (GMT) |
commit | 85da624ebebb09aa5501861e2b25b7f16bfcb620 (patch) | |
tree | 6864da185a6cc67cd3a38f3edb9c10f229bad9bc /Lib | |
parent | c35f3a9f619d0d4abd43d16ddc4767e2a30c3dce (diff) | |
parent | 3b40b71217d7b73e59495de8cadd8fe1ad7cc6bc (diff) | |
download | cpython-85da624ebebb09aa5501861e2b25b7f16bfcb620.zip cpython-85da624ebebb09aa5501861e2b25b7f16bfcb620.tar.gz cpython-85da624ebebb09aa5501861e2b25b7f16bfcb620.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')
-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 ff4c4f1..05557ae 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -222,13 +222,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(): |