From 74542bdfcc22e96ec6675b9f3565b1b527a9ceb6 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 14 Mar 2020 17:25:41 +0900 Subject: [PATCH] bpo-37207: Use _PyArg_CheckPositional for tuple vectorcall --- Objects/tupleobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 14ab53fca22705..1683791dc0d2c7 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -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; }