[New-bugs-announce] [issue27251] TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue

Théo Bueno report at bugs.python.org
Tue Jun 7 11:45:38 EDT 2016


New submission from Théo Bueno:

When trying to log a message with a registered HTTPHandler, using http authentication (by specifying a credentials tuple when constructing an HTTPHandler):

logging/handlers.py, in HTTPHandler.emit:

  if self.credentials:
    import base64
    s = ('u%s:%s' % self.credentials).encode('utf-8')
    s = 'Basic ' + base64.b64encode(s).strip()  # TypeError: Can't convert 'bytes' object to str implicitly
    h.putheader('Authorization', s)

It sounds like a python 2 to 3 conversion issue.

I also want to point out that there is no test covering http authentication in HTTPHandler.

----------
components: Library (Lib)
messages: 267698
nosy: munrek
priority: normal
severity: normal
status: open
title: TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27251>
_______________________________________


More information about the New-bugs-announce mailing list