Skip to content

Commit fda6d0a

Browse files
committed
next() uses FASTCALL
1 parent 84b388b commit fda6d0a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

Python/bltinmodule.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,13 +1303,19 @@ PyTypeObject PyMap_Type = {
13031303

13041304
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
13051305
static PyObject *
1306-
builtin_next(PyObject *self, PyObject *args)
1306+
builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs,
1307+
PyObject *kwnames)
13071308
{
13081309
PyObject *it, *res;
13091310
PyObject *def = NULL;
13101311

1311-
if (!PyArg_UnpackTuple(args, "next", 1, 2, &it, &def))
1312+
if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def))
13121313
return NULL;
1314+
1315+
if (!_PyArg_NoStackKeywords("next", kwnames)) {
1316+
return NULL;
1317+
}
1318+
13131319
if (!PyIter_Check(it)) {
13141320
PyErr_Format(PyExc_TypeError,
13151321
"'%.200s' object is not an iterator",
@@ -2641,7 +2647,7 @@ static PyMethodDef builtin_methods[] = {
26412647
BUILTIN_LOCALS_METHODDEF
26422648
{"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc},
26432649
{"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc},
2644-
{"next", (PyCFunction)builtin_next, METH_VARARGS, next_doc},
2650+
{"next", (PyCFunction)builtin_next, METH_FASTCALL, next_doc},
26452651
BUILTIN_OCT_METHODDEF
26462652
BUILTIN_ORD_METHODDEF
26472653
BUILTIN_POW_METHODDEF

0 commit comments

Comments
 (0)