File tree 5 files changed +51
-47
lines changed
5 files changed +51
-47
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ Other Objects
111
111
memoryview.rst
112
112
weakref.rst
113
113
capsule.rst
114
+ frame.rst
114
115
gen.rst
115
116
coro.rst
116
117
contextvars.rst
Original file line number Diff line number Diff line change
1
+ .. highlight :: c
2
+
3
+ Frame Objects
4
+ -------------
5
+
6
+ .. c :type :: PyFrameObject
7
+
8
+ The C structure of the objects used to describe frame objects.
9
+
10
+ The structure is not part of the C API.
11
+
12
+ .. versionchanged :: 3.11
13
+ The structure moved to the internal C API headers.
14
+
15
+ The :c:func: `PyEval_GetFrame ` and :c:func: `PyThreadState_GetFrame ` functions
16
+ can be used to get a frame object.
17
+
18
+ See also :ref: `Reflection <reflection >`.
19
+
20
+
21
+ .. c :function :: PyFrameObject* PyFrame_GetBack (PyFrameObject *frame)
22
+
23
+ Get the *frame * next outer frame.
24
+
25
+ Return a :term: `strong reference `, or ``NULL `` if *frame * has no outer
26
+ frame.
27
+
28
+ *frame * must not be ``NULL ``.
29
+
30
+ .. versionadded :: 3.9
31
+
32
+
33
+ .. c :function :: PyCodeObject* PyFrame_GetCode (PyFrameObject *frame)
34
+
35
+ Get the *frame * code.
36
+
37
+ Return a :term: `strong reference `.
38
+
39
+ *frame * must not be ``NULL ``. The result (frame code) cannot be ``NULL``.
40
+
41
+ .. versionadded:: 3.9
42
+
43
+
44
+ .. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
45
+
46
+ Return the line number that *frame * is currently executing.
47
+
48
+ *frame * must not be ``NULL ``.
Original file line number Diff line number Diff line change @@ -31,35 +31,6 @@ Reflection
31
31
See also :c:func:`PyThreadState_GetFrame`.
32
32
33
33
34
- .. c:function:: PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
35
-
36
- Get the *frame * next outer frame.
37
-
38
- Return a :term: `strong reference `, or ``NULL `` if *frame * has no outer frame.
39
-
40
- *frame * must not be ``NULL ``.
41
-
42
- .. versionadded :: 3.9
43
-
44
-
45
- .. c :function :: PyCodeObject* PyFrame_GetCode (PyFrameObject *frame)
46
-
47
- Get the *frame * code.
48
-
49
- Return a :term: `strong reference `.
50
-
51
- *frame * must not be ``NULL ``. The result (frame code) cannot be ``NULL``.
52
-
53
- .. versionadded:: 3.9
54
-
55
-
56
- .. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
57
-
58
- Return the line number that *frame * is currently executing.
59
-
60
- *frame * must not be ``NULL ``.
61
-
62
-
63
34
.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
64
35
65
36
Return the name of *func * if it is a function, class or instance object, else the
Original file line number Diff line number Diff line change @@ -286,20 +286,6 @@ the same library that the Python runtime is using.
286
286
<keyword-only_parameter>` arguments and a closure tuple of cells.
287
287
288
288
289
- .. c :type :: PyFrameObject
290
-
291
- The C structure of the objects used to describe frame objects.
292
-
293
- The structure is only part of the internal C API: fields should not be
294
- access directly. Use getter functions like :c:func: `PyFrame_GetCode ` and
295
- :c:func: `PyFrame_GetBack `.
296
-
297
- Debuggers and profilers can use the limited C API to access this structure.
298
-
299
- .. versionchanged :: 3.11
300
- The structure moved to the internal C API headers.
301
-
302
-
303
289
.. c :function :: PyObject* PyEval_EvalFrame (PyFrameObject *f)
304
290
305
291
Evaluate an execution frame. This is a simplified interface to
Original file line number Diff line number Diff line change @@ -968,10 +968,8 @@ Porting to Python 3.11
968
968
* ``f_stackdepth ``: removed.
969
969
* ``f_state ``: no public API (renamed to ``f_frame.f_state ``).
970
970
* ``f_trace ``: no public API.
971
- * ``f_trace_lines ``: use ``PyObject_GetAttrString((PyObject*)frame, "f_trace_lines") ``
972
- (it also be modified).
973
- * ``f_trace_opcodes ``: use ``PyObject_GetAttrString((PyObject*)frame, "f_trace_opcodes") ``
974
- (it also be modified).
971
+ * ``f_trace_lines ``: use ``PyObject_GetAttrString((PyObject*)frame, "f_trace_lines") ``.
972
+ * ``f_trace_opcodes ``: use ``PyObject_GetAttrString((PyObject*)frame, "f_trace_opcodes") ``.
975
973
* ``f_localsplus ``: no public API (renamed to ``f_frame.localsplus ``).
976
974
* ``f_valuestack ``: removed.
977
975
You can’t perform that action at this time.
0 commit comments