changeset 36537:1d99260c3a81

py3: slice over bytes to prevent getting ascii values This fixed reading of mergestate files and fixes 14 tests on Python 3. Differential Revision: https://phab.mercurial-scm.org/D2522
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 02 Mar 2018 02:44:49 +0530
parents 3cd245945ef3
children 81d4a11549ec
files mercurial/merge.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Tue Feb 27 14:26:00 2018 -0800
+++ b/mercurial/merge.py	Fri Mar 02 02:44:49 2018 +0530
@@ -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: