From b204f2f5d9d94110691a465f0c8ad736a6118de2 Mon Sep 17 00:00:00 2001 From: David Halter Date: Wed, 10 Oct 2012 23:10:25 +0200 Subject: [PATCH] fixed edge cases of dynamic array completion, which led to StopIteration --- jedi/dynamic.py | 3 ++- test/completion/dynamic.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jedi/dynamic.py b/jedi/dynamic.py index 23876c84..fdc4a136 100644 --- a/jedi/dynamic.py +++ b/jedi/dynamic.py @@ -239,8 +239,9 @@ def _check_array_additions(compare_array, module, is_list): for c in calls: call_path = list(c.generate_call_path()) separate_index = call_path.index(add_name) - if not len(call_path) > separate_index + 1: + if add_name == call_path[-1] or separate_index == 0: # this means that there is no execution -> [].append + # or the keyword is at the start -> append() continue backtrack_path = iter(call_path[:separate_index]) diff --git a/test/completion/dynamic.py b/test/completion/dynamic.py index 407273b9..e1be4017 100644 --- a/test/completion/dynamic.py +++ b/test/completion/dynamic.py @@ -383,6 +383,8 @@ first(1.0)[0] def third(): b = [] + b.extend + extend() b.extend(first()) return list(b) #?