[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 851401be4b84d2b7efe4ff26d3ddc7e61d5f86cb
Author: juga0 <juga@xxxxxxxxxx>
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:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits