We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 45f679d commit 01b5b57Copy full SHA for 01b5b57
astroid/interpreter/_import/spec.py
@@ -151,7 +151,13 @@ def find_module(
151
if modname in sys.stdlib_module_names or (
152
processed and processed[0] in sys.stdlib_module_names
153
):
154
- spec = importlib.util.find_spec(".".join((*processed, modname)))
+ 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
161
if (
162
spec
163
and spec.loader # type: ignore[comparison-overlap] # noqa: E501
0 commit comments