Skip to content

gh-107659: Add docstring for ctypes.POINTER & ctypes.ARRAY #107739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ addressof(cdata)
pointer(cdata)

POINTER(ctype)
- This factory function creates and returns a new ctypes pointer type.


bytes(cdata)
- return the buffer contents as a sequence of bytes (which is currently a string)
Expand Down Expand Up @@ -4793,6 +4795,14 @@ static PyMappingMethods Array_as_mapping = {
Array_ass_subscript,
};

PyDoc_STRVAR(array_doc,
"Abstract base class for arrays.\n"
"\n"
"The recommended way to create \n"
"concrete array types is by multiplying \n"
"any ctypes data type with a non-negative \n"
"integer.\n");

PyTypeObject PyCArray_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_ctypes.Array",
Expand All @@ -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 */
Expand Down