[NumPy-Tickets] [NumPy] #1649: Strange array behavior in numpy c extension
NumPy Trac
numpy-tickets@scipy....
Mon Oct 25 09:35:34 CDT 2010
#1649: Strange array behavior in numpy c extension
-------------------------------+--------------------------------------------
Reporter: c00kiemonster | Owner: rgommers
Type: defect | Status: new
Priority: normal | Milestone: 2.0.0
Component: Official binaries | Version: 1.5.0
Keywords: |
-------------------------------+--------------------------------------------
I don't know whether I have made some very trivial mistake here, but I
think there is something fishy going on in this particular example of
mine.
I have attached four files:
C_arraytest.h
setup.py
tests.py
weird.c
I am basically making some numpy c extensions, as described on this page
(http://www.scipy.org/Cookbook/C_Extensions/NumPy_arrays). In this very
simple example of mine I have included a c extension that returns the same
1d array that it has been given as a parameter (ie a new array, but
identical in size and data). Everything works as expected, at least until
i feed it with a 1d array that has come from slicing a column from a 2d
array. In that case it doesn't return the expected values, instead it
seems to be taking the values from the original 2d array. I think this has
something to do with the way the pointer is iterating through the data of
the 2d array and not the sliced out 1d array. Feel free to compile the c
extension (weird.c) and run the tests.py script to replicate the behavior.
I don't really know if this is a bug, but it took me a very long time to
weed this particular behavior out (the script in which I found the issue
is very much larger) so I thought I'd let you guys know in case there is
some bug hidden in there.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1649>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list