diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 22:44:04 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 22:44:04 (GMT) |
commit | 9def0901e23c6d655f28b7e5711874033b5ff5bd (patch) | |
tree | ae3c2d73d91bd5058692a4f37bc26ff3b1b10947 /Objects/fileobject.c | |
parent | 75210697ecb830b592bcb5d22503ddbb8401f3e8 (diff) | |
download | cpython-9def0901e23c6d655f28b7e5711874033b5ff5bd.zip cpython-9def0901e23c6d655f28b7e5711874033b5ff5bd.tar.gz cpython-9def0901e23c6d655f28b7e5711874033b5ff5bd.tar.bz2 |
PyFile_WriteObject() now uses fast call
Issue #27128: PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the
creation of a temporary tuple.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 234d07e..83348a8 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -127,7 +127,7 @@ PyFile_GetLine(PyObject *f, int n) 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 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags) 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) |