[BUG ?] Slicing a 'struct_time' can crash Python interpreter

Defresne Sylvain keiichi at yggdrasil.maisel.enst-bretagne.fr
Sat Nov 3 19:36:36 CET 2001


Hello

  I'm trying to take a slice of a 'struct_time' returned by time.gmtime()
with version 2.2b1 of Python. This is what I'm getting :

     Python 2.2b1 (#1, Oct 24 2001, 23:50:39)
     [GCC 2.95.4 20011006 (Debian prerelease)] on linux2
     Type "help", "copyright", "credits" or "license" for more information.
     >>> import time
     >>> x = time.gmtime()
     >>> x
     (2001, 11, 3, 18, 25, 35, 5, 307, 0)
     >>> type(x)
     <type 'struct_time'>
     >>> x[:3]
     (2001, 11, 3)
     >>> x[3:]
     (<nil>, <nil>, <nil>, 18, 25, 35)
     >>> x[:3] + x[3:]
     Segmentation fault

  This used to work with Python 2.0 and 2.1 where time.gmtime() returned
a simple tuple. As a workaround I can always do : x = tuple(x), but this
look ugly ...

  I wanted to know if this is a bug in my version of python (provided by
debian), or a bug in Python 2.2 itself.

Bye

PS : I posted this on this newsgroup because I'm unable to report the
bug on sourceforge ...



More information about the Python-list mailing list