summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-09 13:30:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-09 13:30:29 (GMT)
commitf41b82fb19d1b91f99ab657e4c6a751c44152f12 (patch)
treed646a40450ae5321aaa384609fb7b027639363e6 /Doc
parent339880809a10bc63967b6f94aadc4cd7d406ba54 (diff)
downloadcpython-f41b82fb19d1b91f99ab657e4c6a751c44152f12.zip
cpython-f41b82fb19d1b91f99ab657e4c6a751c44152f12.tar.gz
cpython-f41b82fb19d1b91f99ab657e4c6a751c44152f12.tar.bz2
Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now support
positional-only and keyword parameters in the same function.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/arg.rst11
-rw-r--r--Doc/glossary.rst2
-rw-r--r--Doc/whatsnew/3.6.rst5
3 files changed, 16 insertions, 2 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index d9f0f43..d15f649 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -406,8 +406,15 @@ API Functions
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
Parse the parameters of a function that takes both positional and keyword
- parameters into local variables. Returns true on success; on failure, it
- returns false and raises the appropriate exception.
+ parameters into local variables. The *keywords* argument is a
+ *NULL*-terminated array of keyword parameter names. Empty names denote
+ :ref:`positional-only parameters <positional-only_parameter>`.
+ Returns true on success; on failure, it returns false and raises the
+ appropriate exception.
+
+ .. versionchanged:: 3.6
+ Added support for :ref:`positional-only parameters
+ <positional-only_parameter>`.
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index e7bcb6a..b4f3089 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -718,6 +718,8 @@ Glossary
def func(foo, bar=None): ...
+ .. _positional-only_parameter:
+
* :dfn:`positional-only`: specifies an argument that can be supplied only
by position. Python has no syntax for defining positional-only
parameters. However, some built-in functions have positional-only
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index f438f0b..5dc6076 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -503,6 +503,11 @@ Build and C API Changes
* New :c:func:`Py_FinalizeEx` API which indicates if flushing buffered data
failed (:issue:`5319`).
+* :c:func:`PyArg_ParseTupleAndKeywords` now supports :ref:`positional-only
+ parameters <positional-only_parameter>`. Positional-only parameters are
+ defined by empty names.
+ (Contributed by Serhit Storchaka in :issue:`26282`).
+
Deprecated
==========