[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Fixing python 3 issue concerning exit policy compression
commit 208c03cded57507f835265d7e4d2b4677d0e30e5
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Oct 12 20:07:52 2013 -0700
Fixing python 3 issue concerning exit policy compression
Oops, forgot about the byte vs unicode differences when doing compression for
the ExitPolicy.
---
stem/exit_policy.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/stem/exit_policy.py b/stem/exit_policy.py
index a358908..9c60bda 100644
--- a/stem/exit_policy.py
+++ b/stem/exit_policy.py
@@ -300,13 +300,16 @@ class ExitPolicy(object):
rules = []
is_all_accept, is_all_reject = True, True
- if isinstance(self._input_rules, str):
- decompressed_rules = zlib.decompress(self._input_rules).split(',')
+ if isinstance(self._input_rules, bytes):
+ decompressed_rules = zlib.decompress(self._input_rules).split(b',')
else:
decompressed_rules = self._input_rules
for rule in decompressed_rules:
- if isinstance(rule, (bytes, unicode)):
+ if isinstance(rule, bytes):
+ rule = stem.util.str_tools._to_unicode(rule)
+
+ if isinstance(rule, unicode):
rule = ExitPolicyRule(rule.strip())
if rule.is_accept:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits