From: R David Murray Date: Tue, 19 Feb 2013 17:19:13 +0000 (-0500) Subject: Merge: #13700: Make imap.authenticate with authobject work. X-Git-Tag: v3.3.1rc1~158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6cd6f015567d35be5831f0095b39a512842d31f2;p=thirdparty%2FPython%2Fcpython.git Merge: #13700: Make imap.authenticate with authobject work. This fixes a bytes/string confusion in the API which prevented custom authobjects from working at all. Original patch by Erno Tukia. --- 6cd6f015567d35be5831f0095b39a512842d31f2 diff --cc Lib/imaplib.py index 3f8c65a98b29,00a17fbf36d3..f8c7ffdb9213 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@@ -1310,11 -1307,13 +1314,11 @@@ class _Authenticator def decode(self, inp): if not inp: - return '' + return b'' return binascii.a2b_base64(inp) - - -Mon2num = {b'Jan': 1, b'Feb': 2, b'Mar': 3, b'Apr': 4, b'May': 5, b'Jun': 6, - b'Jul': 7, b'Aug': 8, b'Sep': 9, b'Oct': 10, b'Nov': 11, b'Dec': 12} +Months = ' Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ') +Mon2num = {s.encode():n+1 for n, s in enumerate(Months[1:])} def Internaldate2tuple(resp): """Parse an IMAP4 INTERNALDATE string.