verify: fix exception formatting bug in Python 3
authorAugie Fackler <augie@google.com>
Thu, 01 Mar 2018 23:58:28 -0500
changeset 36577 d85ef895d5f6
parent 36576 cfd0c1df5e33
child 36578 149fd142f498
verify: fix exception formatting bug in Python 3 Differential Revision: https://phab.mercurial-scm.org/D2541
mercurial/verify.py
--- 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):