From 889851ecc355cad3d79f5692a6dbd3ae3127647b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 22 Jul 2023 23:44:33 +0200 Subject: [PATCH] gh-106320: Remove _PyFunction_Vectorcall() API (#107071) Move _PyFunction_Vectorcall() API to the internal C API. No longer export the function. --- Include/cpython/funcobject.h | 6 ------ Include/internal/pycore_function.h | 6 ++++++ Objects/call.c | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Include/cpython/funcobject.h b/Include/cpython/funcobject.h index 6f78f5868d0..de2013323d2 100644 --- a/Include/cpython/funcobject.h +++ b/Include/cpython/funcobject.h @@ -79,12 +79,6 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( - PyObject *func, - PyObject *const *stack, - size_t nargsf, - PyObject *kwnames); - #define _PyFunction_CAST(func) \ (assert(PyFunction_Check(func)), _Py_CAST(PyFunctionObject*, func)) diff --git a/Include/internal/pycore_function.h b/Include/internal/pycore_function.h index ecbb7001e7d..e844d323ec7 100644 --- a/Include/internal/pycore_function.h +++ b/Include/internal/pycore_function.h @@ -8,6 +8,12 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif +extern PyObject* _PyFunction_Vectorcall( + PyObject *func, + PyObject *const *stack, + size_t nargsf, + PyObject *kwnames); + #define FUNC_MAX_WATCHERS 8 struct _py_func_state { diff --git a/Objects/call.c b/Objects/call.c index 396552d85cf..b1610dababd 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -2,6 +2,7 @@ #include "pycore_call.h" // _PyObject_CallNoArgsTstate() #include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate() #include "pycore_dict.h" // _PyDict_FromItems() +#include "pycore_function.h" // _PyFunction_Vectorcall() definition #include "pycore_modsupport.h" // _Py_VaBuildStack() #include "pycore_object.h" // _PyCFunctionWithKeywords_TrampolineCall() #include "pycore_pyerrors.h" // _PyErr_Occurred()