2121
2222#if defined _WIN32 || defined __CYGWIN__
2323 #define EIGENPY_GET_PY_ARRAY_TYPE (array ) \
24- call_PyArray_ObjectType ( reinterpret_cast <PyObject *>( array), 0)
24+ call_PyArray_MinScalarType ( array)->type_num
2525#else
2626 #define EIGENPY_GET_PY_ARRAY_TYPE (array ) \
27- PyArray_ObjectType ( reinterpret_cast <PyObject *>( array), 0)
27+ PyArray_MinScalarType ( array)->type_num
2828#endif
2929
3030namespace eigenpy
@@ -51,6 +51,10 @@ namespace eigenpy
5151 EIGENPY_DLLAPI void call_PyArray_InitArrFuncs (PyArray_ArrFuncs * funcs);
5252
5353 EIGENPY_DLLAPI int call_PyArray_RegisterDataType (PyArray_Descr * dtype);
54+
55+ EIGENPY_DLLAPI int call_PyArray_RegisterCanCast (PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar);
56+
57+ EIGENPY_DLLAPI PyArray_Descr * call_PyArray_MinScalarType (PyArrayObject *arr);
5458}
5559#else
5660 #define call_PyArray_Check (py_obj ) PyArray_Check(py_obj)
@@ -59,8 +63,10 @@ namespace eigenpy
5963 PyArray_New (py_type_ptr,nd,shape,np_type,NULL ,data_ptr,0 ,options,NULL )
6064 #define getPyArrayType () &PyArray_Type
6165 #define call_PyArray_DescrFromType (typenum) PyArray_DescrFromType(typenum)
66+ #define call_PyArray_MinScalarType (py_arr) PyArray_MinScalarType(py_arr)
6267 #define call_PyArray_InitArrFuncs (funcs) PyArray_InitArrFuncs(funcs)
63- #define call_PyArray_RegisterDataType (dtype) PyArray_RegisterDataType(dtype)
68+ #define call_PyArray_RegisterDataType (dtype) PyArray_RegisterDataType(dtype)
69+ #define call_PyArray_RegisterCanCast (descr,totype,scalar) PyArray_RegisterCanCast(descr,totype,scalar)
6470#endif
6571
6672#endif // ifndef __eigenpy_numpy_hpp__
0 commit comments