[Cython] "relaxed_strides" test broken with NumPy 1.8

Sebastian Berg sebastian at sipsolutions.net
Sun Jan 19 00:41:26 CET 2014


On Sun, 2014-01-05 at 09:26 +0100, Stefan Behnel wrote:
> 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.
> 

I didn't really follow this (only saw it now). Just to add...

Numpy 1.7. does not have relaxed strides. However, in some cases 1.8.
strides checks are more strict (and consistent) when not compiled with
relaxed strides. So it is plausible that the tests simply run into one
of those cases, maybe it even just doesn't matter if a test is
unnecessarily skipped in 1.7...

- Sebastian


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




More information about the cython-devel mailing list