0

Visual Studio 2019 (compiling with 2017 64 bit)

This code

... (code before that runs fine)...

PyArrayObject* extents = NULL;
npy_intp extent_dims[] = { 2, 2, 0 };
try {
    extents = (PyArrayObject*)PyArray_SimpleNew(2, extent_dims, PyArray_DOUBLE);
    if (extents == NULL) {
        printf("error \n");
    }
}
catch (...) {
    printf("catch\n");
}
printf("I am here\n");

The statement

extents = (PyArrayObject*)PyArray_SimpleNew(2, extent_dims, PyArray_DOUBLE);

appears to fail silently, exits the Python interpreter. Any ideas?

2
  • I have tried various other numpy calls, all exhibit the same behavior Commented Dec 30, 2021 at 19:55
  • 1
    Does this answer your question? creating numpy array in c extension segfaults. You shold initialize numpy with import_array Commented Dec 30, 2021 at 20:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.