Patchwork D2457: py3: slice over bytes or use .startswith() to prevent getting ascii values

login
register
mail settings
Submitter phabricator
Date Feb. 27, 2018, 12:57 p.m.
Message ID <508805991e3e21b7e0f254dcd265493a@localhost.localdomain>
Download mbox | patch
Permalink /patch/28452/
State Not Applicable
Headers show

Comments

phabricator - Feb. 27, 2018, 12:57 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG588048a6a8d3: py3: slice over bytes or use .startswith() to prevent getting ascii values (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2457?vs=6127&id=6163

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

AFFECTED FILES
  mercurial/archival.py
  mercurial/patch.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2518,7 +2518,7 @@ 
                                 yield (t, l)
                         else:
                             for token in tabsplitter.findall(stripline):
-                                if '\t' == token[0]:
+                                if token.startswith('\t'):
                                     yield (token, 'diff.tab')
                                 else:
                                     yield (token, label)
diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -154,7 +154,7 @@ 
 
         def taropen(mode, name='', fileobj=None):
             if kind == 'gz':
-                mode = mode[0]
+                mode = mode[0:1]
                 if not fileobj:
                     fileobj = open(name, mode + 'b')
                 gzfileobj = self.GzipFileWithTime(name, mode + 'b',