/src/cpython/Objects/clinic/frameobject.c.h
Line | Count | Source |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
6 | | |
7 | | PyDoc_STRVAR(frame_locals__doc__, |
8 | | "Return the mapping used by the frame to look up local variables."); |
9 | | |
10 | | static PyObject * |
11 | | frame_locals_get_impl(PyFrameObject *self); |
12 | | |
13 | | static PyObject * |
14 | | frame_locals_get(PyObject *self, void *Py_UNUSED(context)) |
15 | 37 | { |
16 | 37 | PyObject *return_value = NULL; |
17 | | |
18 | 37 | Py_BEGIN_CRITICAL_SECTION(self); |
19 | 37 | return_value = frame_locals_get_impl((PyFrameObject *)self); |
20 | 37 | Py_END_CRITICAL_SECTION(); |
21 | | |
22 | 37 | return return_value; |
23 | 37 | } |
24 | | |
25 | | PyDoc_STRVAR(frame_lineno__doc__, |
26 | | "Return the current line number in the frame."); |
27 | | |
28 | | static PyObject * |
29 | | frame_lineno_get_impl(PyFrameObject *self); |
30 | | |
31 | | static PyObject * |
32 | | frame_lineno_get(PyObject *self, void *Py_UNUSED(context)) |
33 | 21.1k | { |
34 | 21.1k | PyObject *return_value = NULL; |
35 | | |
36 | 21.1k | Py_BEGIN_CRITICAL_SECTION(self); |
37 | 21.1k | return_value = frame_lineno_get_impl((PyFrameObject *)self); |
38 | 21.1k | Py_END_CRITICAL_SECTION(); |
39 | | |
40 | 21.1k | return return_value; |
41 | 21.1k | } |
42 | | |
43 | | PyDoc_STRVAR(frame_lasti__doc__, |
44 | | "Return the index of the last attempted instruction in the frame."); |
45 | | |
46 | | static PyObject * |
47 | | frame_lasti_get_impl(PyFrameObject *self); |
48 | | |
49 | | static PyObject * |
50 | | frame_lasti_get(PyObject *self, void *Py_UNUSED(context)) |
51 | 0 | { |
52 | 0 | PyObject *return_value = NULL; |
53 | |
|
54 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
55 | 0 | return_value = frame_lasti_get_impl((PyFrameObject *)self); |
56 | 0 | Py_END_CRITICAL_SECTION(); |
57 | |
|
58 | 0 | return return_value; |
59 | 0 | } |
60 | | |
61 | | PyDoc_STRVAR(frame_globals__doc__, |
62 | | "Return the global variables in the frame."); |
63 | | |
64 | | static PyObject * |
65 | | frame_globals_get_impl(PyFrameObject *self); |
66 | | |
67 | | static PyObject * |
68 | | frame_globals_get(PyObject *self, void *Py_UNUSED(context)) |
69 | 0 | { |
70 | 0 | PyObject *return_value = NULL; |
71 | |
|
72 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
73 | 0 | return_value = frame_globals_get_impl((PyFrameObject *)self); |
74 | 0 | Py_END_CRITICAL_SECTION(); |
75 | |
|
76 | 0 | return return_value; |
77 | 0 | } |
78 | | |
79 | | PyDoc_STRVAR(frame_builtins__doc__, |
80 | | "Return the built-in variables in the frame."); |
81 | | |
82 | | static PyObject * |
83 | | frame_builtins_get_impl(PyFrameObject *self); |
84 | | |
85 | | static PyObject * |
86 | | frame_builtins_get(PyObject *self, void *Py_UNUSED(context)) |
87 | 0 | { |
88 | 0 | PyObject *return_value = NULL; |
89 | |
|
90 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
91 | 0 | return_value = frame_builtins_get_impl((PyFrameObject *)self); |
92 | 0 | Py_END_CRITICAL_SECTION(); |
93 | |
|
94 | 0 | return return_value; |
95 | 0 | } |
96 | | |
97 | | PyDoc_STRVAR(frame_code__doc__, |
98 | | "Return the code object being executed in this frame."); |
99 | | |
100 | | static PyObject * |
101 | | frame_code_get_impl(PyFrameObject *self); |
102 | | |
103 | | static PyObject * |
104 | | frame_code_get(PyObject *self, void *Py_UNUSED(context)) |
105 | 63.4k | { |
106 | 63.4k | return frame_code_get_impl((PyFrameObject *)self); |
107 | 63.4k | } |
108 | | |
109 | | static PyObject * |
110 | | frame_back_get_impl(PyFrameObject *self); |
111 | | |
112 | | static PyObject * |
113 | | frame_back_get(PyObject *self, void *Py_UNUSED(context)) |
114 | 22.8k | { |
115 | 22.8k | PyObject *return_value = NULL; |
116 | | |
117 | 22.8k | Py_BEGIN_CRITICAL_SECTION(self); |
118 | 22.8k | return_value = frame_back_get_impl((PyFrameObject *)self); |
119 | 22.8k | Py_END_CRITICAL_SECTION(); |
120 | | |
121 | 22.8k | return return_value; |
122 | 22.8k | } |
123 | | |
124 | | PyDoc_STRVAR(frame_trace_opcodes__doc__, |
125 | | "Return True if opcode tracing is enabled, False otherwise."); |
126 | | |
127 | | static PyObject * |
128 | | frame_trace_opcodes_get_impl(PyFrameObject *self); |
129 | | |
130 | | static PyObject * |
131 | | frame_trace_opcodes_get(PyObject *self, void *Py_UNUSED(context)) |
132 | 0 | { |
133 | 0 | PyObject *return_value = NULL; |
134 | |
|
135 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
136 | 0 | return_value = frame_trace_opcodes_get_impl((PyFrameObject *)self); |
137 | 0 | Py_END_CRITICAL_SECTION(); |
138 | |
|
139 | 0 | return return_value; |
140 | 0 | } |
141 | | |
142 | | static int |
143 | | frame_trace_opcodes_set_impl(PyFrameObject *self, PyObject *value); |
144 | | |
145 | | static int |
146 | | frame_trace_opcodes_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context)) |
147 | 0 | { |
148 | 0 | int return_value = -1; |
149 | 0 | PyObject *value; |
150 | |
|
151 | 0 | if (arg == NULL) { |
152 | 0 | PyErr_Format(PyExc_AttributeError, |
153 | 0 | "attribute 'f_trace_opcodes' of '%.100s' objects cannot be deleted", |
154 | 0 | Py_TYPE(self)->tp_name); |
155 | 0 | return -1; |
156 | 0 | } |
157 | 0 | value = arg; |
158 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
159 | 0 | return_value = frame_trace_opcodes_set_impl((PyFrameObject *)self, value); |
160 | 0 | Py_END_CRITICAL_SECTION(); |
161 | |
|
162 | 0 | return return_value; |
163 | 0 | } |
164 | | |
165 | | static int |
166 | | frame_lineno_set_impl(PyFrameObject *self, PyObject *value); |
167 | | |
168 | | static int |
169 | | frame_lineno_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context)) |
170 | 0 | { |
171 | 0 | int return_value = -1; |
172 | 0 | PyObject *value; |
173 | |
|
174 | 0 | if (arg == NULL) { |
175 | 0 | PyErr_Format(PyExc_AttributeError, |
176 | 0 | "attribute 'f_lineno' of '%.100s' objects cannot be deleted", |
177 | 0 | Py_TYPE(self)->tp_name); |
178 | 0 | return -1; |
179 | 0 | } |
180 | 0 | value = arg; |
181 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
182 | 0 | return_value = frame_lineno_set_impl((PyFrameObject *)self, value); |
183 | 0 | Py_END_CRITICAL_SECTION(); |
184 | |
|
185 | 0 | return return_value; |
186 | 0 | } |
187 | | |
188 | | PyDoc_STRVAR(frame_trace__doc__, |
189 | | "Return the trace function for this frame, or None if no trace function is set."); |
190 | | |
191 | | static PyObject * |
192 | | frame_trace_get_impl(PyFrameObject *self); |
193 | | |
194 | | static PyObject * |
195 | | frame_trace_get(PyObject *self, void *Py_UNUSED(context)) |
196 | 0 | { |
197 | 0 | PyObject *return_value = NULL; |
198 | |
|
199 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
200 | 0 | return_value = frame_trace_get_impl((PyFrameObject *)self); |
201 | 0 | Py_END_CRITICAL_SECTION(); |
202 | |
|
203 | 0 | return return_value; |
204 | 0 | } |
205 | | |
206 | | static int |
207 | | frame_trace_set_impl(PyFrameObject *self, PyObject *value); |
208 | | |
209 | | static int |
210 | | frame_trace_set(PyObject *self, PyObject *arg, void *Py_UNUSED(context)) |
211 | 0 | { |
212 | 0 | int return_value = -1; |
213 | 0 | PyObject *value = NULL; |
214 | |
|
215 | 0 | if (arg != NULL) { |
216 | 0 | value = arg; |
217 | 0 | } |
218 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
219 | 0 | return_value = frame_trace_set_impl((PyFrameObject *)self, value); |
220 | 0 | Py_END_CRITICAL_SECTION(); |
221 | |
|
222 | 0 | return return_value; |
223 | 0 | } |
224 | | |
225 | | PyDoc_STRVAR(frame_generator__doc__, |
226 | | "Return the generator or coroutine associated with this frame, or None."); |
227 | | |
228 | | static PyObject * |
229 | | frame_generator_get_impl(PyFrameObject *self); |
230 | | |
231 | | static PyObject * |
232 | | frame_generator_get(PyObject *self, void *Py_UNUSED(context)) |
233 | 0 | { |
234 | 0 | PyObject *return_value = NULL; |
235 | |
|
236 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
237 | 0 | return_value = frame_generator_get_impl((PyFrameObject *)self); |
238 | 0 | Py_END_CRITICAL_SECTION(); |
239 | |
|
240 | 0 | return return_value; |
241 | 0 | } |
242 | | |
243 | | PyDoc_STRVAR(frame_clear__doc__, |
244 | | "clear($self, /)\n" |
245 | | "--\n" |
246 | | "\n" |
247 | | "Clear all references held by the frame."); |
248 | | |
249 | | #define FRAME_CLEAR_METHODDEF \ |
250 | | {"clear", (PyCFunction)frame_clear, METH_NOARGS, frame_clear__doc__}, |
251 | | |
252 | | static PyObject * |
253 | | frame_clear_impl(PyFrameObject *self); |
254 | | |
255 | | static PyObject * |
256 | | frame_clear(PyObject *self, PyObject *Py_UNUSED(ignored)) |
257 | 0 | { |
258 | 0 | PyObject *return_value = NULL; |
259 | |
|
260 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
261 | 0 | return_value = frame_clear_impl((PyFrameObject *)self); |
262 | 0 | Py_END_CRITICAL_SECTION(); |
263 | |
|
264 | 0 | return return_value; |
265 | 0 | } |
266 | | |
267 | | PyDoc_STRVAR(frame___sizeof____doc__, |
268 | | "__sizeof__($self, /)\n" |
269 | | "--\n" |
270 | | "\n" |
271 | | "Return the size of the frame in memory, in bytes."); |
272 | | |
273 | | #define FRAME___SIZEOF___METHODDEF \ |
274 | | {"__sizeof__", (PyCFunction)frame___sizeof__, METH_NOARGS, frame___sizeof____doc__}, |
275 | | |
276 | | static PyObject * |
277 | | frame___sizeof___impl(PyFrameObject *self); |
278 | | |
279 | | static PyObject * |
280 | | frame___sizeof__(PyObject *self, PyObject *Py_UNUSED(ignored)) |
281 | 0 | { |
282 | 0 | PyObject *return_value = NULL; |
283 | |
|
284 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
285 | 0 | return_value = frame___sizeof___impl((PyFrameObject *)self); |
286 | 0 | Py_END_CRITICAL_SECTION(); |
287 | |
|
288 | 0 | return return_value; |
289 | 0 | } |
290 | | #define FRAME_F_LOCALS_GETSETDEF {"f_locals", (getter)frame_locals_get, (setter)NULL, frame_locals__doc__}, |
291 | | |
292 | | #define FRAME_F_LINENO_GETSETDEF {"f_lineno", (getter)frame_lineno_get, (setter)frame_lineno_set, frame_lineno__doc__}, |
293 | | |
294 | | #define FRAME_F_LASTI_GETSETDEF {"f_lasti", (getter)frame_lasti_get, (setter)NULL, frame_lasti__doc__}, |
295 | | |
296 | | #define FRAME_F_GLOBALS_GETSETDEF {"f_globals", (getter)frame_globals_get, (setter)NULL, frame_globals__doc__}, |
297 | | |
298 | | #define FRAME_F_BUILTINS_GETSETDEF {"f_builtins", (getter)frame_builtins_get, (setter)NULL, frame_builtins__doc__}, |
299 | | |
300 | | #define FRAME_F_CODE_GETSETDEF {"f_code", (getter)frame_code_get, (setter)NULL, frame_code__doc__}, |
301 | | |
302 | | #define FRAME_F_BACK_GETSETDEF {"f_back", (getter)frame_back_get, (setter)NULL, NULL}, |
303 | | |
304 | | #define FRAME_F_TRACE_OPCODES_GETSETDEF {"f_trace_opcodes", (getter)frame_trace_opcodes_get, (setter)frame_trace_opcodes_set, frame_trace_opcodes__doc__}, |
305 | | |
306 | | #define FRAME_F_TRACE_GETSETDEF {"f_trace", (getter)frame_trace_get, (setter)frame_trace_set, frame_trace__doc__}, |
307 | | |
308 | | #define FRAME_F_GENERATOR_GETSETDEF {"f_generator", (getter)frame_generator_get, (setter)NULL, frame_generator__doc__}, |
309 | | |
310 | | /*[clinic end generated code: output=dfa59114b6dbce08 input=a9049054013a1b77]*/ |