summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-09-16 18:42:00 (GMT)
committerGitHub <noreply@github.com>2020-09-16 18:42:00 (GMT)
commita5634c406767ef694df49b624adf9cfa6c0d9064 (patch)
treed0fccb7521e88e3528d5265bf0209f1554fd0098 /Python
parent5c1b46d897d4c693e2f3ae049d54725dfb09f2dc (diff)
downloadcpython-a5634c406767ef694df49b624adf9cfa6c0d9064.zip
cpython-a5634c406767ef694df49b624adf9cfa6c0d9064.tar.gz
cpython-a5634c406767ef694df49b624adf9cfa6c0d9064.tar.bz2
bpo-41746: Add type information to asdl_seq objects (GH-22223)
* Add new capability to the PEG parser to type variable assignments. For instance: ``` | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a } ``` * Add new sequence types from the asdl definition (automatically generated) * Make `asdl_seq` type a generic aliasing pointer type. * Create a new `asdl_generic_seq` for the generic case using `void*`. * The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed. * New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences. * Changes all possible `asdl_seq` types to use specific versions everywhere.
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c507
-rw-r--r--Python/asdl.c64
-rw-r--r--Python/ast.c25
-rw-r--r--Python/ast_opt.c106
-rw-r--r--Python/ast_unparse.c8
-rw-r--r--Python/compile.c77
-rw-r--r--Python/future.c3
-rw-r--r--Python/symtable.c22
8 files changed, 398 insertions, 414 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 094010e..13657a6 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -549,6 +549,18 @@ static int init_identifiers(astmodulestate *state)
return 1;
};
+GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
+
static PyObject* ast2obj_mod(astmodulestate *state, void*);
static const char * const Module_fields[]={
"body",
@@ -1097,7 +1109,7 @@ static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*
if (!result)
return NULL;
for (i = 0; i < n; i++) {
- value = func(state, asdl_seq_GET(seq, i));
+ value = func(state, asdl_seq_GET_UNTYPED(seq, i));
if (!value) {
Py_DECREF(result);
return NULL;
@@ -1912,7 +1924,8 @@ static int obj2ast_type_ignore(astmodulestate *state, PyObject* obj,
type_ignore_ty* out, PyArena* arena);
mod_ty
-Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
+Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, PyArena
+ *arena)
{
mod_ty p;
p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -1925,7 +1938,7 @@ Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
}
mod_ty
-Interactive(asdl_seq * body, PyArena *arena)
+Interactive(asdl_stmt_seq * body, PyArena *arena)
{
mod_ty p;
p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
@@ -1954,7 +1967,7 @@ Expression(expr_ty body, PyArena *arena)
}
mod_ty
-FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
+FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena)
{
mod_ty p;
if (!returns) {
@@ -1972,9 +1985,10 @@ FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
}
stmt_ty
-FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
- decorator_list, expr_ty returns, string type_comment, int lineno,
- int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2005,10 +2019,10 @@ FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
}
stmt_ty
-AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq
- * decorator_list, expr_ty returns, string type_comment, int
- lineno, int col_offset, int end_lineno, int end_col_offset,
- PyArena *arena)
+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) {
@@ -2039,9 +2053,9 @@ AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq
}
stmt_ty
-ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq *
- body, asdl_seq * decorator_list, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2083,7 +2097,7 @@ Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
}
stmt_ty
-Delete(asdl_seq * targets, int lineno, int col_offset, int end_lineno, int
+Delete(asdl_expr_seq * targets, int lineno, int col_offset, int end_lineno, int
end_col_offset, PyArena *arena)
{
stmt_ty p;
@@ -2100,8 +2114,8 @@ Delete(asdl_seq * targets, int lineno, int col_offset, int end_lineno, int
}
stmt_ty
-Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2189,8 +2203,8 @@ AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int
}
stmt_ty
-For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string
- type_comment, int lineno, int col_offset, int end_lineno, int
+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;
@@ -2221,9 +2235,9 @@ For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string
}
stmt_ty
-AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
- string type_comment, int lineno, int col_offset, int end_lineno, int
- end_col_offset, PyArena *arena)
+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) {
@@ -2253,8 +2267,8 @@ AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
}
stmt_ty
-While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2277,7 +2291,7 @@ While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
}
stmt_ty
-If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
+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;
@@ -2301,8 +2315,8 @@ If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
}
stmt_ty
-With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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));
@@ -2320,8 +2334,9 @@ With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
}
stmt_ty
-AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno,
- int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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));
@@ -2357,9 +2372,9 @@ Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno,
}
stmt_ty
-Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, asdl_seq *
- finalbody, int lineno, int col_offset, int end_lineno, int end_col_offset,
- PyArena *arena)
+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));
@@ -2401,7 +2416,7 @@ Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno,
}
stmt_ty
-Import(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
+Import(asdl_alias_seq * names, int lineno, int col_offset, int end_lineno, int
end_col_offset, PyArena *arena)
{
stmt_ty p;
@@ -2418,8 +2433,8 @@ Import(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
}
stmt_ty
-ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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));
@@ -2437,8 +2452,8 @@ ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
}
stmt_ty
-Global(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
- end_col_offset, PyArena *arena)
+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));
@@ -2454,8 +2469,8 @@ Global(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
}
stmt_ty
-Nonlocal(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
- end_col_offset, PyArena *arena)
+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));
@@ -2541,7 +2556,7 @@ Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
}
expr_ty
-BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, int
+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;
@@ -2716,8 +2731,8 @@ IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
}
expr_ty
-Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena)
+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));
@@ -2734,7 +2749,7 @@ Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, int
}
expr_ty
-Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, int
+Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno, int
end_col_offset, PyArena *arena)
{
expr_ty p;
@@ -2751,8 +2766,8 @@ Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, int
}
expr_ty
-ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2774,8 +2789,8 @@ ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
}
expr_ty
-SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2797,8 +2812,9 @@ SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
}
expr_ty
-DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2826,8 +2842,8 @@ DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
}
expr_ty
-GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
- int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2910,8 +2926,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_seq * comparators, int lineno,
- int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2934,8 +2951,8 @@ Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
}
expr_ty
-Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -2983,8 +3000,8 @@ FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno,
}
expr_ty
-JoinedStr(asdl_seq * values, int lineno, int col_offset, int end_lineno, int
- end_col_offset, PyArena *arena)
+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));
@@ -3147,7 +3164,7 @@ Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
}
expr_ty
-List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
+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;
@@ -3170,8 +3187,8 @@ List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
}
expr_ty
-Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena)
+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) {
@@ -3212,7 +3229,7 @@ Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset,
}
comprehension_ty
-comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,
+comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async,
PyArena *arena)
{
comprehension_ty p;
@@ -3237,8 +3254,9 @@ comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,
}
excepthandler_ty
-ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
- col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+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));
@@ -3256,9 +3274,9 @@ ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
}
arguments_ty
-arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty vararg, asdl_seq *
- kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg, asdl_seq *
- defaults, PyArena *arena)
+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));
@@ -3386,12 +3404,12 @@ ast2obj_mod(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Module_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Module.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Module.type_ignores,
+ value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
ast2obj_type_ignore);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
@@ -3402,7 +3420,8 @@ ast2obj_mod(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Interactive_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Interactive.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -3422,7 +3441,8 @@ ast2obj_mod(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->FunctionType_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.FunctionType.argtypes, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->argtypes, value) == -1)
goto failed;
@@ -3465,12 +3485,13 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.FunctionDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.FunctionDef.decorator_list,
+ value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3501,12 +3522,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.AsyncFunctionDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.AsyncFunctionDef.decorator_list,
+ value = ast2obj_list(state,
+ (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3532,22 +3555,26 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ClassDef.bases, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->bases, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ClassDef.keywords, ast2obj_keyword);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
+ ast2obj_keyword);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keywords, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ClassDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ClassDef.decorator_list, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
@@ -3567,7 +3594,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Delete_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Delete.targets, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->targets, value) == -1)
goto failed;
@@ -3577,7 +3605,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Assign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Assign.targets, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->targets, value) == -1)
goto failed;
@@ -3652,12 +3681,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.For.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.For.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3682,12 +3711,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.AsyncFor.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.AsyncFor.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3707,12 +3738,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.While.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.While.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3727,12 +3758,12 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.If.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.If.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
@@ -3742,12 +3773,13 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->With_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.With.items, ast2obj_withitem);
+ value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
+ ast2obj_withitem);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.With.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -3762,12 +3794,14 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->AsyncWith_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.AsyncWith.items, ast2obj_withitem);
+ value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
+ ast2obj_withitem);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.AsyncWith.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -3797,22 +3831,24 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Try_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Try.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Try.handlers, ast2obj_excepthandler);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
+ ast2obj_excepthandler);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->handlers, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Try.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Try.finalbody, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->finalbody, value) == -1)
goto failed;
@@ -3837,7 +3873,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Import_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Import.names, ast2obj_alias);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
+ ast2obj_alias);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
@@ -3852,7 +3889,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->module, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ImportFrom.names, ast2obj_alias);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
+ ast2obj_alias);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
@@ -3867,7 +3905,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Global_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Global.names, ast2obj_identifier);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
+ ast2obj_identifier);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
@@ -3877,7 +3916,8 @@ ast2obj_stmt(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Nonlocal_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Nonlocal.names, ast2obj_identifier);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
+ ast2obj_identifier);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
@@ -3955,7 +3995,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.BoolOp.values, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
@@ -4050,12 +4091,12 @@ ast2obj_expr(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Dict_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Dict.keys, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keys, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Dict.values, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
@@ -4065,7 +4106,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Set_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Set.elts, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
@@ -4080,7 +4121,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ListComp.generators,
+ value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4096,7 +4137,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.SetComp.generators,
+ value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4117,7 +4158,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.DictComp.generators,
+ value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4133,7 +4174,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.GeneratorExp.generators,
+ value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
ast2obj_comprehension);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4190,7 +4231,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->ops, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Compare.comparators, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->comparators, value) == -1)
goto failed;
@@ -4205,12 +4247,13 @@ ast2obj_expr(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->func, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Call.args, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.Call.keywords, ast2obj_keyword);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
+ ast2obj_keyword);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->keywords, value) == -1)
goto failed;
@@ -4240,7 +4283,8 @@ ast2obj_expr(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->JoinedStr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.JoinedStr.values, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
+ ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
@@ -4335,7 +4379,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->List_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.List.elts, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
@@ -4350,7 +4394,7 @@ ast2obj_expr(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->Tuple_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(state, o->v.Tuple.elts, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
@@ -4557,7 +4601,7 @@ ast2obj_comprehension(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->ifs, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->ifs, value) == -1)
goto failed;
@@ -4598,7 +4642,8 @@ ast2obj_excepthandler(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->v.ExceptHandler.body, ast2obj_stmt);
+ value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
+ ast2obj_stmt);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
@@ -4644,12 +4689,12 @@ ast2obj_arguments(astmodulestate *state, void* _o)
tp = (PyTypeObject *)state->arguments_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_list(state, o->posonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->args, ast2obj_arg);
+ value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
@@ -4659,12 +4704,12 @@ ast2obj_arguments(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->vararg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->kwonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->kw_defaults, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
goto failed;
@@ -4674,7 +4719,7 @@ ast2obj_arguments(astmodulestate *state, void* _o)
if (PyObject_SetAttr(result, state->kwarg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(state, o->defaults, ast2obj_expr);
+ value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
if (!value) goto failed;
if (PyObject_SetAttr(result, state->defaults, value) == -1)
goto failed;
@@ -4899,8 +4944,8 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* body;
- asdl_seq* type_ignores;
+ asdl_stmt_seq* body;
+ asdl_type_ignore_seq* type_ignores;
if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
@@ -4918,7 +4963,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -4951,7 +4996,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- type_ignores = _Py_asdl_seq_new(len, arena);
+ type_ignores = _Py_asdl_type_ignore_seq_new(len, arena);
if (type_ignores == NULL) goto failed;
for (i = 0; i < len; i++) {
type_ignore_ty val;
@@ -4978,7 +5023,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* body;
+ asdl_stmt_seq* body;
if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
@@ -4996,7 +5041,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -5048,7 +5093,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* argtypes;
+ asdl_expr_seq* argtypes;
expr_ty returns;
if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) {
@@ -5067,7 +5112,7 @@ obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- argtypes = _Py_asdl_seq_new(len, arena);
+ argtypes = _Py_asdl_expr_seq_new(len, arena);
if (argtypes == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5184,8 +5229,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
identifier name;
arguments_ty args;
- asdl_seq* body;
- asdl_seq* decorator_list;
+ asdl_stmt_seq* body;
+ asdl_expr_seq* decorator_list;
expr_ty returns;
string type_comment;
@@ -5231,7 +5276,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -5264,7 +5309,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- decorator_list = _Py_asdl_seq_new(len, arena);
+ decorator_list = _Py_asdl_expr_seq_new(len, arena);
if (decorator_list == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5321,8 +5366,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
identifier name;
arguments_ty args;
- asdl_seq* body;
- asdl_seq* decorator_list;
+ asdl_stmt_seq* body;
+ asdl_expr_seq* decorator_list;
expr_ty returns;
string type_comment;
@@ -5368,7 +5413,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -5401,7 +5446,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- decorator_list = _Py_asdl_seq_new(len, arena);
+ decorator_list = _Py_asdl_expr_seq_new(len, arena);
if (decorator_list == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5457,10 +5502,10 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
}
if (isinstance) {
identifier name;
- asdl_seq* bases;
- asdl_seq* keywords;
- asdl_seq* body;
- asdl_seq* decorator_list;
+ asdl_expr_seq* bases;
+ asdl_keyword_seq* keywords;
+ asdl_stmt_seq* body;
+ asdl_expr_seq* decorator_list;
if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
@@ -5491,7 +5536,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- bases = _Py_asdl_seq_new(len, arena);
+ bases = _Py_asdl_expr_seq_new(len, arena);
if (bases == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5524,7 +5569,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- keywords = _Py_asdl_seq_new(len, arena);
+ keywords = _Py_asdl_keyword_seq_new(len, arena);
if (keywords == NULL) goto failed;
for (i = 0; i < len; i++) {
keyword_ty val;
@@ -5557,7 +5602,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -5590,7 +5635,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- decorator_list = _Py_asdl_seq_new(len, arena);
+ decorator_list = _Py_asdl_expr_seq_new(len, arena);
if (decorator_list == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5644,7 +5689,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* targets;
+ asdl_expr_seq* targets;
if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) {
return 1;
@@ -5662,7 +5707,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- targets = _Py_asdl_seq_new(len, arena);
+ targets = _Py_asdl_expr_seq_new(len, arena);
if (targets == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5690,7 +5735,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* targets;
+ asdl_expr_seq* targets;
expr_ty value;
string type_comment;
@@ -5710,7 +5755,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- targets = _Py_asdl_seq_new(len, arena);
+ targets = _Py_asdl_expr_seq_new(len, arena);
if (targets == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -5888,8 +5933,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
expr_ty target;
expr_ty iter;
- asdl_seq* body;
- asdl_seq* orelse;
+ asdl_stmt_seq* body;
+ asdl_stmt_seq* orelse;
string type_comment;
if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -5934,7 +5979,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -5967,7 +6012,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- orelse = _Py_asdl_seq_new(len, arena);
+ orelse = _Py_asdl_stmt_seq_new(len, arena);
if (orelse == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6010,8 +6055,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
expr_ty target;
expr_ty iter;
- asdl_seq* body;
- asdl_seq* orelse;
+ asdl_stmt_seq* body;
+ asdl_stmt_seq* orelse;
string type_comment;
if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -6056,7 +6101,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6089,7 +6134,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- orelse = _Py_asdl_seq_new(len, arena);
+ orelse = _Py_asdl_stmt_seq_new(len, arena);
if (orelse == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6131,8 +6176,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty test;
- asdl_seq* body;
- asdl_seq* orelse;
+ asdl_stmt_seq* body;
+ asdl_stmt_seq* orelse;
if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
@@ -6163,7 +6208,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6196,7 +6241,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- orelse = _Py_asdl_seq_new(len, arena);
+ orelse = _Py_asdl_stmt_seq_new(len, arena);
if (orelse == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6225,8 +6270,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty test;
- asdl_seq* body;
- asdl_seq* orelse;
+ asdl_stmt_seq* body;
+ asdl_stmt_seq* orelse;
if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
@@ -6257,7 +6302,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6290,7 +6335,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- orelse = _Py_asdl_seq_new(len, arena);
+ orelse = _Py_asdl_stmt_seq_new(len, arena);
if (orelse == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6318,8 +6363,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* items;
- asdl_seq* body;
+ asdl_withitem_seq* items;
+ asdl_stmt_seq* body;
string type_comment;
if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6338,7 +6383,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- items = _Py_asdl_seq_new(len, arena);
+ items = _Py_asdl_withitem_seq_new(len, arena);
if (items == NULL) goto failed;
for (i = 0; i < len; i++) {
withitem_ty val;
@@ -6371,7 +6416,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6412,8 +6457,8 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* items;
- asdl_seq* body;
+ asdl_withitem_seq* items;
+ asdl_stmt_seq* body;
string type_comment;
if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6432,7 +6477,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- items = _Py_asdl_seq_new(len, arena);
+ items = _Py_asdl_withitem_seq_new(len, arena);
if (items == NULL) goto failed;
for (i = 0; i < len; i++) {
withitem_ty val;
@@ -6465,7 +6510,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6546,10 +6591,10 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* body;
- asdl_seq* handlers;
- asdl_seq* orelse;
- asdl_seq* finalbody;
+ asdl_stmt_seq* body;
+ asdl_excepthandler_seq* handlers;
+ asdl_stmt_seq* orelse;
+ asdl_stmt_seq* finalbody;
if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
@@ -6567,7 +6612,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6600,7 +6645,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- handlers = _Py_asdl_seq_new(len, arena);
+ handlers = _Py_asdl_excepthandler_seq_new(len, arena);
if (handlers == NULL) goto failed;
for (i = 0; i < len; i++) {
excepthandler_ty val;
@@ -6633,7 +6678,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- orelse = _Py_asdl_seq_new(len, arena);
+ orelse = _Py_asdl_stmt_seq_new(len, arena);
if (orelse == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6666,7 +6711,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- finalbody = _Py_asdl_seq_new(len, arena);
+ finalbody = _Py_asdl_stmt_seq_new(len, arena);
if (finalbody == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -6734,7 +6779,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* names;
+ asdl_alias_seq* names;
if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
@@ -6752,7 +6797,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- names = _Py_asdl_seq_new(len, arena);
+ names = _Py_asdl_alias_seq_new(len, arena);
if (names == NULL) goto failed;
for (i = 0; i < len; i++) {
alias_ty val;
@@ -6781,7 +6826,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
}
if (isinstance) {
identifier module;
- asdl_seq* names;
+ asdl_alias_seq* names;
int level;
if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) {
@@ -6813,7 +6858,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- names = _Py_asdl_seq_new(len, arena);
+ names = _Py_asdl_alias_seq_new(len, arena);
if (names == NULL) goto failed;
for (i = 0; i < len; i++) {
alias_ty val;
@@ -6854,7 +6899,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* names;
+ asdl_identifier_seq* names;
if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
@@ -6872,7 +6917,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- names = _Py_asdl_seq_new(len, arena);
+ names = _Py_asdl_identifier_seq_new(len, arena);
if (names == NULL) goto failed;
for (i = 0; i < len; i++) {
identifier val;
@@ -6900,7 +6945,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* names;
+ asdl_identifier_seq* names;
if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
@@ -6918,7 +6963,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- names = _Py_asdl_seq_new(len, arena);
+ names = _Py_asdl_identifier_seq_new(len, arena);
if (names == NULL) goto failed;
for (i = 0; i < len; i++) {
identifier val;
@@ -7081,7 +7126,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
}
if (isinstance) {
boolop_ty op;
- asdl_seq* values;
+ asdl_expr_seq* values;
if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
return 1;
@@ -7112,7 +7157,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- values = _Py_asdl_seq_new(len, arena);
+ values = _Py_asdl_expr_seq_new(len, arena);
if (values == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7368,8 +7413,8 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* keys;
- asdl_seq* values;
+ asdl_expr_seq* keys;
+ asdl_expr_seq* values;
if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) {
return 1;
@@ -7387,7 +7432,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- keys = _Py_asdl_seq_new(len, arena);
+ keys = _Py_asdl_expr_seq_new(len, arena);
if (keys == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7420,7 +7465,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- values = _Py_asdl_seq_new(len, arena);
+ values = _Py_asdl_expr_seq_new(len, arena);
if (values == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7448,7 +7493,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* elts;
+ asdl_expr_seq* elts;
if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
return 1;
@@ -7466,7 +7511,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- elts = _Py_asdl_seq_new(len, arena);
+ elts = _Py_asdl_expr_seq_new(len, arena);
if (elts == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7494,7 +7539,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty elt;
- asdl_seq* generators;
+ asdl_comprehension_seq* generators;
if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
@@ -7525,7 +7570,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- generators = _Py_asdl_seq_new(len, arena);
+ generators = _Py_asdl_comprehension_seq_new(len, arena);
if (generators == NULL) goto failed;
for (i = 0; i < len; i++) {
comprehension_ty val;
@@ -7554,7 +7599,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty elt;
- asdl_seq* generators;
+ asdl_comprehension_seq* generators;
if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
@@ -7585,7 +7630,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- generators = _Py_asdl_seq_new(len, arena);
+ generators = _Py_asdl_comprehension_seq_new(len, arena);
if (generators == NULL) goto failed;
for (i = 0; i < len; i++) {
comprehension_ty val;
@@ -7615,7 +7660,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
expr_ty key;
expr_ty value;
- asdl_seq* generators;
+ asdl_comprehension_seq* generators;
if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) {
return 1;
@@ -7659,7 +7704,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- generators = _Py_asdl_seq_new(len, arena);
+ generators = _Py_asdl_comprehension_seq_new(len, arena);
if (generators == NULL) goto failed;
for (i = 0; i < len; i++) {
comprehension_ty val;
@@ -7688,7 +7733,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty elt;
- asdl_seq* generators;
+ asdl_comprehension_seq* generators;
if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
@@ -7719,7 +7764,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- generators = _Py_asdl_seq_new(len, arena);
+ generators = _Py_asdl_comprehension_seq_new(len, arena);
if (generators == NULL) goto failed;
for (i = 0; i < len; i++) {
comprehension_ty val;
@@ -7827,7 +7872,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
expr_ty left;
asdl_int_seq* ops;
- asdl_seq* comparators;
+ asdl_expr_seq* comparators;
if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) {
return 1;
@@ -7891,7 +7936,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- comparators = _Py_asdl_seq_new(len, arena);
+ comparators = _Py_asdl_expr_seq_new(len, arena);
if (comparators == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7920,8 +7965,8 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
}
if (isinstance) {
expr_ty func;
- asdl_seq* args;
- asdl_seq* keywords;
+ asdl_expr_seq* args;
+ asdl_keyword_seq* keywords;
if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) {
return 1;
@@ -7952,7 +7997,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- args = _Py_asdl_seq_new(len, arena);
+ args = _Py_asdl_expr_seq_new(len, arena);
if (args == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -7985,7 +8030,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- keywords = _Py_asdl_seq_new(len, arena);
+ keywords = _Py_asdl_keyword_seq_new(len, arena);
if (keywords == NULL) goto failed;
for (i = 0; i < len; i++) {
keyword_ty val;
@@ -8067,7 +8112,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* values;
+ asdl_expr_seq* values;
if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
return 1;
@@ -8085,7 +8130,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- values = _Py_asdl_seq_new(len, arena);
+ values = _Py_asdl_expr_seq_new(len, arena);
if (values == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -8341,7 +8386,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* elts;
+ asdl_expr_seq* elts;
expr_context_ty ctx;
if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8360,7 +8405,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- elts = _Py_asdl_seq_new(len, arena);
+ elts = _Py_asdl_expr_seq_new(len, arena);
if (elts == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -8401,7 +8446,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
return 1;
}
if (isinstance) {
- asdl_seq* elts;
+ asdl_expr_seq* elts;
expr_context_ty ctx;
if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8420,7 +8465,7 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
goto failed;
}
len = PyList_GET_SIZE(tmp);
- elts = _Py_asdl_seq_new(len, arena);
+ elts = _Py_asdl_expr_seq_new(len, arena);
if (elts == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -8834,7 +8879,7 @@ obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
PyObject* tmp = NULL;
expr_ty target;
expr_ty iter;
- asdl_seq* ifs;
+ asdl_expr_seq* ifs;
int is_async;
if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -8879,7 +8924,7 @@ obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
goto failed;
}
len = PyList_GET_SIZE(tmp);
- ifs = _Py_asdl_seq_new(len, arena);
+ ifs = _Py_asdl_expr_seq_new(len, arena);
if (ifs == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -8993,7 +9038,7 @@ obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
if (isinstance) {
expr_ty type;
identifier name;
- asdl_seq* body;
+ asdl_stmt_seq* body;
if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) {
return 1;
@@ -9037,7 +9082,7 @@ obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
goto failed;
}
len = PyList_GET_SIZE(tmp);
- body = _Py_asdl_seq_new(len, arena);
+ body = _Py_asdl_stmt_seq_new(len, arena);
if (body == NULL) goto failed;
for (i = 0; i < len; i++) {
stmt_ty val;
@@ -9071,13 +9116,13 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
PyArena* arena)
{
PyObject* tmp = NULL;
- asdl_seq* posonlyargs;
- asdl_seq* args;
+ asdl_arg_seq* posonlyargs;
+ asdl_arg_seq* args;
arg_ty vararg;
- asdl_seq* kwonlyargs;
- asdl_seq* kw_defaults;
+ asdl_arg_seq* kwonlyargs;
+ asdl_expr_seq* kw_defaults;
arg_ty kwarg;
- asdl_seq* defaults;
+ asdl_expr_seq* defaults;
if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) {
return 1;
@@ -9095,7 +9140,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
goto failed;
}
len = PyList_GET_SIZE(tmp);
- posonlyargs = _Py_asdl_seq_new(len, arena);
+ posonlyargs = _Py_asdl_arg_seq_new(len, arena);
if (posonlyargs == NULL) goto failed;
for (i = 0; i < len; i++) {
arg_ty val;
@@ -9128,7 +9173,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
goto failed;
}
len = PyList_GET_SIZE(tmp);
- args = _Py_asdl_seq_new(len, arena);
+ args = _Py_asdl_arg_seq_new(len, arena);
if (args == NULL) goto failed;
for (i = 0; i < len; i++) {
arg_ty val;
@@ -9174,7 +9219,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
goto failed;
}
len = PyList_GET_SIZE(tmp);
- kwonlyargs = _Py_asdl_seq_new(len, arena);
+ kwonlyargs = _Py_asdl_arg_seq_new(len, arena);
if (kwonlyargs == NULL) goto failed;
for (i = 0; i < len; i++) {
arg_ty val;
@@ -9207,7 +9252,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
goto failed;
}
len = PyList_GET_SIZE(tmp);
- kw_defaults = _Py_asdl_seq_new(len, arena);
+ kw_defaults = _Py_asdl_expr_seq_new(len, arena);
if (kw_defaults == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
@@ -9253,7 +9298,7 @@ obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
goto failed;
}
len = PyList_GET_SIZE(tmp);
- defaults = _Py_asdl_seq_new(len, arena);
+ defaults = _Py_asdl_expr_seq_new(len, arena);
if (defaults == NULL) goto failed;
for (i = 0; i < len; i++) {
expr_ty val;
diff --git a/Python/asdl.c b/Python/asdl.c
index c211078..4ff07e4 100644
--- a/Python/asdl.c
+++ b/Python/asdl.c
@@ -1,64 +1,6 @@
#include "Python.h"
#include "asdl.h"
-asdl_seq *
-_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)
-{
- asdl_seq *seq = NULL;
- size_t n;
-
- /* check size is sane */
- if (size < 0 ||
- (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
- PyErr_NoMemory();
- return NULL;
- }
- n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
- /* check if size can be added safely */
- if (n > SIZE_MAX - sizeof(asdl_seq)) {
- PyErr_NoMemory();
- return NULL;
- }
- n += sizeof(asdl_seq);
-
- seq = (asdl_seq *)PyArena_Malloc(arena, n);
- if (!seq) {
- PyErr_NoMemory();
- return NULL;
- }
- memset(seq, 0, n);
- seq->size = size;
- return seq;
-}
-
-asdl_int_seq *
-_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)
-{
- asdl_int_seq *seq = NULL;
- size_t n;
-
- /* check size is sane */
- if (size < 0 ||
- (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
- PyErr_NoMemory();
- return NULL;
- }
- n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
- /* check if size can be added safely */
- if (n > SIZE_MAX - sizeof(asdl_seq)) {
- PyErr_NoMemory();
- return NULL;
- }
- n += sizeof(asdl_seq);
-
- seq = (asdl_int_seq *)PyArena_Malloc(arena, n);
- if (!seq) {
- PyErr_NoMemory();
- return NULL;
- }
- memset(seq, 0, n);
- seq->size = size;
- return seq;
-}
+GENERATE_ASDL_SEQ_CONSTRUCTOR(generic, void*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(identifier, PyObject*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(int, int);
diff --git a/Python/ast.c b/Python/ast.c
index 7bf66e5..4b7bbd2 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -14,9 +14,9 @@
#define MAXLEVEL 200 /* Max parentheses level */
-static int validate_stmts(asdl_seq *);
-static int validate_exprs(asdl_seq *, expr_context_ty, int);
-static int validate_nonempty_seq(asdl_seq *, const char *, const char *);
+static int validate_stmts(asdl_stmt_seq *);
+static int validate_exprs(asdl_expr_seq*, expr_context_ty, int);
+static int _validate_nonempty_seq(asdl_seq *, const char *, const char *);
static int validate_stmt(stmt_ty);
static int validate_expr(expr_ty, expr_context_ty);
@@ -40,7 +40,7 @@ validate_name(PyObject *name)
}
static int
-validate_comprehension(asdl_seq *gens)
+validate_comprehension(asdl_comprehension_seq *gens)
{
Py_ssize_t i;
if (!asdl_seq_LEN(gens)) {
@@ -58,7 +58,7 @@ validate_comprehension(asdl_seq *gens)
}
static int
-validate_keywords(asdl_seq *keywords)
+validate_keywords(asdl_keyword_seq *keywords)
{
Py_ssize_t i;
for (i = 0; i < asdl_seq_LEN(keywords); i++)
@@ -68,7 +68,7 @@ validate_keywords(asdl_seq *keywords)
}
static int
-validate_args(asdl_seq *args)
+validate_args(asdl_arg_seq *args)
{
Py_ssize_t i;
for (i = 0; i < asdl_seq_LEN(args); i++) {
@@ -324,23 +324,24 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
}
static int
-validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
+_validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
{
if (asdl_seq_LEN(seq))
return 1;
PyErr_Format(PyExc_ValueError, "empty %s on %s", what, owner);
return 0;
}
+#define validate_nonempty_seq(seq, what, owner) _validate_nonempty_seq((asdl_seq*)seq, what, owner)
static int
-validate_assignlist(asdl_seq *targets, expr_context_ty ctx)
+validate_assignlist(asdl_expr_seq *targets, expr_context_ty ctx)
{
return validate_nonempty_seq(targets, "targets", ctx == Del ? "Delete" : "Assign") &&
validate_exprs(targets, ctx, 0);
}
static int
-validate_body(asdl_seq *body, const char *owner)
+validate_body(asdl_stmt_seq *body, const char *owner)
{
return validate_nonempty_seq(body, "body", owner) && validate_stmts(body);
}
@@ -488,7 +489,7 @@ validate_stmt(stmt_ty stmt)
}
static int
-validate_stmts(asdl_seq *seq)
+validate_stmts(asdl_stmt_seq *seq)
{
Py_ssize_t i;
for (i = 0; i < asdl_seq_LEN(seq); i++) {
@@ -507,7 +508,7 @@ validate_stmts(asdl_seq *seq)
}
static int
-validate_exprs(asdl_seq *exprs, expr_context_ty ctx, int null_ok)
+validate_exprs(asdl_expr_seq *exprs, expr_context_ty ctx, int null_ok)
{
Py_ssize_t i;
for (i = 0; i < asdl_seq_LEN(exprs); i++) {
@@ -550,7 +551,7 @@ PyAST_Validate(mod_ty mod)
}
PyObject *
-_PyAST_GetDocString(asdl_seq *body)
+_PyAST_GetDocString(asdl_stmt_seq *body)
{
if (!asdl_seq_LEN(body)) {
return NULL;
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index ff786d6..5efaac4 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -271,7 +271,7 @@ fold_binop(expr_ty node, PyArena *arena, _PyASTOptimizeState *state)
}
static PyObject*
-make_const_tuple(asdl_seq *elts)
+make_const_tuple(asdl_expr_seq *elts)
{
for (int i = 0; i < asdl_seq_LEN(elts); i++) {
expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -337,7 +337,7 @@ fold_iter(expr_ty arg, PyArena *arena, _PyASTOptimizeState *state)
PyObject *newval;
if (arg->kind == List_kind) {
/* First change a list into tuple. */
- asdl_seq *elts = arg->v.List.elts;
+ asdl_expr_seq *elts = arg->v.List.elts;
Py_ssize_t n = asdl_seq_LEN(elts);
for (Py_ssize_t i = 0; i < n; i++) {
expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -368,7 +368,7 @@ static int
fold_compare(expr_ty node, PyArena *arena, _PyASTOptimizeState *state)
{
asdl_int_seq *ops;
- asdl_seq *args;
+ asdl_expr_seq *args;
Py_ssize_t i;
ops = node->v.Compare.ops;
@@ -405,9 +405,9 @@ static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOp
#define CALL_SEQ(FUNC, TYPE, ARG) { \
int i; \
- asdl_seq *seq = (ARG); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (ARG); /* avoid variable capture */ \
for (i = 0; i < asdl_seq_LEN(seq); i++) { \
- TYPE elt = (TYPE)asdl_seq_GET(seq, i); \
+ TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
if (elt != NULL && !FUNC(elt, ctx_, state)) \
return 0; \
} \
@@ -424,13 +424,13 @@ static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOp
}
static int
-astfold_body(asdl_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
+astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
{
int docstring = _PyAST_GetDocString(stmts) != NULL;
- CALL_SEQ(astfold_stmt, stmt_ty, stmts);
+ CALL_SEQ(astfold_stmt, stmt, stmts);
if (!docstring && _PyAST_GetDocString(stmts) != NULL) {
stmt_ty st = (stmt_ty)asdl_seq_GET(stmts, 0);
- asdl_seq *values = _Py_asdl_seq_new(1, ctx_);
+ asdl_expr_seq *values = _Py_asdl_expr_seq_new(1, ctx_);
if (!values) {
return 0;
}
@@ -453,7 +453,7 @@ astfold_mod(mod_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
CALL(astfold_body, asdl_seq, node_->v.Module.body);
break;
case Interactive_kind:
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Interactive.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.Interactive.body);
break;
case Expression_kind:
CALL(astfold_expr, expr_ty, node_->v.Expression.body);
@@ -469,7 +469,7 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
{
switch (node_->kind) {
case BoolOp_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.BoolOp.values);
+ CALL_SEQ(astfold_expr, expr, node_->v.BoolOp.values);
break;
case BinOp_kind:
CALL(astfold_expr, expr_ty, node_->v.BinOp.left);
@@ -490,28 +490,28 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
CALL(astfold_expr, expr_ty, node_->v.IfExp.orelse);
break;
case Dict_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.keys);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.values);
+ CALL_SEQ(astfold_expr, expr, node_->v.Dict.keys);
+ CALL_SEQ(astfold_expr, expr, node_->v.Dict.values);
break;
case Set_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Set.elts);
+ CALL_SEQ(astfold_expr, expr, node_->v.Set.elts);
break;
case ListComp_kind:
CALL(astfold_expr, expr_ty, node_->v.ListComp.elt);
- CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.ListComp.generators);
+ CALL_SEQ(astfold_comprehension, comprehension, node_->v.ListComp.generators);
break;
case SetComp_kind:
CALL(astfold_expr, expr_ty, node_->v.SetComp.elt);
- CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.SetComp.generators);
+ CALL_SEQ(astfold_comprehension, comprehension, node_->v.SetComp.generators);
break;
case DictComp_kind:
CALL(astfold_expr, expr_ty, node_->v.DictComp.key);
CALL(astfold_expr, expr_ty, node_->v.DictComp.value);
- CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.DictComp.generators);
+ CALL_SEQ(astfold_comprehension, comprehension, node_->v.DictComp.generators);
break;
case GeneratorExp_kind:
CALL(astfold_expr, expr_ty, node_->v.GeneratorExp.elt);
- CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.GeneratorExp.generators);
+ CALL_SEQ(astfold_comprehension, comprehension, node_->v.GeneratorExp.generators);
break;
case Await_kind:
CALL(astfold_expr, expr_ty, node_->v.Await.value);
@@ -524,20 +524,20 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
break;
case Compare_kind:
CALL(astfold_expr, expr_ty, node_->v.Compare.left);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Compare.comparators);
+ CALL_SEQ(astfold_expr, expr, node_->v.Compare.comparators);
CALL(fold_compare, expr_ty, node_);
break;
case Call_kind:
CALL(astfold_expr, expr_ty, node_->v.Call.func);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Call.args);
- CALL_SEQ(astfold_keyword, keyword_ty, node_->v.Call.keywords);
+ CALL_SEQ(astfold_expr, expr, node_->v.Call.args);
+ CALL_SEQ(astfold_keyword, keyword, node_->v.Call.keywords);
break;
case FormattedValue_kind:
CALL(astfold_expr, expr_ty, node_->v.FormattedValue.value);
CALL_OPT(astfold_expr, expr_ty, node_->v.FormattedValue.format_spec);
break;
case JoinedStr_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.JoinedStr.values);
+ CALL_SEQ(astfold_expr, expr, node_->v.JoinedStr.values);
break;
case Attribute_kind:
CALL(astfold_expr, expr_ty, node_->v.Attribute.value);
@@ -556,10 +556,10 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.step);
break;
case List_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.List.elts);
+ CALL_SEQ(astfold_expr, expr, node_->v.List.elts);
break;
case Tuple_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Tuple.elts);
+ CALL_SEQ(astfold_expr, expr, node_->v.Tuple.elts);
CALL(fold_tuple, expr_ty, node_);
break;
case Name_kind:
@@ -586,7 +586,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState
{
CALL(astfold_expr, expr_ty, node_->target);
CALL(astfold_expr, expr_ty, node_->iter);
- CALL_SEQ(astfold_expr, expr_ty, node_->ifs);
+ CALL_SEQ(astfold_expr, expr, node_->ifs);
CALL(fold_iter, expr_ty, node_->iter);
return 1;
@@ -595,13 +595,13 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, _PyASTOptimizeState
static int
astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
{
- CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
- CALL_SEQ(astfold_arg, arg_ty, node_->args);
+ CALL_SEQ(astfold_arg, arg, node_->posonlyargs);
+ CALL_SEQ(astfold_arg, arg, node_->args);
CALL_OPT(astfold_arg, arg_ty, node_->vararg);
- CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
- CALL_SEQ(astfold_expr, expr_ty, node_->kw_defaults);
+ CALL_SEQ(astfold_arg, arg, node_->kwonlyargs);
+ CALL_SEQ(astfold_expr, expr, node_->kw_defaults);
CALL_OPT(astfold_arg, arg_ty, node_->kwarg);
- CALL_SEQ(astfold_expr, expr_ty, node_->defaults);
+ CALL_SEQ(astfold_expr, expr, node_->defaults);
return 1;
}
@@ -621,7 +621,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
case FunctionDef_kind:
CALL(astfold_arguments, arguments_ty, node_->v.FunctionDef.args);
CALL(astfold_body, asdl_seq, node_->v.FunctionDef.body);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.FunctionDef.decorator_list);
+ CALL_SEQ(astfold_expr, expr, node_->v.FunctionDef.decorator_list);
if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
CALL_OPT(astfold_expr, expr_ty, node_->v.FunctionDef.returns);
}
@@ -629,25 +629,25 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
case AsyncFunctionDef_kind:
CALL(astfold_arguments, arguments_ty, node_->v.AsyncFunctionDef.args);
CALL(astfold_body, asdl_seq, node_->v.AsyncFunctionDef.body);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.decorator_list);
+ CALL_SEQ(astfold_expr, expr, node_->v.AsyncFunctionDef.decorator_list);
if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
CALL_OPT(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.returns);
}
break;
case ClassDef_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.bases);
- CALL_SEQ(astfold_keyword, keyword_ty, node_->v.ClassDef.keywords);
+ CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.bases);
+ CALL_SEQ(astfold_keyword, keyword, node_->v.ClassDef.keywords);
CALL(astfold_body, asdl_seq, node_->v.ClassDef.body);
- CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.decorator_list);
+ CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.decorator_list);
break;
case Return_kind:
CALL_OPT(astfold_expr, expr_ty, node_->v.Return.value);
break;
case Delete_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Delete.targets);
+ CALL_SEQ(astfold_expr, expr, node_->v.Delete.targets);
break;
case Assign_kind:
- CALL_SEQ(astfold_expr, expr_ty, node_->v.Assign.targets);
+ CALL_SEQ(astfold_expr, expr, node_->v.Assign.targets);
CALL(astfold_expr, expr_ty, node_->v.Assign.value);
break;
case AugAssign_kind:
@@ -664,44 +664,44 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
case For_kind:
CALL(astfold_expr, expr_ty, node_->v.For.target);
CALL(astfold_expr, expr_ty, node_->v.For.iter);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.body);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.orelse);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.For.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.For.orelse);
CALL(fold_iter, expr_ty, node_->v.For.iter);
break;
case AsyncFor_kind:
CALL(astfold_expr, expr_ty, node_->v.AsyncFor.target);
CALL(astfold_expr, expr_ty, node_->v.AsyncFor.iter);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.body);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.orelse);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.orelse);
break;
case While_kind:
CALL(astfold_expr, expr_ty, node_->v.While.test);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.body);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.orelse);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.While.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.While.orelse);
break;
case If_kind:
CALL(astfold_expr, expr_ty, node_->v.If.test);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.body);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.orelse);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.If.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.If.orelse);
break;
case With_kind:
- CALL_SEQ(astfold_withitem, withitem_ty, node_->v.With.items);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.With.body);
+ CALL_SEQ(astfold_withitem, withitem, node_->v.With.items);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.With.body);
break;
case AsyncWith_kind:
- CALL_SEQ(astfold_withitem, withitem_ty, node_->v.AsyncWith.items);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncWith.body);
+ CALL_SEQ(astfold_withitem, withitem, node_->v.AsyncWith.items);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncWith.body);
break;
case Raise_kind:
CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.exc);
CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.cause);
break;
case Try_kind:
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.body);
- CALL_SEQ(astfold_excepthandler, excepthandler_ty, node_->v.Try.handlers);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.orelse);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.finalbody);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.Try.body);
+ CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.Try.handlers);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.Try.orelse);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.Try.finalbody);
break;
case Assert_kind:
CALL(astfold_expr, expr_ty, node_->v.Assert.test);
@@ -722,7 +722,7 @@ astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState
switch (node_->kind) {
case ExceptHandler_kind:
CALL_OPT(astfold_expr, expr_ty, node_->v.ExceptHandler.type);
- CALL_SEQ(astfold_stmt, stmt_ty, node_->v.ExceptHandler.body);
+ CALL_SEQ(astfold_stmt, stmt, node_->v.ExceptHandler.body);
break;
default:
break;
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c
index e699751..a04ff93 100644
--- a/Python/ast_unparse.c
+++ b/Python/ast_unparse.c
@@ -117,7 +117,7 @@ static int
append_ast_boolop(_PyUnicodeWriter *writer, expr_ty e, int level)
{
Py_ssize_t i, value_count;
- asdl_seq *values;
+ asdl_expr_seq *values;
const char *op = (e->v.BoolOp.op == And) ? " and " : " or ";
int pr = (e->v.BoolOp.op == And) ? PR_AND : PR_OR;
@@ -398,7 +398,7 @@ append_ast_comprehension(_PyUnicodeWriter *writer, comprehension_ty gen)
}
static int
-append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_seq *comprehensions)
+append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_comprehension_seq *comprehensions)
{
Py_ssize_t i, gen_count;
gen_count = asdl_seq_LEN(comprehensions);
@@ -453,7 +453,7 @@ append_ast_compare(_PyUnicodeWriter *writer, expr_ty e, int level)
{
const char *op;
Py_ssize_t i, comparator_count;
- asdl_seq *comparators;
+ asdl_expr_seq *comparators;
asdl_int_seq *ops;
APPEND_STR_IF(level > PR_CMP, "(");
@@ -612,7 +612,7 @@ append_fstring_element(_PyUnicodeWriter *writer, expr_ty e, bool is_format_spec)
/* Build body separately to enable wrapping the entire stream of Strs,
Constants and FormattedValues in one opening and one closing quote. */
static PyObject *
-build_fstring_body(asdl_seq *values, bool is_format_spec)
+build_fstring_body(asdl_expr_seq *values, bool is_format_spec)
{
Py_ssize_t i, value_count;
_PyUnicodeWriter body_writer;
diff --git a/Python/compile.c b/Python/compile.c
index 2c53266..3ebf221 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -222,27 +222,27 @@ static int compiler_subscript(struct compiler *, expr_ty);
static int compiler_slice(struct compiler *, expr_ty);
static int inplace_binop(operator_ty);
-static int are_all_items_const(asdl_seq *, Py_ssize_t, Py_ssize_t);
+static int are_all_items_const(asdl_expr_seq *, Py_ssize_t, Py_ssize_t);
static int expr_constant(expr_ty);
static int compiler_with(struct compiler *, stmt_ty, int);
static int compiler_async_with(struct compiler *, stmt_ty, int);
static int compiler_async_for(struct compiler *, stmt_ty);
static int compiler_call_helper(struct compiler *c, int n,
- asdl_seq *args,
- asdl_seq *keywords);
+ asdl_expr_seq *args,
+ asdl_keyword_seq *keywords);
static int compiler_try_except(struct compiler *, stmt_ty);
static int compiler_set_qualname(struct compiler *);
static int compiler_sync_comprehension_generator(
struct compiler *c,
- asdl_seq *generators, int gen_index,
+ asdl_comprehension_seq *generators, int gen_index,
int depth,
expr_ty elt, expr_ty val, int type);
static int compiler_async_comprehension_generator(
struct compiler *c,
- asdl_seq *generators, int gen_index,
+ asdl_comprehension_seq *generators, int gen_index,
int depth,
expr_ty elt, expr_ty val, int type);
@@ -1525,7 +1525,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
#define VISIT_SEQ(C, TYPE, SEQ) { \
int _i; \
- asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
if (!compiler_visit_ ## TYPE((C), elt)) \
@@ -1535,7 +1535,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
#define VISIT_SEQ_IN_SCOPE(C, TYPE, SEQ) { \
int _i; \
- asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
if (!compiler_visit_ ## TYPE((C), elt)) { \
@@ -1559,7 +1559,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
/* Search if variable annotations are present statically in a block. */
static int
-find_ann(asdl_seq *stmts)
+find_ann(asdl_stmt_seq *stmts)
{
int i, j, res = 0;
stmt_ty st;
@@ -1778,7 +1778,7 @@ compiler_unwind_fblock_stack(struct compiler *c, int preserve_tos, struct fblock
and for annotations. */
static int
-compiler_body(struct compiler *c, asdl_seq *stmts)
+compiler_body(struct compiler *c, asdl_stmt_seq *stmts)
{
int i = 0;
stmt_ty st;
@@ -1841,8 +1841,7 @@ compiler_mod(struct compiler *c, mod_ty mod)
ADDOP(c, SETUP_ANNOTATIONS);
}
c->c_interactive = 1;
- VISIT_SEQ_IN_SCOPE(c, stmt,
- mod->v.Interactive.body);
+ VISIT_SEQ_IN_SCOPE(c, stmt, mod->v.Interactive.body);
break;
case Expression_kind:
VISIT_IN_SCOPE(c, expr, mod->v.Expression.body);
@@ -1945,7 +1944,7 @@ compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t flags, Py
}
static int
-compiler_decorators(struct compiler *c, asdl_seq* decos)
+compiler_decorators(struct compiler *c, asdl_expr_seq* decos)
{
int i;
@@ -1959,8 +1958,8 @@ compiler_decorators(struct compiler *c, asdl_seq* decos)
}
static int
-compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs,
- asdl_seq *kw_defaults)
+compiler_visit_kwonlydefaults(struct compiler *c, asdl_arg_seq *kwonlyargs,
+ asdl_expr_seq *kw_defaults)
{
/* Push a dict of keyword-only default values.
@@ -2047,7 +2046,7 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
}
static int
-compiler_visit_argannotations(struct compiler *c, asdl_seq* args,
+compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args,
PyObject *names)
{
int i;
@@ -2173,7 +2172,7 @@ compiler_check_debug_one_arg(struct compiler *c, arg_ty arg)
}
static int
-compiler_check_debug_args_seq(struct compiler *c, asdl_seq *args)
+compiler_check_debug_args_seq(struct compiler *c, asdl_arg_seq *args)
{
if (args != NULL) {
for (Py_ssize_t i = 0, n = asdl_seq_LEN(args); i < n; i++) {
@@ -2208,8 +2207,8 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
arguments_ty args;
expr_ty returns;
identifier name;
- asdl_seq* decos;
- asdl_seq *body;
+ asdl_expr_seq* decos;
+ asdl_stmt_seq *body;
Py_ssize_t i, funcflags;
int annotations;
int scope_type;
@@ -2306,7 +2305,7 @@ compiler_class(struct compiler *c, stmt_ty s)
PyCodeObject *co;
PyObject *str;
int i, firstlineno;
- asdl_seq* decos = s->v.ClassDef.decorator_list;
+ asdl_expr_seq *decos = s->v.ClassDef.decorator_list;
if (!compiler_decorators(c, decos))
return 0;
@@ -2418,9 +2417,7 @@ compiler_class(struct compiler *c, stmt_ty s)
ADDOP_LOAD_CONST(c, s->v.ClassDef.name);
/* 5. generate the rest of the code for the call */
- if (!compiler_call_helper(c, 2,
- s->v.ClassDef.bases,
- s->v.ClassDef.keywords))
+ if (!compiler_call_helper(c, 2, s->v.ClassDef.bases, s->v.ClassDef.keywords))
return 0;
/* 6. apply decorators */
@@ -2528,7 +2525,7 @@ compiler_jump_if(struct compiler *c, expr_ty e, basicblock *next, int cond)
/* fallback to general implementation */
break;
case BoolOp_kind: {
- asdl_seq *s = e->v.BoolOp.values;
+ asdl_expr_seq *s = e->v.BoolOp.values;
Py_ssize_t i, n = asdl_seq_LEN(s) - 1;
assert(n >= 0);
int cond2 = e->v.BoolOp.op == Or;
@@ -3645,7 +3642,7 @@ compiler_boolop(struct compiler *c, expr_ty e)
basicblock *end;
int jumpi;
Py_ssize_t i, n;
- asdl_seq *s;
+ asdl_expr_seq *s;
assert(e->kind == BoolOp_kind);
if (e->v.BoolOp.op == And)
@@ -3673,7 +3670,7 @@ compiler_boolop(struct compiler *c, expr_ty e)
}
static int
-starunpack_helper(struct compiler *c, asdl_seq *elts, int pushed,
+starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed,
int build, int add, int extend, int tuple)
{
Py_ssize_t n = asdl_seq_LEN(elts);
@@ -3750,7 +3747,7 @@ starunpack_helper(struct compiler *c, asdl_seq *elts, int pushed,
}
static int
-assignment_helper(struct compiler *c, asdl_seq *elts)
+assignment_helper(struct compiler *c, asdl_expr_seq *elts)
{
Py_ssize_t n = asdl_seq_LEN(elts);
Py_ssize_t i;
@@ -3784,7 +3781,7 @@ assignment_helper(struct compiler *c, asdl_seq *elts)
static int
compiler_list(struct compiler *c, expr_ty e)
{
- asdl_seq *elts = e->v.List.elts;
+ asdl_expr_seq *elts = e->v.List.elts;
if (e->v.List.ctx == Store) {
return assignment_helper(c, elts);
}
@@ -3800,7 +3797,7 @@ compiler_list(struct compiler *c, expr_ty e)
static int
compiler_tuple(struct compiler *c, expr_ty e)
{
- asdl_seq *elts = e->v.Tuple.elts;
+ asdl_expr_seq *elts = e->v.Tuple.elts;
if (e->v.Tuple.ctx == Store) {
return assignment_helper(c, elts);
}
@@ -3821,7 +3818,7 @@ compiler_set(struct compiler *c, expr_ty e)
}
static int
-are_all_items_const(asdl_seq *seq, Py_ssize_t begin, Py_ssize_t end)
+are_all_items_const(asdl_expr_seq *seq, Py_ssize_t begin, Py_ssize_t end)
{
Py_ssize_t i;
for (i = begin; i < end; i++) {
@@ -4084,7 +4081,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
{
Py_ssize_t argsl, i;
expr_ty meth = e->v.Call.func;
- asdl_seq *args = e->v.Call.args;
+ asdl_expr_seq *args = e->v.Call.args;
/* Check that the call node is an attribute access, and that
the call doesn't have keyword parameters. */
@@ -4110,7 +4107,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
}
static int
-validate_keywords(struct compiler *c, asdl_seq *keywords)
+validate_keywords(struct compiler *c, asdl_keyword_seq *keywords)
{
Py_ssize_t nkeywords = asdl_seq_LEN(keywords);
for (Py_ssize_t i = 0; i < nkeywords; i++) {
@@ -4210,7 +4207,7 @@ compiler_formatted_value(struct compiler *c, expr_ty e)
}
static int
-compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
+compiler_subkwargs(struct compiler *c, asdl_keyword_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
{
Py_ssize_t i, n = end - begin;
keyword_ty kw;
@@ -4249,8 +4246,8 @@ compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_
static int
compiler_call_helper(struct compiler *c,
int n, /* Args already pushed */
- asdl_seq *args,
- asdl_seq *keywords)
+ asdl_expr_seq *args,
+ asdl_keyword_seq *keywords)
{
Py_ssize_t i, nseen, nelts, nkwelts;
@@ -4375,7 +4372,7 @@ ex_call:
static int
compiler_comprehension_generator(struct compiler *c,
- asdl_seq *generators, int gen_index,
+ asdl_comprehension_seq *generators, int gen_index,
int depth,
expr_ty elt, expr_ty val, int type)
{
@@ -4392,7 +4389,7 @@ compiler_comprehension_generator(struct compiler *c,
static int
compiler_sync_comprehension_generator(struct compiler *c,
- asdl_seq *generators, int gen_index,
+ asdl_comprehension_seq *generators, int gen_index,
int depth,
expr_ty elt, expr_ty val, int type)
{
@@ -4424,7 +4421,7 @@ compiler_sync_comprehension_generator(struct compiler *c,
/* Fast path for the temporary variable assignment idiom:
for y in [f(x)]
*/
- asdl_seq *elts;
+ asdl_expr_seq *elts;
switch (gen->iter->kind) {
case List_kind:
elts = gen->iter->v.List.elts;
@@ -4511,7 +4508,7 @@ compiler_sync_comprehension_generator(struct compiler *c,
static int
compiler_async_comprehension_generator(struct compiler *c,
- asdl_seq *generators, int gen_index,
+ asdl_comprehension_seq *generators, int gen_index,
int depth,
expr_ty elt, expr_ty val, int type)
{
@@ -4602,7 +4599,7 @@ compiler_async_comprehension_generator(struct compiler *c,
static int
compiler_comprehension(struct compiler *c, expr_ty e, int type,
- identifier name, asdl_seq *generators, expr_ty elt,
+ identifier name, asdl_comprehension_seq *generators, expr_ty elt,
expr_ty val)
{
PyCodeObject *co = NULL;
@@ -5226,7 +5223,7 @@ check_ann_subscr(struct compiler *c, expr_ty e)
return 1;
case Tuple_kind: {
/* extended slice */
- asdl_seq *elts = e->v.Tuple.elts;
+ asdl_expr_seq *elts = e->v.Tuple.elts;
Py_ssize_t i, n = asdl_seq_LEN(elts);
for (i = 0; i < n; i++) {
if (!check_ann_subscr(c, asdl_seq_GET(elts, i))) {
diff --git a/Python/future.c b/Python/future.c
index 56da4d8..3cea4fe 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -13,11 +13,10 @@ static int
future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
{
int i;
- asdl_seq *names;
assert(s->kind == ImportFrom_kind);
- names = s->v.ImportFrom.names;
+ asdl_alias_seq *names = s->v.ImportFrom.names;
for (i = 0; i < asdl_seq_LEN(names); i++) {
alias_ty name = (alias_ty)asdl_seq_GET(names, i);
const char *feature = PyUnicode_AsUTF8(name->name);
diff --git a/Python/symtable.c b/Python/symtable.c
index d192f31..4a98e79 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -202,8 +202,8 @@ static int symtable_visit_excepthandler(struct symtable *st, excepthandler_ty);
static int symtable_visit_alias(struct symtable *st, alias_ty);
static int symtable_visit_comprehension(struct symtable *st, comprehension_ty);
static int symtable_visit_keyword(struct symtable *st, keyword_ty);
-static int symtable_visit_params(struct symtable *st, asdl_seq *args);
-static int symtable_visit_argannotations(struct symtable *st, asdl_seq *args);
+static int symtable_visit_params(struct symtable *st, asdl_arg_seq *args);
+static int symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args);
static int symtable_implicit_arg(struct symtable *st, int pos);
static int symtable_visit_annotations(struct symtable *st, arguments_ty, expr_ty);
static int symtable_visit_withitem(struct symtable *st, withitem_ty item);
@@ -261,7 +261,7 @@ struct symtable *
PySymtable_BuildObject(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
{
struct symtable *st = symtable_new();
- asdl_seq *seq;
+ asdl_stmt_seq *seq;
int i;
PyThreadState *tstate;
int recursion_limit = Py_GetRecursionLimit();
@@ -1116,7 +1116,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
#define VISIT_SEQ(ST, TYPE, SEQ) { \
int i; \
- asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
for (i = 0; i < asdl_seq_LEN(seq); i++) { \
TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1126,7 +1126,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
#define VISIT_SEQ_TAIL(ST, TYPE, SEQ, START) { \
int i; \
- asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
for (i = (START); i < asdl_seq_LEN(seq); i++) { \
TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1136,7 +1136,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) {
#define VISIT_SEQ_WITH_NULL(ST, TYPE, SEQ) { \
int i = 0; \
- asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+ asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
for (i = 0; i < asdl_seq_LEN(seq); i++) { \
TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
if (!elt) continue; /* can be NULL */ \
@@ -1318,7 +1318,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
break;
case Global_kind: {
int i;
- asdl_seq *seq = s->v.Global.names;
+ asdl_identifier_seq *seq = s->v.Global.names;
for (i = 0; i < asdl_seq_LEN(seq); i++) {
identifier name = (identifier)asdl_seq_GET(seq, i);
long cur = symtable_lookup(st, name);
@@ -1351,7 +1351,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
}
case Nonlocal_kind: {
int i;
- asdl_seq *seq = s->v.Nonlocal.names;
+ asdl_identifier_seq *seq = s->v.Nonlocal.names;
for (i = 0; i < asdl_seq_LEN(seq); i++) {
identifier name = (identifier)asdl_seq_GET(seq, i);
long cur = symtable_lookup(st, name);
@@ -1683,7 +1683,7 @@ symtable_implicit_arg(struct symtable *st, int pos)
}
static int
-symtable_visit_params(struct symtable *st, asdl_seq *args)
+symtable_visit_params(struct symtable *st, asdl_arg_seq *args)
{
int i;
@@ -1700,7 +1700,7 @@ symtable_visit_params(struct symtable *st, asdl_seq *args)
}
static int
-symtable_visit_argannotations(struct symtable *st, asdl_seq *args)
+symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args)
{
int i;
@@ -1850,7 +1850,7 @@ symtable_visit_keyword(struct symtable *st, keyword_ty k)
static int
symtable_handle_comprehension(struct symtable *st, expr_ty e,
- identifier scope_name, asdl_seq *generators,
+ identifier scope_name, asdl_comprehension_seq *generators,
expr_ty elt, expr_ty value)
{
int is_generator = (e->kind == GeneratorExp_kind);