From 96c7c0685045b739fdc5145018cddfd252155713 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 15 Jun 2017 17:05:23 +0200 Subject: bpo-20627: Fix error message when keyword arguments are used (#2115) --- Python/bltinmodule.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f7690b17ff..d16b1b4407 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -997,13 +997,13 @@ builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *v, *result, *dflt = NULL; PyObject *name; - if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt)) - return NULL; - if (!_PyArg_NoStackKeywords("getattr", kwnames)) { return NULL; } + if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt)) + return NULL; + if (!PyUnicode_Check(name)) { PyErr_SetString(PyExc_TypeError, "getattr(): attribute name must be string"); @@ -1307,13 +1307,13 @@ builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *it, *res; PyObject *def = NULL; - if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def)) - return NULL; - if (!_PyArg_NoStackKeywords("next", kwnames)) { return NULL; } + if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def)) + return NULL; + if (!PyIter_Check(it)) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not an iterator", -- cgit v1.2.1