Closed
Description
I have a const memoryview and I am trying to create a non-const memoryview by copying it. Naively I would expect it to be possible. Here is a snippet that reproduces the problem:
import numpy as np
cdef const double[:] ro = np.ones(3)
cdef double[:] rw = ro.copy()
The error I get:
Memoryview 'const double[::1]' not conformable to memoryview 'double[:]'.
If I read the error correctly it seems like ro.copy()
type is still const
.
A bit more context: I am trying out cython 0.28b1 and experimenting with const memoryviews in a scikit-learn context.
Side-comment: it is a slight variation of 6704d23 where instead of creating rw
and then replacing the values by using rw[:] = ...
, I am trying to do it in one line (which feels like the thing you would write in practice).