[Cython] 2d buffer interface with aligned data

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Wed Jul 18 12:24:41 CEST 2012

If the image will always be 2D, you can add

cdef Py_ssize_t shape[2]

To your cdef class and assign self.shape to the Py_buffer. This is a bit more efficient.

Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Christian Heimes <lists at cheimes.de> wrote:

Am 17.07.2012 22:55, schrieb Christian Heimes:
> Either I'm doing something wrong or I found a Cython bug. I've attached
> two files. The output is unexpected and looks like something is
> accessing uninitialized memory:

For the record:
It's my fault. The shade and stripes Py_ssize_t* arrays can't be local
variables. I've to malloc() two arrays and free() them in
__releasebuffer__(). Cython is so easy to use, it makes me forget all
this little annoying C things.



cython-devel mailing list
cython-devel at python.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20120718/a4c2a427/attachment.html>

More information about the cython-devel mailing list