From patchwork Sat May 19 19:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D3608: py3: slice over bytes to prevent getting the ascii values From: phabricator X-Patchwork-Id: 31732 Message-Id: <490b8f4078bce92fc10ffb2e9712d706@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sat, 19 May 2018 19:40:11 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG86e0a4bede5d: py3: slice over bytes to prevent getting the ascii values (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3608?vs=8779&id=8813 REVISION DETAIL https://phab.mercurial-scm.org/D3608 AFFECTED FILES mercurial/patch.py CHANGE DETAILS To: pulkit, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1958,31 +1958,31 @@ binchunk = binchunk[s:] i = 0 while i < len(binchunk): - cmd = ord(binchunk[i]) + cmd = ord(binchunk[i:i + 1]) i += 1 if (cmd & 0x80): offset = 0 size = 0 if (cmd & 0x01): - offset = ord(binchunk[i]) + offset = ord(binchunk[i:i + 1]) i += 1 if (cmd & 0x02): - offset |= ord(binchunk[i]) << 8 + offset |= ord(binchunk[i:i + 1]) << 8 i += 1 if (cmd & 0x04): - offset |= ord(binchunk[i]) << 16 + offset |= ord(binchunk[i:i + 1]) << 16 i += 1 if (cmd & 0x08): - offset |= ord(binchunk[i]) << 24 + offset |= ord(binchunk[i:i + 1]) << 24 i += 1 if (cmd & 0x10): - size = ord(binchunk[i]) + size = ord(binchunk[i:i + 1]) i += 1 if (cmd & 0x20): - size |= ord(binchunk[i]) << 8 + size |= ord(binchunk[i:i + 1]) << 8 i += 1 if (cmd & 0x40): - size |= ord(binchunk[i]) << 16 + size |= ord(binchunk[i:i + 1]) << 16 i += 1 if size == 0: size = 0x10000