Patchwork D2457: py3: slice over bytes to prevent getting ascii values

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2018, 12:32 p.m.
Message ID <differential-rev-PHID-DREV-m4y332s5dwhw5gszhn2p-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28390/
State Superseded
Headers show

Comments

phabricator - Feb. 26, 2018, 12:32 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 26, 2018, 1:22 p.m.
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> patch.py:2521
>                              for token in tabsplitter.findall(stripline):
> -                                if '\t' == token[0]:
> +                                if '\t' == token[0:1]:
>                                      yield (token, 'diff.tab')

Nit: could be `token.startswith('\t')`

REPOSITORY
  rHG Mercurial

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

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 '\t' == token[0:1]:
                                     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',