Patchwork [4,of,8] py3: fix loop over byte string in wireprotov1peer

login
register
mail settings
Submitter Yuya Nishihara
Date June 16, 2018, 11:06 a.m.
Message ID <cfa1ca8c0eb7a92cdc08.1529147170@mimosa>
Download mbox | patch
Permalink /patch/32190/
State Accepted
Headers show

Comments

Yuya Nishihara - June 16, 2018, 11:06 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1529138204 -32400
#      Sat Jun 16 17:36:44 2018 +0900
# Node ID cfa1ca8c0eb7a92cdc088b0699415f9d4351543a
# Parent  f13276ec9109d1b428c14e638d0f2b35f484291e
py3: fix loop over byte string in wireprotov1peer

Before, it would always return [True]s on Python 3 because list(b"0") == [48].

Patch

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -205,6 +205,7 @@  test-import.t
 test-imports-checker.t
 test-incoming-outgoing.t
 test-inherit-mode.t
+test-init.t
 test-issue1089.t
 test-issue1102.t
 test-issue1175.t
@@ -227,6 +228,7 @@  test-issue842.t
 test-journal-exists.t
 test-journal-share.t
 test-journal.t
+test-known.t
 test-largefiles-cache.t
 test-largefiles-misc.t
 test-largefiles-small-disk.t
@@ -450,9 +452,11 @@  test-sparse-requirement.t
 test-sparse-verbose-json.t
 test-sparse.t
 test-split.t
+test-ssh-bundle1.t
 test-ssh-clone-r.t
 test-ssh-proto-unbundle.t
 test-ssh-proto.t
+test-ssh.t
 test-sshserver.py
 test-stack.t
 test-status-inprocess.py
diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -355,7 +355,7 @@  class wirepeer(repository.peer):
         yield {'nodes': wireprototypes.encodelist(nodes)}, f
         d = f.value
         try:
-            yield [bool(int(b)) for b in d]
+            yield [bool(int(b)) for b in pycompat.iterbytestr(d)]
         except ValueError:
             self._abort(error.ResponseError(_("unexpected response:"), d))