[tor-commits] [stem/master] Fixing python 2.6 compatability issue with lru_cache

atagar at torproject.org atagar at torproject.org
Sun Oct 13 00:21:32 UTC 2013


commit c10eef255f0948bcc3cd86eab4221e2b335615eb
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Oct 12 17:13:56 2013 -0700

    Fixing python 2.6 compatability issue with lru_cache
    
    The recepie is using set syntax only available in python 2.7 and above...
    
    Traceback (most recent call last):
      File "./run_tests.py", line 18, in <module>
        import stem.prereq
      File "/home/atagar/Desktop/stem/stem/__init__.py", line 420, in <module>
        import stem.util.enum
      File "/home/atagar/Desktop/stem/stem/util/enum.py", line 43, in <module>
        import stem.util.str_tools
      File "/home/atagar/Desktop/stem/stem/util/str_tools.py", line 21, in <module>
        import stem.prereq
      File "/home/atagar/Desktop/stem/stem/prereq.py", line 29, in <module>
        from stem.util.lru_cache import lru_cache
      File "/home/atagar/Desktop/stem/stem/util/lru_cache.py", line 37
        fasttypes = {int, str, frozenset, type(None)},
                        ^
    SyntaxError: invalid syntax
---
 stem/util/lru_cache.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/util/lru_cache.py b/stem/util/lru_cache.py
index a0b8f1b..f1e427c 100644
--- a/stem/util/lru_cache.py
+++ b/stem/util/lru_cache.py
@@ -34,7 +34,7 @@ class _HashedSeq(list):
 
 def _make_key(args, kwds, typed,
               kwd_mark = (object(),),
-              fasttypes = {int, str, frozenset, type(None)},
+              fasttypes = set([int, str, frozenset, type(None)]),
               sorted=sorted, tuple=tuple, type=type, len=len):
     'Make a cache key from optionally typed positional and keyword arguments'
     key = args



More information about the tor-commits mailing list