diff options
author | Guido van Rossum <guido@python.org> | 1990-10-30 13:32:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1990-10-30 13:32:20 (GMT) |
commit | 84c76f52afdd0c6a85ba386327bdbbdf93449f87 (patch) | |
tree | 349522e0a330776e60fec44b1412a5b735b38854 /Objects/listobject.c | |
parent | 726749cc5b98364f0e9f8b26c38b84df11513be6 (diff) | |
download | cpython-84c76f52afdd0c6a85ba386327bdbbdf93449f87.zip cpython-84c76f52afdd0c6a85ba386327bdbbdf93449f87.tar.gz cpython-84c76f52afdd0c6a85ba386327bdbbdf93449f87.tar.bz2 |
Added external interface to sort a list.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index b02a661..97088c5 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -453,6 +453,21 @@ listsort(self, args) return None; } +int +sortlist(v) + object *v; +{ + if (v == NULL || !is_listobject(v)) { + err_badcall(); + return -1; + } + v = listsort((listobject *)v, (object *)NULL); + if (v == NULL) + return -1; + DECREF(v); + return 0; +} + static struct methodlist list_methods[] = { {"append", listappend}, {"insert", listinsert}, |