Commit 88fff9d1 by Jason Rhinelander Committed by Wenzel Jakob

Change numpy constants to non-deprecated versions

A few of pybind's numpy constants are using the numpy-deprecated names
(without "ARRAY_" in them); updated our names to be consistent with
current numpy code.
parent 7d46c6f6
...@@ -107,11 +107,11 @@ inline numpy_internals& get_numpy_internals() { ...@@ -107,11 +107,11 @@ inline numpy_internals& get_numpy_internals() {
struct npy_api { struct npy_api {
enum constants { enum constants {
NPY_C_CONTIGUOUS_ = 0x0001, NPY_ARRAY_C_CONTIGUOUS_ = 0x0001,
NPY_F_CONTIGUOUS_ = 0x0002, NPY_ARRAY_F_CONTIGUOUS_ = 0x0002,
NPY_ARRAY_OWNDATA_ = 0x0004, NPY_ARRAY_OWNDATA_ = 0x0004,
NPY_ARRAY_FORCECAST_ = 0x0010, NPY_ARRAY_FORCECAST_ = 0x0010,
NPY_ENSURE_ARRAY_ = 0x0040, NPY_ARRAY_ENSUREARRAY_ = 0x0040,
NPY_ARRAY_ALIGNED_ = 0x0100, NPY_ARRAY_ALIGNED_ = 0x0100,
NPY_ARRAY_WRITEABLE_ = 0x0400, NPY_ARRAY_WRITEABLE_ = 0x0400,
NPY_BOOL_ = 0, NPY_BOOL_ = 0,
...@@ -330,8 +330,8 @@ public: ...@@ -330,8 +330,8 @@ public:
PYBIND11_OBJECT_CVT(array, buffer, detail::npy_api::get().PyArray_Check_, raw_array) PYBIND11_OBJECT_CVT(array, buffer, detail::npy_api::get().PyArray_Check_, raw_array)
enum { enum {
c_style = detail::npy_api::NPY_C_CONTIGUOUS_, c_style = detail::npy_api::NPY_ARRAY_C_CONTIGUOUS_,
f_style = detail::npy_api::NPY_F_CONTIGUOUS_, f_style = detail::npy_api::NPY_ARRAY_F_CONTIGUOUS_,
forcecast = detail::npy_api::NPY_ARRAY_FORCECAST_ forcecast = detail::npy_api::NPY_ARRAY_FORCECAST_
}; };
...@@ -568,7 +568,7 @@ protected: ...@@ -568,7 +568,7 @@ protected:
if (ptr == nullptr) if (ptr == nullptr)
return nullptr; return nullptr;
return detail::npy_api::get().PyArray_FromAny_( return detail::npy_api::get().PyArray_FromAny_(
ptr, nullptr, 0, 0, detail::npy_api::NPY_ENSURE_ARRAY_ | ExtraFlags, nullptr); ptr, nullptr, 0, 0, detail::npy_api::NPY_ARRAY_ENSUREARRAY_ | ExtraFlags, nullptr);
} }
}; };
...@@ -654,7 +654,7 @@ protected: ...@@ -654,7 +654,7 @@ protected:
return nullptr; return nullptr;
return detail::npy_api::get().PyArray_FromAny_( return detail::npy_api::get().PyArray_FromAny_(
ptr, dtype::of<T>().release().ptr(), 0, 0, ptr, dtype::of<T>().release().ptr(), 0, 0,
detail::npy_api::NPY_ENSURE_ARRAY_ | ExtraFlags, nullptr); detail::npy_api::NPY_ARRAY_ENSUREARRAY_ | ExtraFlags, nullptr);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment