Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f2fb6e

Browse files
authored
gh-107689: Add docstring to ctypes.Array (#107697)
1 parent 4890bfe commit 0f2fb6e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4793,6 +4793,16 @@ static PyMappingMethods Array_as_mapping = {
47934793
Array_ass_subscript,
47944794
};
47954795

4796+
PyDoc_STRVAR(array_doc,
4797+
"Abstract base class for arrays.\n"
4798+
"\n"
4799+
"The recommended way to create concrete array types is by multiplying any\n"
4800+
"ctypes data type with a non-negative integer. Alternatively, you can subclass\n"
4801+
"this type and define _length_ and _type_ class variables. Array elements can\n"
4802+
"be read and written using standard subscript and slice accesses for slice\n"
4803+
"reads, the resulting object is not itself an Array."
4804+
);
4805+
47964806
PyTypeObject PyCArray_Type = {
47974807
PyVarObject_HEAD_INIT(NULL, 0)
47984808
"_ctypes.Array",
@@ -4813,8 +4823,8 @@ PyTypeObject PyCArray_Type = {
48134823
0, /* tp_getattro */
48144824
0, /* tp_setattro */
48154825
&PyCData_as_buffer, /* tp_as_buffer */
4816-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
4817-
PyDoc_STR("XXX to be provided"), /* tp_doc */
4826+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
4827+
array_doc, /* tp_doc */
48184828
(traverseproc)PyCData_traverse, /* tp_traverse */
48194829
(inquiry)PyCData_clear, /* tp_clear */
48204830
0, /* tp_richcompare */

0 commit comments

Comments
 (0)