From 383c596975008cf2fd9f8f38f7b62e96addc0104 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 19 Jan 2025 23:27:37 +0000 Subject: [PATCH] Fix crash (only convert __file__ attribute to a Path if it is not None) --- jedi/inference/compiled/access.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ''