8000 fix __builtins__ for better compatibility by zjjott · Pull Request #7187 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

fix __builtins__ for better compatibility #7187

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

Closed
wants to merge 1 commit into from

Conversation

zjjott
Copy link
@zjjott zjjott commented Sep 27, 2016

issue #7186
Maybe I fix it or maybe it's no an error.....(:з」∠)

@zjjott
Copy link
Author
zjjott commented Sep 27, 2016

AttributeError: 'dict' object has no attribute 'bytes'
wtf....why __builtins__ is dict?

@Kojoley
Copy link
Member
Kojoley commented Sep 27, 2016

wtf....why __builtins__ is dict?

https://docs.python.org/2/reference/executionmodel.html

CPython implementation detail: Users should not touch __builtins__; it is strictly an implementation detail. Users wanting to override values in the builtins namespace should import the __builtin__ (no ‘s’) module and modify its attributes appropriately.

I agree that we need a fix, but then we should use __builtin__/builtins module.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Sep 27, 2016
@zjjott
Copy link
Author
zjjott commented Sep 28, 2016

thanks~ @Kojoley

By default, when in the main module, builtins is the built-in module builtin (note: no ‘s’); when in any other module, builtins is an alias for the dictionary of the builtin module itself. builtins can be set to a user-created dictionary to create a weak form of restricted execution.

looks like __main__ module or other module have diffence __builtins__ and type,I'll close this PR

@anntzer
Copy link
Contributor
anntzer commented Oct 4, 2016

This should probably be

from six.moves import builtins
bytes = builtins.bytes

(feel free to re-close this if you want to make a separate PR).

@anntzer anntzer reopened this Oct 4, 2016
anntzer added a commit to anntzer/matplotlib that referenced this pull request Oct 15, 2016
Also smuggled in some minor reformattings.

Fixes matplotlib#7186.  Supersedes matplotlib#7187 (see discussion there).
@Kojoley
Copy link
Member
Kojoley commented Oct 15, 2016

Fixed by #7272

@Kojoley Kojoley closed this Oct 15, 2016
@Kojoley Kojoley removed this from the 2.0.1 (next bug fix release) milestone Oct 15, 2016
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.

5 participants
0