changeset: 102782:c2af917bde71 user: Victor Stinner date: Sat Aug 20 00:44:04 2016 +0200 files: Objects/fileobject.c description: PyFile_WriteObject() now uses fast call Issue #27128: PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the creation of a temporary tuple. diff -r 3ab32f7add6e -r c2af917bde71 Objects/fileobject.c --- a/Objects/fileobject.c Fri Aug 19 18:59:15 2016 +0200 +++ b/Objects/fileobject.c Sat Aug 20 00:44:04 2016 +0200 @@ -127,7 +127,7 @@ int PyFile_WriteObject(PyObject *v, PyObject *f, int flags) { - PyObject *writer, *value, *args, *result; + PyObject *writer, *value, *result; _Py_IDENTIFIER(write); if (f == NULL) { @@ -146,14 +146,7 @@ Py_DECREF(writer); return -1; } - args = PyTuple_Pack(1, value); - if (args == NULL) { - Py_DECREF(value); - Py_DECREF(writer); - return -1; - } - result = PyEval_CallObject(writer, args); - Py_DECREF(args); + result = _PyObject_FastCall(writer, &value, 1, NULL); Py_DECREF(value); Py_DECREF(writer); if (result == NULL)