Skip to content

Commit e9cd323

Browse files
[3.15] gh-107689: add docstrings to abstract classes (GH-108882) (#159988)
gh-107689: add docstrings to abstract classes (GH-108882) (cherry picked from commit 13a807a) Co-authored-by: Martin Škopek <kiblik1@gmail.com>
1 parent 041150c commit e9cd323

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added docstrings to abstract ctypes.

‎Modules/_ctypes/_ctypes.c‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5546,7 +5546,12 @@ Simple_repr(PyObject *self)
55465546

55475547
static PyType_Slot pycsimple_slots[] = {
55485548
{Py_tp_repr, &Simple_repr},
5549-
{Py_tp_doc, PyDoc_STR("XXX to be provided")},
5549+
{Py_tp_doc, PyDoc_STR("This non-public class is the base class of all "
5550+
"fundamental ctypes data types.\n"
5551+
"It contains the common attributes of the fundamental "
5552+
"ctypes data types.\n"
5553+
"_SimpleCData is a subclass of _CData, so it inherits "
5554+
"their methods and attributes.")},
55505555
{Py_tp_methods, Simple_methods},
55515556
{Py_tp_getset, Simple_getsets},
55525557
{Py_tp_init, Simple_init},
@@ -5987,7 +5992,19 @@ Pointer_bool(PyObject *self)
59875992
}
59885993

59895994
static PyType_Slot pycpointer_slots[] = {
5990-
{Py_tp_doc, (void *)PyDoc_STR("XXX to be provided")},
5995+
{Py_tp_doc, (void *)PyDoc_STR(
5996+
"Private, abstract base class for pointers.\n"
5997+
"\n"
5998+
"Concrete pointer types are created by calling POINTER() "
5999+
"with the type that will be pointed to; this is done "
6000+
"automatically by pointer().\n"
6001+
"\n"
6002+
"If a pointer points to an array, its elements can be read "
6003+
"and written using standard subscript and slice accesses. "
6004+
"Pointer objects have no size, so len() will raise "
6005+
"TypeError. Negative subscripts will read from the memory "
6006+
"before the pointer (as in C), and out-of-range subscripts "
6007+
"will probably crash with an access violation (if you’re lucky).")},
59916008
{Py_tp_getset, Pointer_getsets},
59926009
{Py_tp_init, Pointer_init},
59936010
{Py_tp_new, Pointer_new},

0 commit comments

Comments
 (0)