@@ -101,9 +101,9 @@ static PyObject * ProfilerError = NULL;
101101
102102/* The log reader... */
103103
104- static char logreader_close__doc__ [] =
104+ PyDoc_STRVAR ( logreader_close__doc__ ,
105105"close()\n"
106- "Close the log file, preventing additional records from being read." ;
106+ "Close the log file, preventing additional records from being read." ) ;
107107
108108static PyObject *
109109logreader_close (LogReaderObject * self , PyObject * args )
@@ -522,9 +522,9 @@ logreader_sq_item(LogReaderObject *self, int index)
522522 return result ;
523523}
524524
525- static char next__doc__ [] =
525+ PyDoc_STRVAR ( next__doc__ ,
526526"next() -> event-info\n"
527- "Return the next event record from the log file." ;
527+ "Return the next event record from the log file." ) ;
528528
529529static PyObject *
530530logreader_next (LogReaderObject * self , PyObject * args )
@@ -1021,9 +1021,9 @@ is_available(ProfilerObject *self)
10211021
10221022/* Profiler object interface methods. */
10231023
1024- static char addinfo__doc__ [] =
1024+ PyDoc_STRVAR ( addinfo__doc__ ,
10251025"addinfo(key, value)\n"
1026- "Insert an ADD_INFO record into the log." ;
1026+ "Insert an ADD_INFO record into the log." ) ;
10271027
10281028static PyObject *
10291029profiler_addinfo (ProfilerObject * self , PyObject * args )
@@ -1044,9 +1044,9 @@ profiler_addinfo(ProfilerObject *self, PyObject *args)
10441044 return result ;
10451045}
10461046
1047- static char close__doc__ [] =
1047+ PyDoc_STRVAR ( close__doc__ ,
10481048"close()\n"
1049- "Shut down this profiler and close the log files, even if its active." ;
1049+ "Shut down this profiler and close the log files, even if its active." ) ;
10501050
10511051static PyObject *
10521052profiler_close (ProfilerObject * self , PyObject * args )
@@ -1065,9 +1065,9 @@ profiler_close(ProfilerObject *self, PyObject *args)
10651065 return result ;
10661066}
10671067
1068- static char runcall__doc__ [] =
1068+ PyDoc_STRVAR ( runcall__doc__ ,
10691069"runcall(callable[, args[, kw]]) -> callable()\n"
1070- "Profile a specific function call, returning the result of that call." ;
1070+ "Profile a specific function call, returning the result of that call." ) ;
10711071
10721072static PyObject *
10731073profiler_runcall (ProfilerObject * self , PyObject * args )
@@ -1088,10 +1088,10 @@ profiler_runcall(ProfilerObject *self, PyObject *args)
10881088 return result ;
10891089}
10901090
1091- static char runcode__doc__ [] =
1091+ PyDoc_STRVAR ( runcode__doc__ ,
10921092"runcode(code, globals[, locals])\n"
10931093"Execute a code object while collecting profile data. If locals is\n"
1094- "omitted, globals is used for the locals as well." ;
1094+ "omitted, globals is used for the locals as well." ) ;
10951095
10961096static PyObject *
10971097profiler_runcode (ProfilerObject * self , PyObject * args )
@@ -1127,9 +1127,9 @@ profiler_runcode(ProfilerObject *self, PyObject *args)
11271127 return result ;
11281128}
11291129
1130- static char start__doc__ [] =
1130+ PyDoc_STRVAR ( start__doc__ ,
11311131"start()\n"
1132- "Install this profiler for the current thread." ;
1132+ "Install this profiler for the current thread." ) ;
11331133
11341134static PyObject *
11351135profiler_start (ProfilerObject * self , PyObject * args )
@@ -1146,9 +1146,9 @@ profiler_start(ProfilerObject *self, PyObject *args)
11461146 return result ;
11471147}
11481148
1149- static char stop__doc__ [] =
1149+ PyDoc_STRVAR ( stop__doc__ ,
11501150"stop()\n"
1151- "Remove this profiler from the current thread." ;
1151+ "Remove this profiler from the current thread." ) ;
11521152
11531153static PyObject *
11541154profiler_stop (ProfilerObject * self , PyObject * args )
@@ -1225,7 +1225,7 @@ profiler_getattr(ProfilerObject *self, char *name)
12251225}
12261226
12271227
1228- static char profiler_object__doc__ [] =
1228+ PyDoc_STRVAR ( profiler_object__doc__ ,
12291229"High-performance profiler object.\n"
12301230"\n"
12311231"Methods:\n"
@@ -1241,7 +1241,7 @@ static char profiler_object__doc__[] =
12411241"closed: True if the profiler has already been closed.\n"
12421242"frametimings: True if ENTER/EXIT events collect timing information.\n"
12431243"lineevents: True if SET_LINENO events are reported to the profiler.\n"
1244- "linetimings: True if SET_LINENO events collect timing information." ;
1244+ "linetimings: True if SET_LINENO events collect timing information." ) ;
12451245
12461246static PyTypeObject ProfilerType = {
12471247 PyObject_HEAD_INIT (NULL )
@@ -1288,9 +1288,9 @@ logreader_getattr(LogReaderObject *self, char *name)
12881288}
12891289
12901290
1291- static char logreader__doc__ [] = "\
1292- logreader(filename) --> log-iterator\n\
1293- Create a log-reader for the timing information file." ;
1291+ PyDoc_STRVAR ( logreader__doc__ ,
1292+ " logreader(filename) --> log-iterator\n\
1293+ Create a log-reader for the timing information file." ) ;
12941294
12951295static PySequenceMethods logreader_as_sequence = {
12961296 0 , /* sq_length */
@@ -1476,9 +1476,9 @@ write_header(ProfilerObject *self)
14761476 return 0 ;
14771477}
14781478
1479- static char profiler__doc__ [] = "\
1480- profiler(logfilename[, lineevents[, linetimes]]) -> profiler\n\
1481- Create a new profiler object." ;
1479+ PyDoc_STRVAR ( profiler__doc__ ,
1480+ " profiler(logfilename[, lineevents[, linetimes]]) -> profiler\n\
1481+ Create a new profiler object." ) ;
14821482
14831483static PyObject *
14841484hotshot_profiler (PyObject * unused , PyObject * args )
@@ -1529,10 +1529,10 @@ hotshot_profiler(PyObject *unused, PyObject *args)
15291529 return (PyObject * ) self ;
15301530}
15311531
1532- static char coverage__doc__ [] = "\
1533- coverage(logfilename) -> profiler\n\
1532+ PyDoc_STRVAR ( coverage__doc__ ,
1533+ " coverage(logfilename) -> profiler\n\
15341534Returns a profiler that doesn't collect any timing information, which is\n\
1535- useful in building a coverage analysis tool." ;
1535+ useful in building a coverage analysis tool." ) ;
15361536
15371537static PyObject *
15381538hotshot_coverage (PyObject * unused , PyObject * args )
@@ -1552,17 +1552,22 @@ hotshot_coverage(PyObject *unused, PyObject *args)
15521552 return result ;
15531553}
15541554
1555- static char resolution__doc__ [] =
1555+ PyDoc_VAR ( resolution__doc__ ) =
15561556#ifdef MS_WIN32
1557+ PyDoc_STR (
15571558"resolution() -> (performance-counter-ticks, update-frequency)\n"
15581559"Return the resolution of the timer provided by the QueryPerformanceCounter()\n"
15591560"function. The first value is the smallest observed change, and the second\n"
1560- "is the result of QueryPerformanceFrequency()." ;
1561+ "is the result of QueryPerformanceFrequency()."
1562+ )
15611563#else
1564+ PyDoc_STR (
15621565"resolution() -> (gettimeofday-usecs, getrusage-usecs)\n"
15631566"Return the resolution of the timers provided by the gettimeofday() and\n"
1564- "getrusage() system calls, or -1 if the call is not supported." ;
1567+ "getrusage() system calls, or -1 if the call is not supported."
1568+ )
15651569#endif
1570+ ;
15661571
15671572static PyObject *
15681573hotshot_resolution (PyObject * unused , PyObject * args )
0 commit comments