[Python-checkins] cpython (merge 3.5 -> default): Fixed #27251: merged fix from 3.5.

vinay.sajip python-checkins at python.org
Tue Jun 7 16:20:59 EDT 2016


https://hg.python.org/cpython/rev/12d939477b4f
changeset: 101781:12d939477b4f
parent: 101779:cbb5c5da28f2
parent: 101780:11ebd14076b4
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Tue Jun 07 21:20:39 2016 +0100
summary:
 Fixed #27251: merged fix from 3.5.
files:
 Lib/logging/handlers.py | 4 ++--
 Lib/test/test_logging.py | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1165,8 +1165,8 @@
 h.putheader("Content-length", str(len(data)))
 if self.credentials:
 import base64
- s = ('u%s:%s' % self.credentials).encode('utf-8')
- s = 'Basic ' + base64.b64encode(s).strip()
+ s = ('%s:%s' % self.credentials).encode('utf-8')
+ s = 'Basic ' + base64.b64encode(s).strip().decode('ascii')
 h.putheader('Authorization', s)
 h.endheaders()
 if self.method == "POST":
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1672,7 +1672,8 @@
 secure_client = secure and sslctx
 self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
 secure=secure_client,
- context=context)
+ context=context,
+ credentials=('foo', 'bar'))
 self.log_data = None
 root_logger.addHandler(self.h_hdlr)
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /