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/_io/bufferedio.c b/Modules/_io/bufferedio.c
index ddd17a2..6f55577 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -461,7 +461,7 @@
buffered_simple_flush(buffered *self, PyObject *args)
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush);
}
static int
@@ -513,7 +513,7 @@
}
/* flush() will most probably re-take the lock, so drop it first */
LEAVE_BUFFERED(self)
- res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (!ENTER_BUFFERED(self))
return NULL;
if (res == NULL)
@@ -521,7 +521,7 @@
else
Py_DECREF(res);
- res = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close);
+ res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close);
if (self->buffer) {
PyMem_Free(self->buffer);
@@ -545,7 +545,7 @@
{
PyObject *raw, *res;
CHECK_INITIALIZED(self)
- res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL)
return NULL;
Py_DECREF(res);
@@ -562,21 +562,21 @@
buffered_seekable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable);
}
static PyObject *
buffered_readable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable);
}
static PyObject *
buffered_writable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable);
}
static PyObject *
@@ -599,14 +599,14 @@
buffered_fileno(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno);
}
static PyObject *
buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty);
}
/* Forward decls */
@@ -670,7 +670,7 @@
{
Py_off_t n;
PyObject *res;
- res = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell);
+ res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell);
if (res == NULL)
return -1;
n = PyNumber_AsOff_t(res, PyExc_ValueError);
@@ -1324,7 +1324,7 @@
goto end;
Py_CLEAR(res);
}
- res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos);
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos);
if (res == NULL)
goto end;
/* Reset cached position */
@@ -1351,7 +1351,7 @@
line = _buffered_readline(self, -1);
}
else {
- line = _PyObject_CallMethodNoArgs((PyObject *)self,
+ line = PyObject_CallMethodNoArgs((PyObject *)self,
_PyIO_str_readline);
if (line && !PyBytes_Check(line)) {
PyErr_Format(PyExc_OSError,
@@ -1470,7 +1470,7 @@
raised (see issue #10956).
*/
do {
- res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj);
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj);
} while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj);
if (res == NULL)
@@ -1569,7 +1569,7 @@
}
/* Read until EOF or until read() would block. */
- data = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read);
+ data = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read);
if (data == NULL)
goto cleanup;
if (data != Py_None && !PyBytes_Check(data)) {
@@ -1818,7 +1818,7 @@
*/
do {
errno = 0;
- res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj);
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj);
errnum = errno;
} while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj);