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

login
register
mail settings
Submitter phabricator
Date March 1, 2018, 10:17 p.m.
Message ID <5c5c6f12f9a0af1409b4f3d52fa0dee8@localhost.localdomain>
Download mbox | patch
Permalink /patch/28611/
State Not Applicable
Headers show

Comments

phabricator - March 1, 2018, 10:17 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1d99260c3a81: py3: slice over bytes to prevent getting ascii values (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2522?vs=6292&id=6294

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -287,14 +287,14 @@ 
             off = 0
             end = len(data)
             while off < end:
-                rtype = data[off]
+                rtype = data[off:off + 1]
                 off += 1
                 length = _unpack('>I', data[off:(off + 4)])[0]
                 off += 4
                 record = data[off:(off + length)]
                 off += length
                 if rtype == 't':
-                    rtype, record = record[0], record[1:]
+                    rtype, record = record[0:1], record[1:]
                 records.append((rtype, record))
             f.close()
         except IOError as err: