D1478: py3: cast error message to bytes in blackbox.py

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Nov 21 02:53:44 EST 2017


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  According to the new exceptions reporting mechanism, this is
  the #1 crasher in the test harness for Python 3.
  
  Since this exception is in an except block, we'll likely get a
  new #1 crasher after this change. But at least we won't die
  during error handling!

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/blackbox.py

CHANGE DETAILS

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -44,6 +44,7 @@
 from mercurial.node import hex
 
 from mercurial import (
+    pycompat,
     registrar,
     ui as uimod,
     util,
@@ -182,7 +183,7 @@
                     fp.write(fmt % args)
             except (IOError, OSError) as err:
                 self.debug('warning: cannot write to blackbox.log: %s\n' %
-                           err.strerror)
+                           pycompat.bytestr(err.strerror))
                 # do not restore _bbinlog intentionally to avoid failed
                 # logging again
             else:



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list