On 27 June 2012 12:59, Stefan Behnel <stefan...@behnel.de> wrote: > mark florisson, 27.06.2012 11:54: >> if anyone would like to pick up the release for 0.17, I'd be much >> obliged. > > I think I can handle it. :) >
Great, thanks! >> I can't test it right now, but I don't understand the following in the >> release notes (regarding array.array): "Note that only the buffer >> syntax is supported for these arrays. To use memoryviews with them, >> use the buffer syntax to unpack the buffer first.". Why is that, it >> implements __getbuffer__ right? So it shouldn't matter whether you use >> memoryviews or buffer syntax, both use __Pyx_GetBuffer(). > > The problem is that arrayarray.pxd is only used when the exporter is typed. > This means that you can't do this: > > def func(int[:] arr): pass > > func(array.array('i', [1,2,3])) That works for me, as long and array is cimported from cpython (as 'array' or some other name). It will patch __Pyx_GetBuffer with a typecheck and a call to its __getbuffer__ method. > but it will work if func() is defined like this: > > def func(array.array arr): > cdef int[:] view = arr > > I admit that the wording in the release notes is wrong, I wrote it because > I initially thought that you had to do this: > > def func(array.array[int] arr): > cdef int[:] view = arr > > But no, you don't have to use the buffer interface, you just have to type > the variable. I'll update the release notes. > > Works better in Py3, obviously. > > Stefan > _______________________________________________ > cython-devel mailing list > cython-devel@python.org > http://mail.python.org/mailman/listinfo/cython-devel _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel