[Cython] "relaxed_strides" test broken with NumPy 1.8

Stefan Behnel stefan_ml at behnel.de
Sun Jan 5 09:26:51 CET 2014


Stefan Behnel, 05.01.2014 09:03:
> Nathaniel Smith, 05.01.2014 02:07:
>> On 4 Jan 2014 22:01, "Stefan Behnel" wrote:
>>> Stefan Behnel, 04.01.2014 22:51:
>>>> Stefan Behnel, 04.01.2014 22:47:
>>>>> Nathaniel Smith, 04.01.2014 18:36:
>>>>>>
>>>>>> if not np.ones((10, 1), order="C").flags.f_contiguous:
>>>>>>   # numpy without relaxed stride support
>>>>>>   raise SkipTest
>>>>>
>>>>> https://github.com/cython/cython/commit/e1982505564125714d2010391eecfb8de61626fa
>>>>
>>>> Hmm, but this doesn't seem to work for me in older NumPy versions, although
>>>> the original test used to work there. Should we explicitly test for NumPy
>>>> 1.8+ as well?
>>>
>>> https://github.com/cython/cython/commit/a95d8f912c995300a13fc244ee71bc277668cb9a
>>
>> No, I'm missing something now; AFAIK there are only two numpy behaviors:
>> with relaxed strides and without relaxed strides, and version number should
>> be irrelevant beyond that. What's different between
>> 1.8-without-relaxed-strides and 1.7 that makes the test break?
> 
> Mark would certainly know better than me.
> 
> In any case, the test works with both NumPy 1.7 (tested with Py 2.x and
> 3.[12] on Jenkins) and NumPy 1.8 with relaxed strides support, but not with
> NumPy 1.8 without relaxed strides. The last two were tested in Py3.3 only,
> in case that matters. I also tested it locally now (in 3.3) and your
> snippet successfully distinguishes the two builds for me, but the test
> starts to fail when I disable relaxed strides in NumPy and works when it's
> enabled.

I should add that this

	np.ones((10, 1), order="C").flags.f_contiguous

returns False on NumPy 1.7 and only True on 1.8 with relaxed strides, thus
the additional version test for <1.8.

Stefan



More information about the cython-devel mailing list