Skip to content

Commit

Permalink
Avoid "No such file or directory" if module ancestor doesn't exist (p…
Browse files Browse the repository at this point in the history
…ython#5785)

Fixes python#5784. The fix just adds an `isdir()` call.
  • Loading branch information
gvanrossum authored and Guido van Rossum committed Oct 13, 2018
1 parent bd1098a commit 825fbc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _update_ns_ancestors(self, components: List[str], match: Tuple[str, bool]) -
path, verify = match
for i in range(1, len(components)):
pkg_id = '.'.join(components[:-i])
if pkg_id not in self.ns_ancestors:
if pkg_id not in self.ns_ancestors and self.fscache.isdir(path):
self.ns_ancestors[pkg_id] = path
path = os.path.dirname(path)

Expand Down

0 comments on commit 825fbc3

Please sign in to comment.