1

I have a NumPy array of bools in my code that I wish to write a C extension to. When I try to get a contiguous array in order to use in my C routine, I use:

arr_mask = (PyArrayObject *)
    PyArray_ContiguousFromObject(mask, PyArray_BOOL, 2, 2);

But I get the compiler error that PyArray_BOOL is not declared.

xor_masking.c:44:40: error: ‘PyArray_BOOL’ undeclared (first use in this function)

Why it is so? Is this type undeclared? If it is so, how can I introduce my array of bools to C?

Thanks!

1 Answer 1

1

You need to use NPY_BOOL rather than PyArray_BOOL. Also, you will need to be using the numpy header rather than the numeric header if you are still using the numeric header like in one of your other questions.

Sign up to request clarification or add additional context in comments.

Comments

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.