changeset 38085:e887381e2976

py3: bytestr() bytes to get bytechar while iterating on it Iterating on bytes give you ascii values instead of bytechr so we need to wrap the bytes in pycompat.bytestr() to get bytechr while iterating. Differential Revision: https://phab.mercurial-scm.org/D3609
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 19 May 2018 18:51:14 +0530
parents 86e0a4bede5d
children b95a6fb7ae66
files mercurial/patch.py mercurial/templater.py
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sat May 19 18:49:07 2018 +0530
+++ b/mercurial/patch.py	Sat May 19 18:51:14 2018 +0530
@@ -1946,7 +1946,7 @@
     """
     def deltahead(binchunk):
         i = 0
-        for c in binchunk:
+        for c in pycompat.bytestr(binchunk):
             i += 1
             if not (ord(c) & 0x80):
                 return i
--- a/mercurial/templater.py	Sat May 19 18:49:07 2018 +0530
+++ b/mercurial/templater.py	Sat May 19 18:51:14 2018 +0530
@@ -253,7 +253,8 @@
     p = parser.parser(elements)
     try:
         while pos < stop:
-            n = min((tmpl.find(c, pos, stop) for c in sepchars),
+            n = min((tmpl.find(c, pos, stop)
+                     for c in pycompat.bytestr(sepchars)),
                     key=lambda n: (n < 0, n))
             if n < 0:
                 yield ('string', unescape(tmpl[pos:stop]), pos)