py3: cast error message to localstr in blackbox.py
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 14 Jan 2018 12:06:27 -0800
changeset 35667 de598e84c244
parent 35666 2c6ebd0c850e
child 35668 67cead0eb671
py3: cast error message to localstr in blackbox.py According to the 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! Differential Revision: https://phab.mercurial-scm.org/D1478
hgext/blackbox.py
--- a/hgext/blackbox.py	Wed Jan 10 21:27:05 2018 -0800
+++ b/hgext/blackbox.py	Sun Jan 14 12:06:27 2018 -0800
@@ -44,6 +44,7 @@
 from mercurial.node import hex
 
 from mercurial import (
+    encoding,
     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)
+                           encoding.strtolocal(err.strerror))
                 # do not restore _bbinlog intentionally to avoid failed
                 # logging again
             else: