mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +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
|
@ -9,6 +9,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include "pystate.h" /* _PyErr_StackItem */
|
||||
#include "abstract.h" /* PySendResult */
|
||||
|
||||
/* _PyGenObject_HEAD defines the initial segment of generator
|
||||
and coroutine objects. */
|
||||
|
@ -41,16 +42,9 @@ PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
|
|||
PyObject *name, PyObject *qualname);
|
||||
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
|
||||
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
|
||||
PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *);
|
||||
PyObject *_PyGen_yf(PyGenObject *);
|
||||
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
|
||||
|
||||
typedef enum {
|
||||
PYGEN_RETURN = 0,
|
||||
PYGEN_ERROR = -1,
|
||||
PYGEN_NEXT = 1,
|
||||
} PySendResult;
|
||||
|
||||
/* Sends the value into the generator or the coroutine. Returns:
|
||||
- PYGEN_RETURN (0) if generator has returned.
|
||||
'result' parameter is filled with return value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue