Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4536e1

Browse files
authored
bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)
1 parent e272528 commit b4536e1

File tree

8 files changed

+21
-16
lines changed

8 files changed

+21
-16
lines changed

Include/internal/pycore_ast.h renamed to Include/internal/pycore_ast_state.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File automatically generated by Parser/asdl_c.py.
22

3-
#ifndef Py_INTERNAL_AST_H
4-
#define Py_INTERNAL_AST_H
3+
#ifndef Py_INTERNAL_AST_STATE_H
4+
#define Py_INTERNAL_AST_STATE_H
55
#ifdef __cplusplus
66
extern "C" {
77
#endif
@@ -240,5 +240,5 @@ struct ast_state {
240240
#ifdef __cplusplus
241241
}
242242
#endif
243-
#endif /* !Py_INTERNAL_AST_H */
243+
#endif /* !Py_INTERNAL_AST_STATE_H */
244244

Include/internal/pycore_interp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
#endif
1010

1111
#include "pycore_atomic.h" // _Py_atomic_address
12-
#include "pycore_ast.h" // struct ast_state
12+
#include "pycore_ast_state.h" // struct ast_state
1313
#include "pycore_gil.h" // struct _gil_runtime_state
1414
#include "pycore_gc.h" // struct _gc_runtime_state
1515
#include "pycore_warnings.h" // struct _warnings_runtime_state

Makefile.pre.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,11 @@ regen-ast:
854854
$(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
855855
$(srcdir)/Parser/Python.asdl \
856856
-H $(srcdir)/Include/Python-ast.h.new \
857-
-I $(srcdir)/Include/internal/pycore_ast.h.new \
857+
-I $(srcdir)/Include/internal/pycore_ast_state.h.new \
858858
-C $(srcdir)/Python/Python-ast.c.new
859859

860860
$(UPDATE_FILE) $(srcdir)/Include/Python-ast.h $(srcdir)/Include/Python-ast.h.new
861-
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast.h $(srcdir)/Include/internal/pycore_ast.h.new
861+
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast_state.h $(srcdir)/Include/internal/pycore_ast_state.h.new
862862
$(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
863863

864864
.PHONY: regen-opcode
@@ -1135,6 +1135,7 @@ PYTHON_HEADERS= \
11351135
\
11361136
$(srcdir)/Include/internal/pycore_abstract.h \
11371137
$(srcdir)/Include/internal/pycore_accu.h \
1138+
$(srcdir)/Include/internal/pycore_ast_state.h \
11381139
$(srcdir)/Include/internal/pycore_atomic.h \
11391140
$(srcdir)/Include/internal/pycore_atomic_funcs.h \
11401141
$(srcdir)/Include/internal/pycore_bitutils.h \

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
<ClInclude Include="..\Include\import.h" />
176176
<ClInclude Include="..\Include\internal\pycore_abstract.h" />
177177
<ClInclude Include="..\Include\internal\pycore_accu.h" />
178+
<ClInclude Include="..\Include\internal\pycore_ast_state.h" />
178179
<ClInclude Include="..\Include\internal\pycore_atomic.h" />
179180
<ClInclude Include="..\Include\internal\pycore_atomic_funcs.h" />
180181
<ClInclude Include="..\Include\internal\pycore_bitutils.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@
486486
<ClInclude Include="..\Include\internal\pycore_accu.h">
487487
<Filter>Include\internal</Filter>
488488
</ClInclude>
489+
<ClInclude Include="..\Include\internal\pycore_ast_state.h">
490+
<Filter>Include\internal</Filter>
491+
</ClInclude>
489492
<ClInclude Include="..\Include\internal\pycore_atomic.h">
490493
<Filter>Include\internal</Filter>
491494
</ClInclude>

PCbuild/regen.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
</None>
138138
<None Include="..\Include\opcode.h">
139139
</None>
140-
<None Include="..\Include\internal\pycore_ast.h">
140+
<None Include="..\Include\internal\pycore_ast_state.h">
141141
</None>
142142
<None Include="..\Include\Python-ast.h">
143143
</None>
@@ -163,15 +163,15 @@
163163
<Warning Text="Pegen updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedParse)' != ''" />
164164
</Target>
165165
<Target Name="_RegenAST_H" AfterTargets="_RegenGrammar">
166-
<!-- Regenerate Include/Python-ast.h, Python/Python-ast.c and Include/internal/pycore_ast.h using Parser/asdl_c.py -h -->
167-
<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;" />
166+
<!-- Regenerate Include/Python-ast.h, Python/Python-ast.c and Include/internal/pycore_ast_state.h using Parser/asdl_c.py -h -->
167+
<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;" />
168168
<Copy SourceFiles="$(IntDir)Python-ast.h" DestinationFiles="$(PySourcePath)Include\Python-ast.h">
169169
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
170170
</Copy>
171171
<Copy SourceFiles="$(IntDir)Python-ast.c" DestinationFiles="$(PySourcePath)Python\Python-ast.c">
172172
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedC" />
173173
</Copy>
174-
<Copy SourceFiles="$(IntDir)pycore_ast.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast.h">
174+
<Copy SourceFiles="$(IntDir)pycore_ast_state.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast_state.h">
175175
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedInternalH" />
176176
</Copy>
177177
<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 @@
209209
<Clean Include="$(IntDir)opcode.h" />
210210
<Clean Include="$(IntDir)Python-ast.c" />
211211
<Clean Include="$(IntDir)Python-ast.h" />
212-
<Clean Include="$(IntDir)pycore_ast.h" />
212+
<Clean Include="$(IntDir)pycore_ast_state.h" />
213213
</ItemGroup>
214214
</Target>
215215
</Project>

Parser/asdl_c.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ def generate_module_def(mod, f, internal_h):
14291429

14301430
print(textwrap.dedent(f"""
14311431
#ifdef Py_BUILD_CORE
1432-
# include "pycore_ast.h" // struct ast_state
1432+
# include "pycore_ast_state.h" // struct ast_state
14331433
# include "pycore_interp.h" // _PyInterpreterState.ast
14341434
# include "pycore_pystate.h" // _PyInterpreterState_GET()
14351435
#else
@@ -1522,8 +1522,8 @@ def write_header(mod, f):
15221522

15231523
def write_internal_h_header(mod, f):
15241524
print(textwrap.dedent("""
1525-
#ifndef Py_INTERNAL_AST_H
1526-
#define Py_INTERNAL_AST_H
1525+
#ifndef Py_INTERNAL_AST_STATE_H
1526+
#define Py_INTERNAL_AST_STATE_H
15271527
#ifdef __cplusplus
15281528
extern "C" {
15291529
#endif
@@ -1540,7 +1540,7 @@ def write_internal_h_footer(mod, f):
15401540
#ifdef __cplusplus
15411541
}
15421542
#endif
1543-
#endif /* !Py_INTERNAL_AST_H */
1543+
#endif /* !Py_INTERNAL_AST_STATE_H */
15441544
"""), file=f)
15451545

15461546

Python/Python-ast.c

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)