mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-25 20:57:14 +08:00
Fix an issue with the default type of memoize_default nt being a set.
This commit is contained in:
@@ -476,7 +476,7 @@ def check_array_additions(evaluator, array):
|
|||||||
return _check_array_additions(evaluator, array, current_module, is_list)
|
return _check_array_additions(evaluator, array, current_module, is_list)
|
||||||
|
|
||||||
|
|
||||||
@memoize_default([], evaluator_is_first_arg=True)
|
@memoize_default(default=set(), evaluator_is_first_arg=True)
|
||||||
@debug.increase_indent
|
@debug.increase_indent
|
||||||
def _check_array_additions(evaluator, compare_array, module, is_list):
|
def _check_array_additions(evaluator, compare_array, module, is_list):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def recursion_decorator(func):
|
|||||||
rec_detect = evaluator.recursion_detector
|
rec_detect = evaluator.recursion_detector
|
||||||
# print stmt, len(self.node_statements())
|
# print stmt, len(self.node_statements())
|
||||||
if rec_detect.push_stmt(stmt):
|
if rec_detect.push_stmt(stmt):
|
||||||
return []
|
return set()
|
||||||
else:
|
else:
|
||||||
result = func(evaluator, stmt, *args, **kwargs)
|
result = func(evaluator, stmt, *args, **kwargs)
|
||||||
rec_detect.pop_stmt()
|
rec_detect.pop_stmt()
|
||||||
@@ -119,7 +119,7 @@ class ExecutionRecursionDetector(object):
|
|||||||
debug.dbg('Execution recursions: %s', execution, self.recursion_level,
|
debug.dbg('Execution recursions: %s', execution, self.recursion_level,
|
||||||
self.execution_count, len(self.execution_funcs))
|
self.execution_count, len(self.execution_funcs))
|
||||||
if self.check_recursion(execution):
|
if self.check_recursion(execution):
|
||||||
result = []
|
result = set()
|
||||||
else:
|
else:
|
||||||
result = self.func(execution)
|
result = self.func(execution)
|
||||||
self.pop_execution()
|
self.pop_execution()
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ class FunctionExecution(Executed):
|
|||||||
self.children = new_func.children
|
self.children = new_func.children
|
||||||
self.names_dict = new_func.names_dict
|
self.names_dict = new_func.names_dict
|
||||||
|
|
||||||
@memoize_default(default=())
|
@memoize_default(default=set())
|
||||||
@recursion.execution_recursion_decorator
|
@recursion.execution_recursion_decorator
|
||||||
def get_return_types(self, check_yields=False):
|
def get_return_types(self, check_yields=False):
|
||||||
func = self.base
|
func = self.base
|
||||||
@@ -644,6 +644,7 @@ class FunctionExecution(Executed):
|
|||||||
break
|
break
|
||||||
return types
|
return types
|
||||||
|
|
||||||
|
# TODO add execution_recursion_decorator
|
||||||
def get_yield_types(self):
|
def get_yield_types(self):
|
||||||
yields = self.yields
|
yields = self.yields
|
||||||
stopAt = tree.ForStmt, tree.WhileStmt, FunctionExecution
|
stopAt = tree.ForStmt, tree.WhileStmt, FunctionExecution
|
||||||
@@ -679,7 +680,7 @@ class FunctionExecution(Executed):
|
|||||||
yield evaluator.eval_element(yield_.children[1])
|
yield evaluator.eval_element(yield_.children[1])
|
||||||
else:
|
else:
|
||||||
for_types = evaluator.eval_element(for_stmt.get_input_node())
|
for_types = evaluator.eval_element(for_stmt.get_input_node())
|
||||||
ordered = iterable.ordered_elements_of_iterable(evaluator, for_types, [])
|
ordered = iterable.ordered_elements_of_iterable(evaluator, for_types, set())
|
||||||
for index_types in ordered:
|
for index_types in ordered:
|
||||||
dct = {str(for_stmt.children[1]): index_types}
|
dct = {str(for_stmt.children[1]): index_types}
|
||||||
evaluator.predefined_if_name_dict_dict[for_stmt] = dct
|
evaluator.predefined_if_name_dict_dict[for_stmt] = dct
|
||||||
|
|||||||
Reference in New Issue
Block a user