From 3f7aa4d3bba7fe928a251897616988ee2d63540e Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Sat, 18 Apr 2020 10:10:06 +0200 Subject: [PATCH] core: rely on getPyType function to get the PyTypeObject related to a Scalar type --- include/eigenpy/eigen-to-python.hpp | 2 +- include/eigenpy/numpy-allocator.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/eigenpy/eigen-to-python.hpp b/include/eigenpy/eigen-to-python.hpp index c2548216..fac25371 100644 --- a/include/eigenpy/eigen-to-python.hpp +++ b/include/eigenpy/eigen-to-python.hpp @@ -25,7 +25,7 @@ namespace boost { namespace python { #ifndef BOOST_PYTHON_NO_PY_SIGNATURES inline PyTypeObject const* - get_pytype()const + get_pytype() const { return converter::registered_pytype<MatrixRef>::get_pytype(); } diff --git a/include/eigenpy/numpy-allocator.hpp b/include/eigenpy/numpy-allocator.hpp index cb834106..a7bdfdd3 100644 --- a/include/eigenpy/numpy-allocator.hpp +++ b/include/eigenpy/numpy-allocator.hpp @@ -42,8 +42,8 @@ namespace eigenpy if(NumpyType::sharedMemory()) { - PyTypeObject * py_type_ptr = &PyArray_Type; - PyArrayObject * pyArray = (PyArrayObject*) call_PyArray_New(py_type_ptr, + PyTypeObject py_type = getPyType<Scalar>(); + PyArrayObject * pyArray = (PyArrayObject*) call_PyArray_New(&py_type, static_cast<int>(nd), shape, NumpyEquivalentType<Scalar>::type_code, @@ -80,8 +80,8 @@ namespace eigenpy if(NumpyType::sharedMemory()) { - PyTypeObject * py_type_ptr = &PyArray_Type; - PyArrayObject * pyArray = (PyArrayObject*) call_PyArray_New(py_type_ptr, + PyTypeObject py_type = getPyType<Scalar>(); + PyArrayObject * pyArray = (PyArrayObject*) call_PyArray_New(&py_type, static_cast<int>(nd), shape, NumpyEquivalentType<Scalar>::type_code, -- GitLab