From 1117ad5b1849b0fe151357058bf6f240c120039a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Thu, 13 Jun 2002 20:33:02 +0000 Subject: Patch #568124: Add doc string macros. --- Modules/_hotshot.c | 65 +++--- Modules/_localemodule.c | 47 ++--- Modules/_ssl.c | 28 +-- Modules/_weakref.c | 16 +- Modules/almodule.c | 207 ++++++++----------- Modules/arraymodule.c | 80 ++++---- Modules/binascii.c | 40 ++-- Modules/cPickle.c | 19 +- Modules/cStringIO.c | 83 ++++---- Modules/cmathmodule.c | 68 +++---- Modules/cryptmodule.c | 6 +- Modules/errnomodule.c | 4 +- Modules/fcntlmodule.c | 22 +-- Modules/gcmodule.c | 54 +++-- Modules/gdbmmodule.c | 60 +++--- Modules/grpmodule.c | 8 +- Modules/mathmodule.c | 36 ++-- Modules/md5module.c | 31 ++- Modules/newmodule.c | 28 +-- Modules/operator.c | 12 +- Modules/parsermodule.c | 13 +- Modules/posixmodule.c | 450 +++++++++++++++++++++--------------------- Modules/pwdmodule.c | 30 +-- Modules/pyexpat.c | 43 ++-- Modules/readline.c | 132 ++++++------- Modules/resource.c | 12 +- Modules/selectmodule.c | 24 +-- Modules/shamodule.c | 23 ++- Modules/signalmodule.c | 37 ++-- Modules/socketmodule.c | 164 +++++++-------- Modules/stropmodule.c | 86 ++++---- Modules/structmodule.c | 31 ++- Modules/termios.c | 42 ++-- Modules/threadmodule.c | 36 ++-- Modules/timemodule.c | 46 ++--- Modules/unicodedata.c | 2 +- Modules/xreadlinesmodule.c | 6 +- Modules/xxsubtype.c | 4 +- Modules/zlibmodule.c | 44 ++--- Objects/boolobject.c | 4 +- Objects/cobject.c | 4 +- Objects/complexobject.c | 4 +- Objects/descrobject.c | 4 +- Objects/dictobject.c | 60 +++--- Objects/enumobject.c | 4 +- Objects/fileobject.c | 66 ++++--- Objects/floatobject.c | 4 +- Objects/funcobject.c | 8 +- Objects/intobject.c | 4 +- Objects/listobject.c | 36 ++-- Objects/longobject.c | 4 +- Objects/moduleobject.c | 4 +- Objects/rangeobject.c | 4 +- Objects/stringobject.c | 144 +++++++------- Objects/tupleobject.c | 4 +- Objects/typeobject.c | 8 +- Objects/unicodeobject.c | 148 +++++++------- PC/_winreg.c | 83 ++++---- PC/winsound.c | 12 +- Python/bltinmodule.c | 184 ++++++++--------- Python/exceptions.c | 149 ++++++-------- Python/import.c | 49 ++--- RISCOS/Modules/riscosmodule.c | 4 +- 63 files changed, 1509 insertions(+), 1625 deletions(-) diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index 4399525852..06a68241e7 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -101,9 +101,9 @@ static PyObject * ProfilerError = NULL; /* The log reader... */ -static char logreader_close__doc__[] = +PyDoc_STRVAR(logreader_close__doc__, "close()\n" -"Close the log file, preventing additional records from being read."; +"Close the log file, preventing additional records from being read."); static PyObject * logreader_close(LogReaderObject *self, PyObject *args) @@ -522,9 +522,9 @@ logreader_sq_item(LogReaderObject *self, int index) return result; } -static char next__doc__[] = +PyDoc_STRVAR(next__doc__, "next() -> event-info\n" -"Return the next event record from the log file."; +"Return the next event record from the log file."); static PyObject * logreader_next(LogReaderObject *self, PyObject *args) @@ -1021,9 +1021,9 @@ is_available(ProfilerObject *self) /* Profiler object interface methods. */ -static char addinfo__doc__[] = +PyDoc_STRVAR(addinfo__doc__, "addinfo(key, value)\n" -"Insert an ADD_INFO record into the log."; +"Insert an ADD_INFO record into the log."); static PyObject * profiler_addinfo(ProfilerObject *self, PyObject *args) @@ -1044,9 +1044,9 @@ profiler_addinfo(ProfilerObject *self, PyObject *args) return result; } -static char close__doc__[] = +PyDoc_STRVAR(close__doc__, "close()\n" -"Shut down this profiler and close the log files, even if its active."; +"Shut down this profiler and close the log files, even if its active."); static PyObject * profiler_close(ProfilerObject *self, PyObject *args) @@ -1065,9 +1065,9 @@ profiler_close(ProfilerObject *self, PyObject *args) return result; } -static char runcall__doc__[] = +PyDoc_STRVAR(runcall__doc__, "runcall(callable[, args[, kw]]) -> callable()\n" -"Profile a specific function call, returning the result of that call."; +"Profile a specific function call, returning the result of that call."); static PyObject * profiler_runcall(ProfilerObject *self, PyObject *args) @@ -1088,10 +1088,10 @@ profiler_runcall(ProfilerObject *self, PyObject *args) return result; } -static char runcode__doc__[] = +PyDoc_STRVAR(runcode__doc__, "runcode(code, globals[, locals])\n" "Execute a code object while collecting profile data. If locals is\n" -"omitted, globals is used for the locals as well."; +"omitted, globals is used for the locals as well."); static PyObject * profiler_runcode(ProfilerObject *self, PyObject *args) @@ -1127,9 +1127,9 @@ profiler_runcode(ProfilerObject *self, PyObject *args) return result; } -static char start__doc__[] = +PyDoc_STRVAR(start__doc__, "start()\n" -"Install this profiler for the current thread."; +"Install this profiler for the current thread."); static PyObject * profiler_start(ProfilerObject *self, PyObject *args) @@ -1146,9 +1146,9 @@ profiler_start(ProfilerObject *self, PyObject *args) return result; } -static char stop__doc__[] = +PyDoc_STRVAR(stop__doc__, "stop()\n" -"Remove this profiler from the current thread."; +"Remove this profiler from the current thread."); static PyObject * profiler_stop(ProfilerObject *self, PyObject *args) @@ -1225,7 +1225,7 @@ profiler_getattr(ProfilerObject *self, char *name) } -static char profiler_object__doc__[] = +PyDoc_STRVAR(profiler_object__doc__, "High-performance profiler object.\n" "\n" "Methods:\n" @@ -1241,7 +1241,7 @@ static char profiler_object__doc__[] = "closed: True if the profiler has already been closed.\n" "frametimings: True if ENTER/EXIT events collect timing information.\n" "lineevents: True if SET_LINENO events are reported to the profiler.\n" -"linetimings: True if SET_LINENO events collect timing information."; +"linetimings: True if SET_LINENO events collect timing information."); static PyTypeObject ProfilerType = { PyObject_HEAD_INIT(NULL) @@ -1288,9 +1288,9 @@ logreader_getattr(LogReaderObject *self, char *name) } -static char logreader__doc__[] = "\ -logreader(filename) --> log-iterator\n\ -Create a log-reader for the timing information file."; +PyDoc_STRVAR(logreader__doc__, +"logreader(filename) --> log-iterator\n\ +Create a log-reader for the timing information file."); static PySequenceMethods logreader_as_sequence = { 0, /* sq_length */ @@ -1476,9 +1476,9 @@ write_header(ProfilerObject *self) return 0; } -static char profiler__doc__[] = "\ -profiler(logfilename[, lineevents[, linetimes]]) -> profiler\n\ -Create a new profiler object."; +PyDoc_STRVAR(profiler__doc__, +"profiler(logfilename[, lineevents[, linetimes]]) -> profiler\n\ +Create a new profiler object."); static PyObject * hotshot_profiler(PyObject *unused, PyObject *args) @@ -1529,10 +1529,10 @@ hotshot_profiler(PyObject *unused, PyObject *args) return (PyObject *) self; } -static char coverage__doc__[] = "\ -coverage(logfilename) -> profiler\n\ +PyDoc_STRVAR(coverage__doc__, +"coverage(logfilename) -> profiler\n\ Returns a profiler that doesn't collect any timing information, which is\n\ -useful in building a coverage analysis tool."; +useful in building a coverage analysis tool."); static PyObject * hotshot_coverage(PyObject *unused, PyObject *args) @@ -1552,17 +1552,22 @@ hotshot_coverage(PyObject *unused, PyObject *args) return result; } -static char resolution__doc__[] = +PyDoc_VAR(resolution__doc__) = #ifdef MS_WIN32 +PyDoc_STR( "resolution() -> (performance-counter-ticks, update-frequency)\n" "Return the resolution of the timer provided by the QueryPerformanceCounter()\n" "function. The first value is the smallest observed change, and the second\n" -"is the result of QueryPerformanceFrequency()."; +"is the result of QueryPerformanceFrequency()." +) #else +PyDoc_STR( "resolution() -> (gettimeofday-usecs, getrusage-usecs)\n" "Return the resolution of the timers provided by the gettimeofday() and\n" -"getrusage() system calls, or -1 if the call is not supported."; +"getrusage() system calls, or -1 if the call is not supported." +) #endif +; static PyObject * hotshot_resolution(PyObject *unused, PyObject *args) diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 06f5346029..e6bacb40ba 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -38,15 +38,14 @@ This software comes with no warranty. Use at your own risk. char *strdup(const char *); #endif -static char locale__doc__[] = "Support for POSIX locales."; +PyDoc_STRVAR(locale__doc__, "Support for POSIX locales."); static PyObject *Error; /* support functions for formatting floating point numbers */ -static char setlocale__doc__[] = -"(integer,string=None) -> string. Activates/queries locale processing." -; +PyDoc_STRVAR(setlocale__doc__, +"(integer,string=None) -> string. Activates/queries locale processing."); /* to record the LC_NUMERIC settings */ static PyObject* grouping = NULL; @@ -244,9 +243,8 @@ PyLocale_setlocale(PyObject* self, PyObject* args) return result_object; } -static char localeconv__doc__[] = -"() -> dict. Returns numeric and monetary locale-specific parameters." -; +PyDoc_STRVAR(localeconv__doc__, +"() -> dict. Returns numeric and monetary locale-specific parameters."); static PyObject* PyLocale_localeconv(PyObject* self) @@ -321,9 +319,8 @@ PyLocale_localeconv(PyObject* self) return NULL; } -static char strcoll__doc__[] = -"string,string -> int. Compares two strings according to the locale." -; +PyDoc_STRVAR(strcoll__doc__, +"string,string -> int. Compares two strings according to the locale."); static PyObject* PyLocale_strcoll(PyObject* self, PyObject* args) @@ -335,9 +332,8 @@ PyLocale_strcoll(PyObject* self, PyObject* args) return PyInt_FromLong(strcoll(s1, s2)); } -static char strxfrm__doc__[] = -"string -> string. Returns a string that behaves for cmp locale-aware." -; +PyDoc_STRVAR(strxfrm__doc__, +"string -> string. Returns a string that behaves for cmp locale-aware."); static PyObject* PyLocale_strxfrm(PyObject* self, PyObject* args) @@ -521,10 +517,9 @@ struct langinfo_constant{ {0, 0} }; -static char nl_langinfo__doc__[] = +PyDoc_STRVAR(nl_langinfo__doc__, "nl_langinfo(key) -> string\n" -"Return the value for the locale information associated with key." -; +"Return the value for the locale information associated with key."); static PyObject* PyLocale_nl_langinfo(PyObject* self, PyObject* args) @@ -545,9 +540,9 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args) #ifdef HAVE_LIBINTL_H -static char gettext__doc__[]= +PyDoc_STRVAR(gettext__doc__, "gettext(msg) -> string\n" -"Return translation of msg."; +"Return translation of msg."); static PyObject* PyIntl_gettext(PyObject* self, PyObject *args) @@ -558,9 +553,9 @@ PyIntl_gettext(PyObject* self, PyObject *args) return PyString_FromString(gettext(in)); } -static char dgettext__doc__[]= +PyDoc_STRVAR(dgettext__doc__, "dgettext(domain, msg) -> string\n" -"Return translation of msg in domain."; +"Return translation of msg in domain."); static PyObject* PyIntl_dgettext(PyObject* self, PyObject *args) @@ -571,9 +566,9 @@ PyIntl_dgettext(PyObject* self, PyObject *args) return PyString_FromString(dgettext(domain, in)); } -static char dcgettext__doc__[]= +PyDoc_STRVAR(dcgettext__doc__, "dcgettext(domain, msg, category) -> string\n" -"Return translation of msg in domain and category."; +"Return translation of msg in domain and category."); static PyObject* PyIntl_dcgettext(PyObject *self, PyObject *args) @@ -585,9 +580,9 @@ PyIntl_dcgettext(PyObject *self, PyObject *args) return PyString_FromString(dcgettext(domain,msgid,category)); } -static char textdomain__doc__[]= +PyDoc_STRVAR(textdomain__doc__, "textdomain(domain) -> string\n" -"Set the C library's textdmain to domain, returning the new domain."; +"Set the C library's textdmain to domain, returning the new domain."); static PyObject* PyIntl_textdomain(PyObject* self, PyObject* args) @@ -603,9 +598,9 @@ PyIntl_textdomain(PyObject* self, PyObject* args) return PyString_FromString(domain); } -static char bindtextdomain__doc__[]= +PyDoc_STRVAR(bindtextdomain__doc__, "bindtextdomain(domain, dir) -> string\n" -"Bind the C library's domain to dir."; +"Bind the C library's domain to dir."); static PyObject* PyIntl_bindtextdomain(PyObject* self,PyObject*args) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 1b05e40e6e..d8353e4045 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -259,8 +259,8 @@ PySocket_ssl(PyObject *self, PyObject *args) return (PyObject *)rv; } -static char ssl_doc[] = -"ssl(socket, [keyfile, certfile]) -> sslobject"; +PyDoc_STRVAR(ssl_doc, +"ssl(socket, [keyfile, certfile]) -> sslobject"); /* SSL object methods */ @@ -306,11 +306,11 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args) return PySSL_SetError(self, len); } -static char PySSL_SSLwrite_doc[] = +PyDoc_STRVAR(PySSL_SSLwrite_doc, "write(s) -> len\n\ \n\ Writes the string s into the SSL object. Returns the number\n\ -of bytes written."; +of bytes written."); static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) { @@ -336,10 +336,10 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) return buf; } -static char PySSL_SSLread_doc[] = +PyDoc_STRVAR(PySSL_SSLread_doc, "read([len]) -> string\n\ \n\ -Read up to len bytes from the SSL socket."; +Read up to len bytes from the SSL socket."); static PyMethodDef PySSLMethods[] = { {"write", (PyCFunction)PySSL_SSLwrite, METH_VARARGS, @@ -392,11 +392,11 @@ PySSL_RAND_add(PyObject *self, PyObject *args) return Py_None; } -static char PySSL_RAND_add_doc[] = +PyDoc_STRVAR(PySSL_RAND_add_doc, "RAND_add(string, entropy)\n\ \n\ Mix string into the OpenSSL PRNG state. entropy (a float) is a lower\n\ -bound on the entropy contained in string."; +bound on the entropy contained in string."); static PyObject * PySSL_RAND_status(PyObject *self) @@ -404,12 +404,12 @@ PySSL_RAND_status(PyObject *self) return PyInt_FromLong(RAND_status()); } -static char PySSL_RAND_status_doc[] = +PyDoc_STRVAR(PySSL_RAND_status_doc, "RAND_status() -> 0 or 1\n\ \n\ Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n\ It is necessary to seed the PRNG with RAND_add() on some platforms before\n\ -using the ssl() function."; +using the ssl() function."); static PyObject * PySSL_RAND_egd(PyObject *self, PyObject *arg) @@ -430,12 +430,12 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg) return PyInt_FromLong(bytes); } -static char PySSL_RAND_egd_doc[] = +PyDoc_STRVAR(PySSL_RAND_egd_doc, "RAND_egd(path) -> bytes\n\ \n\ Queries the entropy gather daemon (EGD) on socket path. Returns number\n\ of bytes read. Raises socket.sslerror if connection to EGD fails or\n\ -if it does provide enough data to seed PRNG."; +if it does provide enough data to seed PRNG."); #endif @@ -456,9 +456,9 @@ static PyMethodDef PySSL_methods[] = { }; -static char module_doc[] = +PyDoc_STRVAR(module_doc, "Implementation module for SSL socket operations. See the socket module\n\ -for documentation."; +for documentation."); DL_EXPORT(void) init_ssl(void) diff --git a/Modules/_weakref.c b/Modules/_weakref.c index f797fbf00e..31e63d1859 100644 --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -5,9 +5,9 @@ ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) -static char weakref_getweakrefcount__doc__[] = +PyDoc_STRVAR(weakref_getweakrefcount__doc__, "getweakrefcount(object) -- return the number of weak references\n" -"to 'object'."; +"to 'object'."); static PyObject * weakref_getweakrefcount(PyObject *self, PyObject *object) @@ -26,9 +26,9 @@ weakref_getweakrefcount(PyObject *self, PyObject *object) } -static char weakref_getweakrefs__doc__[] = +PyDoc_STRVAR(weakref_getweakrefs__doc__, "getweakrefs(object) -- return a list of all weak reference objects\n" -"that point to 'object'."; +"that point to 'object'."); static PyObject * weakref_getweakrefs(PyObject *self, PyObject *object) @@ -57,10 +57,10 @@ weakref_getweakrefs(PyObject *self, PyObject *object) } -static char weakref_ref__doc__[] = +PyDoc_STRVAR(weakref_ref__doc__, "new(object[, callback]) -- create a weak reference to 'object';\n" "when 'object' is finalized, 'callback' will be called and passed\n" -"a reference to 'object'."; +"a reference to 'object'."); static PyObject * weakref_ref(PyObject *self, PyObject *args) @@ -76,10 +76,10 @@ weakref_ref(PyObject *self, PyObject *args) } -static char weakref_proxy__doc__[] = +PyDoc_STRVAR(weakref_proxy__doc__, "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" -"reference to the proxy when it is about to be finalized."; +"reference to the proxy when it is about to be finalized."); static PyObject * weakref_proxy(PyObject *self, PyObject *args) diff --git a/Modules/almodule.c b/Modules/almodule.c index 31af258fb1..05c4bef97d 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -272,9 +272,8 @@ GetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig)) return PyInt_FromLong((long) par); } -static char alc_SetWidth__doc__[] = -"alSetWidth: set the wordsize for integer audio data." -; +PyDoc_STRVAR(alc_SetWidth__doc__, +"alSetWidth: set the wordsize for integer audio data."); static PyObject * alc_SetWidth(alcobject *self, PyObject *args) @@ -283,9 +282,8 @@ alc_SetWidth(alcobject *self, PyObject *args) } -static char alc_GetWidth__doc__[] = -"alGetWidth: get the wordsize for integer audio data." -; +PyDoc_STRVAR(alc_GetWidth__doc__, +"alGetWidth: get the wordsize for integer audio data."); static PyObject * alc_GetWidth(alcobject *self, PyObject *args) @@ -294,9 +292,9 @@ alc_GetWidth(alcobject *self, PyObject *args) } -static char alc_SetSampFmt__doc__[] = -"alSetSampFmt: set the sample format setting in an audio ALconfig structure." -; +PyDoc_STRVAR(alc_SetSampFmt__doc__, +"alSetSampFmt: set the sample format setting in an audio ALconfig " +"structure."); static PyObject * alc_SetSampFmt(alcobject *self, PyObject *args) @@ -305,9 +303,9 @@ alc_SetSampFmt(alcobject *self, PyObject *args) } -static char alc_GetSampFmt__doc__[] = -"alGetSampFmt: get the sample format setting in an audio ALconfig structure." -; +PyDoc_STRVAR(alc_GetSampFmt__doc__, +"alGetSampFmt: get the sample format setting in an audio ALconfig " +"structure."); static PyObject * alc_GetSampFmt(alcobject *self, PyObject *args) @@ -316,9 +314,8 @@ alc_GetSampFmt(alcobject *self, PyObject *args) } -static char alc_SetChannels__doc__[] = -"alSetChannels: set the channel settings in an audio ALconfig." -; +PyDoc_STRVAR(alc_SetChannels__doc__, +"alSetChannels: set the channel settings in an audio ALconfig."); static PyObject * alc_SetChannels(alcobject *self, PyObject *args) @@ -327,9 +324,8 @@ alc_SetChannels(alcobject *self, PyObject *args) } -static char alc_GetChannels__doc__[] = -"alGetChannels: get the channel settings in an audio ALconfig." -; +PyDoc_STRVAR(alc_GetChannels__doc__, +"alGetChannels: get the channel settings in an audio ALconfig."); static PyObject * alc_GetChannels(alcobject *self, PyObject *args) @@ -338,9 +334,8 @@ alc_GetChannels(alcobject *self, PyObject *args) } -static char alc_SetFloatMax__doc__[] = -"alSetFloatMax: set the maximum value of floating point sample data." -; +PyDoc_STRVAR(alc_SetFloatMax__doc__, +"alSetFloatMax: set the maximum value of floating point sample data."); static PyObject * alc_SetFloatMax(alcobject *self, PyObject *args) @@ -356,9 +351,8 @@ alc_SetFloatMax(alcobject *self, PyObject *args) } -static char alc_GetFloatMax__doc__[] = -"alGetFloatMax: get the maximum value of floating point sample data." -; +PyDoc_STRVAR(alc_GetFloatMax__doc__, +"alGetFloatMax: get the maximum value of floating point sample data."); static PyObject * alc_GetFloatMax(alcobject *self, PyObject *args) @@ -373,9 +367,8 @@ alc_GetFloatMax(alcobject *self, PyObject *args) } -static char alc_SetDevice__doc__[] = -"alSetDevice: set the device setting in an audio ALconfig structure." -; +PyDoc_STRVAR(alc_SetDevice__doc__, +"alSetDevice: set the device setting in an audio ALconfig structure."); static PyObject * alc_SetDevice(alcobject *self, PyObject *args) @@ -384,9 +377,8 @@ alc_SetDevice(alcobject *self, PyObject *args) } -static char alc_GetDevice__doc__[] = -"alGetDevice: get the device setting in an audio ALconfig structure." -; +PyDoc_STRVAR(alc_GetDevice__doc__, +"alGetDevice: get the device setting in an audio ALconfig structure."); static PyObject * alc_GetDevice(alcobject *self, PyObject *args) @@ -395,9 +387,8 @@ alc_GetDevice(alcobject *self, PyObject *args) } -static char alc_SetQueueSize__doc__[] = -"alSetQueueSize: set audio port buffer size." -; +PyDoc_STRVAR(alc_SetQueueSize__doc__, +"alSetQueueSize: set audio port buffer size."); static PyObject * alc_SetQueueSize(alcobject *self, PyObject *args) @@ -406,9 +397,8 @@ alc_SetQueueSize(alcobject *self, PyObject *args) } -static char alc_GetQueueSize__doc__[] = -"alGetQueueSize: get audio port buffer size." -; +PyDoc_STRVAR(alc_GetQueueSize__doc__, +"alGetQueueSize: get audio port buffer size."); static PyObject * alc_GetQueueSize(alcobject *self, PyObject *args) @@ -590,9 +580,7 @@ alc_getattr(alcobject *self, char *name) return Py_FindMethod(alc_methods, (PyObject *)self, name); } -static char Alctype__doc__[] = -"" -; +PyDoc_STRVAR(Alctype__doc__, ""); static PyTypeObject Alctype = { PyObject_HEAD_INIT(&PyType_Type) @@ -624,9 +612,8 @@ static PyTypeObject Alctype = { #ifdef AL_NO_ELEM /* IRIX 6 */ -static char alp_SetConfig__doc__[] = -"alSetConfig: set the ALconfig of an audio ALport." -; +PyDoc_STRVAR(alp_SetConfig__doc__, +"alSetConfig: set the ALconfig of an audio ALport."); static PyObject * alp_SetConfig(alpobject *self, PyObject *args) @@ -641,9 +628,8 @@ alp_SetConfig(alpobject *self, PyObject *args) } -static char alp_GetConfig__doc__[] = -"alGetConfig: get the ALconfig of an audio ALport." -; +PyDoc_STRVAR(alp_GetConfig__doc__, +"alGetConfig: get the ALconfig of an audio ALport."); static PyObject * alp_GetConfig(alpobject *self, PyObject *args) @@ -657,9 +643,8 @@ alp_GetConfig(alpobject *self, PyObject *args) } -static char alp_GetResource__doc__[] = -"alGetResource: get the resource associated with an audio port." -; +PyDoc_STRVAR(alp_GetResource__doc__, +"alGetResource: get the resource associated with an audio port."); static PyObject * alp_GetResource(alpobject *self, PyObject *args) @@ -674,9 +659,8 @@ alp_GetResource(alpobject *self, PyObject *args) } -static char alp_GetFD__doc__[] = -"alGetFD: get the file descriptor for an audio port." -; +PyDoc_STRVAR(alp_GetFD__doc__, +"alGetFD: get the file descriptor for an audio port."); static PyObject * alp_GetFD(alpobject *self, PyObject *args) @@ -693,9 +677,9 @@ alp_GetFD(alpobject *self, PyObject *args) } -static char alp_GetFilled__doc__[] = -"alGetFilled: return the number of filled sample frames in an audio port." -; +PyDoc_STRVAR(alp_GetFilled__doc__, +"alGetFilled: return the number of filled sample frames in " +"an audio port."); static PyObject * alp_GetFilled(alpobject *self, PyObject *args) @@ -710,9 +694,9 @@ alp_GetFilled(alpobject *self, PyObject *args) } -static char alp_GetFillable__doc__[] = -"alGetFillable: report the number of unfilled sample frames in an audio port." -; +PyDoc_STRVAR(alp_GetFillable__doc__, +"alGetFillable: report the number of unfilled sample frames " +"in an audio port."); static PyObject * alp_GetFillable(alpobject *self, PyObject *args) @@ -727,9 +711,8 @@ alp_GetFillable(alpobject *self, PyObject *args) } -static char alp_ReadFrames__doc__[] = -"alReadFrames: read sample frames from an audio port." -; +PyDoc_STRVAR(alp_ReadFrames__doc__, +"alReadFrames: read sample frames from an audio port."); static PyObject * alp_ReadFrames(alpobject *self, PyObject *args) @@ -796,9 +779,8 @@ alp_ReadFrames(alpobject *self, PyObject *args) } -static char alp_DiscardFrames__doc__[] = -"alDiscardFrames: discard audio from an audio port." -; +PyDoc_STRVAR(alp_DiscardFrames__doc__, +"alDiscardFrames: discard audio from an audio port."); static PyObject * alp_DiscardFrames(alpobject *self, PyObject *args) @@ -819,9 +801,8 @@ alp_DiscardFrames(alpobject *self, PyObject *args) } -static char alp_ZeroFrames__doc__[] = -"alZeroFrames: write zero-valued sample frames to an audio port." -; +PyDoc_STRVAR(alp_ZeroFrames__doc__, +"alZeroFrames: write zero-valued sample frames to an audio port."); static PyObject * alp_ZeroFrames(alpobject *self, PyObject *args) @@ -845,9 +826,8 @@ alp_ZeroFrames(alpobject *self, PyObject *args) } -static char alp_SetFillPoint__doc__[] = -"alSetFillPoint: set low- or high-water mark for an audio port." -; +PyDoc_STRVAR(alp_SetFillPoint__doc__, +"alSetFillPoint: set low- or high-water mark for an audio port."); static PyObject * alp_SetFillPoint(alpobject *self, PyObject *args) @@ -865,9 +845,8 @@ alp_SetFillPoint(alpobject *self, PyObject *args) } -static char alp_GetFillPoint__doc__[] = -"alGetFillPoint: get low- or high-water mark for an audio port." -; +PyDoc_STRVAR(alp_GetFillPoint__doc__, +"alGetFillPoint: get low- or high-water mark for an audio port."); static PyObject * alp_GetFillPoint(alpobject *self, PyObject *args) @@ -884,9 +863,9 @@ alp_GetFillPoint(alpobject *self, PyObject *args) } -static char alp_GetFrameNumber__doc__[] = -"alGetFrameNumber: get the absolute sample frame number associated with a port." -; +PyDoc_STRVAR(alp_GetFrameNumber__doc__, +"alGetFrameNumber: get the absolute sample frame number " +"associated with a port."); static PyObject * alp_GetFrameNumber(alpobject *self, PyObject *args) @@ -903,9 +882,9 @@ alp_GetFrameNumber(alpobject *self, PyObject *args) } -static char alp_GetFrameTime__doc__[] = -"alGetFrameTime: get the time at which a sample frame came in or will go out." -; +PyDoc_STRVAR(alp_GetFrameTime__doc__, +"alGetFrameTime: get the time at which a sample frame came " +"in or will go out."); static PyObject * alp_GetFrameTime(alpobject *self, PyObject *args) @@ -931,9 +910,8 @@ alp_GetFrameTime(alpobject *self, PyObject *args) } -static char alp_WriteFrames__doc__[] = -"alWriteFrames: write sample frames to an audio port." -; +PyDoc_STRVAR(alp_WriteFrames__doc__, +"alWriteFrames: write sample frames to an audio port."); static PyObject * alp_WriteFrames(alpobject *self, PyObject *args) @@ -997,9 +975,7 @@ alp_WriteFrames(alpobject *self, PyObject *args) } -static char alp_ClosePort__doc__[] = -"alClosePort: close an audio port." -; +PyDoc_STRVAR(alp_ClosePort__doc__, "alClosePort: close an audio port."); static PyObject * alp_ClosePort(alpobject *self, PyObject *args) @@ -1314,9 +1290,7 @@ alp_getattr(alpobject *self, char *name) return Py_FindMethod(alp_methods, (PyObject *)self, name); } -static char Alptype__doc__[] = -"" -; +PyDoc_STRVAR(Alptype__doc__, ""); static PyTypeObject Alptype = { PyObject_HEAD_INIT(&PyType_Type) @@ -1349,9 +1323,8 @@ static PyTypeObject Alptype = { #ifdef AL_NO_ELEM /* IRIX 6 */ -static char al_NewConfig__doc__[] = -"alNewConfig: create and initialize an audio ALconfig structure." -; +PyDoc_STRVAR(al_NewConfig__doc__, +"alNewConfig: create and initialize an audio ALconfig structure."); static PyObject * al_NewConfig(PyObject *self, PyObject *args) @@ -1365,9 +1338,8 @@ al_NewConfig(PyObject *self, PyObject *args) return newalcobject(config); } -static char al_OpenPort__doc__[] = -"alOpenPort: open an audio port." -; +PyDoc_STRVAR(al_OpenPort__doc__, +"alOpenPort: open an audio port."); static PyObject * al_OpenPort(PyObject *self, PyObject *args) @@ -1383,9 +1355,8 @@ al_OpenPort(PyObject *self, PyObject *args) return newalpobject(port); } -static char al_Connect__doc__[] = -"alConnect: connect two audio I/O resources." -; +PyDoc_STRVAR(al_Connect__doc__, +"alConnect: connect two audio I/O resources."); static PyObject * al_Connect(PyObject *self, PyObject *args) @@ -1423,9 +1394,8 @@ al_Connect(PyObject *self, PyObject *args) return PyInt_FromLong((long) id); } -static char al_Disconnect__doc__[] = -"alDisconnect: delete a connection between two audio I/O resources." -; +PyDoc_STRVAR(al_Disconnect__doc__, +"alDisconnect: delete a connection between two audio I/O resources."); static PyObject * al_Disconnect(PyObject *self, PyObject *args) @@ -1440,9 +1410,8 @@ al_Disconnect(PyObject *self, PyObject *args) return Py_None; } -static char al_GetParams__doc__[] = -"alGetParams: get the values of audio resource parameters." -; +PyDoc_STRVAR(al_GetParams__doc__, +"alGetParams: get the values of audio resource parameters."); static PyObject * al_GetParams(PyObject *self, PyObject *args) @@ -1585,9 +1554,8 @@ al_GetParams(PyObject *self, PyObject *args) return NULL; } -static char al_SetParams__doc__[] = -"alSetParams: set the values of audio resource parameters." -; +PyDoc_STRVAR(al_SetParams__doc__, +"alSetParams: set the values of audio resource parameters."); static PyObject * al_SetParams(PyObject *self, PyObject *args) @@ -1631,9 +1599,8 @@ al_SetParams(PyObject *self, PyObject *args) return NULL; } -static char al_QueryValues__doc__[] = -"alQueryValues: get the set of possible values for a parameter." -; +PyDoc_STRVAR(al_QueryValues__doc__, +"alQueryValues: get the set of possible values for a parameter."); static PyObject * al_QueryValues(PyObject *self, PyObject *args) @@ -1711,9 +1678,9 @@ al_QueryValues(PyObject *self, PyObject *args) return res; } -static char al_GetParamInfo__doc__[] = -"alGetParamInfo: get information about a parameter on a particular audio resource." -; +PyDoc_STRVAR(al_GetParamInfo__doc__, +"alGetParamInfo: get information about a parameter on " +"a particular audio resource."); static PyObject * al_GetParamInfo(PyObject *self, PyObject *args) @@ -1794,9 +1761,8 @@ al_GetParamInfo(PyObject *self, PyObject *args) return v; } -static char al_GetResourceByName__doc__[] = -"alGetResourceByName: find an audio resource by name." -; +PyDoc_STRVAR(al_GetResourceByName__doc__, +"alGetResourceByName: find an audio resource by name."); static PyObject * al_GetResourceByName(PyObject *self, PyObject *args) @@ -1811,9 +1777,8 @@ al_GetResourceByName(PyObject *self, PyObject *args) return PyInt_FromLong((long) res); } -static char al_IsSubtype__doc__[] = -"alIsSubtype: indicate if one resource type is a subtype of another." -; +PyDoc_STRVAR(al_IsSubtype__doc__, +"alIsSubtype: indicate if one resource type is a subtype of another."); static PyObject * al_IsSubtype(PyObject *self, PyObject *args) @@ -1825,9 +1790,7 @@ al_IsSubtype(PyObject *self, PyObject *args) return PyInt_FromLong((long) alIsSubtype(type, subtype)); } -static char al_SetErrorHandler__doc__[] = -"" -; +PyDoc_STRVAR(al_SetErrorHandler__doc__, ""); static PyObject * al_SetErrorHandler(PyObject *self, PyObject *args) @@ -2024,9 +1987,7 @@ static struct PyMethodDef al_methods[] = { /* Initialization function for the module (*must* be called inital) */ -static char al_module_documentation[] = -"" -; +PyDoc_STRVAR(al_module_documentation, ""); void inital(void) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index f10d442fb9..dd93950f8d 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -820,10 +820,10 @@ array_count(arrayobject *self, PyObject *args) return PyInt_FromLong((long)count); } -static char count_doc [] = +PyDoc_STRVAR(count_doc, "count(x)\n\ \n\ -Return number of occurences of x in the array."; +Return number of occurences of x in the array."); static PyObject * array_index(arrayobject *self, PyObject *args) @@ -847,10 +847,10 @@ array_index(arrayobject *self, PyObject *args) return NULL; } -static char index_doc [] = +PyDoc_STRVAR(index_doc, "index(x)\n\ \n\ -Return index of first occurence of x in the array."; +Return index of first occurence of x in the array."); static PyObject * array_remove(arrayobject *self, PyObject *args) @@ -878,10 +878,10 @@ array_remove(arrayobject *self, PyObject *args) return NULL; } -static char remove_doc [] = +PyDoc_STRVAR(remove_doc, "remove(x)\n\ \n\ -Remove the first occurence of x in the array."; +Remove the first occurence of x in the array."); static PyObject * array_pop(arrayobject *self, PyObject *args) @@ -909,10 +909,10 @@ array_pop(arrayobject *self, PyObject *args) return v; } -static char pop_doc [] = +PyDoc_STRVAR(pop_doc, "pop([i])\n\ \n\ -Return the i-th element and delete it from the array. i defaults to -1."; +Return the i-th element and delete it from the array. i defaults to -1."); static PyObject * array_extend(arrayobject *self, PyObject *args) @@ -927,10 +927,10 @@ array_extend(arrayobject *self, PyObject *args) return Py_None; } -static char extend_doc [] = +PyDoc_STRVAR(extend_doc, "extend(array)\n\ \n\ - Append array items to the end of the array."; + Append array items to the end of the array."); static PyObject * array_insert(arrayobject *self, PyObject *args) @@ -942,10 +942,10 @@ array_insert(arrayobject *self, PyObject *args) return ins(self, i, v); } -static char insert_doc [] = +PyDoc_STRVAR(insert_doc, "insert(i,x)\n\ \n\ -Insert a new item x into the array before position i."; +Insert a new item x into the array before position i."); static PyObject * @@ -964,13 +964,13 @@ array_buffer_info(arrayobject *self, PyObject *args) return retval; } -static char buffer_info_doc [] = +PyDoc_STRVAR(buffer_info_doc, "buffer_info() -> (address, length)\n\ \n\ Return a tuple (address, length) giving the current memory address and\n\ the length in items of the buffer used to hold array's contents\n\ The length should be multiplied by the itemsize attribute to calculate\n\ -the buffer length in bytes."; +the buffer length in bytes."); static PyObject * @@ -982,10 +982,10 @@ array_append(arrayobject *self, PyObject *args) return ins(self, (int) self->ob_size, v); } -static char append_doc [] = +PyDoc_STRVAR(append_doc, "append(x)\n\ \n\ -Append new value x to the end of the array."; +Append new value x to the end of the array."); static PyObject * @@ -1042,11 +1042,11 @@ array_byteswap(arrayobject *self, PyObject *args) return Py_None; } -static char byteswap_doc [] = +PyDoc_STRVAR(byteswap_doc, "byteswap()\n\ \n\ Byteswap all items of the array. If the items in the array are not 1, 2,\n\ -4, or 8 bytes in size, RuntimeError is raised."; +4, or 8 bytes in size, RuntimeError is raised."); static PyObject * array_reverse(arrayobject *self, PyObject *args) @@ -1078,10 +1078,10 @@ array_reverse(arrayobject *self, PyObject *args) return Py_None; } -static char reverse_doc [] = +PyDoc_STRVAR(reverse_doc, "reverse()\n\ \n\ -Reverse the order of the items in the array."; +Reverse the order of the items in the array."); static PyObject * array_fromfile(arrayobject *self, PyObject *args) @@ -1130,11 +1130,11 @@ array_fromfile(arrayobject *self, PyObject *args) return Py_None; } -static char fromfile_doc [] = +PyDoc_STRVAR(fromfile_doc, "fromfile(f, n)\n\ \n\ Read n objects from the file object f and append them to the end of the\n\ -array. Also called as read."; +array. Also called as read."); static PyObject * @@ -1161,11 +1161,11 @@ array_tofile(arrayobject *self, PyObject *args) return Py_None; } -static char tofile_doc [] = +PyDoc_STRVAR(tofile_doc, "tofile(f)\n\ \n\ Write all items (as machine values) to the file object f. Also called as\n\ -write."; +write."); static PyObject * @@ -1207,10 +1207,10 @@ array_fromlist(arrayobject *self, PyObject *args) return Py_None; } -static char fromlist_doc [] = +PyDoc_STRVAR(fromlist_doc, "fromlist(list)\n\ \n\ -Append items to array from list."; +Append items to array from list."); static PyObject * @@ -1233,10 +1233,10 @@ array_tolist(arrayobject *self, PyObject *args) return list; } -static char tolist_doc [] = +PyDoc_STRVAR(tolist_doc, "tolist() -> list\n\ \n\ -Convert array to an ordinary list with the same items."; +Convert array to an ordinary list with the same items."); static PyObject * @@ -1269,11 +1269,11 @@ array_fromstring(arrayobject *self, PyObject *args) return Py_None; } -static char fromstring_doc [] = +PyDoc_STRVAR(fromstring_doc, "fromstring(string)\n\ \n\ Appends items from the string, interpreting it as an array of machine\n\ -values,as if it had been read from a file using the fromfile() method)."; +values,as if it had been read from a file using the fromfile() method)."); static PyObject * @@ -1285,11 +1285,11 @@ array_tostring(arrayobject *self, PyObject *args) self->ob_size * self->ob_descr->itemsize); } -static char tostring_doc [] = +PyDoc_STRVAR(tostring_doc, "tostring() -> string\n\ \n\ Convert the array to an array of machine values and return the string\n\ -representation."; +representation."); @@ -1325,13 +1325,13 @@ array_fromunicode(arrayobject *self, PyObject *args) return Py_None; } -static char fromunicode_doc[] = +PyDoc_STRVAR(fromunicode_doc, "fromunicode(ustr)\n\ \n\ Extends this array with data from the unicode string ustr.\n\ The array must be a type 'u' array; otherwise a ValueError\n\ is raised. Use array.fromstring(ustr.decode(...)) to\n\ -append Unicode data to an array of some other type."; +append Unicode data to an array of some other type."); static PyObject * @@ -1347,13 +1347,13 @@ array_tounicode(arrayobject *self, PyObject *args) return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, self->ob_size); } -static char tounicode_doc [] = +PyDoc_STRVAR(tounicode_doc, "tounicode() -> unicode\n\ \n\ Convert the array to a unicode string. The array must be\n\ a type 'u' array; otherwise a ValueError is raised. Use\n\ array.tostring().decode() to obtain a unicode string from\n\ -an array of some other type."; +an array of some other type."); #endif /* Py_USING_UNICODE */ @@ -1621,7 +1621,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } -static char module_doc [] = +PyDoc_STRVAR(module_doc, "This module defines an object type which can efficiently represent\n\ an array of basic values: characters, integers, floating point\n\ numbers. Arrays are sequence types and behave very much like lists,\n\ @@ -1646,9 +1646,9 @@ is a single character. The following type codes are defined:\n\ The constructor is:\n\ \n\ array(typecode [, initializer]) -- create a new array\n\ -"; +"); -static char arraytype_doc [] = +PyDoc_STRVAR(arraytype_doc, "array(typecode [, initializer]) -> array\n\ \n\ Return a new array whose items are restricted by typecode, and\n\ @@ -1683,7 +1683,7 @@ Attributes:\n\ \n\ typecode -- the typecode character used to create the array\n\ itemsize -- the length in bytes of one array item\n\ -"; +"); statichere PyTypeObject Arraytype = { PyObject_HEAD_INIT(NULL) diff --git a/Modules/binascii.c b/Modules/binascii.c index 9ef305414f..6cba688fc7 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -179,7 +179,7 @@ static unsigned short crctab_hqx[256] = { 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, }; -static char doc_a2b_uu[] = "(ascii) -> bin. Decode a line of uuencoded data"; +PyDoc_STRVAR(doc_a2b_uu, "(ascii) -> bin. Decode a line of uuencoded data"); static PyObject * binascii_a2b_uu(PyObject *self, PyObject *args) @@ -254,7 +254,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args) return rv; } -static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data"; +PyDoc_STRVAR(doc_b2a_uu, "(bin) -> ascii. Uuencode line of data"); static PyObject * binascii_b2a_uu(PyObject *self, PyObject *args) @@ -330,7 +330,7 @@ binascii_find_valid(unsigned char *s, int slen, int num) return ret; } -static char doc_a2b_base64[] = "(ascii) -> bin. Decode a line of base64 data"; +PyDoc_STRVAR(doc_a2b_base64, "(ascii) -> bin. Decode a line of base64 data"); static PyObject * binascii_a2b_base64(PyObject *self, PyObject *args) @@ -417,7 +417,7 @@ binascii_a2b_base64(PyObject *self, PyObject *args) return rv; } -static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data"; +PyDoc_STRVAR(doc_b2a_base64, "(bin) -> ascii. Base64-code line of data"); static PyObject * binascii_b2a_base64(PyObject *self, PyObject *args) @@ -470,7 +470,7 @@ binascii_b2a_base64(PyObject *self, PyObject *args) return rv; } -static char doc_a2b_hqx[] = "ascii -> bin, done. Decode .hqx coding"; +PyDoc_STRVAR(doc_a2b_hqx, "ascii -> bin, done. Decode .hqx coding"); static PyObject * binascii_a2b_hqx(PyObject *self, PyObject *args) @@ -534,7 +534,7 @@ binascii_a2b_hqx(PyObject *self, PyObject *args) return NULL; } -static char doc_rlecode_hqx[] = "Binhex RLE-code binary data"; +PyDoc_STRVAR(doc_rlecode_hqx, "Binhex RLE-code binary data"); static PyObject * binascii_rlecode_hqx(PyObject *self, PyObject *args) @@ -581,7 +581,7 @@ binascii_rlecode_hqx(PyObject *self, PyObject *args) return rv; } -static char doc_b2a_hqx[] = "Encode .hqx data"; +PyDoc_STRVAR(doc_b2a_hqx, "Encode .hqx data"); static PyObject * binascii_b2a_hqx(PyObject *self, PyObject *args) @@ -621,7 +621,7 @@ binascii_b2a_hqx(PyObject *self, PyObject *args) return rv; } -static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string"; +PyDoc_STRVAR(doc_rledecode_hqx, "Decode hexbin RLE-coded string"); static PyObject * binascii_rledecode_hqx(PyObject *self, PyObject *args) @@ -717,8 +717,8 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args) return rv; } -static char doc_crc_hqx[] = -"(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"; +PyDoc_STRVAR(doc_crc_hqx, +"(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"); static PyObject * binascii_crc_hqx(PyObject *self, PyObject *args) @@ -737,8 +737,8 @@ binascii_crc_hqx(PyObject *self, PyObject *args) return Py_BuildValue("i", crc); } -static char doc_crc32[] = -"(data, oldcrc = 0) -> newcrc. Compute CRC-32 incrementally"; +PyDoc_STRVAR(doc_crc32, +"(data, oldcrc = 0) -> newcrc. Compute CRC-32 incrementally"); /* Crc - 32 BIT ANSI X3.66 CRC checksum files Also known as: ISO 3307 @@ -912,10 +912,10 @@ binascii_hexlify(PyObject *self, PyObject *args) return NULL; } -static char doc_hexlify[] = +PyDoc_STRVAR(doc_hexlify, "b2a_hex(data) -> s; Hexadecimal representation of binary data.\n\ \n\ -This function is also available as \"hexlify()\"."; +This function is also available as \"hexlify()\"."); static int @@ -978,11 +978,11 @@ binascii_unhexlify(PyObject *self, PyObject *args) return NULL; } -static char doc_unhexlify[] = +PyDoc_STRVAR(doc_unhexlify, "a2b_hex(hexstr) -> s; Binary data of hexadecimal representation.\n\ \n\ hexstr must contain an even number of hex digits (upper or lower case).\n\ -This function is also available as \"unhexlify()\""; +This function is also available as \"unhexlify()\""); static int table_hex[128] = { -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, @@ -999,7 +999,7 @@ static int table_hex[128] = { #define MAXLINESIZE 76 -static char doc_a2b_qp[] = "Decode a string of qp-encoded data"; +PyDoc_STRVAR(doc_a2b_qp, "Decode a string of qp-encoded data"); static PyObject* binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) @@ -1088,13 +1088,13 @@ to_hex (unsigned char ch, unsigned char *s) return 0; } -static char doc_b2a_qp[] = +PyDoc_STRVAR(doc_b2a_qp, "b2a_qp(data, quotetabs=0, istext=1, header=0) -> s; \n\ Encode a string using quoted-printable encoding. \n\ \n\ On encoding, when istext is set, newlines are not encoded, and white \n\ space at end of lines is. When istext is not set, \\r and \\n (CR/LF) are \n\ -both encoded. When quotetabs is set, space and tabs are encoded."; +both encoded. When quotetabs is set, space and tabs are encoded."); /* XXX: This is ridiculously complicated to be backward compatible * (mostly) with the quopri module. It doesn't re-create the quopri @@ -1295,7 +1295,7 @@ static struct PyMethodDef binascii_module_methods[] = { /* Initialization function for the module (*must* be called initbinascii) */ -static char doc_binascii[] = "Conversion between binary data and ASCII"; +PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); DL_EXPORT(void) initbinascii(void) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 8ba423ed7e..70ead4849a 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -1,13 +1,12 @@ -static char cPickle_module_documentation[] = -"C implementation and optimization of the Python pickle module\n" -"\n" -"cPickle.c,v 1.71 1999/07/11 13:30:34 jim Exp\n" -; - #include "Python.h" #include "cStringIO.h" #include "structmember.h" +PyDoc_STRVAR(cPickle_module_documentation, +"C implementation and optimization of the Python pickle module\n" +"\n" +"cPickle.c,v 1.71 1999/07/11 13:30:34 jim Exp\n"); + #ifndef Py_eval_input #include #define Py_eval_input eval_input @@ -2511,8 +2510,8 @@ static PyGetSetDef Pickler_getsets[] = { {NULL} }; -static char Picklertype__doc__[] = -"Objects that know how to pickle objects\n"; +PyDoc_STRVAR(Picklertype__doc__, +"Objects that know how to pickle objects\n"); static PyTypeObject Picklertype = { PyObject_HEAD_INIT(NULL) @@ -4609,8 +4608,8 @@ cpm_loads(PyObject *self, PyObject *args) } -static char Unpicklertype__doc__[] = -"Objects that know how to unpickle"; +PyDoc_STRVAR(Unpicklertype__doc__, +"Objects that know how to unpickle"); static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 1dbec84651..2f85f417d9 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -1,4 +1,9 @@ -static char cStringIO_module_documentation[] = + +#include "Python.h" +#include "import.h" +#include "cStringIO.h" + +PyDoc_STRVAR(cStringIO_module_documentation, "A simple fast partial StringIO replacement.\n" "\n" "This module provides a simple useful replacement for\n" @@ -25,12 +30,7 @@ static char cStringIO_module_documentation[] = "If someone else wants to provide a more complete implementation,\n" "go for it. :-) \n" "\n" -"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n" -; - -#include "Python.h" -#include "import.h" -#include "cStringIO.h" +"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"); #define UNLESS(E) if (!(E)) @@ -74,7 +74,7 @@ typedef struct { /* Subtype of IOobject */ /* IOobject (common) methods */ -static char IO_flush__doc__[] = "flush(): does nothing."; +PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); static int IO__opencheck(IOobject *self) { @@ -96,12 +96,11 @@ IO_flush(IOobject *self, PyObject *args) { return Py_None; } -static char IO_getval__doc__[] = - "getvalue([use_pos]) -- Get the string value." - "\n" - "If use_pos is specified and is a true value, then the string returned\n" - "will include only the text up to the current file position.\n" -; +PyDoc_STRVAR(IO_getval__doc__, +"getvalue([use_pos]) -- Get the string value." +"\n" +"If use_pos is specified and is a true value, then the string returned\n" +"will include only the text up to the current file position.\n"); static PyObject * IO_cgetval(PyObject *self) { @@ -127,7 +126,7 @@ IO_getval(IOobject *self, PyObject *args) { return PyString_FromStringAndSize(self->buf, s); } -static char IO_isatty__doc__[] = "isatty(): always returns 0"; +PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); static PyObject * IO_isatty(IOobject *self, PyObject *args) { @@ -137,9 +136,8 @@ IO_isatty(IOobject *self, PyObject *args) { return PyInt_FromLong(0); } -static char IO_read__doc__[] = -"read([s]) -- Read s characters, or the rest of the string" -; +PyDoc_STRVAR(IO_read__doc__, +"read([s]) -- Read s characters, or the rest of the string"); static int IO_cread(PyObject *self, char **output, int n) { @@ -169,9 +167,7 @@ IO_read(IOobject *self, PyObject *args) { return PyString_FromStringAndSize(output, n); } -static char IO_readline__doc__[] = -"readline() -- Read one line" -; +PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); static int IO_creadline(PyObject *self, char **output) { @@ -207,9 +203,7 @@ IO_readline(IOobject *self, PyObject *args) { return PyString_FromStringAndSize(output, n); } -static char IO_readlines__doc__[] = -"readlines() -- Read all lines" -; +PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); static PyObject * IO_readlines(IOobject *self, PyObject *args) { @@ -244,9 +238,8 @@ IO_readlines(IOobject *self, PyObject *args) { return NULL; } -static char IO_reset__doc__[] = -"reset() -- Reset the file position to the beginning" -; +PyDoc_STRVAR(IO_reset__doc__, +"reset() -- Reset the file position to the beginning"); static PyObject * IO_reset(IOobject *self, PyObject *args) { @@ -260,8 +253,7 @@ IO_reset(IOobject *self, PyObject *args) { return Py_None; } -static char IO_tell__doc__[] = -"tell() -- get the current position."; +PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); static PyObject * IO_tell(IOobject *self, PyObject *args) { @@ -272,8 +264,8 @@ IO_tell(IOobject *self, PyObject *args) { return PyInt_FromLong(self->pos); } -static char IO_truncate__doc__[] = -"truncate(): truncate the file at the current position."; +PyDoc_STRVAR(IO_truncate__doc__, +"truncate(): truncate the file at the current position."); static PyObject * IO_truncate(IOobject *self, PyObject *args) { @@ -294,9 +286,9 @@ IO_truncate(IOobject *self, PyObject *args) { /* Read-write object methods */ -static char O_seek__doc__[] = +PyDoc_STRVAR(O_seek__doc__, "seek(position) -- set the current position\n" -"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"; +"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); static PyObject * O_seek(Oobject *self, PyObject *args) { @@ -332,10 +324,9 @@ O_seek(Oobject *self, PyObject *args) { return Py_None; } -static char O_write__doc__[] = +PyDoc_STRVAR(O_write__doc__, "write(s) -- Write a string to the file" -"\n\nNote (hack:) writing None resets the buffer" -; +"\n\nNote (hack:) writing None resets the buffer"); static int @@ -384,7 +375,7 @@ O_write(Oobject *self, PyObject *args) { return Py_None; } -static char O_close__doc__[] = "close(): explicitly release resources held."; +PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); static PyObject * O_close(Oobject *self, PyObject *args) { @@ -401,8 +392,8 @@ O_close(Oobject *self, PyObject *args) { } -static char O_writelines__doc__[] = -"writelines(sequence_of_strings): write each string"; +PyDoc_STRVAR(O_writelines__doc__, +"writelines(sequence_of_strings): write each string"); static PyObject * O_writelines(Oobject *self, PyObject *args) { PyObject *tmp = 0; @@ -483,9 +474,7 @@ O_setattr(Oobject *self, char *name, PyObject *value) { return 0; } -static char Otype__doc__[] = -"Simple type for output to strings." -; +PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) @@ -617,9 +606,8 @@ I_getiter(Iobject *self) } -static char Itype__doc__[] = -"Simple type for treating strings as input file streams" -; +PyDoc_STRVAR(Itype__doc__, +"Simple type for treating strings as input file streams"); static PyTypeObject Itype = { PyObject_HEAD_INIT(NULL) @@ -678,9 +666,8 @@ newIobject(PyObject *s) { /* -------------------------------------------------------- */ -static char IO_StringIO__doc__[] = -"StringIO([s]) -- Return a StringIO-like stream for reading or writing" -; +PyDoc_STRVAR(IO_StringIO__doc__, +"StringIO([s]) -- Return a StringIO-like stream for reading or writing"); static PyObject * IO_StringIO(PyObject *self, PyObject *args) { diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 8e74e513b2..0437368de4 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -29,10 +29,10 @@ c_acos(Py_complex x) c_sqrt(c_diff(c_one,c_prod(x,x)))))))); } -static char c_acos_doc[] = +PyDoc_STRVAR(c_acos_doc, "acos(x)\n" "\n" -"Return the arc cosine of x."; +"Return the arc cosine of x."); static Py_complex @@ -45,10 +45,10 @@ c_acosh(Py_complex x) return c_sum(z, z); } -static char c_acosh_doc[] = +PyDoc_STRVAR(c_acosh_doc, "acosh(x)\n" "\n" -"Return the hyperbolic arccosine of x."; +"Return the hyperbolic arccosine of x."); static Py_complex @@ -62,10 +62,10 @@ c_asin(Py_complex x) ) ) ); } -static char c_asin_doc[] = +PyDoc_STRVAR(c_asin_doc, "asin(x)\n" "\n" -"Return the arc sine of x."; +"Return the arc sine of x."); static Py_complex @@ -78,10 +78,10 @@ c_asinh(Py_complex x) return c_sum(z, z); } -static char c_asinh_doc[] = +PyDoc_STRVAR(c_asinh_doc, "asinh(x)\n" "\n" -"Return the hyperbolic arc sine of x."; +"Return the hyperbolic arc sine of x."); static Py_complex @@ -90,10 +90,10 @@ c_atan(Py_complex x) return c_prod(c_halfi,c_log(c_quot(c_sum(c_i,x),c_diff(c_i,x)))); } -static char c_atan_doc[] = +PyDoc_STRVAR(c_atan_doc, "atan(x)\n" "\n" -"Return the arc tangent of x."; +"Return the arc tangent of x."); static Py_complex @@ -102,10 +102,10 @@ c_atanh(Py_complex x) return c_prod(c_half,c_log(c_quot(c_sum(c_one,x),c_diff(c_one,x)))); } -static char c_atanh_doc[] = +PyDoc_STRVAR(c_atanh_doc, "atanh(x)\n" "\n" -"Return the hyperbolic arc tangent of x."; +"Return the hyperbolic arc tangent of x."); static Py_complex @@ -117,10 +117,10 @@ c_cos(Py_complex x) return r; } -static char c_cos_doc[] = +PyDoc_STRVAR(c_cos_doc, "cos(x)\n" "n" -"Return the cosine of x."; +"Return the cosine of x."); static Py_complex @@ -132,10 +132,10 @@ c_cosh(Py_complex x) return r; } -static char c_cosh_doc[] = +PyDoc_STRVAR(c_cosh_doc, "cosh(x)\n" "n" -"Return the hyperbolic cosine of x."; +"Return the hyperbolic cosine of x."); static Py_complex @@ -148,10 +148,10 @@ c_exp(Py_complex x) return r; } -static char c_exp_doc[] = +PyDoc_STRVAR(c_exp_doc, "exp(x)\n" "\n" -"Return the exponential value e**x."; +"Return the exponential value e**x."); static Py_complex @@ -164,10 +164,10 @@ c_log(Py_complex x) return r; } -static char c_log_doc[] = +PyDoc_STRVAR(c_log_doc, "log(x)\n" "\n" -"Return the natural logarithm of x."; +"Return the natural logarithm of x."); static Py_complex @@ -180,10 +180,10 @@ c_log10(Py_complex x) return r; } -static char c_log10_doc[] = +PyDoc_STRVAR(c_log10_doc, "log10(x)\n" "\n" -"Return the base-10 logarithm of x."; +"Return the base-10 logarithm of x."); /* internal function not available from Python */ @@ -206,10 +206,10 @@ c_sin(Py_complex x) return r; } -static char c_sin_doc[] = +PyDoc_STRVAR(c_sin_doc, "sin(x)\n" "\n" -"Return the sine of x."; +"Return the sine of x."); static Py_complex @@ -221,10 +221,10 @@ c_sinh(Py_complex x) return r; } -static char c_sinh_doc[] = +PyDoc_STRVAR(c_sinh_doc, "sinh(x)\n" "\n" -"Return the hyperbolic sine of x."; +"Return the hyperbolic sine of x."); static Py_complex @@ -253,10 +253,10 @@ c_sqrt(Py_complex x) return r; } -static char c_sqrt_doc[] = +PyDoc_STRVAR(c_sqrt_doc, "sqrt(x)\n" "\n" -"Return the square root of x."; +"Return the square root of x."); static Py_complex @@ -280,10 +280,10 @@ c_tan(Py_complex x) return r; } -static char c_tan_doc[] = +PyDoc_STRVAR(c_tan_doc, "tan(x)\n" "\n" -"Return the tangent of x."; +"Return the tangent of x."); static Py_complex @@ -307,10 +307,10 @@ c_tanh(Py_complex x) return r; } -static char c_tanh_doc[] = +PyDoc_STRVAR(c_tanh_doc, "tanh(x)\n" "\n" -"Return the hyperbolic tangent of x."; +"Return the hyperbolic tangent of x."); /* And now the glue to make them available from Python: */ @@ -367,9 +367,9 @@ FUNC1(cmath_tan, c_tan) FUNC1(cmath_tanh, c_tanh) -static char module_doc[] = +PyDoc_STRVAR(module_doc, "This module is always available. It provides access to mathematical\n" -"functions for complex numbers."; +"functions for complex numbers."); static PyMethodDef cmath_methods[] = { {"acos", cmath_acos, METH_VARARGS, c_acos_doc}, diff --git a/Modules/cryptmodule.c b/Modules/cryptmodule.c index 5c4ee2fa81..a1eaced218 100644 --- a/Modules/cryptmodule.c +++ b/Modules/cryptmodule.c @@ -23,13 +23,13 @@ static PyObject *crypt_crypt(PyObject *self, PyObject *args) } -static char crypt_crypt__doc__[] = "\ -crypt(word, salt) -> string\n\ +PyDoc_STRVAR(crypt_crypt__doc__, +"crypt(word, salt) -> string\n\ word will usually be a user's password. salt is a 2-character string\n\ which will be used to select one of 4096 variations of DES. The characters\n\ in salt must be either \".\", \"/\", or an alphanumeric character. Returns\n\ the hashed password as a string, which will be composed of characters from\n\ -the same alphabet as the salt."; +the same alphabet as the salt."); static PyMethodDef crypt_methods[] = { diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index 4b54dc5dba..74d4f0f310 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -43,7 +43,7 @@ _inscode(PyObject *d, PyObject *de, char *name, int code) Py_XDECREF(v); } -static char errno__doc__ [] = +PyDoc_STRVAR(errno__doc__, "This module makes available standard errno system symbols.\n\ \n\ The value of each symbol is the corresponding integer value,\n\ @@ -55,7 +55,7 @@ e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\ Symbols that are not relevant to the underlying system are not defined.\n\ \n\ To map error codes to error messages, use the function os.strerror(),\n\ -e.g. os.strerror(2) could return 'No such file or directory'."; +e.g. os.strerror(2) could return 'No such file or directory'."); DL_EXPORT(void) initerrno(void) diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 13cd0f76e4..f1d89cc7a7 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -72,8 +72,7 @@ fcntl_fcntl(PyObject *self, PyObject *args) return PyInt_FromLong((long)ret); } -static char fcntl_doc [] = - +PyDoc_STRVAR(fcntl_doc, "fcntl(fd, opt, [arg])\n\ \n\ Perform the requested operation on file descriptor fd. The operation\n\ @@ -84,7 +83,7 @@ the return value of fcntl is a string of that length, containing the\n\ resulting value put in the arg buffer by the operating system.The length\n\ of the arg string is not allowed to exceed 1024 bytes. If the arg given\n\ is an integer or if none is specified, the result value is an integer\n\ -corresponding to the return value of the fcntl call in the C code."; +corresponding to the return value of the fcntl call in the C code."); /* ioctl(fd, opt, [arg]) */ @@ -136,7 +135,7 @@ fcntl_ioctl(PyObject *self, PyObject *args) return PyInt_FromLong((long)ret); } -static char ioctl_doc [] = +PyDoc_STRVAR(ioctl_doc, "ioctl(fd, opt, [arg])\n\ \n\ Perform the requested operation on file descriptor fd. The operation\n\ @@ -147,7 +146,7 @@ given as a string, the return value of ioctl is a string of that length,\n\ containing the resulting value put in the arg buffer by the operating system.\n\ The length of the arg string is not allowed to exceed 1024 bytes. If the arg\n\ given is an integer or if none is specified, the result value is an integer\n\ -corresponding to the return value of the ioctl call in the C code."; +corresponding to the return value of the ioctl call in the C code."); /* flock(fd, operation) */ @@ -202,12 +201,12 @@ fcntl_flock(PyObject *self, PyObject *args) return Py_None; } -static char flock_doc [] = +PyDoc_STRVAR(flock_doc, "flock(fd, operation)\n\ \n\ Perform the lock operation op on file descriptor fd. See the Unix \n\ manual flock(3) for details. (On some systems, this function is\n\ -emulated using fcntl().)"; +emulated using fcntl().)"); /* lockf(fd, operation) */ @@ -283,7 +282,7 @@ fcntl_lockf(PyObject *self, PyObject *args) #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ } -static char lockf_doc [] = +PyDoc_STRVAR(lockf_doc, "lockf (fd, operation, length=0, start=0, whence=0)\n\ \n\ This is essentially a wrapper around the fcntl() locking calls. fd is the\n\ @@ -306,7 +305,7 @@ starts. whence is as with fileobj.seek(), specifically:\n\ \n\ 0 - relative to the start of the file (SEEK_SET)\n\ 1 - relative to the current buffer position (SEEK_CUR)\n\ - 2 - relative to the end of the file (SEEK_END)"; + 2 - relative to the end of the file (SEEK_END)"); /* List of functions */ @@ -319,12 +318,11 @@ static PyMethodDef fcntl_methods[] = { }; -static char module_doc [] = - +PyDoc_STRVAR(module_doc, "This module performs file control and I/O control on file \n\ descriptors. It is an interface to the fcntl() and ioctl() Unix\n\ routines. File descriptors can be obtained with the fileno() method of\n\ -a file or socket object."; +a file or socket object."); /* Module initialisation */ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index fd8a076d4e..e4417c2031 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -508,11 +508,10 @@ collect_generations(void) return n; } -static char gc_enable__doc__[] = +PyDoc_STRVAR(gc_enable__doc__, "enable() -> None\n" "\n" -"Enable automatic garbage collection.\n" -; +"Enable automatic garbage collection.\n"); static PyObject * gc_enable(PyObject *self, PyObject *args) @@ -527,11 +526,10 @@ gc_enable(PyObject *self, PyObject *args) return Py_None; } -static char gc_disable__doc__[] = +PyDoc_STRVAR(gc_disable__doc__, "disable() -> None\n" "\n" -"Disable automatic garbage collection.\n" -; +"Disable automatic garbage collection.\n"); static PyObject * gc_disable(PyObject *self, PyObject *args) @@ -546,11 +544,10 @@ gc_disable(PyObject *self, PyObject *args) return Py_None; } -static char gc_isenabled__doc__[] = +PyDoc_STRVAR(gc_isenabled__doc__, "isenabled() -> status\n" "\n" -"Returns true if automatic garbage collection is enabled.\n" -; +"Returns true if automatic garbage collection is enabled.\n"); static PyObject * gc_isenabled(PyObject *self, PyObject *args) @@ -562,11 +559,10 @@ gc_isenabled(PyObject *self, PyObject *args) return Py_BuildValue("i", enabled); } -static char gc_collect__doc__[] = +PyDoc_STRVAR(gc_collect__doc__, "collect() -> n\n" "\n" -"Run a full collection. The number of unreachable objects is returned.\n" -; +"Run a full collection. The number of unreachable objects is returned.\n"); static PyObject * gc_collect(PyObject *self, PyObject *args) @@ -588,7 +584,7 @@ gc_collect(PyObject *self, PyObject *args) return Py_BuildValue("l", n); } -static char gc_set_debug__doc__[] = +PyDoc_STRVAR(gc_set_debug__doc__, "set_debug(flags) -> None\n" "\n" "Set the garbage collection debugging flags. Debugging information is\n" @@ -602,8 +598,7 @@ static char gc_set_debug__doc__[] = " DEBUG_INSTANCES - Print instance objects.\n" " DEBUG_OBJECTS - Print objects other than instances.\n" " DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.\n" -" DEBUG_LEAK - Debug leaking programs (everything but STATS).\n" -; +" DEBUG_LEAK - Debug leaking programs (everything but STATS).\n"); static PyObject * gc_set_debug(PyObject *self, PyObject *args) @@ -615,11 +610,10 @@ gc_set_debug(PyObject *self, PyObject *args) return Py_None; } -static char gc_get_debug__doc__[] = +PyDoc_STRVAR(gc_get_debug__doc__, "get_debug() -> flags\n" "\n" -"Get the garbage collection debugging flags.\n" -; +"Get the garbage collection debugging flags.\n"); static PyObject * gc_get_debug(PyObject *self, PyObject *args) @@ -630,12 +624,11 @@ gc_get_debug(PyObject *self, PyObject *args) return Py_BuildValue("i", debug); } -static char gc_set_thresh__doc__[] = +PyDoc_STRVAR(gc_set_thresh__doc__, "set_threshold(threshold0, [threshold1, threshold2]) -> None\n" "\n" "Sets the collection thresholds. Setting threshold0 to zero disables\n" -"collection.\n" -; +"collection.\n"); static PyObject * gc_set_thresh(PyObject *self, PyObject *args) @@ -655,11 +648,10 @@ gc_set_thresh(PyObject *self, PyObject *args) return Py_None; } -static char gc_get_thresh__doc__[] = +PyDoc_STRVAR(gc_get_thresh__doc__, "get_threshold() -> (threshold0, threshold1, threshold2)\n" "\n" -"Return the current collection thresholds\n" -; +"Return the current collection thresholds\n"); static PyObject * gc_get_thresh(PyObject *self, PyObject *args) @@ -702,9 +694,9 @@ gc_referrers_for(PyObject *objs, PyGC_Head *list, PyObject *resultlist) return 1; /* no error */ } -static char gc_get_referrers__doc__[]= +PyDoc_STRVAR(gc_get_referrers__doc__, "get_referrers(*objs) -> list\n\ -Return the list of objects that directly refer to any of objs."; +Return the list of objects that directly refer to any of objs."); static PyObject * gc_get_referrers(PyObject *self, PyObject *args) @@ -720,12 +712,11 @@ gc_get_referrers(PyObject *self, PyObject *args) return result; } -static char gc_get_objects__doc__[] = +PyDoc_STRVAR(gc_get_objects__doc__, "get_objects() -> [...]\n" "\n" "Return a list of objects tracked by the collector (excluding the list\n" -"returned).\n" -; +"returned).\n"); /* appending objects in a GC list to a Python list */ static int @@ -765,7 +756,7 @@ gc_get_objects(PyObject *self, PyObject *args) } -static char gc__doc__ [] = +PyDoc_STRVAR(gc__doc__, "This module provides access to the garbage collector for reference cycles.\n" "\n" "enable() -- Enable automatic garbage collection.\n" @@ -777,8 +768,7 @@ static char gc__doc__ [] = "set_threshold() -- Set the collection thresholds.\n" "get_threshold() -- Return the current the collection thresholds.\n" "get_objects() -- Return a list of all objects tracked by the collector.\n" -"get_referrers() -- Return the list of objects that refer to an object.\n" -; +"get_referrers() -- Return the list of objects that refer to an object.\n"); static PyMethodDef GcMethods[] = { {"enable", gc_enable, METH_VARARGS, gc_enable__doc__}, diff --git a/Modules/gdbmmodule.c b/Modules/gdbmmodule.c index 72d76eaafa..1da53ff2d0 100644 --- a/Modules/gdbmmodule.c +++ b/Modules/gdbmmodule.c @@ -16,8 +16,8 @@ extern const char * gdbm_strerror(gdbm_error); #endif -static char gdbmmodule__doc__[] = "\ -This module provides an interface to the GNU DBM (GDBM) library.\n\ +PyDoc_STRVAR(gdbmmodule__doc__, +"This module provides an interface to the GNU DBM (GDBM) library.\n\ \n\ This module is quite similar to the dbm module, but uses GDBM instead to\n\ provide some additional functionality. Please note that the file formats\n\ @@ -26,7 +26,7 @@ created by GDBM and dbm are incompatible. \n\ GDBM objects behave like mappings (dictionaries), except that keys and\n\ values are always strings. Printing a GDBM object doesn't print the\n\ keys and values, and the items() and values() methods are not\n\ -supported."; +supported."); typedef struct { PyObject_HEAD @@ -45,15 +45,15 @@ staticforward PyTypeObject Dbmtype; static PyObject *DbmError; -static char gdbm_object__doc__[] = "\ -This object represents a GDBM database.\n\ +PyDoc_STRVAR(gdbm_object__doc__, +"This object represents a GDBM database.\n\ GDBM objects behave like mappings (dictionaries), except that keys and\n\ values are always strings. Printing a GDBM object doesn't print the\n\ keys and values, and the items() and values() methods are not\n\ supported.\n\ \n\ GDBM objects also support additional operations such as firstkey,\n\ -nextkey, reorganize, and sync."; +nextkey, reorganize, and sync."); static PyObject * newdbmobject(char *file, int flags, int mode) @@ -183,9 +183,9 @@ static PyMappingMethods dbm_as_mapping = { (objobjargproc)dbm_ass_sub, /*mp_ass_subscript*/ }; -static char dbm_close__doc__[] = "\ -close() -> None\n\ -Closes the database."; +PyDoc_STRVAR(dbm_close__doc__, +"close() -> None\n\ +Closes the database."); static PyObject * dbm_close(register dbmobject *dp, PyObject *args) @@ -199,9 +199,9 @@ dbm_close(register dbmobject *dp, PyObject *args) return Py_None; } -static char dbm_keys__doc__[] = "\ -keys() -> list_of_keys\n\ -Get a list of all keys in the database."; +PyDoc_STRVAR(dbm_keys__doc__, +"keys() -> list_of_keys\n\ +Get a list of all keys in the database."); static PyObject * dbm_keys(register dbmobject *dp, PyObject *args) @@ -245,9 +245,9 @@ dbm_keys(register dbmobject *dp, PyObject *args) return v; } -static char dbm_has_key__doc__[] = "\ -has_key(key) -> boolean\n\ -Find out whether or not the database contains a given key."; +PyDoc_STRVAR(dbm_has_key__doc__, +"has_key(key) -> boolean\n\ +Find out whether or not the database contains a given key."); static PyObject * dbm_has_key(register dbmobject *dp, PyObject *args) @@ -260,12 +260,12 @@ dbm_has_key(register dbmobject *dp, PyObject *args) return PyInt_FromLong((long) gdbm_exists(dp->di_dbm, key)); } -static char dbm_firstkey__doc__[] = "\ -firstkey() -> key\n\ +PyDoc_STRVAR(dbm_firstkey__doc__, +"firstkey() -> key\n\ It's possible to loop over every key in the database using this method\n\ and the nextkey() method. The traversal is ordered by GDBM's internal\n\ hash values, and won't be sorted by the key values. This method\n\ -returns the starting key."; +returns the starting key."); static PyObject * dbm_firstkey(register dbmobject *dp, PyObject *args) @@ -288,8 +288,8 @@ dbm_firstkey(register dbmobject *dp, PyObject *args) } } -static char dbm_nextkey__doc__[] = "\ -nextkey(key) -> next_key\n\ +PyDoc_STRVAR(dbm_nextkey__doc__, +"nextkey(key) -> next_key\n\ Returns the key that follows key in the traversal.\n\ The following code prints every key in the database db, without having\n\ to create a list in memory that contains them all:\n\ @@ -297,7 +297,7 @@ to create a list in memory that contains them all:\n\ k = db.firstkey()\n\ while k != None:\n\ print k\n\ - k = db.nextkey(k)"; + k = db.nextkey(k)"); static PyObject * dbm_nextkey(register dbmobject *dp, PyObject *args) @@ -320,13 +320,13 @@ dbm_nextkey(register dbmobject *dp, PyObject *args) } } -static char dbm_reorganize__doc__[] = "\ -reorganize() -> None\n\ +PyDoc_STRVAR(dbm_reorganize__doc__, +"reorganize() -> None\n\ If you have carried out a lot of deletions and would like to shrink\n\ the space used by the GDBM file, this routine will reorganize the\n\ database. GDBM will not shorten the length of a database file except\n\ by using this reorganization; otherwise, deleted file space will be\n\ -kept and reused as new (key,value) pairs are added."; +kept and reused as new (key,value) pairs are added."); static PyObject * dbm_reorganize(register dbmobject *dp, PyObject *args) @@ -346,10 +346,10 @@ dbm_reorganize(register dbmobject *dp, PyObject *args) return Py_None; } -static char dbm_sync__doc__[] = "\ -sync() -> None\n\ +PyDoc_STRVAR(dbm_sync__doc__, +"sync() -> None\n\ When the database has been opened in fast mode, this method forces\n\ -any unwritten data to be written to the disk."; +any unwritten data to be written to the disk."); static PyObject * dbm_sync(register dbmobject *dp, PyObject *args) @@ -406,8 +406,8 @@ static PyTypeObject Dbmtype = { /* ----------------------------------------------------------------- */ -static char dbmopen__doc__[] = "\ -open(filename, [flags, [mode]]) -> dbm_object\n\ +PyDoc_STRVAR(dbmopen__doc__, +"open(filename, [flags, [mode]]) -> dbm_object\n\ Open a dbm database and return a dbm object. The filename argument is\n\ the name of the database file.\n\ \n\ @@ -428,7 +428,7 @@ The 's' flag causes all database operations to be synchronized to\n\ disk. The 'u' flag disables locking of the database file.\n\ \n\ The optional mode argument is the Unix mode of the file, used only\n\ -when the database has to be created. It defaults to octal 0666. "; +when the database has to be created. It defaults to octal 0666. "); static PyObject * dbmopen(PyObject *self, PyObject *args) diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index daad5742e6..c834009940 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -15,11 +15,11 @@ static PyStructSequence_Field struct_group_type_fields[] = { {0} }; -static char struct_group__doc__[] = +PyDoc_STRVAR(struct_group__doc__, "grp.struct_group: Results from getgr*() routines.\n\n\ This object may be accessed either as a tuple of\n\ (gr_name,gr_passwd,gr_gid,gr_mem)\n\ -or via the object attributes as named in the above tuple.\n"; +or via the object attributes as named in the above tuple.\n"); static PyStructSequence_Desc struct_group_type_desc = { "grp.struct_group", @@ -139,7 +139,7 @@ Return a list of all available group entries, in arbitrary order."}, {NULL, NULL} /* sentinel */ }; -static char grp__doc__[] = +PyDoc_STRVAR(grp__doc__, "Access to the Unix group database.\n\ \n\ Group entries are reported as 4-tuples containing the following fields\n\ @@ -153,7 +153,7 @@ from the group database, in order:\n\ The gid is an integer, name and password are strings. (Note that most\n\ users are not explicitly listed as members of the groups they are in\n\ according to the password database. Check both databases to get\n\ -complete membership information.)"; +complete membership information.)"); DL_EXPORT(void) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index b6489fdc63..88b439f837 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -85,13 +85,13 @@ math_2(PyObject *args, double (*func) (double, double), char *argsfmt) static PyObject * math_##funcname(PyObject *self, PyObject *args) { \ return math_1(args, func, "d:" #funcname); \ }\ - static char math_##funcname##_doc [] = docstring; + PyDoc_STRVAR(math_##funcname##_doc, docstring); #define FUNC2(funcname, func, docstring) \ static PyObject * math_##funcname(PyObject *self, PyObject *args) { \ return math_2(args, func, "dd:" #funcname); \ }\ - static char math_##funcname##_doc [] = docstring; + PyDoc_STRVAR(math_##funcname##_doc, docstring); FUNC1(acos, acos, "acos(x)\n\nReturn the arc cosine (measured in radians) of x.") @@ -155,12 +155,12 @@ math_frexp(PyObject *self, PyObject *args) return Py_BuildValue("(di)", x, i); } -static char math_frexp_doc [] = +PyDoc_STRVAR(math_frexp_doc, "frexp(x)\n" "\n" "Return the mantissa and exponent of x, as pair (m, e).\n" "m is a float and e is an int, such that x = m * 2.**e.\n" -"If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0."; +"If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0."); static PyObject * math_ldexp(PyObject *self, PyObject *args) @@ -180,8 +180,8 @@ math_ldexp(PyObject *self, PyObject *args) return PyFloat_FromDouble(x); } -static char math_ldexp_doc [] = -"ldexp(x, i) -> x * (2**i)"; +PyDoc_STRVAR(math_ldexp_doc, +"ldexp(x, i) -> x * (2**i)"); static PyObject * math_modf(PyObject *self, PyObject *args) @@ -206,11 +206,11 @@ math_modf(PyObject *self, PyObject *args) return Py_BuildValue("(dd)", x, y); } -static char math_modf_doc [] = +PyDoc_STRVAR(math_modf_doc, "modf(x)\n" "\n" "Return the fractional and integer parts of x. Both results carry the sign\n" -"of x. The integer part is returned as a real."; +"of x. The integer part is returned as a real."); /* A decent logarithm is easy to compute even for huge longs, but libm can't do that by itself -- loghelper can. func is log or log10, and name is @@ -262,8 +262,8 @@ math_log(PyObject *self, PyObject *args) return loghelper(args, log, "log"); } -static char math_log_doc[] = -"log(x) -> the natural logarithm (base e) of x."; +PyDoc_STRVAR(math_log_doc, +"log(x) -> the natural logarithm (base e) of x."); static PyObject * math_log10(PyObject *self, PyObject *args) @@ -271,8 +271,8 @@ math_log10(PyObject *self, PyObject *args) return loghelper(args, log10, "log10"); } -static char math_log10_doc[] = -"log10(x) -> the base 10 logarithm of x."; +PyDoc_STRVAR(math_log10_doc, +"log10(x) -> the base 10 logarithm of x."); static const double degToRad = 3.141592653589793238462643383 / 180.0; @@ -285,8 +285,8 @@ math_degrees(PyObject *self, PyObject *args) return PyFloat_FromDouble(x / degToRad); } -static char math_degrees_doc[] = -"degrees(x) -> converts angle x from radians to degrees"; +PyDoc_STRVAR(math_degrees_doc, +"degrees(x) -> converts angle x from radians to degrees"); static PyObject * math_radians(PyObject *self, PyObject *args) @@ -297,8 +297,8 @@ math_radians(PyObject *self, PyObject *args) return PyFloat_FromDouble(x * degToRad); } -static char math_radians_doc[] = -"radians(x) -> converts angle x from degrees to radians"; +PyDoc_STRVAR(math_radians_doc, +"radians(x) -> converts angle x from degrees to radians"); static PyMethodDef math_methods[] = { {"acos", math_acos, METH_VARARGS, math_acos_doc}, @@ -330,9 +330,9 @@ static PyMethodDef math_methods[] = { }; -static char module_doc [] = +PyDoc_STRVAR(module_doc, "This module is always available. It provides access to the\n" -"mathematical functions defined by the C standard."; +"mathematical functions defined by the C standard."); DL_EXPORT(void) initmath(void) diff --git a/Modules/md5module.c b/Modules/md5module.c index a6068ff23f..045f27ffc8 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -61,12 +61,12 @@ md5_update(md5object *self, PyObject *args) return Py_None; } -static char update_doc [] = +PyDoc_STRVAR(update_doc, "update (arg)\n\ \n\ Update the md5 object with the string arg. Repeated calls are\n\ equivalent to a single call with the concatenation of all the\n\ -arguments."; +arguments."); static PyObject * @@ -82,12 +82,12 @@ md5_digest(md5object *self) return PyString_FromStringAndSize((char *)aDigest, 16); } -static char digest_doc [] = +PyDoc_STRVAR(digest_doc, "digest() -> string\n\ \n\ Return the digest of the strings passed to the update() method so\n\ far. This is an 16-byte string which may contain non-ASCII characters,\n\ -including null bytes."; +including null bytes."); static PyObject * @@ -116,10 +116,10 @@ md5_hexdigest(md5object *self) } -static char hexdigest_doc [] = +PyDoc_STRVAR(hexdigest_doc, "hexdigest() -> string\n\ \n\ -Like digest(), but returns the digest as a string of hexadecimal digits."; +Like digest(), but returns the digest as a string of hexadecimal digits."); static PyObject * @@ -135,10 +135,10 @@ md5_copy(md5object *self) return (PyObject *)md5p; } -static char copy_doc [] = +PyDoc_STRVAR(copy_doc, "copy() -> md5 object\n\ \n\ -Return a copy (``clone'') of the md5 object."; +Return a copy (``clone'') of the md5 object."); static PyMethodDef md5_methods[] = { @@ -159,8 +159,7 @@ md5_getattr(md5object *self, char *name) return Py_FindMethod(md5_methods, (PyObject *)self, name); } -static char module_doc [] = - +PyDoc_STRVAR(module_doc, "This module implements the interface to RSA's MD5 message digest\n\ algorithm (see also Internet RFC 1321). Its use is quite\n\ straightforward: use the new() to create an md5 object. You can now\n\ @@ -176,10 +175,9 @@ md5([arg]) -- DEPRECATED, same as new, but for compatibility\n\ \n\ Special Objects:\n\ \n\ -MD5Type -- type object for md5 objects\n\ -"; +MD5Type -- type object for md5 objects"); -static char md5type_doc [] = +PyDoc_STRVAR(md5type_doc, "An md5 represents the object used to calculate the MD5 checksum of a\n\ string of information.\n\ \n\ @@ -187,8 +185,7 @@ Methods:\n\ \n\ update() -- updates the current digest with an additional string\n\ digest() -- return the current digest value\n\ -copy() -- return a copy of the current md5 object\n\ -"; +copy() -- return a copy of the current md5 object"); statichere PyTypeObject MD5type = { PyObject_HEAD_INIT(NULL) @@ -238,11 +235,11 @@ MD5_new(PyObject *self, PyObject *args) return (PyObject *)md5p; } -static char new_doc [] = +PyDoc_STRVAR(new_doc, "new([arg]) -> md5 object\n\ \n\ Return a new md5 object. If arg is present, the method call update(arg)\n\ -is made."; +is made."); /* List of functions exported by this module */ diff --git a/Modules/newmodule.c b/Modules/newmodule.c index 0a48926da6..6897c8645f 100644 --- a/Modules/newmodule.c +++ b/Modules/newmodule.c @@ -4,9 +4,9 @@ #include "Python.h" #include "compile.h" -static char new_instance_doc[] = +PyDoc_STRVAR(new_instance_doc, "Create an instance object from (CLASS [, DICT]) without calling its\n\ -__init__() method. DICT must be a dictionary or None."; +__init__() method. DICT must be a dictionary or None."); static PyObject * new_instance(PyObject* unused, PyObject* args) @@ -30,8 +30,8 @@ new_instance(PyObject* unused, PyObject* args) return PyInstance_NewRaw(klass, dict); } -static char new_im_doc[] = -"Create a instance method object from (FUNCTION, INSTANCE, CLASS)."; +PyDoc_STRVAR(new_im_doc, +"Create a instance method object from (FUNCTION, INSTANCE, CLASS)."); static PyObject * new_instancemethod(PyObject* unused, PyObject* args) @@ -53,8 +53,8 @@ new_instancemethod(PyObject* unused, PyObject* args) return PyMethod_New(func, self, classObj); } -static char new_function_doc[] = -"Create a function object from (CODE, GLOBALS, [NAME [, ARGDEFS]])."; +PyDoc_STRVAR(new_function_doc, +"Create a function object from (CODE, GLOBALS, [NAME [, ARGDEFS]])."); static PyObject * new_function(PyObject* unused, PyObject* args) @@ -95,10 +95,10 @@ new_function(PyObject* unused, PyObject* args) return (PyObject *)newfunc; } -static char new_code_doc[] = +PyDoc_STRVAR(new_code_doc, "Create a code object from (ARGCOUNT, NLOCALS, STACKSIZE, FLAGS, CODESTRING,\n" "CONSTANTS, NAMES, VARNAMES, FILENAME, NAME, FIRSTLINENO, LNOTAB, FREEVARS,\n" -"CELLVARS)."; +"CELLVARS)."); static PyObject * new_code(PyObject* unused, PyObject* args) @@ -157,8 +157,8 @@ new_code(PyObject* unused, PyObject* args) firstlineno, lnotab); } -static char new_module_doc[] = -"Create a module object from (NAME)."; +PyDoc_STRVAR(new_module_doc, +"Create a module object from (NAME)."); static PyObject * new_module(PyObject* unused, PyObject* args) @@ -170,8 +170,8 @@ new_module(PyObject* unused, PyObject* args) return PyModule_New(name); } -static char new_class_doc[] = -"Create a class object from (NAME, BASE_CLASSES, DICT)."; +PyDoc_STRVAR(new_class_doc, +"Create a class object from (NAME, BASE_CLASSES, DICT)."); static PyObject * new_class(PyObject* unused, PyObject* args) @@ -202,10 +202,10 @@ static PyMethodDef new_methods[] = { {NULL, NULL} /* sentinel */ }; -static char new_doc[] = +PyDoc_STRVAR(new_doc, "Functions to create new objects used by the interpreter.\n\ \n\ -You need to know a great deal about the interpreter to use this!"; +You need to know a great deal about the interpreter to use this!"); DL_EXPORT(void) initnew(void) diff --git a/Modules/operator.c b/Modules/operator.c index d1ea181ef4..fbe8c145aa 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -1,14 +1,14 @@ -static char operator_doc[] = "\ -Operator interface.\n\ + +#include "Python.h" + +PyDoc_STRVAR(operator_doc, +"Operator interface.\n\ \n\ This module exports a set of functions implemented in C corresponding\n\ to the intrinsic operators of Python. For example, operator.add(x, y)\n\ is equivalent to the expression x+y. The function names are those\n\ used for special class methods; variants without leading and trailing\n\ -'__' are also provided for convenience.\n\ -"; - -#include "Python.h" +'__' are also provided for convenience."); #define spam1(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ PyObject *a1; \ diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 24dec1f208..854d986746 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -46,20 +46,17 @@ char *strdup(char *); /* String constants used to initialize module attributes. * */ -static char* -parser_copyright_string -= "Copyright 1995-1996 by Virginia Polytechnic Institute & State\n\ +static char parser_copyright_string[] = +"Copyright 1995-1996 by Virginia Polytechnic Institute & State\n\ University, Blacksburg, Virginia, USA, and Fred L. Drake, Jr., Reston,\n\ Virginia, USA. Portions copyright 1991-1995 by Stichting Mathematisch\n\ Centrum, Amsterdam, The Netherlands."; -static char* -parser_doc_string -= "This is an interface to Python's internal parser."; +PyDoc_STRVAR(parser_doc_string, +"This is an interface to Python's internal parser."); -static char* -parser_version_string = "0.5"; +static char parser_version_string[] = "0.5"; typedef PyObject* (*SeqMaker) (int length); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 95f4613ac3..7e90fbc0b0 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -13,14 +13,14 @@ /* See also ../Dos/dosmodule.c */ -static char posix__doc__ [] = +#include "Python.h" +#include "structseq.h" + +PyDoc_STRVAR(posix__doc__, "This module provides access to operating system functionality that is\n\ standardized by the C Standard and the POSIX standard (a thinly\n\ disguised Unix interface). Refer to the library manual and\n\ -corresponding Unix manual entries for more information on calls."; - -#include "Python.h" -#include "structseq.h" +corresponding Unix manual entries for more information on calls."); #if defined(PYOS_OS2) #define INCL_DOS @@ -519,7 +519,7 @@ posix_2str(PyObject *args, char *format, return Py_None; } -static char stat_result__doc__[] = +PyDoc_STRVAR(stat_result__doc__, "stat_result: Result from stat or lstat.\n\n\ This object may be accessed either as a tuple of\n\ (mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\ @@ -528,7 +528,7 @@ or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ Posix/windows: If your platform supports st_blksize, st_blocks, or st_rdev,\n\ they are available as attributes only.\n\ \n\ -See os.stat for more information.\n"; +See os.stat for more information."); static PyStructSequence_Field stat_result_fields[] = { {"st_mode", "protection bits"}, @@ -578,13 +578,13 @@ static PyStructSequence_Desc stat_result_desc = { 10 }; -static char statvfs_result__doc__[] = +PyDoc_STRVAR(statvfs_result__doc__, "statvfs_result: Result from statvfs or fstatvfs.\n\n\ This object may be accessed either as a tuple of\n\ (bsize,frsize,blocks,bfree,bavail,files,ffree,favail,flag,namemax),\n\ or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.\n\ \n\ -See os.statvfs for more information.\n"; +See os.statvfs for more information."); static PyStructSequence_Field statvfs_result_fields[] = { {"f_bsize", }, @@ -734,9 +734,9 @@ posix_do_stat(PyObject *self, PyObject *args, char *format, /* POSIX methods */ -static char posix_access__doc__[] = +PyDoc_STRVAR(posix_access__doc__, "access(path, mode) -> 1 if granted, 0 otherwise\n\ -Test for access to a file."; +Test for access to a file."); static PyObject * posix_access(PyObject *self, PyObject *args) @@ -767,9 +767,9 @@ posix_access(PyObject *self, PyObject *args) #endif #ifdef HAVE_TTYNAME -static char posix_ttyname__doc__[] = +PyDoc_STRVAR(posix_ttyname__doc__, "ttyname(fd) -> String\n\ -Return the name of the terminal device connected to 'fd'."; +Return the name of the terminal device connected to 'fd'."); static PyObject * posix_ttyname(PyObject *self, PyObject *args) @@ -788,9 +788,9 @@ posix_ttyname(PyObject *self, PyObject *args) #endif #ifdef HAVE_CTERMID -static char posix_ctermid__doc__[] = +PyDoc_STRVAR(posix_ctermid__doc__, "ctermid() -> String\n\ -Return the name of the controlling terminal for this process."; +Return the name of the controlling terminal for this process."); static PyObject * posix_ctermid(PyObject *self, PyObject *args) @@ -812,9 +812,9 @@ posix_ctermid(PyObject *self, PyObject *args) } #endif -static char posix_chdir__doc__[] = +PyDoc_STRVAR(posix_chdir__doc__, "chdir(path) -> None\n\ -Change the current working directory to the specified path."; +Change the current working directory to the specified path."); static PyObject * posix_chdir(PyObject *self, PyObject *args) @@ -827,10 +827,10 @@ posix_chdir(PyObject *self, PyObject *args) } #ifdef HAVE_FCHDIR -static char posix_fchdir__doc__[] = +PyDoc_STRVAR(posix_fchdir__doc__, "fchdir(fildes) -> None\n\ Change to the directory of the given file descriptor. fildes must be\n\ -opened on a directory, not a file."; +opened on a directory, not a file."); static PyObject * posix_fchdir(PyObject *self, PyObject *fdobj) @@ -840,9 +840,9 @@ posix_fchdir(PyObject *self, PyObject *fdobj) #endif /* HAVE_FCHDIR */ -static char posix_chmod__doc__[] = +PyDoc_STRVAR(posix_chmod__doc__, "chmod(path, mode) -> None\n\ -Change the access permissions of a file."; +Change the access permissions of a file."); static PyObject * posix_chmod(PyObject *self, PyObject *args) @@ -865,9 +865,9 @@ posix_chmod(PyObject *self, PyObject *args) #ifdef HAVE_CHROOT -static char posix_chroot__doc__[] = +PyDoc_STRVAR(posix_chroot__doc__, "chroot(path) -> None\n\ -Change root directory to path."; +Change root directory to path."); static PyObject * posix_chroot(PyObject *self, PyObject *args) @@ -877,9 +877,9 @@ posix_chroot(PyObject *self, PyObject *args) #endif #ifdef HAVE_FSYNC -static char posix_fsync__doc__[] = +PyDoc_STRVAR(posix_fsync__doc__, "fsync(fildes) -> None\n\ -force write of file with filedescriptor to disk."; +force write of file with filedescriptor to disk."); static PyObject * posix_fsync(PyObject *self, PyObject *fdobj) @@ -894,10 +894,10 @@ posix_fsync(PyObject *self, PyObject *fdobj) extern int fdatasync(int); /* On HP-UX, in libc but not in unistd.h */ #endif -static char posix_fdatasync__doc__[] = +PyDoc_STRVAR(posix_fdatasync__doc__, "fdatasync(fildes) -> None\n\ force write of file with filedescriptor to disk.\n\ - does not force update of metadata."; + does not force update of metadata."); static PyObject * posix_fdatasync(PyObject *self, PyObject *fdobj) @@ -908,9 +908,9 @@ posix_fdatasync(PyObject *self, PyObject *fdobj) #ifdef HAVE_CHOWN -static char posix_chown__doc__[] = +PyDoc_STRVAR(posix_chown__doc__, "chown(path, uid, gid) -> None\n\ -Change the owner and group id of path to the numeric uid and gid."; +Change the owner and group id of path to the numeric uid and gid."); static PyObject * posix_chown(PyObject *self, PyObject *args) @@ -935,9 +935,9 @@ posix_chown(PyObject *self, PyObject *args) #ifdef HAVE_GETCWD -static char posix_getcwd__doc__[] = +PyDoc_STRVAR(posix_getcwd__doc__, "getcwd() -> path\n\ -Return a string representing the current working directory."; +Return a string representing the current working directory."); static PyObject * posix_getcwd(PyObject *self, PyObject *args) @@ -961,9 +961,9 @@ posix_getcwd(PyObject *self, PyObject *args) #ifdef HAVE_LINK -static char posix_link__doc__[] = +PyDoc_STRVAR(posix_link__doc__, "link(src, dst) -> None\n\ -Create a hard link to a file."; +Create a hard link to a file."); static PyObject * posix_link(PyObject *self, PyObject *args) @@ -973,14 +973,14 @@ posix_link(PyObject *self, PyObject *args) #endif /* HAVE_LINK */ -static char posix_listdir__doc__[] = +PyDoc_STRVAR(posix_listdir__doc__, "listdir(path) -> list_of_strings\n\ Return a list containing the names of the entries in the directory.\n\ \n\ path: path of directory to list\n\ \n\ The list is in arbitrary order. It does not include the special\n\ -entries '.' and '..' even if they are present in the directory."; +entries '.' and '..' even if they are present in the directory."); static PyObject * posix_listdir(PyObject *self, PyObject *args) @@ -1238,9 +1238,9 @@ posix__getfullpathname(PyObject *self, PyObject *args) } /* end of posix__getfullpathname */ #endif /* MS_WIN32 */ -static char posix_mkdir__doc__[] = +PyDoc_STRVAR(posix_mkdir__doc__, "mkdir(path [, mode=0777]) -> None\n\ -Create a directory."; +Create a directory."); static PyObject * posix_mkdir(PyObject *self, PyObject *args) @@ -1273,9 +1273,9 @@ posix_mkdir(PyObject *self, PyObject *args) #endif #endif -static char posix_nice__doc__[] = +PyDoc_STRVAR(posix_nice__doc__, "nice(inc) -> new_priority\n\ -Decrease the priority of process and return new priority."; +Decrease the priority of process and return new priority."); static PyObject * posix_nice(PyObject *self, PyObject *args) @@ -1309,9 +1309,9 @@ posix_nice(PyObject *self, PyObject *args) #endif /* HAVE_NICE */ -static char posix_rename__doc__[] = +PyDoc_STRVAR(posix_rename__doc__, "rename(old, new) -> None\n\ -Rename a file or directory."; +Rename a file or directory."); static PyObject * posix_rename(PyObject *self, PyObject *args) @@ -1320,9 +1320,9 @@ posix_rename(PyObject *self, PyObject *args) } -static char posix_rmdir__doc__[] = +PyDoc_STRVAR(posix_rmdir__doc__, "rmdir(path) -> None\n\ -Remove a directory."; +Remove a directory."); static PyObject * posix_rmdir(PyObject *self, PyObject *args) @@ -1331,10 +1331,10 @@ posix_rmdir(PyObject *self, PyObject *args) } -static char posix_stat__doc__[] = +PyDoc_STRVAR(posix_stat__doc__, "stat(path) -> (st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid,\n\ st_size, st_atime, st_mtime, st_ctime)\n\ -Perform a stat system call on the given path."; +Perform a stat system call on the given path."); static PyObject * posix_stat(PyObject *self, PyObject *args) @@ -1344,9 +1344,9 @@ posix_stat(PyObject *self, PyObject *args) #ifdef HAVE_SYSTEM -static char posix_system__doc__[] = +PyDoc_STRVAR(posix_system__doc__, "system(command) -> exit_status\n\ -Execute the command (a string) in a subshell."; +Execute the command (a string) in a subshell."); static PyObject * posix_system(PyObject *self, PyObject *args) @@ -1363,9 +1363,9 @@ posix_system(PyObject *self, PyObject *args) #endif -static char posix_umask__doc__[] = +PyDoc_STRVAR(posix_umask__doc__, "umask(new_mask) -> old_mask\n\ -Set the current numeric umask and return the previous umask."; +Set the current numeric umask and return the previous umask."); static PyObject * posix_umask(PyObject *self, PyObject *args) @@ -1380,13 +1380,13 @@ posix_umask(PyObject *self, PyObject *args) } -static char posix_unlink__doc__[] = +PyDoc_STRVAR(posix_unlink__doc__, "unlink(path) -> None\n\ -Remove a file (same as remove(path))."; +Remove a file (same as remove(path))."); -static char posix_remove__doc__[] = +PyDoc_STRVAR(posix_remove__doc__, "remove(path) -> None\n\ -Remove a file (same as unlink(path))."; +Remove a file (same as unlink(path))."); static PyObject * posix_unlink(PyObject *self, PyObject *args) @@ -1396,9 +1396,9 @@ posix_unlink(PyObject *self, PyObject *args) #ifdef HAVE_UNAME -static char posix_uname__doc__[] = +PyDoc_STRVAR(posix_uname__doc__, "uname() -> (sysname, nodename, release, version, machine)\n\ -Return a tuple identifying the current operating system."; +Return a tuple identifying the current operating system."); static PyObject * posix_uname(PyObject *self, PyObject *args) @@ -1422,11 +1422,11 @@ posix_uname(PyObject *self, PyObject *args) #endif /* HAVE_UNAME */ -static char posix_utime__doc__[] = +PyDoc_STRVAR(posix_utime__doc__, "utime(path, (atime, utime)) -> None\n\ utime(path, None) -> None\n\ Set the access and modified time of the file to the given values. If the\n\ -second form is used, set the access and modified times to the current time."; +second form is used, set the access and modified times to the current time."); static PyObject * posix_utime(PyObject *self, PyObject *args) @@ -1481,9 +1481,9 @@ posix_utime(PyObject *self, PyObject *args) /* Process operations */ -static char posix__exit__doc__[] = +PyDoc_STRVAR(posix__exit__doc__, "_exit(status)\n\ -Exit to the system with specified status, without normal exit processing."; +Exit to the system with specified status, without normal exit processing."); static PyObject * posix__exit(PyObject *self, PyObject *args) @@ -1497,12 +1497,12 @@ posix__exit(PyObject *self, PyObject *args) #ifdef HAVE_EXECV -static char posix_execv__doc__[] = +PyDoc_STRVAR(posix_execv__doc__, "execv(path, args)\n\ Execute an executable path with arguments, replacing current process.\n\ \n\ path: path of executable file\n\ - args: tuple or list of strings"; + args: tuple or list of strings"); static PyObject * posix_execv(PyObject *self, PyObject *args) @@ -1563,13 +1563,13 @@ posix_execv(PyObject *self, PyObject *args) } -static char posix_execve__doc__[] = +PyDoc_STRVAR(posix_execve__doc__, "execve(path, args, env)\n\ Execute a path with arguments and environment, replacing current process.\n\ \n\ path: path of executable file\n\ args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"; + env: dictionary of strings mapping to strings"); static PyObject * posix_execve(PyObject *self, PyObject *args) @@ -1696,13 +1696,13 @@ posix_execve(PyObject *self, PyObject *args) #ifdef HAVE_SPAWNV -static char posix_spawnv__doc__[] = +PyDoc_STRVAR(posix_spawnv__doc__, "spawnv(mode, path, args)\n\ Execute the program 'path' in a new process.\n\ \n\ mode: mode of process creation\n\ path: path of executable file\n\ - args: tuple or list of strings"; + args: tuple or list of strings"); static PyObject * posix_spawnv(PyObject *self, PyObject *args) @@ -1771,14 +1771,14 @@ posix_spawnv(PyObject *self, PyObject *args) } -static char posix_spawnve__doc__[] = +PyDoc_STRVAR(posix_spawnve__doc__, "spawnve(mode, path, args, env)\n\ Execute the program 'path' in a new process.\n\ \n\ mode: mode of process creation\n\ path: path of executable file\n\ args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"; + env: dictionary of strings mapping to strings"); static PyObject * posix_spawnve(PyObject *self, PyObject *args) @@ -1903,11 +1903,11 @@ posix_spawnve(PyObject *self, PyObject *args) #ifdef HAVE_FORK1 -static char posix_fork1__doc__[] = +PyDoc_STRVAR(posix_fork1__doc__, "fork1() -> pid\n\ Fork a child process with a single multiplexed (i.e., not bound) thread.\n\ \n\ -Return 0 to child process and PID of child to parent process."; +Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork1(self, args) @@ -1927,11 +1927,11 @@ posix_fork1(self, args) #ifdef HAVE_FORK -static char posix_fork__doc__[] = +PyDoc_STRVAR(posix_fork__doc__, "fork() -> pid\n\ Fork a child process.\n\ \n\ -Return 0 to child process and PID of child to parent process."; +Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork(PyObject *self, PyObject *args) @@ -1959,9 +1959,9 @@ posix_fork(PyObject *self, PyObject *args) #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ #if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) -static char posix_openpty__doc__[] = +PyDoc_STRVAR(posix_openpty__doc__, "openpty() -> (master_fd, slave_fd)\n\ -Open a pseudo-terminal, returning open fd's for both master and slave end.\n"; +Open a pseudo-terminal, returning open fd's for both master and slave end.\n"); static PyObject * posix_openpty(PyObject *self, PyObject *args) @@ -1993,11 +1993,11 @@ posix_openpty(PyObject *self, PyObject *args) #endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) */ #ifdef HAVE_FORKPTY -static char posix_forkpty__doc__[] = +PyDoc_STRVAR(posix_forkpty__doc__, "forkpty() -> (pid, master_fd)\n\ Fork a new process with a new pseudo-terminal as controlling tty.\n\n\ Like fork(), return 0 as pid to child process, and PID of child to parent.\n\ -To both, return fd of newly opened pseudo-terminal.\n"; +To both, return fd of newly opened pseudo-terminal.\n"); static PyObject * posix_forkpty(PyObject *self, PyObject *args) @@ -2016,9 +2016,9 @@ posix_forkpty(PyObject *self, PyObject *args) #endif #ifdef HAVE_GETEGID -static char posix_getegid__doc__[] = +PyDoc_STRVAR(posix_getegid__doc__, "getegid() -> egid\n\ -Return the current process's effective group id."; +Return the current process's effective group id."); static PyObject * posix_getegid(PyObject *self, PyObject *args) @@ -2031,9 +2031,9 @@ posix_getegid(PyObject *self, PyObject *args) #ifdef HAVE_GETEUID -static char posix_geteuid__doc__[] = +PyDoc_STRVAR(posix_geteuid__doc__, "geteuid() -> euid\n\ -Return the current process's effective user id."; +Return the current process's effective user id."); static PyObject * posix_geteuid(PyObject *self, PyObject *args) @@ -2046,9 +2046,9 @@ posix_geteuid(PyObject *self, PyObject *args) #ifdef HAVE_GETGID -static char posix_getgid__doc__[] = +PyDoc_STRVAR(posix_getgid__doc__, "getgid() -> gid\n\ -Return the current process's group id."; +Return the current process's group id."); static PyObject * posix_getgid(PyObject *self, PyObject *args) @@ -2060,9 +2060,9 @@ posix_getgid(PyObject *self, PyObject *args) #endif -static char posix_getpid__doc__[] = +PyDoc_STRVAR(posix_getpid__doc__, "getpid() -> pid\n\ -Return the current process id"; +Return the current process id"); static PyObject * posix_getpid(PyObject *self, PyObject *args) @@ -2074,9 +2074,9 @@ posix_getpid(PyObject *self, PyObject *args) #ifdef HAVE_GETGROUPS -static char posix_getgroups__doc__[] = "\ -getgroups() -> list of group IDs\n\ -Return list of supplemental group IDs for the process."; +PyDoc_STRVAR(posix_getgroups__doc__, +"getgroups() -> list of group IDs\n\ +Return list of supplemental group IDs for the process."); static PyObject * posix_getgroups(PyObject *self, PyObject *args) @@ -2118,9 +2118,9 @@ posix_getgroups(PyObject *self, PyObject *args) #endif #ifdef HAVE_GETPGRP -static char posix_getpgrp__doc__[] = +PyDoc_STRVAR(posix_getpgrp__doc__, "getpgrp() -> pgrp\n\ -Return the current process group id."; +Return the current process group id."); static PyObject * posix_getpgrp(PyObject *self, PyObject *args) @@ -2137,9 +2137,9 @@ posix_getpgrp(PyObject *self, PyObject *args) #ifdef HAVE_SETPGRP -static char posix_setpgrp__doc__[] = +PyDoc_STRVAR(posix_setpgrp__doc__, "setpgrp() -> None\n\ -Make this process a session leader."; +Make this process a session leader."); static PyObject * posix_setpgrp(PyObject *self, PyObject *args) @@ -2159,9 +2159,9 @@ posix_setpgrp(PyObject *self, PyObject *args) #endif /* HAVE_SETPGRP */ #ifdef HAVE_GETPPID -static char posix_getppid__doc__[] = +PyDoc_STRVAR(posix_getppid__doc__, "getppid() -> ppid\n\ -Return the parent's process id."; +Return the parent's process id."); static PyObject * posix_getppid(PyObject *self, PyObject *args) @@ -2174,9 +2174,9 @@ posix_getppid(PyObject *self, PyObject *args) #ifdef HAVE_GETLOGIN -static char posix_getlogin__doc__[] = "\ -getlogin() -> string\n\ -Return the actual login name."; +PyDoc_STRVAR(posix_getlogin__doc__, +"getlogin() -> string\n\ +Return the actual login name."); static PyObject * posix_getlogin(PyObject *self, PyObject *args) @@ -2205,9 +2205,9 @@ posix_getlogin(PyObject *self, PyObject *args) #endif #ifdef HAVE_GETUID -static char posix_getuid__doc__[] = +PyDoc_STRVAR(posix_getuid__doc__, "getuid() -> uid\n\ -Return the current process's user id."; +Return the current process's user id."); static PyObject * posix_getuid(PyObject *self, PyObject *args) @@ -2220,9 +2220,9 @@ posix_getuid(PyObject *self, PyObject *args) #ifdef HAVE_KILL -static char posix_kill__doc__[] = +PyDoc_STRVAR(posix_kill__doc__, "kill(pid, sig) -> None\n\ -Kill a process with a signal."; +Kill a process with a signal."); static PyObject * posix_kill(PyObject *self, PyObject *args) @@ -2253,9 +2253,9 @@ posix_kill(PyObject *self, PyObject *args) #endif #ifdef HAVE_KILLPG -static char posix_killpg__doc__[] = +PyDoc_STRVAR(posix_killpg__doc__, "killpg(pgid, sig) -> None\n\ -Kill a process group with a signal."; +Kill a process group with a signal."); static PyObject * posix_killpg(PyObject *self, PyObject *args) @@ -2276,9 +2276,9 @@ posix_killpg(PyObject *self, PyObject *args) #include #endif -static char posix_plock__doc__[] = +PyDoc_STRVAR(posix_plock__doc__, "plock(op) -> None\n\ -Lock program segments into memory."; +Lock program segments into memory."); static PyObject * posix_plock(PyObject *self, PyObject *args) @@ -2295,9 +2295,9 @@ posix_plock(PyObject *self, PyObject *args) #ifdef HAVE_POPEN -static char posix_popen__doc__[] = +PyDoc_STRVAR(posix_popen__doc__, "popen(command [, mode='r' [, bufsize]]) -> pipe\n\ -Open a pipe to/from a command returning a file object."; +Open a pipe to/from a command returning a file object."); #if defined(PYOS_OS2) #if defined(PYCC_VACPP) @@ -3835,9 +3835,10 @@ posix_popen(PyObject *self, PyObject *args) #ifdef HAVE_SETUID -static char posix_setuid__doc__[] = +PyDoc_STRVAR(posix_setuid__doc__, "setuid(uid) -> None\n\ -Set the current process's user id."; +Set the current process's user id."); + static PyObject * posix_setuid(PyObject *self, PyObject *args) { @@ -3853,9 +3854,10 @@ posix_setuid(PyObject *self, PyObject *args) #ifdef HAVE_SETEUID -static char posix_seteuid__doc__[] = +PyDoc_STRVAR(posix_seteuid__doc__, "seteuid(uid) -> None\n\ -Set the current process's effective user id."; +Set the current process's effective user id."); + static PyObject * posix_seteuid (PyObject *self, PyObject *args) { @@ -3872,9 +3874,10 @@ posix_seteuid (PyObject *self, PyObject *args) #endif /* HAVE_SETEUID */ #ifdef HAVE_SETEGID -static char posix_setegid__doc__[] = +PyDoc_STRVAR(posix_setegid__doc__, "setegid(gid) -> None\n\ -Set the current process's effective group id."; +Set the current process's effective group id."); + static PyObject * posix_setegid (PyObject *self, PyObject *args) { @@ -3891,9 +3894,10 @@ posix_setegid (PyObject *self, PyObject *args) #endif /* HAVE_SETEGID */ #ifdef HAVE_SETREUID -static char posix_setreuid__doc__[] = +PyDoc_STRVAR(posix_setreuid__doc__, "seteuid(ruid, euid) -> None\n\ -Set the current process's real and effective user ids."; +Set the current process's real and effective user ids."); + static PyObject * posix_setreuid (PyObject *self, PyObject *args) { @@ -3910,9 +3914,10 @@ posix_setreuid (PyObject *self, PyObject *args) #endif /* HAVE_SETREUID */ #ifdef HAVE_SETREGID -static char posix_setregid__doc__[] = +PyDoc_STRVAR(posix_setregid__doc__, "setegid(rgid, egid) -> None\n\ -Set the current process's real and effective group ids."; +Set the current process's real and effective group ids."); + static PyObject * posix_setregid (PyObject *self, PyObject *args) { @@ -3929,9 +3934,9 @@ posix_setregid (PyObject *self, PyObject *args) #endif /* HAVE_SETREGID */ #ifdef HAVE_SETGID -static char posix_setgid__doc__[] = +PyDoc_STRVAR(posix_setgid__doc__, "setgid(gid) -> None\n\ -Set the current process's group id."; +Set the current process's group id."); static PyObject * posix_setgid(PyObject *self, PyObject *args) @@ -3947,9 +3952,9 @@ posix_setgid(PyObject *self, PyObject *args) #endif /* HAVE_SETGID */ #ifdef HAVE_SETGROUPS -static char posix_setgroups__doc__[] = +PyDoc_STRVAR(posix_setgroups__doc__, "setgroups(list) -> None\n\ -Set the groups of the current process to list."; +Set the groups of the current process to list."); static PyObject * posix_setgroups(PyObject *self, PyObject *args) @@ -3993,9 +3998,9 @@ posix_setgroups(PyObject *self, PyObject *args) #endif /* HAVE_SETGROUPS */ #ifdef HAVE_WAITPID -static char posix_waitpid__doc__[] = +PyDoc_STRVAR(posix_waitpid__doc__, "waitpid(pid, options) -> (pid, status)\n\ -Wait for completion of a given child process."; +Wait for completion of a given child process."); static PyObject * posix_waitpid(PyObject *self, PyObject *args) @@ -4024,9 +4029,9 @@ posix_waitpid(PyObject *self, PyObject *args) #elif defined(HAVE_CWAIT) /* MS C has a variant of waitpid() that's usable for most purposes. */ -static char posix_waitpid__doc__[] = +PyDoc_STRVAR(posix_waitpid__doc__, "waitpid(pid, options) -> (pid, status << 8)\n" -"Wait for completion of a given process. options is ignored on Windows."; +"Wait for completion of a given process. options is ignored on Windows."); static PyObject * posix_waitpid(PyObject *self, PyObject *args) @@ -4049,9 +4054,9 @@ posix_waitpid(PyObject *self, PyObject *args) #endif /* HAVE_WAITPID || HAVE_CWAIT */ #ifdef HAVE_WAIT -static char posix_wait__doc__[] = +PyDoc_STRVAR(posix_wait__doc__, "wait() -> (pid, status)\n\ -Wait for completion of a child process."; +Wait for completion of a child process."); static PyObject * posix_wait(PyObject *self, PyObject *args) @@ -4079,10 +4084,10 @@ posix_wait(PyObject *self, PyObject *args) #endif -static char posix_lstat__doc__[] = +PyDoc_STRVAR(posix_lstat__doc__, "lstat(path) -> (st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid,\n\ st_size, st_atime, st_mtime, st_ctime)\n\ -Like stat(path), but do not follow symbolic links."; +Like stat(path), but do not follow symbolic links."); static PyObject * posix_lstat(PyObject *self, PyObject *args) @@ -4096,9 +4101,9 @@ posix_lstat(PyObject *self, PyObject *args) #ifdef HAVE_READLINK -static char posix_readlink__doc__[] = +PyDoc_STRVAR(posix_readlink__doc__, "readlink(path) -> path\n\ -Return a string representing the path to which the symbolic link points."; +Return a string representing the path to which the symbolic link points."); static PyObject * posix_readlink(PyObject *self, PyObject *args) @@ -4119,9 +4124,9 @@ posix_readlink(PyObject *self, PyObject *args) #ifdef HAVE_SYMLINK -static char posix_symlink__doc__[] = +PyDoc_STRVAR(posix_symlink__doc__, "symlink(src, dst) -> None\n\ -Create a symbolic link."; +Create a symbolic link."); static PyObject * posix_symlink(PyObject *self, PyObject *args) @@ -4215,16 +4220,16 @@ posix_times(PyObject *self, PyObject *args) #endif /* MS_WIN32 */ #ifdef HAVE_TIMES -static char posix_times__doc__[] = +PyDoc_STRVAR(posix_times__doc__, "times() -> (utime, stime, cutime, cstime, elapsed_time)\n\ -Return a tuple of floating point numbers indicating process times."; +Return a tuple of floating point numbers indicating process times."); #endif #ifdef HAVE_SETSID -static char posix_setsid__doc__[] = +PyDoc_STRVAR(posix_setsid__doc__, "setsid() -> None\n\ -Call the system call setsid()."; +Call the system call setsid()."); static PyObject * posix_setsid(PyObject *self, PyObject *args) @@ -4239,9 +4244,9 @@ posix_setsid(PyObject *self, PyObject *args) #endif /* HAVE_SETSID */ #ifdef HAVE_SETPGID -static char posix_setpgid__doc__[] = +PyDoc_STRVAR(posix_setpgid__doc__, "setpgid(pid, pgrp) -> None\n\ -Call the system call setpgid()."; +Call the system call setpgid()."); static PyObject * posix_setpgid(PyObject *self, PyObject *args) @@ -4258,9 +4263,9 @@ posix_setpgid(PyObject *self, PyObject *args) #ifdef HAVE_TCGETPGRP -static char posix_tcgetpgrp__doc__[] = +PyDoc_STRVAR(posix_tcgetpgrp__doc__, "tcgetpgrp(fd) -> pgid\n\ -Return the process group associated with the terminal given by a fd."; +Return the process group associated with the terminal given by a fd."); static PyObject * posix_tcgetpgrp(PyObject *self, PyObject *args) @@ -4277,9 +4282,9 @@ posix_tcgetpgrp(PyObject *self, PyObject *args) #ifdef HAVE_TCSETPGRP -static char posix_tcsetpgrp__doc__[] = +PyDoc_STRVAR(posix_tcsetpgrp__doc__, "tcsetpgrp(fd, pgid) -> None\n\ -Set the process group associated with the terminal given by a fd."; +Set the process group associated with the terminal given by a fd."); static PyObject * posix_tcsetpgrp(PyObject *self, PyObject *args) @@ -4296,9 +4301,9 @@ posix_tcsetpgrp(PyObject *self, PyObject *args) /* Functions acting on file descriptors */ -static char posix_open__doc__[] = +PyDoc_STRVAR(posix_open__doc__, "open(filename, flag [, mode=0777]) -> fd\n\ -Open a file (for low level IO)."; +Open a file (for low level IO)."); static PyObject * posix_open(PyObject *self, PyObject *args) @@ -4322,9 +4327,9 @@ posix_open(PyObject *self, PyObject *args) } -static char posix_close__doc__[] = +PyDoc_STRVAR(posix_close__doc__, "close(fd) -> None\n\ -Close a file descriptor (for low level IO)."; +Close a file descriptor (for low level IO)."); static PyObject * posix_close(PyObject *self, PyObject *args) @@ -4342,9 +4347,9 @@ posix_close(PyObject *self, PyObject *args) } -static char posix_dup__doc__[] = +PyDoc_STRVAR(posix_dup__doc__, "dup(fd) -> fd2\n\ -Return a duplicate of a file descriptor."; +Return a duplicate of a file descriptor."); static PyObject * posix_dup(PyObject *self, PyObject *args) @@ -4361,9 +4366,9 @@ posix_dup(PyObject *self, PyObject *args) } -static char posix_dup2__doc__[] = +PyDoc_STRVAR(posix_dup2__doc__, "dup2(fd, fd2) -> None\n\ -Duplicate file descriptor."; +Duplicate file descriptor."); static PyObject * posix_dup2(PyObject *self, PyObject *args) @@ -4381,9 +4386,9 @@ posix_dup2(PyObject *self, PyObject *args) } -static char posix_lseek__doc__[] = +PyDoc_STRVAR(posix_lseek__doc__, "lseek(fd, pos, how) -> newpos\n\ -Set the current position of a file descriptor."; +Set the current position of a file descriptor."); static PyObject * posix_lseek(PyObject *self, PyObject *args) @@ -4433,9 +4438,9 @@ posix_lseek(PyObject *self, PyObject *args) } -static char posix_read__doc__[] = +PyDoc_STRVAR(posix_read__doc__, "read(fd, buffersize) -> string\n\ -Read a file descriptor."; +Read a file descriptor."); static PyObject * posix_read(PyObject *self, PyObject *args) @@ -4460,9 +4465,9 @@ posix_read(PyObject *self, PyObject *args) } -static char posix_write__doc__[] = +PyDoc_STRVAR(posix_write__doc__, "write(fd, string) -> byteswritten\n\ -Write a string to a file descriptor."; +Write a string to a file descriptor."); static PyObject * posix_write(PyObject *self, PyObject *args) @@ -4480,9 +4485,9 @@ posix_write(PyObject *self, PyObject *args) } -static char posix_fstat__doc__[]= +PyDoc_STRVAR(posix_fstat__doc__, "fstat(fd) -> (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)\n\ -Like stat(), but for an open file descriptor."; +Like stat(), but for an open file descriptor."); static PyObject * posix_fstat(PyObject *self, PyObject *args) @@ -4502,9 +4507,9 @@ posix_fstat(PyObject *self, PyObject *args) } -static char posix_fdopen__doc__[] = +PyDoc_STRVAR(posix_fdopen__doc__, "fdopen(fd, [, mode='r' [, bufsize]]) -> file_object\n\ -Return an open file object connected to a file descriptor."; +Return an open file object connected to a file descriptor."); static PyObject * posix_fdopen(PyObject *self, PyObject *args) @@ -4528,10 +4533,10 @@ posix_fdopen(PyObject *self, PyObject *args) return f; } -static char posix_isatty__doc__[] = +PyDoc_STRVAR(posix_isatty__doc__, "isatty(fd) -> bool\n\ Return True if the file descriptor 'fd' is an open file descriptor\n\ -connected to the slave end of a terminal."; +connected to the slave end of a terminal."); static PyObject * posix_isatty(PyObject *self, PyObject *args) @@ -4543,9 +4548,9 @@ posix_isatty(PyObject *self, PyObject *args) } #ifdef HAVE_PIPE -static char posix_pipe__doc__[] = +PyDoc_STRVAR(posix_pipe__doc__, "pipe() -> (read_end, write_end)\n\ -Create a pipe."; +Create a pipe."); static PyObject * posix_pipe(PyObject *self, PyObject *args) @@ -4597,9 +4602,9 @@ posix_pipe(PyObject *self, PyObject *args) #ifdef HAVE_MKFIFO -static char posix_mkfifo__doc__[] = +PyDoc_STRVAR(posix_mkfifo__doc__, "mkfifo(filename, [, mode=0666]) -> None\n\ -Create a FIFO (a POSIX named pipe)."; +Create a FIFO (a POSIX named pipe)."); static PyObject * posix_mkfifo(PyObject *self, PyObject *args) @@ -4621,14 +4626,14 @@ posix_mkfifo(PyObject *self, PyObject *args) #ifdef HAVE_MKNOD -static char posix_mknod__doc__[] = +PyDoc_STRVAR(posix_mknod__doc__, "mknod(filename, [, mode=0600, major, minor]) -> None\n\ Create a filesystem node (file, device special file or named pipe)\n\ named filename. mode specifies both the permissions to use and the\n\ type of node to be created, being combined (bitwise OR) with one of\n\ S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\ major and minor define the newly created device special file, otherwise\n\ -they are ignored."; +they are ignored."); static PyObject * @@ -4654,9 +4659,9 @@ posix_mknod(PyObject *self, PyObject *args) #ifdef HAVE_FTRUNCATE -static char posix_ftruncate__doc__[] = +PyDoc_STRVAR(posix_ftruncate__doc__, "ftruncate(fd, length) -> None\n\ -Truncate a file to a specified length."; +Truncate a file to a specified length."); static PyObject * posix_ftruncate(PyObject *self, PyObject *args) @@ -4691,9 +4696,9 @@ posix_ftruncate(PyObject *self, PyObject *args) #endif #ifdef HAVE_PUTENV -static char posix_putenv__doc__[] = +PyDoc_STRVAR(posix_putenv__doc__, "putenv(key, value) -> None\n\ -Change or add an environment variable."; +Change or add an environment variable."); /* Save putenv() parameters as values here, so we can collect them when they * get re-set with another call for the same key. */ @@ -4768,9 +4773,9 @@ posix_putenv(PyObject *self, PyObject *args) #endif /* putenv */ #ifdef HAVE_UNSETENV -static char posix_unsetenv__doc__[] = +PyDoc_STRVAR(posix_unsetenv__doc__, "unsetenv(key) -> None\n\ -Delete an environment variable."; +Delete an environment variable."); static PyObject * posix_unsetenv(PyObject *self, PyObject *args) @@ -4799,9 +4804,9 @@ posix_unsetenv(PyObject *self, PyObject *args) #endif /* unsetenv */ #ifdef HAVE_STRERROR -static char posix_strerror__doc__[] = +PyDoc_STRVAR(posix_strerror__doc__, "strerror(code) -> string\n\ -Translate an error code to a message string."; +Translate an error code to a message string."); static PyObject * posix_strerror(PyObject *self, PyObject *args) @@ -4824,9 +4829,9 @@ posix_strerror(PyObject *self, PyObject *args) #ifdef HAVE_SYS_WAIT_H #ifdef WCOREDUMP -static char posix_WCOREDUMP__doc__[] = +PyDoc_STRVAR(posix_WCOREDUMP__doc__, "WCOREDUMP(status) -> bool\n\ -Return True if the process returning 'status' was dumped to a core file."; +Return True if the process returning 'status' was dumped to a core file."); static PyObject * posix_WCOREDUMP(PyObject *self, PyObject *args) @@ -4851,10 +4856,10 @@ posix_WCOREDUMP(PyObject *self, PyObject *args) #endif /* WCOREDUMP */ #ifdef WIFCONTINUED -static char posix_WIFCONTINUED__doc__[] = +PyDoc_STRVAR(posix_WIFCONTINUED__doc__, "WIFCONTINUED(status) -> bool\n\ Return True if the process returning 'status' was continued from a\n\ -job control stop."; +job control stop."); static PyObject * posix_WIFCONTINUED(PyObject *self, PyObject *args) @@ -4879,9 +4884,9 @@ posix_WIFCONTINUED(PyObject *self, PyObject *args) #endif /* WIFCONTINUED */ #ifdef WIFSTOPPED -static char posix_WIFSTOPPED__doc__[] = +PyDoc_STRVAR(posix_WIFSTOPPED__doc__, "WIFSTOPPED(status) -> bool\n\ -Return True if the process returning 'status' was stopped."; +Return True if the process returning 'status' was stopped."); static PyObject * posix_WIFSTOPPED(PyObject *self, PyObject *args) @@ -4906,9 +4911,9 @@ posix_WIFSTOPPED(PyObject *self, PyObject *args) #endif /* WIFSTOPPED */ #ifdef WIFSIGNALED -static char posix_WIFSIGNALED__doc__[] = +PyDoc_STRVAR(posix_WIFSIGNALED__doc__, "WIFSIGNALED(status) -> bool\n\ -Return True if the process returning 'status' was terminated by a signal."; +Return True if the process returning 'status' was terminated by a signal."); static PyObject * posix_WIFSIGNALED(PyObject *self, PyObject *args) @@ -4933,10 +4938,10 @@ posix_WIFSIGNALED(PyObject *self, PyObject *args) #endif /* WIFSIGNALED */ #ifdef WIFEXITED -static char posix_WIFEXITED__doc__[] = +PyDoc_STRVAR(posix_WIFEXITED__doc__, "WIFEXITED(status) -> bool\n\ Return true if the process returning 'status' exited using the exit()\n\ -system call."; +system call."); static PyObject * posix_WIFEXITED(PyObject *self, PyObject *args) @@ -4961,9 +4966,9 @@ posix_WIFEXITED(PyObject *self, PyObject *args) #endif /* WIFEXITED */ #ifdef WEXITSTATUS -static char posix_WEXITSTATUS__doc__[] = +PyDoc_STRVAR(posix_WEXITSTATUS__doc__, "WEXITSTATUS(status) -> integer\n\ -Return the process return code from 'status'."; +Return the process return code from 'status'."); static PyObject * posix_WEXITSTATUS(PyObject *self, PyObject *args) @@ -4988,10 +4993,10 @@ posix_WEXITSTATUS(PyObject *self, PyObject *args) #endif /* WEXITSTATUS */ #ifdef WTERMSIG -static char posix_WTERMSIG__doc__[] = +PyDoc_STRVAR(posix_WTERMSIG__doc__, "WTERMSIG(status) -> integer\n\ Return the signal that terminated the process that provided the 'status'\n\ -value."; +value."); static PyObject * posix_WTERMSIG(PyObject *self, PyObject *args) @@ -5016,9 +5021,10 @@ posix_WTERMSIG(PyObject *self, PyObject *args) #endif /* WTERMSIG */ #ifdef WSTOPSIG -static char posix_WSTOPSIG__doc__[] = +PyDoc_STRVAR(posix_WSTOPSIG__doc__, "WSTOPSIG(status) -> integer\n\ -Return the signal that stopped the process that provided the 'status' value."; +Return the signal that stopped the process that provided\n\ +the 'status' value."); static PyObject * posix_WSTOPSIG(PyObject *self, PyObject *args) @@ -5092,10 +5098,10 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) { return v; } -static char posix_fstatvfs__doc__[] = +PyDoc_STRVAR(posix_fstatvfs__doc__, "fstatvfs(fd) -> \n\ (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\ -Perform an fstatvfs system call on the given fd."; +Perform an fstatvfs system call on the given fd."); static PyObject * posix_fstatvfs(PyObject *self, PyObject *args) @@ -5119,10 +5125,10 @@ posix_fstatvfs(PyObject *self, PyObject *args) #if defined(HAVE_STATVFS) #include -static char posix_statvfs__doc__[] = +PyDoc_STRVAR(posix_statvfs__doc__, "statvfs(path) -> \n\ (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\ -Perform a statvfs system call on the given path."; +Perform a statvfs system call on the given path."); static PyObject * posix_statvfs(PyObject *self, PyObject *args) @@ -5144,11 +5150,11 @@ posix_statvfs(PyObject *self, PyObject *args) #ifdef HAVE_TEMPNAM -static char posix_tempnam__doc__[] = "\ -tempnam([dir[, prefix]]) -> string\n\ +PyDoc_STRVAR(posix_tempnam__doc__, +"tempnam([dir[, prefix]]) -> string\n\ Return a unique name for a temporary file.\n\ The directory and a short may be specified as strings; they may be omitted\n\ -or None if not needed."; +or None if not needed."); static PyObject * posix_tempnam(PyObject *self, PyObject *args) @@ -5180,9 +5186,9 @@ posix_tempnam(PyObject *self, PyObject *args) #ifdef HAVE_TMPFILE -static char posix_tmpfile__doc__[] = "\ -tmpfile() -> file object\n\ -Create a temporary file with no directory entries."; +PyDoc_STRVAR(posix_tmpfile__doc__, +"tmpfile() -> file object\n\ +Create a temporary file with no directory entries."); static PyObject * posix_tmpfile(PyObject *self, PyObject *args) @@ -5200,9 +5206,9 @@ posix_tmpfile(PyObject *self, PyObject *args) #ifdef HAVE_TMPNAM -static char posix_tmpnam__doc__[] = "\ -tmpnam() -> string\n\ -Return a unique name for a temporary file."; +PyDoc_STRVAR(posix_tmpnam__doc__, +"tmpnam() -> string\n\ +Return a unique name for a temporary file."); static PyObject * posix_tmpnam(PyObject *self, PyObject *args) @@ -5355,10 +5361,10 @@ conv_path_confname(PyObject *arg, int *valuep) #endif #ifdef HAVE_FPATHCONF -static char posix_fpathconf__doc__[] = "\ -fpathconf(fd, name) -> integer\n\ +PyDoc_STRVAR(posix_fpathconf__doc__, +"fpathconf(fd, name) -> integer\n\ Return the configuration limit name for the file descriptor fd.\n\ -If there is no limit, return -1."; +If there is no limit, return -1."); static PyObject * posix_fpathconf(PyObject *self, PyObject *args) @@ -5383,10 +5389,10 @@ posix_fpathconf(PyObject *self, PyObject *args) #ifdef HAVE_PATHCONF -static char posix_pathconf__doc__[] = "\ -pathconf(path, name) -> integer\n\ +PyDoc_STRVAR(posix_pathconf__doc__, +"pathconf(path, name) -> integer\n\ Return the configuration limit name for the file or directory path.\n\ -If there is no limit, return -1."; +If there is no limit, return -1."); static PyObject * posix_pathconf(PyObject *self, PyObject *args) @@ -5571,9 +5577,9 @@ conv_confstr_confname(PyObject *arg, int *valuep) / sizeof(struct constdef)); } -static char posix_confstr__doc__[] = "\ -confstr(name) -> string\n\ -Return a string-valued system configuration variable."; +PyDoc_STRVAR(posix_confstr__doc__, +"confstr(name) -> string\n\ +Return a string-valued system configuration variable."); static PyObject * posix_confstr(PyObject *self, PyObject *args) @@ -6111,9 +6117,9 @@ conv_sysconf_confname(PyObject *arg, int *valuep) / sizeof(struct constdef)); } -static char posix_sysconf__doc__[] = "\ -sysconf(name) -> integer\n\ -Return an integer-valued system configuration variable."; +PyDoc_STRVAR(posix_sysconf__doc__, +"sysconf(name) -> integer\n\ +Return an integer-valued system configuration variable."); static PyObject * posix_sysconf(PyObject *self, PyObject *args) @@ -6210,10 +6216,10 @@ setup_confname_tables(PyObject *module) } -static char posix_abort__doc__[] = "\ -abort() -> does not return!\n\ +PyDoc_STRVAR(posix_abort__doc__, +"abort() -> does not return!\n\ Abort the interpreter immediately. This 'dumps core' or otherwise fails\n\ -in the hardest way possible on the hosting operating system."; +in the hardest way possible on the hosting operating system."); static PyObject * posix_abort(PyObject *self, PyObject *args) @@ -6227,8 +6233,8 @@ posix_abort(PyObject *self, PyObject *args) } #ifdef MS_WIN32 -static char win32_startfile__doc__[] = "\ -startfile(filepath) - Start a file with its associated application.\n\ +PyDoc_STRVAR(win32_startfile__doc__, +"startfile(filepath) - Start a file with its associated application.\n\ \n\ This acts like double-clicking the file in Explorer, or giving the file\n\ name as an argument to the DOS \"start\" command: the file is opened\n\ @@ -6240,7 +6246,7 @@ to retrieve the application's exit status.\n\ \n\ The filepath is relative to the current directory. If you want to use\n\ an absolute path, make sure the first character is not a slash (\"/\");\n\ -the underlying Win32 ShellExecute function doesn't work if it is."; +the underlying Win32 ShellExecute function doesn't work if it is."); static PyObject * win32_startfile(PyObject *self, PyObject *args) diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 701ae03251..b51b7f91e1 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -18,11 +18,11 @@ static PyStructSequence_Field struct_pwd_type_fields[] = { {0} }; -static char struct_passwd__doc__[] = +PyDoc_STRVAR(struct_passwd__doc__, "pwd.struct_passwd: Results from getpw*() routines.\n\n\ This object may be accessed either as a tuple of\n\ (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)\n\ -or via the object attributes as named in the above tuple.\n"; +or via the object attributes as named in the above tuple."); static PyStructSequence_Desc struct_pwd_type_desc = { "pwd.struct_passwd", @@ -31,15 +31,15 @@ static PyStructSequence_Desc struct_pwd_type_desc = { 7, }; -static char pwd__doc__ [] = "\ -This module provides access to the Unix password database.\n\ +PyDoc_STRVAR(pwd__doc__, +"This module provides access to the Unix password database.\n\ It is available on all Unix versions.\n\ \n\ Password database entries are reported as 7-tuples containing the following\n\ items from the password database (see `'), in order:\n\ pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell.\n\ The uid and gid items are integers, all others are strings. An\n\ -exception is raised if the entry asked for cannot be found."; +exception is raised if the entry asked for cannot be found."); static PyTypeObject StructPwdType; @@ -74,10 +74,11 @@ mkpwent(struct passwd *p) return v; } -static char pwd_getpwuid__doc__[] = "\ -getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)\n\ +PyDoc_STRVAR(pwd_getpwuid__doc__, +"getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,\n\ + pw_gid,pw_gecos,pw_dir,pw_shell)\n\ Return the password database entry for the given numeric user ID.\n\ -See pwd.__doc__ for more on password database entries."; +See pwd.__doc__ for more on password database entries."); static PyObject * pwd_getpwuid(PyObject *self, PyObject *args) @@ -93,10 +94,11 @@ pwd_getpwuid(PyObject *self, PyObject *args) return mkpwent(p); } -static char pwd_getpwnam__doc__[] = "\ -getpwnam(name) -> (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)\n\ +PyDoc_STRVAR(pwd_getpwnam__doc__, +"getpwnam(name) -> (pw_name,pw_passwd,pw_uid,\n\ + pw_gid,pw_gecos,pw_dir,pw_shell)\n\ Return the password database entry for the given user name.\n\ -See pwd.__doc__ for more on password database entries."; +See pwd.__doc__ for more on password database entries."); static PyObject * pwd_getpwnam(PyObject *self, PyObject *args) @@ -113,11 +115,11 @@ pwd_getpwnam(PyObject *self, PyObject *args) } #ifdef HAVE_GETPWENT -static char pwd_getpwall__doc__[] = "\ -getpwall() -> list_of_entries\n\ +PyDoc_STRVAR(pwd_getpwall__doc__, +"getpwall() -> list_of_entries\n\ Return a list of all available password database entries, \ in arbitrary order.\n\ -See pwd.__doc__ for more on password database entries."; +See pwd.__doc__ for more on password database entries."); static PyObject * pwd_getpwall(PyObject *self) diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 3153693dd2..ae8bf1b666 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -625,9 +625,9 @@ VOID_HANDLER(EndDoctypeDecl, (void *userData), ("()")) /* ---------------------------------------------------------------- */ -static char xmlparse_Parse__doc__[] = +PyDoc_STRVAR(xmlparse_Parse__doc__, "Parse(data[, isfinal])\n\ -Parse XML data. `isfinal' should be true at end of input."; +Parse XML data. `isfinal' should be true at end of input."); static PyObject * xmlparse_Parse(xmlparseobject *self, PyObject *args) @@ -695,9 +695,9 @@ finally: return len; } -static char xmlparse_ParseFile__doc__[] = +PyDoc_STRVAR(xmlparse_ParseFile__doc__, "ParseFile(file)\n\ -Parse XML data from file-like object."; +Parse XML data from file-like object."); static PyObject * xmlparse_ParseFile(xmlparseobject *self, PyObject *args) @@ -754,9 +754,9 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *args) return Py_BuildValue("i", rv); } -static char xmlparse_SetBase__doc__[] = +PyDoc_STRVAR(xmlparse_SetBase__doc__, "SetBase(base_url)\n\ -Set the base URL for the parser."; +Set the base URL for the parser."); static PyObject * xmlparse_SetBase(xmlparseobject *self, PyObject *args) @@ -772,9 +772,9 @@ xmlparse_SetBase(xmlparseobject *self, PyObject *args) return Py_None; } -static char xmlparse_GetBase__doc__[] = +PyDoc_STRVAR(xmlparse_GetBase__doc__, "GetBase() -> url\n\ -Return base URL string for the parser."; +Return base URL string for the parser."); static PyObject * xmlparse_GetBase(xmlparseobject *self, PyObject *args) @@ -785,11 +785,11 @@ xmlparse_GetBase(xmlparseobject *self, PyObject *args) return Py_BuildValue("z", XML_GetBase(self->itself)); } -static char xmlparse_GetInputContext__doc__[] = +PyDoc_STRVAR(xmlparse_GetInputContext__doc__, "GetInputContext() -> string\n\ Return the untranslated text of the input that caused the current event.\n\ If the event was generated by a large amount of text (such as a start tag\n\ -for an element with many attributes), not all of the text may be available."; +for an element with many attributes), not all of the text may be available."); static PyObject * xmlparse_GetInputContext(xmlparseobject *self, PyObject *args) @@ -817,10 +817,10 @@ xmlparse_GetInputContext(xmlparseobject *self, PyObject *args) return result; } -static char xmlparse_ExternalEntityParserCreate__doc__[] = +PyDoc_STRVAR(xmlparse_ExternalEntityParserCreate__doc__, "ExternalEntityParserCreate(context[, encoding])\n\ Create a parser for parsing an external entity based on the\n\ -information passed to the ExternalEntityRefHandler."; +information passed to the ExternalEntityRefHandler."); static PyObject * xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args) @@ -892,13 +892,13 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args) return (PyObject *)new_parser; } -static char xmlparse_SetParamEntityParsing__doc__[] = +PyDoc_STRVAR(xmlparse_SetParamEntityParsing__doc__, "SetParamEntityParsing(flag) -> success\n\ Controls parsing of parameter entities (including the external DTD\n\ subset). Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n\ XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n\ XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n\ -was successful."; +was successful."); static PyObject* xmlparse_SetParamEntityParsing(xmlparseobject *p, PyObject* args) @@ -1225,8 +1225,7 @@ xmlparse_clear(xmlparseobject *op) } #endif -static char Xmlparsetype__doc__[] = -"XML parser"; +PyDoc_STRVAR(Xmlparsetype__doc__, "XML parser"); static PyTypeObject Xmlparsetype = { PyObject_HEAD_INIT(NULL) @@ -1267,9 +1266,9 @@ static PyTypeObject Xmlparsetype = { /* End of code for xmlparser objects */ /* -------------------------------------------------------- */ -static char pyexpat_ParserCreate__doc__[] = +PyDoc_STRVAR(pyexpat_ParserCreate__doc__, "ParserCreate([encoding[, namespace_separator]]) -> parser\n\ -Return a new XML parser object."; +Return a new XML parser object."); static PyObject * pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) @@ -1291,9 +1290,9 @@ pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) return newxmlparseobject(encoding, namespace_separator); } -static char pyexpat_ErrorString__doc__[] = +PyDoc_STRVAR(pyexpat_ErrorString__doc__, "ErrorString(errno) -> string\n\ -Returns string error for given number."; +Returns string error for given number."); static PyObject * pyexpat_ErrorString(PyObject *self, PyObject *args) @@ -1318,8 +1317,8 @@ static struct PyMethodDef pyexpat_methods[] = { /* Module docstring */ -static char pyexpat_module_documentation[] = -"Python wrapper for Expat parser."; +PyDoc_STRVAR(pyexpat_module_documentation, +"Python wrapper for Expat parser."); #if PY_VERSION_HEX < 0x20000F0 diff --git a/Modules/readline.c b/Modules/readline.c index 1ca8ec3c09..afd80db98e 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -46,10 +46,9 @@ parse_and_bind(PyObject *self, PyObject *args) return Py_None; } -static char doc_parse_and_bind[] = "\ -parse_and_bind(string) -> None\n\ -Parse and execute single line of a readline init file.\ -"; +PyDoc_STRVAR(doc_parse_and_bind, +"parse_and_bind(string) -> None\n\ +Parse and execute single line of a readline init file."); /* Exported function to parse a readline init file */ @@ -67,11 +66,10 @@ read_init_file(PyObject *self, PyObject *args) return Py_None; } -static char doc_read_init_file[] = "\ -read_init_file([filename]) -> None\n\ +PyDoc_STRVAR(doc_read_init_file, +"read_init_file([filename]) -> None\n\ Parse a readline initialization file.\n\ -The default filename is the last filename used.\ -"; +The default filename is the last filename used."); /* Exported function to load a readline history file */ @@ -90,11 +88,10 @@ read_history_file(PyObject *self, PyObject *args) } static int history_length = -1; /* do not truncate history by default */ -static char doc_read_history_file[] = "\ -read_history_file([filename]) -> None\n\ +PyDoc_STRVAR(doc_read_history_file, +"read_history_file([filename]) -> None\n\ Load a readline history file.\n\ -The default filename is ~/.history.\ -"; +The default filename is ~/.history."); /* Exported function to save a readline history file */ @@ -114,19 +111,17 @@ write_history_file(PyObject *self, PyObject *args) return Py_None; } -static char doc_write_history_file[] = "\ -write_history_file([filename]) -> None\n\ +PyDoc_STRVAR(doc_write_history_file, +"write_history_file([filename]) -> None\n\ Save a readline history file.\n\ -The default filename is ~/.history.\ -"; +The default filename is ~/.history."); -static char set_history_length_doc[] = "\ -set_history_length(length) -> None\n\ +PyDoc_STRVAR(set_history_length_doc, +"set_history_length(length) -> None\n\ set the maximal number of items which will be written to\n\ the history file. A negative length is used to inhibit\n\ -history truncation.\n\ -"; +history truncation."); static PyObject* set_history_length(PyObject *self, PyObject *args) @@ -141,11 +136,10 @@ set_history_length(PyObject *self, PyObject *args) -static char get_history_length_doc[] = "\ -get_history_length() -> int\n\ +PyDoc_STRVAR(get_history_length_doc, +"get_history_length() -> int\n\ return the maximum number of items that will be written to\n\ -the history file.\n\ -"; +the history file."); static PyObject* get_history_length(PyObject *self, PyObject *args) @@ -204,12 +198,11 @@ set_startup_hook(PyObject *self, PyObject *args) return set_hook("startup_hook", &startup_hook, &startup_hook_tstate, args); } -static char doc_set_startup_hook[] = "\ -set_startup_hook([function]) -> None\n\ +PyDoc_STRVAR(doc_set_startup_hook, +"set_startup_hook([function]) -> None\n\ Set or remove the startup_hook function.\n\ The function is called with no arguments just\n\ -before readline prints the first prompt.\n\ -"; +before readline prints the first prompt."); #ifdef HAVE_RL_PRE_INPUT_HOOK static PyObject * @@ -218,13 +211,12 @@ set_pre_input_hook(PyObject *self, PyObject *args) return set_hook("pre_input_hook", &pre_input_hook, &pre_input_hook_tstate, args); } -static char doc_set_pre_input_hook[] = "\ -set_pre_input_hook([function]) -> None\n\ +PyDoc_STRVAR(doc_set_pre_input_hook, +"set_pre_input_hook([function]) -> None\n\ Set or remove the pre_input_hook function.\n\ The function is called with no arguments after the first prompt\n\ has been printed and just before readline starts reading input\n\ -characters.\n\ -"; +characters."); #endif /* Exported function to specify a word completer in Python */ @@ -243,9 +235,9 @@ get_begidx(PyObject *self) return begidx; } -static char doc_get_begidx[] = "\ -get_begidx() -> int\n\ -get the beginning index of the readline tab-completion scope"; +PyDoc_STRVAR(doc_get_begidx, +"get_begidx() -> int\n\ +get the beginning index of the readline tab-completion scope"); /* get the ending index for the scope of the tab-completion */ static PyObject * @@ -255,9 +247,9 @@ get_endidx(PyObject *self) return endidx; } -static char doc_get_endidx[] = "\ -get_endidx() -> int\n\ -get the ending index of the readline tab-completion scope"; +PyDoc_STRVAR(doc_get_endidx, +"get_endidx() -> int\n\ +get the ending index of the readline tab-completion scope"); /* set the tab-completion word-delimiters that readline uses */ @@ -276,9 +268,9 @@ set_completer_delims(PyObject *self, PyObject *args) return Py_None; } -static char doc_set_completer_delims[] = "\ -set_completer_delims(string) -> None\n\ -set the readline word delimiters for tab-completion"; +PyDoc_STRVAR(doc_set_completer_delims, +"set_completer_delims(string) -> None\n\ +set the readline word delimiters for tab-completion"); static PyObject * py_add_history(PyObject *self, PyObject *args) @@ -293,9 +285,9 @@ py_add_history(PyObject *self, PyObject *args) return Py_None; } -static char doc_add_history[] = "\ -add_history(string) -> None\n\ -add a line to the history buffer"; +PyDoc_STRVAR(doc_add_history, +"add_history(string) -> None\n\ +add a line to the history buffer"); /* get the tab-completion word-delimiters that readline uses */ @@ -306,9 +298,9 @@ get_completer_delims(PyObject *self) return PyString_FromString(rl_completer_word_break_characters); } -static char doc_get_completer_delims[] = "\ -get_completer_delims() -> string\n\ -get the readline word delimiters for tab-completion"; +PyDoc_STRVAR(doc_get_completer_delims, +"get_completer_delims() -> string\n\ +get the readline word delimiters for tab-completion"); static PyObject * set_completer(PyObject *self, PyObject *args) @@ -316,13 +308,12 @@ set_completer(PyObject *self, PyObject *args) return set_hook("completer", &completer, &completer_tstate, args); } -static char doc_set_completer[] = "\ -set_completer([function]) -> None\n\ +PyDoc_STRVAR(doc_set_completer, +"set_completer([function]) -> None\n\ Set or remove the completer function.\n\ The function is called as function(text, state),\n\ for state in 0, 1, 2, ..., until it returns a non-string.\n\ -It should return the next possible completion starting with 'text'.\ -"; +It should return the next possible completion starting with 'text'."); /* Exported function to get any element of history */ @@ -342,10 +333,9 @@ get_history_item(PyObject *self, PyObject *args) } } -static char doc_get_history_item[] = "\ -get_history_item() -> string\n\ -return the current contents of history item at index.\ -"; +PyDoc_STRVAR(doc_get_history_item, +"get_history_item() -> string\n\ +return the current contents of history item at index."); /* Exported function to get current length of history */ @@ -358,10 +348,9 @@ get_current_history_length(PyObject *self) return PyInt_FromLong(hist_st ? (long) hist_st->length : (long) 0); } -static char doc_get_current_history_length[] = "\ -get_current_history_length() -> integer\n\ -return the current (not the maximum) length of history.\ -"; +PyDoc_STRVAR(doc_get_current_history_length, +"get_current_history_length() -> integer\n\ +return the current (not the maximum) length of history."); /* Exported function to read the current line buffer */ @@ -371,10 +360,9 @@ get_line_buffer(PyObject *self) return PyString_FromString(rl_line_buffer); } -static char doc_get_line_buffer[] = "\ -get_line_buffer() -> string\n\ -return the current contents of the line buffer.\ -"; +PyDoc_STRVAR(doc_get_line_buffer, +"get_line_buffer() -> string\n\ +return the current contents of the line buffer."); /* Exported function to insert text into the line buffer */ @@ -389,10 +377,9 @@ insert_text(PyObject *self, PyObject *args) return Py_None; } -static char doc_insert_text[] = "\ -insert_text(string) -> None\n\ -Insert text into the command line.\ -"; +PyDoc_STRVAR(doc_insert_text, +"insert_text(string) -> None\n\ +Insert text into the command line."); static PyObject * redisplay(PyObject *self) @@ -402,11 +389,10 @@ redisplay(PyObject *self) return Py_None; } -static char doc_redisplay[] = "\ -redisplay() -> None\n\ +PyDoc_STRVAR(doc_redisplay, +"redisplay() -> None\n\ Change what's displayed on the screen to reflect the current\n\ -contents of the line buffer.\ -"; +contents of the line buffer."); /* Table of functions exported by the module */ @@ -663,8 +649,8 @@ call_readline(char *prompt) /* Initialize the module */ -static char doc_module[] = -"Importing this module enables command line editing using GNU readline."; +PyDoc_STRVAR(doc_module, +"Importing this module enables command line editing using GNU readline."); DL_EXPORT(void) initreadline(void) diff --git a/Modules/resource.c b/Modules/resource.c index 9881314c1e..5ed98a1f0a 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -17,12 +17,12 @@ static PyObject *ResourceError; -static char struct_rusage__doc__[] = - "struct_rusage: Result from getrusage.\n\n" - "This object may be accessed either as a tuple of\n" - " (utime,stime,maxrss,ixrss,idrss,isrss,minflt,majflt,\n" - " nswap,inblock,oublock,msgsnd,msgrcv,nsignals,nvcsw,nivcsw)\n" - "or via the attributes ru_utime, ru_stime, ru_maxrss, and so on.\n"; +PyDoc_STRVAR(struct_rusage__doc__, +"struct_rusage: Result from getrusage.\n\n" +"This object may be accessed either as a tuple of\n" +" (utime,stime,maxrss,ixrss,idrss,isrss,minflt,majflt,\n" +" nswap,inblock,oublock,msgsnd,msgrcv,nsignals,nvcsw,nivcsw)\n" +"or via the attributes ru_utime, ru_stime, ru_maxrss, and so on."); static PyStructSequence_Field struct_rusage_fields[] = { {"ru_utime", "user time used"}, diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index bdd3a52178..73abd4f2ae 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -351,12 +351,12 @@ update_ufd_array(pollObject *self) return 1; } -static char poll_register_doc[] = +PyDoc_STRVAR(poll_register_doc, "register(fd [, eventmask] ) -> None\n\n\ Register a file descriptor with the polling object.\n\ fd -- either an integer, or an object with a fileno() method returning an\n\ int.\n\ -events -- an optional bitmask describing the type of events to check for"; +events -- an optional bitmask describing the type of events to check for"); static PyObject * poll_register(pollObject *self, PyObject *args) @@ -394,9 +394,9 @@ poll_register(pollObject *self, PyObject *args) return Py_None; } -static char poll_unregister_doc[] = +PyDoc_STRVAR(poll_unregister_doc, "unregister(fd) -> None\n\n\ -Remove a file descriptor being tracked by the polling object."; +Remove a file descriptor being tracked by the polling object."); static PyObject * poll_unregister(pollObject *self, PyObject *args) @@ -431,10 +431,10 @@ poll_unregister(pollObject *self, PyObject *args) return Py_None; } -static char poll_poll_doc[] = +PyDoc_STRVAR(poll_poll_doc, "poll( [timeout] ) -> list of (fd, event) 2-tuples\n\n\ Polls the set of registered file descriptors, returning a list containing \n\ -any descriptors that have events or errors to report."; +any descriptors that have events or errors to report."); static PyObject * poll_poll(pollObject *self, PyObject *args) @@ -580,9 +580,9 @@ statichere PyTypeObject poll_Type = { 0, /*tp_hash*/ }; -static char poll_doc[] = +PyDoc_STRVAR(poll_doc, "Returns a polling object, which supports registering and\n\ -unregistering file descriptors, and then polling them for I/O events."; +unregistering file descriptors, and then polling them for I/O events."); static PyObject * select_poll(PyObject *self, PyObject *args) @@ -598,7 +598,7 @@ select_poll(PyObject *self, PyObject *args) } #endif /* HAVE_POLL */ -static char select_doc[] = +PyDoc_STRVAR(select_doc, "select(rlist, wlist, xlist[, timeout]) -> (rlist, wlist, xlist)\n\ \n\ Wait until one or more file descriptors are ready for some kind of I/O.\n\ @@ -619,7 +619,7 @@ arguments; each contains the subset of the corresponding file descriptors\n\ that are ready.\n\ \n\ *** IMPORTANT NOTICE ***\n\ -On Windows, only sockets are supported; on Unix, all file descriptors."; +On Windows, only sockets are supported; on Unix, all file descriptors."); static PyMethodDef select_methods[] = { {"select", select_select, METH_VARARGS, select_doc}, @@ -629,11 +629,11 @@ static PyMethodDef select_methods[] = { {0, 0}, /* sentinel */ }; -static char module_doc[] = +PyDoc_STRVAR(module_doc, "This module supports asynchronous I/O on multiple file descriptors.\n\ \n\ *** IMPORTANT NOTICE ***\n\ -On Windows, only sockets are supported; on Unix, all file descriptors."; +On Windows, only sockets are supported; on Unix, all file descriptors."); DL_EXPORT(void) initselect(void) diff --git a/Modules/shamodule.c b/Modules/shamodule.c index bb9d37a485..94b1eff484 100644 --- a/Modules/shamodule.c +++ b/Modules/shamodule.c @@ -350,8 +350,7 @@ SHA_dealloc(PyObject *ptr) /* External methods for a hashing object */ -static char SHA_copy__doc__[] = -"Return a copy of the hashing object."; +PyDoc_STRVAR(SHA_copy__doc__, "Return a copy of the hashing object."); static PyObject * SHA_copy(SHAobject *self, PyObject *args) @@ -368,8 +367,8 @@ SHA_copy(SHAobject *self, PyObject *args) return (PyObject *)newobj; } -static char SHA_digest__doc__[] = -"Return the digest value as a string of binary data."; +PyDoc_STRVAR(SHA_digest__doc__, +"Return the digest value as a string of binary data."); static PyObject * SHA_digest(SHAobject *self, PyObject *args) @@ -385,8 +384,8 @@ SHA_digest(SHAobject *self, PyObject *args) return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); } -static char SHA_hexdigest__doc__[] = -"Return the digest value as a string of hexadecimal digits."; +PyDoc_STRVAR(SHA_hexdigest__doc__, +"Return the digest value as a string of hexadecimal digits."); static PyObject * SHA_hexdigest(SHAobject *self, PyObject *args) @@ -427,8 +426,8 @@ SHA_hexdigest(SHAobject *self, PyObject *args) return retval; } -static char SHA_update__doc__[] = -"Update this hashing object's state with the provided string."; +PyDoc_STRVAR(SHA_update__doc__, +"Update this hashing object's state with the provided string."); static PyObject * SHA_update(SHAobject *self, PyObject *args) @@ -479,10 +478,10 @@ static PyTypeObject SHAtype = { /* The single module-level function: new() */ -static char SHA_new__doc__[] = - "Return a new SHA hashing object. An optional string " - "argument may be provided; if present, this string will be " - " automatically hashed."; +PyDoc_STRVAR(SHA_new__doc__, +"Return a new SHA hashing object. An optional string argument\n\ +may be provided; if present, this string will be automatically\n\ +hashed."); static PyObject * SHA_new(PyObject *self, PyObject *args, PyObject *kwdict) diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 3cea2dd77d..395e654bb2 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -96,11 +96,11 @@ signal_default_int_handler(PyObject *self, PyObject *args) return NULL; } -static char default_int_handler_doc[] = +PyDoc_STRVAR(default_int_handler_doc, "default_int_handler(...)\n\ \n\ The default handler for SIGINT instated by Python.\n\ -It raises KeyboardInterrupt."; +It raises KeyboardInterrupt."); static int @@ -155,10 +155,10 @@ signal_alarm(PyObject *self, PyObject *args) return PyInt_FromLong((long)alarm(t)); } -static char alarm_doc[] = +PyDoc_STRVAR(alarm_doc, "alarm(seconds)\n\ \n\ -Arrange for SIGALRM to arrive after the given number of seconds."; +Arrange for SIGALRM to arrive after the given number of seconds."); #endif #ifdef HAVE_PAUSE @@ -177,10 +177,10 @@ signal_pause(PyObject *self) Py_INCREF(Py_None); return Py_None; } -static char pause_doc[] = +PyDoc_STRVAR(pause_doc, "pause()\n\ \n\ -Wait until a signal arrives."; +Wait until a signal arrives."); #endif @@ -231,7 +231,7 @@ signal_signal(PyObject *self, PyObject *args) return old_handler; } -static char signal_doc[] = +PyDoc_STRVAR(signal_doc, "signal(sig, action) -> action\n\ \n\ Set the action for the given signal. The action can be SIG_DFL,\n\ @@ -240,7 +240,7 @@ returned. See getsignal() for possible return values.\n\ \n\ *** IMPORTANT NOTICE ***\n\ A signal handler function is called with two arguments:\n\ -the first is the signal number, the second is the interrupted stack frame."; +the first is the signal number, the second is the interrupted stack frame."); static PyObject * @@ -260,15 +260,14 @@ signal_getsignal(PyObject *self, PyObject *args) return old_handler; } -static char getsignal_doc[] = +PyDoc_STRVAR(getsignal_doc, "getsignal(sig) -> action\n\ \n\ Return the current action for the given signal. The return value can be:\n\ SIG_IGN -- if the signal is being ignored\n\ SIG_DFL -- if the default action for the signal is in effect\n\ None -- if an unknown handler is in effect\n\ -anything else -- the callable Python object used as a handler\n\ -"; +anything else -- the callable Python object used as a handler"); #ifdef HAVE_SIGPROCMASK /* we assume that having SIGPROCMASK is enough to guarantee full POSIX signal handling */ @@ -353,7 +352,7 @@ signal_sigprocmask(PyObject* self, PyObject* args) return _signal_sigset_to_list(&oldset); } -static char sigprocmask_doc[] = +PyDoc_STRVAR(sigprocmask_doc, "sigprocmask(how, sigset) -> sigset\n\ \n\ Change the list of currently blocked signals. The parameter how should be\n\ @@ -371,7 +370,7 @@ of how:\n\ SIG_SETMASK\n\ The set of blocked signals is set to the argument set.\n\ \n\ -A list contating the numbers of the previously blocked signals is returned."; +A list contating the numbers of the previously blocked signals is returned."); static PyObject* signal_sigpending(PyObject* self) @@ -385,11 +384,11 @@ signal_sigpending(PyObject* self) return _signal_sigset_to_list(&set); } -static char sigpending_doc[] = +PyDoc_STRVAR(sigpending_doc, "sigpending() -> sigset\n\ \n\ Return the set of pending signals, i.e. a list containing the numbers of\n\ -those signals that have been raised while blocked."; +those signals that have been raised while blocked."); static PyObject* signal_sigsuspend(PyObject* self, PyObject* arg) @@ -411,11 +410,11 @@ signal_sigsuspend(PyObject* self, PyObject* arg) return Py_None; } -static char sigsuspend_doc[] = +PyDoc_STRVAR(sigsuspend_doc, "sigsuspend(sigset) -> None\n\ \n\ Temporarily replace the signal mask with sigset (which should be a sequence\n\ -of signal numbers) and suspend the process until a signal is received."; +of signal numbers) and suspend the process until a signal is received."); #endif /* List of functions defined in the module */ @@ -443,7 +442,7 @@ static PyMethodDef signal_methods[] = { }; -static char module_doc[] = +PyDoc_STRVAR(module_doc, "This module provides mechanisms to use signal handlers in Python.\n\ \n\ Functions:\n\ @@ -468,7 +467,7 @@ SIGINT, SIGTERM, etc. -- signal numbers\n\ \n\ *** IMPORTANT NOTICE ***\n\ A signal handler function is called with two arguments:\n\ -the first is the signal number, the second is the interrupted stack frame."; +the first is the signal number, the second is the interrupted stack frame."); DL_EXPORT(void) initsignal(void) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 1da9afb800..477dc31677 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -56,8 +56,10 @@ Local naming conventions: */ +#include "Python.h" + /* Socket object documentation */ -static char sock_doc[] = +PyDoc_STRVAR(sock_doc, "socket([family[, type[, proto]]]) -> socket object\n\ \n\ Open a socket of the given type. The family argument specifies the\n\ @@ -93,9 +95,7 @@ setsockopt(level, optname, value) -- set socket options\n\ settimeout(None | float) -- set or clear the timeout\n\ shutdown(how) -- shut down traffic in one or both directions\n\ \n\ - [*] not available on all platforms!"; - -#include "Python.h" + [*] not available on all platforms!"); /* XXX This is a terrible mess of of platform-dependent preprocessor hacks. I hope some day someone can clean this up please... */ @@ -1001,12 +1001,12 @@ finally: return res; } -static char accept_doc[] = +PyDoc_STRVAR(accept_doc, "accept() -> (socket object, address info)\n\ \n\ Wait for an incoming connection. Return a new socket representing the\n\ connection, and the address of the client. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."; +info is a pair (hostaddr, port)."); /* s.setblocking(flag) method. Argument: False -- non-blocking mode; same as settimeout(0) @@ -1029,12 +1029,12 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg) return Py_None; } -static char setblocking_doc[] = +PyDoc_STRVAR(setblocking_doc, "setblocking(flag)\n\ \n\ Set the socket to blocking (flag is true) or non-blocking (false).\n\ setblocking(True) is equivalent to settimeout(None);\n\ -setblocking(False) is equivalent to settimeout(0.0)."; +setblocking(False) is equivalent to settimeout(0.0)."); /* s.settimeout(timeout) method. Argument: None -- no timeout, blocking mode; same as setblocking(True) @@ -1066,13 +1066,13 @@ sock_settimeout(PySocketSockObject *s, PyObject *arg) return Py_None; } -static char settimeout_doc[] = +PyDoc_STRVAR(settimeout_doc, "settimeout(timeout)\n\ \n\ Set a timeout on socket operations. 'timeout' can be a float,\n\ giving in seconds, or None. Setting a timeout of None disables\n\ the timeout feature and is equivalent to setblocking(1).\n\ -Setting a timeout of zero is the same as setblocking(0)."; +Setting a timeout of zero is the same as setblocking(0)."); /* s.gettimeout() method. Returns the timeout associated with a socket. */ @@ -1087,12 +1087,12 @@ sock_gettimeout(PySocketSockObject *s) return PyFloat_FromDouble(s->sock_timeout); } -static char gettimeout_doc[] = +PyDoc_STRVAR(gettimeout_doc, "gettimeout()\n\ \n\ Returns the timeout in floating seconds associated with socket \n\ operations. A timeout of None indicates that timeouts on socket \n\ -operations are disabled."; +operations are disabled."); #ifdef RISCOS /* s.sleeptaskw(1 | 0) method */ @@ -1111,10 +1111,10 @@ sock_sleeptaskw(PySocketSockObject *s,PyObject *args) Py_INCREF(Py_None); return Py_None; } -static char sleeptaskw_doc[] = +PyDoc_STRVAR(sleeptaskw_doc, "sleeptaskw(flag)\n\ \n\ -Allow sleeps in taskwindows."; +Allow sleeps in taskwindows."); #endif @@ -1151,11 +1151,11 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args) return Py_None; } -static char setsockopt_doc[] = +PyDoc_STRVAR(setsockopt_doc, "setsockopt(level, option, value)\n\ \n\ Set a socket option. See the Unix manual for level and option.\n\ -The value argument can either be an integer or a string."; +The value argument can either be an integer or a string."); /* s.getsockopt() method. @@ -1210,12 +1210,12 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args) #endif /* __BEOS__ */ } -static char getsockopt_doc[] = +PyDoc_STRVAR(getsockopt_doc, "getsockopt(level, option[, buffersize]) -> value\n\ \n\ Get a socket option. See the Unix manual for level and option.\n\ If a nonzero buffersize argument is given, the return value is a\n\ -string of that length; otherwise it is an integer."; +string of that length; otherwise it is an integer."); /* s.bind(sockaddr) method */ @@ -1238,12 +1238,12 @@ sock_bind(PySocketSockObject *s, PyObject *addro) return Py_None; } -static char bind_doc[] = +PyDoc_STRVAR(bind_doc, "bind(address)\n\ \n\ Bind the socket to a local address. For IP sockets, the address is a\n\ pair (host, port); the host must refer to the local host. For raw packet\n\ -sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])"; +sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])"); /* s.close() method. @@ -1265,10 +1265,10 @@ sock_close(PySocketSockObject *s) return Py_None; } -static char close_doc[] = +PyDoc_STRVAR(close_doc, "close()\n\ \n\ -Close the socket. It cannot be used after this call."; +Close the socket. It cannot be used after this call."); static int internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen) @@ -1330,11 +1330,11 @@ sock_connect(PySocketSockObject *s, PyObject *addro) return Py_None; } -static char connect_doc[] = +PyDoc_STRVAR(connect_doc, "connect(address)\n\ \n\ Connect the socket to a remote address. For IP sockets, the address\n\ -is a pair (host, port)."; +is a pair (host, port)."); /* s.connect_ex(sockaddr) method */ @@ -1356,11 +1356,11 @@ sock_connect_ex(PySocketSockObject *s, PyObject *addro) return PyInt_FromLong((long) res); } -static char connect_ex_doc[] = +PyDoc_STRVAR(connect_ex_doc, "connect_ex(address)\n\ \n\ This is like connect(address), but returns an error code (the errno value)\n\ -instead of raising an exception when an error occurs."; +instead of raising an exception when an error occurs."); /* s.fileno() method */ @@ -1375,10 +1375,10 @@ sock_fileno(PySocketSockObject *s) #endif } -static char fileno_doc[] = +PyDoc_STRVAR(fileno_doc, "fileno() -> integer\n\ \n\ -Return the integer file descriptor of the socket."; +Return the integer file descriptor of the socket."); #ifndef NO_DUP @@ -1402,10 +1402,10 @@ sock_dup(PySocketSockObject *s) return sock; } -static char dup_doc[] = +PyDoc_STRVAR(dup_doc, "dup() -> socket object\n\ \n\ -Return a new socket object connected to the same system resource."; +Return a new socket object connected to the same system resource."); #endif @@ -1430,11 +1430,11 @@ sock_getsockname(PySocketSockObject *s) return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen); } -static char getsockname_doc[] = +PyDoc_STRVAR(getsockname_doc, "getsockname() -> address info\n\ \n\ Return the address of the local endpoint. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."; +info is a pair (hostaddr, port)."); #ifdef HAVE_GETPEERNAME /* Cray APP doesn't have this :-( */ @@ -1458,11 +1458,11 @@ sock_getpeername(PySocketSockObject *s) return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen); } -static char getpeername_doc[] = +PyDoc_STRVAR(getpeername_doc, "getpeername() -> address info\n\ \n\ Return the address of the remote endpoint. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."; +info is a pair (hostaddr, port)."); #endif /* HAVE_GETPEERNAME */ @@ -1489,12 +1489,12 @@ sock_listen(PySocketSockObject *s, PyObject *arg) return Py_None; } -static char listen_doc[] = +PyDoc_STRVAR(listen_doc, "listen(backlog)\n\ \n\ Enable a server to accept connections. The backlog argument must be at\n\ least 1; it specifies the number of unaccepted connection that the system\n\ -will allow before refusing new connections."; +will allow before refusing new connections."); #ifndef NO_DUP @@ -1543,11 +1543,11 @@ sock_makefile(PySocketSockObject *s, PyObject *args) return f; } -static char makefile_doc[] = +PyDoc_STRVAR(makefile_doc, "makefile([mode[, buffersize]]) -> file object\n\ \n\ Return a regular file object corresponding to the socket.\n\ -The mode and buffersize arguments are as for the built-in open() function."; +The mode and buffersize arguments are as for the built-in open() function."); #endif /* NO_DUP */ @@ -1587,13 +1587,13 @@ sock_recv(PySocketSockObject *s, PyObject *args) return buf; } -static char recv_doc[] = +PyDoc_STRVAR(recv_doc, "recv(buffersize[, flags]) -> data\n\ \n\ Receive up to buffersize bytes from the socket. For the optional flags\n\ argument, see the Unix manual. When no data is available, block until\n\ at least one byte is available or until the remote end is closed. When\n\ -the remote end is closed and all data is read, return the empty string."; +the remote end is closed and all data is read, return the empty string."); /* s.recvfrom(nbytes [,flags]) method */ @@ -1653,10 +1653,10 @@ finally: return ret; } -static char recvfrom_doc[] = +PyDoc_STRVAR(recvfrom_doc, "recvfrom(buffersize[, flags]) -> (data, address info)\n\ \n\ -Like recv(buffersize, flags) but also return the sender's address info."; +Like recv(buffersize, flags) but also return the sender's address info."); /* s.send(data [,flags]) method */ @@ -1679,12 +1679,12 @@ sock_send(PySocketSockObject *s, PyObject *args) return PyInt_FromLong((long)n); } -static char send_doc[] = +PyDoc_STRVAR(send_doc, "send(data[, flags]) -> count\n\ \n\ Send a data string to the socket. For the optional flags\n\ argument, see the Unix manual. Return the number of bytes\n\ -sent; this may be less than len(data) if the network is busy."; +sent; this may be less than len(data) if the network is busy."); /* s.sendall(data [,flags]) method */ @@ -1716,13 +1716,13 @@ sock_sendall(PySocketSockObject *s, PyObject *args) return Py_None; } -static char sendall_doc[] = +PyDoc_STRVAR(sendall_doc, "sendall(data[, flags])\n\ \n\ Send a data string to the socket. For the optional flags\n\ argument, see the Unix manual. This calls send() repeatedly\n\ until all data is sent. If an error occurs, it's impossible\n\ -to tell how much data has been sent."; +to tell how much data has been sent."); /* s.sendto(data, [flags,] sockaddr) method */ @@ -1756,11 +1756,11 @@ sock_sendto(PySocketSockObject *s, PyObject *args) return PyInt_FromLong((long)n); } -static char sendto_doc[] = +PyDoc_STRVAR(sendto_doc, "sendto(data[, flags], address)\n\ \n\ Like send(data, flags) but allows specifying the destination address.\n\ -For IP sockets, the address is a pair (hostaddr, port)."; +For IP sockets, the address is a pair (hostaddr, port)."); /* s.shutdown(how) method */ @@ -1783,11 +1783,11 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg) return Py_None; } -static char shutdown_doc[] = +PyDoc_STRVAR(shutdown_doc, "shutdown(flag)\n\ \n\ Shut down the reading side of the socket (flag == 0), the writing side\n\ -of the socket (flag == 1), or both ends (flag == 2)."; +of the socket (flag == 1), or both ends (flag == 2)."); /* List of methods for socket objects */ @@ -2011,10 +2011,10 @@ socket_gethostname(PyObject *self, PyObject *args) return PyString_FromString(buf); } -static char gethostname_doc[] = +PyDoc_STRVAR(gethostname_doc, "gethostname() -> string\n\ \n\ -Return the current host name."; +Return the current host name."); /* Python interface to gethostbyname(name). */ @@ -2034,10 +2034,10 @@ socket_gethostbyname(PyObject *self, PyObject *args) sizeof(struct sockaddr_in)); } -static char gethostbyname_doc[] = +PyDoc_STRVAR(gethostbyname_doc, "gethostbyname(host) -> address\n\ \n\ -Return the IP address (a string of the form '255.255.255.255') for a host."; +Return the IP address (a string of the form '255.255.255.255') for a host."); /* Convenience function common to gethostbyname_ex and gethostbyaddr */ @@ -2235,11 +2235,11 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args) return ret; } -static char ghbn_ex_doc[] = +PyDoc_STRVAR(ghbn_ex_doc, "gethostbyname_ex(host) -> (name, aliaslist, addresslist)\n\ \n\ Return the true host name, a list of aliases, and a list of IP addresses,\n\ -for a host. The host argument is a string giving a host name or IP number."; +for a host. The host argument is a string giving a host name or IP number."); /* Python interface to gethostbyaddr(IP). */ @@ -2325,11 +2325,11 @@ socket_gethostbyaddr(PyObject *self, PyObject *args) return ret; } -static char gethostbyaddr_doc[] = +PyDoc_STRVAR(gethostbyaddr_doc, "gethostbyaddr(host) -> (name, aliaslist, addresslist)\n\ \n\ Return the true host name, a list of aliases, and a list of IP addresses,\n\ -for a host. The host argument is a string giving a host name or IP number."; +for a host. The host argument is a string giving a host name or IP number."); /* Python interface to getservbyname(name). @@ -2354,11 +2354,11 @@ socket_getservbyname(PyObject *self, PyObject *args) return PyInt_FromLong((long) ntohs(sp->s_port)); } -static char getservbyname_doc[] = +PyDoc_STRVAR(getservbyname_doc, "getservbyname(servicename, protocolname) -> integer\n\ \n\ Return a port number from a service name and protocol name.\n\ -The protocol name should be 'tcp' or 'udp'."; +The protocol name should be 'tcp' or 'udp'."); /* Python interface to getprotobyname(name). @@ -2389,10 +2389,10 @@ socket_getprotobyname(PyObject *self, PyObject *args) #endif } -static char getprotobyname_doc[] = +PyDoc_STRVAR(getprotobyname_doc, "getprotobyname(name) -> integer\n\ \n\ -Return the protocol number for the named protocol. (Rarely used.)"; +Return the protocol number for the named protocol. (Rarely used.)"); #ifndef NO_DUP @@ -2423,11 +2423,11 @@ socket_fromfd(PyObject *self, PyObject *args) return (PyObject *) s; } -static char fromfd_doc[] = +PyDoc_STRVAR(fromfd_doc, "fromfd(fd, family, type[, proto]) -> socket object\n\ \n\ Create a socket object from the given file descriptor.\n\ -The remaining arguments are the same as for socket()."; +The remaining arguments are the same as for socket()."); #endif /* NO_DUP */ @@ -2444,10 +2444,10 @@ socket_ntohs(PyObject *self, PyObject *args) return PyInt_FromLong(x2); } -static char ntohs_doc[] = +PyDoc_STRVAR(ntohs_doc, "ntohs(integer) -> integer\n\ \n\ -Convert a 16-bit integer from network to host byte order."; +Convert a 16-bit integer from network to host byte order."); static PyObject * @@ -2462,10 +2462,10 @@ socket_ntohl(PyObject *self, PyObject *args) return PyInt_FromLong(x2); } -static char ntohl_doc[] = +PyDoc_STRVAR(ntohl_doc, "ntohl(integer) -> integer\n\ \n\ -Convert a 32-bit integer from network to host byte order."; +Convert a 32-bit integer from network to host byte order."); static PyObject * @@ -2480,10 +2480,10 @@ socket_htons(PyObject *self, PyObject *args) return PyInt_FromLong(x2); } -static char htons_doc[] = +PyDoc_STRVAR(htons_doc, "htons(integer) -> integer\n\ \n\ -Convert a 16-bit integer from host to network byte order."; +Convert a 16-bit integer from host to network byte order."); static PyObject * @@ -2498,18 +2498,18 @@ socket_htonl(PyObject *self, PyObject *args) return PyInt_FromLong(x2); } -static char htonl_doc[] = +PyDoc_STRVAR(htonl_doc, "htonl(integer) -> integer\n\ \n\ -Convert a 32-bit integer from host to network byte order."; +Convert a 32-bit integer from host to network byte order."); /* socket.inet_aton() and socket.inet_ntoa() functions. */ -static char inet_aton_doc[] = +PyDoc_STRVAR(inet_aton_doc, "inet_aton(string) -> packed 32-bit IP representation\n\ \n\ Convert an IP address in string format (123.45.67.89) to the 32-bit packed\n\ -binary format used in low-level network functions."; +binary format used in low-level network functions."); static PyObject* socket_inet_aton(PyObject *self, PyObject *args) @@ -2537,10 +2537,10 @@ socket_inet_aton(PyObject *self, PyObject *args) sizeof(packed_addr)); } -static char inet_ntoa_doc[] = +PyDoc_STRVAR(inet_ntoa_doc, "inet_ntoa(packed_ip) -> ip_address_string\n\ \n\ -Convert an IP address from 32-bit packed binary format to string format"; +Convert an IP address from 32-bit packed binary format to string format"); static PyObject* socket_inet_ntoa(PyObject *self, PyObject *args) @@ -2637,11 +2637,11 @@ socket_getaddrinfo(PyObject *self, PyObject *args) return (PyObject *)NULL; } -static char getaddrinfo_doc[] = +PyDoc_STRVAR(getaddrinfo_doc, "socket.getaddrinfo(host, port [, family, socktype, proto, flags])\n\ --> List of (family, socktype, proto, canonname, sockaddr)\n\ \n\ -Resolve host and port into addrinfo struct."; +Resolve host and port into addrinfo struct."); /* Python interface to getnameinfo(sa, flags). */ @@ -2715,10 +2715,10 @@ fail: return ret; } -static char getnameinfo_doc[] = +PyDoc_STRVAR(getnameinfo_doc, "socket.getnameinfo(sockaddr, flags) --> (host, port)\n\ \n\ -Get host and port for a sockaddr."; +Get host and port for a sockaddr."); /* List of functions exported by this module. */ @@ -2882,9 +2882,9 @@ PySocketModule_APIObject PySocketModuleAPI = made at exit time. */ -static char socket_doc[] = +PyDoc_STRVAR(socket_doc, "Implementation module for socket operations. See the socket module\n\ -for documentation."; +for documentation."); DL_EXPORT(void) init_socket(void) diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 9a68b20edf..09bcc3d305 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -1,14 +1,14 @@ /* strop module */ -static char strop_module__doc__[] = +#include "Python.h" +#include + +PyDoc_STRVAR(strop_module__doc__, "Common string manipulations, optimized for speed.\n" "\n" "Always use \"import string\" rather than referencing\n" -"this module directly."; +"this module directly."); -#include "Python.h" - -#include /* XXX This file assumes that the is*() functions XXX are defined for all 8-bit characters! */ @@ -80,7 +80,7 @@ split_whitespace(char *s, int len, int maxsplit) } -static char splitfields__doc__[] = +PyDoc_STRVAR(splitfields__doc__, "split(s [,sep [,maxsplit]]) -> list of strings\n" "splitfields(s [,sep [,maxsplit]]) -> list of strings\n" "\n" @@ -89,7 +89,7 @@ static char splitfields__doc__[] = "maxsplit words. If sep is not specified, any whitespace string\n" "is a separator. Maxsplit defaults to 0.\n" "\n" -"(split and splitfields are synonymous)"; +"(split and splitfields are synonymous)"); static PyObject * strop_splitfields(PyObject *self, PyObject *args) @@ -151,7 +151,7 @@ strop_splitfields(PyObject *self, PyObject *args) } -static char joinfields__doc__[] = +PyDoc_STRVAR(joinfields__doc__, "join(list [,sep]) -> string\n" "joinfields(list [,sep]) -> string\n" "\n" @@ -159,7 +159,7 @@ static char joinfields__doc__[] = "intervening occurrences of sep. Sep defaults to a single\n" "space.\n" "\n" -"(join and joinfields are synonymous)"; +"(join and joinfields are synonymous)"); static PyObject * strop_joinfields(PyObject *self, PyObject *args) @@ -274,14 +274,14 @@ strop_joinfields(PyObject *self, PyObject *args) } -static char find__doc__[] = +PyDoc_STRVAR(find__doc__, "find(s, sub [,start [,end]]) -> in\n" "\n" "Return the lowest index in s where substring sub is found,\n" "such that sub is contained within s[start,end]. Optional\n" "arguments start and end are interpreted as in slice notation.\n" "\n" -"Return -1 on failure."; +"Return -1 on failure."); static PyObject * strop_find(PyObject *self, PyObject *args) @@ -317,14 +317,14 @@ strop_find(PyObject *self, PyObject *args) } -static char rfind__doc__[] = +PyDoc_STRVAR(rfind__doc__, "rfind(s, sub [,start [,end]]) -> int\n" "\n" "Return the highest index in s where substring sub is found,\n" "such that sub is contained within s[start,end]. Optional\n" "arguments start and end are interpreted as in slice notation.\n" "\n" -"Return -1 on failure."; +"Return -1 on failure."); static PyObject * strop_rfind(PyObject *self, PyObject *args) @@ -394,11 +394,11 @@ do_strip(PyObject *args, int striptype) } -static char strip__doc__[] = +PyDoc_STRVAR(strip__doc__, "strip(s) -> string\n" "\n" "Return a copy of the string s with leading and trailing\n" -"whitespace removed."; +"whitespace removed."); static PyObject * strop_strip(PyObject *self, PyObject *args) @@ -408,10 +408,10 @@ strop_strip(PyObject *self, PyObject *args) } -static char lstrip__doc__[] = +PyDoc_STRVAR(lstrip__doc__, "lstrip(s) -> string\n" "\n" -"Return a copy of the string s with leading whitespace removed."; +"Return a copy of the string s with leading whitespace removed."); static PyObject * strop_lstrip(PyObject *self, PyObject *args) @@ -421,10 +421,10 @@ strop_lstrip(PyObject *self, PyObject *args) } -static char rstrip__doc__[] = +PyDoc_STRVAR(rstrip__doc__, "rstrip(s) -> string\n" "\n" -"Return a copy of the string s with trailing whitespace removed."; +"Return a copy of the string s with trailing whitespace removed."); static PyObject * strop_rstrip(PyObject *self, PyObject *args) @@ -434,10 +434,10 @@ strop_rstrip(PyObject *self, PyObject *args) } -static char lower__doc__[] = +PyDoc_STRVAR(lower__doc__, "lower(s) -> string\n" "\n" -"Return a copy of the string s converted to lowercase."; +"Return a copy of the string s converted to lowercase."); static PyObject * strop_lower(PyObject *self, PyObject *args) @@ -473,10 +473,10 @@ strop_lower(PyObject *self, PyObject *args) } -static char upper__doc__[] = +PyDoc_STRVAR(upper__doc__, "upper(s) -> string\n" "\n" -"Return a copy of the string s converted to uppercase."; +"Return a copy of the string s converted to uppercase."); static PyObject * strop_upper(PyObject *self, PyObject *args) @@ -512,11 +512,11 @@ strop_upper(PyObject *self, PyObject *args) } -static char capitalize__doc__[] = +PyDoc_STRVAR(capitalize__doc__, "capitalize(s) -> string\n" "\n" "Return a copy of the string s with only its first character\n" -"capitalized."; +"capitalized."); static PyObject * strop_capitalize(PyObject *self, PyObject *args) @@ -561,13 +561,13 @@ strop_capitalize(PyObject *self, PyObject *args) } -static char expandtabs__doc__[] = +PyDoc_STRVAR(expandtabs__doc__, "expandtabs(string, [tabsize]) -> string\n" "\n" "Expand tabs in a string, i.e. replace them by one or more spaces,\n" "depending on the current column and the given tab size (default 8).\n" "The column number is reset to zero after each newline occurring in the\n" -"string. This doesn't understand other non-printing characters."; +"string. This doesn't understand other non-printing characters."); static PyObject * strop_expandtabs(PyObject *self, PyObject *args) @@ -633,12 +633,12 @@ strop_expandtabs(PyObject *self, PyObject *args) } -static char count__doc__[] = +PyDoc_STRVAR(count__doc__, "count(s, sub[, start[, end]]) -> int\n" "\n" "Return the number of occurrences of substring sub in string\n" "s[start:end]. Optional arguments start and end are\n" -"interpreted as in slice notation."; +"interpreted as in slice notation."); static PyObject * strop_count(PyObject *self, PyObject *args) @@ -678,11 +678,11 @@ strop_count(PyObject *self, PyObject *args) } -static char swapcase__doc__[] = +PyDoc_STRVAR(swapcase__doc__, "swapcase(s) -> string\n" "\n" "Return a copy of the string s with upper case characters\n" -"converted to lowercase and vice versa."; +"converted to lowercase and vice versa."); static PyObject * strop_swapcase(PyObject *self, PyObject *args) @@ -723,7 +723,7 @@ strop_swapcase(PyObject *self, PyObject *args) } -static char atoi__doc__[] = +PyDoc_STRVAR(atoi__doc__, "atoi(s [,base]) -> int\n" "\n" "Return the integer represented by the string s in the given\n" @@ -731,7 +731,7 @@ static char atoi__doc__[] = "or more digits, possibly preceded by a sign. If base is 0, it\n" "is chosen from the leading characters of s, 0 for octal, 0x or\n" "0X for hexadecimal. If base is 16, a preceding 0x or 0X is\n" -"accepted."; +"accepted."); static PyObject * strop_atoi(PyObject *self, PyObject *args) @@ -778,7 +778,7 @@ strop_atoi(PyObject *self, PyObject *args) } -static char atol__doc__[] = +PyDoc_STRVAR(atol__doc__, "atol(s [,base]) -> long\n" "\n" "Return the long integer represented by the string s in the\n" @@ -787,7 +787,7 @@ static char atol__doc__[] = "is 0, it is chosen from the leading characters of s, 0 for\n" "octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n" "0x or 0X is accepted. A trailing L or l is not accepted,\n" -"unless base is 0."; +"unless base is 0."); static PyObject * strop_atol(PyObject *self, PyObject *args) @@ -830,10 +830,10 @@ strop_atol(PyObject *self, PyObject *args) } -static char atof__doc__[] = +PyDoc_STRVAR(atof__doc__, "atof(s) -> float\n" "\n" -"Return the floating point number represented by the string s."; +"Return the floating point number represented by the string s."); static PyObject * strop_atof(PyObject *self, PyObject *args) @@ -874,12 +874,12 @@ strop_atof(PyObject *self, PyObject *args) } -static char maketrans__doc__[] = +PyDoc_STRVAR(maketrans__doc__, "maketrans(frm, to) -> string\n" "\n" "Return a translation table (a string of 256 bytes long)\n" "suitable for use in string.translate. The strings frm and to\n" -"must be of the same length."; +"must be of the same length."); static PyObject * strop_maketrans(PyObject *self, PyObject *args) @@ -910,13 +910,13 @@ strop_maketrans(PyObject *self, PyObject *args) } -static char translate__doc__[] = +PyDoc_STRVAR(translate__doc__, "translate(s,table [,deletechars]) -> string\n" "\n" "Return a copy of the string s, where all characters occurring\n" "in the optional argument deletechars are removed, and the\n" "remaining characters have been mapped through the given\n" -"translation table, which must be a string of length 256."; +"translation table, which must be a string of length 256."); static PyObject * strop_translate(PyObject *self, PyObject *args) @@ -1126,12 +1126,12 @@ mymemreplace(const char *str, int len, /* input string */ } -static char replace__doc__[] = +PyDoc_STRVAR(replace__doc__, "replace (str, old, new[, maxsplit]) -> string\n" "\n" "Return a copy of string str with all occurrences of substring\n" "old replaced by new. If the optional argument maxsplit is\n" -"given, only the first maxsplit occurrences are replaced."; +"given, only the first maxsplit occurrences are replaced."); static PyObject * strop_replace(PyObject *self, PyObject *args) diff --git a/Modules/structmodule.c b/Modules/structmodule.c index bf871ee7f4..5d4de116d8 100644 --- a/Modules/structmodule.c +++ b/Modules/structmodule.c @@ -4,8 +4,11 @@ /* New version supporting byte order, alignment and size options, character strings, and unsigned numbers */ -static char struct__doc__[] = "\ -Functions to convert between Python values and C structs.\n\ +#include "Python.h" +#include + +PyDoc_STRVAR(struct__doc__, +"Functions to convert between Python values and C structs.\n\ Python strings are used to hold the data representing the C struct\n\ and also as format strings to describe the layout of data in the C struct.\n\ \n\ @@ -29,11 +32,7 @@ Special case (not in native mode unless 'long long' in platform C):\n\ q:long long; Q:unsigned long long\n\ Whitespace between formats is ignored.\n\ \n\ -The variable struct.error is an exception raised on errors."; - -#include "Python.h" - -#include +The variable struct.error is an exception raised on errors."); /* Exception */ @@ -1227,10 +1226,10 @@ calcsize(const char *fmt, const formatdef *f) } -static char calcsize__doc__[] = "\ -calcsize(fmt) -> int\n\ +PyDoc_STRVAR(calcsize__doc__, +"calcsize(fmt) -> int\n\ Return size of C struct described by format string fmt.\n\ -See struct.__doc__ for more on format strings."; +See struct.__doc__ for more on format strings."); static PyObject * struct_calcsize(PyObject *self, PyObject *args) @@ -1249,10 +1248,10 @@ struct_calcsize(PyObject *self, PyObject *args) } -static char pack__doc__[] = "\ -pack(fmt, v1, v2, ...) -> string\n\ +PyDoc_STRVAR(pack__doc__, +"pack(fmt, v1, v2, ...) -> string\n\ Return string containing values v1, v2, ... packed according to fmt.\n\ -See struct.__doc__ for more on format strings."; +See struct.__doc__ for more on format strings."); static PyObject * struct_pack(PyObject *self, PyObject *args) @@ -1389,11 +1388,11 @@ struct_pack(PyObject *self, PyObject *args) } -static char unpack__doc__[] = "\ -unpack(fmt, string) -> (v1, v2, ...)\n\ +PyDoc_STRVAR(unpack__doc__, +"unpack(fmt, string) -> (v1, v2, ...)\n\ Unpack the string, containing packed C structure data, according\n\ to fmt. Requires len(string)==calcsize(fmt).\n\ -See struct.__doc__ for more on format strings."; +See struct.__doc__ for more on format strings."); static PyObject * struct_unpack(PyObject *self, PyObject *args) diff --git a/Modules/termios.c b/Modules/termios.c index 0c5697f285..ed78ece933 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -20,15 +20,15 @@ #include #endif -static char termios__doc__[] = "\ -This module provides an interface to the Posix calls for tty I/O control.\n\ +PyDoc_STRVAR(termios__doc__, +"This module provides an interface to the Posix calls for tty I/O control.\n\ For a complete description of these calls, see the Posix or Unix manual\n\ pages. It is only available for those Unix versions that support Posix\n\ termios style tty I/O control.\n\ \n\ All functions in this module take a file descriptor fd as their first\n\ argument. This can be an integer file descriptor, such as returned by\n\ -sys.stdin.fileno(), or a file object, such as sys.stdin itself."; +sys.stdin.fileno(), or a file object, such as sys.stdin itself."); static PyObject *TermiosError; @@ -44,8 +44,8 @@ static int fdconv(PyObject* obj, void* p) return 0; } -static char termios_tcgetattr__doc__[] = "\ -tcgetattr(fd) -> list_of_attrs\n\ +PyDoc_STRVAR(termios_tcgetattr__doc__, +"tcgetattr(fd) -> list_of_attrs\n\ \n\ Get the tty attributes for file descriptor fd, as follows:\n\ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ @@ -53,7 +53,7 @@ of the tty special characters (each a string of length 1, except the items\n\ with indices VMIN and VTIME, which are integers when these fields are\n\ defined). The interpretation of the flags and the speeds as well as the\n\ indexing in the cc array must be done using the symbolic constants defined\n\ -in this module."; +in this module."); static PyObject * termios_tcgetattr(PyObject *self, PyObject *args) @@ -121,8 +121,8 @@ termios_tcgetattr(PyObject *self, PyObject *args) return NULL; } -static char termios_tcsetattr__doc__[] = "\ -tcsetattr(fd, when, attributes) -> None\n\ +PyDoc_STRVAR(termios_tcsetattr__doc__, +"tcsetattr(fd, when, attributes) -> None\n\ \n\ Set the tty attributes for file descriptor fd.\n\ The attributes to be set are taken from the attributes argument, which\n\ @@ -130,7 +130,7 @@ is a list like the one returned by tcgetattr(). The when argument\n\ determines when the attributes are changed: termios.TCSANOW to\n\ change immediately, termios.TCSADRAIN to change after transmitting all\n\ queued output, or termios.TCSAFLUSH to change after transmitting all\n\ -queued output and discarding all queued input. "; +queued output and discarding all queued input. "); static PyObject * termios_tcsetattr(PyObject *self, PyObject *args) @@ -195,12 +195,12 @@ termios_tcsetattr(PyObject *self, PyObject *args) return Py_None; } -static char termios_tcsendbreak__doc__[] = "\ -tcsendbreak(fd, duration) -> None\n\ +PyDoc_STRVAR(termios_tcsendbreak__doc__, +"tcsendbreak(fd, duration) -> None\n\ \n\ Send a break on file descriptor fd.\n\ A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\ -has a system dependent meaning."; +has a system dependent meaning."); static PyObject * termios_tcsendbreak(PyObject *self, PyObject *args) @@ -217,10 +217,10 @@ termios_tcsendbreak(PyObject *self, PyObject *args) return Py_None; } -static char termios_tcdrain__doc__[] = "\ -tcdrain(fd) -> None\n\ +PyDoc_STRVAR(termios_tcdrain__doc__, +"tcdrain(fd) -> None\n\ \n\ -Wait until all output written to file descriptor fd has been transmitted."; +Wait until all output written to file descriptor fd has been transmitted."); static PyObject * termios_tcdrain(PyObject *self, PyObject *args) @@ -237,13 +237,13 @@ termios_tcdrain(PyObject *self, PyObject *args) return Py_None; } -static char termios_tcflush__doc__[] = "\ -tcflush(fd, queue) -> None\n\ +PyDoc_STRVAR(termios_tcflush__doc__, +"tcflush(fd, queue) -> None\n\ \n\ Discard queued data on file descriptor fd.\n\ The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n\ -both queues. "; +both queues. "); static PyObject * termios_tcflush(PyObject *self, PyObject *args) @@ -260,13 +260,13 @@ termios_tcflush(PyObject *self, PyObject *args) return Py_None; } -static char termios_tcflow__doc__[] = "\ -tcflow(fd, action) -> None\n\ +PyDoc_STRVAR(termios_tcflow__doc__, +"tcflow(fd, action) -> None\n\ \n\ Suspend or resume input or output on file descriptor fd.\n\ The action argument can be termios.TCOOFF to suspend output,\n\ termios.TCOON to restart output, termios.TCIOFF to suspend input,\n\ -or termios.TCION to restart input."; +or termios.TCION to restart input."); static PyObject * termios_tcflow(PyObject *self, PyObject *args) diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index ba149dc855..aa9d3c9c22 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -71,7 +71,7 @@ lock_PyThread_acquire_lock(lockobject *self, PyObject *args) return PyBool_FromLong((long)i); } -static char acquire_doc[] = +PyDoc_STRVAR(acquire_doc, "acquire([wait]) -> None or bool\n\ (PyThread_acquire_lock() is an obsolete synonym)\n\ \n\ @@ -80,7 +80,7 @@ locked (even by the same thread), waiting for another thread to release\n\ the lock, and return None once the lock is acquired.\n\ With an argument, this will only block if the argument is true,\n\ and the return value reflects whether the lock is acquired.\n\ -The blocking operation is not interruptible."; +The blocking operation is not interruptible."); static PyObject * lock_PyThread_release_lock(lockobject *self) @@ -97,13 +97,13 @@ lock_PyThread_release_lock(lockobject *self) return Py_None; } -static char release_doc[] = +PyDoc_STRVAR(release_doc, "release()\n\ (PyThread_release_lock() is an obsolete synonym)\n\ \n\ Release the lock, allowing another thread that is blocked waiting for\n\ the lock to acquire the lock. The lock must be in the locked state,\n\ -but it needn't be locked by the same thread that unlocks it."; +but it needn't be locked by the same thread that unlocks it."); static PyObject * lock_locked_lock(lockobject *self) @@ -115,11 +115,11 @@ lock_locked_lock(lockobject *self) return PyBool_FromLong(1L); } -static char locked_doc[] = +PyDoc_STRVAR(locked_doc, "locked() -> bool\n\ (locked_lock() is an obsolete synonym)\n\ \n\ -Return whether the lock is in the locked state."; +Return whether the lock is in the locked state."); static PyMethodDef lock_methods[] = { {"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, @@ -245,7 +245,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) return PyInt_FromLong(ident); } -static char start_new_doc[] = +PyDoc_STRVAR(start_new_doc, "start_new_thread(function, args[, kwargs])\n\ (start_new() is an obsolete synonym)\n\ \n\ @@ -254,7 +254,7 @@ function with positional arguments from the tuple args and keyword arguments\n\ taken from the optional dictionary kwargs. The thread exits when the\n\ function returns; the return value is ignored. The thread will also exit\n\ when the function raises an unhandled exception; a stack trace will be\n\ -printed unless the exception is SystemExit.\n"; +printed unless the exception is SystemExit.\n"); static PyObject * thread_PyThread_exit_thread(PyObject *self) @@ -263,12 +263,12 @@ thread_PyThread_exit_thread(PyObject *self) return NULL; } -static char exit_doc[] = +PyDoc_STRVAR(exit_doc, "exit()\n\ (PyThread_exit_thread() is an obsolete synonym)\n\ \n\ This is synonymous to ``raise SystemExit''. It will cause the current\n\ -thread to exit silently unless the exception is caught."; +thread to exit silently unless the exception is caught."); #ifndef NO_EXIT_PROG static PyObject * @@ -288,11 +288,11 @@ thread_PyThread_allocate_lock(PyObject *self) return (PyObject *) newlockobject(); } -static char allocate_doc[] = +PyDoc_STRVAR(allocate_doc, "allocate_lock() -> lock object\n\ (allocate() is an obsolete synonym)\n\ \n\ -Create a new lock object. See LockType.__doc__ for information about locks."; +Create a new lock object. See LockType.__doc__ for information about locks."); static PyObject * thread_get_ident(PyObject *self) @@ -306,7 +306,7 @@ thread_get_ident(PyObject *self) return PyInt_FromLong(ident); } -static char get_ident_doc[] = +PyDoc_STRVAR(get_ident_doc, "get_ident() -> integer\n\ \n\ Return a non-zero integer that uniquely identifies the current thread\n\ @@ -315,7 +315,7 @@ This may be used to identify per-thread resources.\n\ Even though on some platforms threads identities may appear to be\n\ allocated consecutive numbers starting at 1, this behavior should not\n\ be relied upon, and the number should be seen purely as a magic cookie.\n\ -A thread's identity may be reused for another thread after it exits."; +A thread's identity may be reused for another thread after it exits."); static PyMethodDef thread_methods[] = { {"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread, @@ -344,11 +344,11 @@ static PyMethodDef thread_methods[] = { /* Initialization function */ -static char thread_doc[] = +PyDoc_STRVAR(thread_doc, "This module provides primitive operations to write multi-threaded programs.\n\ -The 'threading' module provides a more convenient interface."; +The 'threading' module provides a more convenient interface."); -static char lock_doc[] = +PyDoc_STRVAR(lock_doc, "A lock object is a synchronization primitive. To create a lock,\n\ call the PyThread_allocate_lock() function. Methods are:\n\ \n\ @@ -358,7 +358,7 @@ locked() -- test whether the lock is currently locked\n\ \n\ A lock is not owned by the thread that locked it; another thread may\n\ unlock it. A thread attempting to lock a lock that it has already locked\n\ -will block until another thread unlocks it. Deadlocks may ensue."; +will block until another thread unlocks it. Deadlocks may ensue."); DL_EXPORT(void) initthread(void) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index dda2ce4ee5..b2b58bf313 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -116,11 +116,11 @@ time_time(PyObject *self, PyObject *args) return PyFloat_FromDouble(secs); } -static char time_doc[] = +PyDoc_STRVAR(time_doc, "time() -> floating point number\n\ \n\ Return the current time in seconds since the Epoch.\n\ -Fractions of a second may be present if the system clock provides them."; +Fractions of a second may be present if the system clock provides them."); #ifdef HAVE_CLOCK @@ -173,11 +173,12 @@ time_clock(PyObject *self, PyObject *args) #endif /* MS_WIN32 && !MS_WIN64 */ #ifdef HAVE_CLOCK -static char clock_doc[] = +PyDoc_STRVAR(clock_doc, "clock() -> floating point number\n\ \n\ Return the CPU time or real time since the start of the process or since\n\ -the first call to clock(). This has as much precision as the system records."; +the first call to clock(). This has as much precision as the system\n\ +records."); #endif static PyObject * @@ -192,11 +193,11 @@ time_sleep(PyObject *self, PyObject *args) return Py_None; } -static char sleep_doc[] = +PyDoc_STRVAR(sleep_doc, "sleep(seconds)\n\ \n\ Delay execution for a given number of seconds. The argument may be\n\ -a floating point number for subsecond precision."; +a floating point number for subsecond precision."); static PyStructSequence_Field struct_time_type_fields[] = { {"tm_year", NULL}, @@ -274,12 +275,12 @@ time_gmtime(PyObject *self, PyObject *args) return time_convert((time_t)when, gmtime); } -static char gmtime_doc[] = +PyDoc_STRVAR(gmtime_doc, "gmtime([seconds]) -> (tm_year, tm_mon, tm_day, tm_hour, tm_min,\n\ tm_sec, tm_wday, tm_yday, tm_isdst)\n\ \n\ Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.\n\ -GMT). When 'seconds' is not passed in, convert the current time instead."; +GMT). When 'seconds' is not passed in, convert the current time instead."); static PyObject * time_localtime(PyObject *self, PyObject *args) @@ -292,11 +293,11 @@ time_localtime(PyObject *self, PyObject *args) return time_convert((time_t)when, localtime); } -static char localtime_doc[] = +PyDoc_STRVAR(localtime_doc, "localtime([seconds]) -> (tm_year,tm_mon,tm_day,tm_hour,tm_min,tm_sec,tm_wday,tm_yday,tm_isdst)\n\ \n\ Convert seconds since the Epoch to a time tuple expressing local time.\n\ -When 'seconds' is not passed in, convert the current time instead."; +When 'seconds' is not passed in, convert the current time instead."); static int gettmarg(PyObject *args, struct tm *p) @@ -389,12 +390,12 @@ time_strftime(PyObject *self, PyObject *args) } } -static char strftime_doc[] = +PyDoc_STRVAR(strftime_doc, "strftime(format[, tuple]) -> string\n\ \n\ Convert a time tuple to a string according to a format specification.\n\ See the library reference manual for formatting codes. When the time tuple\n\ -is not present, current time as returned by localtime() is used."; +is not present, current time as returned by localtime() is used."); #endif /* HAVE_STRFTIME */ #ifdef HAVE_STRPTIME @@ -430,11 +431,11 @@ time_strptime(PyObject *self, PyObject *args) return tmtotuple(&tm); } -static char strptime_doc[] = +PyDoc_STRVAR(strptime_doc, "strptime(string, format) -> tuple\n\ \n\ Parse a string to a time tuple according to a format specification.\n\ -See the library reference manual for formatting codes (same as strftime())."; +See the library reference manual for formatting codes (same as strftime())."); #endif /* HAVE_STRPTIME */ static PyObject * @@ -456,12 +457,12 @@ time_asctime(PyObject *self, PyObject *args) return PyString_FromString(p); } -static char asctime_doc[] = +PyDoc_STRVAR(asctime_doc, "asctime([tuple]) -> string\n\ \n\ Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.\n\ When the time tuple is not present, current time as returned by localtime()\n\ -is used."; +is used."); static PyObject * time_ctime(PyObject *self, PyObject *args) @@ -487,12 +488,12 @@ time_ctime(PyObject *self, PyObject *args) return PyString_FromString(p); } -static char ctime_doc[] = +PyDoc_STRVAR(ctime_doc, "ctime(seconds) -> string\n\ \n\ Convert a time in seconds since the Epoch to a string in local time.\n\ This is equivalent to asctime(localtime(seconds)). When the time tuple is\n\ -not present, current time as returned by localtime() is used."; +not present, current time as returned by localtime() is used."); #ifdef HAVE_MKTIME static PyObject * @@ -516,10 +517,10 @@ time_mktime(PyObject *self, PyObject *args) return PyFloat_FromDouble((double)tt); } -static char mktime_doc[] = +PyDoc_STRVAR(mktime_doc, "mktime(tuple) -> floating point number\n\ \n\ -Convert a time tuple in local time to seconds since the Epoch."; +Convert a time tuple in local time to seconds since the Epoch."); #endif /* HAVE_MKTIME */ static PyMethodDef time_methods[] = { @@ -545,7 +546,7 @@ static PyMethodDef time_methods[] = { }; -static char module_doc[] = +PyDoc_STRVAR(module_doc, "This module provides various functions to manipulate time values.\n\ \n\ There are two standard representations of time. One is the number\n\ @@ -587,8 +588,7 @@ asctime() -- convert time tuple to string\n\ ctime() -- convert time in seconds to string\n\ mktime() -- convert local time tuple to seconds since Epoch\n\ strftime() -- convert time tuple to string according to format specification\n\ -strptime() -- parse string to time tuple according to format specification\n\ -"; +strptime() -- parse string to time tuple according to format specification"); DL_EXPORT(void) diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 60cb412b97..966c8ba4f1 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -458,7 +458,7 @@ static PyMethodDef unicodedata_functions[] = { {NULL, NULL} /* sentinel */ }; -static char *unicodedata_docstring = "unicode character database"; +PyDoc_STRVAR(unicodedata_docstring, "unicode character database"); DL_EXPORT(void) initunicodedata(void) diff --git a/Modules/xreadlinesmodule.c b/Modules/xreadlinesmodule.c index 4511f17f67..7fba5dbfeb 100644 --- a/Modules/xreadlinesmodule.c +++ b/Modules/xreadlinesmodule.c @@ -1,9 +1,9 @@ #include "Python.h" -static char xreadlines_doc [] = +PyDoc_STRVAR(xreadlines_doc, "xreadlines(f)\n\ \n\ -Return an xreadlines object for the file f."; +Return an xreadlines object for the file f."); typedef struct { PyObject_HEAD @@ -112,7 +112,7 @@ xreadlines_next(PyXReadlinesObject *a, PyObject *args) return res; } -static char next_doc[] = "x.next() -> the next line or raise StopIteration"; +PyDoc_STRVAR(next_doc, "x.next() -> the next line or raise StopIteration"); static PyMethodDef xreadlines_methods[] = { {"next", (PyCFunction)xreadlines_next, METH_VARARGS, next_doc}, diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index 7a7cc1ecd4..353f773c28 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -1,11 +1,11 @@ #include "Python.h" #include "structmember.h" -static char xxsubtype__doc__[] = +PyDoc_STRVAR(xxsubtype__doc__, "xxsubtype is an example module showing how to subtype builtin types from C.\n" "test_descr.py in the standard test suite requires it in order to complete.\n" "If you don't care about the examples, and don't intend to run the Python\n" -"test suite, you can recompile Python without Modules/xxsubtype.c."; +"test suite, you can recompile Python without Modules/xxsubtype.c."); /* We link this module statically for convenience. If compiled as a shared library instead, some compilers don't allow addresses of Python objects diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index cfb71ae278..3e979a396e 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -78,15 +78,15 @@ zlib_error(z_stream zst, int err, char *msg) PyErr_Format(ZlibError, "Error %d %s: %.200s", err, msg, zst.msg); } -static char compressobj__doc__[] = +PyDoc_STRVAR(compressobj__doc__, "compressobj([level]) -- Return a compressor object.\n" "\n" -"Optional arg level is the compression level, in 1-9."; +"Optional arg level is the compression level, in 1-9."); -static char decompressobj__doc__[] = +PyDoc_STRVAR(decompressobj__doc__, "decompressobj([wbits]) -- Return a decompressor object.\n" "\n" -"Optional arg wbits is the window buffer size."; +"Optional arg wbits is the window buffer size."); static compobject * newcompobject(PyTypeObject *type) @@ -109,10 +109,10 @@ newcompobject(PyTypeObject *type) return self; } -static char compress__doc__[] = +PyDoc_STRVAR(compress__doc__, "compress(string[, level]) -- Returned compressed string.\n" "\n" -"Optional arg level is the compression level, in 1-9."; +"Optional arg level is the compression level, in 1-9."); static PyObject * PyZlib_compress(PyObject *self, PyObject *args) @@ -185,11 +185,11 @@ PyZlib_compress(PyObject *self, PyObject *args) return ReturnVal; } -static char decompress__doc__[] = +PyDoc_STRVAR(decompress__doc__, "decompress(string[, wbits[, bufsize]]) -- Return decompressed string.\n" "\n" "Optional arg wbits is the window buffer size. Optional arg bufsize is\n" -"the initial output buffer size."; +"the initial output buffer size."); static PyObject * PyZlib_decompress(PyObject *self, PyObject *args) @@ -376,12 +376,12 @@ Decomp_dealloc(compobject *self) PyObject_Del(self); } -static char comp_compress__doc__[] = +PyDoc_STRVAR(comp_compress__doc__, "compress(data) -- Return a string containing data compressed.\n" "\n" "After calling this function, some of the input data may still\n" "be stored in internal buffers for later processing.\n" -"Call the flush() method to clear these buffers."; +"Call the flush() method to clear these buffers."); static PyObject * @@ -442,7 +442,7 @@ PyZlib_objcompress(compobject *self, PyObject *args) return RetVal; } -static char decomp_decompress__doc__[] = +PyDoc_STRVAR(decomp_decompress__doc__, "decompress(data, max_length) -- Return a string containing the decompressed\n" "version of the data.\n" "\n" @@ -451,7 +451,7 @@ static char decomp_decompress__doc__[] = "Call the flush() method to clear these buffers.\n" "If the max_length parameter is specified then the return value will be\n" "no longer than max_length. Unconsumed input data will be stored in\n" -"the unconsumed_tail attribute."; +"the unconsumed_tail attribute."); static PyObject * PyZlib_objdecompress(compobject *self, PyObject *args) @@ -562,13 +562,13 @@ PyZlib_objdecompress(compobject *self, PyObject *args) return RetVal; } -static char comp_flush__doc__[] = +PyDoc_STRVAR(comp_flush__doc__, "flush( [mode] ) -- Return a string containing any remaining compressed data.\n" "\n" "mode can be one of the constants Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH; the\n" "default value used when mode is not specified is Z_FINISH.\n" "If mode == Z_FINISH, the compressor object can no longer be used after\n" -"calling the flush() method. Otherwise, more data can still be compressed.\n"; +"calling the flush() method. Otherwise, more data can still be compressed."); static PyObject * PyZlib_flush(compobject *self, PyObject *args) @@ -649,10 +649,10 @@ PyZlib_flush(compobject *self, PyObject *args) return RetVal; } -static char decomp_flush__doc__[] = +PyDoc_STRVAR(decomp_flush__doc__, "flush() -- Return a string containing any remaining decompressed data.\n" "\n" -"The decompressor object can no longer be used after this call."; +"The decompressor object can no longer be used after this call."); static PyObject * PyZlib_unflush(compobject *self, PyObject *args) @@ -730,11 +730,11 @@ Decomp_getattr(compobject *self, char *name) return retval; } -static char adler32__doc__[] = +PyDoc_STRVAR(adler32__doc__, "adler32(string[, start]) -- Compute an Adler-32 checksum of string.\n" "\n" "An optional starting value can be specified. The returned checksum is\n" -"an integer."; +"an integer."); static PyObject * PyZlib_adler32(PyObject *self, PyObject *args) @@ -749,11 +749,11 @@ PyZlib_adler32(PyObject *self, PyObject *args) return PyInt_FromLong(adler32val); } -static char crc32__doc__[] = +PyDoc_STRVAR(crc32__doc__, "crc32(string[, start]) -- Compute a CRC-32 checksum of string.\n" "\n" "An optional starting value can be specified. The returned checksum is\n" -"an integer."; +"an integer."); static PyObject * PyZlib_crc32(PyObject *self, PyObject *args) @@ -819,7 +819,7 @@ statichere PyTypeObject Decomptype = { 0, /*tp_as_mapping*/ }; -static char zlib_module_documentation[]= +PyDoc_STRVAR(zlib_module_documentation, "The functions in this module allow compression and decompression using the\n" "zlib library, which is based on GNU zip.\n" "\n" @@ -832,7 +832,7 @@ static char zlib_module_documentation[]= "\n" "'wbits' is window buffer size.\n" "Compressor objects support compress() and flush() methods; decompressor\n" -"objects support decompress() and flush()."; +"objects support decompress() and flush()."); DL_EXPORT(void) PyInit_zlib(void) diff --git a/Objects/boolobject.c b/Objects/boolobject.c index 89a7ece11a..a20af00680 100644 --- a/Objects/boolobject.c +++ b/Objects/boolobject.c @@ -93,12 +93,12 @@ bool_xor(PyObject *a, PyObject *b) /* Doc string */ -static char bool_doc[] = +PyDoc_STRVAR(bool_doc, "bool(x) -> bool\n\ \n\ Returns True when the argument x is true, False otherwise.\n\ The builtins True and False are the only two instances of the class bool.\n\ -The class bool is a subclass of the class int, and cannot be subclassed."; +The class bool is a subclass of the class int, and cannot be subclassed."); /* Arithmetic methods -- only so we can override &, |, ^. */ diff --git a/Objects/cobject.c b/Objects/cobject.c index 872e51591c..cdf445721a 100644 --- a/Objects/cobject.c +++ b/Objects/cobject.c @@ -112,13 +112,13 @@ PyCObject_dealloc(PyCObject *self) } -static char PyCObject_Type__doc__[] = +PyDoc_STRVAR(PyCObject_Type__doc__, "C objects to be exported from one extension module to another\n\ \n\ C objects are used for communication between extension modules. They\n\ provide a way for an extension module to export a C interface to other\n\ extension modules, so that extension modules can use the Python import\n\ -mechanism to link to one another."; +mechanism to link to one another."); PyTypeObject PyCObject_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 58ca6bc3a2..ba1e3cc566 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -912,11 +912,11 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return complex_subtype_from_c_complex(type, cr); } -static char complex_doc[] = +PyDoc_STRVAR(complex_doc, "complex(real[, imag]) -> complex number\n" "\n" "Create a complex number from a real part and an optional imaginary part.\n" -"This is equivalent to (real + imag*1j) where imag defaults to 0."; +"This is equivalent to (real + imag*1j) where imag defaults to 0."); static PyNumberMethods complex_as_number = { (binaryfunc)complex_add, /* nb_add */ diff --git a/Objects/descrobject.c b/Objects/descrobject.c index cbf56a99ea..1130f86e00 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1062,7 +1062,7 @@ property_init(PyObject *self, PyObject *args, PyObject *kwds) return 0; } -static char property_doc[] = +PyDoc_STRVAR(property_doc, "property(fget=None, fset=None, fdel=None, doc=None) -> property attribute\n" "\n" "fget is a function to be used for getting an attribute value, and likewise\n" @@ -1072,7 +1072,7 @@ static char property_doc[] = " def getx(self): return self.__x\n" " def setx(self, value): self.__x = value\n" " def delx(self): del self.__x\n" -" x = property(getx, setx, delx, \"I'm the 'x' property.\")"; +" x = property(getx, setx, delx, \"I'm the 'x' property.\")"); static int property_traverse(PyObject *self, visitproc visit, void *arg) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 1bd2f64143..d7bbef9d8d 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1660,48 +1660,48 @@ dict_iteritems(dictobject *dict) } -static char has_key__doc__[] = -"D.has_key(k) -> 1 if D has a key k, else 0"; +PyDoc_STRVAR(has_key__doc__, +"D.has_key(k) -> 1 if D has a key k, else 0"); -static char get__doc__[] = -"D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."; +PyDoc_STRVAR(get__doc__, +"D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."); -static char setdefault_doc__[] = -"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k)"; +PyDoc_STRVAR(setdefault_doc__, +"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k)"); -static char pop__doc__[] = -"D.pop(k) -> v, remove specified key and return the corresponding value"; +PyDoc_STRVAR(pop__doc__, +"D.pop(k) -> v, remove specified key and return the corresponding value"); -static char popitem__doc__[] = +PyDoc_STRVAR(popitem__doc__, "D.popitem() -> (k, v), remove and return some (key, value) pair as a\n\ -2-tuple; but raise KeyError if D is empty"; +2-tuple; but raise KeyError if D is empty"); -static char keys__doc__[] = -"D.keys() -> list of D's keys"; +PyDoc_STRVAR(keys__doc__, +"D.keys() -> list of D's keys"); -static char items__doc__[] = -"D.items() -> list of D's (key, value) pairs, as 2-tuples"; +PyDoc_STRVAR(items__doc__, +"D.items() -> list of D's (key, value) pairs, as 2-tuples"); -static char values__doc__[] = -"D.values() -> list of D's values"; +PyDoc_STRVAR(values__doc__, +"D.values() -> list of D's values"); -static char update__doc__[] = -"D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]"; +PyDoc_STRVAR(update__doc__, +"D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]"); -static char clear__doc__[] = -"D.clear() -> None. Remove all items from D."; +PyDoc_STRVAR(clear__doc__, +"D.clear() -> None. Remove all items from D."); -static char copy__doc__[] = -"D.copy() -> a shallow copy of D"; +PyDoc_STRVAR(copy__doc__, +"D.copy() -> a shallow copy of D"); -static char iterkeys__doc__[] = -"D.iterkeys() -> an iterator over the keys of D"; +PyDoc_STRVAR(iterkeys__doc__, +"D.iterkeys() -> an iterator over the keys of D"); -static char itervalues__doc__[] = -"D.itervalues() -> an iterator over the values of D"; +PyDoc_STRVAR(itervalues__doc__, +"D.itervalues() -> an iterator over the values of D"); -static char iteritems__doc__[] = -"D.iteritems() -> an iterator over the (key, value) items of D"; +PyDoc_STRVAR(iteritems__doc__, +"D.iteritems() -> an iterator over the (key, value) items of D"); static PyMethodDef mapp_methods[] = { {"has_key", (PyCFunction)dict_has_key, METH_O, @@ -1816,14 +1816,14 @@ dict_iter(dictobject *dict) return dictiter_new(dict, select_key); } -static char dictionary_doc[] = +PyDoc_STRVAR(dictionary_doc, "dict() -> new empty dictionary.\n" "dict(mapping) -> new dictionary initialized from a mapping object's\n" " (key, value) pairs.\n" "dict(seq) -> new dictionary initialized as if via:\n" " d = {}\n" " for k, v in seq:\n" -" d[k] = v"; +" d[k] = v"); PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 1964956415..148ac3c742 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -90,8 +90,8 @@ static PyMethodDef enum_methods[] = { {NULL, NULL} /* sentinel */ }; -static char enum_doc[] = - "enumerate(iterable) -> create an enumerating-iterator"; +PyDoc_STRVAR(enum_doc, +"enumerate(iterable) -> create an enumerating-iterator"); PyTypeObject PyEnum_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/fileobject.c b/Objects/fileobject.c index a45a4cfe6a..d4caaf03fd 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -1462,30 +1462,30 @@ file_writelines(PyFileObject *f, PyObject *seq) #undef CHUNKSIZE } -static char readline_doc[] = +PyDoc_STRVAR(readline_doc, "readline([size]) -> next line from the file, as a string.\n" "\n" "Retain newline. A non-negative size argument limits the maximum\n" "number of bytes to return (an incomplete line may be returned then).\n" -"Return an empty string at EOF."; +"Return an empty string at EOF."); -static char read_doc[] = +PyDoc_STRVAR(read_doc, "read([size]) -> read at most size bytes, returned as a string.\n" "\n" -"If the size argument is negative or omitted, read until EOF is reached."; +"If the size argument is negative or omitted, read until EOF is reached."); -static char write_doc[] = +PyDoc_STRVAR(write_doc, "write(str) -> None. Write string str to file.\n" "\n" "Note that due to buffering, flush() or close() may be needed before\n" -"the file on disk reflects the data written."; +"the file on disk reflects the data written."); -static char fileno_doc[] = +PyDoc_STRVAR(fileno_doc, "fileno() -> integer \"file descriptor\".\n" "\n" -"This is needed for lower-level file interfaces, such os.read()."; +"This is needed for lower-level file interfaces, such os.read()."); -static char seek_doc[] = +PyDoc_STRVAR(seek_doc, "seek(offset[, whence]) -> None. Move to new file position.\n" "\n" "Argument offset is a byte count. Optional argument whence defaults to\n" @@ -1494,53 +1494,53 @@ static char seek_doc[] = "relative to end of file, usually negative, although many platforms allow\n" "seeking beyond the end of a file).\n" "\n" -"Note that not all file objects are seekable."; +"Note that not all file objects are seekable."); #ifdef HAVE_FTRUNCATE -static char truncate_doc[] = +PyDoc_STRVAR(truncate_doc, "truncate([size]) -> None. Truncate the file to at most size bytes.\n" "\n" -"Size defaults to the current file position, as returned by tell()."; +"Size defaults to the current file position, as returned by tell()."); #endif -static char tell_doc[] = -"tell() -> current file position, an integer (may be a long integer)."; +PyDoc_STRVAR(tell_doc, +"tell() -> current file position, an integer (may be a long integer)."); -static char readinto_doc[] = -"readinto() -> Undocumented. Don't use this; it may go away."; +PyDoc_STRVAR(readinto_doc, +"readinto() -> Undocumented. Don't use this; it may go away."); -static char readlines_doc[] = +PyDoc_STRVAR(readlines_doc, "readlines([size]) -> list of strings, each a line from the file.\n" "\n" "Call readline() repeatedly and return a list of the lines so read.\n" "The optional size argument, if given, is an approximate bound on the\n" -"total number of bytes in the lines returned."; +"total number of bytes in the lines returned."); -static char xreadlines_doc[] = +PyDoc_STRVAR(xreadlines_doc, "xreadlines() -> next line from the file, as a string.\n" "\n" "Equivalent to xreadlines.xreadlines(file). This is like readline(), but\n" -"often quicker, due to reading ahead internally."; +"often quicker, due to reading ahead internally."); -static char writelines_doc[] = +PyDoc_STRVAR(writelines_doc, "writelines(sequence_of_strings) -> None. Write the strings to the file.\n" "\n" "Note that newlines are not added. The sequence can be any iterable object\n" -"producing strings. This is equivalent to calling write() for each string."; +"producing strings. This is equivalent to calling write() for each string."); -static char flush_doc[] = -"flush() -> None. Flush the internal I/O buffer."; +PyDoc_STRVAR(flush_doc, +"flush() -> None. Flush the internal I/O buffer."); -static char close_doc[] = +PyDoc_STRVAR(close_doc, "close() -> None or (perhaps) an integer. Close the file.\n" "\n" "Sets data attribute .closed to True. A closed file cannot be used for\n" "further I/O operations. close() may be called more than once without\n" "error. Some kinds of file objects (for example, opened by popen())\n" -"may return an exit status upon closing."; +"may return an exit status upon closing."); -static char isatty_doc[] = -"isatty() -> true or false. True if the file is connected to a tty device."; +PyDoc_STRVAR(isatty_doc, +"isatty() -> true or false. True if the file is connected to a tty device."); static PyMethodDef file_methods[] = { {"readline", (PyCFunction)file_readline, METH_VARARGS, readline_doc}, @@ -1687,7 +1687,8 @@ Done: return ret; } -static char file_doc[] = +PyDoc_VAR(file_doc) = +PyDoc_STR( "file(name[, mode[, buffering]]) -> file object\n" "\n" "Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" @@ -1697,7 +1698,9 @@ static char file_doc[] = "Add a '+' to the mode to allow simultaneous reading and writing.\n" "If the buffering argument is given, 0 means unbuffered, 1 means line\n" "buffered, and larger numbers specify the buffer size.\n" +) #ifdef WITH_UNIVERSAL_NEWLINES +PyDoc_STR( "Add a 'U' to mode to open the file for input with universal newline\n" "support. Any line ending in the input file will be seen as a '\\n'\n" "in Python. Also, a file so opened gains the attribute 'newlines';\n" @@ -1705,9 +1708,12 @@ static char file_doc[] = "'\\r', '\\n', '\\r\\n' or a tuple containing all the newline types seen.\n" "\n" "'U' cannot be combined with 'w' or '+' mode.\n" +) #endif /* WITH_UNIVERSAL_NEWLINES */ +PyDoc_STR( "\n" -"Note: open() is an alias for file().\n"; +"Note: open() is an alias for file()." +); PyTypeObject PyFile_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 5fd13bcc1e..d711726a1b 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -719,10 +719,10 @@ float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return new; } -static char float_doc[] = +PyDoc_STRVAR(float_doc, "float(x) -> floating point number\n\ \n\ -Convert a string or number to a floating point number, if possible."; +Convert a string or number to a floating point number, if possible."); static PyNumberMethods float_as_number = { diff --git a/Objects/funcobject.c b/Objects/funcobject.c index a3541e4ee9..f96d0dd9bf 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -493,7 +493,7 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds) return 0; } -static char classmethod_doc[] = +PyDoc_STRVAR(classmethod_doc, "classmethod(function) -> method\n\ \n\ Convert a function to be a class method.\n\ @@ -512,7 +512,7 @@ If a class method is called for a derived class, the derived class\n\ object is passed as the implied first argument.\n\ \n\ Class methods are different than C++ or Java static methods.\n\ -If you want those, see the staticmethod builtin."; +If you want those, see the staticmethod builtin."); PyTypeObject PyClassMethod_Type = { PyObject_HEAD_INIT(&PyType_Type) @@ -625,7 +625,7 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds) return 0; } -static char staticmethod_doc[] = +PyDoc_STRVAR(staticmethod_doc, "staticmethod(function) -> method\n\ \n\ Convert a function to be a static method.\n\ @@ -641,7 +641,7 @@ It can be called either on the class (e.g. C.f()) or on an instance\n\ (e.g. C().f()). The instance is ignored except for its class.\n\ \n\ Static methods in Python are similar to those found in Java or C++.\n\ -For a more advanced concept, see the classmethod builtin."; +For a more advanced concept, see the classmethod builtin."); PyTypeObject PyStaticMethod_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/intobject.c b/Objects/intobject.c index ccd328d6c4..444ada338c 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -830,14 +830,14 @@ int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return new; } -static char int_doc[] = +PyDoc_STRVAR(int_doc, "int(x[, base]) -> integer\n\ \n\ Convert a string or number to an integer, if possible. A floating point\n\ argument will be truncated towards zero (this does not include a string\n\ representation of a floating point number!) When converting a string, use\n\ the optional base. It is an error to supply a base when converting a\n\ -non-string."; +non-string."); static PyNumberMethods int_as_number = { (binaryfunc)int_add, /*nb_add*/ diff --git a/Objects/listobject.c b/Objects/listobject.c index 063ebfbd19..f29774e496 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1633,24 +1633,24 @@ list_nohash(PyObject *self) return -1; } -static char append_doc[] = -"L.append(object) -- append object to end"; -static char extend_doc[] = -"L.extend(list) -- extend list by appending list elements"; -static char insert_doc[] = -"L.insert(index, object) -- insert object before index"; -static char pop_doc[] = -"L.pop([index]) -> item -- remove and return item at index (default last)"; -static char remove_doc[] = -"L.remove(value) -- remove first occurrence of value"; -static char index_doc[] = -"L.index(value) -> integer -- return index of first occurrence of value"; -static char count_doc[] = -"L.count(value) -> integer -- return number of occurrences of value"; -static char reverse_doc[] = -"L.reverse() -- reverse *IN PLACE*"; -static char sort_doc[] = -"L.sort([cmpfunc]) -- sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1"; +PyDoc_STRVAR(append_doc, +"L.append(object) -- append object to end"); +PyDoc_STRVAR(extend_doc, +"L.extend(list) -- extend list by appending list elements"); +PyDoc_STRVAR(insert_doc, +"L.insert(index, object) -- insert object before index"); +PyDoc_STRVAR(pop_doc, +"L.pop([index]) -> item -- remove and return item at index (default last)"); +PyDoc_STRVAR(remove_doc, +"L.remove(value) -- remove first occurrence of value"); +PyDoc_STRVAR(index_doc, +"L.index(value) -> integer -- return index of first occurrence of value"); +PyDoc_STRVAR(count_doc, +"L.count(value) -> integer -- return number of occurrences of value"); +PyDoc_STRVAR(reverse_doc, +"L.reverse() -- reverse *IN PLACE*"); +PyDoc_STRVAR(sort_doc, +"L.sort([cmpfunc]) -- sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1"); static PyMethodDef list_methods[] = { {"append", (PyCFunction)listappend, METH_O, append_doc}, diff --git a/Objects/longobject.c b/Objects/longobject.c index cbc9f68ca5..89fc8b4391 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2261,14 +2261,14 @@ long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)new; } -static char long_doc[] = +PyDoc_STRVAR(long_doc, "long(x[, base]) -> integer\n\ \n\ Convert a string or number to a long integer, if possible. A floating\n\ point argument will be truncated towards zero (this does not include a\n\ string representation of a floating point number!) When converting a\n\ string, use the optional base. It is an error to supply a base when\n\ -converting a non-string."; +converting a non-string."); static PyNumberMethods long_as_number = { (binaryfunc) long_add, /*nb_add*/ diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index b46805d34b..812cbc4ae8 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -209,11 +209,11 @@ module_traverse(PyModuleObject *m, visitproc visit, void *arg) return 0; } -static char module_doc[] = +PyDoc_STRVAR(module_doc, "module(name[, doc])\n\ \n\ Create a module object.\n\ -The name must be a string; the optional doc argument can have any type."; +The name must be a string; the optional doc argument can have any type."); PyTypeObject PyModule_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 13608645dc..c3c6050039 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -110,12 +110,12 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw) return PyRange_New(ilow, n, istep, 1); } -static char range_doc[] = +PyDoc_STRVAR(range_doc, "xrange([start,] stop[, step]) -> xrange object\n\ \n\ Like range(), but instead of returning a list, returns an object that\n\ generates the numbers in the range on demand. This is slightly slower\n\ -than range() but more memory efficient."; +than range() but more memory efficient."); static PyObject * range_item(rangeobject *r, int i) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index b88778ea15..243fcc695e 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -1117,13 +1117,13 @@ split_whitespace(const char *s, int len, int maxsplit) } -static char split__doc__[] = +PyDoc_STRVAR(split__doc__, "S.split([sep [,maxsplit]]) -> list of strings\n\ \n\ Return a list of the words in the string S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ splits are done. If sep is not specified, any whitespace string\n\ -is a separator."; +is a separator."); static PyObject * string_split(PyStringObject *self, PyObject *args) @@ -1191,11 +1191,11 @@ string_split(PyStringObject *self, PyObject *args) } -static char join__doc__[] = +PyDoc_STRVAR(join__doc__, "S.join(sequence) -> string\n\ \n\ Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."; +sequence. The separator between elements is S."); static PyObject * string_join(PyStringObject *self, PyObject *orig) @@ -1365,14 +1365,14 @@ string_find_internal(PyStringObject *self, PyObject *args, int dir) } -static char find__doc__[] = +PyDoc_STRVAR(find__doc__, "S.find(sub [,start [,end]]) -> int\n\ \n\ Return the lowest index in S where substring sub is found,\n\ such that sub is contained within s[start,end]. Optional\n\ arguments start and end are interpreted as in slice notation.\n\ \n\ -Return -1 on failure."; +Return -1 on failure."); static PyObject * string_find(PyStringObject *self, PyObject *args) @@ -1384,10 +1384,10 @@ string_find(PyStringObject *self, PyObject *args) } -static char index__doc__[] = +PyDoc_STRVAR(index__doc__, "S.index(sub [,start [,end]]) -> int\n\ \n\ -Like S.find() but raise ValueError when the substring is not found."; +Like S.find() but raise ValueError when the substring is not found."); static PyObject * string_index(PyStringObject *self, PyObject *args) @@ -1404,14 +1404,14 @@ string_index(PyStringObject *self, PyObject *args) } -static char rfind__doc__[] = +PyDoc_STRVAR(rfind__doc__, "S.rfind(sub [,start [,end]]) -> int\n\ \n\ Return the highest index in S where substring sub is found,\n\ such that sub is contained within s[start,end]. Optional\n\ arguments start and end are interpreted as in slice notation.\n\ \n\ -Return -1 on failure."; +Return -1 on failure."); static PyObject * string_rfind(PyStringObject *self, PyObject *args) @@ -1423,10 +1423,10 @@ string_rfind(PyStringObject *self, PyObject *args) } -static char rindex__doc__[] = +PyDoc_STRVAR(rindex__doc__, "S.rindex(sub [,start [,end]]) -> int\n\ \n\ -Like S.rfind() but raise ValueError when the substring is not found."; +Like S.rfind() but raise ValueError when the substring is not found."); static PyObject * string_rindex(PyStringObject *self, PyObject *args) @@ -1546,13 +1546,13 @@ do_argstrip(PyStringObject *self, int striptype, PyObject *args) } -static char strip__doc__[] = +PyDoc_STRVAR(strip__doc__, "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is unicode, S will be converted to unicode before stripping"; +If sep is unicode, S will be converted to unicode before stripping"); static PyObject * string_strip(PyStringObject *self, PyObject *args) @@ -1564,12 +1564,12 @@ string_strip(PyStringObject *self, PyObject *args) } -static char lstrip__doc__[] = +PyDoc_STRVAR(lstrip__doc__, "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is unicode, S will be converted to unicode before stripping"; +If sep is unicode, S will be converted to unicode before stripping"); static PyObject * string_lstrip(PyStringObject *self, PyObject *args) @@ -1581,12 +1581,12 @@ string_lstrip(PyStringObject *self, PyObject *args) } -static char rstrip__doc__[] = +PyDoc_STRVAR(rstrip__doc__, "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is unicode, S will be converted to unicode before stripping"; +If sep is unicode, S will be converted to unicode before stripping"); static PyObject * string_rstrip(PyStringObject *self, PyObject *args) @@ -1598,10 +1598,10 @@ string_rstrip(PyStringObject *self, PyObject *args) } -static char lower__doc__[] = +PyDoc_STRVAR(lower__doc__, "S.lower() -> string\n\ \n\ -Return a copy of the string S converted to lowercase."; +Return a copy of the string S converted to lowercase."); static PyObject * string_lower(PyStringObject *self) @@ -1626,10 +1626,10 @@ string_lower(PyStringObject *self) } -static char upper__doc__[] = +PyDoc_STRVAR(upper__doc__, "S.upper() -> string\n\ \n\ -Return a copy of the string S converted to uppercase."; +Return a copy of the string S converted to uppercase."); static PyObject * string_upper(PyStringObject *self) @@ -1654,11 +1654,11 @@ string_upper(PyStringObject *self) } -static char title__doc__[] = +PyDoc_STRVAR(title__doc__, "S.title() -> string\n\ \n\ Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."; +characters, all remaining cased characters have lowercase."); static PyObject* string_title(PyStringObject *self) @@ -1689,11 +1689,11 @@ string_title(PyStringObject *self) return new; } -static char capitalize__doc__[] = +PyDoc_STRVAR(capitalize__doc__, "S.capitalize() -> string\n\ \n\ Return a copy of the string S with only its first character\n\ -capitalized."; +capitalized."); static PyObject * string_capitalize(PyStringObject *self) @@ -1726,12 +1726,12 @@ string_capitalize(PyStringObject *self) } -static char count__doc__[] = +PyDoc_STRVAR(count__doc__, "S.count(sub[, start[, end]]) -> int\n\ \n\ Return the number of occurrences of substring sub in string\n\ S[start:end]. Optional arguments start and end are\n\ -interpreted as in slice notation."; +interpreted as in slice notation."); static PyObject * string_count(PyStringObject *self, PyObject *args) @@ -1790,11 +1790,11 @@ string_count(PyStringObject *self, PyObject *args) } -static char swapcase__doc__[] = +PyDoc_STRVAR(swapcase__doc__, "S.swapcase() -> string\n\ \n\ Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."; +converted to lowercase and vice versa."); static PyObject * string_swapcase(PyStringObject *self) @@ -1823,13 +1823,13 @@ string_swapcase(PyStringObject *self) } -static char translate__doc__[] = +PyDoc_STRVAR(translate__doc__, "S.translate(table [,deletechars]) -> string\n\ \n\ Return a copy of the string S, where all characters occurring\n\ in the optional argument deletechars are removed, and the\n\ remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256."; +translation table, which must be a string of length 256."); static PyObject * string_translate(PyStringObject *self, PyObject *args) @@ -2079,12 +2079,12 @@ mymemreplace(const char *str, int len, /* input string */ } -static char replace__doc__[] = +PyDoc_STRVAR(replace__doc__, "S.replace (old, new[, maxsplit]) -> string\n\ \n\ Return a copy of string S with all occurrences of substring\n\ old replaced by new. If the optional argument maxsplit is\n\ -given, only the first maxsplit occurrences are replaced."; +given, only the first maxsplit occurrences are replaced."); static PyObject * string_replace(PyStringObject *self, PyObject *args) @@ -2154,12 +2154,12 @@ string_replace(PyStringObject *self, PyObject *args) } -static char startswith__doc__[] = +PyDoc_STRVAR(startswith__doc__, "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ Return True if S starts with the specified prefix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ -comparing S at that position."; +comparing S at that position."); static PyObject * string_startswith(PyStringObject *self, PyObject *args) @@ -2213,12 +2213,12 @@ string_startswith(PyStringObject *self, PyObject *args) } -static char endswith__doc__[] = +PyDoc_STRVAR(endswith__doc__, "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ Return True if S ends with the specified suffix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ -comparing S at that position."; +comparing S at that position."); static PyObject * string_endswith(PyStringObject *self, PyObject *args) @@ -2265,13 +2265,13 @@ string_endswith(PyStringObject *self, PyObject *args) } -static char encode__doc__[] = +PyDoc_STRVAR(encode__doc__, "S.encode([encoding[,errors]]) -> object\n\ \n\ Encodes S using the codec registered for encoding. encoding defaults\n\ to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a ValueError. Other possible values are 'ignore' and 'replace'."; +a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * string_encode(PyStringObject *self, PyObject *args) @@ -2284,13 +2284,13 @@ string_encode(PyStringObject *self, PyObject *args) } -static char decode__doc__[] = +PyDoc_STRVAR(decode__doc__, "S.decode([encoding[,errors]]) -> object\n\ \n\ Decodes S using the codec registered for encoding. encoding defaults\n\ to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a ValueError. Other possible values are 'ignore' and 'replace'."; +a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * string_decode(PyStringObject *self, PyObject *args) @@ -2303,11 +2303,11 @@ string_decode(PyStringObject *self, PyObject *args) } -static char expandtabs__doc__[] = +PyDoc_STRVAR(expandtabs__doc__, "S.expandtabs([tabsize]) -> string\n\ \n\ Return a copy of S where all tab characters are expanded using spaces.\n\ -If tabsize is not given, a tab size of 8 characters is assumed."; +If tabsize is not given, a tab size of 8 characters is assumed."); static PyObject* string_expandtabs(PyStringObject *self, PyObject *args) @@ -2395,11 +2395,11 @@ pad(PyStringObject *self, int left, int right, char fill) return u; } -static char ljust__doc__[] = +PyDoc_STRVAR(ljust__doc__, "S.ljust(width) -> string\n" "\n" "Return S left justified in a string of length width. Padding is\n" -"done using spaces."; +"done using spaces."); static PyObject * string_ljust(PyStringObject *self, PyObject *args) @@ -2417,11 +2417,11 @@ string_ljust(PyStringObject *self, PyObject *args) } -static char rjust__doc__[] = +PyDoc_STRVAR(rjust__doc__, "S.rjust(width) -> string\n" "\n" "Return S right justified in a string of length width. Padding is\n" -"done using spaces."; +"done using spaces."); static PyObject * string_rjust(PyStringObject *self, PyObject *args) @@ -2439,11 +2439,11 @@ string_rjust(PyStringObject *self, PyObject *args) } -static char center__doc__[] = +PyDoc_STRVAR(center__doc__, "S.center(width) -> string\n" "\n" "Return S centered in a string of length width. Padding is done\n" -"using spaces."; +"using spaces."); static PyObject * string_center(PyStringObject *self, PyObject *args) @@ -2465,11 +2465,11 @@ string_center(PyStringObject *self, PyObject *args) return pad(self, left, marg - left, ' '); } -static char zfill__doc__[] = +PyDoc_STRVAR(zfill__doc__, "S.zfill(width) -> string\n" "\n" "Pad a numeric string S with zeros on the left, to fill a field\n" -"of the specified width. The string S is never truncated."; +"of the specified width. The string S is never truncated."); static PyObject * string_zfill(PyStringObject *self, PyObject *args) @@ -2511,11 +2511,11 @@ string_zfill(PyStringObject *self, PyObject *args) return (PyObject*) s; } -static char isspace__doc__[] = +PyDoc_STRVAR(isspace__doc__, "S.isspace() -> bool\n" "\n" "Return True if there are only whitespace characters in S,\n" -"False otherwise."; +"False otherwise."); static PyObject* string_isspace(PyStringObject *self) @@ -2542,11 +2542,11 @@ string_isspace(PyStringObject *self) } -static char isalpha__doc__[] = +PyDoc_STRVAR(isalpha__doc__, "S.isalpha() -> bool\n\ \n\ Return True if all characters in S are alphabetic\n\ -and there is at least one character in S, False otherwise."; +and there is at least one character in S, False otherwise."); static PyObject* string_isalpha(PyStringObject *self) @@ -2573,11 +2573,11 @@ string_isalpha(PyStringObject *self) } -static char isalnum__doc__[] = +PyDoc_STRVAR(isalnum__doc__, "S.isalnum() -> bool\n\ \n\ Return True if all characters in S are alphanumeric\n\ -and there is at least one character in S, False otherwise."; +and there is at least one character in S, False otherwise."); static PyObject* string_isalnum(PyStringObject *self) @@ -2604,11 +2604,11 @@ string_isalnum(PyStringObject *self) } -static char isdigit__doc__[] = +PyDoc_STRVAR(isdigit__doc__, "S.isdigit() -> bool\n\ \n\ Return True if there are only digit characters in S,\n\ -False otherwise."; +False otherwise."); static PyObject* string_isdigit(PyStringObject *self) @@ -2635,11 +2635,11 @@ string_isdigit(PyStringObject *self) } -static char islower__doc__[] = +PyDoc_STRVAR(islower__doc__, "S.islower() -> bool\n\ \n\ Return True if all cased characters in S are lowercase and there is\n\ -at least one cased character in S, False otherwise."; +at least one cased character in S, False otherwise."); static PyObject* string_islower(PyStringObject *self) @@ -2669,11 +2669,11 @@ string_islower(PyStringObject *self) } -static char isupper__doc__[] = +PyDoc_STRVAR(isupper__doc__, "S.isupper() -> bool\n\ \n\ Return True if all cased characters in S are uppercase and there is\n\ -at least one cased character in S, False otherwise."; +at least one cased character in S, False otherwise."); static PyObject* string_isupper(PyStringObject *self) @@ -2703,12 +2703,12 @@ string_isupper(PyStringObject *self) } -static char istitle__doc__[] = +PyDoc_STRVAR(istitle__doc__, "S.istitle() -> bool\n\ \n\ Return True if S is a titlecased string, i.e. uppercase characters\n\ may only follow uncased characters and lowercase characters only cased\n\ -ones. Return False otherwise."; +ones. Return False otherwise."); static PyObject* string_istitle(PyStringObject *self, PyObject *uncased) @@ -2751,12 +2751,12 @@ string_istitle(PyStringObject *self, PyObject *uncased) } -static char splitlines__doc__[] = +PyDoc_STRVAR(splitlines__doc__, "S.splitlines([keepends]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ -is given and true."; +is given and true."); #define SPLIT_APPEND(data, left, right) \ str = PyString_FromStringAndSize(data + left, right - left); \ @@ -2923,8 +2923,8 @@ basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } -static char basestring_doc[] = -"Type basestring cannot be instantiated; it is the base for str and unicode."; +PyDoc_STRVAR(basestring_doc, +"Type basestring cannot be instantiated; it is the base for str and unicode."); PyTypeObject PyBaseString_Type = { PyObject_HEAD_INIT(&PyType_Type) @@ -2969,11 +2969,11 @@ PyTypeObject PyBaseString_Type = { 0, /* tp_free */ }; -static char string_doc[] = +PyDoc_STRVAR(string_doc, "str(object) -> string\n\ \n\ Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."; +If the argument is a string, the return value is the same object."); PyTypeObject PyString_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 203801ec83..a207102448 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -524,11 +524,11 @@ tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return new; } -static char tuple_doc[] = +PyDoc_STRVAR(tuple_doc, "tuple() -> an empty tuple\n" "tuple(sequence) -> tuple initialized from sequence's items\n" "\n" -"If the argument is a tuple, the return value is the same object."; +"If the argument is a tuple, the return value is the same object."); static PySequenceMethods tuple_as_sequence = { (inquiry)tuplelength, /* sq_length */ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 26222fadcb..b9890eaf45 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1487,9 +1487,9 @@ static PyMethodDef type_methods[] = { {0} }; -static char type_doc[] = +PyDoc_STRVAR(type_doc, "type(object) -> the object's type\n" -"type(name, bases, dict) -> a new type"; +"type(name, bases, dict) -> a new type"); static int type_traverse(PyTypeObject *type, visitproc visit, void *arg) @@ -4355,14 +4355,14 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds) return 0; } -static char super_doc[] = +PyDoc_STRVAR(super_doc, "super(type) -> unbound super object\n" "super(type, obj) -> bound super object; requires isinstance(obj, type)\n" "super(type, type2) -> bound super object; requires issubclass(type2, type)\n" "Typical use to call a cooperative superclass method:\n" "class C(B):\n" " def meth(self, arg):\n" -" super(C, self).meth(arg)"; +" super(C, self).meth(arg)"); static int super_traverse(PyObject *self, visitproc visit, void *arg) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 6e0fd9f428..cd081ada67 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3527,11 +3527,11 @@ PyObject *replace(PyUnicodeObject *self, /* --- Unicode Object Methods --------------------------------------------- */ -static char title__doc__[] = +PyDoc_STRVAR(title__doc__, "S.title() -> unicode\n\ \n\ Return a titlecased version of S, i.e. words start with title case\n\ -characters, all remaining cased characters have lower case."; +characters, all remaining cased characters have lower case."); static PyObject* unicode_title(PyUnicodeObject *self) @@ -3539,11 +3539,11 @@ unicode_title(PyUnicodeObject *self) return fixup(self, fixtitle); } -static char capitalize__doc__[] = +PyDoc_STRVAR(capitalize__doc__, "S.capitalize() -> unicode\n\ \n\ Return a capitalized version of S, i.e. make the first character\n\ -have upper case."; +have upper case."); static PyObject* unicode_capitalize(PyUnicodeObject *self) @@ -3552,11 +3552,11 @@ unicode_capitalize(PyUnicodeObject *self) } #if 0 -static char capwords__doc__[] = +PyDoc_STRVAR(capwords__doc__, "S.capwords() -> unicode\n\ \n\ Apply .capitalize() to all words in S and return the result with\n\ -normalized whitespace (all whitespace strings are replaced by ' ')."; +normalized whitespace (all whitespace strings are replaced by ' ')."); static PyObject* unicode_capwords(PyUnicodeObject *self) @@ -3589,11 +3589,11 @@ onError: } #endif -static char center__doc__[] = +PyDoc_STRVAR(center__doc__, "S.center(width) -> unicode\n\ \n\ Return S centered in a Unicode string of length width. Padding is done\n\ -using spaces."; +using spaces."); static PyObject * unicode_center(PyUnicodeObject *self, PyObject *args) @@ -3818,12 +3818,12 @@ onError: return NULL; } -static char count__doc__[] = +PyDoc_STRVAR(count__doc__, "S.count(sub[, start[, end]]) -> int\n\ \n\ Return the number of occurrences of substring sub in Unicode string\n\ S[start:end]. Optional arguments start and end are\n\ -interpreted as in slice notation."; +interpreted as in slice notation."); static PyObject * unicode_count(PyUnicodeObject *self, PyObject *args) @@ -3859,13 +3859,13 @@ unicode_count(PyUnicodeObject *self, PyObject *args) return result; } -static char encode__doc__[] = +PyDoc_STRVAR(encode__doc__, "S.encode([encoding[,errors]]) -> string\n\ \n\ Return an encoded string version of S. Default encoding is the current\n\ default string encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a ValueError. Other possible values are 'ignore' and 'replace'."; +a ValueError. Other possible values are 'ignore' and 'replace'."); static PyObject * unicode_encode(PyUnicodeObject *self, PyObject *args) @@ -3877,11 +3877,11 @@ unicode_encode(PyUnicodeObject *self, PyObject *args) return PyUnicode_AsEncodedString((PyObject *)self, encoding, errors); } -static char expandtabs__doc__[] = +PyDoc_STRVAR(expandtabs__doc__, "S.expandtabs([tabsize]) -> unicode\n\ \n\ Return a copy of S where all tab characters are expanded using spaces.\n\ -If tabsize is not given, a tab size of 8 characters is assumed."; +If tabsize is not given, a tab size of 8 characters is assumed."); static PyObject* unicode_expandtabs(PyUnicodeObject *self, PyObject *args) @@ -3939,14 +3939,14 @@ unicode_expandtabs(PyUnicodeObject *self, PyObject *args) return (PyObject*) u; } -static char find__doc__[] = +PyDoc_STRVAR(find__doc__, "S.find(sub [,start [,end]]) -> int\n\ \n\ Return the lowest index in S where substring sub is found,\n\ such that sub is contained within s[start,end]. Optional\n\ arguments start and end are interpreted as in slice notation.\n\ \n\ -Return -1 on failure."; +Return -1 on failure."); static PyObject * unicode_find(PyUnicodeObject *self, PyObject *args) @@ -4008,10 +4008,10 @@ unicode_hash(PyUnicodeObject *self) return x; } -static char index__doc__[] = +PyDoc_STRVAR(index__doc__, "S.index(sub [,start [,end]]) -> int\n\ \n\ -Like S.find() but raise ValueError when the substring is not found."; +Like S.find() but raise ValueError when the substring is not found."); static PyObject * unicode_index(PyUnicodeObject *self, PyObject *args) @@ -4040,11 +4040,11 @@ unicode_index(PyUnicodeObject *self, PyObject *args) return PyInt_FromLong(result); } -static char islower__doc__[] = +PyDoc_STRVAR(islower__doc__, "S.islower() -> bool\n\ \n\ Return True if all cased characters in S are lowercase and there is\n\ -at least one cased character in S, False otherwise."; +at least one cased character in S, False otherwise."); static PyObject* unicode_islower(PyUnicodeObject *self) @@ -4074,11 +4074,11 @@ unicode_islower(PyUnicodeObject *self) return PyBool_FromLong(cased); } -static char isupper__doc__[] = +PyDoc_STRVAR(isupper__doc__, "S.isupper() -> bool\n\ \n\ Return True if all cased characters in S are uppercase and there is\n\ -at least one cased character in S, False otherwise."; +at least one cased character in S, False otherwise."); static PyObject* unicode_isupper(PyUnicodeObject *self) @@ -4108,12 +4108,12 @@ unicode_isupper(PyUnicodeObject *self) return PyBool_FromLong(cased); } -static char istitle__doc__[] = +PyDoc_STRVAR(istitle__doc__, "S.istitle() -> bool\n\ \n\ Return True if S is a titlecased string, i.e. upper- and titlecase\n\ characters may only follow uncased characters and lowercase characters\n\ -only cased ones. Return False otherwise."; +only cased ones. Return False otherwise."); static PyObject* unicode_istitle(PyUnicodeObject *self) @@ -4155,11 +4155,11 @@ unicode_istitle(PyUnicodeObject *self) return PyBool_FromLong(cased); } -static char isspace__doc__[] = +PyDoc_STRVAR(isspace__doc__, "S.isspace() -> bool\n\ \n\ Return True if there are only whitespace characters in S,\n\ -False otherwise."; +False otherwise."); static PyObject* unicode_isspace(PyUnicodeObject *self) @@ -4184,11 +4184,11 @@ unicode_isspace(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char isalpha__doc__[] = +PyDoc_STRVAR(isalpha__doc__, "S.isalpha() -> bool\n\ \n\ Return True if all characters in S are alphabetic\n\ -and there is at least one character in S, False otherwise."; +and there is at least one character in S, False otherwise."); static PyObject* unicode_isalpha(PyUnicodeObject *self) @@ -4213,11 +4213,11 @@ unicode_isalpha(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char isalnum__doc__[] = +PyDoc_STRVAR(isalnum__doc__, "S.isalnum() -> bool\n\ \n\ Return True if all characters in S are alphanumeric\n\ -and there is at least one character in S, False otherwise."; +and there is at least one character in S, False otherwise."); static PyObject* unicode_isalnum(PyUnicodeObject *self) @@ -4242,11 +4242,11 @@ unicode_isalnum(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char isdecimal__doc__[] = +PyDoc_STRVAR(isdecimal__doc__, "S.isdecimal() -> bool\n\ \n\ Return True if there are only decimal characters in S,\n\ -False otherwise."; +False otherwise."); static PyObject* unicode_isdecimal(PyUnicodeObject *self) @@ -4271,11 +4271,11 @@ unicode_isdecimal(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char isdigit__doc__[] = +PyDoc_STRVAR(isdigit__doc__, "S.isdigit() -> bool\n\ \n\ Return True if there are only digit characters in S,\n\ -False otherwise."; +False otherwise."); static PyObject* unicode_isdigit(PyUnicodeObject *self) @@ -4300,11 +4300,11 @@ unicode_isdigit(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char isnumeric__doc__[] = +PyDoc_STRVAR(isnumeric__doc__, "S.isnumeric() -> bool\n\ \n\ Return True if there are only numeric characters in S,\n\ -False otherwise."; +False otherwise."); static PyObject* unicode_isnumeric(PyUnicodeObject *self) @@ -4329,11 +4329,11 @@ unicode_isnumeric(PyUnicodeObject *self) return PyBool_FromLong(1); } -static char join__doc__[] = +PyDoc_STRVAR(join__doc__, "S.join(sequence) -> unicode\n\ \n\ Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."; +sequence. The separator between elements is S."); static PyObject* unicode_join(PyObject *self, PyObject *data) @@ -4347,11 +4347,11 @@ unicode_length(PyUnicodeObject *self) return self->length; } -static char ljust__doc__[] = +PyDoc_STRVAR(ljust__doc__, "S.ljust(width) -> unicode\n\ \n\ Return S left justified in a Unicode string of length width. Padding is\n\ -done using spaces."; +done using spaces."); static PyObject * unicode_ljust(PyUnicodeObject *self, PyObject *args) @@ -4368,10 +4368,10 @@ unicode_ljust(PyUnicodeObject *self, PyObject *args) return (PyObject*) pad(self, 0, width - self->length, ' '); } -static char lower__doc__[] = +PyDoc_STRVAR(lower__doc__, "S.lower() -> unicode\n\ \n\ -Return a copy of the string S converted to lowercase."; +Return a copy of the string S converted to lowercase."); static PyObject* unicode_lower(PyUnicodeObject *self) @@ -4494,13 +4494,13 @@ do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args) } -static char strip__doc__[] = +PyDoc_STRVAR(strip__doc__, "S.strip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is a str, it will be converted to unicode before stripping"; +If sep is a str, it will be converted to unicode before stripping"); static PyObject * unicode_strip(PyUnicodeObject *self, PyObject *args) @@ -4512,12 +4512,12 @@ unicode_strip(PyUnicodeObject *self, PyObject *args) } -static char lstrip__doc__[] = +PyDoc_STRVAR(lstrip__doc__, "S.lstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is a str, it will be converted to unicode before stripping"; +If sep is a str, it will be converted to unicode before stripping"); static PyObject * unicode_lstrip(PyUnicodeObject *self, PyObject *args) @@ -4529,12 +4529,12 @@ unicode_lstrip(PyUnicodeObject *self, PyObject *args) } -static char rstrip__doc__[] = +PyDoc_STRVAR(rstrip__doc__, "S.rstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ If sep is given and not None, remove characters in sep instead.\n\ -If sep is a str, it will be converted to unicode before stripping"; +If sep is a str, it will be converted to unicode before stripping"); static PyObject * unicode_rstrip(PyUnicodeObject *self, PyObject *args) @@ -4626,12 +4626,12 @@ PyObject *PyUnicode_Replace(PyObject *obj, return result; } -static char replace__doc__[] = +PyDoc_STRVAR(replace__doc__, "S.replace (old, new[, maxsplit]) -> unicode\n\ \n\ Return a copy of S with all occurrences of substring\n\ old replaced by new. If the optional argument maxsplit is\n\ -given, only the first maxsplit occurrences are replaced."; +given, only the first maxsplit occurrences are replaced."); static PyObject* unicode_replace(PyUnicodeObject *self, PyObject *args) @@ -4665,14 +4665,14 @@ PyObject *unicode_repr(PyObject *unicode) 1); } -static char rfind__doc__[] = +PyDoc_STRVAR(rfind__doc__, "S.rfind(sub [,start [,end]]) -> int\n\ \n\ Return the highest index in S where substring sub is found,\n\ such that sub is contained within s[start,end]. Optional\n\ arguments start and end are interpreted as in slice notation.\n\ \n\ -Return -1 on failure."; +Return -1 on failure."); static PyObject * unicode_rfind(PyUnicodeObject *self, PyObject *args) @@ -4696,10 +4696,10 @@ unicode_rfind(PyUnicodeObject *self, PyObject *args) return result; } -static char rindex__doc__[] = +PyDoc_STRVAR(rindex__doc__, "S.rindex(sub [,start [,end]]) -> int\n\ \n\ -Like S.rfind() but raise ValueError when the substring is not found."; +Like S.rfind() but raise ValueError when the substring is not found."); static PyObject * unicode_rindex(PyUnicodeObject *self, PyObject *args) @@ -4727,11 +4727,11 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args) return PyInt_FromLong(result); } -static char rjust__doc__[] = +PyDoc_STRVAR(rjust__doc__, "S.rjust(width) -> unicode\n\ \n\ Return S right justified in a Unicode string of length width. Padding is\n\ -done using spaces."; +done using spaces."); static PyObject * unicode_rjust(PyUnicodeObject *self, PyObject *args) @@ -4794,13 +4794,13 @@ PyObject *PyUnicode_Split(PyObject *s, return result; } -static char split__doc__[] = +PyDoc_STRVAR(split__doc__, "S.split([sep [,maxsplit]]) -> list of strings\n\ \n\ Return a list of the words in S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ splits are done. If sep is not specified, any whitespace string\n\ -is a separator."; +is a separator."); static PyObject* unicode_split(PyUnicodeObject *self, PyObject *args) @@ -4819,12 +4819,12 @@ unicode_split(PyUnicodeObject *self, PyObject *args) return PyUnicode_Split((PyObject *)self, substring, maxcount); } -static char splitlines__doc__[] = +PyDoc_STRVAR(splitlines__doc__, "S.splitlines([keepends]]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ -is given and true."; +is given and true."); static PyObject* unicode_splitlines(PyUnicodeObject *self, PyObject *args) @@ -4843,11 +4843,11 @@ PyObject *unicode_str(PyUnicodeObject *self) return PyUnicode_AsEncodedString((PyObject *)self, NULL, NULL); } -static char swapcase__doc__[] = +PyDoc_STRVAR(swapcase__doc__, "S.swapcase() -> unicode\n\ \n\ Return a copy of S with uppercase characters converted to lowercase\n\ -and vice versa."; +and vice versa."); static PyObject* unicode_swapcase(PyUnicodeObject *self) @@ -4855,13 +4855,13 @@ unicode_swapcase(PyUnicodeObject *self) return fixup(self, fixswapcase); } -static char translate__doc__[] = +PyDoc_STRVAR(translate__doc__, "S.translate(table) -> unicode\n\ \n\ Return a copy of the string S, where all characters have been mapped\n\ through the given translation table, which must be a mapping of\n\ Unicode ordinals to Unicode ordinals or None. Unmapped characters\n\ -are left untouched. Characters mapped to None are deleted."; +are left untouched. Characters mapped to None are deleted."); static PyObject* unicode_translate(PyUnicodeObject *self, PyObject *table) @@ -4872,10 +4872,10 @@ unicode_translate(PyUnicodeObject *self, PyObject *table) "ignore"); } -static char upper__doc__[] = +PyDoc_STRVAR(upper__doc__, "S.upper() -> unicode\n\ \n\ -Return a copy of S converted to uppercase."; +Return a copy of S converted to uppercase."); static PyObject* unicode_upper(PyUnicodeObject *self) @@ -4883,11 +4883,11 @@ unicode_upper(PyUnicodeObject *self) return fixup(self, fixupper); } -static char zfill__doc__[] = +PyDoc_STRVAR(zfill__doc__, "S.zfill(width) -> unicode\n\ \n\ Pad a numeric string x with zeros on the left, to fill a field\n\ -of the specified width. The string x is never truncated."; +of the specified width. The string x is never truncated."); static PyObject * unicode_zfill(PyUnicodeObject *self, PyObject *args) @@ -4935,12 +4935,12 @@ unicode_freelistsize(PyUnicodeObject *self) } #endif -static char startswith__doc__[] = +PyDoc_STRVAR(startswith__doc__, "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ Return True if S starts with the specified prefix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ -comparing S at that position."; +comparing S at that position."); static PyObject * unicode_startswith(PyUnicodeObject *self, @@ -4966,12 +4966,12 @@ unicode_startswith(PyUnicodeObject *self, } -static char endswith__doc__[] = +PyDoc_STRVAR(endswith__doc__, "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ Return True if S ends with the specified suffix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ -comparing S at that position."; +comparing S at that position."); static PyObject * unicode_endswith(PyUnicodeObject *self, @@ -5847,12 +5847,12 @@ unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)pnew; } -static char unicode_doc[] = +PyDoc_STRVAR(unicode_doc, "unicode(string [, encoding[, errors]]) -> object\n\ \n\ Create a new Unicode object from the given encoded string.\n\ encoding defaults to the current default string encoding and \n\ -errors, defining the error handling, to 'strict'."; +errors, defining the error handling, to 'strict'."); PyTypeObject PyUnicode_Type = { PyObject_HEAD_INIT(&PyType_Type) diff --git a/PC/_winreg.c b/PC/_winreg.c index c86d2bb475..407a4b64ce 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -34,7 +34,7 @@ static char errNotAHandle[] = "Object is not a handle"; /* Forward declares */ /* Doc strings */ -static char module_doc[] = +PyDoc_STRVAR(module_doc, "This module provides access to the Windows registry API.\n" "\n" "Functions:\n" @@ -68,18 +68,18 @@ static char module_doc[] = "\n" "Integer constants:\n" "Many constants are defined - see the documentation for each function\n" -"to see what constants are used, and where."; +"to see what constants are used, and where."); -static char CloseKey_doc[] = +PyDoc_STRVAR(CloseKey_doc, "CloseKey(hkey) - Closes a previously opened registry key.\n" "\n" "The hkey argument specifies a previously opened key.\n" "\n" "Note that if the key is not closed using this method, it will be\n" -"closed when the hkey object is destroyed by Python."; +"closed when the hkey object is destroyed by Python."); -static char ConnectRegistry_doc[] = +PyDoc_STRVAR(ConnectRegistry_doc, "key = ConnectRegistry(computer_name, key) - " "Establishes a connection to a predefined registry handle on another computer.\n" "\n" @@ -88,9 +88,9 @@ static char ConnectRegistry_doc[] = "key is the predefined handle to connect to.\n" "\n" "The return value is the handle of the opened key.\n" -"If the function fails, an EnvironmentError exception is raised."; +"If the function fails, an EnvironmentError exception is raised."); -static char CreateKey_doc[] = +PyDoc_STRVAR(CreateKey_doc, "key = CreateKey(key, sub_key) - Creates or opens the specified key.\n" "\n" "key is an already open key, or one of the predefined HKEY_* constants\n" @@ -101,9 +101,9 @@ static char CreateKey_doc[] = "If the key already exists, this function opens the existing key\n" "\n" "The return value is the handle of the opened key.\n" -"If the function fails, an exception is raised."; +"If the function fails, an exception is raised."); -static char DeleteKey_doc[] = +PyDoc_STRVAR(DeleteKey_doc, "DeleteKey(key, sub_key) - Deletes the specified key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -113,15 +113,15 @@ static char DeleteKey_doc[] = "This method can not delete keys with subkeys.\n" "\n" "If the method succeeds, the entire key, including all of its values,\n" -"is removed. If the method fails, an EnvironmentError exception is raised."; +"is removed. If the method fails, an EnvironmentError exception is raised."); -static char DeleteValue_doc[] = +PyDoc_STRVAR(DeleteValue_doc, "DeleteValue(key, value) - Removes a named value from a registry key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" -"value is a string that identifies the value to remove."; +"value is a string that identifies the value to remove."); -static char EnumKey_doc[] = +PyDoc_STRVAR(EnumKey_doc, "string = EnumKey(key, index) - Enumerates subkeys of an open registry key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -129,9 +129,9 @@ static char EnumKey_doc[] = "\n" "The function retrieves the name of one subkey each time it is called.\n" "It is typically called repeatedly until an EnvironmentError exception is\n" -"raised, indicating no more values are available.\n"; +"raised, indicating no more values are available."); -static char EnumValue_doc[] = +PyDoc_STRVAR(EnumValue_doc, "tuple = EnumValue(key, index) - Enumerates values of an open registry key.\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" "index is an integer that identifies the index of the value to retrieve.\n" @@ -144,9 +144,9 @@ static char EnumValue_doc[] = "value_name is a string that identifies the value.\n" "value_data is an object that holds the value data, and whose type depends\n" " on the underlying registry type.\n" -"data_type is an integer that identifies the type of the value data."; +"data_type is an integer that identifies the type of the value data."); -static char FlushKey_doc[] = +PyDoc_STRVAR(FlushKey_doc, "FlushKey(key) - Writes all the attributes of a key to the registry.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -157,9 +157,9 @@ static char FlushKey_doc[] = "Unlike CloseKey(), the FlushKey() method returns only when all the data has\n" "been written to the registry.\n" "An application should only call FlushKey() if it requires absolute certainty that registry changes are on disk.\n" -"If you don't know whether a FlushKey() call is required, it probably isn't.\n"; +"If you don't know whether a FlushKey() call is required, it probably isn't."); -static char LoadKey_doc[] = +PyDoc_STRVAR(LoadKey_doc, "LoadKey(key, sub_key, file_name) - Creates a subkey under the specified key\n" "and stores registration information from a specified file into that subkey.\n" "\n" @@ -176,9 +176,9 @@ static char LoadKey_doc[] = "If key is a handle returned by ConnectRegistry(), then the path specified\n" "in fileName is relative to the remote computer.\n" "\n" -"The docs imply key must be in the HKEY_USER or HKEY_LOCAL_MACHINE tree"; +"The docs imply key must be in the HKEY_USER or HKEY_LOCAL_MACHINE tree"); -static char OpenKey_doc[] = +PyDoc_STRVAR(OpenKey_doc, "key = OpenKey(key, sub_key, res = 0, sam = KEY_READ) - Opens the specified key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -188,12 +188,11 @@ static char OpenKey_doc[] = " security access for the key. Default is KEY_READ\n" "\n" "The result is a new handle to the specified key\n" -"If the function fails, an EnvironmentError exception is raised.\n"; +"If the function fails, an EnvironmentError exception is raised."); -static char OpenKeyEx_doc[] = -"See OpenKey()"; +PyDoc_STRVAR(OpenKeyEx_doc, "See OpenKey()"); -static char QueryInfoKey_doc[] = +PyDoc_STRVAR(QueryInfoKey_doc, "tuple = QueryInfoKey(key) - Returns information about a key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -202,9 +201,9 @@ static char QueryInfoKey_doc[] = "An integer that identifies the number of sub keys this key has.\n" "An integer that identifies the number of values this key has.\n" "A long integer that identifies when the key was last modified (if available)\n" -" as 100's of nanoseconds since Jan 1, 1600.\n"; +" as 100's of nanoseconds since Jan 1, 1600."); -static char QueryValue_doc[] = +PyDoc_STRVAR(QueryValue_doc, "string = QueryValue(key, sub_key) - retrieves the unnamed value for a key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -214,15 +213,15 @@ static char QueryValue_doc[] = "\n" "Values in the registry have name, type, and data components. This method\n" "retrieves the data for a key's first value that has a NULL name.\n" -"But the underlying API call doesn't return the type, Lame Lame Lame, DONT USE THIS!!!"; +"But the underlying API call doesn't return the type, Lame Lame Lame, DONT USE THIS!!!"); -static char QueryValueEx_doc[] = +PyDoc_STRVAR(QueryValueEx_doc, "value,type_id = QueryValueEx(key, value_name) - Retrieves the type and data for a specified value name associated with an open registry key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" -"value_name is a string indicating the value to query"; +"value_name is a string indicating the value to query"); -static char SaveKey_doc[] = +PyDoc_STRVAR(SaveKey_doc, "SaveKey(key, file_name) - Saves the specified key, and all its subkeys to the specified file.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -234,9 +233,9 @@ static char SaveKey_doc[] = "If key represents a key on a remote computer, the path described by\n" "file_name is relative to the remote computer.\n" "The caller of this method must possess the SeBackupPrivilege security privilege.\n" -"This function passes NULL for security_attributes to the API."; +"This function passes NULL for security_attributes to the API."); -static char SetValue_doc[] = +PyDoc_STRVAR(SetValue_doc, "SetValue(key, sub_key, type, value) - Associates a value with a specified key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -253,9 +252,9 @@ static char SetValue_doc[] = "the configuration registry. This helps the registry perform efficiently.\n" "\n" "The key identified by the key parameter must have been opened with\n" -"KEY_SET_VALUE access."; +"KEY_SET_VALUE access."); -static char SetValueEx_doc[] = +PyDoc_STRVAR(SetValueEx_doc, "SetValueEx(key, value_name, reserved, type, value) - Stores data in the value field of an open registry key.\n" "\n" "key is an already open key, or any one of the predefined HKEY_* constants.\n" @@ -285,10 +284,10 @@ static char SetValueEx_doc[] = "\n" "Value lengths are limited by available memory. Long values (more than\n" "2048 bytes) should be stored as files with the filenames stored in \n" -"the configuration registry. This helps the registry perform efficiently.\n"; +"the configuration registry. This helps the registry perform efficiently."); /* PyHKEY docstrings */ -static char PyHKEY_doc[] = +PyDoc_STRVAR(PyHKEY_doc, "PyHKEY Object - A Python object, representing a win32 registry key.\n" "\n" "This object wraps a Windows HKEY object, automatically closing it when\n" @@ -308,15 +307,15 @@ static char PyHKEY_doc[] = "Operations:\n" "__nonzero__ - Handles with an open object return true, otherwise false.\n" "__int__ - Converting a handle to an integer returns the Win32 handle.\n" -"__cmp__ - Handle objects are compared using the handle value.\n"; +"__cmp__ - Handle objects are compared using the handle value."); -static char PyHKEY_Close_doc[] = +PyDoc_STRVAR(PyHKEY_Close_doc, "key.Close() - Closes the underlying Windows handle.\n" "\n" -"If the handle is already closed, no error is raised."; +"If the handle is already closed, no error is raised."); -static char PyHKEY_Detach_doc[] = +PyDoc_STRVAR(PyHKEY_Detach_doc, "int = key.Detach() - Detaches the Windows handle from the handle object.\n" "\n" "The result is the value of the handle before it is detached. If the\n" @@ -326,7 +325,7 @@ static char PyHKEY_Detach_doc[] = "but the handle is not closed. You would call this function when you\n" "need the underlying win32 handle to exist beyond the lifetime of the\n" "handle object.\n" -"On 64 bit windows, the result of this function is a long integer\n"; +"On 64 bit windows, the result of this function is a long integer"); /************************************************************************ diff --git a/PC/winsound.c b/PC/winsound.c index 704af6c283..26508b6a4e 100644 --- a/PC/winsound.c +++ b/PC/winsound.c @@ -40,13 +40,13 @@ #include /* port functions on Win9x */ #include -static char sound_playsound_doc[] = +PyDoc_STRVAR(sound_playsound_doc, "PlaySound(sound, flags) - a wrapper around the Windows PlaySound API\n" "\n" "The sound argument can be a filename, data, or None.\n" -"For flag values, ored together, see module documentation.\n"; +"For flag values, ored together, see module documentation."); -static char sound_beep_doc[] = +PyDoc_STRVAR(sound_beep_doc, "Beep(frequency, duration) - a wrapper around the Windows Beep API\n" "\n" "The frequency argument specifies frequency, in hertz, of the sound.\n" @@ -54,9 +54,9 @@ static char sound_beep_doc[] = "The duration argument specifies the number of milliseconds.\n" "On WinNT and 2000, the platform Beep API is used directly. Else funky\n" "code doing direct port manipulation is used; it's unknown whether that\n" -"will work on all systems.\n"; +"will work on all systems."); -static char sound_module_doc[] = +PyDoc_STRVAR(sound_module_doc, "PlaySound(sound, flags) - play a sound\n" "SND_FILENAME - sound is a wav file name\n" "SND_ALIAS - sound is a registry sound association name\n" @@ -68,7 +68,7 @@ static char sound_module_doc[] = "SND_NOSTOP - Do not interrupt any sounds currently playing\n" // Raising RuntimeError if needed "SND_NOWAIT - Return immediately if the sound driver is busy\n" // Without any errors "\n" -"Beep(frequency, duration) - Make a beep through the PC speaker.\n"; +"Beep(frequency, duration) - Make a beep through the PC speaker."); PyObject * sound_playsound(PyObject *s, PyObject *args) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 5aa6bc70ea..8f28ea693c 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -40,7 +40,7 @@ builtin___import__(PyObject *self, PyObject *args) return PyImport_ImportModuleEx(name, globals, locals, fromlist); } -static char import_doc[] = +PyDoc_STRVAR(import_doc, "__import__(name, globals, locals, fromlist) -> module\n\ \n\ Import a module. The globals are only used to determine the context;\n\ @@ -49,7 +49,7 @@ should be a list of names to emulate ``from name import ...'', or an\n\ empty list to emulate ``import name''.\n\ When importing a module from a package, note that __import__('A.B', ...)\n\ returns package A when fromlist is empty, but its submodule B when\n\ -fromlist is not empty."; +fromlist is not empty."); static PyObject * @@ -58,10 +58,10 @@ builtin_abs(PyObject *self, PyObject *v) return PyNumber_Absolute(v); } -static char abs_doc[] = +PyDoc_STRVAR(abs_doc, "abs(number) -> number\n\ \n\ -Return the absolute value of the argument."; +Return the absolute value of the argument."); static PyObject * @@ -98,12 +98,12 @@ builtin_apply(PyObject *self, PyObject *args) return retval; } -static char apply_doc[] = +PyDoc_STRVAR(apply_doc, "apply(object[, args[, kwargs]]) -> value\n\ \n\ Call a callable object with positional arguments taken from the tuple args,\n\ and keyword arguments taken from the optional dictionary kwargs.\n\ -Note that classes are callable, as are instances with a __call__() method."; +Note that classes are callable, as are instances with a __call__() method."); static PyObject * @@ -118,13 +118,13 @@ builtin_buffer(PyObject *self, PyObject *args) return PyBuffer_FromObject(ob, offset, size); } -static char buffer_doc[] = +PyDoc_STRVAR(buffer_doc, "buffer(object [, offset[, size]]) -> object\n\ \n\ Create a new buffer object which references the given object.\n\ The buffer will reference a slice of the target object from the\n\ start of the object (or at the specified offset). The slice will\n\ -extend to the end of the target object (or with the specified size)."; +extend to the end of the target object (or with the specified size)."); static PyObject * @@ -133,11 +133,11 @@ builtin_callable(PyObject *self, PyObject *v) return PyBool_FromLong((long)PyCallable_Check(v)); } -static char callable_doc[] = +PyDoc_STRVAR(callable_doc, "callable(object) -> bool\n\ \n\ Return whether the object is callable (i.e., some kind of function).\n\ -Note that classes are callable, as are instances with a __call__() method."; +Note that classes are callable, as are instances with a __call__() method."); static PyObject * @@ -246,12 +246,12 @@ Fail_it: return NULL; } -static char filter_doc[] = +PyDoc_STRVAR(filter_doc, "filter(function or None, sequence) -> list, tuple, or string\n" "\n" "Return those items of sequence for which function(item) is true. If\n" "function is None, return the items that are true. If sequence is a tuple\n" -"or string, return the same type, else return a list."; +"or string, return the same type, else return a list."); static PyObject * builtin_chr(PyObject *self, PyObject *args) @@ -270,10 +270,10 @@ builtin_chr(PyObject *self, PyObject *args) return PyString_FromStringAndSize(s, 1); } -static char chr_doc[] = +PyDoc_STRVAR(chr_doc, "chr(i) -> character\n\ \n\ -Return a string of one character with ordinal i; 0 <= i < 256."; +Return a string of one character with ordinal i; 0 <= i < 256."); #ifdef Py_USING_UNICODE @@ -321,10 +321,10 @@ builtin_unichr(PyObject *self, PyObject *args) } } -static char unichr_doc[] = +PyDoc_STRVAR(unichr_doc, "unichr(i) -> Unicode character\n\ \n\ -Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."; +Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); #endif @@ -341,10 +341,10 @@ builtin_cmp(PyObject *self, PyObject *args) return PyInt_FromLong((long)c); } -static char cmp_doc[] = +PyDoc_STRVAR(cmp_doc, "cmp(x, y) -> integer\n\ \n\ -Return negative if xy."; +Return negative if xy."); static PyObject * @@ -363,11 +363,11 @@ builtin_coerce(PyObject *self, PyObject *args) return res; } -static char coerce_doc[] = +PyDoc_STRVAR(coerce_doc, "coerce(x, y) -> None or (x1, y1)\n\ \n\ When x and y can be coerced to values of the same type, return a tuple\n\ -containing the coerced values. When they can't be coerced, return None."; +containing the coerced values. When they can't be coerced, return None."); static PyObject * @@ -411,7 +411,7 @@ builtin_compile(PyObject *self, PyObject *args) return Py_CompileStringFlags(str, filename, start, &cf); } -static char compile_doc[] = +PyDoc_STRVAR(compile_doc, "compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\ \n\ Compile the source string (a Python module, statement or expression)\n\ @@ -424,7 +424,7 @@ the compilation of the code.\n\ The dont_inherit argument, if non-zero, stops the compilation inheriting\n\ the effects of any future statements in effect in the code calling\n\ compile; if absent or zero these statements do influence the compilation,\n\ -in addition to any features explicitly specified."; +in addition to any features explicitly specified."); static PyObject * builtin_dir(PyObject *self, PyObject *args) @@ -436,7 +436,7 @@ builtin_dir(PyObject *self, PyObject *args) return PyObject_Dir(arg); } -static char dir_doc[] = +PyDoc_STRVAR(dir_doc, "dir([object]) -> list of strings\n" "\n" "Return an alphabetized list of names comprising (some of) the attributes\n" @@ -447,7 +447,7 @@ static char dir_doc[] = "Type or class object: its attributes, and recursively the attributes of\n" " its bases.\n" "Otherwise: its attributes, its class's attributes, and recursively the\n" -" attributes of its class's base classes."; +" attributes of its class's base classes."); static PyObject * builtin_divmod(PyObject *self, PyObject *args) @@ -459,10 +459,10 @@ builtin_divmod(PyObject *self, PyObject *args) return PyNumber_Divmod(v, w); } -static char divmod_doc[] = +PyDoc_STRVAR(divmod_doc, "divmod(x, y) -> (div, mod)\n\ \n\ -Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x."; +Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x."); static PyObject * @@ -517,14 +517,14 @@ builtin_eval(PyObject *self, PyObject *args) return PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); } -static char eval_doc[] = +PyDoc_STRVAR(eval_doc, "eval(source[, globals[, locals]]) -> value\n\ \n\ Evaluate the source in the context of globals and locals.\n\ The source may be a string representing a Python expression\n\ or a code object as returned by compile().\n\ The globals and locals are dictionaries, defaulting to the current\n\ -globals and locals. If only globals is given, locals defaults to it."; +globals and locals. If only globals is given, locals defaults to it."); static PyObject * @@ -616,12 +616,12 @@ builtin_execfile(PyObject *self, PyObject *args) return res; } -static char execfile_doc[] = +PyDoc_STRVAR(execfile_doc, "execfile(filename[, globals[, locals]])\n\ \n\ Read and execute a Python script from a file.\n\ The globals and locals are dictionaries, defaulting to the current\n\ -globals and locals. If only globals is given, locals defaults to it."; +globals and locals. If only globals is given, locals defaults to it."); static PyObject * @@ -656,12 +656,12 @@ builtin_getattr(PyObject *self, PyObject *args) return result; } -static char getattr_doc[] = +PyDoc_STRVAR(getattr_doc, "getattr(object, name[, default]) -> value\n\ \n\ Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\n\ When a default argument is given, it is returned when the attribute doesn't\n\ -exist; without it, an exception is raised in that case."; +exist; without it, an exception is raised in that case."); static PyObject * @@ -674,10 +674,10 @@ builtin_globals(PyObject *self) return d; } -static char globals_doc[] = +PyDoc_STRVAR(globals_doc, "globals() -> dictionary\n\ \n\ -Return the dictionary containing the current scope's global variables."; +Return the dictionary containing the current scope's global variables."); static PyObject * @@ -712,11 +712,11 @@ builtin_hasattr(PyObject *self, PyObject *args) return Py_True; } -static char hasattr_doc[] = +PyDoc_STRVAR(hasattr_doc, "hasattr(object, name) -> bool\n\ \n\ Return whether the object has an attribute with the given name.\n\ -(This is done by calling getattr(object, name) and catching exceptions.)"; +(This is done by calling getattr(object, name) and catching exceptions.)"); static PyObject * @@ -725,11 +725,11 @@ builtin_id(PyObject *self, PyObject *v) return PyLong_FromVoidPtr(v); } -static char id_doc[] = +PyDoc_STRVAR(id_doc, "id(object) -> integer\n\ \n\ Return the identity of an object. This is guaranteed to be unique among\n\ -simultaneously existing objects. (Hint: it's the object's memory address.)"; +simultaneously existing objects. (Hint: it's the object's memory address.)"); static PyObject * @@ -888,7 +888,7 @@ Succeed: return result; } -static char map_doc[] = +PyDoc_STRVAR(map_doc, "map(function, sequence[, sequence, ...]) -> list\n\ \n\ Return a list of the results of applying the function to the items of\n\ @@ -896,7 +896,7 @@ the argument sequence(s). If more than one sequence is given, the\n\ function is called with an argument list consisting of the corresponding\n\ item of each sequence, substituting None for missing values when not all\n\ sequences have the same length. If the function is None, return a list of\n\ -the items of the sequence (or a list of tuples if more than one sequence)."; +the items of the sequence (or a list of tuples if more than one sequence)."); static PyObject * @@ -914,11 +914,11 @@ builtin_setattr(PyObject *self, PyObject *args) return Py_None; } -static char setattr_doc[] = +PyDoc_STRVAR(setattr_doc, "setattr(object, name, value)\n\ \n\ Set a named attribute on an object; setattr(x, 'y', v) is equivalent to\n\ -``x.y = v''."; +``x.y = v''."); static PyObject * @@ -935,11 +935,11 @@ builtin_delattr(PyObject *self, PyObject *args) return Py_None; } -static char delattr_doc[] = +PyDoc_STRVAR(delattr_doc, "delattr(object, name)\n\ \n\ Delete a named attribute on an object; delattr(x, 'y') is equivalent to\n\ -``del x.y''."; +``del x.y''."); static PyObject * @@ -953,11 +953,11 @@ builtin_hash(PyObject *self, PyObject *v) return PyInt_FromLong(x); } -static char hash_doc[] = +PyDoc_STRVAR(hash_doc, "hash(object) -> integer\n\ \n\ Return a hash value for the object. Two objects with the same value have\n\ -the same hash value. The reverse is not necessarily true, but likely."; +the same hash value. The reverse is not necessarily true, but likely."); static PyObject * @@ -974,10 +974,10 @@ builtin_hex(PyObject *self, PyObject *v) return (*nb->nb_hex)(v); } -static char hex_doc[] = +PyDoc_STRVAR(hex_doc, "hex(number) -> string\n\ \n\ -Return the hexadecimal representation of an integer or long integer."; +Return the hexadecimal representation of an integer or long integer."); static PyObject *builtin_raw_input(PyObject *, PyObject *); @@ -1009,10 +1009,10 @@ builtin_input(PyObject *self, PyObject *args) return res; } -static char input_doc[] = +PyDoc_STRVAR(input_doc, "input([prompt]) -> value\n\ \n\ -Equivalent to eval(raw_input(prompt))."; +Equivalent to eval(raw_input(prompt))."); static PyObject * @@ -1026,13 +1026,13 @@ builtin_intern(PyObject *self, PyObject *args) return s; } -static char intern_doc[] = +PyDoc_STRVAR(intern_doc, "intern(string) -> string\n\ \n\ ``Intern'' the given string. This enters the string in the (global)\n\ table of interned strings whose purpose is to speed up dictionary lookups.\n\ Return the string itself or the previously interned string object with the\n\ -same value."; +same value."); static PyObject * @@ -1052,13 +1052,13 @@ builtin_iter(PyObject *self, PyObject *args) return PyCallIter_New(v, w); } -static char iter_doc[] = +PyDoc_STRVAR(iter_doc, "iter(collection) -> iterator\n\ iter(callable, sentinel) -> iterator\n\ \n\ Get an iterator from an object. In the first form, the argument must\n\ supply its own iterator, or be a sequence.\n\ -In the second form, the callable is called until it returns the sentinel."; +In the second form, the callable is called until it returns the sentinel."); static PyObject * @@ -1072,10 +1072,10 @@ builtin_len(PyObject *self, PyObject *v) return PyInt_FromLong(res); } -static char len_doc[] = +PyDoc_STRVAR(len_doc, "len(object) -> integer\n\ \n\ -Return the number of items of a sequence or mapping."; +Return the number of items of a sequence or mapping."); static PyObject * @@ -1097,10 +1097,10 @@ builtin_slice(PyObject *self, PyObject *args) return PySlice_New(start, stop, step); } -static char slice_doc[] = +PyDoc_STRVAR(slice_doc, "slice([start,] stop[, step]) -> slice object\n\ \n\ -Create a slice object. This is used for slicing by the Numeric extensions."; +Create a slice object. This is used for slicing by the Numeric extensions."); static PyObject * @@ -1113,10 +1113,10 @@ builtin_locals(PyObject *self) return d; } -static char locals_doc[] = +PyDoc_STRVAR(locals_doc, "locals() -> dictionary\n\ \n\ -Return the dictionary containing the current scope's local variables."; +Return the dictionary containing the current scope's local variables."); static PyObject * @@ -1176,12 +1176,12 @@ builtin_min(PyObject *self, PyObject *v) return min_max(v, Py_LT); } -static char min_doc[] = +PyDoc_STRVAR(min_doc, "min(sequence) -> value\n\ min(a, b, c, ...) -> value\n\ \n\ With a single sequence argument, return its smallest item.\n\ -With two or more arguments, return the smallest argument."; +With two or more arguments, return the smallest argument."); static PyObject * @@ -1190,12 +1190,12 @@ builtin_max(PyObject *self, PyObject *v) return min_max(v, Py_GT); } -static char max_doc[] = +PyDoc_STRVAR(max_doc, "max(sequence) -> value\n\ max(a, b, c, ...) -> value\n\ \n\ With a single sequence argument, return its largest item.\n\ -With two or more arguments, return the largest argument."; +With two or more arguments, return the largest argument."); static PyObject * @@ -1212,10 +1212,10 @@ builtin_oct(PyObject *self, PyObject *v) return (*nb->nb_oct)(v); } -static char oct_doc[] = +PyDoc_STRVAR(oct_doc, "oct(number) -> string\n\ \n\ -Return the octal representation of an integer or long integer."; +Return the octal representation of an integer or long integer."); static PyObject * @@ -1252,10 +1252,10 @@ builtin_ord(PyObject *self, PyObject* obj) return NULL; } -static char ord_doc[] = +PyDoc_STRVAR(ord_doc, "ord(c) -> integer\n\ \n\ -Return the integer ordinal of a one-character string."; +Return the integer ordinal of a one-character string."); static PyObject * @@ -1268,11 +1268,11 @@ builtin_pow(PyObject *self, PyObject *args) return PyNumber_Power(v, w, z); } -static char pow_doc[] = +PyDoc_STRVAR(pow_doc, "pow(x, y[, z]) -> number\n\ \n\ With two arguments, equivalent to x**y. With three arguments,\n\ -equivalent to (x**y) % z, but may be more efficient (e.g. for longs)."; +equivalent to (x**y) % z, but may be more efficient (e.g. for longs)."); /* Return number of items in range/xrange (lo, hi, step). step > 0 @@ -1354,14 +1354,14 @@ builtin_range(PyObject *self, PyObject *args) return v; } -static char range_doc[] = +PyDoc_STRVAR(range_doc, "range([start,] stop[, step]) -> list of integers\n\ \n\ Return a list containing an arithmetic progression of integers.\n\ range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.\n\ When step is given, it specifies the increment (or decrement).\n\ For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!\n\ -These are exactly the valid indices for a list of 4 elements."; +These are exactly the valid indices for a list of 4 elements."); static PyObject * @@ -1432,13 +1432,13 @@ builtin_raw_input(PyObject *self, PyObject *args) return PyFile_GetLine(f, -1); } -static char raw_input_doc[] = +PyDoc_STRVAR(raw_input_doc, "raw_input([prompt]) -> string\n\ \n\ Read a string from standard input. The trailing newline is stripped.\n\ If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.\n\ On Unix, GNU readline is used if enabled. The prompt string, if given,\n\ -is printed without a trailing newline before reading."; +is printed without a trailing newline before reading."); static PyObject * @@ -1504,7 +1504,7 @@ Fail: return NULL; } -static char reduce_doc[] = +PyDoc_STRVAR(reduce_doc, "reduce(function, sequence[, initial]) -> value\n\ \n\ Apply a function of two arguments cumulatively to the items of a sequence,\n\ @@ -1512,7 +1512,7 @@ from left to right, so as to reduce the sequence to a single value.\n\ For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\ ((((1+2)+3)+4)+5). If initial is present, it is placed before the items\n\ of the sequence in the calculation, and serves as a default when the\n\ -sequence is empty."; +sequence is empty."); static PyObject * @@ -1521,10 +1521,10 @@ builtin_reload(PyObject *self, PyObject *v) return PyImport_ReloadModule(v); } -static char reload_doc[] = +PyDoc_STRVAR(reload_doc, "reload(module) -> module\n\ \n\ -Reload the module. The module must have been successfully imported before."; +Reload the module. The module must have been successfully imported before."); static PyObject * @@ -1533,11 +1533,11 @@ builtin_repr(PyObject *self, PyObject *v) return PyObject_Repr(v); } -static char repr_doc[] = +PyDoc_STRVAR(repr_doc, "repr(object) -> string\n\ \n\ Return the canonical string representation of the object.\n\ -For most object types, eval(repr(object)) == object."; +For most object types, eval(repr(object)) == object."); static PyObject * @@ -1569,11 +1569,11 @@ builtin_round(PyObject *self, PyObject *args) return PyFloat_FromDouble(x); } -static char round_doc[] = +PyDoc_STRVAR(round_doc, "round(number[, ndigits]) -> floating point number\n\ \n\ Round a number to a given precision in decimal digits (default 0 digits).\n\ -This always returns a floating point number. Precision may be negative."; +This always returns a floating point number. Precision may be negative."); static PyObject * @@ -1605,11 +1605,11 @@ builtin_vars(PyObject *self, PyObject *args) return d; } -static char vars_doc[] = +PyDoc_STRVAR(vars_doc, "vars([object]) -> dictionary\n\ \n\ Without arguments, equivalent to locals().\n\ -With an argument, equivalent to object.__dict__."; +With an argument, equivalent to object.__dict__."); static PyObject * builtin_isinstance(PyObject *self, PyObject *args) @@ -1627,13 +1627,13 @@ builtin_isinstance(PyObject *self, PyObject *args) return PyBool_FromLong(retval); } -static char isinstance_doc[] = +PyDoc_STRVAR(isinstance_doc, "isinstance(object, class-or-type-or-tuple) -> bool\n\ \n\ Return whether an object is an instance of a class or of a subclass thereof.\n\ With a type as second argument, return whether that is the object's type.\n\ The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for\n\ -isinstance(x, A) or isinstance(x, B) or ... (etc.)."; +isinstance(x, A) or isinstance(x, B) or ... (etc.)."); static PyObject * @@ -1652,10 +1652,10 @@ builtin_issubclass(PyObject *self, PyObject *args) return PyBool_FromLong(retval); } -static char issubclass_doc[] = +PyDoc_STRVAR(issubclass_doc, "issubclass(C, B) -> bool\n\ \n\ -Return whether class C is a subclass (i.e., a derived class) of class B."; +Return whether class C is a subclass (i.e., a derived class) of class B."); static PyObject* @@ -1763,12 +1763,12 @@ Fail_ret: } -static char zip_doc[] = +PyDoc_STRVAR(zip_doc, "zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)]\n\ \n\ Return a list of tuples, where each tuple contains the i-th element\n\ from each of the argument sequences. The returned list is truncated\n\ -in length to the length of the shortest argument sequence."; +in length to the length of the shortest argument sequence."); static PyMethodDef builtin_methods[] = { @@ -1822,10 +1822,10 @@ static PyMethodDef builtin_methods[] = { {NULL, NULL}, }; -static char builtin_doc[] = +PyDoc_STRVAR(builtin_doc, "Built-in functions, exceptions, and other objects.\n\ \n\ -Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices."; +Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices."); PyObject * _PyBuiltin_Init(void) diff --git a/Python/exceptions.c b/Python/exceptions.c index bd8f55db10..afb6a7bf38 100644 --- a/Python/exceptions.c +++ b/Python/exceptions.c @@ -30,8 +30,7 @@ * Doc/lib/libexcs.tex! */ -static char -module__doc__[] = +PyDoc_STRVAR(module__doc__, "Python's standard exception class hierarchy.\n\ \n\ Before Python 1.5, the standard exceptions were all simple string objects.\n\ @@ -113,7 +112,8 @@ Exception\n\ +-- PendingDeprecationWarning\n\ +-- SyntaxWarning\n\ +-- OverflowWarning\n\ - +-- RuntimeWarning"; + +-- RuntimeWarning" +); /* Helper function for populating a dictionary with method wrappers. */ @@ -230,8 +230,7 @@ get_self(PyObject *args) * All classes after Exception can be created using PyErr_NewException(). */ -static char -Exception__doc__[] = "Common base class for all exceptions."; +PyDoc_STRVAR(Exception__doc__, "Common base class for all exceptions."); static PyObject * @@ -372,19 +371,16 @@ make_Exception(char *modulename) -static char -StandardError__doc__[] = "Base class for all standard Python exceptions."; +PyDoc_STRVAR(StandardError__doc__, +"Base class for all standard Python exceptions."); -static char -TypeError__doc__[] = "Inappropriate argument type."; +PyDoc_STRVAR(TypeError__doc__, "Inappropriate argument type."); -static char -StopIteration__doc__[] = "Signal the end from iterator.next()."; +PyDoc_STRVAR(StopIteration__doc__, "Signal the end from iterator.next()."); -static char -SystemExit__doc__[] = "Request to exit from the interpreter."; +PyDoc_STRVAR(SystemExit__doc__, "Request to exit from the interpreter."); static PyObject * @@ -439,17 +435,14 @@ static PyMethodDef SystemExit_methods[] = { -static char -KeyboardInterrupt__doc__[] = "Program interrupted by user."; +PyDoc_STRVAR(KeyboardInterrupt__doc__, "Program interrupted by user."); -static char -ImportError__doc__[] = -"Import can't find module, or can't find name in module."; +PyDoc_STRVAR(ImportError__doc__, +"Import can't find module, or can't find name in module."); -static char -EnvironmentError__doc__[] = "Base class for I/O related errors."; +PyDoc_STRVAR(EnvironmentError__doc__, "Base class for I/O related errors."); static PyObject * @@ -627,41 +620,31 @@ PyMethodDef EnvironmentError_methods[] = { -static char -IOError__doc__[] = "I/O operation failed."; +PyDoc_STRVAR(IOError__doc__, "I/O operation failed."); -static char -OSError__doc__[] = "OS system call failed."; +PyDoc_STRVAR(OSError__doc__, "OS system call failed."); #ifdef MS_WINDOWS -static char -WindowsError__doc__[] = "MS-Windows OS system call failed."; +PyDoc_STRVAR(WindowsError__doc__, "MS-Windows OS system call failed."); #endif /* MS_WINDOWS */ -static char -EOFError__doc__[] = "Read beyond end of file."; +PyDoc_STRVAR(EOFError__doc__, "Read beyond end of file."); -static char -RuntimeError__doc__[] = "Unspecified run-time error."; +PyDoc_STRVAR(RuntimeError__doc__, "Unspecified run-time error."); -static char -NotImplementedError__doc__[] = -"Method or function hasn't been implemented yet."; +PyDoc_STRVAR(NotImplementedError__doc__, +"Method or function hasn't been implemented yet."); -static char -NameError__doc__[] = "Name not found globally."; +PyDoc_STRVAR(NameError__doc__, "Name not found globally."); -static char -UnboundLocalError__doc__[] = -"Local name referenced but not bound to a value."; +PyDoc_STRVAR(UnboundLocalError__doc__, +"Local name referenced but not bound to a value."); -static char -AttributeError__doc__[] = "Attribute not found."; +PyDoc_STRVAR(AttributeError__doc__, "Attribute not found."); -static char -SyntaxError__doc__[] = "Invalid syntax."; +PyDoc_STRVAR(SyntaxError__doc__, "Invalid syntax."); static int @@ -859,81 +842,65 @@ static PyMethodDef SyntaxError_methods[] = { /* Exception doc strings */ -static char -AssertionError__doc__[] = "Assertion failed."; +PyDoc_STRVAR(AssertionError__doc__, "Assertion failed."); -static char -LookupError__doc__[] = "Base class for lookup errors."; +PyDoc_STRVAR(LookupError__doc__, "Base class for lookup errors."); -static char -IndexError__doc__[] = "Sequence index out of range."; +PyDoc_STRVAR(IndexError__doc__, "Sequence index out of range."); -static char -KeyError__doc__[] = "Mapping key not found."; +PyDoc_STRVAR(KeyError__doc__, "Mapping key not found."); -static char -ArithmeticError__doc__[] = "Base class for arithmetic errors."; +PyDoc_STRVAR(ArithmeticError__doc__, "Base class for arithmetic errors."); -static char -OverflowError__doc__[] = "Result too large to be represented."; +PyDoc_STRVAR(OverflowError__doc__, "Result too large to be represented."); -static char -ZeroDivisionError__doc__[] = -"Second argument to a division or modulo operation was zero."; +PyDoc_STRVAR(ZeroDivisionError__doc__, +"Second argument to a division or modulo operation was zero."); -static char -FloatingPointError__doc__[] = "Floating point operation failed."; +PyDoc_STRVAR(FloatingPointError__doc__, "Floating point operation failed."); -static char -ValueError__doc__[] = "Inappropriate argument value (of correct type)."; +PyDoc_STRVAR(ValueError__doc__, +"Inappropriate argument value (of correct type)."); -static char -UnicodeError__doc__[] = "Unicode related error."; +PyDoc_STRVAR(UnicodeError__doc__, "Unicode related error."); -static char -SystemError__doc__[] = "Internal error in the Python interpreter.\n\ +PyDoc_STRVAR(SystemError__doc__, +"Internal error in the Python interpreter.\n\ \n\ Please report this to the Python maintainer, along with the traceback,\n\ -the Python version, and the hardware/OS platform and version."; +the Python version, and the hardware/OS platform and version."); -static char -ReferenceError__doc__[] = "Weak ref proxy used after referent went away."; +PyDoc_STRVAR(ReferenceError__doc__, +"Weak ref proxy used after referent went away."); -static char -MemoryError__doc__[] = "Out of memory."; +PyDoc_STRVAR(MemoryError__doc__, "Out of memory."); -static char -IndentationError__doc__[] = "Improper indentation."; +PyDoc_STRVAR(IndentationError__doc__, "Improper indentation."); -static char -TabError__doc__[] = "Improper mixture of spaces and tabs."; +PyDoc_STRVAR(TabError__doc__, "Improper mixture of spaces and tabs."); /* Warning category docstrings */ -static char -Warning__doc__[] = "Base class for warning categories."; +PyDoc_STRVAR(Warning__doc__, "Base class for warning categories."); -static char -UserWarning__doc__[] = "Base class for warnings generated by user code."; +PyDoc_STRVAR(UserWarning__doc__, +"Base class for warnings generated by user code."); -static char -DeprecationWarning__doc__[] = -"Base class for warnings about deprecated features."; +PyDoc_STRVAR(DeprecationWarning__doc__, +"Base class for warnings about deprecated features."); -static char -PendingDeprecationWarning__doc__[] = +PyDoc_STRVAR(PendingDeprecationWarning__doc__, "Base class for warnings about features which will be deprecated " -"in the future."; +"in the future."); -static char -SyntaxWarning__doc__[] = "Base class for warnings about dubious syntax."; +PyDoc_STRVAR(SyntaxWarning__doc__, +"Base class for warnings about dubious syntax."); -static char -OverflowWarning__doc__[] = "Base class for warnings about numeric overflow."; +PyDoc_STRVAR(OverflowWarning__doc__, +"Base class for warnings about numeric overflow."); -static char -RuntimeWarning__doc__[] = -"Base class for warnings about dubious runtime behavior."; +PyDoc_STRVAR(RuntimeWarning__doc__, +"Base class for warnings about dubious runtime behavior."); diff --git a/Python/import.c b/Python/import.c index 8c9cd2f0f5..e3efffe773 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2455,47 +2455,40 @@ imp_new_module(PyObject *self, PyObject *args) /* Doc strings */ -static char doc_imp[] = "\ -This module provides the components needed to build your own\n\ -__import__ function. Undocumented functions are obsolete.\n\ -"; +PyDoc_STRVAR(doc_imp, +"This module provides the components needed to build your own\n\ +__import__ function. Undocumented functions are obsolete."); -static char doc_find_module[] = "\ -find_module(name, [path]) -> (file, filename, (suffix, mode, type))\n\ +PyDoc_STRVAR(doc_find_module, +"find_module(name, [path]) -> (file, filename, (suffix, mode, type))\n\ Search for a module. If path is omitted or None, search for a\n\ built-in, frozen or special module and continue search in sys.path.\n\ The module name cannot contain '.'; to search for a submodule of a\n\ -package, pass the submodule name and the package's __path__.\ -"; +package, pass the submodule name and the package's __path__."); -static char doc_load_module[] = "\ -load_module(name, file, filename, (suffix, mode, type)) -> module\n\ +PyDoc_STRVAR(doc_load_module, +"load_module(name, file, filename, (suffix, mode, type)) -> module\n\ Load a module, given information returned by find_module().\n\ -The module name must include the full package name, if any.\ -"; +The module name must include the full package name, if any."); -static char doc_get_magic[] = "\ -get_magic() -> string\n\ -Return the magic number for .pyc or .pyo files.\ -"; +PyDoc_STRVAR(doc_get_magic, +"get_magic() -> string\n\ +Return the magic number for .pyc or .pyo files."); -static char doc_get_suffixes[] = "\ -get_suffixes() -> [(suffix, mode, type), ...]\n\ +PyDoc_STRVAR(doc_get_suffixes, +"get_suffixes() -> [(suffix, mode, type), ...]\n\ Return a list of (suffix, mode, type) tuples describing the files\n\ -that find_module() looks for.\ -"; +that find_module() looks for."); -static char doc_new_module[] = "\ -new_module(name) -> module\n\ +PyDoc_STRVAR(doc_new_module, +"new_module(name) -> module\n\ Create a new module. Do not enter it in sys.modules.\n\ -The module name must include the full package name, if any.\ -"; +The module name must include the full package name, if any."); -static char doc_lock_held[] = "\ -lock_held() -> 0 or 1\n\ +PyDoc_STRVAR(doc_lock_held, +"lock_held() -> 0 or 1\n\ Return 1 if the import lock is currently held.\n\ -On platforms without threads, return 0.\ -"; +On platforms without threads, return 0."); static PyMethodDef imp_methods[] = { {"find_module", imp_find_module, METH_VARARGS, doc_find_module}, diff --git a/RISCOS/Modules/riscosmodule.c b/RISCOS/Modules/riscosmodule.c index cb4289db3e..adcc1286bc 100644 --- a/RISCOS/Modules/riscosmodule.c +++ b/RISCOS/Modules/riscosmodule.c @@ -120,7 +120,7 @@ static PyObject *riscos_listdir(PyObject *self,PyObject *args) return d; } -static char stat_result__doc__[] = +PyDoc_STRVAR(stat_result__doc__, "stat_result: Result from stat or lstat.\n\n\ This object may be accessed either as a tuple of\n\ (mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\ @@ -128,7 +128,7 @@ or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ \n\ RiscOS: The fields st_ftype, st_attrs, and st_obtype are also available.\n\ \n\ -See os.stat for more information.\n"; +See os.stat for more information."); static PyStructSequence_Field stat_result_fields[] = { { "st_mode", "protection bits" }, -- cgit v1.2.1