Change array's writeable exception to a ValueError

Numpy raises ValueError when attempting to modify an array, while
py::array is raising a RuntimeError.  This changes the exception to a
std::domain_error, which gets mapped to the expected ValueError in
python.
This commit is contained in:
Jason Rhinelander
2017-01-20 13:50:07 -05:00
committed by Wenzel Jakob
parent f86dddf7ba
commit fd7517037b
2 changed files with 2 additions and 2 deletions

View File

@@ -536,7 +536,7 @@ protected:
void check_writeable() const {
if (!writeable())
throw std::runtime_error("array is not writeable");
throw std::domain_error("array is not writeable");
}
static std::vector<size_t> default_strides(const std::vector<size_t>& shape, size_t itemsize) {