Skip to content

Commit

Permalink
Only apply to 3.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Dec 23, 2024
1 parent 50916d6 commit 0a5c16b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ def find_module(
if modname in sys.stdlib_module_names or (
processed and processed[0] in sys.stdlib_module_names
):
spec = importlib.util.find_spec(".".join((*processed, modname)))
try:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=Warning)
spec = importlib.util.find_spec(".".join((*processed, modname)))
except ValueError:
# `find_spec` raises a ValueError for modules that are missing their `__spec__`
# attributes. We don't really understand why, but this is likely caused by
# us re-implementing the import behaviour but not correctly.
spec = None
if (
spec
and spec.loader # type: ignore[comparison-overlap] # noqa: E501
Expand Down

0 comments on commit 0a5c16b

Please sign in to comment.