diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 1046cd43e..423403dd8 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -266,6 +266,7 @@ struct npy_format_descriptor::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_())