diff options
author | Wenzel Jakob <wenzel.jakob@epfl.ch> | 2022-10-27 09:45:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 09:45:42 (GMT) |
commit | e60892f9db1316dbabf7a652d7648e4f968b745d (patch) | |
tree | f3e6c05f67907d2778241c17425ce88a88c407cc /Include | |
parent | d578aaea6257458c199328100cbb5af64c6a043e (diff) | |
download | cpython-e60892f9db1316dbabf7a652d7648e4f968b745d.zip cpython-e60892f9db1316dbabf7a652d7648e4f968b745d.tar.gz cpython-e60892f9db1316dbabf7a652d7648e4f968b745d.tar.bz2 |
gh-98586: Add vector call APIs to the Limited API (GH-98587)
Expose the facilities for making vector calls through Python's limited API.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/abstract.h | 16 | ||||
-rw-r--r-- | Include/cpython/abstract.h | 13 |
2 files changed, 16 insertions, 13 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 784ff7e..064b030 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -238,6 +238,22 @@ PyAPI_FUNC(Py_ssize_t) PyVectorcall_NARGS(size_t nargsf); "tuple" and keyword arguments "dict". "dict" may also be NULL */ PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000 +#define PY_VECTORCALL_ARGUMENTS_OFFSET \ + (_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1)) + +/* Perform a PEP 590-style vector call on 'callable' */ +PyAPI_FUNC(PyObject *) PyObject_Vectorcall( + PyObject *callable, + PyObject *const *args, + size_t nargsf, + PyObject *kwnames); + +/* Call the method 'name' on args[0] with arguments in args[1..nargsf-1]. */ +PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod( + PyObject *name, PyObject *const *args, + size_t nargsf, PyObject *kwnames); +#endif /* Implemented elsewhere: diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h index 6da29cde..3b27aab 100644 --- a/Include/cpython/abstract.h +++ b/Include/cpython/abstract.h @@ -50,9 +50,6 @@ PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall( PyObject *const *args, Py_ssize_t nargs, PyObject *keywords); -#define PY_VECTORCALL_ARGUMENTS_OFFSET \ - (_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1)) - // PyVectorcall_NARGS() is exported as a function for the stable ABI. // Here (when we are not using the stable ABI), the name is overridden to // call a static inline function for best performance. @@ -65,12 +62,6 @@ _PyVectorcall_NARGS(size_t n) PyAPI_FUNC(vectorcallfunc) PyVectorcall_Function(PyObject *callable); -PyAPI_FUNC(PyObject *) PyObject_Vectorcall( - PyObject *callable, - PyObject *const *args, - size_t nargsf, - PyObject *kwnames); - // Backwards compatibility aliases for API that was provisional in Python 3.8 #define _PyObject_Vectorcall PyObject_Vectorcall #define _PyObject_VectorcallMethod PyObject_VectorcallMethod @@ -96,10 +87,6 @@ PyAPI_FUNC(PyObject *) _PyObject_FastCall( PyAPI_FUNC(PyObject *) PyObject_CallOneArg(PyObject *func, PyObject *arg); -PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod( - PyObject *name, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - static inline PyObject * PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) { |