summaryrefslogtreecommitdiff
path: root/Doc/c-api/arg.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/c-api/arg.rst')
-rw-r--r--Doc/c-api/arg.rst37
1 files changed, 18 insertions, 19 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 1123972aa2..e8e7e0d559 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -223,8 +223,7 @@ which disallows mutable objects such as :class:`bytearray`.
:c:func:`PyArg_ParseTuple` will use this location as the buffer and interpret the
initial value of *\*buffer_length* as the buffer size. It will then copy the
encoded data into the buffer and NUL-terminate it. If the buffer is not large
- enough, a :exc:`TypeError` will be set.
- Note: starting from Python 3.6 a :exc:`ValueError` will be set.
+ enough, a :exc:`ValueError` will be set.
In both cases, *\*buffer_length* is set to the length of the encoded data
without the trailing NUL byte.
@@ -266,15 +265,12 @@ Numbers
Convert a Python integer to a C :c:type:`unsigned long` without
overflow checking.
-``L`` (:class:`int`) [PY_LONG_LONG]
- Convert a Python integer to a C :c:type:`long long`. This format is only
- available on platforms that support :c:type:`long long` (or :c:type:`_int64` on
- Windows).
+``L`` (:class:`int`) [long long]
+ Convert a Python integer to a C :c:type:`long long`.
-``K`` (:class:`int`) [unsigned PY_LONG_LONG]
+``K`` (:class:`int`) [unsigned long long]
Convert a Python integer to a C :c:type:`unsigned long long`
- without overflow checking. This format is only available on platforms that
- support :c:type:`unsigned long long` (or :c:type:`unsigned _int64` on Windows).
+ without overflow checking.
``n`` (:class:`int`) [Py_ssize_t]
Convert a Python integer to a C :c:type:`Py_ssize_t`.
@@ -424,8 +420,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)
@@ -588,15 +591,11 @@ Building values
``k`` (:class:`int`) [unsigned long]
Convert a C :c:type:`unsigned long` to a Python integer object.
- ``L`` (:class:`int`) [PY_LONG_LONG]
- Convert a C :c:type:`long long` to a Python integer object. Only available
- on platforms that support :c:type:`long long` (or :c:type:`_int64` on
- Windows).
+ ``L`` (:class:`int`) [long long]
+ Convert a C :c:type:`long long` to a Python integer object.
- ``K`` (:class:`int`) [unsigned PY_LONG_LONG]
- Convert a C :c:type:`unsigned long long` to a Python integer object. Only
- available on platforms that support :c:type:`unsigned long long` (or
- :c:type:`unsigned _int64` on Windows).
+ ``K`` (:class:`int`) [unsigned long long]
+ Convert a C :c:type:`unsigned long long` to a Python integer object.
``n`` (:class:`int`) [Py_ssize_t]
Convert a C :c:type:`Py_ssize_t` to a Python integer.