[PATCH 1 of 3 py3] py3: wrap bytes in encoding.from/toutf8b() with bytestr

Yuya Nishihara yuya at tcha.org
Sat Sep 16 14:32:50 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1504421669 -32400
#      Sun Sep 03 15:54:29 2017 +0900
# Node ID 9835dada78098e86e057cf20ee0ee5ec2efe3dab
# Parent  9003f4dc016c5900d02db7a77a0d55d205cffc13
py3: wrap bytes in encoding.from/toutf8b() with bytestr

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -508,6 +508,7 @@ def toutf8b(s):
         except UnicodeDecodeError:
             pass
 
+    s = pycompat.bytestr(s)
     r = ""
     pos = 0
     l = len(s)
@@ -560,6 +561,7 @@ def fromutf8b(s):
     # 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)


More information about the Mercurial-devel mailing list