| | |
| |
|
| | #ifndef Py_CPYTHON_FRAMEOBJECT_H |
| | # error "this header file must not be included directly" |
| | #endif |
| |
|
| | |
| | |
| | |
| | enum _framestate { |
| | FRAME_CREATED = -2, |
| | FRAME_SUSPENDED = -1, |
| | FRAME_EXECUTING = 0, |
| | FRAME_RETURNED = 1, |
| | FRAME_UNWINDING = 2, |
| | FRAME_RAISED = 3, |
| | FRAME_CLEARED = 4 |
| | }; |
| |
|
| | typedef signed char PyFrameState; |
| |
|
| | typedef struct { |
| | int b_type; |
| | int b_handler; |
| | int b_level; |
| | } PyTryBlock; |
| |
|
| | struct _frame { |
| | PyObject_VAR_HEAD |
| | struct _frame *f_back; |
| | PyCodeObject *f_code; |
| | PyObject *f_builtins; |
| | PyObject *f_globals; |
| | PyObject *f_locals; |
| | PyObject **f_valuestack; |
| | PyObject *f_trace; |
| | int f_stackdepth; |
| | char f_trace_lines; |
| | char f_trace_opcodes; |
| |
|
| | |
| | PyObject *f_gen; |
| |
|
| | int f_lasti; |
| | int f_lineno; |
| | int f_iblock; |
| | PyFrameState f_state; |
| | PyTryBlock f_blockstack[CO_MAXBLOCKS]; |
| | PyObject *f_localsplus[1]; |
| | }; |
| |
|
| | static inline int _PyFrame_IsRunnable(struct _frame *f) { |
| | return f->f_state < FRAME_EXECUTING; |
| | } |
| |
|
| | static inline int _PyFrame_IsExecuting(struct _frame *f) { |
| | return f->f_state == FRAME_EXECUTING; |
| | } |
| |
|
| | static inline int _PyFrameHasCompleted(struct _frame *f) { |
| | return f->f_state > FRAME_EXECUTING; |
| | } |
| |
|
| | |
| |
|
| | PyAPI_DATA(PyTypeObject) PyFrame_Type; |
| |
|
| | #define PyFrame_Check(op) Py_IS_TYPE(op, &PyFrame_Type) |
| |
|
| | PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, |
| | PyObject *, PyObject *); |
| |
|
| | |
| | PyFrameObject* |
| | _PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *); |
| |
|
| |
|
| | |
| |
|
| | |
| |
|
| | PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); |
| | PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); |
| |
|
| | |
| |
|
| | PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); |
| |
|
| | PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f); |
| | PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); |
| |
|
| | PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); |
| |
|
| | PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame); |
| |
|