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.

classification
Title: TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: munrek, python-dev, vinay.sajip
Priority: normal Keywords:

Created on 2016-06-07 15:45 by munrek, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg267698 - (view) Author: Théo Bueno (munrek) Date: 2016-06-07 15:45
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.
msg267742 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-07 20:20
New changeset 11ebd14076b4 by Vinay Sajip in branch '3.5':
Fixed #27251: corrected string/bytes handling in credentials.
https://hg.python.org/cpython/rev/11ebd14076b4

New changeset 12d939477b4f by Vinay Sajip in branch 'default':
Fixed #27251: merged fix from 3.5.
https://hg.python.org/cpython/rev/12d939477b4f
History
Date User Action Args
2022-04-11 14:58:32adminsetgithub: 71438
2016-09-08 14:04:48SilentGhostlinkissue28020 superseder
2016-06-08 01:06:35berker.peksagsetstage: test needed -> resolved
2016-06-07 20:22:49vinay.sajipsetstatus: open -> closed
resolution: fixed
2016-06-07 20:20:56python-devsetnosy: + python-dev
messages: + msg267742
2016-06-07 16:24:39SilentGhostsetnosy: + vinay.sajip
stage: test needed
type: behavior

versions: + Python 3.6
2016-06-07 15:45:38munrekcreate