summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorJeroen Demeyer <J.Demeyer@UGent.be>2019-08-16 10:41:27 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-08-16 10:41:27 (GMT)
commit0567786d26348aa7eaf0ab1b5d038fdabe409d92 (patch)
treefe7c90392253850b8a3111b3177188a8f255dc79 /Doc
parentf3cb68f2e4c3e0c405460f9bb881f5c1db70f535 (diff)
downloadcpython-0567786d26348aa7eaf0ab1b5d038fdabe409d92.zip
cpython-0567786d26348aa7eaf0ab1b5d038fdabe409d92.tar.gz
cpython-0567786d26348aa7eaf0ab1b5d038fdabe409d92.tar.bz2
bpo-37540: vectorcall: keyword names must be strings (GH-14682)
The fact that keyword names are strings is now part of the vectorcall and `METH_FASTCALL` protocols. The biggest concrete change is that `_PyStack_UnpackDict` now checks that and raises `TypeError` if not. CC @markshannon @vstinner https://bugs.python.org/issue37540
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/object.rst4
-rw-r--r--Doc/c-api/structures.rst1
-rw-r--r--Doc/library/dis.rst6
3 files changed, 7 insertions, 4 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index 2cf0328..fd1e9c6 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -400,8 +400,8 @@ Object Protocol
:c:func:`PyVectorcall_NARGS(nargsf) <PyVectorcall_NARGS>`.
*kwnames* can be either NULL (no keyword arguments) or a tuple of keyword
- names. In the latter case, the values of the keyword arguments are stored
- in *args* after the positional arguments.
+ names, which must be strings. In the latter case, the values of the keyword
+ arguments are stored in *args* after the positional arguments.
The number of keyword arguments does not influence *nargsf*.
*kwnames* must contain only objects of type ``str`` (not a subclass),
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 5184ad5..d4e65af 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -204,6 +204,7 @@ also keyword arguments. So there are a total of 6 calling conventions:
Keyword arguments are passed the same way as in the vectorcall protocol:
there is an additional fourth :c:type:`PyObject\*` parameter
which is a tuple representing the names of the keyword arguments
+ (which are guaranteed to be strings)
or possibly *NULL* if there are no keywords. The values of the keyword
arguments are stored in the *args* array, after the positional arguments.
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 39a3e13..4a20245 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -1142,8 +1142,10 @@ All of the following opcodes use their arguments.
Calls a callable object with positional (if any) and keyword arguments.
*argc* indicates the total number of positional and keyword arguments.
- The top element on the stack contains a tuple of keyword argument names.
- Below that are keyword arguments in the order corresponding to the tuple.
+ The top element on the stack contains a tuple with the names of the
+ keyword arguments, which must be strings.
+ Below that are the values for the keyword arguments,
+ in the order corresponding to the tuple.
Below that are positional arguments, with the right-most parameter on
top. Below the arguments is a callable object to call.
``CALL_FUNCTION_KW`` pops all arguments and the callable object off the stack,