[Python-checkins] cpython (merge 3.3 -> default): Fix memory error in test_ucn.

serhiy.storchaka python-checkins at python.org
Mon Jan 21 12:06:24 CET 2013


http://hg.python.org/cpython/rev/f90d6ce49772
changeset: 81629:f90d6ce49772
parent: 81624:8488febf7d79
parent: 81628:7c2aae472b27
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Jan 21 13:00:50 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

AltStyle によって変換されたページ (->オリジナル) /