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.
Created on 2008年06月23日 02:44 by skip.montanaro, last changed 2022年04月11日 14:56 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| strftime.diff | skip.montanaro, 2008年06月23日 02:44 | |||
| Messages (17) | |||
|---|---|---|---|
| msg68603 - (view) | Author: Skip Montanaro (skip.montanaro) * (Python triager) | 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) * (Python triager) | 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) * (Python committer) | Date: 2008年06月23日 03:54 | |
So how does it work for non-English locales? |
|||
| msg69092 - (view) | Author: Skip Montanaro (skip.montanaro) * (Python triager) | 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 (vstinner) * (Python committer) | 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(). |
|||
| msg107168 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年06月06日 00:29 | |
What platforms have broken strftime and how badly is it broken there? Is there a python version somewhere? PyPy? |
|||
| msg107315 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2010年06月08日 11:34 | |
PyPy also calls the platform's strftime(). |
|||
| msg111886 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2010年07月29日 03:21 | |
What about the licensing? That look like the BSD license *with* advertising clause... |
|||
| msg111954 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年07月29日 15:52 | |
On Wed, Jul 28, 2010 at 11:22 PM, Guido van Rossum <report@bugs.python.org> wrote: .. > What about the licensing? That look like the BSD license *with* > advertising clause... > I am not a lawyer and I am not intimately familiar with PSF policies, but this license does not look too dissimilar to the profile module license: # Permission to use, copy, modify, and distribute this Python software # and its associated documentation for any purpose (subject to the # restriction in the following sentence) without fee is hereby granted, # provided that the above copyright notice appears in all copies, and # that both that copyright notice and this permission notice appear in # supporting documentation, ... Actually, I wonder if pydoc profile is technically in violation of the InfoSeek license. More likely, however, is that the license text in the source file is not authoritative and PSF has a more permissive license to this code. Skip, can you clarify where the strftime code in your patch came from? In your first post you said that it came from Tcl, so it may have ActiveState copyright on at least portions of it. On the other hand, unless strftime code is already published under an acceptable license, I think rewriting this code from scratch would be easier than tracking down the owners and asking them to contribute it to python. |
|||
| msg125579 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年01月06日 19:13 | |
Maybe rather than spending the effort maintaining a legacy API such as strftime, someone could look into implementing localized date formatting as defined by recent Unicode standards: http://unicode.org/reports/tr35/#Date_Format_Patterns Apparently there is a free implementation for Python out there: http://babel.edgewall.org/wiki/Documentation/dates.html#pattern-syntax See also msg107236 on issue #8913. |
|||
| msg125584 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2011年01月06日 19:56 | |
I think we're stuck with strftime for quite a while, no matter how ugly it is. datetime.__format__ uses it, for example. Although maybe it's possible to write an strftime-format to new-format translator. If we're going to take this on (re-writing strftime), I think the way to do it is to have it take the locale info as a parameter, and if that parameter is NULL then look up the info in the current locale. It looks like it's still a problem to find all of the info in the locale on all platforms, though. Finding the locale info is no doubt the tricky part, as someone said. I agree it would be easier to write this from scratch rather than track down the licensing on the existing patch. As it is, there's just not much code there. |
|||
| msg125585 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年01月06日 20:22 | |
On Thu, Jan 6, 2011 at 2:56 PM, Eric Smith <report@bugs.python.org> wrote: .. > If we're going to take this on (re-writing strftime), I think the way to do it is to have it take the locale info as a > parameter, and if that parameter is NULL then look up the info in the current locale. You may want to take a look at BSD-ish strftime_l function which is defined by POSIX.1-2008: http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html |
|||
| msg125587 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2011年01月06日 20:52 | |
On Thu, Jan 6, 2011 at 11:56 AM, Eric Smith <report@bugs.python.org> wrote: > If we're going to take this on (re-writing strftime), I think the way to do it is to have it take the locale info as a parameter, and if that parameter is NULL then look up the info in the current locale. It looks like it's still a problem to find all of the info in the locale on all platforms, though. Finding the locale info is no doubt the tricky part, as someone said. Hm, shouldn't the libc locale support offer the same set of locales and locale info that the libc strftime uses, on any platform? Or are there platforms whose libc strftime has better locale support than the libc getlocale implementation??? |
|||
| msg125588 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年01月06日 21:00 | |
The Qt library has its own strftime() implementation. The QLocale object has methods providing localized day and month names. For example, day names are implemented using a big ushort array (~20.000 bytes) which contains something like 'Sun;Mon;Tue;Wed;Thu;Fri;Sat;Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;S;M;T;W;T;F;S;7;1;2;3;4;5;6;;;;;;;;Dil;Wix;Qib;Rob;Kam;Jim;San;Dilbata;Wiixata;Qibxata;Roobii;Kamiisa;Jimaata;Sanbata;A;E;T;A;K;G;S;Aca;Etl;Tal;Arb;Kam;Gum;Sab;Acaada;Etleeni;Talaata;Arbaqa;Kamiisi;Gumqata;Sabti;1;2;3;4;5;6;7;So;Ma;Di;Wo;Do;Vr;Sa;Sondag;Maandag;Dinsdag;Woensdag;Donderdag;Vrydag;Saterdag;D;H;M;M;E;P;S;Die;H\xebn;Mar;M\xebr;(...)'. |
|||
| msg125589 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年01月06日 21:06 | |
Is nl_langinfo() function reliable? On any OS? Can we use it to get day name, abbreviated day name, month name and abbreviated month name? We should maybe start with an implementation in Python? It's easier to write code in Python than in C, and because it can be reused on other Python implementations. |
|||
| msg146853 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年11月02日 17:11 | |
> Maybe rather than spending the effort maintaining a legacy API such as strftime, someone could > look into implementing localized date formatting as defined by recent Unicode standards: > http://unicode.org/reports/tr35/#Date_Format_Patterns This scheme is very elegant. I’d love to have built-in/stdlib support for it. Would it need to be implemented in C? > Apparently there is a free implementation for Python out there: > http://babel.edgewall.org/wiki/Documentation/dates.html#pattern-syntax Babel just rocks :) |
|||
| msg163132 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年06月19日 02:00 | |
IANA is now distributing Olson's timezone database software which includes an implementation of strftime(): http://www.iana.org/time-zones/repository/releases/tzcode2012b.tar.gz The code was designated as public domain by Arthur David Olson, but it seems to be based on code copyrighted by UCB and distributed under the BSD license. The code does seem to include some locale support. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:35 | admin | set | github: 47423 |
| 2014年06月29日 22:36:42 | belopolsky | set | assignee: belopolsky -> |
| 2013年09月17日 05:08:48 | berker.peksag | set | nosy:
+ berker.peksag |
| 2012年10月03日 01:07:52 | cvrebert | set | nosy:
+ cvrebert |
| 2012年06月19日 02:00:17 | belopolsky | set | messages: + msg163132 |
| 2012年06月14日 13:29:27 | r.david.murray | link | issue15065 superseder |
| 2012年04月01日 06:14:55 | georg.brandl | link | issue1396946 superseder |
| 2011年11月03日 20:20:48 | flox | link | issue13305 superseder |
| 2011年11月03日 20:20:48 | flox | unlink | issue13305 dependencies |
| 2011年11月02日 17:11:24 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg146853 |
| 2011年11月01日 00:20:25 | flox | set | nosy:
+ flox |
| 2011年10月31日 21:04:59 | belopolsky | link | issue13305 dependencies |
| 2011年01月06日 21:06:22 | vstinner | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125589 |
| 2011年01月06日 21:00:34 | vstinner | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125588 |
| 2011年01月06日 20:52:11 | gvanrossum | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125587 |
| 2011年01月06日 20:22:07 | belopolsky | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125585 |
| 2011年01月06日 19:56:02 | eric.smith | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125584 |
| 2011年01月06日 19:13:45 | belopolsky | set | nosy:
gvanrossum, loewis, amaury.forgeotdarc, belopolsky, vstinner, eric.smith, schmir messages: + msg125579 versions: + Python 3.3, - Python 3.0 |
| 2011年01月06日 18:15:59 | eric.smith | set | nosy:
+ eric.smith |
| 2010年07月29日 15:52:07 | belopolsky | set | messages: + msg111954 |
| 2010年07月29日 03:21:59 | gvanrossum | set | keywords:
patch, patch nosy: + gvanrossum messages: + msg111886 |
| 2010年06月08日 11:34:50 | amaury.forgeotdarc | set | keywords:
patch, patch nosy: + amaury.forgeotdarc messages: + msg107315 |
| 2010年06月06日 00:29:19 | belopolsky | set | nosy:
+ belopolsky messages: + msg107168 assignee: belopolsky keywords: patch, patch type: enhancement |
| 2010年05月20日 20:34:16 | skip.montanaro | set | keywords:
patch, patch nosy: - skip.montanaro |
| 2008年11月11日 04:11:23 | vstinner | set | keywords:
patch, patch nosy: + vstinner messages: + msg75730 |
| 2008年08月05日 22:32:26 | schmir | set | nosy: + schmir |
| 2008年07月02日 13:42:36 | skip.montanaro | set | keywords:
patch, patch messages: + msg69092 |
| 2008年06月23日 03:54:36 | loewis | set | keywords:
patch, patch nosy: + loewis messages: + msg68606 |
| 2008年06月23日 02:47:09 | skip.montanaro | set | keywords:
patch, patch messages: + msg68604 |
| 2008年06月23日 02:44:52 | skip.montanaro | create | |