[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

Joe Peterson report at bugs.python.org
Sat Jan 29 22:45:15 CET 2011


Joe Peterson <joe at skyrush.com> added the comment:

Here is a new patch that adds a test to the tests committed for issue 10939.

This new test case is needed to trigger the DST issue.  This test is not timezone-dependent (in the sense that one does not have to have a specific timezone set for it to work), but it does depend on the DST change happening at 02:00 on the first Sunday in April, 2000.  This is the case for most of the United States, but to make it work everywhere, I have added code that sets the TZ to one that works, and then reverts the temporary TZ change after the test.

The bug is triggered when the time described in the internal date string, ignoring the time offset, is between 02:00 and 03:00.  This is because the raw time in the string is interpreted as local time, and local times in this range are basically invalid, since time advances to 03:00 when 02:00 is reached because of the DST change.  This causes the final result to be off by one hour.

[This patch is only for Python 3]

----------
Added file: http://bugs.python.org/file20613/issue10941.diff

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


More information about the Python-bugs-list mailing list