changeset 36447:588048a6a8d3

py3: slice over bytes or use .startswith() to prevent getting ascii values Differential Revision: https://phab.mercurial-scm.org/D2457
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 26 Feb 2018 17:25:46 +0530
parents 3d58037c6ec0
children 39c9f339b692
files mercurial/archival.py mercurial/patch.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Mon Feb 26 16:23:12 2018 +0530
+++ b/mercurial/archival.py	Mon Feb 26 17:25:46 2018 +0530
@@ -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',
--- a/mercurial/patch.py	Mon Feb 26 16:23:12 2018 +0530
+++ b/mercurial/patch.py	Mon Feb 26 17:25:46 2018 +0530
@@ -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)