[Python-Dev] cpython (2.7): Fix memory error in test_ucn. (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Mon Jan 21 19:13:37 CET 2013
- Previous message: [Python-Dev] cpython (3.2): Issue #16335: Fix integer overflow in unicode-escape decoder.
- Next message: [Python-Dev] Inconsistent behaviour of methods waiting for child process
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 21 Jan 2013 12:06:25 +0100 (CET) serhiy.storchaka <python-checkins at python.org> wrote:
diff --git a/Lib/test/testucn.py b/Lib/test/testucn.py --- a/Lib/test/testucn.py +++ b/Lib/test/testucn.py @@ -144,13 +144,14 @@ # very very long bogus character name try: x = b'\N{SPACE' + b'x' * int(testcapi.UINTMAX + 1) + b'}' + self.assertEqual(len(x), len(b'\N{SPACE}') + + (testcapi.UINTMAX + 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.UINTMAX + 1)) - self.assertRaisesRegexp(UnicodeError, - 'unknown Unicode character name', - x.decode, 'unicode-escape' - )
You can't just do that. The test may end up swapping a lot and make the machine grind to a halt, rather than raise MemoryError. This threatens to make life miserable for anyone who hasn't enough RAM, but has enough swap to fit the test's working set.
Really, you have to use a bigmem decorator.
Regards
Antoine.
- Previous message: [Python-Dev] cpython (3.2): Issue #16335: Fix integer overflow in unicode-escape decoder.
- Next message: [Python-Dev] Inconsistent behaviour of methods waiting for child process
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]