forked from VimPlug/jedi
fix getattr/__getattr*__
This commit is contained in:
@@ -414,9 +414,12 @@ def check_getattr(inst, name_str):
|
||||
"""Checks for both __getattr__ and __getattribute__ methods"""
|
||||
result = []
|
||||
# str is important to lose the NamePart!
|
||||
name = pr.Call(str(name_str), pr.Call.STRING, (0, 0), inst)
|
||||
module = builtin.Builtin.scope
|
||||
name = pr.Call(module, str(name_str), pr.Call.STRING, (0, 0), inst)
|
||||
stmt = pr.Statement(module, 'XXX code', [], [], [], [], (0, 0), None)
|
||||
stmt._commands = [name]
|
||||
try:
|
||||
result = inst.execute_subscope_by_name('__getattr__', [name])
|
||||
result = inst.execute_subscope_by_name('__getattr__', [stmt])
|
||||
except KeyError:
|
||||
pass
|
||||
if not result:
|
||||
@@ -425,7 +428,7 @@ def check_getattr(inst, name_str):
|
||||
# could be practical and the jedi would return wrong types. If
|
||||
# you ever have something, let me know!
|
||||
try:
|
||||
result = inst.execute_subscope_by_name('__getattribute__', [name])
|
||||
result = inst.execute_subscope_by_name('__getattribute__', [stmt])
|
||||
except KeyError:
|
||||
pass
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user