Unverified Commit 584dbe32 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #137 from jcarpent/devel

Fix important bug in 1.6.10
parents 7233fade 7631a42f
......@@ -16,6 +16,41 @@
#include "eigenpy/registration.hpp"
#include "eigenpy/map.hpp"
namespace boost { namespace python { namespace converter {
template<class MatType>
struct implicit<Eigen::MatrixBase<MatType>,MatType>
{
typedef Eigen::MatrixBase<MatType> Source;
typedef MatType Target;
static void* convertible(PyObject* obj)
{
// Find a converter which can produce a Source instance from
// obj. The user has told us that Source can be converted to
// Target, and instantiating construct() below, ensures that
// at compile-time.
return implicit_rvalue_convertible_from_python(obj, registered<Source>::converters)
? obj : 0;
}
static void construct(PyObject* obj, rvalue_from_python_stage1_data* data)
{
void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes;
arg_from_python<Source> get_source(obj);
bool convertible = get_source.convertible();
BOOST_VERIFY(convertible);
new (storage) Target(get_source().derived());
// record successful construction
data->convertible = storage;
}
};
}}} // namespace boost::python::converter
#define GET_PY_ARRAY_TYPE(array) PyArray_ObjectType(reinterpret_cast<PyObject *>(array), 0)
namespace eigenpy
......@@ -531,13 +566,13 @@ namespace eigenpy
// Add also conversion to Eigen::MatrixBase<MatType>
typedef Eigen::MatrixBase<MatType> MatTypeBase;
// bp::implicitly_convertible<MatTypeBase,MatType>();
bp::implicitly_convertible<MatType,MatTypeBase>();
bp::implicitly_convertible<MatTypeBase,MatType>();
}
};
#if EIGEN_VERSION_AT_LEAST(3,2,0)
/// Template specialization for Eigen::Ref
// Template specialization for Eigen::Ref
template<typename MatType>
struct EigenFromPyConverter< eigenpy::Ref<MatType> >
{
......
......@@ -55,7 +55,9 @@ SET(PYTHON_FILES
)
FOREACH(python ${PYTHON_FILES})
PYTHON_BUILD(${PROJECT_NAME} ${python})
IF(NOT WIN32)
PYTHON_BUILD(${PROJECT_NAME} ${python})
ENDIF()
INSTALL(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/eigenpy/${python}"
DESTINATION ${${PYWRAP}_INSTALL_DIR})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment