From fd7c43e7be2bb6828e5bddb323e19bea94cbfb7b Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sun, 17 Aug 2008 17:01:49 +0000 Subject: [PATCH] #3556: test_raiseMemError consumes an insane amount of memory --- Lib/test/test_unicode.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index b3d6907eac..5d887ed92f 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1118,14 +1118,9 @@ class UnicodeTest( # when a string allocation fails with a MemoryError. # This used to crash the interpreter, # or leak references when the number was smaller. - try: - u"a" * (sys.maxint // 2 - 100) - except MemoryError: - pass - try: - u"a" * (sys.maxint // 2 - 100) - except MemoryError: - pass + alloc = lambda: u"a" * (sys.maxsize - 100) + self.assertRaises(MemoryError, alloc) + self.assertRaises(MemoryError, alloc) def test_main(): test_support.run_unittest(__name__) -- 2.40.0