bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)

This commit is contained in:
Dong-hee Na 2020-03-16 23:06:20 +09:00 committed by GitHub
parent c98f87fc33
commit 87ec86c425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 5 deletions

View file

@ -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);