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