Release format descriptor args before converting

This commit is contained in:
Ivan Smirnov 2016-06-19 16:04:01 +01:00
parent bb4015ded3
commit f10c84eb9b

View File

@ -244,7 +244,7 @@ template <typename T> struct npy_format_descriptor
args["names"] = names; args["names"] = names;
args["offsets"] = offsets; args["offsets"] = offsets;
args["formats"] = formats; args["formats"] = formats;
if (!api.PyArray_DescrConverter_(args.ptr(), &descr_()) || !descr_()) if (!api.PyArray_DescrConverter_(args.release().ptr(), &descr_()) || !descr_())
pybind11_fail("NumPy: failed to create structured dtype"); pybind11_fail("NumPy: failed to create structured dtype");
auto np = module::import("numpy"); auto np = module::import("numpy");
auto empty = (object) np.attr("empty"); auto empty = (object) np.attr("empty");