(original) (raw)

changeset: 102777:6a21b6599692 user: Victor Stinner victor.stinner@gmail.com date: Fri Aug 19 18:28:25 2016 +0200 files: Objects/typeobject.c description: 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. diff -r 605a42a50496 -r 6a21b6599692 Objects/typeobject.c --- a/Objects/typeobject.c Fri Aug 19 18:26:05 2016 +0200 +++ b/Objects/typeobject.c Fri Aug 19 18:28:25 2016 +0200 @@ -5946,7 +5946,7 @@ 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 @@ 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; } /victor.stinner@gmail.com