From a63d93ba443b9aaaabb5ecf985144197fc80aafb Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 11 May 2016 11:25:15 +0200 Subject: [PATCH] constructor fix --- include/pybind11/common.h | 1 + include/pybind11/numpy.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/pybind11/common.h b/include/pybind11/common.h index 19f1f3092..401a84bad 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -201,6 +201,7 @@ struct buffer_info { std::vector shape; // Shape of the tensor (1 entry per dimension) std::vector strides; // Number of entries between adjacent entries (for each per dimension) + buffer_info() : ptr(nullptr), view(nullptr) {} buffer_info(void *ptr, size_t itemsize, const std::string &format, int ndim, const std::vector &shape, const std::vector &strides) : ptr(ptr), itemsize(itemsize), size(1), format(format), diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index eb4ee606e..0b0e0eef6 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -128,6 +128,7 @@ template class array_t : public array { public: PYBIND11_OBJECT_CVT(array_t, array, is_non_null, m_ptr = ensure(m_ptr)); array_t() : array() { } + array_t(const buffer_info& info) : array(info) {} static bool is_non_null(PyObject *ptr) { return ptr != nullptr; } static PyObject *ensure(PyObject *ptr) { if (ptr == nullptr)