Replace PyObject_CallFunction() with fastcall

Replace
    PyObject_CallFunction(func, "O", arg)
and
    PyObject_CallFunction(func, "O", arg, NULL)
with
    _PyObject_CallArg1(func, arg)

Replace
    PyObject_CallFunction(func, NULL)
with
    _PyObject_CallNoArg(func)

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This commit is contained in:
Victor Stinner 2016-12-01 14:51:04 +01:00
parent 842cfff321
commit 4778eab1f2
8 changed files with 13 additions and 13 deletions

View file

@ -476,7 +476,7 @@ warn_explicit(PyObject *category, PyObject *message,
}
else {
text = message;
message = PyObject_CallFunction(category, "O", message);
message = _PyObject_CallArg1(category, message);
if (message == NULL)
goto cleanup;
}