From 4a6bf276ed3e6687394afe26b0d9a061ac06fc6b Mon Sep 17 00:00:00 2001 From: Nicholas Sim Date: Fri, 19 Feb 2021 22:55:46 +0800 Subject: [PATCH] bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561) Include/{odictobject.h,parser_interface.h,picklebufobject.h,pydebug.h,pyfpe.h} into Include/cpython/. Parser: peg_api: include Python.h instead of parser_interface.h. --- Doc/whatsnew/3.10.rst | 8 +++++ Include/Python.h | 10 +++---- Include/{ => cpython}/odictobject.h | 0 Include/{ => cpython}/parser_interface.h | 0 Include/{ => cpython}/picklebufobject.h | 0 Include/{ => cpython}/pydebug.h | 0 Include/{ => cpython}/pyfpe.h | 0 Makefile.pre.in | 10 +++---- .../2021-02-18-18-46-42.bpo-35134.dFpEDT.rst | 3 ++ PCbuild/pythoncore.vcxproj | 10 +++---- PCbuild/pythoncore.vcxproj.filters | 30 +++++++++---------- Parser/peg_api.c | 2 +- Python/pythonrun.c | 2 -- Tools/scripts/stable_abi.py | 1 - 14 files changed, 42 insertions(+), 34 deletions(-) rename Include/{ => cpython}/odictobject.h (100%) rename Include/{ => cpython}/parser_interface.h (100%) rename Include/{ => cpython}/picklebufobject.h (100%) rename Include/{ => cpython}/pydebug.h (100%) rename Include/{ => cpython}/pyfpe.h (100%) create mode 100644 Misc/NEWS.d/next/C API/2021-02-18-18-46-42.bpo-35134.dFpEDT.rst diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index b903b3e0b81..c4a79b6a1e9 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -934,6 +934,14 @@ Porting to Python 3.10 bugs like ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz and Victor Stinner in :issue:`30459`.) +* The non-limited API files ``odictobject.h``, ``parser_interface.h``, + ``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, + ``pyfpe.h``, and ``pytime.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. + (Contributed by Nicholas Sim in :issue:`35134`) + Deprecated ---------- diff --git a/Include/Python.h b/Include/Python.h index c71a71f875e..86dbbcf6bd8 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -89,7 +89,7 @@ #include "typeslots.h" #include "pyhash.h" -#include "pydebug.h" +#include "cpython/pydebug.h" #include "bytearrayobject.h" #include "bytesobject.h" @@ -104,7 +104,7 @@ #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" -#include "odictobject.h" +#include "cpython/odictobject.h" #include "enumobject.h" #include "setobject.h" #include "methodobject.h" @@ -126,7 +126,7 @@ #include "weakrefobject.h" #include "structseq.h" #include "namespaceobject.h" -#include "picklebufobject.h" +#include "cpython/picklebufobject.h" #include "cpython/pytime.h" #include "codecs.h" @@ -141,7 +141,7 @@ #include "modsupport.h" #include "compile.h" #include "pythonrun.h" -#include "parser_interface.h" +#include "cpython/parser_interface.h" #include "pylifecycle.h" #include "ceval.h" #include "sysmodule.h" @@ -158,7 +158,7 @@ #include "pystrtod.h" #include "pystrcmp.h" #include "fileutils.h" -#include "pyfpe.h" +#include "cpython/pyfpe.h" #include "tracemalloc.h" #endif /* !Py_PYTHON_H */ diff --git a/Include/odictobject.h b/Include/cpython/odictobject.h similarity index 100% rename from Include/odictobject.h rename to Include/cpython/odictobject.h diff --git a/Include/parser_interface.h b/Include/cpython/parser_interface.h similarity index 100% rename from Include/parser_interface.h rename to Include/cpython/parser_interface.h diff --git a/Include/picklebufobject.h b/Include/cpython/picklebufobject.h similarity index 100% rename from Include/picklebufobject.h rename to Include/cpython/picklebufobject.h diff --git a/Include/pydebug.h b/Include/cpython/pydebug.h similarity index 100% rename from Include/pydebug.h rename to Include/cpython/pydebug.h diff --git a/Include/pyfpe.h b/Include/cpython/pyfpe.h similarity index 100% rename from Include/pyfpe.h rename to Include/cpython/pyfpe.h diff --git a/Makefile.pre.in b/Makefile.pre.in index e4ac248d1f0..0f597009529 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -316,7 +316,7 @@ PEGEN_OBJS= \ PEGEN_HEADERS= \ - $(srcdir)/Include/parser_interface.h \ + $(srcdir)/Include/cpython/parser_interface.h \ $(srcdir)/Parser/pegen.h \ $(srcdir)/Parser/string_parser.h @@ -1056,17 +1056,13 @@ PYTHON_HEADERS= \ $(srcdir)/Include/namespaceobject.h \ $(srcdir)/Include/object.h \ $(srcdir)/Include/objimpl.h \ - $(srcdir)/Include/odictobject.h \ $(srcdir)/Include/opcode.h \ $(srcdir)/Include/osdefs.h \ $(srcdir)/Include/osmodule.h \ $(srcdir)/Include/patchlevel.h \ - $(srcdir)/Include/picklebufobject.h \ $(srcdir)/Include/pycapsule.h \ - $(srcdir)/Include/pydebug.h \ $(srcdir)/Include/pydtrace.h \ $(srcdir)/Include/pyerrors.h \ - $(srcdir)/Include/pyfpe.h \ $(srcdir)/Include/pyframe.h \ $(srcdir)/Include/pyhash.h \ $(srcdir)/Include/pylifecycle.h \ @@ -1116,9 +1112,13 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/methodobject.h \ $(srcdir)/Include/cpython/object.h \ $(srcdir)/Include/cpython/objimpl.h \ + $(srcdir)/Include/cpython/odictobject.h \ + $(srcdir)/Include/cpython/picklebufobject.h \ $(srcdir)/Include/cpython/pyarena.h \ $(srcdir)/Include/cpython/pyctype.h \ + $(srcdir)/Include/cpython/pydebug.h \ $(srcdir)/Include/cpython/pyerrors.h \ + $(srcdir)/Include/cpython/pyfpe.h \ $(srcdir)/Include/cpython/pylifecycle.h \ $(srcdir)/Include/cpython/pymem.h \ $(srcdir)/Include/cpython/pystate.h \ diff --git a/Misc/NEWS.d/next/C API/2021-02-18-18-46-42.bpo-35134.dFpEDT.rst b/Misc/NEWS.d/next/C API/2021-02-18-18-46-42.bpo-35134.dFpEDT.rst new file mode 100644 index 00000000000..5384cb8288f --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-02-18-18-46-42.bpo-35134.dFpEDT.rst @@ -0,0 +1,3 @@ +Move odictobject.h, parser_interface.h, picklebufobject.h, pydebug.h, and +pyfpe.h into the cpython/ directory. They must not be included directly, as +they are already included by Python.h: :ref:`Include Files `. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 89b6218a273..92355a886d9 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -142,9 +142,14 @@ + + + + + @@ -220,19 +225,14 @@ - - - - - diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index bd8fd3433bc..d0b69dbc5b6 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -171,27 +171,18 @@ Include - - Include - Include Include - - Include - Include Include - - Include - Include @@ -378,9 +369,6 @@ Modules - - Include - Parser @@ -420,6 +408,9 @@ Include\cpython + + Include + Include\cpython @@ -432,15 +423,27 @@ Include\cpython + + Include + + + Include + Include Include + + Include + Include\cpython + + Include + Include\cpython @@ -474,9 +477,6 @@ Include\cpython - - Include - Include\internal diff --git a/Parser/peg_api.c b/Parser/peg_api.c index 8381d5e86b0..1555dea51c2 100644 --- a/Parser/peg_api.c +++ b/Parser/peg_api.c @@ -1,4 +1,4 @@ -#include "parser_interface.h" +#include "Python.h" #include "tokenizer.h" #include "pegen.h" diff --git a/Python/pythonrun.c b/Python/pythonrun.c index dacf1a64710..338a1b96d39 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -26,8 +26,6 @@ #include "symtable.h" // PySymtable_BuildObject() #include "marshal.h" // PyMarshal_ReadLongFromFile() -#include "parser_interface.h" // PyParser_ASTFrom* - #ifdef MS_WINDOWS # include "malloc.h" // alloca() #endif diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py index 44f426e096a..cc1009da1bd 100755 --- a/Tools/scripts/stable_abi.py +++ b/Tools/scripts/stable_abi.py @@ -23,7 +23,6 @@ EXCLUDED_HEADERS = { "longintrepr.h", "parsetok.h", "pyatomic.h", - "pydebug.h", "pytime.h", "symtable.h", "token.h",