Skip to content

Commit 13a807a

Browse files
authored
gh-107689: add docstrings to abstract classes (#108882)
1 parent 97b5f24 commit 13a807a

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
@@ -5547,7 +5547,12 @@ Simple_repr(PyObject *self)
55475547

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

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

0 commit comments

Comments
 (0)