From: Michael W. Hudson Date: Thu, 7 Mar 2002 10:09:48 +0000 (+0000) Subject: backport my checkin of X-Git-Tag: v2.2.1c1~102 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77771c3194e1347e5c27b2884b05a3025861b30d;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py index bbd7b7e289fc..c09e0691cd84 100644 --- a/Lib/test/test_structseq.py +++ b/Lib/test/test_structseq.py @@ -13,4 +13,16 @@ for i in range(-len(t), len(t)): for j in range(-len(t), len(t)): 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