From 629b3a1d3a2bd61102c869f5f4f31fd61efc267e Mon Sep 17 00:00:00 2001 From: Anthony Miyaguchi <acmiyaguchi@gmail.com> Date: Sun, 18 Sep 2022 03:46:19 -0700 Subject: [PATCH] Modify stride assertion in `numpy-map.hpp` to be valid for empty vector (#321) * Set stride assert to be less than INT_MAX * Remove extra print calls and flush on print * Revert "Remove extra print calls and flush on print" This reverts commit cc7db3d0fa393611df5f69f7d77f59f803bdff5d. * core: fix assert Co-authored-by: Justin Carpentier <justin.carpentier@inria.fr> --- include/eigenpy/numpy-map.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/eigenpy/numpy-map.hpp b/include/eigenpy/numpy-map.hpp index fbd9bce0..51af11b1 100644 --- a/include/eigenpy/numpy-map.hpp +++ b/include/eigenpy/numpy-map.hpp @@ -157,8 +157,7 @@ struct NumpyMapTraits<MatType, InputScalar, AlignmentValue, Stride, true> { else rowMajor = (PyArray_DIMS(pyArray)[0] > PyArray_DIMS(pyArray)[1]) ? 0 : 1; - assert((PyArray_DIMS(pyArray)[rowMajor] < INT_MAX) && - (PyArray_STRIDE(pyArray, rowMajor))); + assert(PyArray_DIMS(pyArray)[rowMajor] < INT_MAX); const int R = (int)PyArray_DIMS(pyArray)[rowMajor]; const long int itemsize = PyArray_ITEMSIZE(pyArray); const int stride = (int)PyArray_STRIDE(pyArray, rowMajor) / (int)itemsize; -- GitLab