Skip to content

Commit

Permalink
Accept dimension mismatch for empty arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jkseppan committed Sep 21, 2015
1 parent 724cb9b commit 2f29bdf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/numpy_cpp.h
Expand Up @@ -447,6 +447,10 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
return 1;
}
}
if (PyArray_NDIM(tmp) > 0 && PyArray_DIM(tmp, 0) == 0) {
// accept dimension mismatch for empty arrays
return 1;
}
if (PyArray_NDIM(tmp) != ND) {
PyErr_Format(PyExc_ValueError,
"Expected %d-dimensional array, got %d",
Expand Down

0 comments on commit 2f29bdf

Please sign in to comment.