[Python-checkins] python/dist/src/Lib/test list_tests.py, 1.5, 1.5.2.1
rhettinger@users.sourceforge.net
rhettinger at users.sourceforge.net
Sun Aug 21 13:10:09 CEST 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4160/Lib/test
Modified Files:
Tag: release24-maint
list_tests.py
Log Message:
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().
Index: list_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/list_tests.py,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- list_tests.py 30 Sep 2004 07:47:20 -0000 1.5
+++ list_tests.py 21 Aug 2005 11:09:58 -0000 1.5.2.1
@@ -494,3 +494,12 @@
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())
More information about the Python-checkins
mailing list