diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 69099b0d3bf9497a9bee1e67bdd7d619873aaa7b..d602c102c7ec5787e889af402060e5d65514ab0d 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -116,18 +116,16 @@ class IterationTransform(Visitor.VisitorTransform): node, dict_obj, keys, values) # enumerate() ? - if iterator.self is None and \ - isinstance(function, ExprNodes.NameNode) and \ + if iterator.self is None and function.is_name and \ function.entry and function.entry.is_builtin and \ function.name == 'enumerate': return self._transform_enumerate_iteration(node, iterator) # range() iteration? if Options.convert_range and node.target.type.is_int: - if iterator.self is None and \ - isinstance(function, ExprNodes.NameNode) and \ - function.entry and function.entry.is_builtin and \ - function.name in ('range', 'xrange'): + if iterator.self is None and function.is_name and \ + function.entry and function.entry.is_builtin and \ + function.name in ('range', 'xrange'): return self._transform_range_iteration(node, iterator) return node