8000 Document PyDoc_STR alongside PyDoc_STRVAR · python/cpython@c05b5ba · GitHub
[go: up one dir, main page]

Skip to content

Commit c05b5ba

Browse files
committed
Document PyDoc_STR alongside PyDoc_STRVAR
1 parent 644b8ae commit c05b5ba

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Doc/c-api/intro.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ complete listing.
177177
.. c:macro:: PyDoc_STRVAR(name, str)
178178
179179
Creates a variable with name ``name`` that can be used in docstrings.
180+
If Python is built without docstrings, the value will be empty.
180181

181-
Use the :c:macro:`PyDoc_STRVAR` or :c:macro:`PyDoc_STR` macros for
182-
docstrings to support building Python without docstrings,
183-
as specified in :pep:`7`.
182+
Use :c:macro:`PyDoc_STRVAR` for docstrings to support building
183+
Python without docstrings, as specified in :pep:`7`.
184184

185185
Example::
186186

@@ -192,6 +192,22 @@ complete listing.
192192
// ...
193193
}
194194

195+
.. c:macro:: PyDoc_STR(str)
196+
197+
Creates a docstring for the given input string or an empty string
198+
if docstrings are disabled.
199+
200+
Use :c:macro:`PyDoc_STR` in specifying docstrings to support
201+
building Python without docstrings, as specified in :pep:`7`.
202+
203+
Example::
204+
205+
static PyMethodDef pysqlite_row_methods[] = {
206+
{"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
207+
PyDoc_STR("Returns the keys of the row.")},
208+
{NULL, NULL}
209+
};
210+
195211
.. _api-objects:
196212

197213
Objects, Types and Reference Counts

0 commit comments

Comments
 (0)
0