diff options
-rw-r--r-- | Objects/listobject.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 77349bb8f7..36aa7f3a66 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -756,7 +756,8 @@ listpop(PyListObject *self, PyObject *args) static int docompare(PyObject *x, PyObject *y, PyObject *compare) { - PyObject *args, *res; + PyObject *res; + PyObject *args; int i; if (compare == NULL) { @@ -772,9 +773,13 @@ docompare(PyObject *x, PyObject *y, PyObject *compare) return -i; } - args = Py_BuildValue("(OO)", x, y); + args = PyTuple_New(2); if (args == NULL) return CMPERROR; + Py_INCREF(x); + Py_INCREF(y); + PyTuple_SET_ITEM(args, 0, x); + PyTuple_SET_ITEM(args, 1, y); res = PyEval_CallObject(compare, args); Py_DECREF(args); if (res == NULL) |