Description
Hi,
In 2017, I added a new experimental FASTCALL calling convention. See my articles about it: The start of the FASTCALL project and FASTCALL microbenchmarks. It avoids the need to create a temporary tuple to pass positional arguments and the need to create a temporary dictionary to pass keyword arguments. I did my best to keep this API private. I added functions prefixed with _Py
: _PyObject_Fastcall()
. Cython is eager to always use the fastest code and quickly adopted this new METH_FASTCALL
calling convention... oops, I forgot to add a _Py
prefix since these METH
constants don't start with Py
.
In 2019, this calling convention was extended to support also method calls (pass the self
argument): PEP 590 – Vectorcall: a fast calling protocol for CPython. This new API is public and standardized. For example, it added public PyVectorcall_Function()
and PyObject_Vectorcall()
functions.
In 2023, the FASTCALL API is still around in the public C API:
- METH_FASTCALL
- _PyObject_FastCall()
- _PyObject_FastCallTstate()
- _PyObject_FastCallDict()
- _PyObject_FastCallDictTstate()
- _PyStack_AsDict()
- _PY_FASTCALL_SMALL_STACK
Can it be deprecated? Removed? I suppose that if we are in the unknown, the safe option is to start by deprecating it in Python 3.13 and plan its removal in Python 3.15.
cc @encukou
Victor
Linked PRs
- gh-106023: Update code using _PyObject_FastCall() #106257
- gh-106023: Remove _PY_FASTCALL_SMALL_STACK constant #106258
- gh-106023: Rename _PyObject_FastCallDictTstate() #106264
- gh-106023: Remove _PyObject_FastCall() function #106265
- gh-106023: Remove _PyObject_FastCallTstate() function #106273
- gh-106023: Update What's New in 3.13: _PyObject_FastCall() #117633
- Revert "gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)" #117676