summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-04-30 20:02:37 (GMT)
committerGeorg Brandl <georg@python.org>2008-04-30 20:02:37 (GMT)
commit63b0a2eb21386e1c6b1e5d97421085d543150c2c (patch)
tree8ae06ef91d2d14bc391b26c1b1091e8fb20dcfd2
parent28e0873f1f89d0d80ab64fabeb805de813ec08e4 (diff)
downloadcpython-63b0a2eb21386e1c6b1e5d97421085d543150c2c.zip
cpython-63b0a2eb21386e1c6b1e5d97421085d543150c2c.tar.gz
cpython-63b0a2eb21386e1c6b1e5d97421085d543150c2c.tar.bz2
#2727: clarify tp_iternext docs.
-rw-r--r--Doc/c-api/typeobj.rst11
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index e89ecf7..1807c92 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -753,11 +753,12 @@ set.
.. cmember:: iternextfunc PyTypeObject.tp_iternext
- An optional pointer to a function that returns the next item in an iterator, or
- raises :exc:`StopIteration` when the iterator is exhausted. Its presence
- normally signals that the instances of this type are iterators (although classic
- instances always have this function, even if they don't define a :meth:`next`
- method).
+ An optional pointer to a function that returns the next item in an iterator.
+ When the iterator is exhausted, it must return *NULL*; a :exc:`StopIteration`
+ exception may or may not be set. When another error occurs, it must return
+ *NULL* too. Its presence normally signals that the instances of this type
+ are iterators (although classic instances always have this function, even if
+ they don't define a :meth:`next` method).
Iterator types should also define the :attr:`tp_iter` function, and that
function should return the iterator instance itself (not a new iterator