forked from VimPlug/jedi
Fix the recursion error with globals
This generalizes the fix to actually fix a lot of potential recursion issues with if_stmt.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from jedi.parser_utils import get_flow_branch_keyword, is_scope, get_parent_scope
|
||||
from jedi.evaluate.recursion import execution_allowed
|
||||
|
||||
|
||||
class Status(object):
|
||||
@@ -104,9 +105,13 @@ def _break_check(context, context_scope, flow_scope, node):
|
||||
|
||||
|
||||
def _check_if(context, node):
|
||||
types = context.eval_node(node)
|
||||
values = set(x.py__bool__() for x in types)
|
||||
if len(values) == 1:
|
||||
return Status.lookup_table[values.pop()]
|
||||
else:
|
||||
return UNSURE
|
||||
with execution_allowed(context.evaluator, node) as allowed:
|
||||
if not allowed:
|
||||
return UNSURE
|
||||
|
||||
types = context.eval_node(node)
|
||||
values = set(x.py__bool__() for x in types)
|
||||
if len(values) == 1:
|
||||
return Status.lookup_table[values.pop()]
|
||||
else:
|
||||
return UNSURE
|
||||
|
||||
Reference in New Issue
Block a user