diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:03:59 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:03:59 (GMT) |
commit | a710b331daee9e79ca90395feb6ce8c552e00568 (patch) | |
tree | a00e825052dabf853c875136b3e1832742634879 /Lib/test | |
parent | b285974c00fbf51af727d9330fa90443177390f4 (diff) | |
download | cpython-a710b331daee9e79ca90395feb6ce8c552e00568.zip cpython-a710b331daee9e79ca90395feb6ce8c552e00568.tar.gz cpython-a710b331daee9e79ca90395feb6ce8c552e00568.tar.bz2 |
SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear(). The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/list_tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 284edb3..14b54c7 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -514,3 +514,12 @@ class CommonTest(seq_tests.CommonTest): a = self.type2test(range(10)) a[::2] = tuple(range(5)) self.assertEqual(a, self.type2test([0, 1, 1, 3, 2, 5, 3, 7, 4, 9])) + + def test_constructor_exception_handling(self): + # Bug #1242657 + class F(object): + def __iter__(self): + yield 23 + def __len__(self): + raise KeyboardInterrupt + self.assertRaises(KeyboardInterrupt, list, F()) |