New submission from STINNER Victor <vstin...@redhat.com>:
Currently, there are *implicit* dependencies between AST/parser header files. For example, ast.h uses node and mod_ty types but don't include node.h nor Python-ast.h. And parsetok.h uses node and grammer but don't include nor grammar.h. Because of that, C files have to include header files in the "correct order" and need to include header files even if they don't use directly. At the end, we get something like pythonrun.c: #include "Python-ast.h" #include "pycore_state.h" #include "grammar.h" #include "node.h" #include "token.h" #include "parsetok.h" #include "errcode.h" #include "code.h" #include "symtable.h" #include "ast.h" #include "marshal.h" #include "osdefs.h" #include <locale.h> whereas most header files are useless, pythonrun.c still compiles with: #include "pycore_state.h" #include "token.h" /* INDENT in err_input() */ #include "parsetok.h" /* PyParser_ParseFileObject() */ #include "errcode.h" /* E_EOF */ #include "symtable.h" /* PySymtable_BuildObject() */ #include "ast.h" /* PyAST_FromNodeObject() */ #include "marshal.h" /* PyMarshal_ReadLongFromFile */ #include <locale.h> I propose to add explicit dependencies in header files directly, rather than using black magic in C files. Attached PR fix this issue. ---------- components: Interpreter Core messages: 329359 nosy: vstinner priority: normal severity: normal status: open title: Add missing dependencies between AST/parser header files versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35177> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com