From 660076761180bac82ff7467926a4b1d41a50945f Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 20 Jan 2017 08:33:06 +0200 Subject: Issue #29327: Fixed a crash when pass the iterable keyword argument to sorted(). --- Python/bltinmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 69e5f08b0e..8acdfc3222 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2123,7 +2123,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *newlist, *v, *seq, *keyfunc=NULL, **newargs; PyObject *callable; - static char *kwlist[] = {"iterable", "key", "reverse", 0}; + static char *kwlist[] = {"", "key", "reverse", 0}; int reverse; Py_ssize_t nargs; @@ -2142,6 +2142,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds) return NULL; } + assert(PyTuple_GET_SIZE(args) >= 1); newargs = &PyTuple_GET_ITEM(args, 1); nargs = PyTuple_GET_SIZE(args) - 1; v = _PyObject_FastCallDict(callable, newargs, nargs, kwds); -- cgit v1.2.1