diff options
author | Sylvain <sylvain.desodt+github@gmail.com> | 2017-06-15 15:05:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-15 15:05:23 (GMT) |
commit | 96c7c0685045b739fdc5145018cddfd252155713 (patch) | |
tree | 8c99f9484c33d59c49b45146e50f7d6c7b08a4a7 /Python | |
parent | 8acb4cf2b3436652568d7a70228b166316181466 (diff) | |
download | cpython-96c7c0685045b739fdc5145018cddfd252155713.zip cpython-96c7c0685045b739fdc5145018cddfd252155713.tar.gz cpython-96c7c0685045b739fdc5145018cddfd252155713.tar.bz2 |
bpo-20627: Fix error message when keyword arguments are used (#2115)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f7690b1..d16b1b4 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", |