mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 01:15:52 +00:00
Bugfix: pass struct size as itemsize to descriptor
Without this, partially bound structs will have incorrect itemsize.
This commit is contained in:
parent
eeb4c043f9
commit
13022f1b8c
@ -266,6 +266,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
|
||||
args["names"] = names;
|
||||
args["offsets"] = offsets;
|
||||
args["formats"] = formats;
|
||||
args["itemsize"] = int_(sizeof(T));
|
||||
// This is essentially the same as calling np.dtype() constructor in Python and passing
|
||||
// it a dict of the form {'names': ..., 'formats': ..., 'offsets': ...}.
|
||||
if (!api.PyArray_DescrConverter_(args.release().ptr(), &dtype_()) || !dtype_())
|
||||
|
Loading…
Reference in New Issue
Block a user