Uh oh!
There was an error while loading. Please reload this page.
bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() - #25252
Conversation
Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix. Remove macros creating aliases without prefix. For example, Module() becomes _PyAST_Module(). Update Grammar/python.gram to use _PyAST_xxx() functions.
vstinner
commented
Apr 7, 2021
@pablogsal: Does this change look reasonable to you? I already pushed the commit d36d6a9 to prepare the code base (add "Py" prefix in Python-ast.c and ast_opt.c). My intent is to not pollule the |
pablogsal
commented
Apr 7, 2021
This looks reasonable, but one downside of this is that backporting grammar fixes to 3.9 is going to be nontrivial because this will create merge conflicts in the grammar actions :( |
Is that a common thing? I count 7 commits modifying Grammar/python.gram since v3.9.0 (October 2020, 6 months ago) in the 3.9 branch. |
vstinner
commented
Apr 7, 2021
cc @lysnikolaou@isidentical who modified Grammar/python.gram in the last 6 months. |
lysnikolaou
commented
Apr 7, 2021
Not a whole lot to add here. It's true that it's not that common, but it happens from time to time. My feeling is that we can live with it, since with the two parsers being there in 3.9 we already have conflicts most (all?) of the time in the generated C file, when backporting fixes, so it already requires some manual. One line more to change wouldn't make that big of a difference. |
We have made some precautions to make backporting easier in the past because the merge conflicts can be a bit nasty but as @lysnikolaou says, we could live with it. |
vstinner
commented
Apr 7, 2021
An alternative would be to create a header file full of |
vstinner
commented
Apr 7, 2021
An alternative is to only remove aliases and always use It was my first attempt, but I though that if we are going to change things anyway, it can be an opportunity to "fix" the prefix from |
pablogsal
commented
Apr 7, 2021
Nah, I don't think is worth it. I am fine with this PR |
vstinner
commented
Apr 7, 2021
@pablogsal@lysnikolaou: Since you are the one backporting grammar/parser/compiler fixes, I would prefer if one of you could approve officially the PR. I'm also fine with the status quo (keep aliases), it's more up to you ;-) |
vstinner
commented
Apr 7, 2021
Thanks for the review @pablogsal and @lysnikolaou! I merged my PR. |
Rename AST functions of pycore_ast.h to use the "PyAST" prefix.
Remove macros creating aliases without prefix. For example, Module()
becomes _PyAST_Module(). Update Grammar/python.gram to use
_PyAST_xxx() functions.
https://bugs.python.org/issue43244