| 1 |
#ifndef Py_INTERNAL_GENOBJECT_H |
| 2 |
#define Py_INTERNAL_GENOBJECT_H |
| 3 |
#ifdef __cplusplus |
| 4 |
extern "C" { |
| 5 |
#endif |
| 6 |
|
| 7 |
#ifndef Py_BUILD_CORE |
| 8 |
# error "this header requires Py_BUILD_CORE define" |
| 9 |
#endif |
| 10 |
|
| 11 |
#include "pycore_interpframe_structs.h" // _PyGenObject |
| 12 |
|
| 13 |
#include <stddef.h> // offsetof() |
| 14 |
|
| 15 |
|
| 16 |
static inline |
| 17 |
PyGenObject *_PyGen_GetGeneratorFromFrame(_PyInterpreterFrame *frame) |
| 18 |
{ |
| 19 |
assert(frame->owner == FRAME_OWNED_BY_GENERATOR); |
| 20 |
size_t offset_in_gen = offsetof(PyGenObject, gi_iframe); |
| 21 |
return (PyGenObject *)(((char *)frame) - offset_in_gen); |
| 22 |
} |
| 23 |
|
| 24 |
PyAPI_FUNC(PyObject *)_PyGen_yf(PyGenObject *); |
| 25 |
extern void _PyGen_Finalize(PyObject *self); |
| 26 |
|
| 27 |
// Export for '_asyncio' shared extension |
| 28 |
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *); |
| 29 |
|
| 30 |
// Export for '_asyncio' shared extension |
| 31 |
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); |
| 32 |
|
| 33 |
PyAPI_FUNC(PyObject *)_PyCoro_GetAwaitableIter(PyObject *o); |
| 34 |
extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *); |
| 35 |
|
| 36 |
extern PyTypeObject _PyCoroWrapper_Type; |
| 37 |
extern PyTypeObject _PyAsyncGenWrappedValue_Type; |
| 38 |
extern PyTypeObject _PyAsyncGenAThrow_Type; |
| 39 |
|
| 40 |
#ifdef __cplusplus |
| 41 |
} |
| 42 |
#endif |
| 43 |
#endif /* !Py_INTERNAL_GENOBJECT_H */ |