diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-05-31 19:03:47 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 19:03:47 +1000 |
commit | c936a52a9eb18e302fbd5158da7188f674912530 (patch) | |
tree | ce74f2a73cc4730199dfca39420a5564f36daab7 /synapse/util/caches/treecache.py | |
parent | Merge pull request #3303 from NotAFile/py3-memoryview (diff) | |
download | synapse-c936a52a9eb18e302fbd5158da7188f674912530.tar.xz |
Consistently use six's iteritems and wrap lazy keys/values in list() if they're not meant to be lazy (#3307)
Diffstat (limited to 'synapse/util/caches/treecache.py')
-rw-r--r-- | synapse/util/caches/treecache.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py index fcc341a6b7..dd4c9e6067 100644 --- a/synapse/util/caches/treecache.py +++ b/synapse/util/caches/treecache.py @@ -1,3 +1,5 @@ +from six import itervalues + SENTINEL = object() @@ -49,7 +51,7 @@ class TreeCache(object): if popped is SENTINEL: return default - node_and_keys = zip(nodes, key) + node_and_keys = list(zip(nodes, key)) node_and_keys.reverse() node_and_keys.append((self.root, None)) @@ -76,7 +78,7 @@ def iterate_tree_cache_entry(d): can contain dicts. """ if isinstance(d, dict): - for value_d in d.itervalues(): + for value_d in itervalues(d): for value in iterate_tree_cache_entry(value_d): yield value else: |