mirror of https://github.com/python/cpython
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:
parent
a12eec48b6
commit
20a3007a8d
|
@ -5946,7 +5946,7 @@ SLOT0(slot_nb_absolute, "__abs__")
|
||||||
static int
|
static int
|
||||||
slot_nb_bool(PyObject *self)
|
slot_nb_bool(PyObject *self)
|
||||||
{
|
{
|
||||||
PyObject *func, *args, *value;
|
PyObject *func, *value;
|
||||||
int result;
|
int result;
|
||||||
int using_len = 0;
|
int using_len = 0;
|
||||||
_Py_IDENTIFIER(__bool__);
|
_Py_IDENTIFIER(__bool__);
|
||||||
|
@ -5967,13 +5967,7 @@ slot_nb_bool(PyObject *self)
|
||||||
using_len = 1;
|
using_len = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = PyTuple_New(0);
|
value = _PyObject_FastCall(func, NULL, 0, NULL);
|
||||||
if (args == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = PyObject_Call(func, args, NULL);
|
|
||||||
Py_DECREF(args);
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue