From b10ad220c0da1da8198c6e4a5c2fbf3d1e5f84b4 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 16 Sep 2023 12:09:21 +0100 Subject: [PATCH 1/4] Even more PyDoc_STR Regex used ((PyGetSetDef|PyMemberDef|PyMethodDef|PyStructSequence_Field|PyStructSequence_Desc) .* = \{ [\s\S]* .*?"(? Date: Sat, 16 Sep 2023 16:30:03 +0100 Subject: [PATCH 2/4] Fix typo --- Modules/_elementtree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index b2c9c60071d4192..1bfc716553495bc 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -4200,19 +4200,19 @@ static PyGetSetDef element_getsetlist[] = { {"tag", (getter)element_tag_getter, (setter)element_tag_setter, - PyDoct_STR("A string identifying what kind of data this element represents")}, + PyDoc_STR("A string identifying what kind of data this element represents")}, {"text", (getter)element_text_getter, (setter)element_text_setter, - PyDoct_STR("A string of text directly after the start tag, or None")}, + PyDoc_STR("A string of text directly after the start tag, or None")}, {"tail", (getter)element_tail_getter, (setter)element_tail_setter, - PyDoct_STR("A string of text directly after the end tag, or None")}, + PyDoc_STR("A string of text directly after the end tag, or None")}, {"attrib", (getter)element_attrib_getter, (setter)element_attrib_setter, - PyDoct_STR("A dictionary containing the element's attributes")}, + PyDoc_STR("A dictionary containing the element's attributes")}, {NULL}, }; From a6fedf2a0a30d3f08b76443313d4a01a69988230 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Sun, 1 Oct 2023 11:45:43 +0100 Subject: [PATCH 3/4] Apply round 1 of code suggestions Co-authored-by: Nikita Sobolev --- Modules/_winapi.c | 2 +- Python/sysmodule.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 2adcf173edeaac6..53a0a5f9bcef83f 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -329,7 +329,7 @@ static PyMemberDef overlapped_members[] = { static PyType_Slot winapi_overlapped_type_slots[] = { {Py_tp_traverse, overlapped_traverse}, {Py_tp_dealloc, overlapped_dealloc}, - {Py_tp_doc, PyDoc_STR("OVERLAPPED structure wrapper")}, + {Py_tp_doc, PyDoc_STR("Overlapped structure wrapper")}, {Py_tp_methods, overlapped_methods}, {Py_tp_members, overlapped_members}, {0,0} diff --git a/Python/sysmodule.c b/Python/sysmodule.c index c68f6852337da48..25fcdb3972eddc6 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1517,16 +1517,16 @@ sys_getrecursionlimit_impl(PyObject *module) static PyTypeObject WindowsVersionType = {0, 0, 0, 0, 0, 0}; static PyStructSequence_Field windows_version_fields[] = { - {"major", PyDoc_STR"Major version number")}, - {"minor", PyDoc_STR"Minor version number")}, - {"build", PyDoc_STR"Build number")}, - {"platform", PyDoc_STR"Operating system platform")}, - {"service_pack", PyDoc_STR"Latest Service Pack installed on the system")}, - {"service_pack_major", PyDoc_STR"Service Pack major version number")}, - {"service_pack_minor", PyDoc_STR"Service Pack minor version number")}, - {"suite_mask", PyDoc_STR"Bit mask identifying available product suites")}, - {"product_type", PyDoc_STR"System product type")}, - {"platform_version", PyDoc_STR"Diagnostic version number")}, + {"major", PyDoc_STR("Major version number")}, + {"minor", PyDoc_STR("Minor version number")}, + {"build", PyDoc_STR("Build number")}, + {"platform", PyDoc_STR("Operating system platform")}, + {"service_pack", PyDoc_STR("Latest Service Pack installed on the system")}, + {"service_pack_major", PyDoc_STR("Service Pack major version number")}, + {"service_pack_minor", PyDoc_STR("Service Pack minor version number")}, + {"suite_mask", PyDoc_STR("Bit mask identifying available product suites")}, + {"product_type", PyDoc_STR("System product type")}, + {"platform_version", PyDoc_STR("Diagnostic version number")}, {0} }; From 3149e38ea2d96cfba3b3825740cd9fad3bfb4480 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sun, 1 Oct 2023 11:58:24 +0100 Subject: [PATCH 4/4] Remove empty PyDoc_STR --- Modules/_multiprocessing/semaphore.c | 12 ++++-------- Modules/_xxtestfuzz/_xxtestfuzz.c | 2 +- Modules/cjkcodecs/cjkcodecs.h | 2 +- Objects/fileobject.c | 10 +++++----- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index 3b81acd031752f7..328f8f313465bbf 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -739,14 +739,10 @@ static PyMethodDef semlock_methods[] = { */ static PyMemberDef semlock_members[] = { - {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), Py_READONLY, - PyDoc_STR("")}, - {"kind", Py_T_INT, offsetof(SemLockObject, kind), Py_READONLY, - PyDoc_STR("")}, - {"maxvalue", Py_T_INT, offsetof(SemLockObject, maxvalue), Py_READONLY, - PyDoc_STR("")}, - {"name", Py_T_STRING, offsetof(SemLockObject, name), Py_READONLY, - PyDoc_STR("")}, + {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), Py_READONLY}, + {"kind", Py_T_INT, offsetof(SemLockObject, kind), Py_READONLY}, + {"maxvalue", Py_T_INT, offsetof(SemLockObject, maxvalue), Py_READONLY}, + {"name", Py_T_STRING, offsetof(SemLockObject, name), Py_READONLY}, {NULL} }; diff --git a/Modules/_xxtestfuzz/_xxtestfuzz.c b/Modules/_xxtestfuzz/_xxtestfuzz.c index 15298a1952bfcb1..6c2b0fdddf23180 100644 --- a/Modules/_xxtestfuzz/_xxtestfuzz.c +++ b/Modules/_xxtestfuzz/_xxtestfuzz.c @@ -24,7 +24,7 @@ static PyObject* _fuzz_run(PyObject* self, PyObject* args) { } static PyMethodDef module_methods[] = { - {"run", (PyCFunction)_fuzz_run, METH_VARARGS, PyDoc_STR("")}, + {"run", (PyCFunction)_fuzz_run, METH_VARARGS}, {NULL}, }; diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index e8088a90e45b488..910d8ee84c4c23a 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -496,7 +496,7 @@ _cjk_free(void *mod) } static struct PyMethodDef _cjk_methods[] = { - {"getcodec", (PyCFunction)getcodec, METH_O, PyDoc_STR("")}, + {"getcodec", (PyCFunction)getcodec, METH_O}, {NULL, NULL}, }; diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 8414740034ba994..ff11608ed6847e3 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -388,11 +388,11 @@ stdprinter_isatty(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored)) } static PyMethodDef stdprinter_methods[] = { - {"close", (PyCFunction)stdprinter_noop, METH_NOARGS, PyDoc_STR("")}, - {"flush", (PyCFunction)stdprinter_noop, METH_NOARGS, PyDoc_STR("")}, - {"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS, PyDoc_STR("")}, - {"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS, PyDoc_STR("")}, - {"write", (PyCFunction)stdprinter_write, METH_VARARGS, PyDoc_STR("")}, + {"close", (PyCFunction)stdprinter_noop, METH_NOARGS}, + {"flush", (PyCFunction)stdprinter_noop, METH_NOARGS}, + {"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS}, + {"write", (PyCFunction)stdprinter_write, METH_VARARGS}, {NULL, NULL} /*sentinel */ };