Skip to content

Commit 2b4f2f5

Browse files
authored
Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)" (GH-32343)
* Revert "bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API (GH-32054)" This reverts commit f877b40. * Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)" This reverts commit b9a5522.
1 parent 1d3e743 commit 2b4f2f5

File tree

7 files changed

+15
-42
lines changed

7 files changed

+15
-42
lines changed

Doc/c-api/init.rst

+1-10
Original file line numberDiff line numberDiff line change
@@ -1228,25 +1228,18 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
12281228
12291229
.. versionadded:: 3.8
12301230
1231-
.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
1232-
1233-
Internal C API.
1231+
.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, PyFrameObject *frame, int throwflag)
12341232
12351233
Type of a frame evaluation function.
12361234
12371235
The *throwflag* parameter is used by the ``throw()`` method of generators:
12381236
if non-zero, handle the current exception.
12391237
1240-
.. versionchanged:: 3.11
1241-
The second parameter type becomes ``_PyInterpreterFrame``.
1242-
12431238
.. versionchanged:: 3.9
12441239
The function now takes a *tstate* parameter.
12451240
12461241
.. c:function:: _PyFrameEvalFunction _PyInterpreterState_GetEvalFrameFunc(PyInterpreterState *interp)
12471242
1248-
Internal C API.
1249-
12501243
Get the frame evaluation function.
12511244
12521245
See the :pep:`523` "Adding a frame evaluation API to CPython".
@@ -1255,8 +1248,6 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
12551248
12561249
.. c:function:: void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp, _PyFrameEvalFunction eval_frame)
12571250
1258-
Internal C API.
1259-
12601251
Set the frame evaluation function.
12611252
12621253
See the :pep:`523` "Adding a frame evaluation API to CPython".

Doc/whatsnew/3.11.rst

-11
Original file line numberDiff line numberDiff line change
@@ -1338,17 +1338,6 @@ Porting to Python 3.11
13381338
* Distributors are encouraged to build Python with the optimized Blake2
13391339
library `libb2`_.
13401340

1341-
* Move the private undocumented ``_PyEval_EvalFrameDefault()`` function to the
1342-
internal C API. The function now uses the ``_PyInterpreterFrame`` type which
1343-
is part of the internal C API.
1344-
(Contributed by Victor Stinner in :issue:`46850`.)
1345-
1346-
* Move the private ``_PyFrameEvalFunction`` type, and private
1347-
``_PyInterpreterState_GetEvalFrameFunc()`` and
1348-
``_PyInterpreterState_SetEvalFrameFunc()`` functions to the internal C API.
1349-
The ``_PyFrameEvalFunction`` callback function type now uses the
1350-
``_PyInterpreterFrame`` type which is part of the internal C API.
1351-
(Contributed by Victor Stinner in :issue:`46850`.)
13521341

13531342
Deprecated
13541343
----------

Include/cpython/ceval.h

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *);
1515
flag was set, else return 0. */
1616
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
1717

18+
PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc);
19+
1820
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
1921
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
2022

Include/cpython/pystate.h

+10
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
259259
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
260260
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
261261

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+
262272
PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp);
263273

264274
/* Get a copy of the current interpreter configuration.

Include/internal/pycore_ceval.h

-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ extern PyObject* _PyEval_BuiltinsFromGlobals(
5959
PyObject *globals);
6060

6161

62-
PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(
63-
PyThreadState *tstate,
64-
struct _PyInterpreterFrame *frame,
65-
int throwflag);
66-
6762
static inline PyObject*
6863
_PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag)
6964
{

Include/internal/pycore_interp.h

+1-15
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ extern "C" {
1717
#include "pycore_dict.h" // struct _Py_dict_state
1818
#include "pycore_exceptions.h" // struct _Py_exc_state
1919
#include "pycore_floatobject.h" // struct _Py_float_state
20-
#include "pycore_gc.h" // struct _gc_runtime_state
2120
#include "pycore_genobject.h" // struct _Py_async_gen_state
2221
#include "pycore_gil.h" // struct _gil_runtime_state
22+
#include "pycore_gc.h" // struct _gc_runtime_state
2323
#include "pycore_list.h" // struct _Py_list_state
2424
#include "pycore_tuple.h" // struct _Py_tuple_state
2525
#include "pycore_typeobject.h" // struct type_cache
@@ -71,20 +71,6 @@ struct atexit_state {
7171
};
7272

7373

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-
8874
/* interpreter state */
8975

9076
/* PyInterpreterState holds the global state for one of the runtime's

Include/internal/pycore_pystate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#include "pycore_runtime.h" // _PyRuntime
11+
#include "pycore_runtime.h" /* PyRuntimeState */
1212

1313

1414
/* Check if the current thread is the main thread.

0 commit comments

Comments
 (0)