Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:20:54

0001 /* Generator object interface */
0002 
0003 #ifndef Py_LIMITED_API
0004 #ifndef Py_GENOBJECT_H
0005 #define Py_GENOBJECT_H
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009 
0010 /* --- Generators --------------------------------------------------------- */
0011 
0012 /* _PyGenObject_HEAD defines the initial segment of generator
0013    and coroutine objects. */
0014 #define _PyGenObject_HEAD(prefix)                                           \
0015     PyObject_HEAD                                                           \
0016     /* List of weak reference. */                                           \
0017     PyObject *prefix##_weakreflist;                                         \
0018     /* Name of the generator. */                                            \
0019     PyObject *prefix##_name;                                                \
0020     /* Qualified name of the generator. */                                  \
0021     PyObject *prefix##_qualname;                                            \
0022     _PyErr_StackItem prefix##_exc_state;                                    \
0023     PyObject *prefix##_origin_or_finalizer;                                 \
0024     char prefix##_hooks_inited;                                             \
0025     char prefix##_closed;                                                   \
0026     char prefix##_running_async;                                            \
0027     /* The frame */                                                         \
0028     int8_t prefix##_frame_state;                                            \
0029     PyObject *prefix##_iframe[1];                                           \
0030 
0031 typedef struct {
0032     /* The gi_ prefix is intended to remind of generator-iterator. */
0033     _PyGenObject_HEAD(gi)
0034 } PyGenObject;
0035 
0036 PyAPI_DATA(PyTypeObject) PyGen_Type;
0037 
0038 #define PyGen_Check(op) PyObject_TypeCheck((op), &PyGen_Type)
0039 #define PyGen_CheckExact(op) Py_IS_TYPE((op), &PyGen_Type)
0040 
0041 PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *);
0042 PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
0043     PyObject *name, PyObject *qualname);
0044 PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
0045 PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
0046 PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
0047 PyAPI_FUNC(PyCodeObject *) PyGen_GetCode(PyGenObject *gen);
0048 
0049 
0050 /* --- PyCoroObject ------------------------------------------------------- */
0051 
0052 typedef struct {
0053     _PyGenObject_HEAD(cr)
0054 } PyCoroObject;
0055 
0056 PyAPI_DATA(PyTypeObject) PyCoro_Type;
0057 PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
0058 
0059 #define PyCoro_CheckExact(op) Py_IS_TYPE((op), &PyCoro_Type)
0060 PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
0061     PyObject *name, PyObject *qualname);
0062 
0063 
0064 /* --- Asynchronous Generators -------------------------------------------- */
0065 
0066 typedef struct {
0067     _PyGenObject_HEAD(ag)
0068 } PyAsyncGenObject;
0069 
0070 PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
0071 PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
0072 PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type;
0073 PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
0074 
0075 PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
0076     PyObject *name, PyObject *qualname);
0077 
0078 #define PyAsyncGen_CheckExact(op) Py_IS_TYPE((op), &PyAsyncGen_Type)
0079 
0080 #define PyAsyncGenASend_CheckExact(op) Py_IS_TYPE((op), &_PyAsyncGenASend_Type)
0081 
0082 
0083 #undef _PyGenObject_HEAD
0084 
0085 #ifdef __cplusplus
0086 }
0087 #endif
0088 #endif /* !Py_GENOBJECT_H */
0089 #endif /* Py_LIMITED_API */