Patchwork [1,of,4,V2] py3: use encoding.unitolocal instead of .encode(encoding.encoding)

login
register
mail settings
Submitter Pulkit Goyal
Date May 4, 2017, 10:40 p.m.
Message ID <104a4d6517666d7a10bb.1493937615@pulkit-goyal>
Download mbox | patch
Permalink /patch/20436/
State Accepted
Headers show

Comments

Pulkit Goyal - May 4, 2017, 10:40 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1491629557 -19800
#      Sat Apr 08 11:02:37 2017 +0530
# Node ID 104a4d6517666d7a10bb371dfdc6c1e83dc670c9
# Parent  2cfdf5241096f6c0c2d45d32b2f1a41575835025
py3: use encoding.unitolocal instead of .encode(encoding.encoding)

Patch

diff -r 2cfdf5241096 -r 104a4d651766 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Apr 28 01:13:07 2017 +0530
+++ b/mercurial/scmutil.py	Sat Apr 08 11:02:37 2017 +0530
@@ -212,7 +212,7 @@ 
                 reason = inst.reason
             if isinstance(reason, unicode):
                 # SSLError of Python 2.7.9 contains a unicode
-                reason = reason.encode(encoding.encoding, 'replace')
+                reason = encoding.unitolocal(reason)
             ui.warn(_("abort: error: %s\n") % reason)
         elif (util.safehasattr(inst, "args")
               and inst.args and inst.args[0] == errno.EPIPE):