[Python-checkins] bpo-29179: Document the Py_UNUSED macro (#4341)

Victor Stinner webhook-mailer at python.org
Wed Nov 8 10:59:24 EST 2017


https://github.com/python/cpython/commit/2138163621196a186975796afb2b0a6aa335231d
commit: 2138163621196a186975796afb2b0a6aa335231d
branch: master
author: Petr Viktorin <encukou at gmail.com>
committer: Victor Stinner <victor.stinner at gmail.com>
date: 2017-11-08T07:59:20-08:00
summary:

bpo-29179: Document the Py_UNUSED macro (#4341)

Py_UNUSED has a public name, and is used in the wild outside CPython,
but was not documented. Rectify that.

The macro was added in bpo-19976 and referenced in bpo-26179.

files:
M Doc/c-api/intro.rst

diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index 63231808b4a..15006100c73 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -149,6 +149,13 @@ complete listing.
    Like ``getenv(s)``, but returns *NULL* if :option:`-E` was passed on the
    command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set).
 
+.. c:macro:: Py_UNUSED(arg)
+
+   Use this for unused arguments in a function definition to silence compiler
+   warnings, e.g. ``PyObject* func(PyObject *Py_UNUSED(ignored))``.
+
+   .. versionadded:: 3.4
+
 
 .. _api-objects:
 



More information about the Python-checkins mailing list