[Cython] memoryviews from C arrays

mark florisson markflorisson88 at gmail.com
Wed Nov 23 21:21:17 CET 2011


Hey,

Currently when we want to convert C arrays to memoryview slices we have to
do this:

cdef int array[5][4]
cdef int[:, :] slice = <int[:5, :4]> <int *> array

I'd like to be able to write

cdef int array[5][4]
cdef int[:, :] slice

slice = <int[:, :]> array
# and
slice = array

I think that would be convenient, especially if we later on support
variable sized C arrays. I also changed semantics with the cython.array
callback, so now the data gets deallocated only if cython.array allocated
it itself, otherwise a callback may be registered.

Anyone opposed to the above semantics?

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20111123/42213f88/attachment.html>


More information about the cython-devel mailing list