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

Tim Peters tim.one at home.com
Sat Nov 3 20:03:38 CET 2001


[Defresne Sylvain]
>   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 is a bug in 2.2b1 that was fixed last week (it works fine in current
CVS Python).

> ...
>   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.

I'm confused.  Python 2.2 has not been released, and won't be until
December -- 2.2b1 is a beta release, and nobody should be shipping a beta
version in a production system (we guarantee that beta releases have nasty
bugs <wink>).  So if you're not confused, Debian is.





More information about the Python-list mailing list