summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-01-02 20:51:08 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-01-02 20:51:08 (GMT)
commit4abd5f0fce54d32fbe01207e505047bd82ff9ca3 (patch)
tree7c94a45859968c9e92cf2c5970ee2d4071a9b7a8 /Objects/listobject.c
parentfe8496ca03e93b74fe007de50f0e05347a772a60 (diff)
downloadcpython-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.c5
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},