[Python-checkins] cpython (2.7): Fix memory error in test_ucn.

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


http://hg.python.org/cpython/rev/38a10d0778d2
changeset: 81630:38a10d0778d2
branch: 2.7
parent: 81626:cd8d983c15de
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Jan 21 13:03:58 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
@@ -144,13 +144,14 @@
 # very very long bogus character name
 try:
 x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}'
+ self.assertEqual(len(x), len(b'\\N{SPACE}') +
+ (_testcapi.UINT_MAX + 1))
+ self.assertRaisesRegexp(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.assertRaisesRegexp(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 によって変換されたページ (->オリジナル) /