Mercurial > hg
comparison mercurial/wireprotov1peer.py @ 38328:aa9dd805234d
py3: fix loop over byte string in wireprotov1peer
Before, it would always return [True]s on Python 3 because list(b"0") == [48].
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 16 Jun 2018 17:36:44 +0900 |
parents | 856f381ad74b |
children | e7aa113b14f7 |
comparison
equal
deleted
inserted
replaced
38327:62376d7b8859 | 38328:aa9dd805234d |
---|---|
353 def known(self, nodes): | 353 def known(self, nodes): |
354 f = future() | 354 f = future() |
355 yield {'nodes': wireprototypes.encodelist(nodes)}, f | 355 yield {'nodes': wireprototypes.encodelist(nodes)}, f |
356 d = f.value | 356 d = f.value |
357 try: | 357 try: |
358 yield [bool(int(b)) for b in d] | 358 yield [bool(int(b)) for b in pycompat.iterbytestr(d)] |
359 except ValueError: | 359 except ValueError: |
360 self._abort(error.ResponseError(_("unexpected response:"), d)) | 360 self._abort(error.ResponseError(_("unexpected response:"), d)) |
361 | 361 |
362 @batchable | 362 @batchable |
363 def branchmap(self): | 363 def branchmap(self): |