1
0
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:
Dave Halter
2018-03-04 16:47:01 +01:00
parent a3a39c0757
commit d4af314b65

View File

@@ -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