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

@ -661,7 +661,8 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint)
to remove the bytecode interpretation overhead, but it could
probably be removed here. */
_Py_IDENTIFIER(extend);
PyObject *ret = _PyObject_CallMethodId(result, &PyId_extend, "O", self);
PyObject *ret = _PyObject_CallMethodIdObjArgs(result, &PyId_extend,
self, NULL);
if (ret == NULL) {
Py_DECREF(result);