diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 81e0e5af..c9791d86 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -195,13 +195,12 @@ class Evaluator(object): @recursion.recursion_decorator def eval_statement(self, stmt, seek_name=None): """ - The starting point of the completion. A statement always owns a call list, - which are the calls, that a statement does. - In case multiple names are defined in the statement, `seek_name` returns - the result for this name. + The starting point of the completion. A statement always owns a call + list, which are the calls, that a statement does. In case multiple + names are defined in the statement, `seek_name` returns the result for + this name. :param stmt: A `pr.Statement`. - :param seek_name: A string. """ debug.dbg('eval_statement %s (%s)' % (stmt, seek_name)) expression_list = stmt.expression_list() @@ -389,7 +388,7 @@ class Evaluator(object): pass if isinstance(obj, compiled.PyObject): - return list(obj.execute(params)) + return list(obj.execute(self, params)) elif obj.isinstance(er.Class): # There maybe executions of executions. return [er.Instance(self, obj, params)] diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index 749a781b..112a6141 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -69,7 +69,7 @@ class PyObject(Base): # might not exist sometimes (raises AttributeError) return self._cls().obj.__name__ - def execute(self, params): + def execute(self, evaluator, params): t = self.type() if t == 'class': if not self.instantiated: @@ -77,9 +77,15 @@ class PyObject(Base): elif t == 'def': for name in self._parse_function_doc()[1].split(): try: - yield create(getattr(_builtins, name), builtin, True) + bltn_obj = create(getattr(_builtins, name), builtin, module=builtin) except AttributeError: - pass + continue + else: + if isinstance(bltn_obj, PyObject): + yield bltn_obj + else: + for result in evaluator.execute(bltn_obj, params): + yield result def get_self_attributes(self): return [] # Instance compatibility