bpo-39245: Switch to public API for Vectorcall (GH-18460)
The bulk of this patch was generated automatically with:
for name in \
PyObject_Vectorcall \
Py_TPFLAGS_HAVE_VECTORCALL \
PyObject_VectorcallMethod \
PyVectorcall_Function \
PyObject_CallOneArg \
PyObject_CallMethodNoArgs \
PyObject_CallMethodOneArg \
;
do
echo $name
git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
done
old=_PyObject_FastCallDict
new=PyObject_VectorcallDict
git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"
and then cleaned up:
- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
diff --git a/Objects/call.c b/Objects/call.c
index d1d50b6..37d079d 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -95,7 +95,7 @@
{
assert(callable != NULL);
- /* _PyObject_FastCallDict() must not be called with an exception set,
+ /* PyObject_VectorcallDict() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
caller loses its exception */
assert(!_PyErr_Occurred(tstate));
@@ -105,7 +105,7 @@
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
- vectorcallfunc func = _PyVectorcall_Function(callable);
+ vectorcallfunc func = PyVectorcall_Function(callable);
if (func == NULL) {
/* Use tp_call instead */
return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwargs);
@@ -133,7 +133,7 @@
PyObject *
-_PyObject_FastCallDict(PyObject *callable, PyObject *const *args,
+PyObject_VectorcallDict(PyObject *callable, PyObject *const *args,
size_t nargsf, PyObject *kwargs)
{
PyThreadState *tstate = _PyThreadState_GET();
@@ -204,8 +204,8 @@
{
PyThreadState *tstate = _PyThreadState_GET();
- /* get vectorcallfunc as in _PyVectorcall_Function, but without
- * the _Py_TPFLAGS_HAVE_VECTORCALL check */
+ /* get vectorcallfunc as in PyVectorcall_Function, but without
+ * the Py_TPFLAGS_HAVE_VECTORCALL check */
Py_ssize_t offset = Py_TYPE(callable)->tp_vectorcall_offset;
if (offset <= 0) {
_PyErr_Format(tstate, PyExc_TypeError,
@@ -259,7 +259,7 @@
assert(PyTuple_Check(args));
assert(kwargs == NULL || PyDict_Check(kwargs));
- if (_PyVectorcall_Function(callable) != NULL) {
+ if (PyVectorcall_Function(callable) != NULL) {
return PyVectorcall_Call(callable, args, kwargs);
}
else {
@@ -796,7 +796,7 @@
PyObject *
-_PyObject_VectorcallMethod(PyObject *name, PyObject *const *args,
+PyObject_VectorcallMethod(PyObject *name, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{
assert(name != NULL);