diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 310554eabe6706e..078c87eb55fd913 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -957,6 +957,10 @@ Porting to Python 3.10 been included directly, consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :issue:`35134`) +* The non-limited API file ``pyarena.h`` has been moved to the + ``Include/internal/pycore_arena.h``. + (Contributed by Hai Shi in :issue:`43244`.) + Deprecated ---------- diff --git a/Include/Python-ast.h b/Include/Python-ast.h index bd127ca2ab0cad2..dbfbea58d264a7a 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -8,6 +8,7 @@ extern "C" { #ifndef Py_LIMITED_API #include "asdl.h" +#include "pycore_arena.h" #undef Yield /* undefine macro conflicting with */ diff --git a/Include/Python.h b/Include/Python.h index 86dbbcf6bd85da6..e3e1486c6561922 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -137,7 +137,6 @@ #include "pystate.h" #include "context.h" -#include "cpython/pyarena.h" #include "modsupport.h" #include "compile.h" #include "pythonrun.h" diff --git a/Include/compile.h b/Include/compile.h index 4dd5435ce71a965..d01301311acc3f1 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -7,6 +7,8 @@ extern "C" { #endif +#include "internal/pycore_arena.h" // struct PyArena + /* Public interface */ #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ diff --git a/Include/cpython/pyarena.h b/Include/internal/pycore_arena.h similarity index 100% rename from Include/cpython/pyarena.h rename to Include/internal/pycore_arena.h diff --git a/Makefile.pre.in b/Makefile.pre.in index 0f59700952989e0..24156f07bbbe56f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1114,7 +1114,6 @@ PYTHON_HEADERS= \ $(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 \ @@ -1129,6 +1128,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/tupleobject.h \ $(srcdir)/Include/cpython/unicodeobject.h \ \ + $(srcdir)/Include/internal/pycore_arena.h \ $(srcdir)/Include/internal/pycore_abstract.h \ $(srcdir)/Include/internal/pycore_accu.h \ $(srcdir)/Include/internal/pycore_atomic.h \ diff --git a/Misc/NEWS.d/next/C API/2021-03-02-01-31-58.bpo-43244.SuTGYi.rst b/Misc/NEWS.d/next/C API/2021-03-02-01-31-58.bpo-43244.SuTGYi.rst new file mode 100644 index 000000000000000..7837f2172916349 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-03-02-01-31-58.bpo-43244.SuTGYi.rst @@ -0,0 +1,2 @@ +The non-limited API file ``pyarena.h`` has been moved to the +``Include/internal/pycore_arena.h``. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 92355a886d91a75..93f3c191429fac9 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -145,7 +145,6 @@ - @@ -173,6 +172,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index d0b69dbc5b64fd1..c65b000689865e3 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -429,9 +429,6 @@ Include - - Include - Include @@ -477,6 +474,9 @@ Include\cpython + + Include\internal + Include\internal diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 8c167bc79c779bf..46fe83c52d6e1bf 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1499,6 +1499,7 @@ def write_header(mod, f): f.write('\n') f.write('#ifndef Py_LIMITED_API\n') f.write('#include "asdl.h"\n') + f.write('#include "pycore_arena.h"\n') f.write('\n') f.write('#undef Yield /* undefine macro conflicting with */\n') f.write('\n') @@ -1549,6 +1550,8 @@ def write_source(mod, f, internal_h_file): #include #include "Python.h" + + #include "pycore_arena.h" """), file=f) generate_module_def(mod, f, internal_h_file) diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 439da8f2512ef22..3f35b001f5f06cf 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -5,6 +5,8 @@ #include "Python.h" +#include "pycore_arena.h" + #ifdef Py_BUILD_CORE # include "pycore_ast.h" // struct ast_state # include "pycore_interp.h" // _PyInterpreterState.ast diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index dec2984a068df27..750ea21c64adb3c 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -4,6 +4,7 @@ #include #include "ast.h" #undef Yield /* undefine macro conflicting with */ +#include "pycore_arena.h" // struct PyArena #include "pycore_object.h" // _Py_AddToAllObjects() #include "pycore_pyerrors.h" // _PyErr_NoMemory() #include "pycore_pystate.h" // _PyThreadState_GET() diff --git a/Python/compile.c b/Python/compile.c index 454005eb7b0cbe2..1585bc7333b8dfa 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -22,6 +22,7 @@ */ #include "Python.h" +#include "pycore_arena.h" // struct PyArena #include "pycore_pymem.h" // _PyMem_IsPtrFreed() #include "pycore_long.h" // _PyLong_GetZero() diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 338a1b96d39e1b4..2ff1bdfd39bde7a 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -13,6 +13,7 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with */ +#include "pycore_arena.h" // struct PyArena #include "pycore_interp.h" // PyInterpreterState.importlib #include "pycore_object.h" // _PyDebug_PrintTotalRefs() #include "pycore_pyerrors.h" // _PyErr_Fetch diff --git a/Tools/peg_generator/peg_extension/peg_extension.c b/Tools/peg_generator/peg_extension/peg_extension.c index 96d3a52b8808803..16d321090dd338c 100644 --- a/Tools/peg_generator/peg_extension/peg_extension.c +++ b/Tools/peg_generator/peg_extension/peg_extension.c @@ -1,4 +1,5 @@ #include "pegen.h" +#include "pycore_arena.h" //struct PyArena PyObject * _build_return_object(mod_ty module, int mode, PyObject *filename_ob, PyArena *arena)