summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ucn.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-21 11:00:50 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-21 11:00:50 (GMT)
commit5a95977c71d19d6aed32b0a4721d5e9ef4888efe (patch)
tree71a2c639fafd2d77483cb7fdbe98c703f900c0d2 /Lib/test/test_ucn.py
parent6481bfb2b5c917041f062da8ebcc7bd7b7727945 (diff)
parent85da624ebebb09aa5501861e2b25b7f16bfcb620 (diff)
downloadcpython-5a95977c71d19d6aed32b0a4721d5e9ef4888efe.zip
cpython-5a95977c71d19d6aed32b0a4721d5e9ef4888efe.tar.gz
cpython-5a95977c71d19d6aed32b0a4721d5e9ef4888efe.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.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
index 13aebaa..da1ddf2 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():