annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/frameobject.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 /* Frame object interface */
jpayne@69 2
jpayne@69 3 #ifndef Py_LIMITED_API
jpayne@69 4 #ifndef Py_FRAMEOBJECT_H
jpayne@69 5 #define Py_FRAMEOBJECT_H
jpayne@69 6 #ifdef __cplusplus
jpayne@69 7 extern "C" {
jpayne@69 8 #endif
jpayne@69 9
jpayne@69 10 typedef struct {
jpayne@69 11 int b_type; /* what kind of block this is */
jpayne@69 12 int b_handler; /* where to jump to find handler */
jpayne@69 13 int b_level; /* value stack level to pop to */
jpayne@69 14 } PyTryBlock;
jpayne@69 15
jpayne@69 16 typedef struct _frame {
jpayne@69 17 PyObject_VAR_HEAD
jpayne@69 18 struct _frame *f_back; /* previous frame, or NULL */
jpayne@69 19 PyCodeObject *f_code; /* code segment */
jpayne@69 20 PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
jpayne@69 21 PyObject *f_globals; /* global symbol table (PyDictObject) */
jpayne@69 22 PyObject *f_locals; /* local symbol table (any mapping) */
jpayne@69 23 PyObject **f_valuestack; /* points after the last local */
jpayne@69 24 /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
jpayne@69 25 Frame evaluation usually NULLs it, but a frame that yields sets it
jpayne@69 26 to the current stack top. */
jpayne@69 27 PyObject **f_stacktop;
jpayne@69 28 PyObject *f_trace; /* Trace function */
jpayne@69 29 char f_trace_lines; /* Emit per-line trace events? */
jpayne@69 30 char f_trace_opcodes; /* Emit per-opcode trace events? */
jpayne@69 31
jpayne@69 32 /* Borrowed reference to a generator, or NULL */
jpayne@69 33 PyObject *f_gen;
jpayne@69 34
jpayne@69 35 int f_lasti; /* Last instruction if called */
jpayne@69 36 /* Call PyFrame_GetLineNumber() instead of reading this field
jpayne@69 37 directly. As of 2.3 f_lineno is only valid when tracing is
jpayne@69 38 active (i.e. when f_trace is set). At other times we use
jpayne@69 39 PyCode_Addr2Line to calculate the line from the current
jpayne@69 40 bytecode index. */
jpayne@69 41 int f_lineno; /* Current line number */
jpayne@69 42 int f_iblock; /* index in f_blockstack */
jpayne@69 43 char f_executing; /* whether the frame is still executing */
jpayne@69 44 PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
jpayne@69 45 PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
jpayne@69 46 } PyFrameObject;
jpayne@69 47
jpayne@69 48
jpayne@69 49 /* Standard object interface */
jpayne@69 50
jpayne@69 51 PyAPI_DATA(PyTypeObject) PyFrame_Type;
jpayne@69 52
jpayne@69 53 #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type)
jpayne@69 54
jpayne@69 55 PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
jpayne@69 56 PyObject *, PyObject *);
jpayne@69 57
jpayne@69 58 /* only internal use */
jpayne@69 59 PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *,
jpayne@69 60 PyObject *, PyObject *);
jpayne@69 61
jpayne@69 62
jpayne@69 63 /* The rest of the interface is specific for frame objects */
jpayne@69 64
jpayne@69 65 /* Block management functions */
jpayne@69 66
jpayne@69 67 PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
jpayne@69 68 PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
jpayne@69 69
jpayne@69 70 /* Extend the value stack */
jpayne@69 71
jpayne@69 72 PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
jpayne@69 73
jpayne@69 74 /* Conversions between "fast locals" and locals in dictionary */
jpayne@69 75
jpayne@69 76 PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
jpayne@69 77
jpayne@69 78 PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
jpayne@69 79 PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
jpayne@69 80
jpayne@69 81 PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
jpayne@69 82
jpayne@69 83 PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
jpayne@69 84
jpayne@69 85 /* Return the line of code the frame is currently executing. */
jpayne@69 86 PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
jpayne@69 87
jpayne@69 88 #ifdef __cplusplus
jpayne@69 89 }
jpayne@69 90 #endif
jpayne@69 91 #endif /* !Py_FRAMEOBJECT_H */
jpayne@69 92 #endif /* Py_LIMITED_API */