codekingpro/portable-devtools
114k
1/* See InternalDocs/frames.md for an explanation of the frame stack2 * including explanation of the PyFrameObject and _PyInterpreterFrame3 * structs. */4 5#ifndef Py_INTERNAL_FRAME_H6#define Py_INTERNAL_FRAME_H7#ifdef __cplusplus8extern "C" {9#endif10 11#ifndef Py_BUILD_CORE12# error "this header requires Py_BUILD_CORE define"13#endif14 15#include "pycore_typedefs.h" // _PyInterpreterFrame16 17 18struct _frame {19 PyObject_HEAD20 PyFrameObject *f_back; /* previous frame, or NULL */21 _PyInterpreterFrame *f_frame; /* points to the frame data */22 PyObject *f_trace; /* Trace function */23 int f_lineno; /* Current line number. Only valid if non-zero */24 char f_trace_lines; /* Emit per-line trace events? */25 char f_trace_opcodes; /* Emit per-opcode trace events? */26 PyObject *f_extra_locals; /* Dict for locals set by users using f_locals, could be NULL */27 /* This is purely for backwards compatibility for PyEval_GetLocals.28 PyEval_GetLocals requires a borrowed reference so the actual reference29 is stored here */30 PyObject *f_locals_cache;31 /* A tuple containing strong references to fast locals that were overwritten32 * via f_locals. Borrowed references to these locals may exist in frames33 * closer to the top of the stack. The references in this tuple act as34 * "support" for the borrowed references, ensuring that they remain valid.35 */36 PyObject *f_overwritten_fast_locals;37 /* The frame data, if this frame object owns the frame */38 PyObject *_f_frame_data[1];39};40 41extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code);42 43 44/* other API */45 46typedef enum _framestate {47 FRAME_CREATED = -3,48 FRAME_SUSPENDED = -2,49 FRAME_SUSPENDED_YIELD_FROM = -1,50 FRAME_EXECUTING = 0,51 FRAME_COMPLETED = 1,52 FRAME_CLEARED = 453} PyFrameState;54 55#define FRAME_STATE_SUSPENDED(S) ((S) == FRAME_SUSPENDED || (S) == FRAME_SUSPENDED_YIELD_FROM)56#define FRAME_STATE_FINISHED(S) ((S) >= FRAME_COMPLETED)57 58#ifdef __cplusplus59}60#endif61#endif /* !Py_INTERNAL_FRAME_H */62 