[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

STINNER Victor report at bugs.python.org
Wed Jan 12 11:54:59 CET 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

On Linux, cfmt.py fails on fr_FR locale (the only valid locale in the list of tested locales):
---
fr_FR [mer. 12 janv. 2011 11:30:35 CET] %a %d %B %Y %H:%M:%S %Z != %a %d %b %Y %T %Z
---

The problem is the month format: locale.nl_langinfo(locale.D_T_FMT) returns '%a %d %b %Y %T %Z', but _strptime (LocaleTime().LC_date_time) uses '%a %d %B %Y %H:%M:%S %Z' => '%b' vs '%B'.

_strptime.LocalTime.__calc_date_time() uses strftime('%c') and then parse the output to get the complete format. But it uses strftime('%c') with the march month, and in french, march is formatted 'mars' for both month formats (%b *and* %B).

_strptime.LocalTime.__calc_date_time() should detect that the month has the same format with %b and %B, and try other timestamps (other months).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8957>
_______________________________________


More information about the Python-bugs-list mailing list