https://github.com/python/cpython/commit/13a807afc84909eec3be7656d021d8171af42764
commit: 13a807afc84909eec3be7656d021d8171af42764
branch: main
author: Martin Škopek <[email protected]>
committer: ambv <[email protected]>
date: 2026-10-20T16:22:21-07:00
summary:
gh-107689: add docstrings to abstract classes (#108882)
files:
A Misc/NEWS.d/next/Documentation/2023-09-04-16-01-20.gh-issue-107689.LFLFtG.rst
M Modules/_ctypes/_ctypes.c
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 dc146e41109f80c..39ca44790d4244f 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5547,7 +5547,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},
@@ -5988,7 +5993,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},
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]