PyPy compatibility - __builtin__ is not iterable #8330

Closed
mattip opened this Issue Mar 18, 2017 · 2 comments

Comments

Projects
None yet
4 participants

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

arigo commented Mar 20, 2017 • edited

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).

Contributor

anntzer commented Mar 21, 2017

fixed by #8331.

anntzer closed this Mar 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment