diff --git a/jedi/inference/compiled/access.py b/jedi/inference/compiled/access.py index 09ed1b64..fcad4887 100644 --- a/jedi/inference/compiled/access.py +++ b/jedi/inference/compiled/access.py @@ -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 ''