Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address Batuhan's review
  • Loading branch information
vstinner committed Oct 29, 2020
commit ef38d8423a75d65215b1ea3c4e47b27492c07c4a
2 changes: 1 addition & 1 deletion PCbuild/regen.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<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 annd Include/internal/pycore_ast.h using Parser/asdl_c.py -h -->
<!-- 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;" />
<Copy SourceFiles="$(IntDir)Python-ast.h" DestinationFiles="$(PySourcePath)Include\Python-ast.h">
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
Expand Down
5 changes: 4 additions & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,9 @@ def visitModule(self, mod):
self.emit("astmodule_exec(PyObject *m)", 0)
self.emit("{", 0)
self.emit('struct ast_state *state = get_ast_state();', 1)
Comment thread
vstinner marked this conversation as resolved.
self.emit('if (state == NULL) {', 1)
self.emit('return -1;', 2)
self.emit('}', 1)
self.emit('if (PyModule_AddObject(m, "AST", state->AST_type) < 0) {', 1)
self.emit('return -1;', 2)
self.emit('}', 1)
Expand Down Expand Up @@ -1354,7 +1357,7 @@ def generate_ast_fini(module_state, f):
void _PyAST_Fini(PyThreadState *tstate)
{
#ifdef Py_BUILD_CORE
struct ast_state* state = &tstate->interp->ast;
struct ast_state *state = &tstate->interp->ast;
#else
struct ast_state *state = &global_ast_state;
#endif
Expand Down
5 changes: 4 additions & 1 deletion Python/Python-ast.c

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