From 105582e74c1817bc6a9d99bcb6540b34a3367292 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 15 Oct 2021 13:06:05 +0200 Subject: bpo-45434: Remove Include/eval.h header file (GH-28973) Move Include/eval.h content into Include/ceval.h and Include/cpython/ceval.h, and remove Include/eval.h. --- Doc/faq/extending.rst | 3 --- Doc/faq/windows.rst | 2 +- Doc/whatsnew/3.11.rst | 10 ++++---- Include/Python.h | 1 - Include/ceval.h | 12 +++++++++- Include/cpython/ceval.h | 2 ++ Include/eval.h | 27 ---------------------- Makefile.pre.in | 1 - .../C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst | 11 +++++---- PCbuild/pythoncore.vcxproj | 1 - PCbuild/pythoncore.vcxproj.filters | 3 --- 11 files changed, 26 insertions(+), 47 deletions(-) delete mode 100644 Include/eval.h diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst index 3379e41..fd32b09 100644 --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -290,9 +290,6 @@ complete example using the GNU readline library (you may want to ignore #define PY_SSIZE_T_CLEAN #include - #include - #include - #include int main (int argc, char* argv[]) { diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index 0153a4f..6b95819 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -212,7 +212,7 @@ Embedding the Python interpreter in a Windows app can be summarized as follows: .. code-block:: c - #include "python.h" + #include ... Py_Initialize(); // Initialize Python. initmyAppc(); // Initialize (import) the helper class. diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 2e95228..994fb84 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -573,11 +573,11 @@ Porting to Python 3.11 (Contributed by Victor Stinner in :issue:`45434`.) * The non-limited API files ``cellobject.h``, ``classobject.h``, ``context.h``, - ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have been - moved to the ``Include/cpython`` directory. These files must not be included - directly, as they are already included in ``Python.h``: :ref:`Include Files - `. If they have been included directly, consider including - ``Python.h`` instead. + ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have been moved to + the ``Include/cpython`` directory. Moreover, the ``eval.h`` header file was + removed. These files must not be included directly, as they are already + included in ``Python.h``: :ref:`Include Files `. If they have + been included directly, consider including ``Python.h`` instead. (Contributed by Victor Stinner in :issue:`35134`.) Deprecated diff --git a/Include/Python.h b/Include/Python.h index bc8d4f9..a2de514 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -96,7 +96,6 @@ #include "import.h" #include "abstract.h" #include "bltinmodule.h" -#include "eval.h" #include "cpython/pyctype.h" #include "pystrtod.h" #include "pystrcmp.h" diff --git a/Include/ceval.h b/Include/ceval.h index cf8c5b1..1b57f6e 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -1,3 +1,5 @@ +/* Interface to random parts in ceval.c */ + #ifndef Py_CEVAL_H #define Py_CEVAL_H #ifdef __cplusplus @@ -5,7 +7,15 @@ extern "C" { #endif -/* Interface to random parts in ceval.c */ +PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, + PyObject *globals, + PyObject *locals, + PyObject *const *args, int argc, + PyObject *const *kwds, int kwdc, + PyObject *const *defs, int defc, + PyObject *kwdefs, PyObject *closure); /* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction * and PyEval_CallMethod are deprecated. Since they are officially part of the diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h index 44b78f6..caf6440 100644 --- a/Include/cpython/ceval.h +++ b/Include/cpython/ceval.h @@ -2,6 +2,8 @@ # error "this header file must not be included directly" #endif +PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); + PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); diff --git a/Include/eval.h b/Include/eval.h deleted file mode 100644 index eda28df..0000000 --- a/Include/eval.h +++ /dev/null @@ -1,27 +0,0 @@ - -/* Interface to execute compiled code */ - -#ifndef Py_EVAL_H -#define Py_EVAL_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); - -PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, - PyObject *globals, - PyObject *locals, - PyObject *const *args, int argc, - PyObject *const *kwds, int kwdc, - PyObject *const *defs, int defc, - PyObject *kwdefs, PyObject *closure); - -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !Py_EVAL_H */ diff --git a/Makefile.pre.in b/Makefile.pre.in index ccce52b..b79b71f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1137,7 +1137,6 @@ PYTHON_HEADERS= \ $(srcdir)/Include/dynamic_annotations.h \ $(srcdir)/Include/enumobject.h \ $(srcdir)/Include/errcode.h \ - $(srcdir)/Include/eval.h \ $(srcdir)/Include/fileobject.h \ $(srcdir)/Include/fileutils.h \ $(srcdir)/Include/floatobject.h \ diff --git a/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst b/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst index 4ab1088..d0d3ce6 100644 --- a/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst +++ b/Misc/NEWS.d/next/C API/2021-10-15-00-11-51.bpo-35134.eX4zqy.rst @@ -1,4 +1,7 @@ -Move ``cellobject.h``, ``classobject.h``, ``context.h``, ``funcobject.h``, -``genobject.h`` and ``longintrepr.h`` header files from ``Include/`` to -``Include/cpython/``. C extensions should only include the main ```` -header. Patch by Victor Stinner. +The non-limited API files ``cellobject.h``, ``classobject.h``, ``context.h``, +``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have been moved to +the ``Include/cpython`` directory. Moreover, the ``eval.h`` header file was +removed. These files must not be included directly, as they are already +included in ``Python.h``: :ref:`Include Files `. If they have +been included directly, consider including ``Python.h`` instead. +Patch by Victor Stinner. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 32511d2..357d0a7 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -166,7 +166,6 @@ - diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 4cc1092..1a3ad88 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -84,9 +84,6 @@ Include - - Include - Include -- cgit v0.12