classification
Title: external strftime for Python?
Type: Stage:
Components: Versions: Python 3.0
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: haypo, loewis, schmir, skip.montanaro (4)
Priority: normal Keywords patch, patch

Created on 2008-06-23 02:44 by skip.montanaro, last changed 2008-11-11 04:11 by haypo.

Files
File name Uploaded Description Edit Remove
strftime.diff skip.montanaro, 2008-06-23 02:44
Messages (5)
msg68603 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-06-23 02:44
Back in April we had a thread on xmlrpclib's problematic handling of dates
before 1900:

    http://thread.gmane.org/gmane.comp.python.devel/93273/focus=93309

I'm still of the opinion that strftime() is the culprit and xmlrpclib is
just an innocent bystander.  Guido worried that to correct this we'd have 
to
implement strftime() from scratch.

I took a different approach and scouted around for an existing version of
strftime() which we could suck into the distribution.  I found a modified
version of the BSD 4.4 strftime which came with (I see to recall) Tcl.
The attached patch is against the py3k svn repo.  It passes all tests as
far as I can tell.

Also, see http://bugs.python.org/issue1777412 which appears to be related.
msg68604 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-06-23 02:47
Ummm...  I think I only modified timemodule.c.  datetimemodule.c
probably needs a tweak as well.  I need to get this off my desk though.
msg68606 - (view) Author: Martin v. Löwis (loewis) Date: 2008-06-23 03:54
So how does it work for non-English locales?
msg69092 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-07-02 13:42
Good question.  I don't claim that the strftime.c I found is complete
for our needs, only that we can avoid the "rewrite strftime from
scratch" problem Guido indicated.

S
msg75730 - (view) Author: STINNER Victor (haypo) Date: 2008-11-11 04:11
The issue #1777412 has a working patch (for Python 2.6) which allows 
year < 1900 in time.strftime() and datetime.datetime.strftime().
History
Date User Action Args
2008-11-11 04:11:23hayposetkeywords: patch, patch
nosy: + haypo
messages: + msg75730
2008-08-05 22:32:26schmirsetnosy: + schmir
2008-07-02 13:42:36skip.montanarosetkeywords: patch, patch
messages: + msg69092
2008-06-23 03:54:36loewissetkeywords: patch, patch
nosy: + loewis
messages: + msg68606
2008-06-23 02:47:09skip.montanarosetkeywords: patch, patch
messages: + msg68604
2008-06-23 02:44:52skip.montanarocreate