New submission from Joe Peterson <j...@skyrush.com>:

There are two issues with conversion to Python 3:

1. It raise "KeyError".  This is because the Mon2num dictionary keys are 
strings (str), not bytes objects (note that many other strings in imaplib have 
been updated, but not Mon2num).

2. The sign character of the TZ offset (e.g. -0700) is compared to the string 
(str) '-', not bytes array b'-', so the compare is never true, causing a large 
error when the TZ offset is negative.

Patch attached that also adds a unit test.

----------
components: Library (Lib)
files: imaplib_Internaldate2tuple_bytes_fixes_python32.patch
keywords: patch
messages: 126499
nosy: lavajoe
priority: normal
severity: normal
status: open
title: imaplib: Internaldate2tuple fails to parse month and does not work with 
negative TZ offset due to bytes/str issues
type: behavior
versions: Python 3.2
Added file: 
http://bugs.python.org/file20444/imaplib_Internaldate2tuple_bytes_fixes_python32.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10939>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to