Don't go crazy with big lists.

This commit is contained in:
Dave Halter
2017-09-07 01:25:49 +02:00
parent a0bf465aee
commit c4601b835f
2 changed files with 10 additions and 0 deletions

View File

@@ -207,6 +207,9 @@ class CompiledObject(Context):
return return
for i, part in enumerate(self.obj): for i, part in enumerate(self.obj):
if i > 20:
# Should not go crazy with large iterators
break
yield LazyKnownContext(create(self.evaluator, part)) yield LazyKnownContext(create(self.evaluator, part))
def py__name__(self): def py__name__(self):

View File

@@ -218,3 +218,10 @@ def test_param_completion():
_assert_interpreter_complete('foo(bar', locals(), ['bar']) _assert_interpreter_complete('foo(bar', locals(), ['bar'])
# TODO we're not yet using the Python3.5 inspect.signature, yet. # TODO we're not yet using the Python3.5 inspect.signature, yet.
assert not jedi.Interpreter('lambd(xyz', [locals()]).completions() assert not jedi.Interpreter('lambd(xyz', [locals()]).completions()
def test_endless_yield():
lst = [1] * 10000
# If iterating over lists it should not be possible to take an extremely
# long time.
_assert_interpreter_complete('list(lst)[9000].rea', locals(), ['real'])