From 23b9fffb1f49216f77390192852d02930042f6f7 Mon Sep 17 00:00:00 2001 From: Stefano Borini Date: Mon, 28 Dec 2020 17:38:34 +0000 Subject: [PATCH] PEP 637: Addnew slots to the C interface (#1750) --- pep-0637.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pep-0637.rst b/pep-0637.rst index 390d25041..22c9a2056 100644 --- a/pep-0637.rst +++ b/pep-0637.rst @@ -606,7 +606,7 @@ need to be implemented to support the extended call. We propose - ``PyObject_SetItemWithKeywords(PyObject *o, PyObject *key, PyObject *value, PyObject *kwargs)`` - ``PyObject_GetItemWithKeywords(PyObject *o, PyObject *key, PyObject *kwargs)`` -Additionally, new opcodes will be needed for the enhanced call. Currently, the +New opcodes will be needed for the enhanced call. Currently, the implementation uses ``BINARY_SUBSCR``, ``STORE_SUBSCR`` and ``DELETE_SUBSCR`` to invoke the old functions. We propose ``BINARY_SUBSCR_KW``, ``STORE_SUBSCR_KW`` and ``DELETE_SUBSCR_KW`` for the new operations. The @@ -614,6 +614,15 @@ compiler will have to generate these new opcodes. The old C implementations will call the extended methods passing ``NULL`` as kwargs. +Finally, the following new slots must be added to the ``PyMappingMethods`` struct: + +- ``mp_subscript_kw`` +- ``mp_ass_subscript_kw`` + +These slots will have the appropriate signature to handle the dictionary object +containing the keywords. + + Reference Implementation ========================