From d36d6a9c1808e87628ebaa855d4bec80130189f4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 7 Apr 2021 13:01:09 +0200 Subject: [PATCH] bpo-43244: Remove Yield macro from pycore_ast.h (GH-25243) * pycore_ast.h no longer defines the Yield macro. * Fix a compiler warning on Windows: "warning C4005: 'Yield': macro redefinition". * Python-ast.c now defines directly functions with their real _Py_xxx() name, rather than xxx(). * Remove "#undef Yield" in C files including pycore_ast.h. --- Include/internal/pycore_ast.h | 3 - Parser/asdl_c.py | 69 ++--- Python/Python-ast.c | 565 +++++++++++++++++----------------- Python/ast_opt.c | 4 +- Python/bltinmodule.c | 1 - Python/import.c | 1 - Python/pythonrun.c | 2 - Python/symtable.c | 1 - 8 files changed, 320 insertions(+), 326 deletions(-) diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h index ac1e387560b..5099cf6ec8c 100644 --- a/Include/internal/pycore_ast.h +++ b/Include/internal/pycore_ast.h @@ -12,8 +12,6 @@ extern "C" { #include "pycore_asdl.h" -#undef Yield /* undefine macro conflicting with */ - typedef struct _mod *mod_ty; typedef struct _stmt *stmt_ty; @@ -729,7 +727,6 @@ expr_ty _Py_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int #define Await(a0, a1, a2, a3, a4, a5) _Py_Await(a0, a1, a2, a3, a4, a5) expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); -#define Yield(a0, a1, a2, a3, a4, a5) _Py_Yield(a0, a1, a2, a3, a4, a5) expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); #define YieldFrom(a0, a1, a2, a3, a4, a5) _Py_YieldFrom(a0, a1, a2, a3, a4, a5) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 3bdeedb394d..02be1b3ccb0 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -325,8 +325,12 @@ class PrototypeVisitor(EmitVisitor): margs = "a0" for i in range(1, len(args)+1): margs += ", a%d" % i - self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0, - reflow=False) + # bpo-43244: defines Yield macro. Don't redefine it in + # pycore_ast.h: it is not needed outside Python-ast.c which calls + # directly _Py_Yield(). + if name != "Yield": + self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0, + reflow=False) self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), False) def visitProduct(self, prod, name): @@ -336,6 +340,10 @@ class PrototypeVisitor(EmitVisitor): union=False) +def pyfunc_name(name): + return f"_Py_{name}" + + class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" @@ -349,7 +357,7 @@ class FunctionVisitor(PrototypeVisitor): else: argstr = "PyArena *arena" self.emit("%s" % ctype, 0) - emit("%s(%s)" % (name, argstr)) + emit("%s(%s)" % (pyfunc_name(name), argstr)) emit("{") emit("%s p;" % ctype, 1) for argtype, argname, opt in args: @@ -488,7 +496,7 @@ class Obj2ModVisitor(PickleVisitor): for f in t.fields: self.visitField(f, t.name, sum=sum, depth=2) args = [f.name for f in t.fields] + [a.name for a in sum.attributes] - self.emit("*out = %s(%s);" % (t.name, self.buildArgs(args)), 2) + self.emit("*out = %s(%s);" % (pyfunc_name(t.name), self.buildArgs(args)), 2) self.emit("if (*out == NULL) goto failed;", 2) self.emit("return 0;", 2) self.emit("}", 1) @@ -521,7 +529,7 @@ class Obj2ModVisitor(PickleVisitor): self.visitField(a, name, prod=prod, depth=1) args = [f.name for f in prod.fields] args.extend([a.name for a in prod.attributes]) - self.emit("*out = %s(%s);" % (name, self.buildArgs(args)), 1) + self.emit("*out = %s(%s);" % (pyfunc_name(name), self.buildArgs(args)), 1) self.emit("return 0;", 1) self.emit("failed:", 0) self.emit("Py_XDECREF(tmp);", 1) @@ -1423,34 +1431,29 @@ def generate_module_def(mod, f, internal_h): generate_ast_state(module_state, internal_h) - print(textwrap.dedent(f""" + print(textwrap.dedent(""" + #include "Python.h" + #include "pycore_ast.h" #include "pycore_ast_state.h" // struct ast_state #include "pycore_interp.h" // _PyInterpreterState.ast #include "pycore_pystate.h" // _PyInterpreterState_GET() - """).rstrip(), file=f) - - f.write(""" -// Forward declaration -static int init_types(struct ast_state *state); - -static struct ast_state* -get_ast_state(void) -{ - PyInterpreterState *interp = _PyInterpreterState_GET(); - struct ast_state *state = &interp->ast; - if (!init_types(state)) { - return NULL; - } - return state; -} -""") - - print(textwrap.dedent(""" - // Include pycore_ast.h after pycore_interp.h to avoid conflicts - // with the Yield macro redefined by - #include "pycore_ast.h" #include "structmember.h" - """).rstrip(), file=f) + #include + + // Forward declaration + static int init_types(struct ast_state *state); + + static struct ast_state* + get_ast_state(void) + { + PyInterpreterState *interp = _PyInterpreterState_GET(); + struct ast_state *state = &interp->ast; + if (!init_types(state)) { + return NULL; + } + return state; + } + """).strip(), file=f) generate_ast_fini(module_state, f) @@ -1477,8 +1480,6 @@ def write_header(mod, f): #include "pycore_asdl.h" - #undef Yield /* undefine macro conflicting with */ - """).lstrip()) c = ChainOfVisitors(TypeDefVisitor(f), SequenceDefVisitor(f), @@ -1534,12 +1535,6 @@ def write_internal_h_footer(mod, f): def write_source(mod, f, internal_h_file): - print(textwrap.dedent(f""" - #include - - #include "Python.h" - """), file=f) - generate_module_def(mod, f, internal_h_file) v = ChainOfVisitors( diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 3c4b0ba8b83..e34bd26d74a 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -1,14 +1,12 @@ // File automatically generated by Parser/asdl_c.py. - -#include - #include "Python.h" - - +#include "pycore_ast.h" #include "pycore_ast_state.h" // struct ast_state #include "pycore_interp.h" // _PyInterpreterState.ast #include "pycore_pystate.h" // _PyInterpreterState_GET() +#include "structmember.h" +#include // Forward declaration static int init_types(struct ast_state *state); @@ -24,11 +22,6 @@ get_ast_state(void) return state; } -// Include pycore_ast.h after pycore_interp.h to avoid conflicts -// with the Yield macro redefined by -#include "pycore_ast.h" -#include "structmember.h" - void _PyAST_Fini(PyInterpreterState *interp) { struct ast_state *state = &interp->ast; @@ -1783,8 +1776,8 @@ static int obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty* out, PyArena* arena); mod_ty -Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, PyArena - *arena) +_Py_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, PyArena + *arena) { mod_ty p; p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -1797,7 +1790,7 @@ Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, PyArena } mod_ty -Interactive(asdl_stmt_seq * body, PyArena *arena) +_Py_Interactive(asdl_stmt_seq * body, PyArena *arena) { mod_ty p; p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -1809,7 +1802,7 @@ Interactive(asdl_stmt_seq * body, PyArena *arena) } mod_ty -Expression(expr_ty body, PyArena *arena) +_Py_Expression(expr_ty body, PyArena *arena) { mod_ty p; if (!body) { @@ -1826,7 +1819,7 @@ Expression(expr_ty body, PyArena *arena) } mod_ty -FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena) +_Py_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena) { mod_ty p; if (!returns) { @@ -1844,10 +1837,10 @@ FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena) } stmt_ty -FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, - asdl_expr_seq * decorator_list, expr_ty returns, string - type_comment, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, + asdl_expr_seq * decorator_list, expr_ty returns, string + type_comment, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { stmt_ty p; if (!name) { @@ -1878,10 +1871,10 @@ FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, } stmt_ty -AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, - asdl_expr_seq * decorator_list, expr_ty returns, string - type_comment, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, + asdl_expr_seq * decorator_list, expr_ty returns, string + type_comment, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena) { stmt_ty p; if (!name) { @@ -1912,9 +1905,10 @@ AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body, } stmt_ty -ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq * keywords, - asdl_stmt_seq * body, asdl_expr_seq * decorator_list, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq * + keywords, asdl_stmt_seq * body, asdl_expr_seq * decorator_list, + int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; if (!name) { @@ -1939,8 +1933,8 @@ ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq * keywords, } stmt_ty -Return(expr_ty value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Return(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -1956,8 +1950,8 @@ Return(expr_ty value, int lineno, int col_offset, int end_lineno, int } stmt_ty -Delete(asdl_expr_seq * targets, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -1973,8 +1967,9 @@ Delete(asdl_expr_seq * targets, int lineno, int col_offset, int end_lineno, int } stmt_ty -Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int lineno, - int col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int + lineno, int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { stmt_ty p; if (!value) { @@ -1997,8 +1992,8 @@ Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int lineno, } stmt_ty -AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!target) { @@ -2031,9 +2026,9 @@ AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int } stmt_ty -AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, + int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; if (!target) { @@ -2062,9 +2057,9 @@ AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int } stmt_ty -For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * orelse, - string type_comment, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * + orelse, string type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!target) { @@ -2094,9 +2089,9 @@ For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * orelse, } stmt_ty -AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * - orelse, string type_comment, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq + * orelse, string type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!target) { @@ -2126,8 +2121,9 @@ AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq * } stmt_ty -While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, - int col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int + lineno, int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { stmt_ty p; if (!test) { @@ -2150,8 +2146,8 @@ While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, } stmt_ty -If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!test) { @@ -2174,8 +2170,9 @@ If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int lineno, int } stmt_ty -With(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, + int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2193,9 +2190,9 @@ With(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, int } stmt_ty -AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, - int lineno, int col_offset, int end_lineno, int end_col_offset, - PyArena *arena) +_Py_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string + type_comment, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2213,8 +2210,8 @@ AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string type_comment, } stmt_ty -Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!subject) { @@ -2236,8 +2233,8 @@ Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int col_offset, } stmt_ty -Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, - int end_col_offset, PyArena *arena) +_Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2254,9 +2251,9 @@ Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, } stmt_ty -Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, asdl_stmt_seq * - orelse, asdl_stmt_seq * finalbody, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, asdl_stmt_seq + * orelse, asdl_stmt_seq * finalbody, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2275,8 +2272,8 @@ Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, asdl_stmt_seq * } stmt_ty -Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, - int end_col_offset, PyArena *arena) +_Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; if (!test) { @@ -2298,8 +2295,8 @@ Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, } stmt_ty -Import(asdl_alias_seq * names, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Import(asdl_alias_seq * names, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2315,8 +2312,9 @@ Import(asdl_alias_seq * names, int lineno, int col_offset, int end_lineno, int } stmt_ty -ImportFrom(identifier module, asdl_alias_seq * names, int level, int lineno, - int col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_ImportFrom(identifier module, asdl_alias_seq * names, int level, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2334,8 +2332,8 @@ ImportFrom(identifier module, asdl_alias_seq * names, int level, int lineno, } stmt_ty -Global(asdl_identifier_seq * names, int lineno, int col_offset, int end_lineno, - int end_col_offset, PyArena *arena) +_Py_Global(asdl_identifier_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2351,8 +2349,8 @@ Global(asdl_identifier_seq * names, int lineno, int col_offset, int end_lineno, } stmt_ty -Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2368,8 +2366,8 @@ Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int } stmt_ty -Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { stmt_ty p; if (!value) { @@ -2390,8 +2388,8 @@ Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int } stmt_ty -Pass(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2406,8 +2404,8 @@ Pass(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena } stmt_ty -Break(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_Break(int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2422,8 +2420,8 @@ Break(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena } stmt_ty -Continue(int lineno, int col_offset, int end_lineno, int end_col_offset, - PyArena *arena) +_Py_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2438,8 +2436,8 @@ Continue(int lineno, int col_offset, int end_lineno, int end_col_offset, } expr_ty -BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!op) { @@ -2461,8 +2459,8 @@ BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset, int } expr_ty -NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!target) { @@ -2489,8 +2487,8 @@ NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int } expr_ty -BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!left) { @@ -2523,8 +2521,8 @@ BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, } expr_ty -UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!op) { @@ -2551,8 +2549,8 @@ UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int } expr_ty -Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!args) { @@ -2579,8 +2577,8 @@ Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int } expr_ty -IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!test) { @@ -2613,8 +2611,8 @@ IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, } expr_ty -Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2631,8 +2629,8 @@ Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int col_offset, } expr_ty -Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2648,8 +2646,8 @@ Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, int } expr_ty -ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!elt) { @@ -2671,8 +2669,8 @@ ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int } expr_ty -SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!elt) { @@ -2694,9 +2692,9 @@ SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int } expr_ty -DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * generators, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * generators, + int lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { expr_ty p; if (!key) { @@ -2724,8 +2722,9 @@ DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * generators, int } expr_ty -GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { expr_ty p; if (!elt) { @@ -2747,8 +2746,8 @@ GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int lineno, int } expr_ty -Await(expr_ty value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { expr_ty p; if (!value) { @@ -2769,8 +2768,8 @@ Await(expr_ty value, int lineno, int col_offset, int end_lineno, int } expr_ty -Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2786,8 +2785,8 @@ Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int } expr_ty -YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena) +_Py_YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena) { expr_ty p; if (!value) { @@ -2808,9 +2807,9 @@ YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int } expr_ty -Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators, int + lineno, int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { expr_ty p; if (!left) { @@ -2833,8 +2832,9 @@ Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators, int } expr_ty -Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords, int + lineno, int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { expr_ty p; if (!func) { @@ -2857,9 +2857,9 @@ Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords, int } expr_ty -FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno, - int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { expr_ty p; if (!value) { @@ -2882,8 +2882,8 @@ FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno, } expr_ty -JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int end_lineno, - int end_col_offset, PyArena *arena) +_Py_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2899,8 +2899,8 @@ JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int end_lineno, } expr_ty -Constant(constant value, string kind, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Constant(constant value, string kind, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!value) { @@ -2922,8 +2922,9 @@ Constant(constant value, string kind, int lineno, int col_offset, int } expr_ty -Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { expr_ty p; if (!value) { @@ -2956,8 +2957,9 @@ Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int } expr_ty -Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { expr_ty p; if (!value) { @@ -2990,8 +2992,8 @@ Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, int } expr_ty -Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!value) { @@ -3018,8 +3020,8 @@ Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, int } expr_ty -Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!id) { @@ -3046,8 +3048,8 @@ Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int } expr_ty -List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!ctx) { @@ -3069,8 +3071,8 @@ List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int } expr_ty -Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!ctx) { @@ -3092,8 +3094,8 @@ Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int col_offset, } expr_ty -Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena) +_Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -3111,8 +3113,8 @@ Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset, } expr_ty -MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; if (!pattern) { @@ -3139,8 +3141,8 @@ MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int } expr_ty -MatchOr(asdl_expr_seq * patterns, int lineno, int col_offset, int end_lineno, - int end_col_offset, PyArena *arena) +_Py_MatchOr(asdl_expr_seq * patterns, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -3156,8 +3158,8 @@ MatchOr(asdl_expr_seq * patterns, int lineno, int col_offset, int end_lineno, } comprehension_ty -comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, - PyArena *arena) +_Py_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int + is_async, PyArena *arena) { comprehension_ty p; if (!target) { @@ -3181,9 +3183,9 @@ comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, } excepthandler_ty -ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int lineno, - int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) +_Py_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena) { excepthandler_ty p; p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -3201,9 +3203,9 @@ ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int lineno, } arguments_ty -arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty vararg, - asdl_arg_seq * kwonlyargs, asdl_expr_seq * kw_defaults, arg_ty kwarg, - asdl_expr_seq * defaults, PyArena *arena) +_Py_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty vararg, + asdl_arg_seq * kwonlyargs, asdl_expr_seq * kw_defaults, arg_ty + kwarg, asdl_expr_seq * defaults, PyArena *arena) { arguments_ty p; p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -3220,8 +3222,8 @@ arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty vararg, } arg_ty -arg(identifier arg, expr_ty annotation, string type_comment, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) +_Py_arg(identifier arg, expr_ty annotation, string type_comment, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena *arena) { arg_ty p; if (!arg) { @@ -3243,8 +3245,8 @@ arg(identifier arg, expr_ty annotation, string type_comment, int lineno, int } keyword_ty -keyword(identifier arg, expr_ty value, int lineno, int col_offset, int - end_lineno, int end_col_offset, PyArena *arena) +_Py_keyword(identifier arg, expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) { keyword_ty p; if (!value) { @@ -3265,7 +3267,7 @@ keyword(identifier arg, expr_ty value, int lineno, int col_offset, int } alias_ty -alias(identifier name, identifier asname, PyArena *arena) +_Py_alias(identifier name, identifier asname, PyArena *arena) { alias_ty p; if (!name) { @@ -3282,7 +3284,7 @@ alias(identifier name, identifier asname, PyArena *arena) } withitem_ty -withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) +_Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) { withitem_ty p; if (!context_expr) { @@ -3299,7 +3301,8 @@ withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) } match_case_ty -match_case(expr_ty pattern, expr_ty guard, asdl_stmt_seq * body, PyArena *arena) +_Py_match_case(expr_ty pattern, expr_ty guard, asdl_stmt_seq * body, PyArena + *arena) { match_case_ty p; if (!pattern) { @@ -3317,7 +3320,7 @@ match_case(expr_ty pattern, expr_ty guard, asdl_stmt_seq * body, PyArena *arena) } type_ignore_ty -TypeIgnore(int lineno, string tag, PyArena *arena) +_Py_TypeIgnore(int lineno, string tag, PyArena *arena) { type_ignore_ty p; if (!tag) { @@ -5034,7 +5037,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) } Py_CLEAR(tmp); } - *out = Module(body, type_ignores, arena); + *out = _Py_Module(body, type_ignores, arena); if (*out == NULL) goto failed; return 0; } @@ -5079,7 +5082,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) } Py_CLEAR(tmp); } - *out = Interactive(body, arena); + *out = _Py_Interactive(body, arena); if (*out == NULL) goto failed; return 0; } @@ -5104,7 +5107,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Expression(body, arena); + *out = _Py_Expression(body, arena); if (*out == NULL) goto failed; return 0; } @@ -5163,7 +5166,7 @@ obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = FunctionType(argtypes, returns, arena); + *out = _Py_FunctionType(argtypes, returns, arena); if (*out == NULL) goto failed; return 0; } @@ -5374,9 +5377,9 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = FunctionDef(name, args, body, decorator_list, returns, - type_comment, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_FunctionDef(name, args, body, decorator_list, returns, + type_comment, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5511,9 +5514,9 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = AsyncFunctionDef(name, args, body, decorator_list, returns, - type_comment, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_AsyncFunctionDef(name, args, body, decorator_list, returns, + type_comment, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5674,8 +5677,9 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = ClassDef(name, bases, keywords, body, decorator_list, lineno, - col_offset, end_lineno, end_col_offset, arena); + *out = _Py_ClassDef(name, bases, keywords, body, decorator_list, + lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -5700,8 +5704,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Return(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Return(value, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5746,8 +5750,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Delete(targets, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Delete(targets, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5820,8 +5824,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Assign(targets, value, type_comment, lineno, col_offset, - end_lineno, end_col_offset, arena); + *out = _Py_Assign(targets, value, type_comment, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5874,8 +5878,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = AugAssign(target, op, value, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_AugAssign(target, op, value, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -5942,8 +5946,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = AnnAssign(target, annotation, value, simple, lineno, col_offset, - end_lineno, end_col_offset, arena); + *out = _Py_AnnAssign(target, annotation, value, simple, lineno, + col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6064,8 +6068,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = For(target, iter, body, orelse, type_comment, lineno, - col_offset, end_lineno, end_col_offset, arena); + *out = _Py_For(target, iter, body, orelse, type_comment, lineno, + col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6186,8 +6190,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = AsyncFor(target, iter, body, orelse, type_comment, lineno, - col_offset, end_lineno, end_col_offset, arena); + *out = _Py_AsyncFor(target, iter, body, orelse, type_comment, lineno, + col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6280,8 +6284,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = While(test, body, orelse, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_While(test, body, orelse, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6374,8 +6378,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = If(test, body, orelse, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_If(test, body, orelse, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6468,8 +6472,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = With(items, body, type_comment, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_With(items, body, type_comment, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6562,8 +6566,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = AsyncWith(items, body, type_comment, lineno, col_offset, - end_lineno, end_col_offset, arena); + *out = _Py_AsyncWith(items, body, type_comment, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6622,8 +6626,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Match(subject, cases, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Match(subject, cases, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6662,8 +6666,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Raise(exc, cause, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Raise(exc, cause, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6810,8 +6814,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Try(body, handlers, orelse, finalbody, lineno, col_offset, - end_lineno, end_col_offset, arena); + *out = _Py_Try(body, handlers, orelse, finalbody, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6850,8 +6854,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Assert(test, msg, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Assert(test, msg, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6896,8 +6900,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Import(names, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Import(names, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6970,8 +6974,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = ImportFrom(module, names, level, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_ImportFrom(module, names, level, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7016,8 +7020,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Global(names, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Global(names, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7062,8 +7066,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Nonlocal(names, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Nonlocal(names, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7088,8 +7092,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Expr(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Expr(value, lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -7100,7 +7104,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } if (isinstance) { - *out = Pass(lineno, col_offset, end_lineno, end_col_offset, arena); + *out = _Py_Pass(lineno, col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7111,7 +7115,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } if (isinstance) { - *out = Break(lineno, col_offset, end_lineno, end_col_offset, arena); + *out = _Py_Break(lineno, col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7122,7 +7126,8 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } if (isinstance) { - *out = Continue(lineno, col_offset, end_lineno, end_col_offset, arena); + *out = _Py_Continue(lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -7257,8 +7262,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = BoolOp(op, values, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_BoolOp(op, values, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7297,8 +7302,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = NamedExpr(target, value, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_NamedExpr(target, value, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7351,8 +7356,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = BinOp(left, op, right, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_BinOp(left, op, right, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7391,8 +7396,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = UnaryOp(op, operand, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_UnaryOp(op, operand, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7431,8 +7436,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Lambda(args, body, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Lambda(args, body, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7485,8 +7490,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = IfExp(test, body, orelse, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_IfExp(test, body, orelse, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7565,8 +7570,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Dict(keys, values, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Dict(keys, values, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7611,7 +7616,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Set(elts, lineno, col_offset, end_lineno, end_col_offset, arena); + *out = _Py_Set(elts, lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -7670,8 +7676,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = ListComp(elt, generators, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_ListComp(elt, generators, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7730,8 +7736,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = SetComp(elt, generators, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_SetComp(elt, generators, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7804,8 +7810,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = DictComp(key, value, generators, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_DictComp(key, value, generators, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7864,8 +7870,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = GeneratorExp(elt, generators, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_GeneratorExp(elt, generators, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -7890,8 +7896,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Await(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Await(value, lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -7916,8 +7922,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Yield(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Yield(value, lineno, col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -7942,8 +7948,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = YieldFrom(value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_YieldFrom(value, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8036,8 +8042,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Compare(left, ops, comparators, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Compare(left, ops, comparators, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8130,8 +8136,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = Call(func, args, keywords, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Call(func, args, keywords, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8184,8 +8190,9 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = FormattedValue(value, conversion, format_spec, lineno, - col_offset, end_lineno, end_col_offset, arena); + *out = _Py_FormattedValue(value, conversion, format_spec, lineno, + col_offset, end_lineno, end_col_offset, + arena); if (*out == NULL) goto failed; return 0; } @@ -8230,8 +8237,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = JoinedStr(values, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_JoinedStr(values, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8270,8 +8277,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Constant(value, kind, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Constant(value, kind, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8324,8 +8331,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Attribute(value, attr, ctx, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Attribute(value, attr, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8378,8 +8385,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Subscript(value, slice, ctx, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Subscript(value, slice, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8418,8 +8425,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Starred(value, ctx, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Starred(value, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8458,8 +8465,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Name(id, ctx, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Name(id, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8518,8 +8525,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = List(elts, ctx, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_List(elts, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8578,8 +8585,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Tuple(elts, ctx, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_Tuple(elts, ctx, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8632,8 +8639,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = Slice(lower, upper, step, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_Slice(lower, upper, step, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8672,8 +8679,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = MatchAs(pattern, name, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_MatchAs(pattern, name, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -8718,8 +8725,8 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = MatchOr(patterns, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_MatchOr(patterns, lineno, col_offset, end_lineno, + end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -9123,7 +9130,7 @@ obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = comprehension(target, iter, ifs, is_async, arena); + *out = _Py_comprehension(target, iter, ifs, is_async, arena); return 0; failed: Py_XDECREF(tmp); @@ -9268,8 +9275,8 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* } Py_CLEAR(tmp); } - *out = ExceptHandler(type, name, body, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_ExceptHandler(type, name, body, lineno, col_offset, + end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -9484,8 +9491,8 @@ obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out, } Py_CLEAR(tmp); } - *out = arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults, kwarg, - defaults, arena); + *out = _Py_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults, + kwarg, defaults, arena); return 0; failed: Py_XDECREF(tmp); @@ -9595,8 +9602,8 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = arg(arg, annotation, type_comment, lineno, col_offset, end_lineno, - end_col_offset, arena); + *out = _Py_arg(arg, annotation, type_comment, lineno, col_offset, + end_lineno, end_col_offset, arena); return 0; failed: Py_XDECREF(tmp); @@ -9693,8 +9700,8 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = keyword(arg, value, lineno, col_offset, end_lineno, end_col_offset, - arena); + *out = _Py_keyword(arg, value, lineno, col_offset, end_lineno, + end_col_offset, arena); return 0; failed: Py_XDECREF(tmp); @@ -9735,7 +9742,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = alias(name, asname, arena); + *out = _Py_alias(name, asname, arena); return 0; failed: Py_XDECREF(tmp); @@ -9776,7 +9783,7 @@ obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out, if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = withitem(context_expr, optional_vars, arena); + *out = _Py_withitem(context_expr, optional_vars, arena); return 0; failed: Py_XDECREF(tmp); @@ -9851,7 +9858,7 @@ obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out, } Py_CLEAR(tmp); } - *out = match_case(pattern, guard, body, arena); + *out = _Py_match_case(pattern, guard, body, arena); return 0; failed: Py_XDECREF(tmp); @@ -9906,7 +9913,7 @@ obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty* if (res != 0) goto failed; Py_CLEAR(tmp); } - *out = TypeIgnore(lineno, tag, arena); + *out = _Py_TypeIgnore(lineno, tag, arena); if (*out == NULL) goto failed; return 0; } diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 0310466b34f..46dba7646e0 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -451,8 +451,8 @@ astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state) return 0; } asdl_seq_SET(values, 0, st->v.Expr.value); - expr_ty expr = JoinedStr(values, st->lineno, st->col_offset, - st->end_lineno, st->end_col_offset, ctx_); + expr_ty expr = _Py_JoinedStr(values, st->lineno, st->col_offset, + st->end_lineno, st->end_col_offset, ctx_); if (!expr) { return 0; } diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a076006d652..3b0e59a6d18 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -3,7 +3,6 @@ #include "Python.h" #include #include "pycore_ast.h" // _PyAST_Validate() -#undef Yield /* undefine macro conflicting with */ #include "pycore_compile.h" // _PyAST_Compile() #include "pycore_object.h" // _Py_AddToAllObjects() #include "pycore_pyerrors.h" // _PyErr_NoMemory() diff --git a/Python/import.c b/Python/import.c index 6fba057badd..c4878c628be 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2,7 +2,6 @@ #include "Python.h" -#undef Yield /* undefine macro conflicting with */ #include "pycore_import.h" // _PyImport_BootstrapImp() #include "pycore_initconfig.h" #include "pycore_pyerrors.h" diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 1715cde49dd..99be6295b48 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -11,8 +11,6 @@ #include "Python.h" #include "pycore_ast.h" // PyAST_mod2obj -#undef Yield /* undefine macro conflicting with */ - #include "pycore_compile.h" // _PyAST_Compile() #include "pycore_interp.h" // PyInterpreterState.importlib #include "pycore_object.h" // _PyDebug_PrintTotalRefs() diff --git a/Python/symtable.c b/Python/symtable.c index 68f2c71f18e..d148a563a3e 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1,6 +1,5 @@ #include "Python.h" #include "pycore_ast.h" // identifier, stmt_ty -#undef Yield /* undefine macro conflicting with */ #include "pycore_compile.h" // _Py_Mangle() #include "pycore_parser.h" // _PyParser_ASTFromString() #include "pycore_pystate.h" // _PyThreadState_GET()