From 921ab6e39190a9daa1532b87c6a43a853e36c799 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 27 Aug 2018 23:37:20 +0200 Subject: [PATCH] Fix two bugs that were raising exceptions --- jedi/evaluate/context/typing.py | 3 ++- jedi/evaluate/param.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/context/typing.py b/jedi/evaluate/context/typing.py index cc5bc488..4deeff93 100644 --- a/jedi/evaluate/context/typing.py +++ b/jedi/evaluate/context/typing.py @@ -133,7 +133,8 @@ class TypingContextWithIndex(_WithIndexBase): elif string_name == 'Optional': # Optional is basically just saying it's either None or the actual # type. - return ContextSet(self._context) \ + # TODO raise a warning if multiple params are given + return self._execute_annotations_for_all_indexes() \ | ContextSet(builtin_from_name(self.evaluator, u'None')) elif string_name == 'Type': # The type is actually already given in the index_context diff --git a/jedi/evaluate/param.py b/jedi/evaluate/param.py index 8c0368db..37e6fd86 100644 --- a/jedi/evaluate/param.py +++ b/jedi/evaluate/param.py @@ -48,7 +48,7 @@ def get_executed_params(execution_context, var_args): # Default params are part of the context where the function was defined. # This means that they might have access on class variables that the # function itself doesn't have. - default_param_context = execution_context.get_default_param_context() + default_param_context = execution_context.function_context.get_default_param_context() for param in funcdef.get_params(): param_dict[param.name.value] = param