diff --git a/Misc/NEWS.d/next/Documentation/2023-09-04-16-01-20.gh-issue-107689.LFLFtG.rst b/Misc/NEWS.d/next/Documentation/2023-09-04-16-01-20.gh-issue-107689.LFLFtG.rst new file mode 100644 index 000000000000000..5c60e29bc0b44a3 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-09-04-16-01-20.gh-issue-107689.LFLFtG.rst @@ -0,0 +1 @@ +Added docstrings to abstract ctypes. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index ae49cbf3e57da77..19872f8678f7b0e 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -5545,7 +5545,12 @@ Simple_repr(PyObject *self) static PyType_Slot pycsimple_slots[] = { {Py_tp_repr, &Simple_repr}, - {Py_tp_doc, PyDoc_STR("XXX to be provided")}, + {Py_tp_doc, PyDoc_STR("This non-public class is the base class of all " + "fundamental ctypes data types.\n" + "It contains the common attributes of the fundamental " + "ctypes data types.\n" + "_SimpleCData is a subclass of _CData, so it inherits " + "their methods and attributes.")}, {Py_tp_methods, Simple_methods}, {Py_tp_getset, Simple_getsets}, {Py_tp_init, Simple_init}, @@ -5986,7 +5991,19 @@ Pointer_bool(PyObject *self) } static PyType_Slot pycpointer_slots[] = { - {Py_tp_doc, (void *)PyDoc_STR("XXX to be provided")}, + {Py_tp_doc, (void *)PyDoc_STR( + "Private, abstract base class for pointers.\n" + "\n" + "Concrete pointer types are created by calling POINTER() " + "with the type that will be pointed to; this is done " + "automatically by pointer().\n" + "\n" + "If a pointer points to an array, its elements can be read " + "and written using standard subscript and slice accesses. " + "Pointer objects have no size, so len() will raise " + "TypeError. Negative subscripts will read from the memory " + "before the pointer (as in C), and out-of-range subscripts " + "will probably crash with an access violation (if you’re lucky).")}, {Py_tp_getset, Pointer_getsets}, {Py_tp_init, Pointer_init}, {Py_tp_new, Pointer_new},