8000 bpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros by bsolomon1124 · Pull Request #16607 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros #16607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Document PyDoc_STR alongside PyDoc_STRVAR
  • Loading branch information
bsolomon1124 committed Jan 26, 2020
commit c05b5bac74d625b6dfb6367b8f0985c9ebf263d1
22 changes: 19 additions & 3 deletions Doc/c-api/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ complete listing.
.. c:macro:: PyDoc_STRVAR(name, str)

Creates a variable with name ``name`` that can be used in docstrings.
If Python is built without docstrings, the value will be empty.

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

Example::

Expand All @@ -192,6 +192,22 @@ complete listing.
// ...
}

.. c:macro:: PyDoc_STR(str)

Creates a docstring for the given input string or an empty string
if docstrings are disabled.

Use :c:macro:`PyDoc_STR` in specifying docstrings to support
building Python without docstrings, as specified in :pep:`7`.

Example::

static PyMethodDef pysqlite_row_methods[] = {
{"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
PyDoc_STR("Returns the keys of the row.")},
{NULL, NULL}
};

.. _api-objects:

Objects, Types and Reference Counts
Expand Down
0