Patchwork [STABLE] py3: force bytestr conversion of "reason" in scmutil.callcatch()

login
register
mail settings
Submitter Denis Laxalde
Date Dec. 18, 2019, 4:45 p.m.
Message ID <b5ea9c258bedfc2ba121.1576687509@steppe.local>
Download mbox | patch
Permalink /patch/43975/
State Superseded
Headers show

Comments

Denis Laxalde - Dec. 18, 2019, 4:45 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1576687426 -3600
#      Wed Dec 18 17:43:46 2019 +0100
# Branch stable
# Node ID b5ea9c258bedfc2ba12111e98c038076ded3ac6a
# Parent  b06cf2809ec3486b25187ac2c8e766d6ac18763b
py3: force bytestr conversion of "reason" in scmutil.callcatch()

For instance, reason may be InvalidURL.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -262,7 +262,7 @@  def callcatch(ui, func):
             if isinstance(reason, pycompat.unicode):
                 # SSLError of Python 2.7.9 contains a unicode
                 reason = encoding.unitolocal(reason)
-            ui.error(_(b"abort: error: %s\n") % reason)
+            ui.error(_(b"abort: error: %s\n") % stringutil.forcebytestr(reason))
         elif (
             util.safehasattr(inst, b"args")
             and inst.args