Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/python3.14/internal/pycore_interpframe_structs.h
1 /* Structures used by pycore_debug_offsets.h. 2 * 3 * See InternalDocs/frames.md for an explanation of the frame stack 4 * including explanation of the PyFrameObject and _PyInterpreterFrame 5 * structs. 6 */ 7 8 #ifndef Py_INTERNAL_INTERP_FRAME_STRUCTS_H 9 #define Py_INTERNAL_INTERP_FRAME_STRUCTS_H 10 11 #ifndef Py_BUILD_CORE 12 # error "this header requires Py_BUILD_CORE define" 13 #endif 14 15 #include "pycore_structs.h" // _PyStackRef 16 #include "pycore_typedefs.h" // _PyInterpreterFrame 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 enum _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 30 struct _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_DISABLED 41 /* Index of thread-local bytecode containing instr_ptr. */ 42 int32_t tlbc_index; 43 #endif 44 uint16_t return_offset; /* Only relevant during a function call */ 45 char owner; 46 #ifdef Py_DEBUG 47 uint8_t visited:1; 48 uint8_t lltrace:7; 49 #else 50 uint8_t visited; 51 #endif 52 /* Locals and stack */ 53 _PyStackRef localsplus[1]; 54 }; 55 56 57 /* _PyGenObject_HEAD defines the initial segment of generator 58 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 76 struct _PyGenObject { 77 /* The gi_ prefix is intended to remind of generator-iterator. */ 78 _PyGenObject_HEAD(gi) 79 }; 80 81 struct _PyCoroObject { 82 _PyGenObject_HEAD(cr) 83 }; 84 85 struct _PyAsyncGenObject { 86 _PyGenObject_HEAD(ag) 87 }; 88 89 #undef _PyGenObject_HEAD 90 91 92 #ifdef __cplusplus 93 } 94 #endif 95 #endif // !Py_INTERNAL_INTERP_FRAME_STRUCTS_H