mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +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]:
|
def py__file__(self) -> Optional[Path]:
|
||||||
try:
|
try:
|
||||||
return Path(self._obj.__file__)
|
__file__attribute = self._obj.__file__
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
return Path(__file__attribute) if __file__attribute is not None else None
|
||||||
|
|
||||||
def py__doc__(self):
|
def py__doc__(self):
|
||||||
return inspect.getdoc(self._obj) or ''
|
return inspect.getdoc(self._obj) or ''
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user