summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Farber <73378227+kostyafarber@users.noreply.github.com>2023-08-10 06:39:14 (GMT)
committerGitHub <noreply@github.com>2023-08-10 06:39:14 (GMT)
commit0f2fb6efb4d5d8ca43a0e779b89a8e805880e09a (patch)
tree6bb6b6c503caeda5fc44f8c63a2dbd799a8e665e
parent4890bfe1f906202ef521ffd327cae36e1afa0873 (diff)
downloadcpython-0f2fb6efb4d5d8ca43a0e779b89a8e805880e09a.zip
cpython-0f2fb6efb4d5d8ca43a0e779b89a8e805880e09a.tar.gz
cpython-0f2fb6efb4d5d8ca43a0e779b89a8e805880e09a.tar.bz2
gh-107689: Add docstring to `ctypes.Array` (#107697)
-rw-r--r--Modules/_ctypes/_ctypes.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9aee37a..dc80291 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4793,6 +4793,16 @@ static PyMappingMethods Array_as_mapping = {
Array_ass_subscript,
};
+PyDoc_STRVAR(array_doc,
+"Abstract base class for arrays.\n"
+"\n"
+"The recommended way to create concrete array types is by multiplying any\n"
+"ctypes data type with a non-negative integer. Alternatively, you can subclass\n"
+"this type and define _length_ and _type_ class variables. Array elements can\n"
+"be read and written using standard subscript and slice accesses for slice\n"
+"reads, the resulting object is not itself an Array."
+);
+
PyTypeObject PyCArray_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_ctypes.Array",
@@ -4813,8 +4823,8 @@ PyTypeObject PyCArray_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
&PyCData_as_buffer, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- PyDoc_STR("XXX to be provided"), /* tp_doc */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ array_doc, /* tp_doc */
(traverseproc)PyCData_traverse, /* tp_traverse */
(inquiry)PyCData_clear, /* tp_clear */
0, /* tp_richcompare */