Skip to content

Commit 097553f

Browse files
committed
Modify PyDoc_STRVAR example; mention PEP 7
1 parent 7d95103 commit 097553f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Doc/c-api/intro.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,21 @@ complete listing.
176176

177177
.. c:macro:: PyDoc_STRVAR(name, str)
178178
179-
A shortcut for ``static const char name[] = str``, commonly used
180-
to initialize a module, function, class, or method docstring.
179+
Creates a variable with name ``name`` that can be used in docstrings.
180+
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`.
181184

182185
Example::
183186

184-
PyDoc_STRVAR(module_doc, "This is the module's docstring.");
187+
PyDoc_STRVAR(pop_doc, "Remove and return the rightmost element.");
185188

186-
.. versionchanged:: 3.8
187-
This macro previously inserted ``static char name[]``.
189+
static PyMethodDef deque_methods[] = {
190+
// ...
191+
{"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},
192+
// ...
193+
}
188194

189195
.. _api-objects:
190196

0 commit comments

Comments
 (0)