Commit 177240cf authored by Alexander Dielen's avatar Alexander Dielen

fixed potentially unsafe copy

parent 0ef632d1
Pipeline #6166 passed with stage
in 1 minute and 9 seconds
......@@ -125,7 +125,7 @@ public:
const Handle hnd(i);
const py::object obj = Mesh::property(prop, hnd);
try {
const auto arr = obj.cast<py::array_t<double> >();
const auto arr = make_c_style(obj.cast<py::array_t<double> >());
if (arr.size() != size) {
throw py::error_already_set();
}
......
......@@ -2,6 +2,8 @@
#define OPENMESH_PYTHON_UTILITIES_HH
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
......@@ -13,4 +15,9 @@ py::capsule free_when_done(dtype *data) {
});
}
template<class dtype>
py::array_t<dtype, py::array::c_style | py::array::forcecast> make_c_style(py::array_t<dtype> _arr) {
return _arr;
}
#endif
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