Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

frameobject.h 3.2 KB

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

Press p or to see the previous file or, n or to see the next file

Comments

Loading...