Commit 13022f1b by Ivan Smirnov

Bugfix: pass struct size as itemsize to descriptor

Without this, partially bound structs will have incorrect itemsize.
parent eeb4c043
...@@ -266,6 +266,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value> ...@@ -266,6 +266,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
args["names"] = names; args["names"] = names;
args["offsets"] = offsets; args["offsets"] = offsets;
args["formats"] = formats; args["formats"] = formats;
args["itemsize"] = int_(sizeof(T));
// This is essentially the same as calling np.dtype() constructor in Python and passing // This is essentially the same as calling np.dtype() constructor in Python and passing
// it a dict of the form {'names': ..., 'formats': ..., 'offsets': ...}. // it a dict of the form {'names': ..., 'formats': ..., 'offsets': ...}.
if (!api.PyArray_DescrConverter_(args.release().ptr(), &dtype_()) || !dtype_()) if (!api.PyArray_DescrConverter_(args.release().ptr(), &dtype_()) || !dtype_())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment