mirror of https://github.com/python/cpython
gh-91118: Fix docstrings that do not honor --without-doc-strings (#31769)
Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
328dbc051f
commit
a573cb2fec
|
@ -2597,7 +2597,7 @@ A basic :ref:`static type <static-types>`::
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "mymod.MyObject",
|
.tp_name = "mymod.MyObject",
|
||||||
.tp_basicsize = sizeof(MyObject),
|
.tp_basicsize = sizeof(MyObject),
|
||||||
.tp_doc = "My objects",
|
.tp_doc = PyDoc_STR("My objects"),
|
||||||
.tp_new = myobj_new,
|
.tp_new = myobj_new,
|
||||||
.tp_dealloc = (destructor)myobj_dealloc,
|
.tp_dealloc = (destructor)myobj_dealloc,
|
||||||
.tp_repr = (reprfunc)myobj_repr,
|
.tp_repr = (reprfunc)myobj_repr,
|
||||||
|
@ -2627,7 +2627,7 @@ with a more verbose initializer::
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
0, /* tp_flags */
|
0, /* tp_flags */
|
||||||
"My objects", /* tp_doc */
|
PyDoc_STR("My objects"), /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -2660,7 +2660,7 @@ A type that supports weakrefs, instance dicts, and hashing::
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "mymod.MyObject",
|
.tp_name = "mymod.MyObject",
|
||||||
.tp_basicsize = sizeof(MyObject),
|
.tp_basicsize = sizeof(MyObject),
|
||||||
.tp_doc = "My objects",
|
.tp_doc = PyDoc_STR("My objects"),
|
||||||
.tp_weaklistoffset = offsetof(MyObject, weakreflist),
|
.tp_weaklistoffset = offsetof(MyObject, weakreflist),
|
||||||
.tp_dictoffset = offsetof(MyObject, inst_dict),
|
.tp_dictoffset = offsetof(MyObject, inst_dict),
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
||||||
|
@ -2688,7 +2688,7 @@ to create instances (e.g. uses a separate factory func) using
|
||||||
.tp_name = "mymod.MyStr",
|
.tp_name = "mymod.MyStr",
|
||||||
.tp_basicsize = sizeof(MyStr),
|
.tp_basicsize = sizeof(MyStr),
|
||||||
.tp_base = NULL, // set to &PyUnicode_Type in module init
|
.tp_base = NULL, // set to &PyUnicode_Type in module init
|
||||||
.tp_doc = "my custom str",
|
.tp_doc = PyDoc_STR("my custom str"),
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
||||||
.tp_repr = (reprfunc)myobj_repr,
|
.tp_repr = (reprfunc)myobj_repr,
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,7 +90,7 @@ The second bit is the definition of the type object. ::
|
||||||
static PyTypeObject CustomType = {
|
static PyTypeObject CustomType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "custom.Custom",
|
.tp_name = "custom.Custom",
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
.tp_basicsize = sizeof(CustomObject),
|
.tp_basicsize = sizeof(CustomObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||||
|
@ -161,7 +161,7 @@ you will need to OR the corresponding flags.
|
||||||
|
|
||||||
We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::
|
We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::
|
||||||
|
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
|
|
||||||
To enable object creation, we have to provide a :c:member:`~PyTypeObject.tp_new`
|
To enable object creation, we have to provide a :c:member:`~PyTypeObject.tp_new`
|
||||||
handler. This is the equivalent of the Python method :meth:`__new__`, but
|
handler. This is the equivalent of the Python method :meth:`__new__`, but
|
||||||
|
|
|
@ -9,7 +9,7 @@ typedef struct {
|
||||||
static PyTypeObject CustomType = {
|
static PyTypeObject CustomType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "custom.Custom",
|
.tp_name = "custom.Custom",
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
.tp_basicsize = sizeof(CustomObject),
|
.tp_basicsize = sizeof(CustomObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||||
|
|
|
@ -98,7 +98,7 @@ static PyMethodDef Custom_methods[] = {
|
||||||
static PyTypeObject CustomType = {
|
static PyTypeObject CustomType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "custom2.Custom",
|
.tp_name = "custom2.Custom",
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
.tp_basicsize = sizeof(CustomObject),
|
.tp_basicsize = sizeof(CustomObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||||
|
|
|
@ -148,7 +148,7 @@ static PyMethodDef Custom_methods[] = {
|
||||||
static PyTypeObject CustomType = {
|
static PyTypeObject CustomType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "custom3.Custom",
|
.tp_name = "custom3.Custom",
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
.tp_basicsize = sizeof(CustomObject),
|
.tp_basicsize = sizeof(CustomObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||||
|
|
|
@ -160,7 +160,7 @@ static PyMethodDef Custom_methods[] = {
|
||||||
static PyTypeObject CustomType = {
|
static PyTypeObject CustomType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "custom4.Custom",
|
.tp_name = "custom4.Custom",
|
||||||
.tp_doc = "Custom objects",
|
.tp_doc = PyDoc_STR("Custom objects"),
|
||||||
.tp_basicsize = sizeof(CustomObject),
|
.tp_basicsize = sizeof(CustomObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
||||||
|
|
|
@ -31,7 +31,7 @@ SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)
|
||||||
static PyTypeObject SubListType = {
|
static PyTypeObject SubListType = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "sublist.SubList",
|
.tp_name = "sublist.SubList",
|
||||||
.tp_doc = "SubList objects",
|
.tp_doc = PyDoc_STR("SubList objects"),
|
||||||
.tp_basicsize = sizeof(SubListObject),
|
.tp_basicsize = sizeof(SubListObject),
|
||||||
.tp_itemsize = 0,
|
.tp_itemsize = 0,
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Classes and functions that unconditionally declared their docstrings
|
||||||
|
ignoring the `--without-doc-strings` compilation flag no longer do so.
|
||||||
|
|
||||||
|
The classes affected are :class:`ctypes.UnionType`,
|
||||||
|
:class:`pickle.PickleBuffer`, :class:`testcapi.RecursingInfinitelyError`,
|
||||||
|
and :class:`types.GenericAlias`.
|
||||||
|
|
||||||
|
The functions affected are 24 methods in :mod:`ctypes`.
|
||||||
|
|
||||||
|
Patch by Oleg Iarygin.
|
|
@ -0,0 +1,4 @@
|
||||||
|
All docstrings in code snippets are now wrapped into :func:`PyDoc_STR` to
|
||||||
|
follow the guideline of `PEP 7's Documentation Strings paragraph
|
||||||
|
<https://www.python.org/dev/peps/pep-0007/#documentation-strings>`_. Patch
|
||||||
|
by Oleg Iarygin.
|
|
@ -196,7 +196,7 @@ static PyTypeObject DictRemover_Type = {
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
/* XXX should participate in GC? */
|
/* XXX should participate in GC? */
|
||||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||||
"deletes a key from a dictionary", /* tp_doc */
|
PyDoc_STR("deletes a key from a dictionary"), /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -579,8 +579,8 @@ UnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return StructUnionType_new(type, args, kwds, 0);
|
return StructUnionType_new(type, args, kwds, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char from_address_doc[] =
|
PyDoc_STRVAR(from_address_doc,
|
||||||
"C.from_address(integer) -> C instance\naccess a C instance at the specified address";
|
"C.from_address(integer) -> C instance\naccess a C instance at the specified address");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
CDataType_from_address(PyObject *type, PyObject *value)
|
CDataType_from_address(PyObject *type, PyObject *value)
|
||||||
|
@ -597,8 +597,8 @@ CDataType_from_address(PyObject *type, PyObject *value)
|
||||||
return PyCData_AtAddress(type, buf);
|
return PyCData_AtAddress(type, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char from_buffer_doc[] =
|
PyDoc_STRVAR(from_buffer_doc,
|
||||||
"C.from_buffer(object, offset=0) -> C instance\ncreate a C instance from a writeable buffer";
|
"C.from_buffer(object, offset=0) -> C instance\ncreate a C instance from a writeable buffer");
|
||||||
|
|
||||||
static int
|
static int
|
||||||
KeepRef(CDataObject *target, Py_ssize_t index, PyObject *keep);
|
KeepRef(CDataObject *target, Py_ssize_t index, PyObject *keep);
|
||||||
|
@ -677,8 +677,8 @@ CDataType_from_buffer(PyObject *type, PyObject *args)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char from_buffer_copy_doc[] =
|
PyDoc_STRVAR(from_buffer_copy_doc,
|
||||||
"C.from_buffer_copy(object, offset=0) -> C instance\ncreate a C instance from a readable buffer";
|
"C.from_buffer_copy(object, offset=0) -> C instance\ncreate a C instance from a readable buffer");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
GenericPyCData_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
|
GenericPyCData_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
|
||||||
|
@ -728,8 +728,8 @@ CDataType_from_buffer_copy(PyObject *type, PyObject *args)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char in_dll_doc[] =
|
PyDoc_STRVAR(in_dll_doc,
|
||||||
"C.in_dll(dll, name) -> C instance\naccess a C instance in a dll";
|
"C.in_dll(dll, name) -> C instance\naccess a C instance in a dll");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
CDataType_in_dll(PyObject *type, PyObject *args)
|
CDataType_in_dll(PyObject *type, PyObject *args)
|
||||||
|
@ -790,8 +790,8 @@ CDataType_in_dll(PyObject *type, PyObject *args)
|
||||||
return PyCData_AtAddress(type, address);
|
return PyCData_AtAddress(type, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char from_param_doc[] =
|
PyDoc_STRVAR(from_param_doc,
|
||||||
"Convert a Python object into a function call parameter.";
|
"Convert a Python object into a function call parameter.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
CDataType_from_param(PyObject *type, PyObject *value)
|
CDataType_from_param(PyObject *type, PyObject *value)
|
||||||
|
@ -945,7 +945,7 @@ PyTypeObject PyCStructType_Type = {
|
||||||
PyCStructType_setattro, /* tp_setattro */
|
PyCStructType_setattro, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"metatype for the CData Objects", /* tp_doc */
|
PyDoc_STR("metatype for the CData Objects"), /* tp_doc */
|
||||||
(traverseproc)CDataType_traverse, /* tp_traverse */
|
(traverseproc)CDataType_traverse, /* tp_traverse */
|
||||||
(inquiry)CDataType_clear, /* tp_clear */
|
(inquiry)CDataType_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -987,7 +987,7 @@ static PyTypeObject UnionType_Type = {
|
||||||
UnionType_setattro, /* tp_setattro */
|
UnionType_setattro, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"metatype for the CData Objects", /* tp_doc */
|
PyDoc_STR("metatype for the CData Objects"), /* tp_doc */
|
||||||
(traverseproc)CDataType_traverse, /* tp_traverse */
|
(traverseproc)CDataType_traverse, /* tp_traverse */
|
||||||
(inquiry)CDataType_clear, /* tp_clear */
|
(inquiry)CDataType_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -1245,7 +1245,7 @@ PyTypeObject PyCPointerType_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"metatype for the Pointer Objects", /* tp_doc */
|
PyDoc_STR("metatype for the Pointer Objects"), /* tp_doc */
|
||||||
(traverseproc)CDataType_traverse, /* tp_traverse */
|
(traverseproc)CDataType_traverse, /* tp_traverse */
|
||||||
(inquiry)CDataType_clear, /* tp_clear */
|
(inquiry)CDataType_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -1620,7 +1620,7 @@ PyTypeObject PyCArrayType_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"metatype for the Array Objects", /* tp_doc */
|
PyDoc_STR("metatype for the Array Objects"), /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -2314,7 +2314,7 @@ PyTypeObject PyCSimpleType_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"metatype for the PyCSimpleType Objects", /* tp_doc */
|
PyDoc_STR("metatype for the PyCSimpleType Objects"), /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -2603,7 +2603,7 @@ PyTypeObject PyCFuncPtrType_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"metatype for C function pointers", /* tp_doc */
|
PyDoc_STR("metatype for C function pointers"), /* tp_doc */
|
||||||
(traverseproc)CDataType_traverse, /* tp_traverse */
|
(traverseproc)CDataType_traverse, /* tp_traverse */
|
||||||
(inquiry)CDataType_clear, /* tp_clear */
|
(inquiry)CDataType_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -2908,7 +2908,7 @@ PyTypeObject PyCData_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"XXX to be provided", /* tp_doc */
|
PyDoc_STR("XXX to be provided"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -4306,7 +4306,7 @@ PyTypeObject PyCFuncPtr_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"Function Pointer", /* tp_doc */
|
PyDoc_STR("Function Pointer"), /* tp_doc */
|
||||||
(traverseproc)PyCFuncPtr_traverse, /* tp_traverse */
|
(traverseproc)PyCFuncPtr_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCFuncPtr_clear, /* tp_clear */
|
(inquiry)PyCFuncPtr_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -4458,7 +4458,7 @@ static PyTypeObject Struct_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"Structure base class", /* tp_doc */
|
PyDoc_STR("Structure base class"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -4500,7 +4500,7 @@ static PyTypeObject Union_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"Union base class", /* tp_doc */
|
PyDoc_STR("Union base class"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -4820,7 +4820,7 @@ PyTypeObject PyCArray_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"XXX to be provided", /* tp_doc */
|
PyDoc_STR("XXX to be provided"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -5039,7 +5039,7 @@ static PyTypeObject Simple_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"XXX to be provided", /* tp_doc */
|
PyDoc_STR("XXX to be provided"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -5421,7 +5421,7 @@ PyTypeObject PyCPointer_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
&PyCData_as_buffer, /* tp_as_buffer */
|
&PyCData_as_buffer, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"XXX to be provided", /* tp_doc */
|
PyDoc_STR("XXX to be provided"), /* tp_doc */
|
||||||
(traverseproc)PyCData_traverse, /* tp_traverse */
|
(traverseproc)PyCData_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCData_clear, /* tp_clear */
|
(inquiry)PyCData_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
@ -5448,12 +5448,12 @@ PyTypeObject PyCPointer_Type = {
|
||||||
* Module initialization.
|
* Module initialization.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char module_docs[] =
|
PyDoc_STRVAR(_ctypes__doc__,
|
||||||
"Create and manipulate C compatible data types in Python.";
|
"Create and manipulate C compatible data types in Python.");
|
||||||
|
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
|
|
||||||
static const char comerror_doc[] = "Raised when a COM method call failed.";
|
PyDoc_STRVAR(comerror_doc, "Raised when a COM method call failed.");
|
||||||
|
|
||||||
int
|
int
|
||||||
comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
|
comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
|
@ -5642,7 +5642,7 @@ wstring_at(const wchar_t *ptr, int size)
|
||||||
static struct PyModuleDef _ctypesmodule = {
|
static struct PyModuleDef _ctypesmodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
.m_name = "_ctypes",
|
.m_name = "_ctypes",
|
||||||
.m_doc = module_docs,
|
.m_doc = _ctypes__doc__,
|
||||||
.m_size = -1,
|
.m_size = -1,
|
||||||
.m_methods = _ctypes_module_methods,
|
.m_methods = _ctypes_module_methods,
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,7 +82,7 @@ PyTypeObject PyCThunk_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"CThunkObject", /* tp_doc */
|
PyDoc_STR("CThunkObject"), /* tp_doc */
|
||||||
CThunkObject_traverse, /* tp_traverse */
|
CThunkObject_traverse, /* tp_traverse */
|
||||||
CThunkObject_clear, /* tp_clear */
|
CThunkObject_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
|
|
@ -1307,11 +1307,11 @@ _parse_voidp(PyObject *obj, void **address)
|
||||||
|
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
|
|
||||||
static const char format_error_doc[] =
|
PyDoc_STRVAR(format_error_doc,
|
||||||
"FormatError([integer]) -> string\n\
|
"FormatError([integer]) -> string\n\
|
||||||
\n\
|
\n\
|
||||||
Convert a win32 error code into a string. If the error code is not\n\
|
Convert a win32 error code into a string. If the error code is not\n\
|
||||||
given, the return value of a call to GetLastError() is used.\n";
|
given, the return value of a call to GetLastError() is used.\n");
|
||||||
static PyObject *format_error(PyObject *self, PyObject *args)
|
static PyObject *format_error(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -1331,13 +1331,13 @@ static PyObject *format_error(PyObject *self, PyObject *args)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char load_library_doc[] =
|
PyDoc_STRVAR(load_library_doc,
|
||||||
"LoadLibrary(name, load_flags) -> handle\n\
|
"LoadLibrary(name, load_flags) -> handle\n\
|
||||||
\n\
|
\n\
|
||||||
Load an executable (usually a DLL), and return a handle to it.\n\
|
Load an executable (usually a DLL), and return a handle to it.\n\
|
||||||
The handle may be used to locate exported functions in this\n\
|
The handle may be used to locate exported functions in this\n\
|
||||||
module. load_flags are as defined for LoadLibraryEx in the\n\
|
module. load_flags are as defined for LoadLibraryEx in the\n\
|
||||||
Windows API.\n";
|
Windows API.\n");
|
||||||
static PyObject *load_library(PyObject *self, PyObject *args)
|
static PyObject *load_library(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *nameobj;
|
PyObject *nameobj;
|
||||||
|
@ -1382,10 +1382,10 @@ static PyObject *load_library(PyObject *self, PyObject *args)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char free_library_doc[] =
|
PyDoc_STRVAR(free_library_doc,
|
||||||
"FreeLibrary(handle) -> void\n\
|
"FreeLibrary(handle) -> void\n\
|
||||||
\n\
|
\n\
|
||||||
Free the handle of an executable previously loaded by LoadLibrary.\n";
|
Free the handle of an executable previously loaded by LoadLibrary.\n");
|
||||||
static PyObject *free_library(PyObject *self, PyObject *args)
|
static PyObject *free_library(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
void *hMod;
|
void *hMod;
|
||||||
|
@ -1405,8 +1405,8 @@ static PyObject *free_library(PyObject *self, PyObject *args)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char copy_com_pointer_doc[] =
|
PyDoc_STRVAR(copy_com_pointer_doc,
|
||||||
"CopyComPointer(src, dst) -> HRESULT value\n";
|
"CopyComPointer(src, dst) -> HRESULT value\n");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
copy_com_pointer(PyObject *self, PyObject *args)
|
copy_com_pointer(PyObject *self, PyObject *args)
|
||||||
|
@ -1644,10 +1644,10 @@ call_cdeclfunction(PyObject *self, PyObject *args)
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* functions
|
* functions
|
||||||
*/
|
*/
|
||||||
static const char sizeof_doc[] =
|
PyDoc_STRVAR(sizeof_doc,
|
||||||
"sizeof(C type) -> integer\n"
|
"sizeof(C type) -> integer\n"
|
||||||
"sizeof(C instance) -> integer\n"
|
"sizeof(C instance) -> integer\n"
|
||||||
"Return the size in bytes of a C instance";
|
"Return the size in bytes of a C instance");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
sizeof_func(PyObject *self, PyObject *obj)
|
sizeof_func(PyObject *self, PyObject *obj)
|
||||||
|
@ -1665,10 +1665,10 @@ sizeof_func(PyObject *self, PyObject *obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char alignment_doc[] =
|
PyDoc_STRVAR(alignment_doc,
|
||||||
"alignment(C type) -> integer\n"
|
"alignment(C type) -> integer\n"
|
||||||
"alignment(C instance) -> integer\n"
|
"alignment(C instance) -> integer\n"
|
||||||
"Return the alignment requirements of a C instance";
|
"Return the alignment requirements of a C instance");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
align_func(PyObject *self, PyObject *obj)
|
align_func(PyObject *self, PyObject *obj)
|
||||||
|
@ -1688,10 +1688,10 @@ align_func(PyObject *self, PyObject *obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char byref_doc[] =
|
PyDoc_STRVAR(byref_doc,
|
||||||
"byref(C instance[, offset=0]) -> byref-object\n"
|
"byref(C instance[, offset=0]) -> byref-object\n"
|
||||||
"Return a pointer lookalike to a C instance, only usable\n"
|
"Return a pointer lookalike to a C instance, only usable\n"
|
||||||
"as function argument";
|
"as function argument");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must return something which can be converted to a parameter,
|
* We must return something which can be converted to a parameter,
|
||||||
|
@ -1732,9 +1732,9 @@ byref(PyObject *self, PyObject *args)
|
||||||
return (PyObject *)parg;
|
return (PyObject *)parg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char addressof_doc[] =
|
PyDoc_STRVAR(addressof_doc,
|
||||||
"addressof(C instance) -> integer\n"
|
"addressof(C instance) -> integer\n"
|
||||||
"Return the address of the C instance internal buffer";
|
"Return the address of the C instance internal buffer");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
addressof(PyObject *self, PyObject *obj)
|
addressof(PyObject *self, PyObject *obj)
|
||||||
|
|
|
@ -325,7 +325,7 @@ PyTypeObject PyCField_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
|
||||||
"Structure/Union member", /* tp_doc */
|
PyDoc_STR("Structure/Union member"), /* tp_doc */
|
||||||
(traverseproc)PyCField_traverse, /* tp_traverse */
|
(traverseproc)PyCField_traverse, /* tp_traverse */
|
||||||
(inquiry)PyCField_clear, /* tp_clear */
|
(inquiry)PyCField_clear, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
|
|
@ -6599,7 +6599,7 @@ static PyTypeObject PyRecursingInfinitelyError_Type = {
|
||||||
0, /* tp_setattro */
|
0, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
"Instantiating this exception starts infinite recursion.", /* tp_doc */
|
PyDoc_STR("Instantiating this exception starts infinite recursion."), /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
|
|
|
@ -341,6 +341,11 @@ _Py_subs_parameters(PyObject *self, PyObject *args, PyObject *parameters, PyObje
|
||||||
return newargs;
|
return newargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(genericalias__doc__,
|
||||||
|
"Represent a PEP 585 generic type\n"
|
||||||
|
"\n"
|
||||||
|
"E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
ga_getitem(PyObject *self, PyObject *item)
|
ga_getitem(PyObject *self, PyObject *item)
|
||||||
{
|
{
|
||||||
|
@ -703,14 +708,11 @@ ga_iter(PyObject *self) {
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - argument clinic?
|
// - argument clinic?
|
||||||
// - __doc__?
|
|
||||||
// - cache?
|
// - cache?
|
||||||
PyTypeObject Py_GenericAliasType = {
|
PyTypeObject Py_GenericAliasType = {
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||||
.tp_name = "types.GenericAlias",
|
.tp_name = "types.GenericAlias",
|
||||||
.tp_doc = "Represent a PEP 585 generic type\n"
|
.tp_doc = genericalias__doc__,
|
||||||
"\n"
|
|
||||||
"E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).",
|
|
||||||
.tp_basicsize = sizeof(gaobject),
|
.tp_basicsize = sizeof(gaobject),
|
||||||
.tp_dealloc = ga_dealloc,
|
.tp_dealloc = ga_dealloc,
|
||||||
.tp_repr = ga_repr,
|
.tp_repr = ga_repr,
|
||||||
|
|
|
@ -206,7 +206,7 @@ static PyMethodDef picklebuf_methods[] = {
|
||||||
PyTypeObject PyPickleBuffer_Type = {
|
PyTypeObject PyPickleBuffer_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
.tp_name = "pickle.PickleBuffer",
|
.tp_name = "pickle.PickleBuffer",
|
||||||
.tp_doc = "Wrapper for potentially out-of-band buffers",
|
.tp_doc = PyDoc_STR("Wrapper for potentially out-of-band buffers"),
|
||||||
.tp_basicsize = sizeof(PyPickleBufferObject),
|
.tp_basicsize = sizeof(PyPickleBufferObject),
|
||||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
|
||||||
.tp_new = picklebuf_new,
|
.tp_new = picklebuf_new,
|
||||||
|
|
|
@ -443,9 +443,9 @@ union_getattro(PyObject *self, PyObject *name)
|
||||||
PyTypeObject _PyUnion_Type = {
|
PyTypeObject _PyUnion_Type = {
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||||
.tp_name = "types.UnionType",
|
.tp_name = "types.UnionType",
|
||||||
.tp_doc = "Represent a PEP 604 union type\n"
|
.tp_doc = PyDoc_STR("Represent a PEP 604 union type\n"
|
||||||
"\n"
|
"\n"
|
||||||
"E.g. for int | str",
|
"E.g. for int | str"),
|
||||||
.tp_basicsize = sizeof(unionobject),
|
.tp_basicsize = sizeof(unionobject),
|
||||||
.tp_dealloc = unionobject_dealloc,
|
.tp_dealloc = unionobject_dealloc,
|
||||||
.tp_alloc = PyType_GenericAlloc,
|
.tp_alloc = PyType_GenericAlloc,
|
||||||
|
|
Loading…
Reference in New Issue