diff options
author | Skip Montanaro <skip@pobox.com> | 2003-01-02 20:51:08 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2003-01-02 20:51:08 (GMT) |
commit | 4abd5f0fce54d32fbe01207e505047bd82ff9ca3 (patch) | |
tree | 7c94a45859968c9e92cf2c5970ee2d4071a9b7a8 /Objects/listobject.c | |
parent | fe8496ca03e93b74fe007de50f0e05347a772a60 (diff) | |
download | cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.zip cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.tar.gz cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.tar.bz2 |
Allow list sort's comparison function to explicitly be None. See SF patch
661092.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 461350c..79403cc 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1657,6 +1657,9 @@ listsort(PyListObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "sort", 0, 1, &compare)) return NULL; } + if (compare == Py_None) + compare = NULL; + merge_init(&ms, compare); /* The list is temporarily made empty, so that mutations performed @@ -2069,7 +2072,7 @@ PyDoc_STRVAR(count_doc, PyDoc_STRVAR(reverse_doc, "L.reverse() -- reverse *IN PLACE*"); PyDoc_STRVAR(sort_doc, -"L.sort([cmpfunc]) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1"); +"L.sort(cmpfunc=None) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1"); static PyMethodDef list_methods[] = { {"append", (PyCFunction)listappend, METH_O, append_doc}, |