summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-17 22:11:03 (GMT)
committerGitHub <noreply@github.com>2021-03-17 22:11:03 (GMT)
commitb4536e1c6abe4c6219177a89e16575d05ea22f64 (patch)
treebade8c2412e0b83d00e737ce465214d2033cf5f3
parente272528bbd5e0b081dbffa73b1a6908f3992d13c (diff)
downloadcpython-b4536e1c6abe4c6219177a89e16575d05ea22f64.zip
cpython-b4536e1c6abe4c6219177a89e16575d05ea22f64.tar.gz
cpython-b4536e1c6abe4c6219177a89e16575d05ea22f64.tar.bz2
bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)
-rw-r--r--Include/internal/pycore_ast_state.h (renamed from Include/internal/pycore_ast.h)6
-rw-r--r--Include/internal/pycore_interp.h2
-rw-r--r--Makefile.pre.in5
-rw-r--r--PCbuild/pythoncore.vcxproj1
-rw-r--r--PCbuild/pythoncore.vcxproj.filters3
-rw-r--r--PCbuild/regen.vcxproj10
-rwxr-xr-xParser/asdl_c.py8
-rw-r--r--Python/Python-ast.c2
8 files changed, 21 insertions, 16 deletions
diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast_state.h
index 2d0c5fb..c5ae224 100644
--- a/Include/internal/pycore_ast.h
+++ b/Include/internal/pycore_ast_state.h
@@ -1,7 +1,7 @@
// File automatically generated by Parser/asdl_c.py.
-#ifndef Py_INTERNAL_AST_H
-#define Py_INTERNAL_AST_H
+#ifndef Py_INTERNAL_AST_STATE_H
+#define Py_INTERNAL_AST_STATE_H
#ifdef __cplusplus
extern "C" {
#endif
@@ -240,5 +240,5 @@ struct ast_state {
#ifdef __cplusplus
}
#endif
-#endif /* !Py_INTERNAL_AST_H */
+#endif /* !Py_INTERNAL_AST_STATE_H */
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index ea770da..1e4b3ff 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -9,7 +9,7 @@ extern "C" {
#endif
#include "pycore_atomic.h" // _Py_atomic_address
-#include "pycore_ast.h" // struct ast_state
+#include "pycore_ast_state.h" // struct ast_state
#include "pycore_gil.h" // struct _gil_runtime_state
#include "pycore_gc.h" // struct _gc_runtime_state
#include "pycore_warnings.h" // struct _warnings_runtime_state
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 50bd75c..ee93ab6 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -854,11 +854,11 @@ regen-ast:
$(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
$(srcdir)/Parser/Python.asdl \
-H $(srcdir)/Include/Python-ast.h.new \
- -I $(srcdir)/Include/internal/pycore_ast.h.new \
+ -I $(srcdir)/Include/internal/pycore_ast_state.h.new \
-C $(srcdir)/Python/Python-ast.c.new
$(UPDATE_FILE) $(srcdir)/Include/Python-ast.h $(srcdir)/Include/Python-ast.h.new
- $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast.h $(srcdir)/Include/internal/pycore_ast.h.new
+ $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast_state.h $(srcdir)/Include/internal/pycore_ast_state.h.new
$(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
.PHONY: regen-opcode
@@ -1135,6 +1135,7 @@ PYTHON_HEADERS= \
\
$(srcdir)/Include/internal/pycore_abstract.h \
$(srcdir)/Include/internal/pycore_accu.h \
+ $(srcdir)/Include/internal/pycore_ast_state.h \
$(srcdir)/Include/internal/pycore_atomic.h \
$(srcdir)/Include/internal/pycore_atomic_funcs.h \
$(srcdir)/Include/internal/pycore_bitutils.h \
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 92355a8..655c831 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -175,6 +175,7 @@
<ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\pycore_abstract.h" />
<ClInclude Include="..\Include\internal\pycore_accu.h" />
+ <ClInclude Include="..\Include\internal\pycore_ast_state.h" />
<ClInclude Include="..\Include\internal\pycore_atomic.h" />
<ClInclude Include="..\Include\internal\pycore_atomic_funcs.h" />
<ClInclude Include="..\Include\internal\pycore_bitutils.h" />
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index d0b69db..fba4af5 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -486,6 +486,9 @@
<ClInclude Include="..\Include\internal\pycore_accu.h">
<Filter>Include\internal</Filter>
</ClInclude>
+ <ClInclude Include="..\Include\internal\pycore_ast_state.h">
+ <Filter>Include\internal</Filter>
+ </ClInclude>
<ClInclude Include="..\Include\internal\pycore_atomic.h">
<Filter>Include\internal</Filter>
</ClInclude>
diff --git a/PCbuild/regen.vcxproj b/PCbuild/regen.vcxproj
index 936f5fd..166468a 100644
--- a/PCbuild/regen.vcxproj
+++ b/PCbuild/regen.vcxproj
@@ -137,7 +137,7 @@
</None>
<None Include="..\Include\opcode.h">
</None>
- <None Include="..\Include\internal\pycore_ast.h">
+ <None Include="..\Include\internal\pycore_ast_state.h">
</None>
<None Include="..\Include\Python-ast.h">
</None>
@@ -163,15 +163,15 @@
<Warning Text="Pegen updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedParse)' != ''" />
</Target>
<Target Name="_RegenAST_H" AfterTargets="_RegenGrammar">
- <!-- Regenerate Include/Python-ast.h, Python/Python-ast.c and Include/internal/pycore_ast.h using Parser/asdl_c.py -h -->
- <Exec Command="&quot;$(PythonExe)&quot; &quot;$(PySourcePath)Parser\asdl_c.py&quot; &quot;$(PySourcePath)Parser\Python.asdl&quot; -H &quot;$(IntDir)Python-ast.h&quot; -C &quot;$(IntDir)Python-ast.c&quot; -I &quot;$(IntDir)pycore_ast.h&quot;" />
+ <!-- Regenerate Include/Python-ast.h, Python/Python-ast.c and Include/internal/pycore_ast_state.h using Parser/asdl_c.py -h -->
+ <Exec Command="&quot;$(PythonExe)&quot; &quot;$(PySourcePath)Parser\asdl_c.py&quot; &quot;$(PySourcePath)Parser\Python.asdl&quot; -H &quot;$(IntDir)Python-ast.h&quot; -C &quot;$(IntDir)Python-ast.c&quot; -I &quot;$(IntDir)pycore_ast_state.h&quot;" />
<Copy SourceFiles="$(IntDir)Python-ast.h" DestinationFiles="$(PySourcePath)Include\Python-ast.h">
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
</Copy>
<Copy SourceFiles="$(IntDir)Python-ast.c" DestinationFiles="$(PySourcePath)Python\Python-ast.c">
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedC" />
</Copy>
- <Copy SourceFiles="$(IntDir)pycore_ast.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast.h">
+ <Copy SourceFiles="$(IntDir)pycore_ast_state.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast_state.h">
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedInternalH" />
</Copy>
<Warning Text="ASDL is updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedH)' != '' != '' and '@(_UpdatedC)' != '' and @(_UpdatedInternalH)'" />
@@ -209,7 +209,7 @@
<Clean Include="$(IntDir)opcode.h" />
<Clean Include="$(IntDir)Python-ast.c" />
<Clean Include="$(IntDir)Python-ast.h" />
- <Clean Include="$(IntDir)pycore_ast.h" />
+ <Clean Include="$(IntDir)pycore_ast_state.h" />
</ItemGroup>
</Target>
</Project>
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 8c167bc..e96f1f3 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1429,7 +1429,7 @@ def generate_module_def(mod, f, internal_h):
print(textwrap.dedent(f"""
#ifdef Py_BUILD_CORE
- # include "pycore_ast.h" // struct ast_state
+ # include "pycore_ast_state.h" // struct ast_state
# include "pycore_interp.h" // _PyInterpreterState.ast
# include "pycore_pystate.h" // _PyInterpreterState_GET()
#else
@@ -1522,8 +1522,8 @@ def write_header(mod, f):
def write_internal_h_header(mod, f):
print(textwrap.dedent("""
- #ifndef Py_INTERNAL_AST_H
- #define Py_INTERNAL_AST_H
+ #ifndef Py_INTERNAL_AST_STATE_H
+ #define Py_INTERNAL_AST_STATE_H
#ifdef __cplusplus
extern "C" {
#endif
@@ -1540,7 +1540,7 @@ def write_internal_h_footer(mod, f):
#ifdef __cplusplus
}
#endif
- #endif /* !Py_INTERNAL_AST_H */
+ #endif /* !Py_INTERNAL_AST_STATE_H */
"""), file=f)
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 439da8f..59acce7 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -6,7 +6,7 @@
#include "Python.h"
#ifdef Py_BUILD_CORE
-# include "pycore_ast.h" // struct ast_state
+# include "pycore_ast_state.h" // struct ast_state
# include "pycore_interp.h" // _PyInterpreterState.ast
# include "pycore_pystate.h" // _PyInterpreterState_GET()
#else