1
0
forked from VimPlug/jedi

Fix an issue around __dir__ in the interpreter

Fixes #1027.
This commit is contained in:
Dave Halter
2018-03-12 01:46:12 +01:00
parent e0c682977c
commit 5c1d979522
2 changed files with 28 additions and 3 deletions
+4 -3
View File
@@ -305,20 +305,21 @@ class CompiledObjectFilter(AbstractFilter):
name,
lambda: self._compiled_object.access_handle.is_allowed_getattr(name),
lambda: self._compiled_object.access_handle.dir(),
check_has_attribute=True
)
def _get(self, name, allowed_getattr_callback, dir_callback):
def _get(self, name, allowed_getattr_callback, dir_callback, check_has_attribute=False):
"""
To remove quite a few access calls we introduced the callback here.
"""
has_attribute, is_descriptor = allowed_getattr_callback()
if not has_attribute:
if check_has_attribute and not has_attribute:
return []
# Always use unicode objects in Python 2 from here.
name = force_unicode(name)
if is_descriptor:
if is_descriptor or not has_attribute:
return [self._get_cached_name(name, is_empty=True)]
if self._is_instance and name not in dir_callback():