[Python-checkins] cpython (merge 3.2 -> 3.3): Fix memory error in test_ucn.
serhiy.storchaka
python-checkins at python.org
Mon Jan 21 12:06:23 CET 2013
http://hg.python.org/cpython/rev/7c2aae472b27
changeset: 81628:7c2aae472b27
branch: 3.3
parent: 81623:494d341e9143
parent: 81627:f84a6c89ccbc
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Jan 21 13:00:11 2013 +0200
summary:
Fix memory error in test_ucn.
unicode-escape decoder requires memory for result corresponding to input size.
Fixes test for issue #16335.
files:
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
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -222,13 +222,14 @@
# 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():
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list