[Numpy-discussion] PyArray_SimpleNewFromData segfaults
Tue Oct 6 01:11:19 CDT 2009
On Mon, Oct 5, 2009 at 9:42 PM, Robert Kern <email@example.com> wrote:
> On Mon, Oct 5, 2009 at 23:34, Ondrej Certik <firstname.lastname@example.org> wrote:
>> The only mention of the _import_array() in the documentation that I
>> found is here:
>> but I don't understand what it means ---- do I have to just call
>> _import_array() and then I can use numpy CAPI, or do I also have to
>> define those PY_ARRAY_UNIQUE_SYMBOL etc?
> Not _import_array() but import_array().
> You don't have multiple files, so you only use import_array() and not
> PY_ARRAY_UNIQUE_SYMBOL or NO_IMPORT_ARRAY.
> I'm not really sure what is unclear about the text except that you
> searched for the wrong spelling and found the wrong entry.
Ah, that's the way. I was using _import_array() and that worked, so I
changed that to import_array() and call it just once at the top of the
.pyx file and now everything works very nice.
Indeed, it is well documented in there, I didn't realize it written
one paragraph above it.
Thanks for help, all is fine now. Here is how to use that new code in
hermes1d from C++:
one can now easily decide if to copy or not to copy the data when
constructing the numpy arrays.
More information about the NumPy-Discussion