Patchwork [5,of,8,py3] py3: iterate bytes as a byte string in dagparser.py

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 16, 2017, 2:31 p.m.
Message ID <19726b35322ecc59a387.1505572289@mimosa>
Download mbox | patch
Permalink /patch/23940/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 16, 2017, 2:31 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504420365 -32400
#      Sun Sep 03 15:32:45 2017 +0900
# Node ID 19726b35322ecc59a3879746ee24a08231d8bf0d
# Parent  9df048c2b35e6c3528727c52ed710ec1fd997d2c
py3: iterate bytes as a byte string in dagparser.py

Patch

diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py
--- a/mercurial/dagparser.py
+++ b/mercurial/dagparser.py
@@ -181,7 +181,7 @@  def parsedag(desc):
         else:
             return labels[ref]
 
-    chiter = (c for c in desc)
+    chiter = pycompat.iterbytestr(desc)
 
     def nextch():
         return next(chiter, '\0')
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -48,8 +48,7 @@  testmod('mercurial.changelog')
 testmod('mercurial.color')
 testmod('mercurial.config')
 testmod('mercurial.context')
-testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE,
-        py3=False)  # py3: use of str()
+testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
 testmod('mercurial.dispatch')
 testmod('mercurial.encoding', py3=False)  # py3: multiple encoding issues
 testmod('mercurial.formatter', py3=False)  # py3: write bytes to stdout