[Numpy-discussion] c api, ndarray creation
Sergey Petrov
qweqwegod at yahoo.com
Tue Nov 5 13:10:22 EST 2013
Rather stupid question here, but I can't figure out by myself:
Why does the following c program segfaults? And how can I avoid it?
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#include <numpy/arrayobject.h>
int main(int argc, char *argv[])
{
int nd=1;
npy_intp dims[] = {3};
npy_intp data[] = {1,2,3};
PyObject* array = PyArray_SimpleNewFromData(nd, dims, NPY_INT, (void*)
data);
return 0;
}
More information about the NumPy-Discussion
mailing list