[tor-commits] [stem/master] Fix python3 proc regression

atagar at torproject.org atagar at torproject.org
Fri May 18 02:10:16 UTC 2018


commit 25e428be5bd4860127bc72af841ca9168fde58c9
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu May 17 10:11:40 2018 -0700

    Fix python3 proc regression
    
    Unit tests failed with python 3.x due to my recent proc changes. Caught thanks
    to dmr. Stacktrace when I remove the masking catch-all is...
    
      ======================================================================
      ERROR: test_high_connection_count
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/usr/lib/python3.5/unittest/mock.py", line 1157, in patched
          return func(*args, **keywargs)
        File "/home/atagar/Desktop/stem/test/unit/util/proc.py", line 349, in test_high_connection_count
          self.assertEqual(expected, proc.connections(pid))
        File "/home/atagar/Desktop/stem/stem/util/proc.py", line 398, in connections
          div = l_dst.find(':')
      TypeError: a bytes-like object is required, not 'str'
    
      ----------------------------------------------------------------------
---
 stem/util/proc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/util/proc.py b/stem/util/proc.py
index 9969b59c..b15d708c 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -395,11 +395,11 @@ def connections(pid = None, user = None):
             elif protocol == 'tcp' and status != b'01':
               continue  # skip tcp connections that aren't yet established
 
-            div = l_dst.find(':')
+            div = l_dst.find(b':')
             l_addr = _unpack_addr(l_dst[:div])
             l_port = int(l_dst[div + 1:], 16)
 
-            div = r_dst.find(':')
+            div = r_dst.find(b':')
             r_addr = _unpack_addr(r_dst[:div])
             r_port = int(r_dst[div + 1:], 16)
 





More information about the tor-commits mailing list