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/Modules/_json.c b/Modules/_json.c
index a70043b..ee2070c 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -777,14 +777,14 @@
*next_idx_ptr = idx + 1;
if (has_pairs_hook) {
- val = _PyObject_CallOneArg(s->object_pairs_hook, rval);
+ val = PyObject_CallOneArg(s->object_pairs_hook, rval);
Py_DECREF(rval);
return val;
}
/* if object_hook is not None: rval = object_hook(rval) */
if (s->object_hook != Py_None) {
- val = _PyObject_CallOneArg(s->object_hook, rval);
+ val = PyObject_CallOneArg(s->object_hook, rval);
Py_DECREF(rval);
return val;
}
@@ -890,7 +890,7 @@
return NULL;
/* rval = parse_constant(constant) */
- rval = _PyObject_CallOneArg(s->parse_constant, cstr);
+ rval = PyObject_CallOneArg(s->parse_constant, cstr);
idx += PyUnicode_GET_LENGTH(cstr);
Py_DECREF(cstr);
*next_idx_ptr = idx;
@@ -989,7 +989,7 @@
idx - start);
if (numstr == NULL)
return NULL;
- rval = _PyObject_CallOneArg(custom_func, numstr);
+ rval = PyObject_CallOneArg(custom_func, numstr);
}
else {
Py_ssize_t i, n;
@@ -1399,7 +1399,7 @@
if (s->fast_encode) {
return s->fast_encode(NULL, obj);
}
- encoded = _PyObject_CallOneArg(s->encoder, obj);
+ encoded = PyObject_CallOneArg(s->encoder, obj);
if (encoded != NULL && !PyUnicode_Check(encoded)) {
PyErr_Format(PyExc_TypeError,
"encoder() must return a string, not %.80s",
@@ -1485,7 +1485,7 @@
return -1;
}
}
- newobj = _PyObject_CallOneArg(s->defaultfn, obj);
+ newobj = PyObject_CallOneArg(s->defaultfn, obj);
if (newobj == NULL) {
Py_XDECREF(ident);
return -1;