changeset 34211:a48ad118c558

py3: wrap string constants in dagparser.py with bytestr()
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Sep 2017 15:28:39 +0900
parents 8927534cacbc
children dfd009e5f9f2
files mercurial/dagparser.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dagparser.py	Sun Sep 03 15:25:50 2017 +0900
+++ b/mercurial/dagparser.py	Sun Sep 03 15:28:39 2017 +0900
@@ -13,6 +13,7 @@
 from .i18n import _
 from . import (
     error,
+    pycompat,
     util,
 )
 
@@ -158,7 +159,6 @@
 
     Error:
 
-        >>> from . import pycompat
         >>> try: list(parsedag(b'+1 bad'))
         ... except Exception as e: print(pycompat.sysstr(bytes(e)))
         invalid character in dag description: bad...
@@ -167,7 +167,7 @@
     if not desc:
         return
 
-    wordchars = string.ascii_letters + string.digits
+    wordchars = pycompat.bytestr(string.ascii_letters + string.digits)
 
     labels = {}
     p1 = -1
@@ -176,7 +176,7 @@
     def resolve(ref):
         if not ref:
             return p1
-        elif ref[0] in string.digits:
+        elif ref[0] in pycompat.bytestr(string.digits):
             return r - int(ref)
         else:
             return labels[ref]
@@ -210,7 +210,7 @@
 
     c = nextch()
     while c != '\0':
-        while c in string.whitespace:
+        while c in pycompat.bytestr(string.whitespace):
             c = nextch()
         if c == '.':
             yield 'n', (r, [p1])
@@ -218,7 +218,7 @@
             r += 1
             c = nextch()
         elif c == '+':
-            c, digs = nextrun(nextch(), string.digits)
+            c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
             n = int(digs)
             for i in xrange(0, n):
                 yield 'n', (r, [p1])