D2541: verify: fix exception formatting bug in Python 3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Mar 2 12:10:47 EST 2018


durin42 updated this revision to Diff 6364.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2541?vs=6331&id=6364

REVISION DETAIL
  https://phab.mercurial-scm.org/D2541

AFFECTED FILES
  mercurial/verify.py

CHANGE DETAILS

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -70,8 +70,9 @@
         self.errors += 1
 
     def exc(self, linkrev, msg, inst, filename=None):
-        if not str(inst):
-            inst = repr(inst)
+        fmsg = pycompat.bytestr(inst)
+        if not fmsg:
+            fmsg = pycompat.byterepr(inst)
         self.err(linkrev, "%s: %s" % (msg, inst), filename)
 
     def checklog(self, obj, name, linkrev):



To: durin42, #hg-reviewers, pulkit, yuja
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list