Skip to content

Commit 01b5b57

Browse files
committed
Try another fix
1 parent 45f679d commit 01b5b57

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

astroid/interpreter/_import/spec.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ def find_module(
151151
if modname in sys.stdlib_module_names or (
152152
processed and processed[0] in sys.stdlib_module_names
153153
):
154-
spec = importlib.util.find_spec(".".join((*processed, modname)))
154+
try:
155+
spec = importlib.util.find_spec(".".join((*processed, modname)))
156+
except ValueError:
157+
# `find_spec` raises a ValueError for modules that are missing their `__spec__`
158+
# attributes. We don't really understand why, but this is likely caused by
159+
# us re-implementing the import behaviour but not correctly.
160+
spec = None
155161
if (
156162
spec
157163
and spec.loader # type: ignore[comparison-overlap] # noqa: E501

0 commit comments

Comments
 (0)