Skip to content

Commit a243517

Browse files
committed
Move tuple to AC vectorcall
1 parent 15f74e8 commit a243517

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

Objects/clinic/tupleobject.c.h

Lines changed: 29 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/tupleobject.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ static PyObject *
713713
tuple_subtype_new(PyTypeObject *type, PyObject *iterable);
714714

715715
/*[clinic input]
716+
@vectorcall zero_arg=(PyObject*)&_Py_SINGLETON(tuple_empty)
716717
@classmethod
717718
tuple.__new__ as tuple_new
718719
iterable: object(c_default="NULL") = ()
@@ -728,7 +729,7 @@ If the argument is a tuple, the return value is the same object.
728729

729730
static PyObject *
730731
tuple_new_impl(PyTypeObject *type, PyObject *iterable)
731-
/*[clinic end generated code: output=4546d9f0d469bce7 input=86963bcde633b5a2]*/
732+
/*[clinic end generated code: output=4546d9f0d469bce7 input=fff66d7a13734d92]*/
732733
{
733734
if (type != &PyTuple_Type)
734735
return tuple_subtype_new(type, iterable);
@@ -741,27 +742,6 @@ tuple_new_impl(PyTypeObject *type, PyObject *iterable)
741742
}
742743
}
743744

744-
static PyObject *
745-
tuple_vectorcall(PyObject *type, PyObject * const*args,
746-
size_t nargsf, PyObject *kwnames)
747-
{
748-
if (!_PyArg_NoKwnames("tuple", kwnames)) {
749-
return NULL;
750-
}
751-
752-
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
753-
if (!_PyArg_CheckPositional("tuple", nargs, 0, 1)) {
754-
return NULL;
755-
}
756-
757-
if (nargs) {
758-
return tuple_new_impl(_PyType_CAST(type), args[0]);
759-
}
760-
else {
761-
return tuple_get_empty();
762-
}
763-
}
764-
765745
static PyObject *
766746
tuple_subtype_new(PyTypeObject *type, PyObject *iterable)
767747
{

0 commit comments

Comments
 (0)