Ensure that the argument is a NumPy array of the correct dtype (and if not, try to convert it). In case of an error, nullptr is returned and the Python error is cleared.
| 1493 | /// Ensure that the argument is a NumPy array of the correct dtype (and if not, try to convert |
| 1494 | /// it). In case of an error, nullptr is returned and the Python error is cleared. |
| 1495 | static array_t ensure(handle h) { |
| 1496 | auto result = reinterpret_steal<array_t>(raw_array_t(h.ptr())); |
| 1497 | if (!result) { |
| 1498 | PyErr_Clear(); |
| 1499 | } |
| 1500 | return result; |
| 1501 | } |
| 1502 | |
| 1503 | static bool check_(handle h) { |
| 1504 | const auto &api = detail::npy_api::get(); |