]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)"...
authorVictor Stinner <vstinner@python.org>
Wed, 6 Apr 2022 11:58:07 +0000 (13:58 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Apr 2022 11:58:07 +0000 (13:58 +0200)
* Revert "bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API (GH-32054)"

This reverts commit f877b40e3f7e0d97878884d80fbec879a85ab7e8.

* Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)"

This reverts commit b9a5522dd952125a99ff554f01f311cae25f5a91.

Doc/c-api/init.rst
Doc/whatsnew/3.11.rst
Include/cpython/ceval.h
Include/cpython/pystate.h
Include/internal/pycore_ceval.h
Include/internal/pycore_interp.h
Include/internal/pycore_pystate.h

index 82c4acebf1bc9f2df8310290699befa9b6142ab9..3fda9c3af4d2a56e37d36482a57a642f0f8a8045 100644 (file)
@@ -1228,25 +1228,18 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
 
    .. versionadded:: 3.8
 
-.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
-
-   Internal C API.
+.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, PyFrameObject *frame, int throwflag)
 
    Type of a frame evaluation function.
 
    The *throwflag* parameter is used by the ``throw()`` method of generators:
    if non-zero, handle the current exception.
 
-   .. versionchanged:: 3.11
-      The second parameter type becomes ``_PyInterpreterFrame``.
-
    .. versionchanged:: 3.9
       The function now takes a *tstate* parameter.
 
 .. c:function:: _PyFrameEvalFunction _PyInterpreterState_GetEvalFrameFunc(PyInterpreterState *interp)
 
-   Internal C API.
-
    Get the frame evaluation function.
 
    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`.
 
 .. c:function:: void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp, _PyFrameEvalFunction eval_frame)
 
-   Internal C API.
-
    Set the frame evaluation function.
 
    See the :pep:`523` "Adding a frame evaluation API to CPython".
index a572ff6981462f95748fc90ea0f69ab0faf18150..d58056394d86467bfa7d497e53cd61f979b7d976 100644 (file)
@@ -1338,17 +1338,6 @@ Porting to Python 3.11
 * Distributors are encouraged to build Python with the optimized Blake2
   library `libb2`_.
 
-* Move the private undocumented ``_PyEval_EvalFrameDefault()`` function to the
-  internal C API. The function now uses the ``_PyInterpreterFrame`` type which
-  is part of the internal C API.
-  (Contributed by Victor Stinner in :issue:`46850`.)
-
-* Move the private ``_PyFrameEvalFunction`` type, and private
-  ``_PyInterpreterState_GetEvalFrameFunc()`` and
-  ``_PyInterpreterState_SetEvalFrameFunc()`` functions to the internal C API.
-  The ``_PyFrameEvalFunction`` callback function type now uses the
-  ``_PyInterpreterFrame`` type which is part of the internal C API.
-  (Contributed by Victor Stinner in :issue:`46850`.)
 
 Deprecated
 ----------
index 65aae2d669a52d27578fd7f0eb05af7c6d601967..9d4eeafb427eb28b376bc7116b4d56dfff16b9d9 100644 (file)
@@ -15,6 +15,8 @@ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *);
    flag was set, else return 0. */
 PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
 
+PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc);
+
 PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
 PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
 
index e346d744b6f12da9d3ae367885446e21679544d8..1af21a2c947d9966b9f257ada1cac3bb345a7093 100644 (file)
@@ -259,6 +259,16 @@ PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
 PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
 PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
 
+/* Frame evaluation API */
+
+typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int);
+
+PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc(
+    PyInterpreterState *interp);
+PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
+    PyInterpreterState *interp,
+    _PyFrameEvalFunction eval_frame);
+
 PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp);
 
 /* Get a copy of the current interpreter configuration.
index b29b496ee3f58ee91c94498021d6727a7903101d..45d26a37a34c695751b6d5af39300913d24ec063 100644 (file)
@@ -59,11 +59,6 @@ extern PyObject* _PyEval_BuiltinsFromGlobals(
     PyObject *globals);
 
 
-PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(
-    PyThreadState *tstate,
-    struct _PyInterpreterFrame *frame,
-    int throwflag);
-
 static inline PyObject*
 _PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag)
 {
index 592d438bcf1d241b3727097e43a988da5a240657..d55627908a28f89967516c39801ee300538a4d0d 100644 (file)
@@ -17,9 +17,9 @@ extern "C" {
 #include "pycore_dict.h"          // struct _Py_dict_state
 #include "pycore_exceptions.h"    // struct _Py_exc_state
 #include "pycore_floatobject.h"   // struct _Py_float_state
-#include "pycore_gc.h"            // struct _gc_runtime_state
 #include "pycore_genobject.h"     // struct _Py_async_gen_state
 #include "pycore_gil.h"           // struct _gil_runtime_state
+#include "pycore_gc.h"            // struct _gc_runtime_state
 #include "pycore_list.h"          // struct _Py_list_state
 #include "pycore_tuple.h"         // struct _Py_tuple_state
 #include "pycore_typeobject.h"    // struct type_cache
@@ -71,20 +71,6 @@ struct atexit_state {
 };
 
 
-/* Frame evaluation API (PEP 523) */
-
-typedef PyObject* (*_PyFrameEvalFunction) (
-    PyThreadState *tstate,
-    struct _PyInterpreterFrame *frame,
-    int throwflag);
-
-PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc(
-    PyInterpreterState *interp);
-PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
-    PyInterpreterState *interp,
-    _PyFrameEvalFunction eval_frame);
-
-
 /* interpreter state */
 
 /* PyInterpreterState holds the global state for one of the runtime's
index c463347dbf06aed725de9cf8507e4ac90ceb74e3..c4bc53c707fdafc693d624184aca9d9a1a15b79c 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_runtime.h"       // _PyRuntime
+#include "pycore_runtime.h"   /* PyRuntimeState */
 
 
 /* Check if the current thread is the main thread.