Repository navigation
Improve and fix issues with resolve_name; replace __import__ with resolve_name - #4083
Merged
Merged
Conversation
Member
Author
|
It turns out the bug I fixed also affects v1.0.x, so I'm going to split that off to a separate PR and backport it to the 1.0.x branch. |
…mporting a top-level module (like 'numpy') things could go seriously awry with the import system (this itself is a bug in Python 2).
… resolve_name as variable positional arguments
embray
force-pushed
the
utils/resolve-name-import
branch
from
August 17, 2015 21:40
6161143 to
a1a512a
Compare
Member
Author
|
CI info got lost because I rebased the branch, and a new build didn't run due to "skip ci" being in the last commit. However, this was the original (successful) build for this PR: https://travis-ci.org/astropy/astropy/builds/76005979 |
embray
added a commit
that referenced
this pull request
Aug 17, 2015
Improve and fix issues with resolve_name; replace __import__ with resolve_name
dhomeier
pushed a commit
to dhomeier/astropy
that referenced
this pull request
Dec 17, 2015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are many subtleties to using the
__import__builtin, and its behavior can often seem (or actually be) buggy at times on different Python versions. Careless use of__import__can lead to bugs like the one in this build.The
resolve_nameutility attempts to work around those subtleties so that it just works (and is actually more powerful than__import__since it can also resolve objects in modules). So this PR implements a general policy of usingresolve_nameinstead of__import__where appropriate.This also fixed a bug in
resolve_nameitself--another subtle buglet with__import__that occurs on Python 2 that I didn't know about before.