Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even more PyDoc_STR #109487

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ deque_get_maxlen(dequeobject *deque, void *Py_UNUSED(ignored))

static PyGetSetDef deque_getset[] = {
{"maxlen", (getter)deque_get_maxlen, (setter)NULL,
"maximum size of a deque or None if unbounded"},
PyDoc_STR("maximum size of a deque or None if unbounded")},
{0}
};

Expand Down
12 changes: 6 additions & 6 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,9 +1380,9 @@ CharArray_set_value(CDataObject *self, PyObject *value, void *Py_UNUSED(ignored)

static PyGetSetDef CharArray_getsets[] = {
{ "raw", (getter)CharArray_get_raw, (setter)CharArray_set_raw,
"value", NULL },
PyDoc_STR("value"), NULL },
{ "value", (getter)CharArray_get_value, (setter)CharArray_set_value,
"string value"},
PyDoc_STR("string value")},
{ NULL, NULL }
};

Expand Down Expand Up @@ -1432,7 +1432,7 @@ WCharArray_set_value(CDataObject *self, PyObject *value, void *Py_UNUSED(ignored

static PyGetSetDef WCharArray_getsets[] = {
{ "value", (getter)WCharArray_get_value, (setter)WCharArray_set_value,
"string value"},
PyDoc_STR("string value")},
{ NULL, NULL }
};

Expand Down Expand Up @@ -2762,13 +2762,13 @@ PyCData_dealloc(PyObject *self)
static PyMemberDef PyCData_members[] = {
{ "_b_base_", _Py_T_OBJECT,
offsetof(CDataObject, b_base), Py_READONLY,
"the base object" },
PyDoc_STR("the base object") },
{ "_b_needsfree_", Py_T_INT,
offsetof(CDataObject, b_needsfree), Py_READONLY,
"whether the object owns the memory or not" },
PyDoc_STR("whether the object owns the memory or not") },
{ "_objects", _Py_T_OBJECT,
offsetof(CDataObject, b_objects), Py_READONLY,
"internal objects tree (NEVER CHANGE THIS OBJECT!)"},
PyDoc_STR("internal objects tree (NEVER CHANGE THIS OBJECT!)") },
{ NULL },
};

Expand Down
14 changes: 7 additions & 7 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ PyCArg_repr(PyCArgObject *self)
static PyMemberDef PyCArgType_members[] = {
{ "_obj", _Py_T_OBJECT,
offsetof(PyCArgObject, obj), Py_READONLY,
"the wrapped object" },
PyDoc_STR("the wrapped object") },
{ NULL },
};

Expand Down Expand Up @@ -2036,8 +2036,8 @@ PyMethodDef _ctypes_module_methods[] = {
CREATE_POINTER_TYPE_METHODDEF
CREATE_POINTER_INST_METHODDEF
{"_unpickle", unpickle, METH_VARARGS },
{"buffer_info", buffer_info, METH_O, "Return buffer interface information"},
{"resize", resize, METH_VARARGS, "Resize the memory buffer of a ctypes instance"},
{"buffer_info", buffer_info, METH_O, PyDoc_STR("Return buffer interface information")},
{"resize", resize, METH_VARARGS, PyDoc_STR("Resize the memory buffer of a ctypes instance")},
#ifdef MS_WIN32
{"get_last_error", get_last_error, METH_NOARGS},
{"set_last_error", set_last_error, METH_VARARGS},
Expand All @@ -2048,12 +2048,12 @@ PyMethodDef _ctypes_module_methods[] = {
{"_check_HRESULT", check_hresult, METH_VARARGS},
#else
{"dlopen", py_dl_open, METH_VARARGS,
"dlopen(name, flag={RTLD_GLOBAL|RTLD_LOCAL}) open a shared library"},
{"dlclose", py_dl_close, METH_VARARGS, "dlclose a library"},
{"dlsym", py_dl_sym, METH_VARARGS, "find symbol in shared library"},
PyDoc_STR("dlopen(name, flag={RTLD_GLOBAL|RTLD_LOCAL}) open a shared library")},
{"dlclose", py_dl_close, METH_VARARGS, PyDoc_STR("dlclose a library")},
{"dlsym", py_dl_sym, METH_VARARGS, PyDoc_STR("find symbol in shared library")},
#endif
#ifdef __APPLE__
{"_dyld_shared_cache_contains_path", py_dyld_shared_cache_contains_path, METH_VARARGS, "check if path is in the shared cache"},
{"_dyld_shared_cache_contains_path", py_dyld_shared_cache_contains_path, METH_VARARGS, PyDoc_STR("check if path is in the shared cache")},
#endif
{"alignment", align_func, METH_O, alignment_doc},
{"sizeof", sizeof_func, METH_O, sizeof_doc},
Expand Down
8 changes: 4 additions & 4 deletions Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2563,7 +2563,7 @@ static PyGetSetDef PyCursesWindow_getsets[] = {
{"encoding",
(getter)PyCursesWindow_get_encoding,
(setter)PyCursesWindow_set_encoding,
"the typecode character used to create the array"},
PyDoc_STR("the typecode character used to create the array")},
{NULL, NULL, NULL, NULL } /* sentinel */
};

Expand Down Expand Up @@ -4563,9 +4563,9 @@ PyDoc_STRVAR(ncurses_version__doc__,
Ncurses version information as a named tuple.");

static PyStructSequence_Field ncurses_version_fields[] = {
{"major", "Major release number"},
{"minor", "Minor release number"},
{"patch", "Patch release number"},
{"major", PyDoc_STR("Major release number")},
{"minor", PyDoc_STR("Minor release number")},
{"patch", PyDoc_STR("Patch release number")},
{0}
};

Expand Down
2 changes: 1 addition & 1 deletion Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6915,7 +6915,7 @@ _datetime_exec(PyObject *module)
static struct PyModuleDef datetimemodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_datetime",
.m_doc = "Fast implementation of the datetime type.",
.m_doc = PyDoc_STR("Fast implementation of the datetime type."),
.m_size = -1,
.m_methods = module_methods,
};
Expand Down
8 changes: 4 additions & 4 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4200,19 +4200,19 @@ static PyGetSetDef element_getsetlist[] = {
{"tag",
(getter)element_tag_getter,
(setter)element_tag_setter,
"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,
"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,
"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,
"A dictionary containing the element's attributes"},
PyDoc_STR("A dictionary containing the element's attributes")},
{NULL},
};

Expand Down
6 changes: 3 additions & 3 deletions Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ PyDoc_STRVAR(partial_doc,
#define OFF(x) offsetof(partialobject, x)
static PyMemberDef partial_memberlist[] = {
{"func", _Py_T_OBJECT, OFF(fn), Py_READONLY,
"function object to use in future partial calls"},
PyDoc_STR("function object to use in future partial calls")},
{"args", _Py_T_OBJECT, OFF(args), Py_READONLY,
"tuple of arguments to future partial calls"},
PyDoc_STR("tuple of arguments to future partial calls")},
{"keywords", _Py_T_OBJECT, OFF(kw), Py_READONLY,
"dictionary of keyword arguments to future partial calls"},
PyDoc_STR("dictionary of keyword arguments to future partial calls")},
{"__weaklistoffset__", Py_T_PYSSIZET,
offsetof(partialobject, weakreflist), Py_READONLY},
{"__dictoffset__", Py_T_PYSSIZET,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ static PyModuleDef_Slot hashlib_slots[] = {
static struct PyModuleDef _hashlibmodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_hashlib",
.m_doc = "OpenSSL interface for hashlib module",
.m_doc = PyDoc_STR("OpenSSL interface for hashlib module"),
.m_size = sizeof(_hashlibstate),
.m_methods = EVP_functions,
.m_slots = hashlib_slots,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_io/bytesio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ bytesio_clear(bytesio *self)

static PyGetSetDef bytesio_getsetlist[] = {
{"closed", (getter)bytesio_get_closed, NULL,
"True if the file is closed."},
PyDoc_STR("True if the file is closed.")},
{NULL}, /* sentinel */
};

Expand Down
6 changes: 3 additions & 3 deletions Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,10 +1192,10 @@ get_mode(fileio *self, void *closure)
}

static PyGetSetDef fileio_getsetlist[] = {
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
{"closed", (getter)get_closed, NULL, PyDoc_STR("True if the file is closed")},
{"closefd", (getter)get_closefd, NULL,
"True if the file descriptor will be closed by close()."},
{"mode", (getter)get_mode, NULL, "String giving the file mode"},
PyDoc_STR("True if the file descriptor will be closed by close().")},
{"mode", (getter)get_mode, NULL, PyDoc_STR("String giving the file mode")},
{NULL},
};

Expand Down
6 changes: 3 additions & 3 deletions Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,10 +1134,10 @@ get_mode(winconsoleio *self, void *closure)
}

static PyGetSetDef winconsoleio_getsetlist[] = {
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
{"closed", (getter)get_closed, NULL, PyDoc_STR("True if the file is closed")},
{"closefd", (getter)get_closefd, NULL,
"True if the file descriptor will be closed by close()."},
{"mode", (getter)get_mode, NULL, "String giving the file mode"},
PyDoc_STR("True if the file descriptor will be closed by close().")},
{"mode", (getter)get_mode, NULL, PyDoc_STR("String giving the file mode")},
{NULL},
};

Expand Down
26 changes: 13 additions & 13 deletions Modules/_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ typedef struct _PyScannerObject {
} PyScannerObject;

static PyMemberDef scanner_members[] = {
{"strict", Py_T_BOOL, offsetof(PyScannerObject, strict), Py_READONLY, "strict"},
{"object_hook", _Py_T_OBJECT, offsetof(PyScannerObject, object_hook), Py_READONLY, "object_hook"},
{"strict", Py_T_BOOL, offsetof(PyScannerObject, strict), Py_READONLY, PyDoc_STR("strict")},
{"object_hook", _Py_T_OBJECT, offsetof(PyScannerObject, object_hook), Py_READONLY, PyDoc_STR("object_hook")},
{"object_pairs_hook", _Py_T_OBJECT, offsetof(PyScannerObject, object_pairs_hook), Py_READONLY},
{"parse_float", _Py_T_OBJECT, offsetof(PyScannerObject, parse_float), Py_READONLY, "parse_float"},
{"parse_int", _Py_T_OBJECT, offsetof(PyScannerObject, parse_int), Py_READONLY, "parse_int"},
{"parse_constant", _Py_T_OBJECT, offsetof(PyScannerObject, parse_constant), Py_READONLY, "parse_constant"},
{"parse_float", _Py_T_OBJECT, offsetof(PyScannerObject, parse_float), Py_READONLY, PyDoc_STR("parse_float")},
{"parse_int", _Py_T_OBJECT, offsetof(PyScannerObject, parse_int), Py_READONLY, PyDoc_STR("parse_int")},
{"parse_constant", _Py_T_OBJECT, offsetof(PyScannerObject, parse_constant), Py_READONLY, PyDoc_STR("parse_constant")},
{NULL}
};

Expand All @@ -52,14 +52,14 @@ typedef struct _PyEncoderObject {
} PyEncoderObject;

static PyMemberDef encoder_members[] = {
{"markers", _Py_T_OBJECT, offsetof(PyEncoderObject, markers), Py_READONLY, "markers"},
{"default", _Py_T_OBJECT, offsetof(PyEncoderObject, defaultfn), Py_READONLY, "default"},
{"encoder", _Py_T_OBJECT, offsetof(PyEncoderObject, encoder), Py_READONLY, "encoder"},
{"indent", _Py_T_OBJECT, offsetof(PyEncoderObject, indent), Py_READONLY, "indent"},
{"key_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, key_separator), Py_READONLY, "key_separator"},
{"item_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, item_separator), Py_READONLY, "item_separator"},
{"sort_keys", Py_T_BOOL, offsetof(PyEncoderObject, sort_keys), Py_READONLY, "sort_keys"},
{"skipkeys", Py_T_BOOL, offsetof(PyEncoderObject, skipkeys), Py_READONLY, "skipkeys"},
{"markers", _Py_T_OBJECT, offsetof(PyEncoderObject, markers), Py_READONLY, PyDoc_STR("markers")},
{"default", _Py_T_OBJECT, offsetof(PyEncoderObject, defaultfn), Py_READONLY, PyDoc_STR("default")},
{"encoder", _Py_T_OBJECT, offsetof(PyEncoderObject, encoder), Py_READONLY, PyDoc_STR("encoder")},
{"indent", _Py_T_OBJECT, offsetof(PyEncoderObject, indent), Py_READONLY, PyDoc_STR("indent")},
{"key_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, key_separator), Py_READONLY, PyDoc_STR("key_separator")},
{"item_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, item_separator), Py_READONLY, PyDoc_STR("item_separator")},
{"sort_keys", Py_T_BOOL, offsetof(PyEncoderObject, sort_keys), Py_READONLY, PyDoc_STR("sort_keys")},
{"skipkeys", Py_T_BOOL, offsetof(PyEncoderObject, skipkeys), Py_READONLY, PyDoc_STR("skipkeys")},
{NULL}
};

Expand Down
24 changes: 12 additions & 12 deletions Modules/_lsprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,21 +419,21 @@ pending_exception(ProfilerObject *pObj)
/************************************************************/

static PyStructSequence_Field profiler_entry_fields[] = {
{"code", "code object or built-in function name"},
{"callcount", "how many times this was called"},
{"reccallcount", "how many times called recursively"},
{"totaltime", "total time in this entry"},
{"inlinetime", "inline time in this entry (not in subcalls)"},
{"calls", "details of the calls"},
{"code", PyDoc_STR("code object or built-in function name")},
{"callcount", PyDoc_STR("how many times this was called")},
{"reccallcount", PyDoc_STR("how many times called recursively")},
{"totaltime", PyDoc_STR("total time in this entry")},
{"inlinetime", PyDoc_STR("inline time in this entry (not in subcalls)")},
{"calls", PyDoc_STR("details of the calls")},
{0}
};

static PyStructSequence_Field profiler_subentry_fields[] = {
{"code", "called code object or built-in function name"},
{"callcount", "how many times this is called"},
{"reccallcount", "how many times this is called recursively"},
{"totaltime", "total time spent in this call"},
{"inlinetime", "inline time (not in further subcalls)"},
{"code", PyDoc_STR("called code object or built-in function name")},
{"callcount", PyDoc_STR("how many times this is called")},
{"reccallcount", PyDoc_STR("how many times this is called recursively")},
{"totaltime", PyDoc_STR("total time spent in this call")},
{"inlinetime", PyDoc_STR("inline time (not in further subcalls)")},
{0}
};

Expand Down Expand Up @@ -1014,7 +1014,7 @@ static PyModuleDef_Slot _lsprofslots[] = {
static struct PyModuleDef _lsprofmodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_lsprof",
.m_doc = "Fast profiler",
.m_doc = PyDoc_STR("Fast profiler"),
.m_size = sizeof(_lsprof_state),
.m_methods = moduleMethods,
.m_slots = _lsprofslots,
Expand Down
2 changes: 1 addition & 1 deletion Modules/_multiprocessing/posixshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static PyModuleDef_Slot module_slots[] = {
static struct PyModuleDef _posixshmemmodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_posixshmem",
.m_doc = "POSIX shared memory module",
.m_doc = PyDoc_STR("POSIX shared memory module"),
.m_size = 0,
.m_methods = module_methods,
.m_slots = module_slots,
Expand Down
8 changes: 4 additions & 4 deletions Modules/_multiprocessing/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,13 @@ static PyMethodDef semlock_methods[] = {

static PyMemberDef semlock_members[] = {
{"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), Py_READONLY,
""},
PyDoc_STR("")},
Gobot1234 marked this conversation as resolved.
Show resolved Hide resolved
{"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("")},
{NULL}
};

Expand Down
2 changes: 1 addition & 1 deletion Modules/_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static PyModuleDef_Slot module_slots[] = {
static struct PyModuleDef opcodemodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_opcode",
.m_doc = "Opcode support module.",
.m_doc = PyDoc_STR("Opcode support module."),
.m_size = 0,
.m_methods = opcode_functions,
.m_slots = module_slots,
Expand Down
20 changes: 10 additions & 10 deletions Modules/_sre/sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,18 +3017,18 @@ static PyMethodDef pattern_methods[] = {

static PyGetSetDef pattern_getset[] = {
{"groupindex", (getter)pattern_groupindex, (setter)NULL,
"A dictionary mapping group names to group numbers."},
PyDoc_STR("A dictionary mapping group names to group numbers.")},
{NULL} /* Sentinel */
};

#define PAT_OFF(x) offsetof(PatternObject, x)
static PyMemberDef pattern_members[] = {
{"pattern", _Py_T_OBJECT, PAT_OFF(pattern), Py_READONLY,
"The pattern string from which the RE object was compiled."},
PyDoc_STR("The pattern string from which the RE object was compiled.")},
{"flags", Py_T_INT, PAT_OFF(flags), Py_READONLY,
"The regex matching flags."},
PyDoc_STR("The regex matching flags.")},
{"groups", Py_T_PYSSIZET, PAT_OFF(groups), Py_READONLY,
"The number of capturing groups in the pattern."},
PyDoc_STR("The number of capturing groups in the pattern.")},
{"__weaklistoffset__", Py_T_PYSSIZET, offsetof(PatternObject, weakreflist), Py_READONLY},
{NULL} /* Sentinel */
};
Expand Down Expand Up @@ -3073,23 +3073,23 @@ static PyMethodDef match_methods[] = {

static PyGetSetDef match_getset[] = {
{"lastindex", (getter)match_lastindex_get, (setter)NULL,
"The integer index of the last matched capturing group."},
PyDoc_STR("The integer index of the last matched capturing group.")},
{"lastgroup", (getter)match_lastgroup_get, (setter)NULL,
"The name of the last matched capturing group."},
PyDoc_STR("The name of the last matched capturing group.")},
{"regs", (getter)match_regs_get, (setter)NULL},
{NULL}
};

#define MATCH_OFF(x) offsetof(MatchObject, x)
static PyMemberDef match_members[] = {
{"string", _Py_T_OBJECT, MATCH_OFF(string), Py_READONLY,
"The string passed to match() or search()."},
PyDoc_STR("The string passed to match() or search().")},
{"re", _Py_T_OBJECT, MATCH_OFF(pattern), Py_READONLY,
"The regular expression object."},
PyDoc_STR("The regular expression object.")},
{"pos", Py_T_PYSSIZET, MATCH_OFF(pos), Py_READONLY,
"The index into the string at which the RE engine started looking for a match."},
PyDoc_STR("The index into the string at which the RE engine started looking for a match.")},
{"endpos", Py_T_PYSSIZET, MATCH_OFF(endpos), Py_READONLY,
"The index into the string beyond which the RE engine will not go."},
PyDoc_STR("The index into the string beyond which the RE engine will not go.")},
{NULL}
};

Expand Down
4 changes: 2 additions & 2 deletions Modules/_testcapi/heaptype.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ test_type_from_ephemeral_spec(PyObject *self, PyObject *Py_UNUSED(ignored))
}

PyType_Slot repeated_doc_slots[] = {
{Py_tp_doc, "A class used for tests·"},
{Py_tp_doc, "A class used for tests"},
{Py_tp_doc, PyDoc_STR("A class used for tests·")},
{Py_tp_doc, PyDoc_STR("A class used for tests")},
{0, 0},
};

Expand Down