This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author etukia
Recipients docs@python, etukia, r.david.murray
Date 2012-01-03.15:06:15
SpamBayes Score 3.7678578e-06
Marked as misclassified No
Message-id <1325603176.26.0.392799478167.issue13700@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2012-01-03 15:06:16etukiasetrecipients: + etukia, r.david.murray, docs@python
2012-01-03 15:06:16etukiasetmessageid: <1325603176.26.0.392799478167.issue13700@psf.upfronthosting.co.za>
2012-01-03 15:06:15etukialinkissue13700 messages
2012-01-03 15:06:15etukiacreate