[tor-commits] [stem/master] FallbackDirectory unicode normalization issue for python3
atagar at torproject.org
atagar at torproject.org
Tue Feb 23 16:56:21 UTC 2016
commit a6aca45c3dbc543f4023818e6f77b7d61e4221e3
Author: Damian Johnson <atagar at torproject.org>
Date: Tue Feb 23 08:56:39 2016 -0800
FallbackDirectory unicode normalization issue for python3
Need to normalize so both python2 and python3 are happy...
======================================================================
ERROR: test_fallback_directories_from_remote
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "/home/atagar/Desktop/stem/test/unit/descriptor/remote.py", line 193, in test_fallback_directories_from_remote
fallback_directories = stem.descriptor.remote.FallbackDirectory.from_remote()
File "/home/atagar/Desktop/stem/stem/descriptor/remote.py", line 949, in from_remote
elif line.startswith('"'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
----------------------------------------------------------------------
Ran 6 tests in 0.018s
---
stem/descriptor/remote.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index f96d6a7..6739df5 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -94,7 +94,7 @@ except ImportError:
import stem.descriptor
from stem import Flag
-from stem.util import connection, log, tor_tools
+from stem.util import connection, log, str_tools, tor_tools
# Tor has a limited number of descriptors we can fetch explicitly by their
# fingerprint or hashes due to a limit on the url length by squid proxies.
@@ -924,7 +924,7 @@ class FallbackDirectory(Directory):
"""
try:
- fallback_dir_page = urllib.urlopen(GITWEB_FALLBACK_DIR_URL, timeout = timeout).read()
+ fallback_dir_page = str_tools._to_unicode(urllib.urlopen(GITWEB_FALLBACK_DIR_URL, timeout = timeout).read())
except:
exc = sys.exc_info()[1]
raise IOError("Unable to download tor's fallback directories from %s: %s" % (GITWEB_FALLBACK_DIR_URL, exc))
More information about the tor-commits
mailing list