py3: wrap bytes in encoding.from/toutf8b() with bytestr
authorYuya Nishihara <yuya@tcha.org>
Sun, 03 Sep 2017 15:54:29 +0900
changeset 34216 1c601df9894c
parent 34215 b4abc438a8c9
child 34217 5307cc57f271
py3: wrap bytes in encoding.from/toutf8b() with bytestr
mercurial/encoding.py
--- a/mercurial/encoding.py	Sun Sep 03 17:28:47 2017 +0900
+++ b/mercurial/encoding.py	Sun Sep 03 15:54:29 2017 +0900
@@ -508,6 +508,7 @@
         except UnicodeDecodeError:
             pass
 
+    s = pycompat.bytestr(s)
     r = ""
     pos = 0
     l = len(s)
@@ -560,6 +561,7 @@
     # points to be escaped. Instead, we use our handy getutf8char
     # helper again to walk the string without "decoding" it.
 
+    s = pycompat.bytestr(s)
     r = ""
     pos = 0
     l = len(s)