summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-06-13 20:33:02 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-06-13 20:33:02 (GMT)
commit14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f (patch)
tree7b150133cdd51df851c6bdaf261cd9ea30c149af /Modules
parent654c11ee3a2c9b72c040524c9cc4f95a1858f20b (diff)
downloadcpython-14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f.zip
cpython-14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f.tar.gz
cpython-14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f.tar.bz2
Patch #568124: Add doc string macros.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_hotshot.c65
-rw-r--r--Modules/_localemodule.c47
-rw-r--r--Modules/_ssl.c28
-rw-r--r--Modules/_weakref.c16
-rw-r--r--Modules/almodule.c207
-rw-r--r--Modules/arraymodule.c80
-rw-r--r--Modules/binascii.c40
-rw-r--r--Modules/cPickle.c19
-rw-r--r--Modules/cStringIO.c83
-rw-r--r--Modules/cmathmodule.c68
-rw-r--r--Modules/cryptmodule.c6
-rw-r--r--Modules/errnomodule.c4
-rw-r--r--Modules/fcntlmodule.c22
-rw-r--r--Modules/gcmodule.c54
-rw-r--r--Modules/gdbmmodule.c60
-rw-r--r--Modules/grpmodule.c8
-rw-r--r--Modules/mathmodule.c36
-rw-r--r--Modules/md5module.c31
-rw-r--r--Modules/newmodule.c28
-rw-r--r--Modules/operator.c12
-rw-r--r--Modules/parsermodule.c13
-rw-r--r--Modules/posixmodule.c450
-rw-r--r--Modules/pwdmodule.c30
-rw-r--r--Modules/pyexpat.c43
-rw-r--r--Modules/readline.c132
-rw-r--r--Modules/resource.c12
-rw-r--r--Modules/selectmodule.c24
-rw-r--r--Modules/shamodule.c23
-rw-r--r--Modules/signalmodule.c37
-rw-r--r--Modules/socketmodule.c164
-rw-r--r--Modules/stropmodule.c86
-rw-r--r--Modules/structmodule.c31
-rw-r--r--Modules/termios.c42
-rw-r--r--Modules/threadmodule.c36
-rw-r--r--Modules/timemodule.c46
-rw-r--r--Modules/unicodedata.c2
-rw-r--r--Modules/xreadlinesmodule.c6
-rw-r--r--Modules/xxsubtype.c4
-rw-r--r--Modules/zlibmodule.c44
39 files changed, 1029 insertions, 1110 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 4399525..06a6824 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 06f5346..e6bacb4 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 1b05e40..d8353e4 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 f797fbf..31e63d1 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 31af258..05c4bef 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 f10d442..dd93950 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 9ef3054..6cba688 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 8ba423e..70ead48 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 <graminit.h>
#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 1dbec84..2f85f41 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 8e74e51..0437368 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 5c4ee2f..a1eaced 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 4b54dc5..74d4f0f 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 13cd0f7..f1d89cc 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 fd8a076..e4417c2 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 72d76ea..1da53ff 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 daad574..c834009 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 b6489fd..88b439f 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 a6068ff..045f27f 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 0a48926..6897c86 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 d1ea181..fbe8c14 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 24dec1f..854d986 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 95f4613..7e90fbc 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 <sys/lock.h>
#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 <sys/statvfs.h>
-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 701ae03..b51b7f9 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 `<pwd.h>'), 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 3153693..ae8bf1b 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 1ca8ec3..afd80db 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 9881314..5ed98a1 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 bdd3a52..73abd4f 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 bb9d37a..94b1eff 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 3cea2dd..395e654 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 1da9afb..477dc31 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 9a68b20..09bcc3d 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -1,14 +1,14 @@
/* strop module */
-static char strop_module__doc__[] =
+#include "Python.h"
+#include <ctype.h>
+
+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 <ctype.h>
/* XXX This file assumes that the <ctype.h> 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 bf871ee..5d4de11 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 <ctype.h>
+
+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 <ctype.h>
+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 0c5697f..ed78ece 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -20,15 +20,15 @@
#include <sys/modem.h>
#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 ba149dc..aa9d3c9 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 dda2ce4..b2b58bf 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 60cb412..966c8ba 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 4511f17..7fba5db 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 7a7cc1e..353f773 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 cfb71ae..3e979a3 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)