mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
Always pop nodes in recursion detector
This commit is contained in:
@@ -49,6 +49,7 @@ per_function_recursion_limit = 2
|
|||||||
A function may not be executed more than this number of times recursively.
|
A function may not be executed more than this number of times recursively.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class RecursionDetector(object):
|
class RecursionDetector(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pushed_nodes = []
|
self.pushed_nodes = []
|
||||||
@@ -67,8 +68,10 @@ def execution_allowed(evaluator, node):
|
|||||||
node.start_pos)
|
node.start_pos)
|
||||||
yield False
|
yield False
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
pushed_nodes.append(node)
|
pushed_nodes.append(node)
|
||||||
yield True
|
yield True
|
||||||
|
finally:
|
||||||
pushed_nodes.pop()
|
pushed_nodes.pop()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user