KEMBAR78
Avoid "No such file or directory" if module ancestor doesn't exist by gvanrossum · Pull Request #5785 · python/mypy · GitHub
Skip to content

Conversation

gvanrossum
Copy link
Member

Tentative fix for #5784.

(An alternative fix would be not to add anything to self.ns_ancestors unless self.options.namespace_packages is set.)

@gvanrossum
Copy link
Member Author

Beware: When testing manually, the cache may suppress errors.

@gvanrossum gvanrossum changed the title Only return ns_ancestors in namespace-package mode Avoid "No such file or directory" if module ancestor doesn't exist Oct 13, 2018
@gvanrossum
Copy link
Member Author

I am now sufficiently confident that this version of the fix (which leaves all the original code in place but adds an isdir() check before putting a path in ns_ancestors) is right. I am going to merge this and cherry-pick it into the release-0.641 branch.

(Why am I confident? I added a bunch of print() calls and tested this with the repro from #5784 (import aiohttp), as well as with the tests from #5758 (typedpkg_namespace.alpha), and it gives exactly the expected errors and the output explains why.)

However before I re-cut a release I want #5782 (Refactor testpep561 etc.) to land too. That requires further review. I may or may not merge that into the release-0.641 branch (since I like the idea of having absolutely minimal changes in a "brown bag release" like that).

@gvanrossum gvanrossum merged commit 4acd48e into python:master Oct 13, 2018
@gvanrossum gvanrossum deleted the fix-regression branch October 13, 2018 22:01
gvanrossum added a commit to gvanrossum/mypy that referenced this pull request Oct 13, 2018
gvanrossum pushed a commit that referenced this pull request Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant