1
0
forked from VimPlug/jedi

Fix a python3 issue with py__file__.

This commit is contained in:
Dave Halter
2016-12-03 13:41:55 +01:00
parent f355c04cae
commit 760f900560
2 changed files with 6 additions and 2 deletions

View File

@@ -85,7 +85,10 @@ class CompiledObject(Context):
return bool(self.obj) return bool(self.obj)
def py__file__(self): def py__file__(self):
return self.obj.__file__ try:
return self.obj.__file__
except AttributeError:
return None
def is_class(self): def is_class(self):
return inspect.isclass(self.obj) return inspect.isclass(self.obj)

View File

@@ -26,7 +26,8 @@ py__iter__() Returns a generator of a set of types.
py__class__() Returns the class of an instance. py__class__() Returns the class of an instance.
py__getitem__(index: int/str) Returns a a set of types of the index. py__getitem__(index: int/str) Returns a a set of types of the index.
Can raise an IndexError/KeyError. Can raise an IndexError/KeyError.
py__file__() Only on modules. py__file__() Only on modules. Returns None if does
not exist.
py__package__() Only on modules. For the import system. py__package__() Only on modules. For the import system.
py__path__() Only on modules. For the import system. py__path__() Only on modules. For the import system.
====================================== ======================================== ====================================== ========================================