[Cython] BUG: assignment to typed memoryview

Sturla Molden sturla at molden.no
Wed Dec 4 12:55:21 CET 2013


On 26 Nov 2013, at 16:18, Daniele Nicolodi <daniele at grinta.net> wrote:

> Hello,
> 
> I believe there is a bug in how assignment to typed memoryviews is
> handled in the compiler.  I think the following code should be valid code:
> 
>  cdef double[::1] a = np.arange(10, dtype=np.double)
>  cdef double[::1] b = np.empty(a.size // 2)
>  b[:] = a[::2]
> 


Then you are wrong. This should not be valid code. You have declared b to be contiguous, a[::2] is a discontiguous slice. Thus a[::2] cannot be assigned to b.



Sturla



More information about the cython-devel mailing list