Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Include/cpython/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ _PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
{
assert(kwnames == NULL || PyTuple_Check(kwnames));
assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0);
vectorcallfunc func = _PyVectorcall_Function(callable);
if (func == NULL) {
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
return _PyObject_MakeTpCall(callable, args, nargs, kwnames);
PyTypeObject *tp = Py_TYPE(callable);
if (PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) {
assert(PyCallable_Check(callable));
Py_ssize_t offset = tp->tp_vectorcall_offset;
assert(offset > 0);
vectorcallfunc func = *((vectorcallfunc *)(((char *)callable) + offset));
if (func != NULL) {
PyObject *res = func(callable, args, nargsf, kwnames);
return _Py_CheckFunctionResult(callable, res, NULL);
}
}
PyObject *res = func(callable, args, nargsf, kwnames);
return _Py_CheckFunctionResult(callable, res, NULL);
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
return _PyObject_MakeTpCall(callable, args, nargs, kwnames);
}

/* Same as _PyObject_Vectorcall except that keyword arguments are passed as
Expand Down