Skip to content

PyPy compatibility - __builtin__ is not iterable #8330

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
mattip opened this issue Mar 18, 2017 · 2 comments
Closed

PyPy compatibility - __builtin__ is not iterable #8330

mattip opened this issue Mar 18, 2017 · 2 comments
Milestone

Comments

@mattip
Copy link
Contributor

mattip commented Mar 18, 2017

On PyPy builtins[key] should be builtins.key, which is also CPython compatible. This is a continuation of the fix(es) in issues #7186, #7272
lib/matplotlib/axes/axes.py line 6105
lib/matplotlib/axes/_axes.py line 6477
range = __builtins__['range'] -> range = __builtins__.range

For reference, this turned up in testing pandas/tests/plotting

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Mar 18, 2017
@arigo
Copy link

arigo commented Mar 20, 2017

Note that it's more complicated. __builtins__ can be a (regular) dictionary or a module object on CPython; on PyPy it is always a module object. It is documented as an internal detail and the proper solution is to not use it. Instead, do import __builtin__; range = __builtin__.range (or, in this case, just from __builtin__ import range).

@anntzer
Copy link
Contributor

anntzer commented Mar 21, 2017

fixed by #8331.

@anntzer anntzer closed this as completed Mar 21, 2017
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

No branches or pull requests

4 participants