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