annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/genobject.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1
jpayne@69 2 /* Generator object interface */
jpayne@69 3
jpayne@69 4 #ifndef Py_LIMITED_API
jpayne@69 5 #ifndef Py_GENOBJECT_H
jpayne@69 6 #define Py_GENOBJECT_H
jpayne@69 7 #ifdef __cplusplus
jpayne@69 8 extern "C" {
jpayne@69 9 #endif
jpayne@69 10
jpayne@69 11 #include "pystate.h" /* _PyErr_StackItem */
jpayne@69 12
jpayne@69 13 struct _frame; /* Avoid including frameobject.h */
jpayne@69 14
jpayne@69 15 /* _PyGenObject_HEAD defines the initial segment of generator
jpayne@69 16 and coroutine objects. */
jpayne@69 17 #define _PyGenObject_HEAD(prefix) \
jpayne@69 18 PyObject_HEAD \
jpayne@69 19 /* Note: gi_frame can be NULL if the generator is "finished" */ \
jpayne@69 20 struct _frame *prefix##_frame; \
jpayne@69 21 /* True if generator is being executed. */ \
jpayne@69 22 char prefix##_running; \
jpayne@69 23 /* The code object backing the generator */ \
jpayne@69 24 PyObject *prefix##_code; \
jpayne@69 25 /* List of weak reference. */ \
jpayne@69 26 PyObject *prefix##_weakreflist; \
jpayne@69 27 /* Name of the generator. */ \
jpayne@69 28 PyObject *prefix##_name; \
jpayne@69 29 /* Qualified name of the generator. */ \
jpayne@69 30 PyObject *prefix##_qualname; \
jpayne@69 31 _PyErr_StackItem prefix##_exc_state;
jpayne@69 32
jpayne@69 33 typedef struct {
jpayne@69 34 /* The gi_ prefix is intended to remind of generator-iterator. */
jpayne@69 35 _PyGenObject_HEAD(gi)
jpayne@69 36 } PyGenObject;
jpayne@69 37
jpayne@69 38 PyAPI_DATA(PyTypeObject) PyGen_Type;
jpayne@69 39
jpayne@69 40 #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
jpayne@69 41 #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
jpayne@69 42
jpayne@69 43 PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
jpayne@69 44 PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
jpayne@69 45 PyObject *name, PyObject *qualname);
jpayne@69 46 PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
jpayne@69 47 PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
jpayne@69 48 PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
jpayne@69 49 PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *);
jpayne@69 50 PyObject *_PyGen_yf(PyGenObject *);
jpayne@69 51 PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
jpayne@69 52
jpayne@69 53 #ifndef Py_LIMITED_API
jpayne@69 54 typedef struct {
jpayne@69 55 _PyGenObject_HEAD(cr)
jpayne@69 56 PyObject *cr_origin;
jpayne@69 57 } PyCoroObject;
jpayne@69 58
jpayne@69 59 PyAPI_DATA(PyTypeObject) PyCoro_Type;
jpayne@69 60 PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
jpayne@69 61
jpayne@69 62 PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type;
jpayne@69 63
jpayne@69 64 #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type)
jpayne@69 65 PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
jpayne@69 66 PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *,
jpayne@69 67 PyObject *name, PyObject *qualname);
jpayne@69 68
jpayne@69 69 /* Asynchronous Generators */
jpayne@69 70
jpayne@69 71 typedef struct {
jpayne@69 72 _PyGenObject_HEAD(ag)
jpayne@69 73 PyObject *ag_finalizer;
jpayne@69 74
jpayne@69 75 /* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks
jpayne@69 76 were called on the generator, to avoid calling them more
jpayne@69 77 than once. */
jpayne@69 78 int ag_hooks_inited;
jpayne@69 79
jpayne@69 80 /* Flag is set to 1 when aclose() is called for the first time, or
jpayne@69 81 when a StopAsyncIteration exception is raised. */
jpayne@69 82 int ag_closed;
jpayne@69 83
jpayne@69 84 int ag_running_async;
jpayne@69 85 } PyAsyncGenObject;
jpayne@69 86
jpayne@69 87 PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
jpayne@69 88 PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
jpayne@69 89 PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type;
jpayne@69 90 PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
jpayne@69 91
jpayne@69 92 PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *,
jpayne@69 93 PyObject *name, PyObject *qualname);
jpayne@69 94
jpayne@69 95 #define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type)
jpayne@69 96
jpayne@69 97 PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
jpayne@69 98
jpayne@69 99 int PyAsyncGen_ClearFreeLists(void);
jpayne@69 100
jpayne@69 101 #endif
jpayne@69 102
jpayne@69 103 #undef _PyGenObject_HEAD
jpayne@69 104
jpayne@69 105 #ifdef __cplusplus
jpayne@69 106 }
jpayne@69 107 #endif
jpayne@69 108 #endif /* !Py_GENOBJECT_H */
jpayne@69 109 #endif /* Py_LIMITED_API */