mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-41756: Add PyIter_Send function (#22443)
This commit is contained in:
parent
9975cc5008
commit
037245c5ac
12 changed files with 78 additions and 42 deletions
|
@ -15,11 +15,6 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
|
|||
The C structure used for generator objects.
|
||||
|
||||
|
||||
.. c:type:: PySendResult
|
||||
|
||||
The enum value used to represent different results of :c:func:`PyGen_Send`.
|
||||
|
||||
|
||||
.. c:var:: PyTypeObject PyGen_Type
|
||||
|
||||
The type object corresponding to generator objects.
|
||||
|
|
|
@ -44,3 +44,17 @@ something like this::
|
|||
else {
|
||||
/* continue doing useful work */
|
||||
}
|
||||
|
||||
|
||||
.. c:type:: PySendResult
|
||||
|
||||
The enum value used to represent different results of :c:func:`PyIter_Send`.
|
||||
|
||||
|
||||
.. c:function:: PySendResult PyIter_Send(PyObject *iter, PyObject *arg, PyObject **presult)
|
||||
|
||||
Sends the *arg* value into the iterator *iter*. Returns:
|
||||
|
||||
- ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*.
|
||||
- ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*.
|
||||
- ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue