Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue #71438

Closed
munrek mannequin opened this issue Jun 7, 2016 · 2 comments
Closed

TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue #71438

munrek mannequin opened this issue Jun 7, 2016 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@munrek
Copy link
Mannequin

munrek mannequin commented Jun 7, 2016

BPO 27251
Nosy @vsajip, @munrek

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-06-07.20:22:49.278>
created_at = <Date 2016-06-07.15:45:38.467>
labels = ['type-bug', 'library']
title = 'TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue'
updated_at = <Date 2016-06-08.01:06:35.652>
user = 'https://github.com/munrek'

bugs.python.org fields:

activity = <Date 2016-06-08.01:06:35.652>
actor = 'berker.peksag'
assignee = 'none'
closed = True
closed_date = <Date 2016-06-07.20:22:49.278>
closer = 'vinay.sajip'
components = ['Library (Lib)']
creation = <Date 2016-06-07.15:45:38.467>
creator = 'munrek'
dependencies = []
files = []
hgrepos = []
issue_num = 27251
keywords = []
message_count = 2.0
messages = ['267698', '267742']
nosy_count = 3.0
nosy_names = ['vinay.sajip', 'python-dev', 'munrek']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue27251'
versions = ['Python 3.5', 'Python 3.6']

@munrek
Copy link
Mannequin Author

munrek mannequin commented Jun 7, 2016

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.

@munrek munrek mannequin added the stdlib Python modules in the Lib dir label Jun 7, 2016
@SilentGhost SilentGhost mannequin added the type-bug An unexpected behavior, bug, or error label Jun 7, 2016
@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 7, 2016

New changeset 11ebd14076b4 by Vinay Sajip in branch '3.5':
Fixed bpo-27251: corrected string/bytes handling in credentials.
https://hg.python.org/cpython/rev/11ebd14076b4

New changeset 12d939477b4f by Vinay Sajip in branch 'default':
Fixed bpo-27251: merged fix from 3.5.
https://hg.python.org/cpython/rev/12d939477b4f

@vsajip vsajip closed this as completed Jun 7, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant