@@ -2861,11 +2861,21 @@ memory_contiguous(PyMemoryViewObject *self, PyObject *dummy)
28612861 return PyBool_FromLong (MV_ANY_CONTIGUOUS (self -> flags ));
28622862}
28632863
2864+ PyDoc_STRVAR (memory_obj_doc ,
2865+ "The underlying object of the memoryview." );
2866+ PyDoc_STRVAR (memory_nbytes_doc ,
2867+ "The amount of space in bytes that the array would use in\n"
2868+ " a contiguous representation." );
2869+ PyDoc_STRVAR (memory_readonly_doc ,
2870+ "A bool indicating whether the memory is read only." );
2871+ PyDoc_STRVAR (memory_itemsize_doc ,
2872+ "The size in bytes of each element of the memoryview." );
28642873PyDoc_STRVAR (memory_format_doc ,
28652874 "A string containing the format (in struct module style)\n"
28662875 " for each element in the view." );
2867- PyDoc_STRVAR (memory_itemsize_doc ,
2868- "The size in bytes of each element of the memoryview." );
2876+ PyDoc_STRVAR (memory_ndim_doc ,
2877+ "An integer indicating how many dimensions of a multi-dimensional\n"
2878+ " array the memory represents." );
28692879PyDoc_STRVAR (memory_shape_doc ,
28702880 "A tuple of ndim integers giving the shape of the memory\n"
28712881 " as an N-dimensional array." );
@@ -2874,25 +2884,26 @@ PyDoc_STRVAR(memory_strides_doc,
28742884 " each element for each dimension of the array." );
28752885PyDoc_STRVAR (memory_suboffsets_doc ,
28762886 "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." );
2887+ PyDoc_STRVAR (memory_c_contiguous_doc ,
2888+ "A bool indicating whether the memory is C contiguous." );
2889+ PyDoc_STRVAR (memory_f_contiguous_doc ,
2890+ "A bool indicating whether the memory is Fortran contiguous." );
2891+ PyDoc_STRVAR (memory_contiguous_doc ,
2892+ "A bool indicating whether the memory is contiguous." );
28822893
28832894static PyGetSetDef memory_getsetlist [] = {
2884- {"obj" , (getter )memory_obj_get , NULL , NULL },
2885- {"nbytes" , (getter )memory_nbytes_get , NULL , NULL },
2895+ {"obj" , (getter )memory_obj_get , NULL , memory_obj_doc },
2896+ {"nbytes" , (getter )memory_nbytes_get , NULL , memory_nbytes_doc },
28862897 {"readonly" , (getter )memory_readonly_get , NULL , memory_readonly_doc },
28872898 {"itemsize" , (getter )memory_itemsize_get , NULL , memory_itemsize_doc },
28882899 {"format" , (getter )memory_format_get , NULL , memory_format_doc },
28892900 {"ndim" , (getter )memory_ndim_get , NULL , memory_ndim_doc },
28902901 {"shape" , (getter )memory_shape_get , NULL , memory_shape_doc },
28912902 {"strides" , (getter )memory_strides_get , NULL , memory_strides_doc },
28922903 {"suboffsets" , (getter )memory_suboffsets_get , NULL , memory_suboffsets_doc },
2893- {"c_contiguous" , (getter )memory_c_contiguous , NULL , NULL },
2894- {"f_contiguous" , (getter )memory_f_contiguous , NULL , NULL },
2895- {"contiguous" , (getter )memory_contiguous , NULL , NULL },
2904+ {"c_contiguous" , (getter )memory_c_contiguous , NULL , memory_c_contiguous_doc },
2905+ {"f_contiguous" , (getter )memory_f_contiguous , NULL , memory_f_contiguous_doc },
2906+ {"contiguous" , (getter )memory_contiguous , NULL , memory_contiguous_doc },
28962907 {NULL , NULL , NULL , NULL },
28972908};
28982909
@@ -2908,12 +2919,16 @@ PyDoc_STRVAR(memory_tolist_doc,
29082919"M.tolist() -> list\n\
29092920\n\
29102921Return the data in the buffer as a list of elements." );
2922+ PyDoc_STRVAR (memory_cast_doc ,
2923+ "M.cast(format[, shape]) -> memoryview\n\
2924+ \n\
2925+ Cast a memoryview to a new format or shape." );
29112926
29122927static PyMethodDef memory_methods [] = {
29132928 {"release" , (PyCFunction )memory_release , METH_NOARGS , memory_release_doc },
29142929 {"tobytes" , (PyCFunction )memory_tobytes , METH_NOARGS , memory_tobytes_doc },
29152930 {"tolist" , (PyCFunction )memory_tolist , METH_NOARGS , memory_tolist_doc },
2916- {"cast" , (PyCFunction )memory_cast , METH_VARARGS |METH_KEYWORDS , NULL },
2931+ {"cast" , (PyCFunction )memory_cast , METH_VARARGS |METH_KEYWORDS , memory_cast_doc },
29172932 {"__enter__" , memory_enter , METH_NOARGS , NULL },
29182933 {"__exit__" , memory_exit , METH_VARARGS , NULL },
29192934 {NULL , NULL }
0 commit comments