Use _PyObject_CallMethodIdObjArgs() in _io
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() when the format string was only made of "O"
formats, PyObject* arguments.
_PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and
doesn't have to parse a format string.
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 2b43fd8..cb4173e 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -454,7 +454,8 @@
{
if (self->ok && self->raw) {
PyObject *r;
- r = _PyObject_CallMethodId(self->raw, &PyId__dealloc_warn, "O", source);
+ r = _PyObject_CallMethodIdObjArgs(self->raw, &PyId__dealloc_warn,
+ source, NULL);
if (r)
Py_DECREF(r);
else