Skip to content

Commit ae493ad

Browse files
author
loewis
committed
Patch #568124: Add doc string macros.
git-svn-id: http://svn.python.org/projects/python/trunk@27200 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent a118409 commit ae493ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1509
-1625
lines changed

Modules/_hotshot.c

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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

108108
static PyObject *
109109
logreader_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

529529
static PyObject *
530530
logreader_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

10281028
static PyObject *
10291029
profiler_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

10511051
static PyObject *
10521052
profiler_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

10721072
static PyObject *
10731073
profiler_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

10961096
static PyObject *
10971097
profiler_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

11341134
static PyObject *
11351135
profiler_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

11531153
static PyObject *
11541154
profiler_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

12461246
static 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

12951295
static 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

14831483
static PyObject *
14841484
hotshot_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\
15341534
Returns 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

15371537
static PyObject *
15381538
hotshot_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

15671572
static PyObject *
15681573
hotshot_resolution(PyObject *unused, PyObject *args)

Modules/_localemodule.c

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ This software comes with no warranty. Use at your own risk.
3838
char *strdup(const char *);
3939
#endif
4040

41-
static char locale__doc__[] = "Support for POSIX locales.";
41+
PyDoc_STRVAR(locale__doc__, "Support for POSIX locales.");
4242

4343
static PyObject *Error;
4444

4545
/* support functions for formatting floating point numbers */
4646

47-
static char setlocale__doc__[] =
48-
"(integer,string=None) -> string. Activates/queries locale processing."
49-
;
47+
PyDoc_STRVAR(setlocale__doc__,
48+
"(integer,string=None) -> string. Activates/queries locale processing.");
5049

5150
/* to record the LC_NUMERIC settings */
5251
static PyObject* grouping = NULL;
@@ -244,9 +243,8 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
244243
return result_object;
245244
}
246245

247-
static char localeconv__doc__[] =
248-
"() -> dict. Returns numeric and monetary locale-specific parameters."
249-
;
246+
PyDoc_STRVAR(localeconv__doc__,
247+
"() -> dict. Returns numeric and monetary locale-specific parameters.");
250248

251249
static PyObject*
252250
PyLocale_localeconv(PyObject* self)
@@ -321,9 +319,8 @@ PyLocale_localeconv(PyObject* self)
321319
return NULL;
322320
}
323321

324-
static char strcoll__doc__[] =
325-
"string,string -> int. Compares two strings according to the locale."
326-
;
322+
PyDoc_STRVAR(strcoll__doc__,
323+
"string,string -> int. Compares two strings according to the locale.");
327324

328325
static PyObject*
329326
PyLocale_strcoll(PyObject* self, PyObject* args)
@@ -335,9 +332,8 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
335332
return PyInt_FromLong(strcoll(s1, s2));
336333
}
337334

338-
static char strxfrm__doc__[] =
339-
"string -> string. Returns a string that behaves for cmp locale-aware."
340-
;
335+
PyDoc_STRVAR(strxfrm__doc__,
336+
"string -> string. Returns a string that behaves for cmp locale-aware.");
341337

342338
static PyObject*
343339
PyLocale_strxfrm(PyObject* self, PyObject* args)
@@ -521,10 +517,9 @@ struct langinfo_constant{
521517
{0, 0}
522518
};
523519

524-
static char nl_langinfo__doc__[] =
520+
PyDoc_STRVAR(nl_langinfo__doc__,
525521
"nl_langinfo(key) -> string\n"
526-
"Return the value for the locale information associated with key."
527-
;
522+
"Return the value for the locale information associated with key.");
528523

529524
static PyObject*
530525
PyLocale_nl_langinfo(PyObject* self, PyObject* args)
@@ -545,9 +540,9 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
545540

546541
#ifdef HAVE_LIBINTL_H
547542

548-
static char gettext__doc__[]=
543+
PyDoc_STRVAR(gettext__doc__,
549544
"gettext(msg) -> string\n"
550-
"Return translation of msg.";
545+
"Return translation of msg.");
551546

552547
static PyObject*
553548
PyIntl_gettext(PyObject* self, PyObject *args)
@@ -558,9 +553,9 @@ PyIntl_gettext(PyObject* self, PyObject *args)
558553
return PyString_FromString(gettext(in));
559554
}
560555

561-
static char dgettext__doc__[]=
556+
PyDoc_STRVAR(dgettext__doc__,
562557
"dgettext(domain, msg) -> string\n"
563-
"Return translation of msg in domain.";
558+
"Return translation of msg in domain.");
564559

565560
static PyObject*
566561
PyIntl_dgettext(PyObject* self, PyObject *args)
@@ -571,9 +566,9 @@ PyIntl_dgettext(PyObject* self, PyObject *args)
571566
return PyString_FromString(dgettext(domain, in));
572567
}
573568

574-
static char dcgettext__doc__[]=
569+
PyDoc_STRVAR(dcgettext__doc__,
575570
"dcgettext(domain, msg, category) -> string\n"
576-
"Return translation of msg in domain and category.";
571+
"Return translation of msg in domain and category.");
577572

578573
static PyObject*
579574
PyIntl_dcgettext(PyObject *self, PyObject *args)
@@ -585,9 +580,9 @@ PyIntl_dcgettext(PyObject *self, PyObject *args)
585580
return PyString_FromString(dcgettext(domain,msgid,category));
586581
}
587582

588-
static char textdomain__doc__[]=
583+
PyDoc_STRVAR(textdomain__doc__,
589584
"textdomain(domain) -> string\n"
590-
"Set the C library's textdmain to domain, returning the new domain.";
585+
"Set the C library's textdmain to domain, returning the new domain.");
591586

592587
static PyObject*
593588
PyIntl_textdomain(PyObject* self, PyObject* args)
@@ -603,9 +598,9 @@ PyIntl_textdomain(PyObject* self, PyObject* args)
603598
return PyString_FromString(domain);
604599
}
605600

606-
static char bindtextdomain__doc__[]=
601+
PyDoc_STRVAR(bindtextdomain__doc__,
607602
"bindtextdomain(domain, dir) -> string\n"
608-
"Bind the C library's domain to dir.";
603+
"Bind the C library's domain to dir.");
609604

610605
static PyObject*
611606
PyIntl_bindtextdomain(PyObject* self,PyObject*args)

0 commit comments

Comments
 (0)