Patchwork [2,of,2] py3: use bytes() to byte-stringify url object in url.py

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 18, 2018, 1:55 p.m.
Message ID <b7ebed58e716806e5789.1518962110@mimosa>
Download mbox | patch
Permalink /patch/28089/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 18, 2018, 1:55 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1518959605 -32400
#      Sun Feb 18 22:13:25 2018 +0900
# Node ID b7ebed58e716806e5789779090bc054e98fb43e2
# Parent  20fd00ae43f25ab4db11bafc909a6a659bb74cbe
py3: use bytes() to byte-stringify url object in url.py

Perhaps we'll have to convert it back and forth from/to bytes and unicode
at urllib boundary, but at least util.hidepassword() wants a byte string.
Augie Fackler - Feb. 18, 2018, 9:02 p.m.
On Sun, Feb 18, 2018 at 10:55:10PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1518959605 -32400
> #      Sun Feb 18 22:13:25 2018 +0900
> # Node ID b7ebed58e716806e5789779090bc054e98fb43e2
> # Parent  20fd00ae43f25ab4db11bafc909a6a659bb74cbe
> py3: use bytes() to byte-stringify url object in url.py

queued, thanks

Patch

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -71,10 +71,10 @@  class passwordmgr(object):
             u.query = None
             if not self.ui.interactive():
                 raise error.Abort(_('http authorization required for %s') %
-                                 util.hidepassword(str(u)))
+                                  util.hidepassword(bytes(u)))
 
             self.ui.write(_("http authorization required for %s\n") %
-                          util.hidepassword(str(u)))
+                          util.hidepassword(bytes(u)))
             self.ui.write(_("realm: %s\n") % realm)
             if user:
                 self.ui.write(_("user: %s\n") % user)
@@ -124,7 +124,7 @@  class proxyhandler(urlreq.proxyhandler):
             else:
                 self.no_list = no_list
 
-            proxyurl = str(proxy)
+            proxyurl = bytes(proxy)
             proxies = {'http': proxyurl, 'https': proxyurl}
             ui.debug('proxying through %s\n' % util.hidepassword(proxyurl))
         else: