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/descrobject.c b/Objects/descrobject.c
index 49c26eb..aaaa447 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -454,7 +454,7 @@
if (bound == NULL) {
return NULL;
}
- PyObject *res = _PyObject_FastCallDict(bound, _PyTuple_ITEMS(args)+1,
+ PyObject *res = PyObject_VectorcallDict(bound, _PyTuple_ITEMS(args)+1,
argc-1, kwds);
Py_DECREF(bound);
return res;
@@ -673,7 +673,7 @@
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
- _Py_TPFLAGS_HAVE_VECTORCALL |
+ Py_TPFLAGS_HAVE_VECTORCALL |
Py_TPFLAGS_METHOD_DESCRIPTOR, /* tp_flags */
0, /* tp_doc */
descr_traverse, /* tp_traverse */
@@ -1493,7 +1493,7 @@
return NULL;
}
- return _PyObject_CallOneArg(gs->prop_get, obj);
+ return PyObject_CallOneArg(gs->prop_get, obj);
}
static int
@@ -1514,7 +1514,7 @@
return -1;
}
if (value == NULL)
- res = _PyObject_CallOneArg(func, obj);
+ res = PyObject_CallOneArg(func, obj);
else
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
if (res == NULL)