cpython: 71c22e592a9b (original) (raw)

Mercurial > cpython

changeset 102780:71c22e592a9b

keyobject_richcompare() now uses fast call Issue #27128: keyobject_richcompare() now calls _PyObject_FastCall() using a small stack allocated on the C stack to avoid a temporary tuple. [#27128]

Victor Stinner victor.stinner@gmail.com
date Fri, 19 Aug 2016 18:52:35 +0200
parents 124d5d0ef81f
children 3ab32f7add6e
files Modules/_functoolsmodule.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-)[+] [-] Modules/_functoolsmodule.c 18

line wrap: on

line diff

--- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -461,12 +461,12 @@ static PyObject * keyobject_richcompare(PyObject *ko, PyObject *other, int op) { PyObject *res;

if (zero == NULL) { zero = PyLong_FromLong(0); @@ -490,17 +490,13 @@ keyobject_richcompare(PyObject ko, PyOb / Call the user's comparison function and translate the 3-way * result into true or false (or error). */

+ answer = PyObject_RichCompare(res, zero, op); Py_DECREF(res); return answer;