From 8f7d45117e278768d733b6a52dd49031eb5f50f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lum=C3=ADr=20=27Frenzy=27=20Balhar?= Date: Thu, 5 Aug 2021 08:24:35 +0200 Subject: [PATCH] inspect now raises OSError for objects without source file CPython issue: https://bugs.python.org/issue44648 --- jedi/inference/compiled/mixed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jedi/inference/compiled/mixed.py b/jedi/inference/compiled/mixed.py index 43e0ed6c..b323d70e 100644 --- a/jedi/inference/compiled/mixed.py +++ b/jedi/inference/compiled/mixed.py @@ -187,7 +187,7 @@ def _find_syntax_node_name(inference_state, python_object): try: python_object = _get_object_to_check(python_object) path = inspect.getsourcefile(python_object) - except TypeError: + except (OSError, TypeError): # The type might not be known (e.g. class_with_dict.__weakref__) return None path = None if path is None else Path(path) -- 2.31.1