bpo-41756: Add PyIter_Send function (#22443)

This commit is contained in:
Vladimir Matveev 2020-10-09 17:15:15 -07:00 committed by GitHub
parent 9975cc5008
commit 037245c5ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 78 additions and 42 deletions

View file

@ -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.

View file

@ -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``.