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

Michael Hudson mwh@users.sourceforge.net
Thu, 07 Mar 2002 02:09:51 -0800


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

Modified Files:
      Tag: release22-maint
	test_structseq.py 
Log Message:
backport my checkin of
    revision 1.3 of test_structseq.py

Test for

[ 526039 ] devious code can crash structseqs

Bugfix candidate.

I haven't actually fixed this on the branch yet.  Will soon.


Index: test_structseq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_structseq.py,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -C2 -d -r1.2 -r1.2.8.1
*** test_structseq.py	31 Oct 2001 03:46:14 -0000	1.2
--- test_structseq.py	7 Mar 2002 10:09:48 -0000	1.2.8.1
***************
*** 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