summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-02 14:04:46 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-02 14:18:41 -0400
commitfc5f8b6931dbbfcf31157cb9e4f68da56b6ff6aa (patch)
treed04ebc3954ebf7215bff02d7a03c9f307a1324b3
parent1953a7e61d7dede47f90016cea13b38bc33554ef (diff)
downloadtor-fc5f8b6931dbbfcf31157cb9e4f68da56b6ff6aa.tar.gz
tor-fc5f8b6931dbbfcf31157cb9e4f68da56b6ff6aa.zip
ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows. Fixes bug 26535; bug introduced in f4be34f70d6f277a0f3f73e, which was apparently intended itself as a Python3 workaround.
-rw-r--r--changes/bug26535.0295
-rwxr-xr-xsrc/test/ntor_ref.py9
2 files changed, 11 insertions, 3 deletions
diff --git a/changes/bug26535.029 b/changes/bug26535.029
new file mode 100644
index 0000000000..111b539f17
--- /dev/null
+++ b/changes/bug26535.029
@@ -0,0 +1,5 @@
+ o Minor bugfixes (testing, compatibility):
+ - When running the ntor_ref.py test, make sure only to pass strings
+ (rather than "bytes" objects) to the Python subprocess module.
+ Python 3 on Windows seems to require this. Fixes bug 26535; bugfix on
+ 0.2.5.5-alpha.
diff --git a/src/test/ntor_ref.py b/src/test/ntor_ref.py
index df065853f3..5ec117f2bd 100755
--- a/src/test/ntor_ref.py
+++ b/src/test/ntor_ref.py
@@ -336,13 +336,16 @@ def test_tor():
Call the test-ntor-cl command-line program to make sure we can
interoperate with Tor's ntor program
"""
- enhex=lambda s: binascii.b2a_hex(s)
+ if sys.version_info[0] >= 3:
+ enhex=lambda s: binascii.b2a_hex(s).decode("ascii")
+ else:
+ enhex=lambda s: binascii.b2a_hex(s)
dehex=lambda s: binascii.a2b_hex(s.strip())
- PROG = b"./src/test/test-ntor-cl"
+ PROG = "./src/test/test-ntor-cl"
def tor_client1(node_id, pubkey_B):
" returns (msg, state) "
- p = subprocess.Popen([PROG, b"client1", enhex(node_id),
+ p = subprocess.Popen([PROG, "client1", enhex(node_id),
enhex(pubkey_B.serialize())],
stdout=subprocess.PIPE)
return map(dehex, p.stdout.readlines())