From 64e75861f12e137906b2fa6374ce1a70070977df Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 20 Aug 2016 00:44:04 +0200 Subject: PyFile_WriteObject() now uses fast call Issue #27128: PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the creation of a temporary tuple. --- Objects/fileobject.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'Objects/fileobject.c') diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 234d07e5c6..83348a8ee3 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) -- cgit v1.2.1 From de03c6d8066496680a1ea99ff9e67e28852b0007 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 22 Aug 2016 22:48:54 +0200 Subject: Rename _PyObject_FastCall() to _PyObject_FastCallDict() Issue #27809: * Rename _PyObject_FastCall() function to _PyObject_FastCallDict() * Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1() macros calling _PyObject_FastCallDict() --- Objects/fileobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Objects/fileobject.c') diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 83348a8ee3..f4424184d2 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -146,7 +146,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags) Py_DECREF(writer); return -1; } - result = _PyObject_FastCall(writer, &value, 1, NULL); + result = _PyObject_CallArg1(writer, value); Py_DECREF(value); Py_DECREF(writer); if (result == NULL) -- cgit v1.2.1