summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-08-17 17:06:51 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-08-17 17:06:51 (GMT)
commit3db3e874347824f78f02c4021aa8e94a69564b11 (patch)
tree59634c8cdd8a054cf4eee65c081c842b1df26ad5
parent43e45192bd56057227aa4b187685280fae54615c (diff)
downloadcpython-3db3e874347824f78f02c4021aa8e94a69564b11.zip
cpython-3db3e874347824f78f02c4021aa8e94a69564b11.tar.gz
cpython-3db3e874347824f78f02c4021aa8e94a69564b11.tar.bz2
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 ........
-rw-r--r--Lib/test/test_unicode.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index fdd90ca..f82a642 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1155,20 +1155,15 @@ class UnicodeTest(
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__)