Skip to content

Commit 102918f

Browse files
authored
Merge pull request #15 from olivier-stasse/devel
This should remove the deprecated messages spanning all over the packages relying on pinocchio and thus on eigenpy.
2 parents d43c336 + 3a48c50 commit 102918f

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/details.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
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;

src/fwd.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#include <boost/python.hpp>
2121
#include <Eigen/Core>
2222

23+
#ifdef NPY_1_8_API_VERSION
24+
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
25+
#endif
26+
2327
namespace eigenpy
2428
{
2529
template<typename D, typename Scalar = typename D::Scalar>

src/map.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ namespace eigenpy
6060

6161
const int R = (int)PyArray_DIMS(pyArray)[0];
6262
const int C = (int)PyArray_DIMS(pyArray)[1];
63-
const int itemsize = PyArray_ITEMSIZE(pyArray);
64-
const int stride1 = (int)PyArray_STRIDE(pyArray, 0) / itemsize;
65-
const int stride2 = (int)PyArray_STRIDE(pyArray, 1) / itemsize;
63+
const long int itemsize = PyArray_ITEMSIZE(pyArray);
64+
const int stride1 = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
65+
const int stride2 = (int)PyArray_STRIDE(pyArray, 1) / (int)itemsize;
6666

6767
if( (MatType::RowsAtCompileTime!=R)
6868
&& (MatType::RowsAtCompileTime!=Eigen::Dynamic) )
@@ -94,8 +94,8 @@ namespace eigenpy
9494
assert( (PyArray_DIMS(pyArray)[rowMajor]< INT_MAX)
9595
&& (PyArray_STRIDE(pyArray, rowMajor) ));
9696
const int R = (int)PyArray_DIMS(pyArray)[rowMajor];
97-
const int itemsize = PyArray_ITEMSIZE(pyArray);
98-
const int stride = (int) PyArray_STRIDE(pyArray, rowMajor) / itemsize;;
97+
const long int itemsize = PyArray_ITEMSIZE(pyArray);
98+
const int stride = (int) PyArray_STRIDE(pyArray, rowMajor) / (int) itemsize;;
9999

100100
if( (MatType::MaxSizeAtCompileTime!=R)
101101
&& (MatType::MaxSizeAtCompileTime!=Eigen::Dynamic) )

0 commit comments

Comments
 (0)