[tor-commits] [stem/master] TypeError under python3 when using 'use_mirrors = True'

atagar at torproject.org atagar at torproject.org
Thu Sep 17 15:14:01 UTC 2015


commit d7079a71bed67a88e45d72358ca8562899d71582
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Sep 17 08:15:10 2015 -0700

    TypeError under python3 when using 'use_mirrors = True'
    
    Great catch from trodun. Under python3 filter is an iterable rather than
    returning a list, causing random.choice() to balk on us...
    
      https://trac.torproject.org/projects/tor/ticket/17083
---
 docs/change_log.rst       |    1 +
 stem/descriptor/remote.py |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 6de73f4..273dc26 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -57,6 +57,7 @@ The following are only available within Stem's `git repository
   * Server descriptor validation fails with 'extra-info-digest line had an invalid value' from additions in proposal 228 (:trac:`16227`)
   * :class:`~stem.descriptor.server_descriptor.BridgeDescriptor` now has 'ntor_onion_key' like its unsanitized counterparts
   * Replaced the :class:`~stem.descriptor.microdescriptor.Microdescriptor` identifier and identifier_type attributes with an identifiers hash since it can now appear multiple times (:spec:`09ff9e2`)
+  * TypeError under python3 when using 'use_mirrors = True' (:trac:`17083`)
 
  * **Website**
 
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 389182d..fbc9d96 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -344,7 +344,7 @@ class Query(object):
     """
 
     if use_authority or not self.endpoints:
-      authority = random.choice(filter(HAS_V3IDENT, get_authorities().values()))
+      authority = random.choice(list(filter(HAS_V3IDENT, get_authorities().values())))
       address, dirport = authority.address, authority.dir_port
     else:
       address, dirport = random.choice(self.endpoints)



More information about the tor-commits mailing list