mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-106023: Remove _PyObject_FastCallTstate() function (#106273)
This commit is contained in:
parent
f3cf2ddd8d
commit
80b3d8f337
3 changed files with 6 additions and 30 deletions
|
@ -113,19 +113,6 @@ function as with any other callable.
|
||||||
:c:func:`PyObject_Vectorcall` will usually be most efficient.
|
:c:func:`PyObject_Vectorcall` will usually be most efficient.
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
In CPython 3.8, the vectorcall API and related functions were available
|
|
||||||
provisionally under names with a leading underscore:
|
|
||||||
``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``,
|
|
||||||
``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``,
|
|
||||||
``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``,
|
|
||||||
``_PyObject_CallMethodOneArg``.
|
|
||||||
Additionally, ``PyObject_VectorcallDict`` was available as
|
|
||||||
``_PyObject_FastCallDict``.
|
|
||||||
The old names are still defined as aliases of the new, non-underscored names.
|
|
||||||
|
|
||||||
|
|
||||||
Recursion Control
|
Recursion Control
|
||||||
.................
|
.................
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,7 @@ _PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg
|
||||||
|
|
||||||
/* === Vectorcall protocol (PEP 590) ============================= */
|
/* === Vectorcall protocol (PEP 590) ============================= */
|
||||||
|
|
||||||
// Call callable using tp_call. Arguments are like PyObject_Vectorcall()
|
// Call callable using tp_call. Arguments are like PyObject_Vectorcall(),
|
||||||
// or PyObject_FastCallDict() (both forms are supported),
|
|
||||||
// except that nargs is plainly the number of arguments without flags.
|
// except that nargs is plainly the number of arguments without flags.
|
||||||
//
|
//
|
||||||
// Export for shared stdlib extensions like the math extension,
|
// Export for shared stdlib extensions like the math extension,
|
||||||
|
@ -204,14 +203,6 @@ _PyObject_CallNoArgs(PyObject *func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline PyObject *
|
|
||||||
_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func,
|
|
||||||
PyObject *const *args, Py_ssize_t nargs)
|
|
||||||
{
|
|
||||||
EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_API, func);
|
|
||||||
return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern PyObject *const *
|
extern PyObject *const *
|
||||||
_PyStack_UnpackDict(PyThreadState *tstate,
|
_PyStack_UnpackDict(PyThreadState *tstate,
|
||||||
PyObject *const *args, Py_ssize_t nargs,
|
PyObject *const *args, Py_ssize_t nargs,
|
||||||
|
|
|
@ -979,12 +979,6 @@ static PyObject *
|
||||||
call_trampoline(PyThreadState *tstate, PyObject* callback,
|
call_trampoline(PyThreadState *tstate, PyObject* callback,
|
||||||
PyFrameObject *frame, int what, PyObject *arg)
|
PyFrameObject *frame, int what, PyObject *arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
PyObject *stack[3];
|
|
||||||
stack[0] = (PyObject *)frame;
|
|
||||||
stack[1] = whatstrings[what];
|
|
||||||
stack[2] = (arg != NULL) ? arg : Py_None;
|
|
||||||
|
|
||||||
/* Discard any previous modifications the frame's fast locals */
|
/* Discard any previous modifications the frame's fast locals */
|
||||||
if (frame->f_fast_as_locals) {
|
if (frame->f_fast_as_locals) {
|
||||||
if (PyFrame_FastToLocalsWithError(frame) < 0) {
|
if (PyFrame_FastToLocalsWithError(frame) < 0) {
|
||||||
|
@ -993,7 +987,11 @@ call_trampoline(PyThreadState *tstate, PyObject* callback,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call the Python-level function */
|
/* call the Python-level function */
|
||||||
PyObject *result = _PyObject_FastCallTstate(tstate, callback, stack, 3);
|
if (arg == NULL) {
|
||||||
|
arg = Py_None;
|
||||||
|
}
|
||||||
|
PyObject *args[3] = {(PyObject *)frame, whatstrings[what], arg};
|
||||||
|
PyObject *result = _PyObject_VectorcallTstate(tstate, callback, args, 3, NULL);
|
||||||
|
|
||||||
PyFrame_LocalsToFast(frame, 1);
|
PyFrame_LocalsToFast(frame, 1);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue