Fix SEGV to create empty shaped numpy array (#1371)

Fix a segfault when creating a 0-dimension, c-strides array.
This commit is contained in:
Naotoshi Seo
2018-05-06 13:59:25 +00:00
committed by Jason Rhinelander
parent 4b874616b2
commit 5ef1af138d
3 changed files with 10 additions and 2 deletions

View File

@@ -102,6 +102,9 @@ TEST_SUBMODULE(numpy_array, sm) {
sm.def("make_f_array", [] { return py::array_t<float>({ 2, 2 }, { 4, 8 }); });
sm.def("make_c_array", [] { return py::array_t<float>({ 2, 2 }, { 8, 4 }); });
// test_empty_shaped_array
sm.def("make_empty_shaped_array", [] { return py::array(py::dtype("f"), {}, {}); });
// test_wrap
sm.def("wrap", [](py::array a) {
return py::array(