[tor-commits] [bridgedb/master] Fix BridgeRequestBase.addressClass check.

isis at torproject.org isis at torproject.org
Wed Mar 25 19:03:47 UTC 2015


commit 8507fa30378e85e90b71b54de2bcb2f9537936f4
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Mar 23 00:32:04 2015 +0000

    Fix BridgeRequestBase.addressClass check.
    
     * CHANGE `bridgedb.bridgerequest.BridgeRequestBase.__init__()` to check
       that the `addressClass` *is* either an `ipaddr.IPv4Address` or an
       `ipaddr.IPv6Address`, rather than checking if `addressClass` is an
       instance of one of those classes.
     * FIXES #14065: https://bugs.torproject.org/14065.
---
 lib/bridgedb/bridgerequest.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/bridgerequest.py b/lib/bridgedb/bridgerequest.py
index d7b4d18..320074a 100644
--- a/lib/bridgedb/bridgerequest.py
+++ b/lib/bridgedb/bridgerequest.py
@@ -88,8 +88,8 @@ class BridgeRequestBase(object):
 
     def __init__(self, addressClass=None):
         self.addressClass = addressClass
-        if not isinstance(self.addressClass,
-                          (ipaddr.IPv4Address, ipaddr.IPv6Address)):
+        if not ((self.addressClass is ipaddr.IPv4Address) or
+                (self.addressClass is ipaddr.IPv6Address)):
             self.addressClass = ipaddr.IPv4Address
         self.filters = list()
         self.transports = list()





More information about the tor-commits mailing list