mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 16:37:13 +00:00
Add empty recarray test, check for calloc fail
This commit is contained in:
parent
f10c84eb9b
commit
2e1565e414
@ -17,3 +17,8 @@ arr = create_rec_simple(3)
|
||||
assert arr.dtype == dtype
|
||||
check_eq(arr, [(False, 0, 0.0), (True, 1, 1.5), (False, 2, 3.0)], dtype)
|
||||
check_eq(arr, [(False, 0, 0.0), (True, 1, 1.5), (False, 2, 3.0)], base_dtype)
|
||||
|
||||
arr = create_rec_simple(0)
|
||||
assert arr.dtype == dtype
|
||||
check_eq(arr, [], dtype)
|
||||
check_eq(arr, [], base_dtype)
|
||||
|
@ -116,6 +116,8 @@ public:
|
||||
auto buf_info = info;
|
||||
if (!buf_info.ptr)
|
||||
buf_info.ptr = std::calloc(info.size, info.itemsize);
|
||||
if (!buf_info.ptr)
|
||||
pybind11_fail("NumPy: failed to allocate memory for buffer");
|
||||
auto view = py::memoryview(buf_info);
|
||||
|
||||
API& api = lookup_api();
|
||||
|
Loading…
Reference in New Issue
Block a user