Skip to content

Improve and fix issues with resolve_name; replace __import__ with resolve_name - #4083

Merged
embray merged 5 commits into
astropy:masterfrom
embray:utils/resolve-name-import
Aug 17, 2015
Merged

embray merged 5 commits into
astropy:masterfrom
embray:utils/resolve-name-import

Conversation

@embray

@embray embray commented Aug 17, 2015

Copy link
Copy Markdown
Member

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_name utility 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 using resolve_name instead of __import__ where appropriate.

This also fixed a bug in resolve_name itself--another subtle buglet with __import__ that occurs on Python 2 that I didn't know about before.

@embray

embray commented Aug 17, 2015

Copy link
Copy Markdown
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.

@embray

embray commented Aug 17, 2015

Copy link
Copy Markdown
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 embray removed the Bug label Aug 17, 2015
@embray embray added this to the v1.1.0 milestone Aug 17, 2015
embray added a commit that referenced this pull request Aug 17, 2015
Improve and fix issues with resolve_name; replace __import__ with resolve_name
@embray
embray merged commit 65c86d7 into astropy:master Aug 17, 2015
@embray
embray deleted the utils/resolve-name-import branch August 17, 2015 21:47
dhomeier pushed a commit to dhomeier/astropy that referenced this pull request Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant