File tree Expand file tree Collapse file tree 6 files changed +38
-13
lines changed Expand file tree Collapse file tree 6 files changed +38
-13
lines changed Original file line number Diff line number Diff line change @@ -1228,18 +1228,25 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
1228
1228
1229
1229
.. versionadded :: 3.8
1230
1230
1231
- .. c :type :: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, PyFrameObject *frame, int throwflag)
1231
+ .. c :type :: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
1232
+
1233
+ Internal C API.
1232
1234
1233
1235
Type of a frame evaluation function.
1234
1236
1235
1237
The *throwflag * parameter is used by the ``throw() `` method of generators:
1236
1238
if non-zero, handle the current exception.
1237
1239
1240
+ .. versionchanged :: 3.11
1241
+ The second parameter type becomes ``_PyInterpreterFrame ``.
1242
+
1238
1243
.. versionchanged :: 3.9
1239
1244
The function now takes a *tstate * parameter.
1240
1245
1241
1246
.. c :function :: _PyFrameEvalFunction _PyInterpreterState_GetEvalFrameFunc (PyInterpreterState *interp)
1242
1247
1248
+ Internal C API.
1249
+
1243
1250
Get the frame evaluation function.
1244
1251
1245
1252
See the :pep: `523 ` "Adding a frame evaluation API to CPython".
@@ -1248,6 +1255,8 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
1248
1255
1249
1256
.. c :function :: void _PyInterpreterState_SetEvalFrameFunc (PyInterpreterState *interp, _PyFrameEvalFunction eval_frame)
1250
1257
1258
+ Internal C API.
1259
+
1251
1260
Set the frame evaluation function.
1252
1261
1253
1262
See the :pep: `523 ` "Adding a frame evaluation API to CPython".
Original file line number Diff line number Diff line change @@ -1102,6 +1102,12 @@ Porting to Python 3.11
1102
1102
is part of the internal C API.
1103
1103
(Contributed by Victor Stinner in :issue: `46850 `.)
1104
1104
1105
+ * Move the private ``_PyFrameEvalFunction `` type, and private
1106
+ ``_PyInterpreterState_GetEvalFrameFunc() `` and
1107
+ ``_PyInterpreterState_SetEvalFrameFunc() `` functions to the internal C API.
1108
+ The ``_PyFrameEvalFunction `` callback function type now uses the
1109
+ ``_PyInterpreterFrame `` type which is part of the internal C API.
1110
+ (Contributed by Victor Stinner in :issue: `46850 `.)
1105
1111
1106
1112
Deprecated
1107
1113
----------
Original file line number Diff line number Diff line change @@ -259,16 +259,6 @@ PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
259
259
PyAPI_FUNC (PyThreadState * ) PyThreadState_Next (PyThreadState * );
260
260
PyAPI_FUNC (void ) PyThreadState_DeleteCurrent (void );
261
261
262
- /* Frame evaluation API */
263
-
264
- typedef PyObject * (* _PyFrameEvalFunction )(PyThreadState * tstate , struct _PyInterpreterFrame * , int );
265
-
266
- PyAPI_FUNC (_PyFrameEvalFunction ) _PyInterpreterState_GetEvalFrameFunc (
267
- PyInterpreterState * interp );
268
- PyAPI_FUNC (void ) _PyInterpreterState_SetEvalFrameFunc (
269
- PyInterpreterState * interp ,
270
- _PyFrameEvalFunction eval_frame );
271
-
272
262
PyAPI_FUNC (const PyConfig * ) _PyInterpreterState_GetConfig (PyInterpreterState * interp );
273
263
274
264
/* Get a copy of the current interpreter configuration.
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ extern "C" {
17
17
#include "pycore_dict.h" // struct _Py_dict_state
18
18
#include "pycore_exceptions.h" // struct _Py_exc_state
19
19
#include "pycore_floatobject.h" // struct _Py_float_state
20
+ #include "pycore_gc.h" // struct _gc_runtime_state
20
21
#include "pycore_genobject.h" // struct _Py_async_gen_state
21
22
#include "pycore_gil.h" // struct _gil_runtime_state
22
- #include "pycore_gc.h" // struct _gc_runtime_state
23
23
#include "pycore_list.h" // struct _Py_list_state
24
24
#include "pycore_tuple.h" // struct _Py_tuple_state
25
25
#include "pycore_typeobject.h" // struct type_cache
@@ -71,6 +71,20 @@ struct atexit_state {
71
71
};
72
72
73
73
74
+ /* Frame evaluation API (PEP 523) */
75
+
76
+ typedef PyObject * (* _PyFrameEvalFunction ) (
77
+ PyThreadState * tstate ,
78
+ struct _PyInterpreterFrame * frame ,
79
+ int throwflag );
80
+
81
+ PyAPI_FUNC (_PyFrameEvalFunction ) _PyInterpreterState_GetEvalFrameFunc (
82
+ PyInterpreterState * interp );
83
+ PyAPI_FUNC (void ) _PyInterpreterState_SetEvalFrameFunc (
84
+ PyInterpreterState * interp ,
85
+ _PyFrameEvalFunction eval_frame );
86
+
87
+
74
88
/* interpreter state */
75
89
76
90
/* PyInterpreterState holds the global state for one of the runtime's
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ extern "C" {
8
8
# error "this header requires Py_BUILD_CORE define"
9
9
#endif
10
10
11
- #include "pycore_runtime.h" /* PyRuntimeState */
11
+ #include "pycore_runtime.h" // _PyRuntime
12
12
13
13
14
14
/* Check if the current thread is the main thread.
Original file line number Diff line number Diff line change
1
+ Move the private ``_PyFrameEvalFunction `` type, and private
2
+ ``_PyInterpreterState_GetEvalFrameFunc() `` and
3
+ ``_PyInterpreterState_SetEvalFrameFunc() `` functions to the internal C API. The
4
+ ``_PyFrameEvalFunction `` callback function type now uses the
5
+ ``_PyInterpreterFrame `` type which is part of the internal C API. Patch by
6
+ Victor Stinner.
You can’t perform that action at this time.
0 commit comments