diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index c8cd53de5e22622..3a3ddd6dcc3ff85 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -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} }; diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 184af2132c27078..0abb1ac3276e1e9 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -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 } }; @@ -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 } }; @@ -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 }, }; diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index fc08c42bd3574ab..08e7db7e039674c 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -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 }, }; @@ -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}, @@ -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}, diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index d339a8aa798361f..48a1013cf475774 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -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 */ }; @@ -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} }; diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 0d356779cfe1920..43d207ce78722ee 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -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, }; diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 8cb57e693d81d7d..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, - "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}, }; diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 389ff4391de0be6..38e284fb9564e84 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -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, diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index ee6fb8b4b036435..339c3638d863a61 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -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, diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index f3074203f54ea2a..90b89a8b860d59f 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -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 */ }; diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index fb416700e225231..5fca08ccc6a2e59 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -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}, }; diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index 50b8818aad410b0..5eae71af790ea75 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -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}, }; diff --git a/Modules/_json.c b/Modules/_json.c index 41495e2012f1522..be8c170cfc896f1 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -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} }; @@ -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} }; diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index d23a756ace887d1..23e7029fbb1740d 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -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} }; @@ -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, diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c index debef3267f77d1f..aa70a26d1fde97d 100644 --- a/Modules/_multiprocessing/posixshmem.c +++ b/Modules/_multiprocessing/posixshmem.c @@ -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, diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index f8f2afda28d06db..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, - ""}, - {"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, - ""}, + {"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/_opcode.c b/Modules/_opcode.c index dac9c019b249e9a..c7851ff0830f018 100644 --- a/Modules/_opcode.c +++ b/Modules/_opcode.c @@ -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, diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c index 07da5da13f70d39..d25f29b9d2c0248 100644 --- a/Modules/_sre/sre.c +++ b/Modules/_sre/sre.c @@ -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 */ }; @@ -3073,9 +3073,9 @@ 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} }; @@ -3083,13 +3083,13 @@ static PyGetSetDef match_getset[] = { #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} }; diff --git a/Modules/_testcapi/heaptype.c b/Modules/_testcapi/heaptype.c index d14a1763184207a..6e0903a91118162 100644 --- a/Modules/_testcapi/heaptype.c +++ b/Modules/_testcapi/heaptype.c @@ -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}, }; diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c index fdef06168bfc86b..1677e4510c7cdf0 100644 --- a/Modules/_testmultiphase.c +++ b/Modules/_testmultiphase.c @@ -105,7 +105,7 @@ Example_setattr(ExampleObject *self, const char *name, PyObject *v) } static PyType_Slot Example_Type_slots[] = { - {Py_tp_doc, "The Example type"}, + {Py_tp_doc, PyDoc_STR("The Example type")}, {Py_tp_finalize, Example_finalize}, {Py_tp_traverse, Example_traverse}, {Py_tp_getattro, Example_getattro}, @@ -279,7 +279,7 @@ static PyMethodDef StateAccessType_methods[] = { }; static PyType_Slot StateAccessType_Type_slots[] = { - {Py_tp_doc, "Type for testing per-module state access from methods."}, + {Py_tp_doc, PyDoc_STR("Type for testing per-module state access from methods.")}, {Py_tp_methods, StateAccessType_methods}, {0, NULL} }; diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 7692bacccc4909c..117a6f67b815845 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -688,7 +688,7 @@ static PyMemberDef local_dummy_type_members[] = { static PyType_Slot local_dummy_type_slots[] = { {Py_tp_dealloc, (destructor)localdummy_dealloc}, - {Py_tp_doc, "Thread-local dummy"}, + {Py_tp_doc, PyDoc_STR("Thread-local dummy")}, {Py_tp_members, local_dummy_type_members}, {0, 0} }; @@ -970,7 +970,7 @@ static PyType_Slot local_type_slots[] = { {Py_tp_dealloc, (destructor)local_dealloc}, {Py_tp_getattro, (getattrofunc)local_getattro}, {Py_tp_setattro, (setattrofunc)local_setattro}, - {Py_tp_doc, "Thread-local data"}, + {Py_tp_doc, PyDoc_STR("Thread-local data")}, {Py_tp_traverse, (traverseproc)local_traverse}, {Py_tp_clear, (inquiry)local_clear}, {Py_tp_new, local_new}, @@ -1513,10 +1513,10 @@ PyDoc_STRVAR(ExceptHookArgs__doc__, Type used to pass arguments to threading.excepthook."); static PyStructSequence_Field ExceptHookArgs_fields[] = { - {"exc_type", "Exception type"}, - {"exc_value", "Exception value"}, - {"exc_traceback", "Exception traceback"}, - {"thread", "Thread"}, + {"exc_type", PyDoc_STR("Exception type")}, + {"exc_value", PyDoc_STR("Exception value")}, + {"exc_traceback", PyDoc_STR("Exception traceback")}, + {"thread", PyDoc_STR("Thread")}, {0} }; diff --git a/Modules/_winapi.c b/Modules/_winapi.c index eec33499b983fe7..53a0a5f9bcef83f 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -322,14 +322,14 @@ static PyMethodDef overlapped_methods[] = { static PyMemberDef overlapped_members[] = { {"event", T_HANDLE, offsetof(OverlappedObject, overlapped) + offsetof(OVERLAPPED, hEvent), - Py_READONLY, "overlapped event handle"}, + Py_READONLY, PyDoc_STR("overlapped event handle")}, {NULL} }; static PyType_Slot winapi_overlapped_type_slots[] = { {Py_tp_traverse, overlapped_traverse}, {Py_tp_dealloc, overlapped_dealloc}, - {Py_tp_doc, "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/Modules/_xxtestfuzz/_xxtestfuzz.c b/Modules/_xxtestfuzz/_xxtestfuzz.c index a2dbabce71ed67c..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, ""}, + {"run", (PyCFunction)_fuzz_run, METH_VARARGS}, {NULL}, }; diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index eb4e522465181fe..d2f9a3bf7ee7142 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -2842,7 +2842,7 @@ static PyModuleDef_Slot zoneinfomodule_slots[] = { static struct PyModuleDef zoneinfomodule = { .m_base = PyModuleDef_HEAD_INIT, .m_name = "_zoneinfo", - .m_doc = "C implementation of the zoneinfo module", + .m_doc = PyDoc_STR("C implementation of the zoneinfo module"), .m_size = sizeof(zoneinfo_state), .m_methods = module_methods, .m_slots = zoneinfomodule_slots, diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 309a36919f34650..52612c144cf5d69 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2332,9 +2332,9 @@ array_get_itemsize(arrayobject *a, void *closure) static PyGetSetDef array_getsets [] = { {"typecode", (getter) array_get_typecode, NULL, - "the typecode character used to create the array"}, + PyDoc_STR("the typecode character used to create the array")}, {"itemsize", (getter) array_get_itemsize, NULL, - "the size, in bytes, of one array item"}, + PyDoc_STR("the size, in bytes, of one array item")}, {NULL} }; diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index 766f82983025e46..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, ""}, + {"getcodec", (PyCFunction)getcodec, METH_O}, {NULL, NULL}, }; diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 20e83de84e8340f..3c76f813c90562e 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -14,10 +14,10 @@ module grp /*[clinic end generated code: output=da39a3ee5e6b4b0d input=cade63f2ed1bd9f8]*/ static PyStructSequence_Field struct_group_type_fields[] = { - {"gr_name", "group name"}, - {"gr_passwd", "password"}, - {"gr_gid", "group id"}, - {"gr_mem", "group members"}, + {"gr_name", PyDoc_STR("group name")}, + {"gr_passwd", PyDoc_STR("password")}, + {"gr_gid", PyDoc_STR("group id")}, + {"gr_mem", PyDoc_STR("group members")}, {0} }; diff --git a/Modules/overlapped.c b/Modules/overlapped.c index e23db22dadb18bb..4efd53dfa3d2974 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -1950,18 +1950,18 @@ static PyMethodDef Overlapped_methods[] = { static PyMemberDef Overlapped_members[] = { {"error", Py_T_ULONG, offsetof(OverlappedObject, error), - Py_READONLY, "Error from last operation"}, + Py_READONLY, PyDoc_STR("Error from last operation")}, {"event", T_HANDLE, offsetof(OverlappedObject, overlapped) + offsetof(OVERLAPPED, hEvent), - Py_READONLY, "Overlapped event handle"}, + Py_READONLY, PyDoc_STR("Overlapped event handle")}, {NULL} }; static PyGetSetDef Overlapped_getsets[] = { {"address", (getter)Overlapped_getaddress, NULL, - "Address of overlapped structure"}, + PyDoc_STR("Address of overlapped structure")}, {"pending", (getter)Overlapped_getpending, NULL, - "Whether the operation is pending"}, + PyDoc_STR("Whether the operation is pending")}, {NULL}, }; diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c4340397fbe577c..f478e11aef53d99 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2133,52 +2133,52 @@ or st_flags, they are available as attributes only.\n\ See os.stat for more information."); static PyStructSequence_Field stat_result_fields[] = { - {"st_mode", "protection bits"}, - {"st_ino", "inode"}, - {"st_dev", "device"}, - {"st_nlink", "number of hard links"}, - {"st_uid", "user ID of owner"}, - {"st_gid", "group ID of owner"}, - {"st_size", "total size, in bytes"}, + {"st_mode", PyDoc_STR("protection bits")}, + {"st_ino", PyDoc_STR("inode")}, + {"st_dev", PyDoc_STR("device")}, + {"st_nlink", PyDoc_STR("number of hard links")}, + {"st_uid", PyDoc_STR("user ID of owner")}, + {"st_gid", PyDoc_STR("group ID of owner")}, + {"st_size", PyDoc_STR("total size, in bytes")}, /* The NULL is replaced with PyStructSequence_UnnamedField later. */ - {NULL, "integer time of last access"}, - {NULL, "integer time of last modification"}, - {NULL, "integer time of last change"}, - {"st_atime", "time of last access"}, - {"st_mtime", "time of last modification"}, - {"st_ctime", "time of last change"}, - {"st_atime_ns", "time of last access in nanoseconds"}, - {"st_mtime_ns", "time of last modification in nanoseconds"}, - {"st_ctime_ns", "time of last change in nanoseconds"}, + {NULL, PyDoc_STR("integer time of last access")}, + {NULL, PyDoc_STR("integer time of last modification")}, + {NULL, PyDoc_STR("integer time of last change")}, + {"st_atime", PyDoc_STR("time of last access")}, + {"st_mtime", PyDoc_STR("time of last modification")}, + {"st_ctime", PyDoc_STR("time of last change")}, + {"st_atime_ns", PyDoc_STR("time of last access in nanoseconds")}, + {"st_mtime_ns", PyDoc_STR("time of last modification in nanoseconds")}, + {"st_ctime_ns", PyDoc_STR("time of last change in nanoseconds")}, #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - {"st_blksize", "blocksize for filesystem I/O"}, + {"st_blksize", PyDoc_STR("blocksize for filesystem I/O")}, #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS - {"st_blocks", "number of blocks allocated"}, + {"st_blocks", PyDoc_STR("number of blocks allocated")}, #endif #ifdef HAVE_STRUCT_STAT_ST_RDEV - {"st_rdev", "device type (if inode device)"}, + {"st_rdev", PyDoc_STR("device type (if inode device)")}, #endif #ifdef HAVE_STRUCT_STAT_ST_FLAGS - {"st_flags", "user defined flags for file"}, + {"st_flags", PyDoc_STR("user defined flags for file")}, #endif #ifdef HAVE_STRUCT_STAT_ST_GEN - {"st_gen", "generation number"}, + {"st_gen", PyDoc_STR("generation number")}, #endif #if defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) || defined(MS_WINDOWS) - {"st_birthtime", "time of creation"}, + {"st_birthtime", PyDoc_STR("time of creation")}, #endif #ifdef MS_WINDOWS - {"st_birthtime_ns", "time of creation in nanoseconds"}, + {"st_birthtime_ns", PyDoc_STR("time of creation in nanoseconds")}, #endif #ifdef HAVE_STRUCT_STAT_ST_FILE_ATTRIBUTES - {"st_file_attributes", "Windows file attribute bits"}, + {"st_file_attributes", PyDoc_STR("Windows file attribute bits")}, #endif #ifdef HAVE_STRUCT_STAT_ST_FSTYPE - {"st_fstype", "Type of filesystem"}, + {"st_fstype", PyDoc_STR("Type of filesystem")}, #endif #ifdef HAVE_STRUCT_STAT_ST_REPARSE_TAG - {"st_reparse_tag", "Windows reparse tag"}, + {"st_reparse_tag", PyDoc_STR("Windows reparse tag")}, #endif {0} }; @@ -5857,11 +5857,11 @@ os_remove_impl(PyObject *module, path_t *path, int dir_fd) static PyStructSequence_Field uname_result_fields[] = { - {"sysname", "operating system name"}, - {"nodename", "name of machine on network (implementation-defined)"}, - {"release", "operating system release"}, - {"version", "operating system version"}, - {"machine", "hardware identifier"}, + {"sysname", PyDoc_STR("operating system name")}, + {"nodename", PyDoc_STR("name of machine on network (implementation-defined)")}, + {"release", PyDoc_STR("operating system release")}, + {"version", PyDoc_STR("operating system version")}, + {"machine", PyDoc_STR("hardware identifier")}, {NULL} }; @@ -7820,7 +7820,7 @@ os_sched_param_impl(PyTypeObject *type, PyObject *sched_priority) PyDoc_VAR(os_sched_param__doc__); static PyStructSequence_Field sched_param_fields[] = { - {"sched_priority", "the scheduling priority"}, + {"sched_priority", PyDoc_STR("the scheduling priority")}, {0} }; @@ -9928,11 +9928,11 @@ os_symlink_impl(PyObject *module, path_t *src, path_t *dst, static PyStructSequence_Field times_result_fields[] = { - {"user", "user time"}, - {"system", "system time"}, - {"children_user", "user time of children"}, - {"children_system", "system time of children"}, - {"elapsed", "elapsed time since an arbitrary point in the past"}, + {"user", PyDoc_STR("user time")}, + {"system", PyDoc_STR("system time")}, + {"children_user", PyDoc_STR("user time of children")}, + {"children_system", PyDoc_STR("system time of children")}, + {"elapsed", PyDoc_STR("elapsed time since an arbitrary point in the past")}, {NULL} }; @@ -14227,8 +14227,8 @@ PyDoc_STRVAR(TerminalSize_docstring, "A tuple of (columns, lines) for holding terminal window size"); static PyStructSequence_Field TerminalSize_fields[] = { - {"columns", "width of the terminal window in characters"}, - {"lines", "height of the terminal window in characters"}, + {"columns", PyDoc_STR("width of the terminal window in characters")}, + {"lines", PyDoc_STR("height of the terminal window in characters")}, {NULL, NULL} }; @@ -14882,9 +14882,9 @@ os_DirEntry___fspath___impl(DirEntry *self) static PyMemberDef DirEntry_members[] = { {"name", Py_T_OBJECT_EX, offsetof(DirEntry, name), Py_READONLY, - "the entry's base filename, relative to scandir() \"path\" argument"}, + PyDoc_STR("the entry's base filename, relative to scandir() \"path\" argument")}, {"path", Py_T_OBJECT_EX, offsetof(DirEntry, path), Py_READONLY, - "the entry's full path name; equivalent to os.path.join(scandir_path, entry.name)"}, + PyDoc_STR("the entry's full path name; equivalent to os.path.join(scandir_path, entry.name)")}, {NULL} }; diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index b7034369c4731ee..6cf0d5c21ce9792 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -14,13 +14,13 @@ module pwd /*[clinic end generated code: output=da39a3ee5e6b4b0d input=60f628ef356b97b6]*/ static PyStructSequence_Field struct_pwd_type_fields[] = { - {"pw_name", "user name"}, - {"pw_passwd", "password"}, - {"pw_uid", "user id"}, - {"pw_gid", "group id"}, - {"pw_gecos", "real name"}, - {"pw_dir", "home directory"}, - {"pw_shell", "shell program"}, + {"pw_name", PyDoc_STR("user name")}, + {"pw_passwd", PyDoc_STR("password")}, + {"pw_uid", PyDoc_STR("user id")}, + {"pw_gid", PyDoc_STR("group id")}, + {"pw_gecos", PyDoc_STR("real name")}, + {"pw_dir", PyDoc_STR("home directory")}, + {"pw_shell", PyDoc_STR("shell program")}, {0} }; diff --git a/Modules/resource.c b/Modules/resource.c index d65509ec3436a20..781dc5cf7955c2a 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -44,22 +44,22 @@ PyDoc_STRVAR(struct_rusage__doc__, "or via the attributes ru_utime, ru_stime, ru_maxrss, and so on."); static PyStructSequence_Field struct_rusage_fields[] = { - {"ru_utime", "user time used"}, - {"ru_stime", "system time used"}, - {"ru_maxrss", "max. resident set size"}, - {"ru_ixrss", "shared memory size"}, - {"ru_idrss", "unshared data size"}, - {"ru_isrss", "unshared stack size"}, - {"ru_minflt", "page faults not requiring I/O"}, - {"ru_majflt", "page faults requiring I/O"}, - {"ru_nswap", "number of swap outs"}, - {"ru_inblock", "block input operations"}, - {"ru_oublock", "block output operations"}, - {"ru_msgsnd", "IPC messages sent"}, - {"ru_msgrcv", "IPC messages received"}, - {"ru_nsignals", "signals received"}, - {"ru_nvcsw", "voluntary context switches"}, - {"ru_nivcsw", "involuntary context switches"}, + {"ru_utime", PyDoc_STR("user time used")}, + {"ru_stime", PyDoc_STR("system time used")}, + {"ru_maxrss", PyDoc_STR("max. resident set size")}, + {"ru_ixrss", PyDoc_STR("shared memory size")}, + {"ru_idrss", PyDoc_STR("unshared data size")}, + {"ru_isrss", PyDoc_STR("unshared stack size")}, + {"ru_minflt", PyDoc_STR("page faults not requiring I/O")}, + {"ru_majflt", PyDoc_STR("page faults requiring I/O")}, + {"ru_nswap", PyDoc_STR("number of swap outs")}, + {"ru_inblock", PyDoc_STR("block input operations")}, + {"ru_oublock", PyDoc_STR("block output operations")}, + {"ru_msgsnd", PyDoc_STR("IPC messages sent")}, + {"ru_msgrcv", PyDoc_STR("IPC messages received")}, + {"ru_nsignals", PyDoc_STR("signals received")}, + {"ru_nvcsw", PyDoc_STR("voluntary context switches")}, + {"ru_nivcsw", PyDoc_STR("involuntary context switches")}, {0} }; diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index c56e682b21e2a1e..bf537b60c5d7941 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -1089,7 +1089,7 @@ select_devpoll_fileno_impl(devpollObject *self) static PyGetSetDef devpoll_getsetlist[] = { {"closed", (getter)devpoll_get_closed, NULL, - "True if the devpoll object is closed"}, + PyDoc_STR("True if the devpoll object is closed")}, {0}, }; @@ -1683,7 +1683,7 @@ select_epoll___exit___impl(pyEpoll_Object *self, PyObject *exc_type, static PyGetSetDef pyepoll_getsetlist[] = { {"closed", (getter)pyepoll_get_closed, NULL, - "True if the epoll handler is closed"}, + PyDoc_STR("True if the epoll handler is closed")}, {0}, }; @@ -2260,7 +2260,7 @@ select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist, static PyGetSetDef kqueue_queue_getsetlist[] = { {"closed", (getter)kqueue_queue_get_closed, NULL, - "True if the kqueue handler is closed"}, + PyDoc_STR("True if the kqueue handler is closed")}, {0}, }; diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 8d6556727b3a5a7..84fd125c596294f 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -1092,13 +1092,13 @@ signal_valid_signals_impl(PyObject *module) #if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) static PyStructSequence_Field struct_siginfo_fields[] = { - {"si_signo", "signal number"}, - {"si_code", "signal code"}, - {"si_errno", "errno associated with this signal"}, - {"si_pid", "sending process ID"}, - {"si_uid", "real user ID of sending process"}, - {"si_status", "exit value or signal"}, - {"si_band", "band event for SIGPOLL"}, + {"si_signo", PyDoc_STR("signal number")}, + {"si_code", PyDoc_STR("signal code")}, + {"si_errno", PyDoc_STR("errno associated with this signal")}, + {"si_pid", PyDoc_STR("sending process ID")}, + {"si_uid", PyDoc_STR("real user ID of sending process")}, + {"si_status", PyDoc_STR("exit value or signal")}, + {"si_band", PyDoc_STR("band event for SIGPOLL")}, {0} }; diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 90592ffc152fc19..330c949b1057f30 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -5206,9 +5206,9 @@ static PyMethodDef sock_methods[] = { /* SockObject members */ static PyMemberDef sock_memberlist[] = { - {"family", Py_T_INT, offsetof(PySocketSockObject, sock_family), Py_READONLY, "the socket family"}, - {"type", Py_T_INT, offsetof(PySocketSockObject, sock_type), Py_READONLY, "the socket type"}, - {"proto", Py_T_INT, offsetof(PySocketSockObject, sock_proto), Py_READONLY, "the socket protocol"}, + {"family", Py_T_INT, offsetof(PySocketSockObject, sock_family), Py_READONLY, PyDoc_STR("the socket family")}, + {"type", Py_T_INT, offsetof(PySocketSockObject, sock_type), Py_READONLY, PyDoc_STR("the socket type")}, + {"proto", Py_T_INT, offsetof(PySocketSockObject, sock_proto), Py_READONLY, PyDoc_STR("the socket protocol")}, {0}, }; diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 6a872a285d289b8..412bd4309f7ed59 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -438,17 +438,17 @@ Delay execution for a given number of seconds. The argument may be\n\ a floating point number for subsecond precision."); static PyStructSequence_Field struct_time_type_fields[] = { - {"tm_year", "year, for example, 1993"}, - {"tm_mon", "month of year, range [1, 12]"}, - {"tm_mday", "day of month, range [1, 31]"}, - {"tm_hour", "hours, range [0, 23]"}, - {"tm_min", "minutes, range [0, 59]"}, - {"tm_sec", "seconds, range [0, 61])"}, - {"tm_wday", "day of week, range [0, 6], Monday is 0"}, - {"tm_yday", "day of year, range [1, 366]"}, - {"tm_isdst", "1 if summer time is in effect, 0 if not, and -1 if unknown"}, - {"tm_zone", "abbreviation of timezone name"}, - {"tm_gmtoff", "offset from UTC in seconds"}, + {"tm_year", PyDoc_STR("year, for example, 1993")}, + {"tm_mon", PyDoc_STR("month of year, range [1, 12]")}, + {"tm_mday", PyDoc_STR("day of month, range [1, 31]")}, + {"tm_hour", PyDoc_STR("hours, range [0, 23]")}, + {"tm_min", PyDoc_STR("minutes, range [0, 59]")}, + {"tm_sec", PyDoc_STR("seconds, range [0, 61])")}, + {"tm_wday", PyDoc_STR("day of week, range [0, 6], Monday is 0")}, + {"tm_yday", PyDoc_STR("day of year, range [1, 366]")}, + {"tm_isdst", PyDoc_STR("1 if summer time is in effect, 0 if not, and -1 if unknown")}, + {"tm_zone", PyDoc_STR("abbreviation of timezone name")}, + {"tm_gmtoff", PyDoc_STR("offset from UTC in seconds")}, {0} }; diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c index 1ff3ef1cb6f296e..50797a998764b91 100644 --- a/Modules/xxlimited_35.c +++ b/Modules/xxlimited_35.c @@ -110,7 +110,7 @@ Xxo_setattr(XxoObject *self, const char *name, PyObject *v) } static PyType_Slot Xxo_Type_slots[] = { - {Py_tp_doc, "The Xxo type"}, + {Py_tp_doc, PyDoc_STR("The Xxo type")}, {Py_tp_traverse, Xxo_traverse}, {Py_tp_clear, Xxo_clear}, {Py_tp_finalize, Xxo_finalize}, diff --git a/Objects/classobject.c b/Objects/classobject.c index 618d88894debbea..22ccc4b6bc17f15 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -154,9 +154,9 @@ static PyMethodDef method_methods[] = { static PyMemberDef method_memberlist[] = { {"__func__", _Py_T_OBJECT, MO_OFF(im_func), Py_READONLY, - "the function (or other callable) implementing a method"}, + PyDoc_STR("the function (or other callable) implementing a method")}, {"__self__", _Py_T_OBJECT, MO_OFF(im_self), Py_READONLY, - "the instance to which a method is bound"}, + PyDoc_STR("the instance to which a method is bound")}, {NULL} /* Sentinel */ }; @@ -376,7 +376,7 @@ PyInstanceMethod_Function(PyObject *im) static PyMemberDef instancemethod_memberlist[] = { {"__func__", _Py_T_OBJECT, IMO_OFF(func), Py_READONLY, - "the function (or other callable) implementing a method"}, + PyDoc_STR("the function (or other callable) implementing a method")}, {NULL} /* Sentinel */ }; diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 0e96f54584677cc..4cdcfb3376e648c 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -721,9 +721,9 @@ static PyMethodDef complex_methods[] = { static PyMemberDef complex_members[] = { {"real", Py_T_DOUBLE, offsetof(PyComplexObject, cval.real), Py_READONLY, - "the real part of a complex number"}, + PyDoc_STR("the real part of a complex number")}, {"imag", Py_T_DOUBLE, offsetof(PyComplexObject, cval.imag), Py_READONLY, - "the imaginary part of a complex number"}, + PyDoc_STR("the imaginary part of a complex number")}, {0}, }; diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 9c2402502188381..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, ""}, - {"flush", (PyCFunction)stdprinter_noop, METH_NOARGS, ""}, - {"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS, ""}, - {"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS, ""}, - {"write", (PyCFunction)stdprinter_write, METH_VARARGS, ""}, + {"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 */ }; @@ -415,9 +415,9 @@ get_encoding(PyStdPrinter_Object *self, void *closure) } static PyGetSetDef stdprinter_getsetlist[] = { - {"closed", (getter)get_closed, NULL, "True if the file is closed"}, - {"encoding", (getter)get_encoding, NULL, "Encoding of the file"}, - {"mode", (getter)get_mode, NULL, "String giving the file mode"}, + {"closed", (getter)get_closed, NULL, PyDoc_STR("True if the file is closed")}, + {"encoding", (getter)get_encoding, NULL, PyDoc_STR("Encoding of the file")}, + {"mode", (getter)get_mode, NULL, PyDoc_STR("String giving the file mode")}, {0}, }; diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 776c7092edd057b..c891d906de68a60 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -63,24 +63,24 @@ information about the precision and internal representation. Please study\n\ your system's :file:`float.h` for more information."); static PyStructSequence_Field floatinfo_fields[] = { - {"max", "DBL_MAX -- maximum representable finite float"}, - {"max_exp", "DBL_MAX_EXP -- maximum int e such that radix**(e-1) " - "is representable"}, - {"max_10_exp", "DBL_MAX_10_EXP -- maximum int e such that 10**e " - "is representable"}, - {"min", "DBL_MIN -- Minimum positive normalized float"}, - {"min_exp", "DBL_MIN_EXP -- minimum int e such that radix**(e-1) " - "is a normalized float"}, - {"min_10_exp", "DBL_MIN_10_EXP -- minimum int e such that 10**e is " - "a normalized float"}, - {"dig", "DBL_DIG -- maximum number of decimal digits that " - "can be faithfully represented in a float"}, - {"mant_dig", "DBL_MANT_DIG -- mantissa digits"}, - {"epsilon", "DBL_EPSILON -- Difference between 1 and the next " - "representable float"}, - {"radix", "FLT_RADIX -- radix of exponent"}, - {"rounds", "FLT_ROUNDS -- rounding mode used for arithmetic " - "operations"}, + {"max", PyDoc_STR("DBL_MAX -- maximum representable finite float")}, + {"max_exp", PyDoc_STR("DBL_MAX_EXP -- maximum int e such that radix**(e-1) " + "is representable")}, + {"max_10_exp", PyDoc_STR("DBL_MAX_10_EXP -- maximum int e such that 10**e " + "is representable")}, + {"min", PyDoc_STR("DBL_MIN -- Minimum positive normalized float")}, + {"min_exp", PyDoc_STR("DBL_MIN_EXP -- minimum int e such that radix**(e-1) " + "is a normalized float")}, + {"min_10_exp", PyDoc_STR("DBL_MIN_10_EXP -- minimum int e such that 10**e is " + "a normalized float")}, + {"dig", PyDoc_STR("DBL_DIG -- maximum number of decimal digits that " + "can be faithfully represented in a float")}, + {"mant_dig", PyDoc_STR("DBL_MANT_DIG -- mantissa digits")}, + {"epsilon", PyDoc_STR("DBL_EPSILON -- Difference between 1 and the next " + "representable float")}, + {"radix", PyDoc_STR("FLT_RADIX -- radix of exponent")}, + {"rounds", PyDoc_STR("FLT_ROUNDS -- rounding mode used for arithmetic " + "operations")}, {0} }; diff --git a/Objects/longobject.c b/Objects/longobject.c index e73de7422290056..77d68ac072aef66 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6154,18 +6154,18 @@ int_is_integer_impl(PyObject *self) static PyMethodDef long_methods[] = { {"conjugate", long_long_meth, METH_NOARGS, - "Returns self, the complex conjugate of any int."}, + PyDoc_STR("Returns self, the complex conjugate of any int.")}, INT_BIT_LENGTH_METHODDEF INT_BIT_COUNT_METHODDEF INT_TO_BYTES_METHODDEF INT_FROM_BYTES_METHODDEF INT_AS_INTEGER_RATIO_METHODDEF {"__trunc__", long_long_meth, METH_NOARGS, - "Truncating an Integral returns itself."}, + PyDoc_STR("Truncating an Integral returns itself.")}, {"__floor__", long_long_meth, METH_NOARGS, - "Flooring an Integral returns itself."}, + PyDoc_STR("Flooring an Integral returns itself.")}, {"__ceil__", long_long_meth, METH_NOARGS, - "Ceiling of an Integral returns itself."}, + PyDoc_STR("Ceiling of an Integral returns itself.")}, INT___ROUND___METHODDEF INT___GETNEWARGS___METHODDEF INT___FORMAT___METHODDEF @@ -6300,10 +6300,10 @@ A named tuple that holds information about Python's\n\ internal representation of integers. The attributes are read only."); static PyStructSequence_Field int_info_fields[] = { - {"bits_per_digit", "size of a digit in bits"}, - {"sizeof_digit", "size in bytes of the C type used to represent a digit"}, - {"default_max_str_digits", "maximum string conversion digits limitation"}, - {"str_digits_check_threshold", "minimum positive value for int_max_str_digits"}, + {"bits_per_digit", PyDoc_STR("size of a digit in bits")}, + {"sizeof_digit", PyDoc_STR("size in bytes of the C type used to represent a digit")}, + {"default_max_str_digits", PyDoc_STR("maximum string conversion digits limitation")}, + {"str_digits_check_threshold", PyDoc_STR("minimum positive value for int_max_str_digits")}, {NULL, NULL} }; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 84c50507691cbe4..3ba5dd5bf4125a9 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -10199,11 +10199,11 @@ typedef struct { static PyMemberDef super_members[] = { {"__thisclass__", _Py_T_OBJECT, offsetof(superobject, type), Py_READONLY, - "the class invoking super()"}, + PyDoc_STR("the class invoking super()")}, {"__self__", _Py_T_OBJECT, offsetof(superobject, obj), Py_READONLY, - "the instance invoking super(); may be None"}, + PyDoc_STR("the instance invoking super(); may be None")}, {"__self_class__", _Py_T_OBJECT, offsetof(superobject, obj_type), Py_READONLY, - "the type of the instance invoking super(); may be None"}, + PyDoc_STR("the type of the instance invoking super(); may be None")}, {0} }; diff --git a/Python/errors.c b/Python/errors.c index f670b78c1f14efd..72c5d90c1ae7798 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -1327,11 +1327,11 @@ Type used to pass arguments to sys.unraisablehook."); static PyTypeObject UnraisableHookArgsType; static PyStructSequence_Field UnraisableHookArgs_fields[] = { - {"exc_type", "Exception type"}, - {"exc_value", "Exception value"}, - {"exc_traceback", "Exception traceback"}, - {"err_msg", "Error message"}, - {"object", "Object causing the exception"}, + {"exc_type", PyDoc_STR("Exception type")}, + {"exc_value", PyDoc_STR("Exception value")}, + {"exc_traceback", PyDoc_STR("Exception traceback")}, + {"err_msg", PyDoc_STR("Error message")}, + {"object", PyDoc_STR("Object causing the exception")}, {0} }; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index fed12812a77089f..25fcdb3972eddc6 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1331,8 +1331,8 @@ A named tuple providing information about asynchronous\n\ generators hooks. The attributes are read only."); static PyStructSequence_Field asyncgen_hooks_fields[] = { - {"firstiter", "Hook to intercept first iteration"}, - {"finalizer", "Hook to intercept finalization"}, + {"firstiter", PyDoc_STR("Hook to intercept first iteration")}, + {"finalizer", PyDoc_STR("Hook to intercept finalization")}, {0} }; @@ -1440,17 +1440,17 @@ A named tuple providing parameters used for computing\n\ hashes. The attributes are read only."); static PyStructSequence_Field hash_info_fields[] = { - {"width", "width of the type used for hashing, in bits"}, - {"modulus", "prime number giving the modulus on which the hash " - "function is based"}, - {"inf", "value to be used for hash of a positive infinity"}, - {"nan", "value to be used for hash of a nan"}, - {"imag", "multiplier used for the imaginary part of a complex number"}, - {"algorithm", "name of the algorithm for hashing of str, bytes and " - "memoryviews"}, - {"hash_bits", "internal output size of hash algorithm"}, - {"seed_bits", "seed size of hash algorithm"}, - {"cutoff", "small string optimization cutoff"}, + {"width", PyDoc_STR("width of the type used for hashing, in bits")}, + {"modulus", PyDoc_STR("prime number giving the modulus on which the hash " + "function is based")}, + {"inf", PyDoc_STR("value to be used for hash of a positive infinity")}, + {"nan", PyDoc_STR("value to be used for hash of a nan")}, + {"imag", PyDoc_STR("multiplier used for the imaginary part of a complex number")}, + {"algorithm", PyDoc_STR("name of the algorithm for hashing of str, bytes and " + "memoryviews")}, + {"hash_bits", PyDoc_STR("internal output size of hash algorithm")}, + {"seed_bits", PyDoc_STR("seed size of hash algorithm")}, + {"cutoff", PyDoc_STR("small string optimization cutoff")}, {NULL, NULL} }; @@ -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", "Major version number"}, - {"minor", "Minor version number"}, - {"build", "Build number"}, - {"platform", "Operating system platform"}, - {"service_pack", "Latest Service Pack installed on the system"}, - {"service_pack_major", "Service Pack major version number"}, - {"service_pack_minor", "Service Pack minor version number"}, - {"suite_mask", "Bit mask identifying available product suites"}, - {"product_type", "System product type"}, - {"platform_version", "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} }; @@ -2917,24 +2917,24 @@ Flags provided through command line arguments or environment vars."); static PyTypeObject FlagsType; static PyStructSequence_Field flags_fields[] = { - {"debug", "-d"}, - {"inspect", "-i"}, - {"interactive", "-i"}, - {"optimize", "-O or -OO"}, - {"dont_write_bytecode", "-B"}, - {"no_user_site", "-s"}, - {"no_site", "-S"}, - {"ignore_environment", "-E"}, - {"verbose", "-v"}, - {"bytes_warning", "-b"}, - {"quiet", "-q"}, - {"hash_randomization", "-R"}, - {"isolated", "-I"}, - {"dev_mode", "-X dev"}, - {"utf8_mode", "-X utf8"}, - {"warn_default_encoding", "-X warn_default_encoding"}, - {"safe_path", "-P"}, - {"int_max_str_digits", "-X int_max_str_digits"}, + {"debug", PyDoc_STR("-d")}, + {"inspect", PyDoc_STR("-i")}, + {"interactive", PyDoc_STR("-i")}, + {"optimize", PyDoc_STR("-O or -OO")}, + {"dont_write_bytecode", PyDoc_STR("-B")}, + {"no_user_site", PyDoc_STR("-s")}, + {"no_site", PyDoc_STR("-S")}, + {"ignore_environment", PyDoc_STR("-E")}, + {"verbose", PyDoc_STR("-v")}, + {"bytes_warning", PyDoc_STR("-b")}, + {"quiet", PyDoc_STR("-q")}, + {"hash_randomization", PyDoc_STR("-R")}, + {"isolated", PyDoc_STR("-I")}, + {"dev_mode", PyDoc_STR("-X dev")}, + {"utf8_mode", PyDoc_STR("-X utf8")}, + {"warn_default_encoding", PyDoc_STR("-X warn_default_encoding")}, + {"safe_path", PyDoc_STR("-P")}, + {"int_max_str_digits", PyDoc_STR("-X int_max_str_digits")}, {0} }; @@ -3014,11 +3014,11 @@ Version information as a named tuple."); static PyTypeObject VersionInfoType; static PyStructSequence_Field version_info_fields[] = { - {"major", "Major release number"}, - {"minor", "Minor release number"}, - {"micro", "Patch release number"}, - {"releaselevel", "'alpha', 'beta', 'candidate', or 'final'"}, - {"serial", "Serial release number"}, + {"major", PyDoc_STR("Major release number")}, + {"minor", PyDoc_STR("Minor release number")}, + {"micro", PyDoc_STR("Patch release number")}, + {"releaselevel", PyDoc_STR("'alpha', 'beta', 'candidate', or 'final'")}, + {"serial", PyDoc_STR("Serial release number")}, {0} }; @@ -3158,10 +3158,10 @@ WebAssembly Emscripten platform information."); static PyTypeObject *EmscriptenInfoType; static PyStructSequence_Field emscripten_info_fields[] = { - {"emscripten_version", "Emscripten version (major, minor, micro)"}, - {"runtime", "Runtime (Node.JS version, browser user agent)"}, - {"pthreads", "pthread support"}, - {"shared_memory", "shared memory support"}, + {"emscripten_version", PyDoc_STR("Emscripten version (major, minor, micro)")}, + {"runtime", PyDoc_STR("Runtime (Node.JS version, browser user agent)")}, + {"pthreads", PyDoc_STR("pthread support")}, + {"shared_memory", PyDoc_STR("shared memory support")}, {0} }; diff --git a/Python/thread.c b/Python/thread.c index 1ac2db2937e3738..6f0a5a64733306a 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -111,9 +111,9 @@ PyDoc_STRVAR(threadinfo__doc__, A named tuple holding information about the thread implementation."); static PyStructSequence_Field threadinfo_fields[] = { - {"name", "name of the thread implementation"}, - {"lock", "name of the lock implementation"}, - {"version", "name and version of the thread library"}, + {"name", PyDoc_STR("name of the thread implementation")}, + {"lock", PyDoc_STR("name of the lock implementation")}, + {"version", PyDoc_STR("name and version of the thread library")}, {0} }; diff --git a/Tools/peg_generator/peg_extension/peg_extension.c b/Tools/peg_generator/peg_extension/peg_extension.c index 7df134b5ade8bbe..5d625bee9677877 100644 --- a/Tools/peg_generator/peg_extension/peg_extension.c +++ b/Tools/peg_generator/peg_extension/peg_extension.c @@ -150,8 +150,8 @@ dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored)) } static PyMethodDef ParseMethods[] = { - {"parse_file", _PyCFunction_CAST(parse_file), METH_VARARGS|METH_KEYWORDS, "Parse a file."}, - {"parse_string", _PyCFunction_CAST(parse_string), METH_VARARGS|METH_KEYWORDS, "Parse a string."}, + {"parse_file", _PyCFunction_CAST(parse_file), METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Parse a file.")}, + {"parse_string", _PyCFunction_CAST(parse_string), METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Parse a string.")}, {"clear_memo_stats", clear_memo_stats, METH_NOARGS}, {"dump_memo_stats", dump_memo_stats, METH_NOARGS}, {"get_memo_stats", get_memo_stats, METH_NOARGS}, @@ -161,7 +161,7 @@ static PyMethodDef ParseMethods[] = { static struct PyModuleDef parsemodule = { PyModuleDef_HEAD_INIT, .m_name = "parse", - .m_doc = "A parser.", + .m_doc = PyDoc_STR("A parser."), .m_methods = ParseMethods, };