[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Joe Peterson j...@skyrush.com added the comment: This issue has been split, as suggested by Alexander Belopolsky, into separate issues: issue 10934 - doc change to correctly reflect return of local time vs. UTC issue 10939 - bytes/str issues issue 10941 - DST handled incorrectly issue 10947 - compatibility using str/bytes Closing this issue (see separate ones above). -- status: open - closed ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- resolution: - duplicate stage: unit test needed - committed/rejected superseder: - imaplib: Internaldate2tuple() is documented to return UTC, but it returns local time ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Joe Peterson j...@skyrush.com added the comment: I have started splitting these up as recommended. First one (documentation) is: issue 10934. I will split out more later today... -- ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
R. David Murray rdmur...@bitdance.com added the comment: If I understand correctly, what Alexander means by only work in the C locale is that both strptime and strftime are locale dependent, and so if the locale is something other than C it may fail to parse the month name and may generate a non-standard month name. -- ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Joe Peterson j...@skyrush.com added the comment: Two more issues split out into their own issues: issue 10939 (bytes/str issues) issue 10941 (DST handled incorrectly) -- ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Joe Peterson j...@skyrush.com added the comment: Added fix for ParseFlags (another string/bytes issue) and now accept strings as args to ParseFlags and Internaldate2tuple. Also added unit tests for changes. -- assignee: - docs@python components: +Tests title: imaplib: Internaldate2tuple() crashes, does not handle negative TZ offsets, does not handle DST correctly - imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly Added file: http://bugs.python.org/file20430/imaplib_Internaldate2tuple_python32.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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Joe Peterson j...@skyrush.com: Removed 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Joe Peterson j...@skyrush.com: Removed file: http://bugs.python.org/file20430/imaplib_Internaldate2tuple_python32.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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Joe Peterson j...@skyrush.com: Added file: http://bugs.python.org/file20431/imaplib_Internaldate2tuple_python32.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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Joe Peterson j...@skyrush.com: Removed file: http://bugs.python.org/file20426/imaplib_Internaldate2tuple_python27.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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Changes by Joe Peterson j...@skyrush.com: Added file: http://bugs.python.org/file20432/imaplib_Internaldate2tuple_python27.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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: There are at least 3 issues here: a documentation issue, a py3k bug and at least one feature request. Given that the logistics are different for different kinds of issues, I think it would be best to split them on the tracker. Here is how I see what is being proposed: 1. Internaldate2tuple is documented to return UTC timetuple, but implemented to return local time (ignoring the DST issues.) The proposal is to change the documentation. 2. There are a couple of str vs bytes bugs that obviously need to be fixed. 3. The proposed patch also make both str and bytes acceptable as Internaldate2tuple argument. As discussed in issue 9864, it would be best if datetime formatting and parsing routines would operate on datetime objects. Something along the lines of def parseinternaldate(datestr): return datetime.strptime(datestr, %d-%b-%Y %H:%M:%S %z) def formatinternaldate(dateobj): return dateobj.strftime(%d-%b-%Y %H:%M:%S %z) The above uses recently added timezone support in datetime module. There is still a problem, though. The code above would only work as expected in the C locale, but Time2Internaldate already has this limitation. -- ___ 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
[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly
Joe Peterson j...@skyrush.com added the comment: There are at least 3 issues here: a documentation issue, a py3k bug and at least one feature request. Which is a feature request? In these patches, I am attempting to fix the DST problems and regain the previous behavior in Python 2. Are you talking about the ability to accept a string vs. a bytes object? 1. Internaldate2tuple is documented to return UTC timetuple, but implemented to return local time (ignoring the DST issues.) The proposal is to change the documentation. I prefer UTC, so this is a bit of a shame, I agree, but the use of the pervious interfaces assumed localtime, so changing to UTC would definitely break existing code. I do think it would be nice to extend this to deal with UTC instead, but in this patch, I am only trying to retain current functionality. 2. There are a couple of str vs bytes bugs that obviously need to be fixed. 3. The proposed patch also make both str and bytes acceptable as Internaldate2tuple argument. True, but given the new role of str and bytes, it is unclear what existing code would try to pass. As discussed in issue 9864, it would be best if datetime formatting and parsing routines would operate on datetime objects. I can see that redoing some of this would be a good idea. But I am only trying to keep the existing stuff from being broken in this patch. I agree that the interfaces could be a lot better, and I would indeed like to see it improved (and I am willing to help with doing that). There is still a problem, though. The code above would only work as expected in the C locale, but Time2Internaldate already has this limitation. As long as we assume strings passed are ASCII, it should work. And email headers should be ASCII (although I have seen some really weird deviations from this on old emails). It's not perfect, certainly, and going forward, the IMAP lib could be tightened up. Maybe this first patch could be thought of as a step, at least fixing what is broken until improved. -- ___ 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