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.parser_utils import get_flow_branch_keyword, is_scope, get_parent_scope
|
||||||
|
from jedi.evaluate.recursion import execution_allowed
|
||||||
|
|
||||||
|
|
||||||
class Status(object):
|
class Status(object):
|
||||||
@@ -104,9 +105,13 @@ def _break_check(context, context_scope, flow_scope, node):
|
|||||||
|
|
||||||
|
|
||||||
def _check_if(context, node):
|
def _check_if(context, node):
|
||||||
types = context.eval_node(node)
|
with execution_allowed(context.evaluator, node) as allowed:
|
||||||
values = set(x.py__bool__() for x in types)
|
if not allowed:
|
||||||
if len(values) == 1:
|
return UNSURE
|
||||||
return Status.lookup_table[values.pop()]
|
|
||||||
else:
|
types = context.eval_node(node)
|
||||||
return UNSURE
|
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