[tor-commits] [sbws/master] circuitbuilder: circuit path is not a number in the code

juga at torproject.org juga at torproject.org
Fri Feb 15 17:42:48 UTC 2019


commit 851401be4b84d2b7efe4ff26d3ddc7e61d5f86cb
Author: juga0 <juga at riseup.net>
Date:   Wed Feb 6 17:11:20 2019 +0000

    circuitbuilder: circuit path is not a number in the code
    
    There is no any case in our code where path is an integer.
    Remove asserts, check only the lenght of the circuit and check it
    in a more logical way.
---
 sbws/lib/circuitbuilder.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index 5eb8a02..8efc8de 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -17,10 +17,7 @@ class PathLengthException(Exception):
 
 
 def valid_circuit_length(path):
-    assert isinstance(path, int) or isinstance(path, list)
-    if isinstance(path, int):
-        return path > 0 and path <= 8
-    return len(path) > 0 and len(path) <= 8
+    return 0 < len(path) <= 8
 
 
 class CircuitBuilder:





More information about the tor-commits mailing list