From: Michael W. Hudson Date: Wed, 6 Mar 2002 17:18:15 +0000 (+0000) Subject: Test for X-Git-Tag: v2.3c1~6568 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02b28ec316114a646c7875a76edeb577c5c3581b;p=python Test for [ 526039 ] devious code can crash structseqs Bugfix candidate. --- diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py index bbd7b7e289..c09e0691cd 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