summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-17 03:09:14 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-01-17 03:09:14 (GMT)
commitfda6d0acf0cb8e683640e6a3a404a371cb68b145 (patch)
tree5bcf40da86e0604b8256376a5f89f64f2171f517 /Python
parent84b388bb809b186b9ccef90da817f22872f9578e (diff)
downloadcpython-fda6d0acf0cb8e683640e6a3a404a371cb68b145.zip
cpython-fda6d0acf0cb8e683640e6a3a404a371cb68b145.tar.gz
cpython-fda6d0acf0cb8e683640e6a3a404a371cb68b145.tar.bz2
next() uses FASTCALL
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index b269937..9487a53 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1303,13 +1303,19 @@ PyTypeObject PyMap_Type = {
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
-builtin_next(PyObject *self, PyObject *args)
+builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs,
+ PyObject *kwnames)
{
PyObject *it, *res;
PyObject *def = NULL;
- if (!PyArg_UnpackTuple(args, "next", 1, 2, &it, &def))
+ if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def))
return NULL;
+
+ if (!_PyArg_NoStackKeywords("next", kwnames)) {
+ return NULL;
+ }
+
if (!PyIter_Check(it)) {
PyErr_Format(PyExc_TypeError,
"'%.200s' object is not an iterator",
@@ -2641,7 +2647,7 @@ static PyMethodDef builtin_methods[] = {
BUILTIN_LOCALS_METHODDEF
{"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc},
{"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc},
- {"next", (PyCFunction)builtin_next, METH_VARARGS, next_doc},
+ {"next", (PyCFunction)builtin_next, METH_FASTCALL, next_doc},
BUILTIN_OCT_METHODDEF
BUILTIN_ORD_METHODDEF
BUILTIN_POW_METHODDEF