Skip to content
Snippets Groups Projects
Unverified Commit 629b3a1d authored by Anthony Miyaguchi's avatar Anthony Miyaguchi Committed by GitHub
Browse files

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 cc7db3d0.

* core: fix assert

Co-authored-by: default avatarJustin Carpentier <justin.carpentier@inria.fr>
parent e491c961
No related branches found
No related tags found
No related merge requests found
Pipeline #22089 passed with warnings
......@@ -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;
......
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