PEP 637: Addnew slots to the C interface (#1750)

This commit is contained in:
Stefano Borini 2020-12-28 17:38:34 +00:00 committed by GitHub
parent a2269ff5b8
commit 23b9fffb1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -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
========================