@@ -2861,27 +2861,58 @@ memory_contiguous(PyMemoryViewObject *self, PyObject *dummy)
28612861 return PyBool_FromLong (MV_ANY_CONTIGUOUS (self -> flags ));
28622862}
28632863
2864+ PyDoc_STRVAR (memory_format_doc ,
2865+ "A string containing the format (in struct module style)\n"
2866+ " for each element in the view." );
2867+ PyDoc_STRVAR (memory_itemsize_doc ,
2868+ "The size in bytes of each element of the memoryview." );
2869+ PyDoc_STRVAR (memory_shape_doc ,
2870+ "A tuple of ndim integers giving the shape of the memory\n"
2871+ " as an N-dimensional array." );
2872+ PyDoc_STRVAR (memory_strides_doc ,
2873+ "A tuple of ndim integers giving the size in bytes to access\n"
2874+ " each element for each dimension of the array." );
2875+ PyDoc_STRVAR (memory_suboffsets_doc ,
2876+ "A tuple of integers used internally for PIL-style arrays." );
2877+ PyDoc_STRVAR (memory_readonly_doc ,
2878+ "A bool indicating whether the memory is read only." );
2879+ PyDoc_STRVAR (memory_ndim_doc ,
2880+ "An integer indicating how many dimensions of a multi-dimensional\n"
2881+ " array the memory represents." );
2882+
28642883static PyGetSetDef memory_getsetlist [] = {
28652884 {"obj" , (getter )memory_obj_get , NULL , NULL },
28662885 {"nbytes" , (getter )memory_nbytes_get , NULL , NULL },
2867- {"readonly" , (getter )memory_readonly_get , NULL , NULL },
2868- {"itemsize" , (getter )memory_itemsize_get , NULL , NULL },
2869- {"format" , (getter )memory_format_get , NULL , NULL },
2870- {"ndim" , (getter )memory_ndim_get , NULL , NULL },
2871- {"shape" , (getter )memory_shape_get , NULL , NULL },
2872- {"strides" , (getter )memory_strides_get , NULL , NULL },
2873- {"suboffsets" , (getter )memory_suboffsets_get , NULL , NULL },
2886+ {"readonly" , (getter )memory_readonly_get , NULL , memory_readonly_doc },
2887+ {"itemsize" , (getter )memory_itemsize_get , NULL , memory_itemsize_doc },
2888+ {"format" , (getter )memory_format_get , NULL , memory_format_doc },
2889+ {"ndim" , (getter )memory_ndim_get , NULL , memory_ndim_doc },
2890+ {"shape" , (getter )memory_shape_get , NULL , memory_shape_doc },
2891+ {"strides" , (getter )memory_strides_get , NULL , memory_strides_doc },
2892+ {"suboffsets" , (getter )memory_suboffsets_get , NULL , memory_suboffsets_doc },
28742893 {"c_contiguous" , (getter )memory_c_contiguous , NULL , NULL },
28752894 {"f_contiguous" , (getter )memory_f_contiguous , NULL , NULL },
28762895 {"contiguous" , (getter )memory_contiguous , NULL , NULL },
28772896 {NULL , NULL , NULL , NULL },
28782897};
28792898
2899+ PyDoc_STRVAR (memory_release_doc ,
2900+ "M.release() -> None\n\
2901+ \n\
2902+ Release the underlying buffer exposed by the memoryview object." );
2903+ PyDoc_STRVAR (memory_tobytes_doc ,
2904+ "M.tobytes() -> bytes\n\
2905+ \n\
2906+ Return the data in the buffer as a byte string." );
2907+ PyDoc_STRVAR (memory_tolist_doc ,
2908+ "M.tolist() -> list\n\
2909+ \n\
2910+ Return the data in the buffer as a list of elements." );
28802911
28812912static PyMethodDef memory_methods [] = {
2882- {"release" , (PyCFunction )memory_release , METH_NOARGS , NULL },
2883- {"tobytes" , (PyCFunction )memory_tobytes , METH_NOARGS , NULL },
2884- {"tolist" , (PyCFunction )memory_tolist , METH_NOARGS , NULL },
2913+ {"release" , (PyCFunction )memory_release , METH_NOARGS , memory_release_doc },
2914+ {"tobytes" , (PyCFunction )memory_tobytes , METH_NOARGS , memory_tobytes_doc },
2915+ {"tolist" , (PyCFunction )memory_tolist , METH_NOARGS , memory_tolist_doc },
28852916 {"cast" , (PyCFunction )memory_cast , METH_VARARGS |METH_KEYWORDS , NULL },
28862917 {"__enter__" , memory_enter , METH_NOARGS , NULL },
28872918 {"__exit__" , memory_exit , METH_VARARGS , NULL },
0 commit comments