2020#include < boost/python.hpp>
2121#include < Eigen/Core>
2222
23+ #include < numpy/numpyconfig.h>
24+ #ifdef NPY_1_8_API_VERSION
25+ #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
26+ #endif
27+
2328#include < numpy/arrayobject.h>
2429#include < iostream>
2530
@@ -137,11 +142,12 @@ namespace eigenpy
137142 EigenFromPy ()
138143 {
139144 bp::converter::registry::push_back
140- (&convertible,&construct,bp::type_id<MatType>());
145+ (reinterpret_cast <void *(*)(_object *)>(&convertible),
146+ &construct,bp::type_id<MatType>());
141147 }
142148
143149 // Determine if obj_ptr can be converted in a Eigenvec
144- static void * convertible (PyObject * obj_ptr)
150+ static void * convertible (PyArrayObject * obj_ptr)
145151 {
146152 typedef typename MatType::Scalar T;
147153
@@ -162,15 +168,18 @@ namespace eigenpy
162168 return 0 ;
163169 }
164170
165- if ((PyArray_ObjectType (obj_ptr, 0 )) != NumpyEquivalentType<T>::type_code)
171+ if ((PyArray_ObjectType (reinterpret_cast <PyObject *>( obj_ptr) , 0 )) != NumpyEquivalentType<T>::type_code)
166172 {
167173#ifndef NDEBUG
168174 std::cerr << " The internal type as no Eigen equivalent." << std::endl;
169175#endif
170176 return 0 ;
171177 }
172-
178+ #ifdef NPY_1_8_API_VERSION
179+ if (!(PyArray_FLAGS (obj_ptr)))
180+ #else
173181 if (!(PyArray_FLAGS (obj_ptr) & NPY_ALIGNED))
182+ #endif
174183 {
175184#ifndef NDEBUG
176185 std::cerr << " NPY non-aligned matrices are not implemented." << std::endl;
0 commit comments