This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: time.strftime("%Y"): limitation of 4 digits on OpenIndiana (Solaris)
Type: Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, skip.montanaro, vstinner
Priority: normal Keywords:

Created on 2011-01-08 02:43 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg125744 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-01-08 02:43
The following example displays '2345' instead of '12345':

import time
t = (12345,) + (0,)*8
print(repr(time.strftime("%Y", t)))

time.strftime() should raise a ValueError if the year is bigger than 9999, as it is done with Visual Studio for year outside [1; 9999].
msg125747 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-01-08 03:35
Oh, it's more funny with negative numbers: -1 is formatted '000/'.

Let's try r87850. I'm now waiting for the buildbot.
msg125783 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2011-01-08 13:55
On my Mac it displays "12345".  I don't see that as a big problem.
It raises ValueError for a year of -1.  This is with  build py3k:87566.

If someone wants to feed a year > 9999 to time.strftime I don't see that
as a big problem.  I less sure about year < 0.
msg125788 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-01-08 16:18
> Let's try r87850. I'm now waiting for the buildbot.

The test pass on both OpenIndiana buildbots, so I close the issue.

> On my Mac it displays "12345".  I don't see that as a big problem.

Why do you say "problem"? It is the correct result :-)
msg125793 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2011-01-08 17:02
Skip> On my Mac it displays "12345".  I don't see that as a big problem.

haypo> Why do you say "problem"? It is the correct result :-)

I agree.  I interpreted your ticket as complaining that it should raise
a ValueError if year > 9999:

>> time.strftime() should raise a ValueError if the year is bigger
>> than 9999, as it is done with Visual Studio for year
>> outside [1; 9999].
msg125794 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-01-08 17:26
Le samedi 08 janvier 2011 à 17:02 +0000, Skip Montanaro a écrit :
> I agree.  I interpreted your ticket as complaining that it should raise
> a ValueError if year > 9999:

Only on OpenIndiana because on this specific OS, "%Y" only supoprts year
in [1; 9999]. For other values, it gives strange results :-)
msg131590 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-21 01:12
New changeset d56eb817b181 by Victor Stinner in branch '3.2':
Issue #10864 has been fixed: remove the workaround
http://hg.python.org/cpython/rev/d56eb817b181
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55073
2011-03-21 01:12:17python-devsetnosy: + python-dev
messages: + msg131590
2011-01-08 17:26:23vstinnersetnosy: skip.montanaro, vstinner
messages: + msg125794
2011-01-08 17:02:42skip.montanarosetnosy: skip.montanaro, vstinner
messages: + msg125793
2011-01-08 16:18:18vstinnersetstatus: open -> closed
nosy: skip.montanaro, vstinner
resolution: fixed
2011-01-08 16:18:09vstinnersetnosy: skip.montanaro, vstinner
messages: + msg125788
2011-01-08 13:55:32skip.montanarosetnosy: + skip.montanaro
messages: + msg125783
2011-01-08 03:35:51vstinnersetmessages: + msg125747
2011-01-08 02:43:14vstinnercreate