Skip to content
Snippets Groups Projects
Verified Commit b2eca85f authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: fix call to PyArray_Check

parent 4e82e8b5
No related branches found
No related tags found
No related merge requests found
...@@ -285,7 +285,7 @@ namespace eigenpy ...@@ -285,7 +285,7 @@ namespace eigenpy
template<typename MatType> template<typename MatType>
void* EigenFromPy<MatType>::convertible(PyArrayObject* pyArray) void* EigenFromPy<MatType>::convertible(PyArrayObject* pyArray)
{ {
if(!PyArray_Check(pyArray)) if(!call_PyArray_Check(pyArray))
return 0; return 0;
if(!np_type_is_convertible_into_scalar<Scalar>(EIGENPY_GET_PY_ARRAY_TYPE(pyArray))) if(!np_type_is_convertible_into_scalar<Scalar>(EIGENPY_GET_PY_ARRAY_TYPE(pyArray)))
...@@ -476,7 +476,7 @@ namespace eigenpy ...@@ -476,7 +476,7 @@ namespace eigenpy
/// \brief Determine if pyObj can be converted into a MatType object /// \brief Determine if pyObj can be converted into a MatType object
static void* convertible(PyArrayObject * pyArray) static void* convertible(PyArrayObject * pyArray)
{ {
if(!PyArray_Check(pyArray)) if(!call_PyArray_Check(pyArray))
return 0; return 0;
if(!PyArray_ISWRITEABLE(pyArray)) if(!PyArray_ISWRITEABLE(pyArray))
return 0; return 0;
......
...@@ -37,6 +37,8 @@ namespace eigenpy ...@@ -37,6 +37,8 @@ namespace eigenpy
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
namespace eigenpy namespace eigenpy
{ {
EIGENPY_DLLEXPORT bool call_PyArray_Check(PyObject *);
EIGENPY_DLLEXPORT PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type); EIGENPY_DLLEXPORT PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type);
EIGENPY_DLLEXPORT PyObject* call_PyArray_New(PyTypeObject * py_type_ptr, int nd, npy_intp * shape, int np_type, void * data_ptr, int options); EIGENPY_DLLEXPORT PyObject* call_PyArray_New(PyTypeObject * py_type_ptr, int nd, npy_intp * shape, int np_type, void * data_ptr, int options);
...@@ -52,6 +54,7 @@ namespace eigenpy ...@@ -52,6 +54,7 @@ namespace eigenpy
EIGENPY_DLLEXPORT int call_PyArray_RegisterDataType(PyArray_Descr * dtype); EIGENPY_DLLEXPORT int call_PyArray_RegisterDataType(PyArray_Descr * dtype);
} }
#else #else
#define call_PyArray_Check(py_obj) PyArray_Check(py_obj)
#define call_PyArray_SimpleNew PyArray_SimpleNew #define call_PyArray_SimpleNew PyArray_SimpleNew
#define call_PyArray_New(py_type_ptr,nd,shape,np_type,data_ptr,options) \ #define call_PyArray_New(py_type_ptr,nd,shape,np_type,data_ptr,options) \
PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL) PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL)
......
...@@ -22,6 +22,11 @@ namespace eigenpy ...@@ -22,6 +22,11 @@ namespace eigenpy
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
bool call_PyArray_Check(PyObject * py_obj)
{
return PyArray_Check(py_obj);
}
PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type) PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type)
{ {
return PyArray_SimpleNew(nd,shape,np_type); return PyArray_SimpleNew(nd,shape,np_type);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment