changeset 41378:e6c1c6478d04

wireprotov2peer: rewrite character traversal to use slices Otherwise on Python 3 we iterate over integers instead of a bytes instance and the comparison fails. Differential Revision: https://phab.mercurial-scm.org/D5698
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 25 Jan 2019 15:03:20 -0800
parents e053053ceba7
children 4d86bdef3371
files mercurial/wireprotov2peer.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireprotov2peer.py	Fri Jan 25 14:57:37 2019 -0800
+++ b/mercurial/wireprotov2peer.py	Fri Jan 25 15:03:20 2019 -0800
@@ -510,7 +510,7 @@
     # Bytestring where each byte is a 0 or 1.
     raw = next(objs)
 
-    return [True if c == '1' else False for c in raw]
+    return [True if raw[i:i + 1] == b'1' else False for i in range(len(raw))]
 
 def decodelistkeys(objs):
     # Map with bytestring keys and values.