Kurt Smith wrote: > On Sat, Apr 18, 2009 at 7:57 AM, Dag Sverre Seljebotn > <[email protected]> wrote: >> Dag Sverre Seljebotn wrote: >>> Kurt Smith wrote: >>>> The current numpy_test.pyx file fails for PowerPC macs due to >>>> endianness issues in the dtype. This is a small fix to make it work >>>> (and make all tests pass on my machine). It also adds an explicit >>>> big-endian test to the doctest. >>>> >>>> diff -r fc73225aaea1 tests/run/numpy_test.pyx >>>> --- a/tests/run/numpy_test.pyx Fri Apr 17 09:11:16 2009 +0200 >>>> +++ b/tests/run/numpy_test.pyx Fri Apr 17 15:43:11 2009 -0500 >>>> @@ -132,13 +132,20 @@ >>>> >>> test_recordarray() >>>> >>>> >>> test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\ >>>> - ('a', np.dtype('i,i')),\ >>>> - ('b', np.dtype('i,i'))\ >>>> + ('a', np.dtype('<i,<i')),\ >>>> + ('b', np.dtype('<i,<i'))\ >>>> ]))) >>>> array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))], >>>> dtype=[('a', [('f0', '<i4'), ('f1', '<i4')]), ('b', [('f0', >>>> '<i4'), ('f1', '<i4')])]) >>> Any ideas on why this particular case actually passes on your machine? >>> The Cython code alwayws works with big-endian on your machine, so I >>> wouldn't expect to see ((1, 2), (1, 4)) there, but the byteswapped >>> versions of those numbers... >>> >> Ahh right; the only value read from the input array (in the test >> function) is zero, which is the same in both endians, and you added >> explicit byteswap on the output. > > Sorry -- can't devote the time to address these questions right now > but I'll get to them as soon as I can (Monday?).
I wasn't implying that you should fix this :-) just that the problem is larger than the patch. Actually struct buffer access isn't fully worked out yet (the rudimentary support that is there now was added some months ago and contains some weaknesses). I now actually think some rather involved fixes on "struct packing" (native vs. packed) must be done as well to support most common numpy dtypes; and those are very connected, so may do those at the same time. If you like we can do it together. We'll see; my work on it must happen sporadically over the course of some weeks anyway. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
