[Python-checkins] bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)

Dong-hee Na webhook-mailer at python.org
Mon Mar 16 10:04:26 EDT 2020


https://github.com/python/cpython/commit/c98f87fc330eb40fbcff627dfc50958785a44f35
commit: c98f87fc330eb40fbcff627dfc50958785a44f35
branch: master
author: Dong-hee Na <donghee.na92 at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-03-16T15:04:14+01:00
summary:

bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)

files:
M Objects/tupleobject.c

diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 839667ad6f173..d4165dec17a00 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;
     }
 



More information about the Python-checkins mailing list