Hi, I've got a use case where I'm trying to create a typed memoryview from a raw C pointer. My impression was that this should all be possible without the GIL, but it doesn't seem to be the case. Could anyone help me understand what I'm missing?
I'm getting an error message like:
cdef int[:] _copy_to_mv(int* ptr, size_t n) nogil:
cdef array arr = <int[:n]> ptr
^
------------------------------------------------------------
/Users/ajfriend/.cache/ipython/cython/_cython_magic_cc24b6a67fe400606664b7c5a8b1c440.pyx:5:21: Operation not allowed without gil
Thanks!
A minimal example:

Code:
%%cython
from libc.stdlib cimport calloc, free
from cython.view cimport array
cdef int[:] _copy_to_mv(int* ptr, size_t n) nogil:
cdef array arr = <int[:n]> ptr
arr.callback_free_data = free
return arr
cdef size_t n = 10
cdef int* ptr = <int*> calloc(n, sizeof(int))
_copy_to_mv(ptr, n)