Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

make sure we only perform absolute imports on loading a backend#2335

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 2 commits intomatplotlib:masterfromandreabedini:patch-5
Sep 3, 2013

Conversation

andreabedini
Copy link

Fixes#2309

@andreabedini
Copy link
Author

Travis build failure is unrelated.

@@ -22,7 +22,7 @@ def pylab_setup():
backend_name = backend_name.lower() # until we banish mixed case
backend_name = 'matplotlib.backends.%s'%backend_name.lower()
backend_mod = __import__(backend_name,
globals(),locals(),[backend_name])
globals(),locals(),[backend_name],0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Add a comment explaining the reason for explicitly setting the import to be absolute. Also, I want to make sure that ipython and spyder does not break with this. Then, I want to get this patch merged asap to let it bake and hopefully we can catch anybody else that was depending on relative imports (can't imagine how, but just to be safe).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

well, from line 23 it's clear that backend_name is an absolute module name. the difference relies on how user provided strings are understood. I'll see if I can add a note where this is documented.

@andreabedini
Copy link
Author

The documentation says... ifmy_backend.pyis a matplotlib backend in yourPYTHONPATH ... to me this implies the import is meant to be absolute already.

@mdboom
Copy link
Member

Yeah -- I think absolute has certainly always been theintent, even if not theeffect of the code.

@WeatherGod
Copy link
Member

Certainly... I just want a comment (or something) right there above it to explain the "0" parameter being passed to the__import__ function. It isn't like we use__import__ everyday. Lets imagine an incorrect value was placed there today, with no comment. A year from now, someone comes along and sees what the documentation says, and sees what the import does, and will probably be afraid to fix it because "it was set that way forsome reason, right?"

Maybe it is just me being nuts...

@andreabedini
Copy link
Author

No, you're being perfectly reasonable. I'll write something in. 

Andrea


Sent from Mailbox for iPhone

On Tue, Aug 27, 2013 at 11:52 PM, Benjamin Rootnotifications@github.com
wrote:

Certainly... I just want a comment (or something) right there above it to explain the "0" parameter being passed to the__import__ function. It isn't like we use__import__ everyday. Lets imagine an incorrect value was placed there today, with no comment. A year from now, someone comes along and sees what the documentation says, and sees what the import does, and will probably be afraid to fix it because "it was set that way forsome reason, right?"

Maybe it is just me being nuts...

Reply to this email directly or view it on GitHub:
#2335 (comment)

mdboom added a commit that referenced this pull requestSep 3, 2013
make sure we only perform absolute imports on loading a backend
@mdboommdboom merged commitd0a0100 intomatplotlib:masterSep 3, 2013
mdboom added a commit that referenced this pull requestSep 3, 2013
make sure we only perform absolute imports on loading a backend
@andreabediniandreabedini deleted the patch-5 branchSeptember 3, 2013 22:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

use('module://') directive doesn't work as expected
3 participants
@andreabedini@mdboom@WeatherGod

[8]ページ先頭

©2009-2025 Movatter.jp