diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-03-16 14:06:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 14:06:20 (GMT) |
commit | 87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b (patch) | |
tree | 8c51144ad1a0b7c88c29e63f1063537096c6c15b /Objects | |
parent | c98f87fc330eb40fbcff627dfc50958785a44f35 (diff) | |
download | cpython-87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b.zip cpython-87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b.tar.gz cpython-87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b.tar.bz2 |
bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/rangeobject.c | 3 | ||||
-rw-r--r-- | Objects/tupleobject.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 123ca0b..5bd178b 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -146,8 +146,7 @@ range_vectorcall(PyTypeObject *type, PyObject *const *args, size_t nargsf, PyObject *kwnames) { Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); - if (kwnames && PyTuple_GET_SIZE(kwnames) != 0) { - PyErr_Format(PyExc_TypeError, "range() takes no keyword arguments"); + if (!_PyArg_NoKwnames("range", kwnames)) { return NULL; } return range_from_array(type, args, nargs); diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index d4165de..8a8c6ae 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -709,8 +709,7 @@ static PyObject * tuple_vectorcall(PyObject *type, PyObject * const*args, size_t nargsf, PyObject *kwnames) { - if (kwnames && PyTuple_GET_SIZE(kwnames) != 0) { - PyErr_Format(PyExc_TypeError, "tuple() takes no keyword arguments"); + if (!_PyArg_NoKwnames("tuple", kwnames)) { return NULL; } |