On Fri, 2013-04-12 at 17:37 +0100, mark florisson wrote:
> 
> 
> On 12 April 2013 13:20, Matěj Laitl <ma...@laitl.cz> wrote:
>         On 8. 4. 2013 Matěj Laitl wrote:
>         > Hi cython-devel and Mark,
>         > I was getting
>         >
>         > > Fatal Python error: Acquisition count is 0 (line XYZ)
>         >
>         > when I was doing
>         >
>         > > cdef class MemViewContainer:
>         > >     cdef double[:, :] A
>         > >
>         > >     cdef a_method(self):
>         > >         self.A = np.eye(2)
>         > >         some_function(self.A.T)
>         > >         some_function(self.A.T)
>         >
>         > I have found out that it is caused by the self.A.T
>         expression - Cython emits
>         > __PYX_XDEC_MEMVIEW() after the call, but no
>         __PYX_INC_MEMVIEW() before the
>         > call. This doesn't happen if the memoryview is a
>         function-local variable.
>         >
>         > Proper test case is in the pull request [1] along with an
>         ad-hoc patch that
>         > fixes the problem here, but needs review whether it is
>         actually correct. I'd
>         > be very grateful if a fix for this problem could get it into
>         Cython 0.19.
>         >
>         > Cython version: 0.19b1 3a6b9856187d7e490e08
>         >
>         > [1] https://github.com/cython/cython/pull/201
>         
>         
>         Bump. Anything else I can provide to help with getting this
>         fixed in 0.19?
>         
>         Ragards,
>                         Matěj
> 
> Thanks for the bump, I merged it.
> 
> 
> Stefan, do you want to wait with 0.19 for the strides fix? We don't
> know when 0.20 would be, I'd like to give it a go this weekend.

Hey,

if you have started on the strides fix or a PR, give me a ping and I
will have a look at it if you like.

If you still need tests, checking that these arrays work as both C and
F-contiguous should be sufficient (of course numpy does not know about
that yet, unless NPY_RELAXED_STRIDES_CHECKING is set):

max_intp = np.iinfo(np.intp).max # obviously weird stride
a = np.ones((1, 10, 1))
a.strides = (max_intp, a.itemsize, max_intp)

and:
a = np.ones((10, 0, 10))
a.strides = (max_intp,) * 3

Regards,

Sebastian

> _______________________________________________
> 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

Reply via email to