Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
Documentation
TheArray
class from thectypes
module doesn't have a proper docstring:
fromctypesimportArrayhelp(Array)>>>HelponclassArrayinmodule_ctypes:>>>>>>classArray(_CData)>>>|XXXtobeprovided# !!>>>|
Though the class is documented in thedocs 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 inModules/_ctypes/_ctypes.c
. Here is the current docstring definition:
cpython/Modules/_ctypes/_ctypes.c
Lines 4816 to 4818 in71a7c96
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 ofPyDoc_STR(...)
but if the docstring is longer it's better to usePyDoc_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 ofPyDoc_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 ;)