From 41dffd9134afd5d557f7e003e9bfaaab5202f4d1 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 14 Sep 2023 10:08:19 +0300 Subject: [PATCH 1/2] Add missing `PyDoc_STR` calls --- Modules/_ctypes/cfield.c | 4 ++-- Modules/_struct.c | 4 ++-- Objects/typevarobject.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index 128506a9eed9204..bfb40e5c5393fcb 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -250,8 +250,8 @@ PyCField_get_size(PyObject *self, void *data) } static PyGetSetDef PyCField_getset[] = { - { "offset", PyCField_get_offset, NULL, "offset in bytes of this field" }, - { "size", PyCField_get_size, NULL, "size in bytes of this field" }, + { "offset", PyCField_get_offset, NULL, PyDoc_STR("offset in bytes of this field") }, + { "size", PyCField_get_size, NULL, PyDoc_STR("size in bytes of this field") }, { NULL, NULL, NULL, NULL }, }; diff --git a/Modules/_struct.c b/Modules/_struct.c index 1f8f9c44dd69aa2..ff1bf4e96c5f214 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2198,8 +2198,8 @@ static PyMemberDef s_members[] = { }; static PyGetSetDef s_getsetlist[] = { - {"format", (getter)s_get_format, (setter)NULL, "struct format string", NULL}, - {"size", (getter)s_get_size, (setter)NULL, "struct size in bytes", NULL}, + {"format", (getter)s_get_format, (setter)NULL, PyDoc_STR("struct format string"), NULL}, + {"size", (getter)s_get_size, (setter)NULL, PyDoc_STR("struct size in bytes"), NULL}, {NULL} /* sentinel */ }; diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c index 3adae3e14c9103c..0f04523b0032ed2 100644 --- a/Objects/typevarobject.c +++ b/Objects/typevarobject.c @@ -806,8 +806,8 @@ paramspec_kwargs(PyObject *self, void *unused) } static PyGetSetDef paramspec_getset[] = { - {"args", (getter)paramspec_args, NULL, "Represents positional arguments.", NULL}, - {"kwargs", (getter)paramspec_kwargs, NULL, "Represents keyword arguments.", NULL}, + {"args", (getter)paramspec_args, NULL, PyDoc_STR("Represents positional arguments."), NULL}, + {"kwargs", (getter)paramspec_kwargs, NULL, PyDoc_STR("Represents keyword arguments."), NULL}, {0}, }; From 572b87e64e14ecc6527d29ea3285ed9ff11e61a8 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 14 Sep 2023 10:11:03 +0300 Subject: [PATCH 2/2] More --- Objects/dictobject.c | 2 +- Objects/unionobject.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 7cbc49f96994f7c..329581c8692c403 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -4643,7 +4643,7 @@ dictview_mapping(PyObject *view, void *Py_UNUSED(ignored)) { static PyGetSetDef dictview_getset[] = { {"mapping", dictview_mapping, (setter)NULL, - "dictionary that this view refers to", NULL}, + PyDoc_STR("dictionary that this view refers to"), NULL}, {0} }; diff --git a/Objects/unionobject.c b/Objects/unionobject.c index 347945a4c459723..3493ab3f240abc5 100644 --- a/Objects/unionobject.c +++ b/Objects/unionobject.c @@ -331,7 +331,8 @@ union_parameters(PyObject *self, void *Py_UNUSED(unused)) } static PyGetSetDef union_properties[] = { - {"__parameters__", union_parameters, (setter)NULL, "Type variables in the types.UnionType.", NULL}, + {"__parameters__", union_parameters, (setter)NULL, + PyDoc_STR("Type variables in the types.UnionType."), NULL}, {0} };