]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)
authorDong-hee Na <donghee.na92@gmail.com>
Mon, 16 Mar 2020 14:04:14 +0000 (23:04 +0900)
committerGitHub <noreply@github.com>
Mon, 16 Mar 2020 14:04:14 +0000 (15:04 +0100)
Objects/tupleobject.c

index 839667ad6f1730c6d123cbd95d9e0ce1e7d5b831..d4165dec17a000736c7aa4e4eb7f56e0ae35a5d9 100644 (file)
@@ -713,9 +713,9 @@ tuple_vectorcall(PyObject *type, PyObject * const*args,
         PyErr_Format(PyExc_TypeError, "tuple() takes no keyword arguments");
         return NULL;
     }
+
     Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
-    if (nargs > 1) {
-        PyErr_Format(PyExc_TypeError, "tuple() expected at most 1 argument, got %zd", nargs);
+    if (!_PyArg_CheckPositional("tuple", nargs, 0, 1)) {
         return NULL;
     }