numpy.h: fixed a leak, added some comments to buffer_info
diff --git a/include/pybind11/common.h b/include/pybind11/common.h
index f00f16b..ad55be6 100644
--- a/include/pybind11/common.h
+++ b/include/pybind11/common.h
@@ -143,12 +143,13 @@
/// Information record describing a Python buffer object
struct buffer_info {
- void *ptr;
- size_t itemsize, size;
- std::string format; // for dense contents, this should be set to format_descriptor<T>::value
- int ndim;
- std::vector<size_t> shape;
- std::vector<size_t> strides;
+ void *ptr; // Pointer to the underlying storage
+ size_t itemsize; // Size of individual items in bytes
+ size_t size; // Total number of entries
+ std::string format; // For homogeneous buffers, this should be set to format_descriptor<T>::value
+ int ndim; // Number of dimensions
+ std::vector<size_t> shape; // Shape of the tensor (1 entry per dimension)
+ std::vector<size_t> strides; // Number of entries between adjacent entries (for each per dimension)
buffer_info(void *ptr, size_t itemsize, const std::string &format, int ndim,
const std::vector<size_t> &shape, const std::vector<size_t> &strides)