Erno Tukia <erno.tu...@iki.fi> added the comment:

In Python 2.6 PLAIN authentication works, in Python 3.1 not.

Lib/test/test_imaplib.py does not test IMAP4.authenticate() or 
IMAP4.login_cram_md5() functions, only IMAP4.login().

I would still like to go back to imaplib._Authenticator.encode() function. The 
function is below.

# inp = authobject(response)
def encode(self, inp):
    oup = ''
    while inp:
        if len(inp) > 48:
            t = inp[:48]
            inp = inp[48:]
        else:
            t = inp
            inp = ''
        e = binascii.b2a_base64(t)
        if e:
            oup = oup + e[:-1]
    return oup

binascii.b2a_base64() takes bytes, so inp must therefore be bytes, and returns 
bytes (Python 3). Then str + bytes (out + e[:-1]) fails.

The fix would then be changing 
            oup = oup + e[:-1]
to
            oup = oup + e[:-1].decode()

----------

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

Reply via email to