Message92170
in Modules/timemodule.c, in the routine time_strftime, there is a range
check on the tm_isdst field:
if (buf.tm_isdst < -1 || buf.tm_isdst > 1) {
PyErr_SetString(PyExc_ValueError,
"daylight savings flag out of range");
return NULL;
}
This check is incorrect, as the tm_isdst field is interpreted as less
than 0, 0, or greater than zero (see the comment at the top of the
routine, and the documentation for the strftime function).
Unfortunately, there exists at least one platform for which tm_isdst is
set to something other than -1, 0, or 1 (on IBM zOS it's apparently set
to 2 for daylight savings). This means that you can't do the obvious
strftime(...,localtime(...)) to format a time.
The fix is to either remove the range check entirely, or else to
normalize the +1, -1, or 0. The former is preferred unless there is some
platform on which strftime doesn't do the right thing with values
outside the range of [-1,1].
This bug exists in 2.5.1 and 2.6.2. I haven't checked other versions. |
|
Date |
User |
Action |
Args |
2009-09-02 15:40:51 | rshapiro | set | recipients:
+ rshapiro |
2009-09-02 15:40:51 | rshapiro | set | messageid: <1251906051.81.0.942074704483.issue6823@psf.upfronthosting.co.za> |
2009-09-02 15:40:50 | rshapiro | link | issue6823 messages |
2009-09-02 15:40:49 | rshapiro | create | |
|