From b773887585001d789f4a3a3b570b0f902b5d3007 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Thu, 24 Oct 2024 22:43:40 -0700 Subject: [PATCH] fix regression from #15347 --- mypy/modulefinder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index fee484ae02fb..5adb7c059e07 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -553,7 +553,11 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult: return ancestor if approved_stub_package_exists(id): - return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED + if len(components) == 1 or ( + self.find_module(components[0]) + is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED + ): + return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED elif found_possible_third_party_missing_type_hints: return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS else: