mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 14:29:11 +00:00
array: set exception message on failure
When attempting to get a raw array pointer we return nullptr if given a nullptr, which triggers an error_already_set(), but we haven't set an exception message, which results in "Unknown internal error". Callers that want explicit allowing of a nullptr here already handle it (by clearing the exception after the call).
This commit is contained in:
@@ -264,4 +264,8 @@ test_initializer numpy_array([](py::module &m) {
|
||||
sm.def("array_auxiliaries2", [](py::array_t<double> a) {
|
||||
return auxiliaries(a, a);
|
||||
});
|
||||
|
||||
// Issue #785: Uninformative "Unknown internal error" exception when constructing array from empty object:
|
||||
sm.def("array_fail_test", []() { return py::array(py::object()); });
|
||||
sm.def("array_t_fail_test", []() { return py::array_t<double>(py::object()); });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user