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.
This commit is contained in:
Victor Stinner 2016-12-09 15:39:28 +01:00
parent 20401deae2
commit 61bdb0d319
5 changed files with 14 additions and 10 deletions

View file

@ -454,7 +454,8 @@ buffered_dealloc_warn(buffered *self, PyObject *source)
{
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