diff --git a/include/pybind11/common.h b/include/pybind11/common.h index eff105cfc..32e245b46 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -203,15 +203,15 @@ enum class return_value_policy : uint8_t { /// Information record describing a Python buffer object struct buffer_info { - void *ptr; // Pointer to the underlying storage - size_t itemsize; // Size of individual items in bytes - size_t size; // Total number of entries + void *ptr = nullptr; // Pointer to the underlying storage + size_t itemsize = 0; // Size of individual items in bytes + size_t size = 0; // Total number of entries std::string format; // For homogeneous buffers, this should be set to format_descriptor::format() - size_t ndim; // Number of dimensions + size_t ndim = 0; // Number of dimensions 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(){} buffer_info(void *ptr, size_t itemsize, const std::string &format, size_t ndim, const std::vector &shape, const std::vector &strides)