From: Victor Stinner Date: Fri, 19 Aug 2016 16:28:25 +0000 (+0200) Subject: slot_nb_bool() now uses fast call X-Git-Tag: v3.6.0b1~647 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20a3007a8de57c99713cae8849634f47689a8f19;p=python 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 --git a/Objects/typeobject.c b/Objects/typeobject.c index 46f944c804..4d259275b4 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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; }