@@ -103,10 +103,11 @@ sys_displayhook(PyObject *self, PyObject *o)
103103 return Py_None ;
104104}
105105
106- static char displayhook_doc [] =
106+ PyDoc_STRVAR ( displayhook_doc ,
107107"displayhook(object) -> None\n"
108108"\n"
109- "Print an object to sys.stdout and also save it in __builtin__._\n" ;
109+ "Print an object to sys.stdout and also save it in __builtin__._\n"
110+ );
110111
111112static PyObject *
112113sys_excepthook (PyObject * self , PyObject * args )
@@ -119,10 +120,11 @@ sys_excepthook(PyObject* self, PyObject* args)
119120 return Py_None ;
120121}
121122
122- static char excepthook_doc [] =
123+ PyDoc_STRVAR ( excepthook_doc ,
123124"excepthook(exctype, value, traceback) -> None\n"
124125"\n"
125- "Handle an exception by displaying it with a traceback on sys.stderr.\n" ;
126+ "Handle an exception by displaying it with a traceback on sys.stderr.\n"
127+ );
126128
127129static PyObject *
128130sys_exc_info (PyObject * self )
@@ -137,11 +139,12 @@ sys_exc_info(PyObject *self)
137139 tstate -> exc_traceback : Py_None );
138140}
139141
140- static char exc_info_doc [] =
142+ PyDoc_STRVAR ( exc_info_doc ,
141143"exc_info() -> (type, value, traceback)\n\
142144\n\
143145Return information about the exception that is currently being handled.\n\
144- This should be called from inside an except clause only." ;
146+ This should be called from inside an except clause only."
147+ );
145148
146149static PyObject *
147150sys_exit (PyObject * self , PyObject * args )
@@ -154,14 +157,15 @@ sys_exit(PyObject *self, PyObject *args)
154157 return NULL ;
155158}
156159
157- static char exit_doc [] =
160+ PyDoc_STRVAR ( exit_doc ,
158161"exit([status])\n\
159162\n\
160163Exit the interpreter by raising SystemExit(status).\n\
161164If the status is omitted or None, it defaults to zero (i.e., success).\n\
162165If the status is numeric, it will be used as the system exit status.\n\
163166If it is another kind of object, it will be printed and the system\n\
164- exit status will be one (i.e., failure)." ;
167+ exit status will be one (i.e., failure)."
168+ );
165169
166170#ifdef Py_USING_UNICODE
167171
@@ -171,11 +175,12 @@ sys_getdefaultencoding(PyObject *self)
171175 return PyString_FromString (PyUnicode_GetDefaultEncoding ());
172176}
173177
174- static char getdefaultencoding_doc [] =
178+ PyDoc_STRVAR ( getdefaultencoding_doc ,
175179"getdefaultencoding() -> string\n\
176180\n\
177181Return the current default string encoding used by the Unicode \n\
178- implementation." ;
182+ implementation."
183+ );
179184
180185static PyObject *
181186sys_setdefaultencoding (PyObject * self , PyObject * args )
@@ -189,10 +194,11 @@ sys_setdefaultencoding(PyObject *self, PyObject *args)
189194 return Py_None ;
190195}
191196
192- static char setdefaultencoding_doc [] =
197+ PyDoc_STRVAR ( setdefaultencoding_doc ,
193198"setdefaultencoding(encoding)\n\
194199\n\
195- Set the current default string encoding used by the Unicode implementation." ;
200+ Set the current default string encoding used by the Unicode implementation."
201+ );
196202
197203#endif
198204
@@ -316,11 +322,12 @@ sys_settrace(PyObject *self, PyObject *args)
316322 return Py_None ;
317323}
318324
319- static char settrace_doc [] =
325+ PyDoc_STRVAR ( settrace_doc ,
320326"settrace(function)\n\
321327\n\
322328Set the global debug tracing function. It will be called on each\n\
323- function call. See the debugger chapter in the library manual." ;
329+ function call. See the debugger chapter in the library manual."
330+ );
324331
325332static PyObject *
326333sys_setprofile (PyObject * self , PyObject * args )
@@ -335,11 +342,12 @@ sys_setprofile(PyObject *self, PyObject *args)
335342 return Py_None ;
336343}
337344
338- static char setprofile_doc [] =
345+ PyDoc_STRVAR ( setprofile_doc ,
339346"setprofile(function)\n\
340347\n\
341348Set the profiling function. It will be called on each function call\n\
342- and return. See the profiler chapter in the library manual." ;
349+ and return. See the profiler chapter in the library manual."
350+ );
343351
344352static PyObject *
345353sys_setcheckinterval (PyObject * self , PyObject * args )
@@ -351,11 +359,12 @@ sys_setcheckinterval(PyObject *self, PyObject *args)
351359 return Py_None ;
352360}
353361
354- static char setcheckinterval_doc [] =
362+ PyDoc_STRVAR ( setcheckinterval_doc ,
355363"setcheckinterval(n)\n\
356364\n\
357365Tell the Python interpreter to check for asynchronous events every\n\
358- n instructions. This also affects how often thread switches occur." ;
366+ n instructions. This also affects how often thread switches occur."
367+ );
359368
360369static PyObject *
361370sys_setrecursionlimit (PyObject * self , PyObject * args )
@@ -373,26 +382,28 @@ sys_setrecursionlimit(PyObject *self, PyObject *args)
373382 return Py_None ;
374383}
375384
376- static char setrecursionlimit_doc [] =
385+ PyDoc_STRVAR ( setrecursionlimit_doc ,
377386"setrecursionlimit(n)\n\
378387\n\
379388Set the maximum depth of the Python interpreter stack to n. This\n\
380389limit prevents infinite recursion from causing an overflow of the C\n\
381390stack and crashing Python. The highest possible limit is platform-\n\
382- dependent." ;
391+ dependent."
392+ );
383393
384394static PyObject *
385395sys_getrecursionlimit (PyObject * self )
386396{
387397 return PyInt_FromLong (Py_GetRecursionLimit ());
388398}
389399
390- static char getrecursionlimit_doc [] =
400+ PyDoc_STRVAR ( getrecursionlimit_doc ,
391401"getrecursionlimit()\n\
392402\n\
393403Return the current value of the recursion limit, the maximum depth\n\
394404of the Python interpreter stack. This limit prevents infinite\n\
395405recursion from causing an overflow of the C stack and crashing Python." ;
406+ );
396407
397408#ifdef HAVE_DLOPEN
398409static PyObject *
@@ -409,14 +420,15 @@ sys_setdlopenflags(PyObject *self, PyObject *args)
409420 return Py_None ;
410421}
411422
412- static char setdlopenflags_doc [] =
423+ PyDoc_STRVAR ( setdlopenflags_doc ,
413424"setdlopenflags(n) -> None\n\
414425\n\
415426Set the flags that will be used for dlopen() calls. Among other\n\
416427things, this will enable a lazy resolving of symbols when importing\n\
417428a module, if called as sys.setdlopenflags(0)\n\
418429To share symbols across extension modules, call as\n\
419- sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)" ;
430+ sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)"
431+ );
420432
421433static PyObject *
422434sys_getdlopenflags (PyObject * self , PyObject * args )
@@ -427,11 +439,12 @@ sys_getdlopenflags(PyObject *self, PyObject *args)
427439 return PyInt_FromLong (tstate -> interp -> dlopenflags );
428440}
429441
430- static char getdlopenflags_doc [] =
442+ PyDoc_STRVAR ( getdlopenflags_doc ,
431443"getdlopenflags() -> int\n\
432444\n\
433445Return the current value of the flags that are used for dlopen()\n\
434- calls. The flag constants are defined in the dl module." ;
446+ calls. The flag constants are defined in the dl module."
447+ );
435448#endif
436449
437450#ifdef USE_MALLOPT
@@ -466,11 +479,12 @@ sys_gettotalrefcount(PyObject *self)
466479
467480#endif /* Py_TRACE_REFS */
468481
469- static char getrefcount_doc [] =
482+ PyDoc_STRVAR ( getrefcount_doc ,
470483"getrefcount(object) -> integer\n\
471484\n\
472485Return the current reference count for the object. This includes the\n\
473- temporary reference in the argument list, so it is at least 2." ;
486+ temporary reference in the argument list, so it is at least 2."
487+ );
474488
475489#ifdef COUNT_ALLOCS
476490static PyObject *
@@ -482,7 +496,7 @@ sys_getcounts(PyObject *self)
482496}
483497#endif
484498
485- static char getframe_doc [] =
499+ PyDoc_STRVAR ( getframe_doc ,
486500"_getframe([depth]) -> frameobject\n\
487501\n\
488502Return a frame object from the call stack. If optional integer depth is\n\
@@ -491,7 +505,8 @@ If that is deeper than the call stack, ValueError is raised. The default\n\
491505for depth is zero, returning the frame at the top of the call stack.\n\
492506\n\
493507This function should be used for internal and specialized\n\
494- purposes only." ;
508+ purposes only."
509+ );
495510
496511static PyObject *
497512sys_getframe (PyObject * self , PyObject * args )
@@ -633,7 +648,8 @@ PySys_AddWarnOption(char *s)
633648 Two literals concatenated works just fine. If you have a K&R compiler
634649 or other abomination that however *does* understand longer strings,
635650 get rid of the !!! comment in the middle and the quotes that surround it. */
636- static char sys_doc [] =
651+ PyDoc_VAR (sys_doc ) =
652+ PyDoc_STR (
637653"This module provides access to some objects used or maintained by the\n\
638654interpreter and to functions that interact strongly with the interpreter.\n\
639655\n\
@@ -669,8 +685,10 @@ exc_traceback -- traceback of exception currently being handled\n\
669685 The function exc_info() should be used instead of these three,\n\
670686 because it is thread-safe.\n\
671687"
688+ )
672689#ifndef MS_WIN16
673690/* concatenating string here */
691+ PyDoc_STR (
674692"\n\
675693Static objects:\n\
676694\n\
@@ -686,12 +704,16 @@ executable -- pathname of this Python interpreter\n\
686704prefix -- prefix used to find the Python library\n\
687705exec_prefix -- prefix used to find the machine-specific Python library\n\
688706"
707+ )
689708#ifdef MS_WINDOWS
690709/* concatenating string here */
710+ PyDoc_STR (
691711"dllhandle -- [Windows only] integer handle of the Python DLL\n\
692712winver -- [Windows only] version number of the Python DLL\n\
693713"
714+ )
694715#endif /* MS_WINDOWS */
716+ PyDoc_STR (
695717"__stdin__ -- the original stdin; don't touch!\n\
696718__stdout__ -- the original stdout; don't touch!\n\
697719__stderr__ -- the original stderr; don't touch!\n\
@@ -713,6 +735,7 @@ setprofile() -- set the global profiling function\n\
713735setrecursionlimit() -- set the max recursion depth for the interpreter\n\
714736settrace() -- set the global debug tracing function\n\
715737"
738+ )
716739#endif /* MS_WIN16 */
717740/* end of sys_doc */ ;
718741
0 commit comments