diff --git a/jedi/inference/compiled/mixed.py b/jedi/inference/compiled/mixed.py index ef82a574..43e0ed6c 100644 --- a/jedi/inference/compiled/mixed.py +++ b/jedi/inference/compiled/mixed.py @@ -191,8 +191,15 @@ def _find_syntax_node_name(inference_state, python_object): # The type might not be known (e.g. class_with_dict.__weakref__) return None path = None if path is None else Path(path) - if path is None or not path.exists(): - # The path might not exist or be e.g. . + try: + if path is None or not path.exists(): + # The path might not exist or be e.g. . + return None + except OSError: + # Might raise an OSError on Windows: + # + # [WinError 123] The filename, directory name, or volume label + # syntax is incorrect: '' return None file_io = FileIO(path)