# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2018-02-26 11:55:46 # Node ID 588048a6a8d34a73e9e7da3fb75da3ceefb544a5 # Parent 3d58037c6ec0bce3222606e3d95d29d48bb9ff1f py3: slice over bytes or use .startswith() to prevent getting ascii values Differential Revision: https://phab.mercurial-scm.org/D2457 diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -154,7 +154,7 @@ class tarit(object): 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', diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2518,7 +2518,7 @@ def difflabel(func, *args, **kw): 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)