mirror of
https://github.com/python/cpython.git
synced 2026-04-07 20:30:51 +00:00
* Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it. * Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector. * Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation. * Move ownership of InterpreterFrame in generator from frame object to generator object. * Do not create frame objects for Python calls. * Do not create frame objects for generators.
43 lines
1.4 KiB
C
43 lines
1.4 KiB
C
/* Frame object interface */
|
|
|
|
#ifndef Py_CPYTHON_FRAMEOBJECT_H
|
|
# error "this header file must not be included directly"
|
|
#endif
|
|
|
|
struct _frame {
|
|
PyObject_HEAD
|
|
struct _frame *f_back; /* previous frame, or NULL */
|
|
struct _interpreter_frame *f_frame; /* points to the frame data */
|
|
PyObject *f_trace; /* Trace function */
|
|
int f_lineno; /* Current line number. Only valid if non-zero */
|
|
char f_trace_lines; /* Emit per-line trace events? */
|
|
char f_trace_opcodes; /* Emit per-opcode trace events? */
|
|
char f_own_locals_memory; /* This frame owns the memory for the locals */
|
|
};
|
|
|
|
/* Standard object interface */
|
|
|
|
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
|
|
|
#define PyFrame_Check(op) Py_IS_TYPE(op, &PyFrame_Type)
|
|
|
|
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
|
PyObject *, PyObject *);
|
|
|
|
/* only internal use */
|
|
PyFrameObject*
|
|
_PyFrame_New_NoTrack(struct _interpreter_frame *, int);
|
|
|
|
|
|
/* The rest of the interface is specific for frame objects */
|
|
|
|
/* Conversions between "fast locals" and locals in dictionary */
|
|
|
|
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);
|