slot_nb_bool() now uses fast call

Issue #27128: slot_nb_bool() now calls _PyObject_FastCall() to avoid a
temporary empty tuple to call the slot function.
This commit is contained in:
Victor Stinner 2016-08-19 18:28:25 +02:00
parent a12eec48b6
commit 20a3007a8d
1 changed files with 2 additions and 8 deletions

View File

@ -5946,7 +5946,7 @@ SLOT0(slot_nb_absolute, "__abs__")
static int
slot_nb_bool(PyObject *self)
{
PyObject *func, *args, *value;
PyObject *func, *value;
int result;
int using_len = 0;
_Py_IDENTIFIER(__bool__);
@ -5967,13 +5967,7 @@ slot_nb_bool(PyObject *self)
using_len = 1;
}
args = PyTuple_New(0);
if (args == NULL) {
goto error;
}
value = PyObject_Call(func, args, NULL);
Py_DECREF(args);
value = _PyObject_FastCall(func, NULL, 0, NULL);
if (value == NULL) {
goto error;
}