diff --git a/jedi/evaluate/arguments.py b/jedi/evaluate/arguments.py index 48c0d5e6..0dabb862 100644 --- a/jedi/evaluate/arguments.py +++ b/jedi/evaluate/arguments.py @@ -128,7 +128,6 @@ class TreeArguments(AbstractArguments): arrays = self.context.eval_node(el) iterators = [_iterate_star_args(self.context, a, el, funcdef) for a in arrays] - iterators = list(iterators) for values in list(zip_longest(*iterators)): # TODO zip_longest yields None, that means this would raise # an exception? diff --git a/jedi/evaluate/context/function.py b/jedi/evaluate/context/function.py index ce740bf8..0368ae1c 100644 --- a/jedi/evaluate/context/function.py +++ b/jedi/evaluate/context/function.py @@ -140,7 +140,7 @@ class FunctionExecutionContext(TreeContext): if check_yields: context_set |= ContextSet.from_sets( lazy_context.infer() - for lazy_context in self._eval_yield(r) + for lazy_context in self._get_yield_lazy_context(r) ) else: try: @@ -155,7 +155,7 @@ class FunctionExecutionContext(TreeContext): break return context_set - def _eval_yield(self, yield_expr): + def _get_yield_lazy_context(self, yield_expr): if yield_expr.type == 'keyword': # `yield` just yields None. ctx = compiled.builtin_from_name(self.evaluator, u'None') @@ -171,7 +171,7 @@ class FunctionExecutionContext(TreeContext): yield LazyTreeContext(self, node) @recursion.execution_recursion_decorator(default=iter([])) - def get_yield_values(self): + def get_yield_lazy_contexts(self): for_parents = [(y, tree.search_ancestor(y, 'for_stmt', 'funcdef', 'while_stmt', 'if_stmt')) for y in get_yield_exprs(self.evaluator, self.tree_node)] @@ -204,7 +204,7 @@ class FunctionExecutionContext(TreeContext): if for_stmt is None: # No for_stmt, just normal yields. for yield_ in yields: - for result in self._eval_yield(yield_): + for result in self._get_yield_lazy_context(yield_): yield result else: input_node = for_stmt.get_testlist() @@ -215,7 +215,7 @@ class FunctionExecutionContext(TreeContext): dct = {str(for_stmt.children[1].value): lazy_context.infer()} with helpers.predefine_names(self, for_stmt, dct): for yield_in_same_for_stmt in yields: - for result in self._eval_yield(yield_in_same_for_stmt): + for result in self._get_yield_lazy_context(yield_in_same_for_stmt): yield result def get_filters(self, search_global, until_position=None, origin_scope=None): diff --git a/jedi/evaluate/context/iterable.py b/jedi/evaluate/context/iterable.py index 0f7fcf8b..66d0b968 100644 --- a/jedi/evaluate/context/iterable.py +++ b/jedi/evaluate/context/iterable.py @@ -91,7 +91,7 @@ class Generator(GeneratorMixin, Context): self._func_execution_context = func_execution_context def py__iter__(self): - return self._func_execution_context.get_yield_values() + return self._func_execution_context.get_yield_lazy_contexts() def __repr__(self): return "<%s of %s>" % (type(self).__name__, self._func_execution_context)