8000 Avoid "No such file or directory" if module ancestor doesn't exist (#… · python/mypy@4acd48e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4acd48e

Browse files
authored
Avoid "No such file or directory" if module ancestor doesn't exist (#5785)
Fixes #5784. The fix just adds an `isdir()` call.
1 parent 1e10491 commit 4acd48e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/modulefinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _update_ns_ancestors(self, components: List[str], match: Tuple[str, bool]) -
121121
path, verify = match
122122
for i in range(1, len(components)):
123123
pkg_id = '.'.join(components[:-i])
124-
if pkg_id not in self.ns_ancestors:
124+
if pkg_id not in self.ns_ancestors and self.fscache.isdir(path):
125125
self.ns_ancestors[pkg_id] = path
126126
path = os.path.dirname(path)
127127

0 commit comments

Comments
 (0)
0