[Python-checkins] cpython: sys_pyfile_write_unicode() now uses fast call

victor.stinner python-checkins at python.org
Fri Aug 19 19:50:39 EDT 2016


https://hg.python.org/cpython/rev/351b987d6d1c
changeset:   102786:351b987d6d1c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Aug 20 01:24:22 2016 +0200
summary:
  sys_pyfile_write_unicode() now uses fast call

Issue #27128.

files:
  Python/sysmodule.c |  9 ++-------
  1 files changed, 2 insertions(+), 7 deletions(-)


diff --git a/Python/sysmodule.c b/Python/sysmodule.c
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -2112,7 +2112,7 @@
 static int
 sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
 {
-    PyObject *writer = NULL, *args = NULL, *result = NULL;
+    PyObject *writer = NULL, *result = NULL;
     int err;
 
     if (file == NULL)
@@ -2122,11 +2122,7 @@
     if (writer == NULL)
         goto error;
 
-    args = PyTuple_Pack(1, unicode);
-    if (args == NULL)
-        goto error;
-
-    result = PyEval_CallObject(writer, args);
+    result = _PyObject_FastCall(writer, &unicode, 1, NULL);
     if (result == NULL) {
         goto error;
     } else {
@@ -2138,7 +2134,6 @@
     err = -1;
 finally:
     Py_XDECREF(writer);
-    Py_XDECREF(args);
     Py_XDECREF(result);
     return err;
 }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list