PyFile_WriteObject() now uses fast call
Issue #27128: PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the creation of a temporary tuple.
This commit is contained in:
parent
75210697ec
commit
9def0901e2
@ -127,7 +127,7 @@ PyFile_GetLine(PyObject *f, int n)
|
|||||||
int
|
int
|
||||||
PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
|
PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
|
||||||
{
|
{
|
||||||
PyObject *writer, *value, *args, *result;
|
PyObject *writer, *value, *result;
|
||||||
_Py_IDENTIFIER(write);
|
_Py_IDENTIFIER(write);
|
||||||
|
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
@ -146,14 +146,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
|
|||||||
Py_DECREF(writer);
|
Py_DECREF(writer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
args = PyTuple_Pack(1, value);
|
result = _PyObject_FastCall(writer, &value, 1, NULL);
|
||||||
if (args == NULL) {
|
|
||||||
Py_DECREF(value);
|
|
||||||
Py_DECREF(writer);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
result = PyEval_CallObject(writer, args);
|
|
||||||
Py_DECREF(args);
|
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
Py_DECREF(writer);
|
Py_DECREF(writer);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user