Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pycore_interpframe_structs.h96 linesDownload Raw Back to internal
1/* Structures used by pycore_debug_offsets.h.2 *3 * See InternalDocs/frames.md for an explanation of the frame stack4 * including explanation of the PyFrameObject and _PyInterpreterFrame5 * structs.6 */7 8#ifndef Py_INTERNAL_INTERP_FRAME_STRUCTS_H9#define Py_INTERNAL_INTERP_FRAME_STRUCTS_H10 11#ifndef Py_BUILD_CORE12#  error "this header requires Py_BUILD_CORE define"13#endif14 15#include "pycore_structs.h"       // _PyStackRef16#include "pycore_typedefs.h"      // _PyInterpreterFrame17 18#ifdef __cplusplus19extern "C" {20#endif21 22enum _frameowner {23    FRAME_OWNED_BY_THREAD = 0,24    FRAME_OWNED_BY_GENERATOR = 1,25    FRAME_OWNED_BY_FRAME_OBJECT = 2,26    FRAME_OWNED_BY_INTERPRETER = 3,27    FRAME_OWNED_BY_CSTACK = 4,28};29 30struct _PyInterpreterFrame {31    _PyStackRef f_executable; /* Deferred or strong reference (code object or None) */32    struct _PyInterpreterFrame *previous;33    _PyStackRef f_funcobj; /* Deferred or strong reference. Only valid if not on C stack */34    PyObject *f_globals; /* Borrowed reference. Only valid if not on C stack */35    PyObject *f_builtins; /* Borrowed reference. Only valid if not on C stack */36    PyObject *f_locals; /* Strong reference, may be NULL. Only valid if not on C stack */37    PyFrameObject *frame_obj; /* Strong reference, may be NULL. Only valid if not on C stack */38    _Py_CODEUNIT *instr_ptr; /* Instruction currently executing (or about to begin) */39    _PyStackRef *stackpointer;40#ifdef Py_GIL_DISABLED41    /* Index of thread-local bytecode containing instr_ptr. */42    int32_t tlbc_index;43#endif44    uint16_t return_offset;  /* Only relevant during a function call */45    char owner;46#ifdef Py_DEBUG47    uint8_t visited:1;48    uint8_t lltrace:7;49#else50    uint8_t visited;51#endif52    /* Locals and stack */53    _PyStackRef localsplus[1];54};55 56 57/* _PyGenObject_HEAD defines the initial segment of generator58   and coroutine objects. */59#define _PyGenObject_HEAD(prefix)                                           \60    PyObject_HEAD                                                           \61    /* List of weak reference. */                                           \62    PyObject *prefix##_weakreflist;                                         \63    /* Name of the generator. */                                            \64    PyObject *prefix##_name;                                                \65    /* Qualified name of the generator. */                                  \66    PyObject *prefix##_qualname;                                            \67    _PyErr_StackItem prefix##_exc_state;                                    \68    PyObject *prefix##_origin_or_finalizer;                                 \69    char prefix##_hooks_inited;                                             \70    char prefix##_closed;                                                   \71    char prefix##_running_async;                                            \72    /* The frame */                                                         \73    int8_t prefix##_frame_state;                                            \74    _PyInterpreterFrame prefix##_iframe;                                    \75 76struct _PyGenObject {77    /* The gi_ prefix is intended to remind of generator-iterator. */78    _PyGenObject_HEAD(gi)79};80 81struct _PyCoroObject {82    _PyGenObject_HEAD(cr)83};84 85struct _PyAsyncGenObject {86    _PyGenObject_HEAD(ag)87};88 89#undef _PyGenObject_HEAD90 91 92#ifdef __cplusplus93}94#endif95#endif  // !Py_INTERNAL_INTERP_FRAME_STRUCTS_H96 
codekingpro/portable-devtools · Team Ai