diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-10-14 05:50:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 05:50:03 (GMT) |
commit | 7284e0ef84e53f80b2e60c3f51e3467d67a275f3 (patch) | |
tree | ccc8b2aecb45f767c08b9b4b934bfe99ce76ef47 /Doc | |
parent | ce298a1c1566467e7fd459c8f61478a26f42833e (diff) | |
download | cpython-7284e0ef84e53f80b2e60c3f51e3467d67a275f3.zip cpython-7284e0ef84e53f80b2e60c3f51e3467d67a275f3.tar.gz cpython-7284e0ef84e53f80b2e60c3f51e3467d67a275f3.tar.bz2 |
gh-110815: Support non-ASCII keyword names in PyArg_ParseTupleAndKeywords() (GH-110816)
It already mostly worked, except in the case when invalid keyword
argument with non-ASCII name was passed to function with non-ASCII
parameter names. Then it crashed in the debug mode.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/arg.rst | 9 | ||||
-rw-r--r-- | Doc/whatsnew/3.13.rst | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index c43dd0f..62d87d8 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -416,8 +416,10 @@ 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. The *keywords* argument is a - ``NULL``-terminated array of keyword parameter names. Empty names denote + parameters into local variables. + The *keywords* argument is a ``NULL``-terminated array of keyword parameter + names specified as null-terminated ASCII or UTF-8 encoded C strings. + Empty names denote :ref:`positional-only parameters <positional-only_parameter>`. Returns true on success; on failure, it returns false and raises the appropriate exception. @@ -426,6 +428,9 @@ API Functions Added support for :ref:`positional-only parameters <positional-only_parameter>`. + .. versionchanged:: 3.13 + Added support for non-ASCII keyword parameter names. + .. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index dfce976..eb49e01 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -1045,6 +1045,10 @@ New Features but pass event arguments as a Python :class:`tuple` object. (Contributed by Victor Stinner in :gh:`85283`.) +* :c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword + parameter names. + (Contributed by Serhiy Storchaka in :gh:`110815`.) + Porting to Python 3.13 ---------------------- |