changeset 36606:d85ef895d5f6

verify: fix exception formatting bug in Python 3 Differential Revision: https://phab.mercurial-scm.org/D2541
author Augie Fackler <augie@google.com>
date Thu, 01 Mar 2018 23:58:28 -0500
parents cfd0c1df5e33
children 149fd142f498
files mercurial/verify.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/verify.py	Fri Mar 02 13:50:31 2018 -0500
+++ b/mercurial/verify.py	Thu Mar 01 23:58:28 2018 -0500
@@ -70,9 +70,10 @@
         self.errors += 1
 
     def exc(self, linkrev, msg, inst, filename=None):
-        if not str(inst):
-            inst = repr(inst)
-        self.err(linkrev, "%s: %s" % (msg, inst), filename)
+        fmsg = pycompat.bytestr(inst)
+        if not fmsg:
+            fmsg = pycompat.byterepr(inst)
+        self.err(linkrev, "%s: %s" % (msg, fmsg), filename)
 
     def checklog(self, obj, name, linkrev):
         if not len(obj) and (self.havecl or self.havemf):