summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-20 08:35:18 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-20 08:35:18 +0200
commit72be5decb1a4622433fe2250f7192ede3255619e (patch)
tree05d9234c0b5f25a40f7a25e5618de72967bd6b38 /Python
parent2f27d0db5885ac6c74221fbf4c57ae0910056b33 (diff)
parent660076761180bac82ff7467926a4b1d41a50945f (diff)
downloadcpython-72be5decb1a4622433fe2250f7192ede3255619e.tar.gz
Issue #29327: Fixed a crash when pass the iterable keyword argument to sorted().
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index ab029ce0aa..6df8af4733 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2128,7 +2128,7 @@ builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwna
{
PyObject *newlist, *v, *seq, *keyfunc=NULL;
PyObject *callable;
- static const char * const kwlist[] = {"iterable", "key", "reverse", 0};
+ static const char * const kwlist[] = {"", "key", "reverse", 0};
/* args 1-3 should match listsort in Objects/listobject.c */
static _PyArg_Parser parser = {"O|Oi:sorted", kwlist, 0};
int reverse;
@@ -2147,6 +2147,7 @@ builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwna
return NULL;
}
+ assert(nargs >= 1);
v = _PyObject_FastCallKeywords(callable, args + 1, nargs - 1, kwnames);
Py_DECREF(callable);
if (v == NULL) {