New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid "No such file or directory" if module ancestor doesn't exist #5785

Merged
merged 3 commits into from Oct 13, 2018

Conversation

Projects
None yet
1 participant
@gvanrossum
Copy link
Member

gvanrossum commented Oct 12, 2018

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

This comment has been minimized.

Copy link
Member

gvanrossum commented Oct 13, 2018

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

This comment has been minimized.

Copy link
Member

gvanrossum commented Oct 13, 2018

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

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gvanrossum gvanrossum deleted the gvanrossum:fix-regression branch Oct 13, 2018

gvanrossum added a commit to gvanrossum/mypy that referenced this pull request Oct 13, 2018

gvanrossum added 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