[Cython] buffer shape incompatible with memoryview shape

mark florisson markflorisson88 at gmail.com
Thu Jun 21 16:24:22 CEST 2012


On 21 June 2012 13:05, Dag Sverre Seljebotn <d.s.seljebotn at astro.uio.no> wrote:
> On 06/21/2012 01:36 PM, Stefan Behnel wrote:
>>
>> Dag Sverre Seljebotn, 21.06.2012 13:10:
>>>
>>> On 06/21/2012 10:59 AM, Stefan Behnel wrote:
>>>>
>>>> I find this worth fixing for 0.17:
>>>>
>>>> http://trac.cython.org/cython_trac/ticket/780
>>>
>>>
>>> I'm not sure about the timeline here.
>>>
>>> The object<->memoryview semantics haven't even been hammered down yet;
>>> does
>>> "mview.customattr" trigger an AttributeError, SyntaxError or fall back to
>>> some underlying object (constructing it if necesarry).
>>>
>>> Until that happens, memoryviews are an experimental feature and present
>>> for
>>> development purposes mostly, so it's not like this is a big bug that
>>> would
>>> bite end-users. Thinking about those semantics is much more important...
>>
>>
>> Absolutely.
>>
>> I ran into this when I gave a Cython+NumPy course and this was the first
>> thing that the attendants tried when I asked them to validate that two
>> input arrays have the same size before adding them. It's the one obvious
>> way to do it, and it fails miserably. I think it should be fixed, and I
>> think it should be fixed soon because it feels really low-level and
>> complicated, especially to new users.
>
>
> Can you clarify a bit -- did you give this course using np.ndarray[double,
> ndim=2], or double[:, :]? They're really very separate under the hood and
> the fix is different.

I think we should support both, although it seems a bit of a shame to
fix something just a while before deprecating it :) Anyway, both fixes
are really straightforward anyway.

> Or, did you actually use object[double, ndim=2] like in the bug report? (Did
> me and Mark get around to propose deprecating this one on the list?)
>
> Dag
>
> _______________________________________________
> 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