[Python-3000-checkins] r65774 - in python/branches/py3k: Lib/test/test_unicode.py

antoine.pitrou python-3000-checkins at python.org
Sun Aug 17 19:06:51 CEST 2008


Author: antoine.pitrou
Date: Sun Aug 17 19:06:51 2008
New Revision: 65774

Log:
Merged revisions 65773 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65773 | antoine.pitrou | 2008-08-17 19:01:49 +0200 (dim., 17 août 2008) | 3 lines
  
  #3556: test_raiseMemError consumes an insane amount of memory
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_unicode.py

Modified: python/branches/py3k/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unicode.py	(original)
+++ python/branches/py3k/Lib/test/test_unicode.py	Sun Aug 17 19:06:51 2008
@@ -1155,20 +1155,15 @@
             return
         self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
 
-
     def test_raiseMemError(self):
         # Ensure that the freelist contains a consistent object, even
         # when a string allocation fails with a MemoryError.
         # This used to crash the interpreter,
         # or leak references when the number was smaller.
-        try:
-            "a" * (sys.maxsize // 2 - 100)
-        except MemoryError:
-            pass
-        try:
-            "a" * (sys.maxsize // 2 - 100)
-        except MemoryError:
-            pass
+        alloc = lambda: "a" * (sys.maxsize - 100)
+        self.assertRaises(MemoryError, alloc)
+        self.assertRaises(MemoryError, alloc)
+
 
 def test_main():
     support.run_unittest(__name__)


More information about the Python-3000-checkins mailing list