Kaydet (Commit) c3ccaae6 authored tarafından Victor Stinner's avatar Victor Stinner

sys_pyfile_write_unicode() now uses fast call

Issue #27128.
üst 78da82bf
...@@ -2112,7 +2112,7 @@ PySys_SetArgv(int argc, wchar_t **argv) ...@@ -2112,7 +2112,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
static int static int
sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
{ {
PyObject *writer = NULL, *args = NULL, *result = NULL; PyObject *writer = NULL, *result = NULL;
int err; int err;
if (file == NULL) if (file == NULL)
...@@ -2122,11 +2122,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) ...@@ -2122,11 +2122,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
if (writer == NULL) if (writer == NULL)
goto error; goto error;
args = PyTuple_Pack(1, unicode); result = _PyObject_FastCall(writer, &unicode, 1, NULL);
if (args == NULL)
goto error;
result = PyEval_CallObject(writer, args);
if (result == NULL) { if (result == NULL) {
goto error; goto error;
} else { } else {
...@@ -2138,7 +2134,6 @@ error: ...@@ -2138,7 +2134,6 @@ error:
err = -1; err = -1;
finally: finally:
Py_XDECREF(writer); Py_XDECREF(writer);
Py_XDECREF(args);
Py_XDECREF(result); Py_XDECREF(result);
return err; return err;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment