From f5b166d042b8c1edd9bff6e2f8604e54843d7924 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Tue, 21 Jun 2016 21:03:58 +0100 Subject: [PATCH] Simplify npy_format_descriptor slightly --- include/pybind11/numpy.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 3f538e56..1d957d1a 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -234,14 +234,12 @@ template struct npy_format_descriptor array::API& api = array::lookup_api(); auto args = py::dict(); py::list names { }, offsets { }, formats { }; - std::vector dtypes; for (auto field : fields) { - names.append(py::str(field.name)); - offsets.append(py::int_(field.offset)); if (!field.descr) pybind11_fail("NumPy: unsupported field dtype"); - dtypes.emplace_back(field.descr, true); - formats.append(dtypes.back()); + names.append(py::str(field.name)); + offsets.append(py::int_(field.offset)); + formats.append(object(field.descr, true)); } args["names"] = names; args["offsets"] = offsets;