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? |