Skip to content

Commit a9c6204

Browse files
committed
[C++] Correct import_array return type
1 parent d70a5dc commit a9c6204

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/details.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ namespace eigenpy
201201
eigenMatrix = numpyMap;
202202
}
203203
};
204-
204+
#define numpy_import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } }
205+
205206
template<typename MatType,typename EigenEquivalentType>
206207
void enableEigenPySpecific()
207208
{
208-
import_array();
209209

210210
#ifdef EIGEN_DONT_VECTORIZE
211211

@@ -217,6 +217,7 @@ namespace eigenpy
217217
boost::python::to_python_converter<MatType,
218218
eigenpy::EigenToPy<MatType,MatType> >();
219219
eigenpy::EigenFromPy<MatType,MatType>();
220+
numpy_import_array();
220221

221222
typedef typename eigenpy::UnalignedEquivalent<MatType>::type MatTypeDontAlign;
222223
#ifndef EIGENPY_ALIGNED

0 commit comments

Comments
 (0)