[Python-checkins] python/dist/src/Lib/test list_tests.py,1.2,1.3
nnorwitz at users.sourceforge.net
nnorwitz at users.sourceforge.net
Fri Aug 13 05:19:01 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1355/Lib/test
Modified Files:
list_tests.py
Log Message:
SF patch #1005778, Fix seg fault if list object is modified during list.index()
Backport candidate
Index: list_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/list_tests.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** list_tests.py 18 Jan 2004 21:03:23 -0000 1.2
--- list_tests.py 13 Aug 2004 03:18:29 -0000 1.3
***************
*** 312,315 ****
--- 312,327 ----
self.assertEqual(a, self.type2test([-2, -1, 0, 1, 2]))
+ # Test modifying the list during index's iteration
+ class EvilCmp:
+ def __init__(self, victim):
+ self.victim = victim
+ def __eq__(self, other):
+ del self.victim[:]
+ return False
+ a = self.type2test()
+ a[:] = [EvilCmp(a) for _ in xrange(100)]
+ # This used to seg fault before patch #1005778
+ self.assertRaises(ValueError, a.index, None)
+
def test_reverse(self):
u = self.type2test([-2, -1, 0, 1, 2])
More information about the Python-checkins
mailing list