[Cython] test crash in Py3.2 (NumPy/memoryview/refcounting related?)

mark florisson markflorisson88 at gmail.com
Mon Apr 23 10:32:46 CEST 2012

On 23 April 2012 09:23, Stefan Behnel <stefan_ml at behnel.de> wrote:
> mark florisson, 22.04.2012 16:41:
>> On 22 April 2012 15:31, mark florisson wrote:
>>> I think the problem here
>>> is that a single memoryview object is traversed multiple times through
>>> different traverse functions, and that the refcount doesn't match the
>>> number of traverses. Indeed, the refcount is only one, as the actual
>>> count is the acquisition count. So we shouldn't traverse the
>>> memoryview objects in memoryview slices, i.e. not
>>> _memoryviewslice.from_slice.memview. I'll come up with a commit
>>> shortly, would you be willing to test it?
>> A fix is here: https://github.com/markflorisson88/cython/commit/cd32184f3f782b6d7275cf430694b59801ce642a
>> Lets see what jenkins has to say :)
> Seems to like it.
>> BTW, tp_clear calls Py_CLEAR on Py_buffer.obj, shouldn't it call
>> releasebuffer instead?
> Where is that? The memoryview class calls __Pyx_ReleaseBuffer() here.

Yes, but ModuleNode generates a tp_clear for Py_buffer cdef class
attributes that clears Py_buffer.obj, which means a subsequent
__dealloc__ calling release buffer cannot call the release buffer
function on the original object.

> BTW, why are some of the self arguments in MemoryView.pyx explicitly typed
> as "memoryview"?

I suppose because the original code had that before I started, and
then I continued with it a bit for

> Stefan
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel

More information about the cython-devel mailing list