mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fix crash (only convert __file__ attribute to a Path if it is not None)
This commit is contained in:
@@ -183,10 +183,12 @@ class DirectObjectAccess:
|
||||
|
||||
def py__file__(self) -> Optional[Path]:
|
||||
try:
|
||||
return Path(self._obj.__file__)
|
||||
__file__attribute = self._obj.__file__
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
return Path(__file__attribute) if __file__attribute is not None else None
|
||||
|
||||
def py__doc__(self):
|
||||
return inspect.getdoc(self._obj) or ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user