]> granicus.if.org Git - python/commitdiff
bpo-29179: Document the Py_UNUSED macro (#4341)
authorPetr Viktorin <encukou@gmail.com>
Wed, 8 Nov 2017 15:59:20 +0000 (16:59 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 8 Nov 2017 15:59:20 +0000 (07:59 -0800)
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.

Doc/c-api/intro.rst

index 63231808b4ad924b73ca73e8943a84571153cfa9..15006100c7366acc86510e9ef29d186eb0c2b303 100644 (file)
@@ -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: