diff mercurial/extensions.py @ 31457:6419cd243017

encoding: add converter between native str and byte string This kind of encoding conversion is unavoidable on Python 3.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 13 Mar 2017 09:12:56 -0700
parents 067add650129
children b98ee1a808bd
line wrap: on
line diff
--- a/mercurial/extensions.py	Mon Mar 13 09:11:08 2017 -0700
+++ b/mercurial/extensions.py	Mon Mar 13 09:12:56 2017 -0700
@@ -108,9 +108,7 @@
 def _forbytes(inst):
     """Portably format an import error into a form suitable for
     %-formatting into bytestrings."""
-    if pycompat.ispy3:
-        return encoding.unitolocal(str(inst))
-    return inst
+    return encoding.strtolocal(str(inst))
 
 def _reportimporterror(ui, err, failed, next):
     # note: this ui.debug happens before --debug is processed,