From 3a0ac37ee8b5cc4ba33265f3ca2de6598714c555 Mon Sep 17 00:00:00 2001 From: micbou Date: Fri, 12 Jan 2018 17:33:10 +0100 Subject: [PATCH] Fix error when using generators with variable-length arguments --- jedi/evaluate/arguments.py | 8 +++++++- test/completion/decorators.py | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/jedi/evaluate/arguments.py b/jedi/evaluate/arguments.py index 32b9238c..a0b7d416 100644 --- a/jedi/evaluate/arguments.py +++ b/jedi/evaluate/arguments.py @@ -29,6 +29,8 @@ def try_iter_content(types, depth=0): class AbstractArguments(object): context = None + argument_node = None + trailer = None def eval_argument_clinic(self, parameters): """Uses a list with argument clinic information (see PEP 436).""" @@ -197,7 +199,11 @@ class TreeArguments(AbstractArguments): arguments = param.var_args break - return [arguments.argument_node or arguments.trailer] + if arguments.argument_node: + return [arguments.argument_node] + if arguments.trailer: + return [arguments.trailer] + return [] class ValuesArguments(AbstractArguments): diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 27e455ae..043ed0bf 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -211,6 +211,17 @@ class X(): #? self.x() + +def decorator_var_args(function, *args): + return function(*args) + +@decorator_var_args +def function_var_args(param): + return param + +#? int() +function_var_args(1) + # ----------------- # method decorators # -----------------