Commit 8ee7708c authored by Raymond Hettinger's avatar Raymond Hettinger

Issue #19005: Fix documentation for PyIter_Next().

parent 3415fa3c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Iterator Protocol Iterator Protocol
================= =================
There are only a couple of functions specifically for working with iterators. There are two functions specifically for working with iterators.
.. c:function:: int PyIter_Check(PyObject *o) .. c:function:: int PyIter_Check(PyObject *o)
...@@ -14,11 +14,10 @@ There are only a couple of functions specifically for working with iterators. ...@@ -14,11 +14,10 @@ There are only a couple of functions specifically for working with iterators.
.. c:function:: PyObject* PyIter_Next(PyObject *o) .. c:function:: PyObject* PyIter_Next(PyObject *o)
Return the next value from the iteration *o*. If the object is an iterator, Return the next value from the iteration *o*. The object must be an iterator
this retrieves the next value from the iteration, and returns *NULL* with no (it is up to the caller to check this). If there are no remaining values,
exception set if there are no remaining items. If the object is not an returns *NULL* with no exception set. If an error occurs while retrieving
iterator, :exc:`TypeError` is raised, or if there is an error in retrieving the the item, returns *NULL* and passes along the exception.
item, returns *NULL* and passes along the exception.
To write a loop which iterates over an iterator, the C code should look To write a loop which iterates over an iterator, the C code should look
something like this:: something like this::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment