forked from VimPlug/jedi
A property can raise an Exception, therefore the interpreter completion should check for those exceptions, fixes #538.
This commit is contained in:
@@ -618,7 +618,7 @@ class Interpreter(Script):
|
|||||||
for n in old:
|
for n in old:
|
||||||
try:
|
try:
|
||||||
namespaces.append(getattr(n, p))
|
namespaces.append(getattr(n, p))
|
||||||
except AttributeError:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
completion_names = []
|
completion_names = []
|
||||||
|
|||||||
@@ -80,3 +80,13 @@ class TestInterpreterAPI(TestCase):
|
|||||||
|
|
||||||
foo = Foo()
|
foo = Foo()
|
||||||
self.check_interpreter_complete('foo[0].', locals(), [])
|
self.check_interpreter_complete('foo[0].', locals(), [])
|
||||||
|
|
||||||
|
def test_property_error(self):
|
||||||
|
class Foo():
|
||||||
|
@property
|
||||||
|
def bar(self):
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
|
foo = Foo()
|
||||||
|
self.check_interpreter_complete('foo.bar', locals(), ['bar'])
|
||||||
|
self.check_interpreter_complete('foo.bar.baz', locals(), [])
|
||||||
|
|||||||
Reference in New Issue
Block a user