diff --git a/src/utils/gen.py b/src/utils/gen.py index 596d5379e..2065b1b3e 100644 --- a/src/utils/gen.py +++ b/src/utils/gen.py @@ -219,9 +219,9 @@ class IterableMap(object): """Define .items() in a class and subclass this to get the other iters. """ def items(self): - if minisix.PY3 and hasattr(self, 'items'): + if minisix.PY3 and hasattr(self, 'iteritems'): # For old plugins - return getattr(self, 'items')() # avoid 2to3 + return self.iteritems() # avoid 2to3 else: raise NotImplementedError() __iter__ = items diff --git a/src/utils/structures.py b/src/utils/structures.py index f5c12fcd5..70866b194 100644 --- a/src/utils/structures.py +++ b/src/utils/structures.py @@ -381,8 +381,8 @@ class MaxLengthQueue(queue): class TwoWayDictionary(dict): __slots__ = () def __init__(self, seq=(), **kwargs): - if hasattr(seq, 'items'): - seq = seq.items() + if hasattr(seq, 'iteritems'): + seq = seq.iteritems() elif hasattr(seq, 'items'): seq = seq.items() for (key, value) in seq: