diff options
author | Vladimir Matveev <vladima@fb.com> | 2020-10-10 00:15:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-10 00:15:15 (GMT) |
commit | 037245c5ac46c3436f617a1f5d965929754be239 (patch) | |
tree | ce2a797b165e846d59e53ba5d530413cb573a8aa /Include/abstract.h | |
parent | 9975cc5008c795e069ce11e2dbed2110cc12e74e (diff) | |
download | cpython-037245c5ac46c3436f617a1f5d965929754be239.zip cpython-037245c5ac46c3436f617a1f5d965929754be239.tar.gz cpython-037245c5ac46c3436f617a1f5d965929754be239.tar.bz2 |
bpo-41756: Add PyIter_Send function (#22443)
Diffstat (limited to 'Include/abstract.h')
-rw-r--r-- | Include/abstract.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index a23b7dc..716cd4b 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -338,6 +338,22 @@ PyAPI_FUNC(int) PyIter_Check(PyObject *); NULL with an exception means an error occurred. */ PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); +typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, +} PySendResult; + +/* Takes generator, coroutine or iterator object and sends the value into it. + Returns: + - PYGEN_RETURN (0) if generator has returned. + 'result' parameter is filled with return value + - PYGEN_ERROR (-1) if exception was raised. + 'result' parameter is NULL + - PYGEN_NEXT (1) if generator has yielded. + 'result' parameter is filled with yielded value. */ +PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **); + /* === Number Protocol ================================================== */ |