Skip to content
11 changes: 6 additions & 5 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1252,13 +1252,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``
* The non-limited API files ``asdl.h``, ``odictobject.h``,
``parser_interface.h``, ``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``,
``pydebug.h``, ``pyfpe.h``, ``pystrhex.h``, ``pytime.h``, ``symtable.h``,
``token.h``, and ``tracemalloc.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 <api-includes>`. If they have
been included directly, consider including ``Python.h`` instead.
(Contributed by Nicholas Sim in :issue:`35134`)
been included directly, consider including ``Python.h`` instead. (Contributed
by Nicholas Sim in :issue:`35134`)

Deprecated
----------
Expand Down
2 changes: 1 addition & 1 deletion Include/Python-ast.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@
#include "cpython/pyctype.h"
#include "pystrtod.h"
#include "pystrcmp.h"
#include "cpython/pystrhex.h"
#include "fileutils.h"
#include "cpython/pyfpe.h"
#include "tracemalloc.h"
#include "cpython/tracemalloc.h"
#include "cpython/asdl.h"
#include "cpython/symtable.h"

#endif /* !Py_PYTHON_H */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,11 @@ regen-token:
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py rst \
$(srcdir)/Grammar/Tokens \
$(srcdir)/Doc/library/token-list.inc
# Regenerate Include/token.h from Grammar/Tokens
# Regenerate Include/cpython/token.h from Grammar/Tokens
# using Tools/scripts/generate_token.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py h \
$(srcdir)/Grammar/Tokens \
$(srcdir)/Include/token.h
$(srcdir)/Include/cpython/token.h
# Regenerate Parser/token.c from Grammar/Tokens
# using Tools/scripts/generate_token.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py c \
Expand Down Expand Up @@ -1015,7 +1015,6 @@ regen-typeslots:
PYTHON_HEADERS= \
$(srcdir)/Include/Python.h \
$(srcdir)/Include/abstract.h \
$(srcdir)/Include/asdl.h \
$(srcdir)/Include/ast.h \
$(srcdir)/Include/bltinmodule.h \
$(srcdir)/Include/boolobject.h \
Expand Down Expand Up @@ -1073,7 +1072,6 @@ PYTHON_HEADERS= \
$(srcdir)/Include/pyport.h \
$(srcdir)/Include/pystate.h \
$(srcdir)/Include/pystrcmp.h \
$(srcdir)/Include/pystrhex.h \
$(srcdir)/Include/pystrtod.h \
$(srcdir)/Include/pythonrun.h \
$(srcdir)/Include/pythread.h \
Expand All @@ -1082,11 +1080,8 @@ PYTHON_HEADERS= \
$(srcdir)/Include/sliceobject.h \
$(srcdir)/Include/structmember.h \
$(srcdir)/Include/structseq.h \
$(srcdir)/Include/symtable.h \
$(srcdir)/Include/sysmodule.h \
$(srcdir)/Include/token.h \
$(srcdir)/Include/traceback.h \
$(srcdir)/Include/tracemalloc.h \
$(srcdir)/Include/tupleobject.h \
$(srcdir)/Include/unicodeobject.h \
$(srcdir)/Include/warnings.h \
Expand All @@ -1097,6 +1092,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/Python-ast.h \
\
$(srcdir)/Include/cpython/abstract.h \
$(srcdir)/Include/cpython/asdl.h \
$(srcdir)/Include/cpython/bytearrayobject.h \
$(srcdir)/Include/cpython/bytesobject.h \
$(srcdir)/Include/cpython/ceval.h \
Expand All @@ -1122,10 +1118,14 @@ PYTHON_HEADERS= \
$(srcdir)/Include/cpython/pylifecycle.h \
$(srcdir)/Include/cpython/pymem.h \
$(srcdir)/Include/cpython/pystate.h \
$(srcdir)/Include/cpython/pystrhex.h \
$(srcdir)/Include/cpython/pythonrun.h \
$(srcdir)/Include/cpython/pytime.h \
$(srcdir)/Include/cpython/symtable.h \
$(srcdir)/Include/cpython/sysmodule.h \
$(srcdir)/Include/cpython/token.h \
$(srcdir)/Include/cpython/traceback.h \
$(srcdir)/Include/cpython/tracemalloc.h \
$(srcdir)/Include/cpython/tupleobject.h \
$(srcdir)/Include/cpython/unicodeobject.h \
\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Move asdl.h, pystrhex.h, symtable.h, token.h, and tracemalloc.h into the
cpython/ directory. They must not be included directly, as they are already
included by Python.h: :ref:`Include Files <api-includes>`.
1 change: 0 additions & 1 deletion Modules/_blake2/blake2b_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

#include "Python.h"
#include "pystrhex.h"

#include "../hashlib.h"
#include "blake2ns.h"
Expand Down
1 change: 0 additions & 1 deletion Modules/_blake2/blake2s_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

#include "Python.h"
#include "pystrhex.h"

#include "../hashlib.h"
#include "blake2ns.h"
Expand Down
1 change: 0 additions & 1 deletion Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "Python.h"
#include "hashlib.h"
#include "pystrhex.h"


/* EVP is the preferred interface to hashing in OpenSSL */
Expand Down
1 change: 0 additions & 1 deletion Modules/_sha3/sha3module.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

#include "Python.h"
#include "pystrhex.h"
#include "../hashlib.h"

/* **************************************************************************
Expand Down
1 change: 0 additions & 1 deletion Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#define PY_SSIZE_T_CLEAN

#include "Python.h"
#include "pystrhex.h"
#ifdef USE_ZLIB_CRC32
#include "zlib.h"
#endif
Expand Down
1 change: 0 additions & 1 deletion Modules/md5module.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "Python.h"
#include "hashlib.h"
#include "pystrhex.h"

/*[clinic input]
module _md5
Expand Down
1 change: 0 additions & 1 deletion Modules/sha1module.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "Python.h"
#include "hashlib.h"
#include "pystrhex.h"

/*[clinic input]
module _sha1
Expand Down
1 change: 0 additions & 1 deletion Modules/sha256module.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "pycore_bitutils.h" // _Py_bswap32()
#include "structmember.h" // PyMemberDef
#include "hashlib.h"
#include "pystrhex.h"

/*[clinic input]
module _sha256
Expand Down
1 change: 0 additions & 1 deletion Modules/sha512module.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "pycore_bitutils.h" // _Py_bswap64()
#include "structmember.h" // PyMemberDef
#include "hashlib.h"
#include "pystrhex.h"

/*[clinic input]
module _sha512
Expand Down
1 change: 0 additions & 1 deletion Modules/symtablemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "code.h"
#include "Python-ast.h"
#include "symtable.h"

#include "clinic/symtablemodule.c.h"
/*[clinic input]
Expand Down
1 change: 0 additions & 1 deletion Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "pycore_bytes_methods.h"
#include "pycore_object.h"
#include "bytesobject.h"
#include "pystrhex.h"

/*[clinic input]
class bytearray "PyByteArrayObject *" "&PyByteArray_Type"
Expand Down
1 change: 0 additions & 1 deletion Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "pycore_object.h" // _PyObject_GC_TRACK
#include "pycore_pymem.h" // PYMEM_CLEANBYTE

#include "pystrhex.h"
#include <stddef.h>

/*[clinic input]
Expand Down
1 change: 0 additions & 1 deletion Objects/memoryobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_object.h"
#include "pystrhex.h"
#include <stddef.h>

/*[clinic input]
Expand Down
10 changes: 5 additions & 5 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<ClInclude Include="..\Include\Python-ast.h" />
<ClInclude Include="..\Include\Python.h" />
<ClInclude Include="..\Include\abstract.h" />
<ClInclude Include="..\Include\asdl.h" />
<ClInclude Include="..\Include\ast.h" />
<ClInclude Include="..\Include\boolobject.h" />
<ClInclude Include="..\Include\bytearrayobject.h" />
Expand All @@ -127,6 +126,7 @@
<ClInclude Include="..\Include\complexobject.h" />
<ClInclude Include="..\Include\context.h" />
<ClInclude Include="..\Include\cpython\abstract.h" />
<ClInclude Include="..\Include\cpython\asdl.h" />
<ClInclude Include="..\Include\cpython\bytearrayobject.h" />
<ClInclude Include="..\Include\cpython\bytesobject.h" />
<ClInclude Include="..\Include\cpython\ceval.h" />
Expand All @@ -153,10 +153,14 @@
<ClInclude Include="..\Include\cpython\pylifecycle.h" />
<ClInclude Include="..\Include\cpython\pymem.h" />
<ClInclude Include="..\Include\cpython\pystate.h" />
<ClInclude Include="..\Include\cpython\pystrhex.h" />
<ClInclude Include="..\Include\cpython\pythonrun.h" />
<ClInclude Include="..\Include\cpython\pytime.h" />
<ClInclude Include="..\Include\cpython\symtable.h" />
<ClInclude Include="..\Include\cpython\sysmodule.h" />
<ClInclude Include="..\Include\cpython\token.h" />
<ClInclude Include="..\Include\cpython\traceback.h" />
<ClInclude Include="..\Include\cpython\tracemalloc.h" />
<ClInclude Include="..\Include\cpython\tupleobject.h" />
<ClInclude Include="..\Include\cpython\unicodeobject.h" />
<ClInclude Include="..\Include\datetime.h" />
Expand Down Expand Up @@ -242,7 +246,6 @@
<ClInclude Include="..\Include\pyport.h" />
<ClInclude Include="..\Include\pystate.h" />
<ClInclude Include="..\Include\pystrcmp.h" />
<ClInclude Include="..\Include\pystrhex.h" />
<ClInclude Include="..\Include\pystrtod.h" />
<ClInclude Include="..\Include\pythonrun.h" />
<ClInclude Include="..\Include\pythread.h" />
Expand All @@ -251,11 +254,8 @@
<ClInclude Include="..\Include\sliceobject.h" />
<ClInclude Include="..\Include\structmember.h" />
<ClInclude Include="..\Include\structseq.h" />
<ClInclude Include="..\Include\symtable.h" />
<ClInclude Include="..\Include\sysmodule.h" />
<ClInclude Include="..\Include\token.h" />
<ClInclude Include="..\Include\traceback.h" />
<ClInclude Include="..\Include\tracemalloc.h" />
<ClInclude Include="..\Include\tupleobject.h" />
<ClInclude Include="..\Include\unicodeobject.h" />
<ClInclude Include="..\Include\weakrefobject.h" />
Expand Down
30 changes: 15 additions & 15 deletions PCbuild/pythoncore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
<ClInclude Include="..\Include\abstract.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\asdl.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\ast.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -207,9 +204,6 @@
<ClInclude Include="..\Include\pystrtod.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\pystrhex.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\Python-ast.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -237,21 +231,12 @@
<ClInclude Include="..\Include\structseq.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\symtable.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\sysmodule.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\token.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\traceback.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\tracemalloc.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\tupleobject.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -381,6 +366,9 @@
<ClInclude Include="..\Include\cpython\abstract.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\asdl.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\bytearrayobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand Down Expand Up @@ -450,6 +438,9 @@
<ClInclude Include="..\Include\cpython\pylifecycle.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\pystrhex.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\pytime.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand All @@ -468,9 +459,18 @@
<ClInclude Include="..\Include\cpython\pythonrun.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\symtable.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\sysmodule.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\token.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\tracemalloc.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\pystate.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand Down
6 changes: 3 additions & 3 deletions PCbuild/regen.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
</None>
<None Include="..\Grammar\Tokens">
</None>
<None Include="..\Include\token.h">
<None Include="..\Include\cpython\token.h">
</None>
<None Include="..\Include\opcode.h">
</None>
Expand Down Expand Up @@ -187,8 +187,8 @@
<Target Name="_RegenTokens" AfterTargets="_RegenOpcodes">
<!-- Regenerate Doc/library/token-list.inc from Grammar/Tokens using Tools/scripts/generate_token.py-->
<Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py rst &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Doc\library\token-list.inc&quot;" />
<!-- Regenerate Include/token.h from Grammar/Tokens using Tools/scripts/generate_token.py-->
<Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py h &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Include\token.h&quot;" />
<!-- Regenerate Include/cpython/token.h from Grammar/Tokens using Tools/scripts/generate_token.py-->
<Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py h &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Include\cpython\token.h&quot;" />
<!-- Regenerate Parser/token.c from Grammar/Tokens using Tools/scripts/generate_token.py-->
<Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py c &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Parser\token.c&quot;" />
<!-- Regenerate Lib/token.py from Grammar/Tokens using Tools/scripts/generate_token.py -->
Expand Down
2 changes: 1 addition & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ def write_header(mod, f):
f.write('#endif\n')
f.write('\n')
f.write('#ifndef Py_LIMITED_API\n')
f.write('#include "asdl.h"\n')
f.write('#include "cpython/asdl.h"\n')
f.write('\n')
f.write('#undef Yield /* undefine macro conflicting with <winbase.h> */\n')
f.write('\n')
Expand Down
2 changes: 1 addition & 1 deletion Parser/pegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <token.h>
#include <cpython/token.h>
#include <Python-ast.h>

#if 0
Expand Down
2 changes: 1 addition & 1 deletion Parser/token.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading