mirror of https://github.com/python/cpython
bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)
This commit is contained in:
parent
f707d94af6
commit
c98f87fc33
|
@ -713,9 +713,9 @@ tuple_vectorcall(PyObject *type, PyObject * const*args,
|
||||||
PyErr_Format(PyExc_TypeError, "tuple() takes no keyword arguments");
|
PyErr_Format(PyExc_TypeError, "tuple() takes no keyword arguments");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
||||||
if (nargs > 1) {
|
if (!_PyArg_CheckPositional("tuple", nargs, 0, 1)) {
|
||||||
PyErr_Format(PyExc_TypeError, "tuple() expected at most 1 argument, got %zd", nargs);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue