changeset 31178:81e289ef9376

ui: fix ui.traceback on Python 3
author Augie Fackler <raf@durin42.com>
date Fri, 03 Mar 2017 14:09:14 -0500
parents a7cabac20b62
children 49ad6bf63107
files mercurial/ui.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Mar 03 14:08:24 2017 -0500
+++ b/mercurial/ui.py	Fri Mar 03 14:09:14 2017 -0500
@@ -1336,7 +1336,11 @@
                                ''.join(exconly))
             else:
                 output = traceback.format_exception(exc[0], exc[1], exc[2])
-                self.write_err(''.join(output))
+                data = r''.join(output)
+                if pycompat.ispy3:
+                    enc = pycompat.sysstr(encoding.encoding)
+                    data = data.encode(enc, errors=r'replace')
+                self.write_err(data)
         return self.tracebackflag or force
 
     def geteditor(self):