commit 8c8cbf50dad79eb4233c0962a93f882a09c70b9d Author: Nick Mathewson nickm@torproject.org Date: Fri May 10 14:15:09 2019 -0400
Don't use "ord" to debug a byte; python3 hates it. --- lib/chutney/Traffic.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index 425d08d..2f4cc94 100755 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -34,6 +34,13 @@ import asynchat
from chutney.Debug import debug_flag, debug
+if sys.version_info[0] >= 3: + def byte_to_int(b): + return b +else: + def byte_to_int(b): + return ord(b) + def addr_to_family(addr): for family in [socket.AF_INET, socket.AF_INET6]: try: @@ -274,7 +281,7 @@ class Source(asynchat.async_chat): self.push_output() else: debug("proxy handshake failed (0x%x)! (fd=%d)" % - (ord(self.inbuf[1]), self.fileno())) + (byte_to_int(self.inbuf[1]), self.fileno())) self.state = self.NOT_CONNECTED self.close()
tor-commits@lists.torproject.org