[Python-bugs-list] [ python-Bugs-485723 ] time.localtime() unsliceable!!

noreply@sourceforge.net noreply@sourceforge.net
Mon, 26 Nov 2001 16:29:37 -0800


Bugs item #485723, was opened at 2001-11-26 10:47
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485723&group_id=5470

Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Tim Peters (tim_one)
Summary: time.localtime() unsliceable!!

Initial Comment:
The result of time.localtime()[2:4]
(or any slice) will return a strange
result, to wit:
  (<nil>, <nil>)

Comparison of this slice to any other
value will cause Python to CORE.

For example:
   if time.localtime()[3:5] > (12, 00):
will CORE python.

This is version 2.2b1 on Linux.

The workaround I have used is to make
a shallow copy of the result of time.localtime().

That is, time.localtime()[:][2:4] works fine!

Also, single element indexing DOES seem to work.
It is just slicing that causes the problem.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-11-26 16:29

Message:
Logged In: YES 
user_id=31435

Get 2.2b2 (this was fixed some time ago).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485723&group_id=5470