Skip to content

PyPy compatibility - __builtin__ is not iterable #8330

Closed

Description

@mattip

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

Activity

  1. added this to the milestone on Mar 18, 2017
  2. arigo commented on Mar 20, 2017

    @arigo

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

  3. anntzer commented on Mar 21, 2017

    @anntzer
    Contributor

    fixed by #8331.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions