diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-17 17:01:49 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-17 17:01:49 +0000 |
commit | fd7c43e7be2bb6828e5bddb323e19bea94cbfb7b (patch) | |
tree | 9f03a5a3ac2173a7c0f81f0f052fe4a52350295f /Lib/test/test_unicode.py | |
parent | bebb18bef5864e9b73400e5bda87cdf3f38248e1 (diff) | |
download | cpython-git-fd7c43e7be2bb6828e5bddb323e19bea94cbfb7b.tar.gz |
#3556: test_raiseMemError consumes an insane amount of memory
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 11 |
1 files 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__) |