comparison mercurial/wireprotov2peer.py @ 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 15a643304728
children 090a797f2b47
comparison
equal deleted inserted replaced
41377:e053053ceba7 41378:e6c1c6478d04
508 508
509 def decodeknown(objs): 509 def decodeknown(objs):
510 # Bytestring where each byte is a 0 or 1. 510 # Bytestring where each byte is a 0 or 1.
511 raw = next(objs) 511 raw = next(objs)
512 512
513 return [True if c == '1' else False for c in raw] 513 return [True if raw[i:i + 1] == b'1' else False for i in range(len(raw))]
514 514
515 def decodelistkeys(objs): 515 def decodelistkeys(objs):
516 # Map with bytestring keys and values. 516 # Map with bytestring keys and values.
517 return next(objs) 517 return next(objs)
518 518