Issue1636

classification
Title: time.strftime fails to convert time tuple
Type: behaviour Severity: normal
Components: Library Versions: 2.5.1, 2.5.2b1
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: urs.bisang, zyasoft
Priority: Keywords:

Created on 2010-07-25.09:50:51 by urs.bisang, last changed 2010-08-06.05:24:02 by zyasoft.

Messages
msg5920 (view) Author: Urs Bisang (urs.bisang) Date: 2010-07-25.09:50:49
Demonstration of problem:

Jython 2.5.2b1 (Release_2_5_2beta1:7075, Jun 28 2010, 07:44:20) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> d = (2010, 7, 25, 8, 58, 41, -1, 206, -1)
>>> time.strftime('%Y-%m-%dT%H:%M:%SZ',d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: day of week out of range (0-6)
>>> 


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

Behavior of CPython for same example:

Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> d = (2010, 7, 25, 8, 58, 41, -1, 206, -1)
>>> time.strftime('%Y-%m-%dT%H:%M:%SZ',d)
'2010-07-25T08:58:41Z'
msg5938 (view) Author: Jim Baker (zyasoft) Date: 2010-08-04.17:18:02
Seems to me the bug is in CPython:

$ python
Python 2.6.4+ (release26-maint, Nov  5 2009, 07:35:50) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>> import time
>>> d = (2010, 7, 25, 8, 58, 41, 100000000, 206, -1)
>>> time.strftime('%Y-%m-%dT%H:%M:%SZ',d)
'2010-07-25T08:58:41Z'

Day of week is not necessary here to construct the time tuple, but ignoring something that's inconsistent doesn't seem to make sense.

Urs, is there any reason why we should support this behavior, other than compliance even when buggy? I'm going to keep this pending for the moment.
msg5939 (view) Author: Jim Baker (zyasoft) Date: 2010-08-04.17:18:50
(Note - CPython 2.7 has the same behavior as 2.6)
History
Date User Action Args
2010-08-06 05:24:02zyasoftsetstatus: pending -> closed
2010-08-04 17:18:50zyasoftsetmessages: + msg5939
2010-08-04 17:18:03zyasoftsetstatus: open -> pending
assignee: zyasoft
resolution: wont fix
messages: + msg5938
nosy: + zyasoft
2010-07-25 09:50:51urs.bisangcreate