Documentation
The Array class from the ctypes module doesn't have a proper docstring:
fromctypesimportArrayhelp(Array)
>>>HelponclassArrayinmodule_ctypes:
>>>>>>classArray(_CData)
>>>|XXXtobeprovided# !!>>>|
Though the class is documented in the docs so we could just reuse that description.
Feel free to pick up this issue :) If you're new to the C internals, here's a small guide to help you get started:
ctypes.Array is a class implemented in C defined in Modules/_ctypes/_ctypes.c. Here is the current docstring definition:
| Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| PyDoc_STR("XXX to be provided"), /* tp_doc */ |
| (traverseproc)PyCData_traverse, /* tp_traverse */ |
To update the docstring, we could simply change the argument of PyDoc_STR(...) but if the docstring is longer it's better to use PyDoc_STRVAR to create a separate variable with the new docstring:
PyDoc_STRVAR(array_doc,
"Abstract base class for arrays.\n""\n""The recommended way to create ...");
then you substitute it back instead of PyDoc_STR:
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - PyDoc_STR("XXX to be provided"), /* tp_doc */ + array_doc, /* tp_doc */
(traverseproc)PyCData_traverse, To test that it worked, rebuild python and check the docstring ;)
Linked PRs
Documentation
The
Arrayclass from thectypesmodule doesn't have a proper docstring:Though the class is documented in the docs so we could just reuse that description.
Feel free to pick up this issue :) If you're new to the C internals, here's a small guide to help you get started:
ctypes.Arrayis a class implemented in C defined inModules/_ctypes/_ctypes.c. Here is the current docstring definition:cpython/Modules/_ctypes/_ctypes.c
Lines 4816 to 4818 in 71a7c96
To update the docstring, we could simply change the argument of
PyDoc_STR(...)but if the docstring is longer it's better to use PyDoc_STRVAR to create a separate variable with the new docstring:then you substitute it back instead of
PyDoc_STR:To test that it worked, rebuild python and check the docstring ;)
Linked PRs