Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3ccaae

Browse files
committed
sys_pyfile_write_unicode() now uses fast call
Issue #27128.
1 parent 78da82b commit c3ccaae

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

Python/sysmodule.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
21122112
static int
21132113
sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
21142114
{
2115-
PyObject *writer = NULL, *args = NULL, *result = NULL;
2115+
PyObject *writer = NULL, *result = NULL;
21162116
int err;
21172117

21182118
if (file == NULL)
@@ -2122,11 +2122,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
21222122
if (writer == NULL)
21232123
goto error;
21242124

2125-
args = PyTuple_Pack(1, unicode);
2126-
if (args == NULL)
2127-
goto error;
2128-
2129-
result = PyEval_CallObject(writer, args);
2125+
result = _PyObject_FastCall(writer, &unicode, 1, NULL);
21302126
if (result == NULL) {
21312127
goto error;
21322128
} else {
@@ -2138,7 +2134,6 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
21382134
err = -1;
21392135
finally:
21402136
Py_XDECREF(writer);
2141-
Py_XDECREF(args);
21422137
Py_XDECREF(result);
21432138
return err;
21442139
}

0 commit comments

Comments
 (0)