Submitter | Augie Fackler |
---|---|
Date | March 6, 2017, 11:23 p.m. |
Message ID | <cf5be2a3d1804666dff9.1488842587@augie-macbookair2.roam.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/18947/ |
State | Accepted |
Headers | show |
Comments
On Mon, 06 Mar 2017 18:23:07 -0500, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler <raf@durin42.com> > # Date 1488568154 18000 > # Fri Mar 03 14:09:14 2017 -0500 > # Node ID cf5be2a3d1804666dff9a4c99a33354dab7cc322 > # Parent 2e19b1921f0ba7f3550c11f7f3c85e88e732e3a0 > ui: fix ui.traceback on Python 3 > > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1336,7 +1336,11 @@ class ui(object): > ''.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 = encoding.encoding.decode('latin1', errors='replace') > + data = data.encode(enc, errors='replace') Fixed indent and some bytes-vs-unicode issues as follows: if pycompat.ispy3: enc = pycompat.sysstr(encoding.encoding) data = data.encode(enc, errors=r'replace')
Patch
diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1336,7 +1336,11 @@ class ui(object): ''.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 = encoding.encoding.decode('latin1', errors='replace') + data = data.encode(enc, errors='replace') + self.write_err(data) return self.tracebackflag or force def geteditor(self):