From patchwork Mon Feb 26 18:53:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2457: py3: slice over bytes or use .startswith() to prevent getting ascii values From: phabricator X-Patchwork-Id: 28415 Message-Id: <33331c6cd265137e4b55a1a6153f5c0f@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Mon, 26 Feb 2018 18:53:13 +0000 pulkit updated this revision to Diff 6127. pulkit retitled this revision from "py3: slice over bytes to prevent getting ascii values" to "py3: slice over bytes or use .startswith() to prevent getting ascii values". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2457?vs=6112&id=6127 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 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',