[tor-commits] [stem/master] Python3 regression when reading descriptors

atagar at torproject.org atagar at torproject.org
Sun Mar 27 20:09:39 UTC 2016


commit a82f7fcfd08174d6edbbb7d120a28ea2d478eea1
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Mar 27 13:08:28 2016 -0700

    Python3 regression when reading descriptors
    
    Oops! Recent commit broke all descriptor parsing for python3, caught by
    toralf...
    
      https://trac.torproject.org/projects/tor/ticket/18658
---
 stem/descriptor/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 65e6ed4..05c6087 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -861,7 +861,7 @@ def _get_descriptor_components(raw_contents, validate, extra_keywords = (), non_
 
     if validate and keyword not in non_ascii_fields:
       try:
-        value.decode('ascii')
+        value.encode('ascii')
       except UnicodeError:
         replaced = ''.join([(char if char in string.printable else '?') for char in value])
         raise ValueError("'%s' line had non-ascii content: %s" % (keyword, replaced))



More information about the tor-commits mailing list