[New-bugs-announce] [issue10947] imaplib: Internaldate2tuple and ParseFlags require (and latter returns) bytes arrays; should allow/return str
Joe Peterson
report at bugs.python.org
Wed Jan 19 16:35:32 CET 2011
New submission from Joe Peterson <joe at skyrush.com>:
In imaplib, there is currently a mix of bytes array and str use. Time2Internaldate(), e.g., returns (and accepts) str. Internaldate2tuple() and ParseFlags() only accept a bytes object, and the latter returns a tuple of bytes objects. Of course, these were all strings in Python 2.
To regain compatibility with Python 2 behavior and make things more consistent, this patch changes the return type of ParseFlags() to a str tuple, and allow it and Internaldate2tuple() to accept either a bytes object or a str.
The unit test has been expanded to test these. Note that applying this patch assumes that the the patches from issue 10939 and issue 10941 have been applied.
Also, I am not sure it is proper to accept *both* bytes array and str. Perhaps only str should be allowed. Comments?
----------
components: Library (Lib)
files: imaplib_string_compat.patch
keywords: patch
messages: 126532
nosy: lavajoe
priority: normal
severity: normal
status: open
title: imaplib: Internaldate2tuple and ParseFlags require (and latter returns) bytes arrays; should allow/return str
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file20453/imaplib_string_compat.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10947>
_______________________________________
More information about the New-bugs-announce
mailing list