From 8f2f7cd61cae57680baa3cef2c00c307f51b5146 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Sun, 17 Jul 2016 11:07:49 +0100 Subject: [PATCH] Various cleanup --- 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 b8827c34b..e756db8e2 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -138,21 +138,19 @@ public: // constructor seems to then consume them, so we don't need to strip them ourselves auto numpy_internal = module::import("numpy.core._internal"); auto dtype_from_fmt = (object) numpy_internal.attr("_dtype_from_pep3118"); - auto dtype = dtype_from_fmt(pybind11::str(info.format)); - auto dtype2 = strip_padding_fields(dtype); + auto dtype = strip_padding_fields(dtype_from_fmt(pybind11::str(info.format))); object tmp(api.PyArray_NewFromDescr_( - api.PyArray_Type_, dtype2.release().ptr(), (int) info.ndim, (Py_intptr_t *) &info.shape[0], + api.PyArray_Type_, dtype.release().ptr(), (int) info.ndim, (Py_intptr_t *) &info.shape[0], (Py_intptr_t *) &info.strides[0], info.ptr, 0, nullptr), false); if (!tmp) pybind11_fail("NumPy: unable to create array!"); if (info.ptr) tmp = object(api.PyArray_NewCopy_(tmp.ptr(), -1 /* any order */), false); m_ptr = tmp.release().ptr(); - auto d = (object) this->attr("dtype"); } -// protected: +protected: static API &lookup_api() { static API api = API::lookup(); return api;