bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)

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.
This commit is contained in:
Victor Stinner 2021-04-07 21:34:22 +02:00 committed by GitHub
parent 58d72cab89
commit d27f8d2e07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 858 additions and 907 deletions

View file

@ -797,10 +797,11 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
/* And now create the FormattedValue node that represents this
entire expression with the conversion and format spec. */
//TODO: Fix this
*expression = FormattedValue(simple_expression, conversion,
format_spec, first_token->lineno,
first_token->col_offset, last_token->end_lineno,
last_token->end_col_offset, p->arena);
*expression = _PyAST_FormattedValue(simple_expression, conversion,
format_spec, first_token->lineno,
first_token->col_offset,
last_token->end_lineno,
last_token->end_col_offset, p->arena);
if (!*expression) {
goto error;
}
@ -1044,8 +1045,9 @@ make_str_node_and_del(Parser *p, PyObject **str, Token* first_token, Token *last
return NULL;
}
return Constant(s, kind, first_token->lineno, first_token->col_offset,
last_token->end_lineno, last_token->end_col_offset, p->arena);
return _PyAST_Constant(s, kind, first_token->lineno, first_token->col_offset,
last_token->end_lineno, last_token->end_col_offset,
p->arena);
}
@ -1204,8 +1206,9 @@ _PyPegen_FstringParser_Finish(Parser *p, FstringParser *state, Token* first_toke
goto error;
}
return _Py_JoinedStr(seq, first_token->lineno, first_token->col_offset,
last_token->end_lineno, last_token->end_col_offset, p->arena);
return _PyAST_JoinedStr(seq, first_token->lineno, first_token->col_offset,
last_token->end_lineno, last_token->end_col_offset,
p->arena);
error:
_PyPegen_FstringParser_Dealloc(state);