Skip to content

Commit 80b3d8f

Browse files
authored
gh-106023: Remove _PyObject_FastCallTstate() function (#106273)
1 parent f3cf2dd commit 80b3d8f

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

Doc/c-api/call.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,6 @@ function as with any other callable.
113113
:c:func:`PyObject_Vectorcall` will usually be most efficient.
114114

115115

116-
.. note::
117-
118-
In CPython 3.8, the vectorcall API and related functions were available
119-
provisionally under names with a leading underscore:
120-
``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``,
121-
``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``,
122-
``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``,
123-
``_PyObject_CallMethodOneArg``.
124-
Additionally, ``PyObject_VectorcallDict`` was available as
125-
``_PyObject_FastCallDict``.
126-
The old names are still defined as aliases of the new, non-underscored names.
127-
128-
129116
Recursion Control
130117
.................
131118

Include/internal/pycore_call.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ _PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg
117117

118118
/* === Vectorcall protocol (PEP 590) ============================= */
119119

120-
// Call callable using tp_call. Arguments are like PyObject_Vectorcall()
121-
// or PyObject_FastCallDict() (both forms are supported),
120+
// Call callable using tp_call. Arguments are like PyObject_Vectorcall(),
122121
// except that nargs is plainly the number of arguments without flags.
123122
//
124123
// Export for shared stdlib extensions like the math extension,
@@ -204,14 +203,6 @@ _PyObject_CallNoArgs(PyObject *func) {
204203
}
205204

206205

207-
static inline PyObject *
208-
_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func,
209-
PyObject *const *args, Py_ssize_t nargs)
210-
{
211-
EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_API, func);
212-
return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
213-
}
214-
215206
extern PyObject *const *
216207
_PyStack_UnpackDict(PyThreadState *tstate,
217208
PyObject *const *args, Py_ssize_t nargs,

Python/sysmodule.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -979,12 +979,6 @@ static PyObject *
979979
call_trampoline(PyThreadState *tstate, PyObject* callback,
980980
PyFrameObject *frame, int what, PyObject *arg)
981981
{
982-
983-
PyObject *stack[3];
984-
stack[0] = (PyObject *)frame;
985-
stack[1] = whatstrings[what];
986-
stack[2] = (arg != NULL) ? arg : Py_None;
987-
988982
/* Discard any previous modifications the frame's fast locals */
989983
if (frame->f_fast_as_locals) {
990984
if (PyFrame_FastToLocalsWithError(frame) < 0) {
@@ -993,7 +987,11 @@ call_trampoline(PyThreadState *tstate, PyObject* callback,
993987
}
994988

995989
/* call the Python-level function */
996-
PyObject *result = _PyObject_FastCallTstate(tstate, callback, stack, 3);
990+
if (arg == NULL) {
991+
arg = Py_None;
992+
}
993+
PyObject *args[3] = {(PyObject *)frame, whatstrings[what], arg};
994+
PyObject *result = _PyObject_VectorcallTstate(tstate, callback, args, 3, NULL);
997995

998996
PyFrame_LocalsToFast(frame, 1);
999997
return result;

0 commit comments

Comments
 (0)