Patchwork D6453: contrib: fix import-checker to operate on str instead of bytes

login
register
mail settings
Submitter phabricator
Date May 29, 2019, 2:32 p.m.
Message ID <06e5ab622492d02d96f9cdd0aec8609f@localhost.localdomain>
Download mbox | patch
Permalink /patch/40264/
State Not Applicable
Headers show

Comments

phabricator - May 29, 2019, 2:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG04eb3c5607af: contrib: fix import-checker to operate on str instead of bytes (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6453?vs=15283&id=15288

REVISION DETAIL
  https://phab.mercurial-scm.org/D6453

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS




To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -649,15 +649,15 @@ 
     ...         print("%s %s %d" % (_forcestr(m), _forcestr(f), l))
     ...         print(repr(_forcestr(s)))
     >>> lines = [
-    ...   b'comment',
-    ...   b'  >>> from __future__ import print_function',
-    ...   b"  >>> ' multiline",
-    ...   b"  ... string'",
-    ...   b'  ',
-    ...   b'comment',
-    ...   b'  $ cat > foo.py <<EOF',
-    ...   b'  > from __future__ import print_function',
-    ...   b'  > EOF',
+    ...   'comment',
+    ...   '  >>> from __future__ import print_function',
+    ...   "  >>> ' multiline",
+    ...   "  ... string'",
+    ...   '  ',
+    ...   'comment',
+    ...   '  $ cat > foo.py <<EOF',
+    ...   '  > from __future__ import print_function',
+    ...   '  > EOF',
     ... ]
     >>> test(b"example.t", lines)
     example[2] doctest.py 1
@@ -694,7 +694,7 @@ 
             yield src.read(), modname, f, 0
             py = True
     if py or f.endswith('.t'):
-        with open(f, 'rb') as src:
+        with open(f, 'r') as src:
             for script, modname, t, line in embedded(f, modname, src):
                 yield script, modname.encode('utf8'), t, line