Skip to content

Commit fbc8ff0

Browse files
committed
fix regression from #15347
1 parent ac79825 commit fbc8ff0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mypy/modulefinder.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,14 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult:
553553
return ancestor
554554

555555
if approved_stub_package_exists(id):
556-
return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
557-
elif found_possible_third_party_missing_type_hints:
556+
if len(components) == 1 or (
557+
self.find_module(components[0])
558+
is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
559+
):
560+
return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED
561+
if found_possible_third_party_missing_type_hints:
558562
return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS
559-
else:
560-
return ModuleNotFoundReason.NOT_FOUND
563+
return ModuleNotFoundReason.NOT_FOUND
561564

562565
def find_modules_recursive(self, module: str) -> list[BuildSource]:
563566
module_path = self.find_module(module, fast_path=True)

0 commit comments

Comments
 (0)