Joe Peterson <j...@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@python
components: +Documentation
nosy: +docs@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10921>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to