Skip to content

MemoryView implementation incompatible with Options.cache_builtins = False #3406

Description

@thirtythreeforty

Disabling the cache_builtins option in setup.py:

Options.cache_builtins = False

causes code that uses MemoryView to fail to compile:

Error compiling Cython file:
------------------------------------------------------------
...
    if not is_slice:

        if start < 0:
            start += shape
        if not 0 <= start < shape:
            _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
                    ^
------------------------------------------------------------

View.MemoryView:832:21: Accessing Python global or builtin not allowed without gil

(There are several such errors building the file, all stemming from doing a lookup on the exception type without the GIL held.)

To fix this, the GIL should be locked before calling _err_dim.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions