// compile and link:
// - regular:
// g++ -std=c++11 -fPIC -I/usr/include/python3.10/ -I/usr/lib/python3/dist-packages/numpy/core/include/ -I.. ../sf.cpp -lpython3.10
// - debug:
// g++ -g -std=c++11 -fPIC -I/usr/include/python3.10d/ -I/usr/lib/python3/dist-packages/numpy/core/include/ -I.. ../sf.cpp -lpython3.10d
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/ndarrayobject.h>
int main()
{
auto* dims = new npy_intp[2];
dims[0] = 3;
dims[1] = 4;
PyObject* pyarray = PyArray_SimpleNew(2, dims, NPY_DOUBLE);
}
segfaults in PyArray_SimpleNew
. gdb yields no clue. What's wrong?