diff options
author | Guido van Rossum <guido@python.org> | 2002-07-16 20:47:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-07-16 20:47:50 (GMT) |
commit | 86d593e110f61800069b2d488d5530477a3d8054 (patch) | |
tree | 894ea4a9b9dccb6e46ae33bbb8df2f967855a9da | |
parent | 2147df748fa0a44beede227af9e595fe96fd7a14 (diff) | |
download | cpython-86d593e110f61800069b2d488d5530477a3d8054.zip cpython-86d593e110f61800069b2d488d5530477a3d8054.tar.gz cpython-86d593e110f61800069b2d488d5530477a3d8054.tar.bz2 |
Remove the next() method -- one is supplied automatically by
PyType_Ready() because the tp_iternext slot is set. Also removed the
redundant (and expensive!) call to raise StopIteration from
rangeiter_next().
-rw-r--r-- | Objects/rangeobject.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index c3c6050..7c0e609 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -1,4 +1,3 @@ - /* Range object implementation */ #include "Python.h" @@ -251,16 +250,9 @@ rangeiter_next(rangeiterobject *r) { if (r->index < r->len) return PyInt_FromLong(r->start + (r->index++) * r->step); - PyErr_SetObject(PyExc_StopIteration, Py_None); return NULL; } -static PyMethodDef rangeiter_methods[] = { - {"next", (PyCFunction)rangeiter_next, METH_NOARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ -}; - static PyTypeObject Pyrangeiter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -291,6 +283,5 @@ static PyTypeObject Pyrangeiter_Type = { 0, /* tp_weaklistoffset */ (getiterfunc)rangeiter_getiter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ - rangeiter_methods, /* tp_methods */ + 0, /* tp_methods */ }; - |