1
0
forked from VimPlug/jedi

In some very rare cases it was possible to get an interpreter crash because of this bug. Fixes #1087

This commit is contained in:
Dave Halter
2018-04-23 08:56:01 +02:00
parent 0bcd1701f0
commit 4075c384e6
2 changed files with 18 additions and 4 deletions

View File

@@ -166,11 +166,10 @@ def _find_syntax_node_name(evaluator, access_handle):
return None # It's too hard to find lambdas.
# Doesn't always work (e.g. os.stat_result)
try:
names = module_node.get_used_names()[name_str]
except KeyError:
return None
names = module_node.get_used_names().get(name_str, [])
names = [n for n in names if n.is_definition()]
if not names:
return None
try:
code = python_object.__code__

View File

@@ -341,3 +341,18 @@ def test_dir_magic_method():
foo = [c for c in completions if c.name == 'foo'][0]
assert foo._goto_definitions() == []
def test_name_not_findable():
class X():
if 0:
NOT_FINDABLE
def hidden(self):
return
hidden.__name__ = 'NOT_FINDABLE'
setattr(X, 'NOT_FINDABLE', X.hidden)
assert jedi.Interpreter("X.NOT_FINDA", [locals()]).completions()