diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 16:28:25 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 16:28:25 (GMT) |
commit | 20a3007a8de57c99713cae8849634f47689a8f19 (patch) | |
tree | 251340eb295eb7ed2551c1e574b3df529fce5cc8 | |
parent | a12eec48b6b30d446bd1a9461bb5b948c9d167fe (diff) | |
download | cpython-20a3007a8de57c99713cae8849634f47689a8f19.zip cpython-20a3007a8de57c99713cae8849634f47689a8f19.tar.gz cpython-20a3007a8de57c99713cae8849634f47689a8f19.tar.bz2 |
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.
-rw-r--r-- | Objects/typeobject.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 46f944c..4d25927 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; } |