diff options
author | Daniel Stutzbach <daniel.stutzbach@google.com> | 2011-05-04 19:47:14 (GMT) |
---|---|---|
committer | Daniel Stutzbach <daniel.stutzbach@google.com> | 2011-05-04 19:47:14 (GMT) |
commit | 3f064693bb628dde15b82d0216da9d03f5281fd3 (patch) | |
tree | a97517a3ef501d30b64846042675025e44ad7a4a /Lib | |
parent | fc20b0c65c446f79e39d006f3cffed03aa745380 (diff) | |
parent | eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3 (diff) | |
download | cpython-3f064693bb628dde15b82d0216da9d03f5281fd3.zip cpython-3f064693bb628dde15b82d0216da9d03f5281fd3.tar.gz cpython-3f064693bb628dde15b82d0216da9d03f5281fd3.tar.bz2 |
#11335: Merge from 3.2: Fix memory leak after key function failure in sort
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sort.py | 6 |
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) |