[issue10921] imaplib: Internaldate2tuple() crashes, does not handle negative TZ offsets, does not handle DST correctly
report at bugs.python.org
Mon Jan 17 02:46:38 CET 2011
Joe Peterson <joe at skyrush.com> added the comment:
Regarding problem #4, it actually appears that returning local time is the right thing to do, since it matches the behavior of Time2Internaldate(). Returning UTC, as the doc states, would potentially break IMAP append() that can include an internaldate possibly returned from Internaldate2tuple() in typical usage (like when copying messages). In this case, the doc is wrong on Internaldate2tuple().
I have attached a new patch to both the code and doc that replaces the old patch. I now return localtime rather than gmtime, but other than that, the DST fix remains the same and now handles the cases near DST changes correctly.
Ultimately, it might be desirable to be able always stay in UTC, so perhaps adding UTC variants of both Internaldate2tuple() and Time2Internaldate() (and a UTC option to append()) would be a good enhancement for later.
assignee: -> docs at python
nosy: +docs at python
title: imaplib: Internaldate2tuple() crashes, does not handle negative TZ offsets, does not handle DST correctly, and outputs localtime (not UTC) -> imaplib: Internaldate2tuple() crashes, does not handle negative TZ offsets, does not handle DST correctly
Added file: http://bugs.python.org/file20420/imaplib_Internaldate2tuple.patch
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list