[Python-checkins] CVS: python/dist/src/Lib/test test_structseq.py,1.2,1.3

Michael Hudson mwh@users.sourceforge.net
Wed, 06 Mar 2002 09:18:17 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv26183

Modified Files:
	test_structseq.py 
Log Message:
Test for

[ 526039 ] devious code can crash structseqs

Bugfix candidate.



Index: test_structseq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_structseq.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_structseq.py	31 Oct 2001 03:46:14 -0000	1.2
--- test_structseq.py	6 Mar 2002 17:18:15 -0000	1.3
***************
*** 14,16 ****
--- 14,28 ----
          vereq(t[i:j], astuple[i:j])
  
+ # Devious code could crash structseqs' contructors
+ class C:
+     def __getitem__(self, i):
+         raise IndexError
+     def __len__(self):
+         return 9
+ 
+ try:
+     repr(time.struct_time(C()))
+ except:
+     pass
+ 
  # XXX more needed