mercurial/pycompat.py
changeset 31391 c9fd842dc886
parent 31381 06440ba06bc0
child 31408 1ed169c5e235
--- a/mercurial/pycompat.py	Sun Mar 12 19:47:51 2017 -0400
+++ b/mercurial/pycompat.py	Sun Mar 12 17:04:45 2017 -0700
@@ -76,6 +76,10 @@
     def bytechr(i):
         return bytes([i])
 
+    def iterbytestr(s):
+        """Iterate bytes as if it were a str object of Python 2"""
+        return iter(s[i:i + 1] for i in range(len(s)))
+
     def sysstr(s):
         """Return a keyword str to be passed to Python functions such as
         getattr() and str.encode()
@@ -142,6 +146,7 @@
     import cStringIO
 
     bytechr = chr
+    iterbytestr = iter
 
     def sysstr(s):
         return s