summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel.stutzbach@google.com>2011-05-04 19:46:28 (GMT)
committerDaniel Stutzbach <daniel.stutzbach@google.com>2011-05-04 19:46:28 (GMT)
commiteda70b81d3346f1831efe0f1b9553ef9f1bb4ca3 (patch)
tree54b3b82803e1158016cd2dd505cf7e1812007633 /Lib/test
parent0d5e52d3469a310001afe50689f77ddba6d554d1 (diff)
downloadcpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.zip
cpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.tar.gz
cpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.tar.bz2
#11335: Fix memory leak after key function failure in sort
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_sort.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index a7afe73..55503b5 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -111,6 +111,12 @@ class TestBase(unittest.TestCase):
s.sort(key=CmpToKey(lambda a, b: int(random.random() * 3) - 1))
check("an insane function left some permutation", x, s)
+ if len(x) >= 2:
+ def bad_key(x):
+ raise RuntimeError
+ s = x[:]
+ self.assertRaises(RuntimeError, s.sort, key=bad_key)
+
x = [Complains(i) for i in x]
s = x[:]
random.shuffle(s)