The following code
<code>from cpython.mem cimport PyMem_Malloc
cdef int N = 3
cdef float complex *arr_ptr = <float complex *> PyMem_Malloc(N * N * sizeof(float complex))
cdef float complex[:, ::1] arr = <float complex[:N, :N]> arr_ptr
</code>
<code>from cpython.mem cimport PyMem_Malloc
cdef int N = 3
cdef float complex *arr_ptr = <float complex *> PyMem_Malloc(N * N * sizeof(float complex))
cdef float complex[:, ::1] arr = <float complex[:N, :N]> arr_ptr
</code>
from cpython.mem cimport PyMem_Malloc
cdef int N = 3
cdef float complex *arr_ptr = <float complex *> PyMem_Malloc(N * N * sizeof(float complex))
cdef float complex[:, ::1] arr = <float complex[:N, :N]> arr_ptr
compiles and works as intended. However, my linter marks the two :N in the typecast in the last line with the following error message:
Axis specification only allowed in the “step” slot for memory view Cython
I’m wondering whether I’m actually doing something I shouldn’t be doing, or if I can ignore the message?
Several discussions on here suggest that the way I’m initializing my array is fine. I couldn’t find more information on this issue here on in the Cython doc.