From 511c6591e66432f183f943a52ec6ebe096d1a56a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 24 May 2020 15:32:39 -0700 Subject: [PATCH 001/218] Add AST/compiler support for switches and guards --- Include/Python-ast.h | 27 ++++- Parser/Python.asdl | 4 + Parser/pegen/parse.c | 3 + Python/Python-ast.c | 277 +++++++++++++++++++++++++++++++++++++++++++ Python/ast.c | 29 +++++ Python/compile.c | 44 +++++++ Python/symtable.c | 16 +++ 7 files changed, 396 insertions(+), 4 deletions(-) diff --git a/Include/Python-ast.h b/Include/Python-ast.h index e7afa1e6579e8d..f2ebf9244aa512 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -44,6 +44,8 @@ typedef struct _alias *alias_ty; typedef struct _withitem *withitem_ty; +typedef struct _match_case *match_case_ty; + typedef struct _type_ignore *type_ignore_ty; @@ -77,10 +79,10 @@ enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, Return_kind=4, Delete_kind=5, Assign_kind=6, AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, - AsyncWith_kind=14, Raise_kind=15, Try_kind=16, - Assert_kind=17, Import_kind=18, ImportFrom_kind=19, - Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23, - Break_kind=24, Continue_kind=25}; + AsyncWith_kind=14, Match_kind=15, Raise_kind=16, Try_kind=17, + Assert_kind=18, Import_kind=19, ImportFrom_kind=20, + Global_kind=21, Nonlocal_kind=22, Expr_kind=23, Pass_kind=24, + Break_kind=25, Continue_kind=26}; struct _stmt { enum _stmt_kind kind; union { @@ -177,6 +179,11 @@ struct _stmt { string type_comment; } AsyncWith; + struct { + expr_ty target; + asdl_seq *cases; + } Match; + struct { expr_ty exc; expr_ty cause; @@ -443,6 +450,12 @@ struct _withitem { expr_ty optional_vars; }; +struct _match_case { + expr_ty pattern; + expr_ty guard; + asdl_seq *body; +}; + enum _type_ignore_kind {TypeIgnore_kind=1}; struct _type_ignore { enum _type_ignore_kind kind; @@ -523,6 +536,9 @@ stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, string type_comment, int stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); +#define Match(a0, a1, a2, a3, a4, a5, a6) _Py_Match(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_Match(expr_ty target, asdl_seq * cases, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); #define Raise(a0, a1, a2, a3, a4, a5, a6) _Py_Raise(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); @@ -683,6 +699,9 @@ alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); #define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2) withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena); +#define match_case(a0, a1, a2, a3) _Py_match_case(a0, a1, a2, a3) +match_case_ty _Py_match_case(expr_ty pattern, expr_ty guard, asdl_seq * body, + PyArena *arena); #define TypeIgnore(a0, a1, a2) _Py_TypeIgnore(a0, a1, a2) type_ignore_ty _Py_TypeIgnore(int lineno, string tag, PyArena *arena); diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 889712b4b3d36e..517aa256d8d00f 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -36,6 +36,8 @@ module Python | With(withitem* items, stmt* body, string? type_comment) | AsyncWith(withitem* items, stmt* body, string? type_comment) + | Match(expr target, match_case* cases) + | Raise(expr? exc, expr? cause) | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) | Assert(expr test, expr? msg) @@ -121,5 +123,7 @@ module Python withitem = (expr context_expr, expr? optional_vars) + match_case = (expr pattern, expr? guard, stmt* body) + type_ignore = TypeIgnore(int lineno, string tag) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index fe95d274f37d2b..286f72111e3519 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -12072,6 +12072,9 @@ invalid_star_etc_rule(Parser *p) p->mark = _mark; } { // '*' ',' TYPE_COMMENT + if (p->error_indicator) { + return NULL; + } Token * _literal; Token * _literal_1; Token * type_comment_var; diff --git a/Python/Python-ast.c b/Python/Python-ast.c index f34b1450c66ef1..80ac60edd9cf71 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -87,6 +87,7 @@ typedef struct { PyObject *Lt_type; PyObject *MatMult_singleton; PyObject *MatMult_type; + PyObject *Match_type; PyObject *Mod_singleton; PyObject *Mod_type; PyObject *Module_type; @@ -149,6 +150,7 @@ typedef struct { PyObject *bases; PyObject *body; PyObject *boolop_type; + PyObject *cases; PyObject *cause; PyObject *cmpop_type; PyObject *col_offset; @@ -171,6 +173,7 @@ typedef struct { PyObject *format_spec; PyObject *func; PyObject *generators; + PyObject *guard; PyObject *handlers; PyObject *id; PyObject *ifs; @@ -189,6 +192,7 @@ typedef struct { PyObject *level; PyObject *lineno; PyObject *lower; + PyObject *match_case_type; PyObject *mod_type; PyObject *module; PyObject *msg; @@ -200,6 +204,7 @@ typedef struct { PyObject *ops; PyObject *optional_vars; PyObject *orelse; + PyObject *pattern; PyObject *posonlyargs; PyObject *returns; PyObject *right; @@ -307,6 +312,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(astmodulestate(module)->Lt_type); Py_CLEAR(astmodulestate(module)->MatMult_singleton); Py_CLEAR(astmodulestate(module)->MatMult_type); + Py_CLEAR(astmodulestate(module)->Match_type); Py_CLEAR(astmodulestate(module)->Mod_singleton); Py_CLEAR(astmodulestate(module)->Mod_type); Py_CLEAR(astmodulestate(module)->Module_type); @@ -369,6 +375,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(astmodulestate(module)->bases); Py_CLEAR(astmodulestate(module)->body); Py_CLEAR(astmodulestate(module)->boolop_type); + Py_CLEAR(astmodulestate(module)->cases); Py_CLEAR(astmodulestate(module)->cause); Py_CLEAR(astmodulestate(module)->cmpop_type); Py_CLEAR(astmodulestate(module)->col_offset); @@ -391,6 +398,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(astmodulestate(module)->format_spec); Py_CLEAR(astmodulestate(module)->func); Py_CLEAR(astmodulestate(module)->generators); + Py_CLEAR(astmodulestate(module)->guard); Py_CLEAR(astmodulestate(module)->handlers); Py_CLEAR(astmodulestate(module)->id); Py_CLEAR(astmodulestate(module)->ifs); @@ -409,6 +417,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(astmodulestate(module)->level); Py_CLEAR(astmodulestate(module)->lineno); Py_CLEAR(astmodulestate(module)->lower); + Py_CLEAR(astmodulestate(module)->match_case_type); Py_CLEAR(astmodulestate(module)->mod_type); Py_CLEAR(astmodulestate(module)->module); Py_CLEAR(astmodulestate(module)->msg); @@ -420,6 +429,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(astmodulestate(module)->ops); Py_CLEAR(astmodulestate(module)->optional_vars); Py_CLEAR(astmodulestate(module)->orelse); + Py_CLEAR(astmodulestate(module)->pattern); Py_CLEAR(astmodulestate(module)->posonlyargs); Py_CLEAR(astmodulestate(module)->returns); Py_CLEAR(astmodulestate(module)->right); @@ -526,6 +536,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(astmodulestate(module)->Lt_type); Py_VISIT(astmodulestate(module)->MatMult_singleton); Py_VISIT(astmodulestate(module)->MatMult_type); + Py_VISIT(astmodulestate(module)->Match_type); Py_VISIT(astmodulestate(module)->Mod_singleton); Py_VISIT(astmodulestate(module)->Mod_type); Py_VISIT(astmodulestate(module)->Module_type); @@ -588,6 +599,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(astmodulestate(module)->bases); Py_VISIT(astmodulestate(module)->body); Py_VISIT(astmodulestate(module)->boolop_type); + Py_VISIT(astmodulestate(module)->cases); Py_VISIT(astmodulestate(module)->cause); Py_VISIT(astmodulestate(module)->cmpop_type); Py_VISIT(astmodulestate(module)->col_offset); @@ -610,6 +622,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(astmodulestate(module)->format_spec); Py_VISIT(astmodulestate(module)->func); Py_VISIT(astmodulestate(module)->generators); + Py_VISIT(astmodulestate(module)->guard); Py_VISIT(astmodulestate(module)->handlers); Py_VISIT(astmodulestate(module)->id); Py_VISIT(astmodulestate(module)->ifs); @@ -628,6 +641,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(astmodulestate(module)->level); Py_VISIT(astmodulestate(module)->lineno); Py_VISIT(astmodulestate(module)->lower); + Py_VISIT(astmodulestate(module)->match_case_type); Py_VISIT(astmodulestate(module)->mod_type); Py_VISIT(astmodulestate(module)->module); Py_VISIT(astmodulestate(module)->msg); @@ -639,6 +653,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(astmodulestate(module)->ops); Py_VISIT(astmodulestate(module)->optional_vars); Py_VISIT(astmodulestate(module)->orelse); + Py_VISIT(astmodulestate(module)->pattern); Py_VISIT(astmodulestate(module)->posonlyargs); Py_VISIT(astmodulestate(module)->returns); Py_VISIT(astmodulestate(module)->right); @@ -699,6 +714,7 @@ static int init_identifiers(void) if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return 0; if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return 0; if ((state->body = PyUnicode_InternFromString("body")) == NULL) return 0; + if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return 0; if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return 0; if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return 0; if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return 0; @@ -716,6 +732,7 @@ static int init_identifiers(void) if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return 0; if ((state->func = PyUnicode_InternFromString("func")) == NULL) return 0; if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return 0; + if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return 0; if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return 0; if ((state->id = PyUnicode_InternFromString("id")) == NULL) return 0; if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return 0; @@ -742,6 +759,7 @@ static int init_identifiers(void) if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return 0; if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return 0; if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return 0; + if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return 0; if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return 0; if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return 0; if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 0; @@ -863,6 +881,10 @@ static const char * const AsyncWith_fields[]={ "body", "type_comment", }; +static const char * const Match_fields[]={ + "target", + "cases", +}; static const char * const Raise_fields[]={ "exc", "cause", @@ -1080,6 +1102,12 @@ static const char * const withitem_fields[]={ "context_expr", "optional_vars", }; +static PyObject* ast2obj_match_case(void*); +static const char * const match_case_fields[]={ + "pattern", + "guard", + "body", +}; static PyObject* ast2obj_type_ignore(void*); static const char * const TypeIgnore_fields[]={ "lineno", @@ -1430,6 +1458,7 @@ static int init_types(void) " | If(expr test, stmt* body, stmt* orelse)\n" " | With(withitem* items, stmt* body, string? type_comment)\n" " | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" + " | Match(expr target, match_case* cases)\n" " | Raise(expr? exc, expr? cause)\n" " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" " | Assert(expr test, expr? msg)\n" @@ -1527,6 +1556,9 @@ static int init_types(void) if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None) == -1) return 0; + state->Match_type = make_type("Match", state->stmt_type, Match_fields, 2, + "Match(expr target, match_case* cases)"); + if (!state->Match_type) return 0; state->Raise_type = make_type("Raise", state->stmt_type, Raise_fields, 2, "Raise(expr? exc, expr? cause)"); if (!state->Raise_type) return 0; @@ -2011,6 +2043,13 @@ static int init_types(void) if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None) == -1) return 0; + state->match_case_type = make_type("match_case", state->AST_type, + match_case_fields, 3, + "match_case(expr pattern, expr? guard, stmt* body)"); + if (!state->match_case_type) return 0; + if (!add_attributes(state->match_case_type, NULL, 0)) return 0; + if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1) + return 0; state->type_ignore_type = make_type("type_ignore", state->AST_type, NULL, 0, "type_ignore = TypeIgnore(int lineno, string tag)"); if (!state->type_ignore_type) return 0; @@ -2041,6 +2080,8 @@ static int obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena); static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena); static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena); static int obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena); +static int obj2ast_match_case(PyObject* obj, match_case_ty* out, PyArena* + arena); static int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena); @@ -2471,6 +2512,29 @@ AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, return p; } +stmt_ty +Match(expr_ty target, asdl_seq * cases, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) +{ + stmt_ty p; + if (!target) { + PyErr_SetString(PyExc_ValueError, + "field 'target' is required for Match"); + return NULL; + } + p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = Match_kind; + p->v.Match.target = target; + p->v.Match.cases = cases; + p->lineno = lineno; + p->col_offset = col_offset; + p->end_lineno = end_lineno; + p->end_col_offset = end_col_offset; + return p; +} + stmt_ty Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena) @@ -3486,6 +3550,24 @@ withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena) return p; } +match_case_ty +match_case(expr_ty pattern, expr_ty guard, asdl_seq * body, PyArena *arena) +{ + match_case_ty p; + if (!pattern) { + PyErr_SetString(PyExc_ValueError, + "field 'pattern' is required for match_case"); + return NULL; + } + p = (match_case_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->pattern = pattern; + p->guard = guard; + p->body = body; + return p; +} + type_ignore_ty TypeIgnore(int lineno, string tag, PyArena *arena) { @@ -3939,6 +4021,22 @@ ast2obj_stmt(void* _o) goto failed; Py_DECREF(value); break; + case Match_kind: + tp = (PyTypeObject *)astmodulestate_global->Match_type; + result = PyType_GenericNew(tp, NULL, NULL); + if (!result) goto failed; + value = ast2obj_expr(o->v.Match.target); + if (!value) goto failed; + if (PyObject_SetAttr(result, astmodulestate_global->target, value) == + -1) + goto failed; + Py_DECREF(value); + value = ast2obj_list(o->v.Match.cases, ast2obj_match_case); + if (!value) goto failed; + if (PyObject_SetAttr(result, astmodulestate_global->cases, value) == -1) + goto failed; + Py_DECREF(value); + break; case Raise_kind: tp = (PyTypeObject *)astmodulestate_global->Raise_type; result = PyType_GenericNew(tp, NULL, NULL); @@ -5043,6 +5141,41 @@ ast2obj_withitem(void* _o) return NULL; } +PyObject* +ast2obj_match_case(void* _o) +{ + match_case_ty o = (match_case_ty)_o; + PyObject *result = NULL, *value = NULL; + PyTypeObject *tp; + if (!o) { + Py_RETURN_NONE; + } + + tp = (PyTypeObject *)astmodulestate_global->match_case_type; + result = PyType_GenericNew(tp, NULL, NULL); + if (!result) return NULL; + value = ast2obj_expr(o->pattern); + if (!value) goto failed; + if (PyObject_SetAttr(result, astmodulestate_global->pattern, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_expr(o->guard); + if (!value) goto failed; + if (PyObject_SetAttr(result, astmodulestate_global->guard, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_list(o->body, ast2obj_stmt); + if (!value) goto failed; + if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1) + goto failed; + Py_DECREF(value); + return result; +failed: + Py_XDECREF(value); + Py_XDECREF(result); + return NULL; +} + PyObject* ast2obj_type_ignore(void* _o) { @@ -6729,6 +6862,67 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) if (*out == NULL) goto failed; return 0; } + tp = astmodulestate_global->Match_type; + isinstance = PyObject_IsInstance(obj, tp); + if (isinstance == -1) { + return 1; + } + if (isinstance) { + expr_ty target; + asdl_seq* cases; + + if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0) + { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from Match"); + return 1; + } + else { + int res; + res = obj2ast_expr(tmp, &target, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, astmodulestate_global->cases, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"cases\" missing from Match"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "Match field \"cases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + cases = _Py_asdl_seq_new(len, arena); + if (cases == NULL) goto failed; + for (i = 0; i < len; i++) { + match_case_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + res = obj2ast_match_case(tmp2, &val, arena); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "Match field \"cases\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(cases, i, val); + } + Py_CLEAR(tmp); + } + *out = Match(target, cases, lineno, col_offset, end_lineno, + end_col_offset, arena); + if (*out == NULL) goto failed; + return 0; + } tp = astmodulestate_global->Raise_type; isinstance = PyObject_IsInstance(obj, tp); if (isinstance == -1) { @@ -9824,6 +10018,80 @@ obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena) return 1; } +int +obj2ast_match_case(PyObject* obj, match_case_ty* out, PyArena* arena) +{ + PyObject* tmp = NULL; + expr_ty pattern; + expr_ty guard; + asdl_seq* body; + + if (_PyObject_LookupAttr(obj, astmodulestate_global->pattern, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from match_case"); + return 1; + } + else { + int res; + res = obj2ast_expr(tmp, &pattern, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, astmodulestate_global->guard, &tmp) < 0) { + return 1; + } + if (tmp == NULL || tmp == Py_None) { + Py_CLEAR(tmp); + guard = NULL; + } + else { + int res; + res = obj2ast_expr(tmp, &guard, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from match_case"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "match_case field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + body = _Py_asdl_seq_new(len, arena); + if (body == NULL) goto failed; + for (i = 0; i < len; i++) { + stmt_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + res = obj2ast_stmt(tmp2, &val, arena); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "match_case field \"body\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(body, i, val); + } + Py_CLEAR(tmp); + } + *out = match_case(pattern, guard, body, arena); + return 0; +failed: + Py_XDECREF(tmp); + return 1; +} + int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena) { @@ -9998,6 +10266,10 @@ PyInit__ast(void) goto error; } Py_INCREF(astmodulestate(m)->AsyncWith_type); + if (PyModule_AddObject(m, "Match", astmodulestate_global->Match_type) < 0) { + goto error; + } + Py_INCREF(astmodulestate(m)->Match_type); if (PyModule_AddObject(m, "Raise", astmodulestate_global->Raise_type) < 0) { goto error; } @@ -10373,6 +10645,11 @@ PyInit__ast(void) goto error; } Py_INCREF(astmodulestate(m)->withitem_type); + if (PyModule_AddObject(m, "match_case", + astmodulestate_global->match_case_type) < 0) { + goto error; + } + Py_INCREF(astmodulestate(m)->match_case_type); if (PyModule_AddObject(m, "type_ignore", astmodulestate_global->type_ignore_type) < 0) { goto error; diff --git a/Python/ast.c b/Python/ast.c index 2d20ca62aa8378..09300bb4c01228 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -302,6 +302,19 @@ validate_expr(expr_ty exp, expr_context_ty ctx) return 0; } +static int +validate_pattern(expr_ty p) +{ + switch (p->kind) { + case Constant_kind: + return validate_constant(p->v.Constant.value); + default: + break; + } + PyErr_SetString(PyExc_SystemError, "invalid match pattern"); + return 0; +} + static int validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner) { @@ -399,6 +412,22 @@ validate_stmt(stmt_ty stmt) return 0; } return validate_body(stmt->v.AsyncWith.body, "AsyncWith"); + case Match_kind: + if (!validate_expr(stmt->v.Match.target, Load) + || !validate_nonempty_seq(stmt->v.Match.cases, "cases", "Match")) { + return 0; + } + match_case_ty m; + Py_ssize_t cases = asdl_seq_LEN(stmt->v.Match.cases); + for (i = 0; i < cases; i++) { + m = asdl_seq_GET(stmt->v.Match.cases, i); + if (!validate_pattern(m->pattern) + || (m->guard && !validate_expr(m->guard, Load)) + || !validate_body(m->body, "match_case")) { + return 0; + } + } + return 1; case Raise_kind: if (stmt->v.Raise.exc) { return validate_expr(stmt->v.Raise.exc, Load) && diff --git a/Python/compile.c b/Python/compile.c index 4a587c00fd4021..c90988778ef734 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2746,6 +2746,48 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } +static int +compiler_pattern(struct compiler *c, expr_ty p, basicblock *next) +{ + switch (p->kind) { + case Constant_kind: + VISIT(c, expr, p); + ADDOP_COMPARE(c, Eq); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); + return 1; + default: + break; + } + PyErr_SetString(PyExc_SystemError, "invalid match pattern"); + return 0; +} + +static int +compiler_match(struct compiler *c, stmt_ty s) +{ + basicblock *end = compiler_new_block(c); + VISIT(c, expr, s->v.Match.target); + match_case_ty m; + basicblock *next; + Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); + for (Py_ssize_t i = 0; i < cases; i++) { + m = asdl_seq_GET(s->v.Match.cases, i); + next = compiler_new_block(c); + ADDOP(c, DUP_TOP); + compiler_pattern(c, m->pattern, next); + if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { + return 0; + } + ADDOP(c, POP_TOP); + VISIT_SEQ(c, stmt, m->body); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, next); + } + ADDOP(c, POP_TOP); + compiler_use_next_block(c, end); + return 1; +} + static int compiler_for(struct compiler *c, stmt_ty s) { @@ -3409,6 +3451,8 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s) return compiler_while(c, s); case If_kind: return compiler_if(c, s); + case Match_kind: + return compiler_match(c, s); case Raise_kind: n = 0; if (s->v.Raise.exc) { diff --git a/Python/symtable.c b/Python/symtable.c index d192f31deefb77..5cf1f90ed5f942 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -207,6 +207,7 @@ static int symtable_visit_argannotations(struct symtable *st, asdl_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); +static int symtable_visit_match_case(struct symtable *st, match_case_ty m); static identifier top = NULL, lambda = NULL, genexpr = NULL, @@ -1291,6 +1292,10 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) if (s->v.If.orelse) VISIT_SEQ(st, stmt, s->v.If.orelse); break; + case Match_kind: + VISIT(st, expr, s->v.Match.target); + VISIT_SEQ(st, match_case, s->v.Match.cases); + break; case Raise_kind: if (s->v.Raise.exc) { VISIT(st, expr, s->v.Raise.exc); @@ -1783,6 +1788,17 @@ symtable_visit_withitem(struct symtable *st, withitem_ty item) } +static int +symtable_visit_match_case(struct symtable *st, match_case_ty m) +{ + VISIT(st, expr, m->pattern); + if (m->guard) { + VISIT(st, expr, m->guard); + } + VISIT_SEQ(st, stmt, m->body); + return 1; +} + static int symtable_visit_alias(struct symtable *st, alias_ty a) { From 1c37cca13fddd5f002a1166699b3a53a95d34b81 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 24 May 2020 15:33:08 -0700 Subject: [PATCH 002/218] Add tests for pattern-matching --- Lib/test/test_patma.py | 143 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Lib/test/test_patma.py diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py new file mode 100644 index 00000000000000..0cd4e6f03bd918 --- /dev/null +++ b/Lib/test/test_patma.py @@ -0,0 +1,143 @@ +import ast +import typing +import unittest + + +FILENAME = "" + + +class MatchCase(typing.NamedTuple): + pattern: str + body: str + guard: typing.Optional[str] = None + + +class PatMaTests(unittest.TestCase): + @staticmethod + def parse_stmts(stmts: str) -> typing.List[ast.stmt]: + return ast.parse(stmts, FILENAME, "exec").body + + @staticmethod + def parse_expr(expr: str) -> ast.expr: + return ast.parse(expr, FILENAME, "eval").body + + @classmethod + def parse_match_case(cls, match_case: MatchCase) -> ast.expr: + pattern = cls.parse_expr(match_case.pattern) + guard = None if match_case.guard is None else cls.parse_expr(match_case.guard) + body = cls.parse_stmts(match_case.body) + return ast.match_case(pattern=pattern, guard=guard, body=body) + + @classmethod + def execute_match( + cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str + ) -> typing.Tuple[typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]]: + cases = [cls.parse_match_case(case) for case in match_cases] + match = ast.Match(target=cls.parse_expr(target), cases=cases) + body = [*cls.parse_stmts(pre), match, *cls.parse_stmts(post)] + tree = ast.fix_missing_locations(ast.Module(body=body, type_ignores=[])) + namespace = {} + exec(compile(tree, FILENAME, "exec"), None, namespace) + return namespace + + def test_steroid_switch_0(self) -> None: + match_cases = [MatchCase("0", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_1(self) -> None: + match_cases = [MatchCase("False", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_2(self) -> None: + match_cases = [MatchCase("1", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + + def test_steroid_switch_3(self) -> None: + match_cases = [MatchCase("None", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + + def test_steroid_switch_4(self) -> None: + match_cases = [MatchCase("0", "y = 0"), MatchCase("0", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_5(self) -> None: + match_cases = [MatchCase("1", "y = 0"), MatchCase("1", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + + def test_steroid_switch_6(self) -> None: + match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] + namespace = self.execute_match("x = 'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "x") + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_7(self) -> None: + match_cases = [MatchCase("'y'", "y = 0"), MatchCase("'x'", "y = 1")] + namespace = self.execute_match("x = 'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "x") + self.assertEqual(namespace.get("y"), 1) + + def test_steroid_switch_8(self) -> None: + match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] + namespace = self.execute_match("x = 'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "x") + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_9(self) -> None: + match_cases = [MatchCase("b'y'", "y = 0"), MatchCase("b'x'", "y = 1")] + namespace = self.execute_match("x = b'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), b"x") + self.assertEqual(namespace.get("y"), 1) + + def test_steroid_switch_guard_0(self) -> None: + match_cases = [MatchCase("0", "y = 0", "False"), MatchCase("0", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 1) + + def test_steroid_switch_guard_1(self) -> None: + match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + + def test_steroid_switch_guard_2(self) -> None: + match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_guard_3(self) -> None: + match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_steroid_switch_guard_4(self) -> None: + match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] + namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 2) + + def test_steroid_switch_guard_5(self) -> None: + match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "1")] + namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 2) + + def test_steroid_switch_guard_6(self) -> None: + match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("1", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 1) + self.assertNotIn("y", namespace) From 42cc51b106b7e1672f53db53cbe28a18a4a8fa44 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 25 May 2020 14:11:19 -0700 Subject: [PATCH 003/218] Add soft keywords These are like keywords but they only work in context; they are not reserved except when there is an exact match. This would enable things like match statements. --- Parser/pegen/pegen.c | 24 ++++++++++++++++++++++++ Parser/pegen/pegen.h | 1 + Tools/peg_generator/pegen/c_generator.py | 15 ++++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index ca4ea824b3f28e..8e8b330fbe489b 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -753,6 +753,30 @@ _PyPegen_expect_token(Parser *p, int type) return t; } +expr_ty +_PyPegen_expect_soft_keyword(Parser *p, const char *keyword) +{ + if (p->mark == p->fill) { + if (_PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + return NULL; + } + } + Token *t = p->tokens[p->mark]; + if (t->type != NAME) { + return NULL; + } + char* s = PyBytes_AsString(t->bytes); + if (!s) { + return NULL; + } + if (strcmp(s, keyword) != 0) { + return NULL; + } + expr_ty res = _PyPegen_name_token(p); + return res; +} + Token * _PyPegen_get_last_nonnwhitespace_token(Parser *p) { diff --git a/Parser/pegen/pegen.h b/Parser/pegen/pegen.h index 146804a896fd10..3d6c5e49a30df2 100644 --- a/Parser/pegen/pegen.h +++ b/Parser/pegen/pegen.h @@ -121,6 +121,7 @@ int _PyPegen_lookahead_with_int(int, Token *(func)(Parser *, int), Parser *, int int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *); Token *_PyPegen_expect_token(Parser *p, int type); +expr_ty _PyPegen_expect_soft_keyword(Parser *p, const char *keyword); Token *_PyPegen_get_last_nonnwhitespace_token(Parser *); int _PyPegen_fill_token(Parser *p); expr_ty _PyPegen_name_token(Parser *p); diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index c93b348e2b44c9..09869839480606 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -109,6 +109,16 @@ def keyword_helper(self, keyword: str) -> FunctionCall: comment=f"token='{keyword}'", ) + def soft_keyword_helper(self, value: str) -> FunctionCall: + return FunctionCall( + assigned_variable="_keyword", + function="_PyPegen_expect_soft_keyword", + arguments=["p", value], + return_type="expr_ty", + nodetype=NodeTypes.NAME_TOKEN, + comment=f"soft_keyword='{value}'", + ) + def visit_NameLeaf(self, node: NameLeaf) -> FunctionCall: name = node.value if name in self.non_exact_tokens: @@ -146,7 +156,10 @@ def visit_NameLeaf(self, node: NameLeaf) -> FunctionCall: def visit_StringLeaf(self, node: StringLeaf) -> FunctionCall: val = ast.literal_eval(node.value) if re.match(r"[a-zA-Z_]\w*\Z", val): # This is a keyword - return self.keyword_helper(val) + if node.value.endswith("'"): + return self.keyword_helper(val) + else: + return self.soft_keyword_helper(node.value) else: assert val in self.exact_tokens, f"{node.value} is not a known literal" type = self.exact_tokens[val] From 0fe638f9666e87d9ef2da6609b54ca157227f6ca Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 14:38:53 -0700 Subject: [PATCH 004/218] Fix bad type hint --- Lib/test/test_patma.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 0cd4e6f03bd918..d2df20851a5c67 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -31,7 +31,7 @@ def parse_match_case(cls, match_case: MatchCase) -> ast.expr: @classmethod def execute_match( cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str - ) -> typing.Tuple[typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]]: + ) -> typing.Dict[str, typing.Any]: cases = [cls.parse_match_case(case) for case in match_cases] match = ast.Match(target=cls.parse_expr(target), cases=cases) body = [*cls.parse_stmts(pre), match, *cls.parse_stmts(post)] From 40a0c793b75a2a3b7d4e510770f5263a21300f70 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 14:52:33 -0700 Subject: [PATCH 005/218] Add support for named patterns --- Lib/test/test_patma.py | 14 ++++++++++++++ Python/ast.c | 2 ++ Python/compile.c | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index d2df20851a5c67..4fccaf3026a010 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -141,3 +141,17 @@ def test_steroid_switch_guard_6(self) -> None: namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertNotIn("y", namespace) + + def test_walrus_0(self) -> None: + match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("(z := 0)", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 1) + self.assertEqual(namespace.get("y"), 1) + self.assertEqual(namespace.get("z"), 0) + + def test_walrus_1(self) -> None: + match_cases = [MatchCase("(z := 1)", "y = 0", "not (x := 1)"), MatchCase("0", "y = 1")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 1) + self.assertNotIn("z", namespace) diff --git a/Python/ast.c b/Python/ast.c index 09300bb4c01228..207133fee15a01 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -308,6 +308,8 @@ validate_pattern(expr_ty p) switch (p->kind) { case Constant_kind: return validate_constant(p->v.Constant.value); + case NamedExpr_kind: + return validate_pattern(p->v.NamedExpr.value); default: break; } diff --git a/Python/compile.c b/Python/compile.c index c90988778ef734..4e2b9ca14b0d0f 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2755,6 +2755,13 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *next) ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); return 1; + case NamedExpr_kind: + if (!compiler_pattern(c, p->v.NamedExpr.value, next)) { + return 0; + } + ADDOP(c, DUP_TOP); + VISIT(c, expr, p->v.NamedExpr.target); + return 1; default: break; } From 6188176a98a9b710dca1c9a75cc90a254e461b7c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 14:56:29 -0700 Subject: [PATCH 006/218] Add more tests for named patterns --- Lib/test/test_patma.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 4fccaf3026a010..5dce64acde47e8 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -143,15 +143,43 @@ def test_steroid_switch_guard_6(self) -> None: self.assertNotIn("y", namespace) def test_walrus_0(self) -> None: - match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("(z := 0)", "y = 1")] + match_cases = [ + MatchCase("0", "y = 0", "not (x := 1)"), + MatchCase("(z := 0)", "y = 1"), + ] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) def test_walrus_1(self) -> None: - match_cases = [MatchCase("(z := 1)", "y = 0", "not (x := 1)"), MatchCase("0", "y = 1")] + match_cases = [ + MatchCase("(z := 1)", "y = 0", "not (x := 1)"), + MatchCase("0", "y = 1"), + ] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 1) self.assertNotIn("z", namespace) + + def test_walrus_2(self) -> None: + match_cases = [MatchCase("(z := 0)", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 0) + + def test_walrus_3(self) -> None: + match_cases = [MatchCase("(z := 1)", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + self.assertNotIn("z", namespace) + + def test_walrus_4(self) -> None: + match_cases = [MatchCase("(z := 0)", "y = 0", "(w := 0)")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("w"), 0) + self.assertEqual(namespace.get("x"), 0) + self.assertNotIn("y", namespace) + self.assertEqual(namespace.get("z"), 0) From 3323ae03a8773637ffce52c2a8a50a910825fa40 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 15:18:32 -0700 Subject: [PATCH 007/218] Add a nested walrus test --- Lib/test/test_patma.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 5dce64acde47e8..20d8ce23ae3028 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -183,3 +183,11 @@ def test_walrus_4(self) -> None: self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) self.assertEqual(namespace.get("z"), 0) + + def test_walrus_5(self) -> None: + match_cases = [MatchCase("(z := (w := 0))", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("w"), 0) + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 0) From 409de6ccc9507f66ae0eb1f5f253e7a7c7a18f82 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 25 May 2020 16:30:12 -0700 Subject: [PATCH 008/218] Fix D() macro usage for soft keywords --- Tools/peg_generator/pegen/c_generator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 0ca0e9443acfef..885ff05858f679 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -669,8 +669,9 @@ def handle_alt_normal(self, node: Alt, is_gather: bool, rulename: Optional[str]) self.print("{") # We have parsed successfully all the conditions for the option. with self.indent(): + node_str = str(node).replace('"', '\\"') self.print( - f'D(fprintf(stderr, "%*c+ {rulename}[%d-%d]: %s succeeded!\\n", p->level, \' \', _mark, p->mark, "{node}"));' + f'D(fprintf(stderr, "%*c+ {rulename}[%d-%d]: %s succeeded!\\n", p->level, \' \', _mark, p->mark, "{node_str}"));' ) # Prepare to emmit the rule action and do so if node.action and "EXTRA" in node.action: @@ -723,8 +724,9 @@ def visit_Alt( self.print(f"{{ // {node}") with self.indent(): self._check_for_errors() + node_str = str(node).replace('"', '\\"') self.print( - f'D(fprintf(stderr, "%*c> {rulename}[%d-%d]: %s\\n", p->level, \' \', _mark, p->mark, "{node}"));' + f'D(fprintf(stderr, "%*c> {rulename}[%d-%d]: %s\\n", p->level, \' \', _mark, p->mark, "{node_str}"));' ) # Prepare variable declarations for the alternative vars = self.collect_vars(node) @@ -746,9 +748,10 @@ def visit_Alt( self.handle_alt_normal(node, is_gather, rulename) self.print("p->mark = _mark;") + node_str = str(node).replace('"', '\\"') self.print( f"D(fprintf(stderr, \"%*c%s {rulename}[%d-%d]: %s failed!\\n\", p->level, ' ',\n" - f' p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "{node}"));' + f' p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "{node_str}"));' ) if "_cut_var" in vars: self.print("if (_cut_var) {") From 1d39be6f9e3351ad9799f9d174edc3e6d142b9d9 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 25 May 2020 16:16:10 -0700 Subject: [PATCH 009/218] Tentative (incomplete) grammar for match statements This currently segfaults but I still like it --- Grammar/python.gram | 51 + Parser/pegen/parse.c | 16923 ++++++++++++++++++++++++----------------- 2 files changed, 9857 insertions(+), 7117 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 19d9bb36fed5f3..dba18e16fc36f6 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -80,6 +80,7 @@ compound_stmt[stmt_ty]: | &('for' | ASYNC) for_stmt | &'try' try_stmt | &'while' while_stmt + | match_stmt # NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield' assignment[stmt_ty]: @@ -191,6 +192,56 @@ except_block[excepthandler_ty]: | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } finally_block[asdl_seq*]: 'finally' ':' a=block { a } +match_stmt[stmt_ty]: + | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT {_Py_Match(target, cases, EXTRA) } +case_block: + | "case" pattern=pattern guard=['if' a=named_expression { a }] ':' body=block { + _Py_match_case(pattern, guard, body, p->arena) } + +pattern: + | a=NAME ':=' b=or_pattern { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, a, Store)), b, EXTRA) } + | or_pattern + +or_pattern: + | '|'.closed_pattern+ + +closed_pattern: + | name_pattern + | literal_pattern + | constant_pattern + | group_pattern + | sequence_pattern + | mapping_pattern + | class_pattern + +name_pattern: + | a=NAME !('.' | '(') { a } +literal_pattern: + | NUMBER + | strings + | 'None' + | 'True' + | 'False' +constant_pattern: + | '.' NAME + | a='.'.NAME+ !'(' { a } +group_pattern: + | '(' a=pattern ')' { a } +sequence_pattern: + | '[' a=[','.pattern+] ']' { _Py_List(a, Load, EXTRA) } + | '(' a=[','.pattern+] ')' { _Py_Tuple(a, Load, EXTRA) } +mapping_pattern: + | '{' ','.(key_pattern ':' closed_pattern)+ '}' { NULL } +key_pattern: + | a=literal_pattern &':' { a } + | a='|'.literal_pattern+ { NULL } +class_pattern: + | '.'.NAME+ '(' pattern_args ')' +pattern_args: + | ','.pattern+ ',' ','.(NAME '=' or_pattern)+ { NULL } + | ','.(NAME '=' or_pattern)+ { NULL } + | a=','.pattern+ { a } + return_stmt[stmt_ty]: | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index b63924177d400c..f4d59b89f04281 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -14,7 +14,7 @@ static KeywordToken *reserved_keywords[] = { (KeywordToken[]) { {"if", 510}, {"in", 518}, - {"is", 526}, + {"is", 529}, {"as", 531}, {"or", 532}, {NULL, -1}, @@ -23,8 +23,8 @@ static KeywordToken *reserved_keywords[] = { {"del", 503}, {"try", 511}, {"for", 517}, - {"def", 522}, - {"not", 525}, + {"def", 525}, + {"not", 528}, {"and", 533}, {NULL, -1}, }, @@ -34,8 +34,8 @@ static KeywordToken *reserved_keywords[] = { {"elif", 515}, {"else", 516}, {"with", 519}, - {"True", 527}, - {"None", 529}, + {"None", 522}, + {"True", 523}, {NULL, -1}, }, (KeywordToken[]) { @@ -43,8 +43,8 @@ static KeywordToken *reserved_keywords[] = { {"yield", 504}, {"break", 506}, {"while", 512}, - {"class", 523}, - {"False", 528}, + {"False", 524}, + {"class", 526}, {NULL, -1}, }, (KeywordToken[]) { @@ -53,7 +53,7 @@ static KeywordToken *reserved_keywords[] = { {"global", 508}, {"import", 513}, {"except", 520}, - {"lambda", 524}, + {"lambda", 527}, {NULL, -1}, }, (KeywordToken[]) { @@ -113,272 +113,314 @@ static KeywordToken *reserved_keywords[] = { #define try_stmt_type 1035 #define except_block_type 1036 #define finally_block_type 1037 -#define return_stmt_type 1038 -#define raise_stmt_type 1039 -#define function_def_type 1040 -#define function_def_raw_type 1041 -#define func_type_comment_type 1042 -#define params_type 1043 -#define parameters_type 1044 -#define slash_no_default_type 1045 -#define slash_with_default_type 1046 -#define star_etc_type 1047 -#define kwds_type 1048 -#define param_no_default_type 1049 -#define param_with_default_type 1050 -#define param_maybe_default_type 1051 -#define param_type 1052 -#define annotation_type 1053 -#define default_type 1054 -#define decorators_type 1055 -#define class_def_type 1056 -#define class_def_raw_type 1057 -#define block_type 1058 -#define expressions_list_type 1059 -#define star_expressions_type 1060 -#define star_expression_type 1061 -#define star_named_expressions_type 1062 -#define star_named_expression_type 1063 -#define named_expression_type 1064 -#define annotated_rhs_type 1065 -#define expressions_type 1066 -#define expression_type 1067 -#define lambdef_type 1068 -#define lambda_parameters_type 1069 -#define lambda_slash_no_default_type 1070 -#define lambda_slash_with_default_type 1071 -#define lambda_star_etc_type 1072 -#define lambda_kwds_type 1073 -#define lambda_param_no_default_type 1074 -#define lambda_param_with_default_type 1075 -#define lambda_param_maybe_default_type 1076 -#define lambda_param_type 1077 -#define disjunction_type 1078 -#define conjunction_type 1079 -#define inversion_type 1080 -#define comparison_type 1081 -#define compare_op_bitwise_or_pair_type 1082 -#define eq_bitwise_or_type 1083 -#define noteq_bitwise_or_type 1084 -#define lte_bitwise_or_type 1085 -#define lt_bitwise_or_type 1086 -#define gte_bitwise_or_type 1087 -#define gt_bitwise_or_type 1088 -#define notin_bitwise_or_type 1089 -#define in_bitwise_or_type 1090 -#define isnot_bitwise_or_type 1091 -#define is_bitwise_or_type 1092 -#define bitwise_or_type 1093 // Left-recursive -#define bitwise_xor_type 1094 // Left-recursive -#define bitwise_and_type 1095 // Left-recursive -#define shift_expr_type 1096 // Left-recursive -#define sum_type 1097 // Left-recursive -#define term_type 1098 // Left-recursive -#define factor_type 1099 -#define power_type 1100 -#define await_primary_type 1101 -#define primary_type 1102 // Left-recursive -#define slices_type 1103 -#define slice_type 1104 -#define atom_type 1105 -#define strings_type 1106 -#define list_type 1107 -#define listcomp_type 1108 -#define tuple_type 1109 -#define group_type 1110 -#define genexp_type 1111 -#define set_type 1112 -#define setcomp_type 1113 -#define dict_type 1114 -#define dictcomp_type 1115 -#define double_starred_kvpairs_type 1116 -#define double_starred_kvpair_type 1117 -#define kvpair_type 1118 -#define for_if_clauses_type 1119 -#define for_if_clause_type 1120 -#define yield_expr_type 1121 -#define arguments_type 1122 -#define args_type 1123 -#define kwargs_type 1124 -#define starred_expression_type 1125 -#define kwarg_or_starred_type 1126 -#define kwarg_or_double_starred_type 1127 -#define star_targets_type 1128 -#define star_targets_seq_type 1129 -#define star_target_type 1130 -#define star_atom_type 1131 -#define single_target_type 1132 -#define single_subscript_attribute_target_type 1133 -#define del_targets_type 1134 -#define del_target_type 1135 -#define del_t_atom_type 1136 -#define del_target_end_type 1137 -#define targets_type 1138 -#define target_type 1139 -#define t_primary_type 1140 // Left-recursive -#define t_lookahead_type 1141 -#define t_atom_type 1142 -#define incorrect_arguments_type 1143 -#define invalid_kwarg_type 1144 -#define invalid_named_expression_type 1145 -#define invalid_assignment_type 1146 -#define invalid_block_type 1147 -#define invalid_comprehension_type 1148 -#define invalid_dict_comprehension_type 1149 -#define invalid_parameters_type 1150 -#define invalid_star_etc_type 1151 -#define invalid_lambda_star_etc_type 1152 -#define invalid_double_type_comments_type 1153 -#define invalid_del_target_type 1154 -#define invalid_import_from_targets_type 1155 -#define _loop0_1_type 1156 -#define _loop0_2_type 1157 -#define _loop0_4_type 1158 -#define _gather_3_type 1159 -#define _loop0_6_type 1160 -#define _gather_5_type 1161 -#define _loop0_8_type 1162 -#define _gather_7_type 1163 -#define _loop0_10_type 1164 -#define _gather_9_type 1165 -#define _loop1_11_type 1166 -#define _loop0_13_type 1167 -#define _gather_12_type 1168 -#define _tmp_14_type 1169 -#define _tmp_15_type 1170 -#define _tmp_16_type 1171 -#define _tmp_17_type 1172 -#define _tmp_18_type 1173 -#define _tmp_19_type 1174 -#define _tmp_20_type 1175 -#define _tmp_21_type 1176 -#define _loop1_22_type 1177 -#define _tmp_23_type 1178 -#define _tmp_24_type 1179 -#define _loop0_26_type 1180 -#define _gather_25_type 1181 -#define _loop0_28_type 1182 -#define _gather_27_type 1183 -#define _tmp_29_type 1184 -#define _loop0_30_type 1185 -#define _loop1_31_type 1186 -#define _loop0_33_type 1187 -#define _gather_32_type 1188 -#define _tmp_34_type 1189 -#define _loop0_36_type 1190 -#define _gather_35_type 1191 -#define _tmp_37_type 1192 -#define _loop0_39_type 1193 -#define _gather_38_type 1194 -#define _loop0_41_type 1195 -#define _gather_40_type 1196 -#define _loop0_43_type 1197 -#define _gather_42_type 1198 -#define _loop0_45_type 1199 -#define _gather_44_type 1200 -#define _tmp_46_type 1201 -#define _loop1_47_type 1202 -#define _tmp_48_type 1203 -#define _tmp_49_type 1204 -#define _tmp_50_type 1205 -#define _tmp_51_type 1206 -#define _tmp_52_type 1207 -#define _loop0_53_type 1208 -#define _loop0_54_type 1209 -#define _loop0_55_type 1210 -#define _loop1_56_type 1211 -#define _loop0_57_type 1212 -#define _loop1_58_type 1213 -#define _loop1_59_type 1214 -#define _loop1_60_type 1215 -#define _loop0_61_type 1216 -#define _loop1_62_type 1217 -#define _loop0_63_type 1218 -#define _loop1_64_type 1219 -#define _loop0_65_type 1220 -#define _loop1_66_type 1221 -#define _loop1_67_type 1222 -#define _tmp_68_type 1223 -#define _loop0_70_type 1224 -#define _gather_69_type 1225 -#define _loop1_71_type 1226 -#define _loop0_73_type 1227 -#define _gather_72_type 1228 -#define _loop1_74_type 1229 -#define _loop0_75_type 1230 -#define _loop0_76_type 1231 -#define _loop0_77_type 1232 -#define _loop1_78_type 1233 -#define _loop0_79_type 1234 -#define _loop1_80_type 1235 -#define _loop1_81_type 1236 -#define _loop1_82_type 1237 -#define _loop0_83_type 1238 -#define _loop1_84_type 1239 -#define _loop0_85_type 1240 -#define _loop1_86_type 1241 -#define _loop0_87_type 1242 -#define _loop1_88_type 1243 -#define _loop1_89_type 1244 -#define _loop1_90_type 1245 -#define _loop1_91_type 1246 -#define _tmp_92_type 1247 -#define _loop0_94_type 1248 -#define _gather_93_type 1249 -#define _tmp_95_type 1250 -#define _tmp_96_type 1251 -#define _tmp_97_type 1252 -#define _tmp_98_type 1253 -#define _loop1_99_type 1254 -#define _tmp_100_type 1255 -#define _tmp_101_type 1256 -#define _loop0_103_type 1257 -#define _gather_102_type 1258 -#define _loop1_104_type 1259 -#define _loop0_105_type 1260 -#define _loop0_106_type 1261 -#define _tmp_107_type 1262 -#define _tmp_108_type 1263 -#define _loop0_110_type 1264 -#define _gather_109_type 1265 -#define _loop0_112_type 1266 -#define _gather_111_type 1267 -#define _loop0_114_type 1268 -#define _gather_113_type 1269 -#define _loop0_116_type 1270 -#define _gather_115_type 1271 -#define _loop0_117_type 1272 -#define _loop0_119_type 1273 -#define _gather_118_type 1274 -#define _tmp_120_type 1275 -#define _loop0_122_type 1276 -#define _gather_121_type 1277 -#define _loop0_124_type 1278 -#define _gather_123_type 1279 -#define _tmp_125_type 1280 -#define _loop0_126_type 1281 -#define _tmp_127_type 1282 -#define _tmp_128_type 1283 -#define _tmp_129_type 1284 -#define _tmp_130_type 1285 -#define _loop0_131_type 1286 -#define _tmp_132_type 1287 -#define _tmp_133_type 1288 -#define _tmp_134_type 1289 -#define _tmp_135_type 1290 -#define _tmp_136_type 1291 -#define _tmp_137_type 1292 -#define _tmp_138_type 1293 -#define _tmp_139_type 1294 -#define _tmp_140_type 1295 -#define _tmp_141_type 1296 -#define _tmp_142_type 1297 -#define _tmp_143_type 1298 -#define _tmp_144_type 1299 -#define _tmp_145_type 1300 -#define _loop1_146_type 1301 -#define _tmp_147_type 1302 -#define _tmp_148_type 1303 +#define match_stmt_type 1038 +#define case_block_type 1039 +#define pattern_type 1040 +#define or_pattern_type 1041 +#define closed_pattern_type 1042 +#define name_pattern_type 1043 +#define literal_pattern_type 1044 +#define constant_pattern_type 1045 +#define group_pattern_type 1046 +#define sequence_pattern_type 1047 +#define mapping_pattern_type 1048 +#define key_pattern_type 1049 +#define class_pattern_type 1050 +#define pattern_args_type 1051 +#define return_stmt_type 1052 +#define raise_stmt_type 1053 +#define function_def_type 1054 +#define function_def_raw_type 1055 +#define func_type_comment_type 1056 +#define params_type 1057 +#define parameters_type 1058 +#define slash_no_default_type 1059 +#define slash_with_default_type 1060 +#define star_etc_type 1061 +#define kwds_type 1062 +#define param_no_default_type 1063 +#define param_with_default_type 1064 +#define param_maybe_default_type 1065 +#define param_type 1066 +#define annotation_type 1067 +#define default_type 1068 +#define decorators_type 1069 +#define class_def_type 1070 +#define class_def_raw_type 1071 +#define block_type 1072 +#define expressions_list_type 1073 +#define star_expressions_type 1074 +#define star_expression_type 1075 +#define star_named_expressions_type 1076 +#define star_named_expression_type 1077 +#define named_expression_type 1078 +#define annotated_rhs_type 1079 +#define expressions_type 1080 +#define expression_type 1081 +#define lambdef_type 1082 +#define lambda_parameters_type 1083 +#define lambda_slash_no_default_type 1084 +#define lambda_slash_with_default_type 1085 +#define lambda_star_etc_type 1086 +#define lambda_kwds_type 1087 +#define lambda_param_no_default_type 1088 +#define lambda_param_with_default_type 1089 +#define lambda_param_maybe_default_type 1090 +#define lambda_param_type 1091 +#define disjunction_type 1092 +#define conjunction_type 1093 +#define inversion_type 1094 +#define comparison_type 1095 +#define compare_op_bitwise_or_pair_type 1096 +#define eq_bitwise_or_type 1097 +#define noteq_bitwise_or_type 1098 +#define lte_bitwise_or_type 1099 +#define lt_bitwise_or_type 1100 +#define gte_bitwise_or_type 1101 +#define gt_bitwise_or_type 1102 +#define notin_bitwise_or_type 1103 +#define in_bitwise_or_type 1104 +#define isnot_bitwise_or_type 1105 +#define is_bitwise_or_type 1106 +#define bitwise_or_type 1107 // Left-recursive +#define bitwise_xor_type 1108 // Left-recursive +#define bitwise_and_type 1109 // Left-recursive +#define shift_expr_type 1110 // Left-recursive +#define sum_type 1111 // Left-recursive +#define term_type 1112 // Left-recursive +#define factor_type 1113 +#define power_type 1114 +#define await_primary_type 1115 +#define primary_type 1116 // Left-recursive +#define slices_type 1117 +#define slice_type 1118 +#define atom_type 1119 +#define strings_type 1120 +#define list_type 1121 +#define listcomp_type 1122 +#define tuple_type 1123 +#define group_type 1124 +#define genexp_type 1125 +#define set_type 1126 +#define setcomp_type 1127 +#define dict_type 1128 +#define dictcomp_type 1129 +#define double_starred_kvpairs_type 1130 +#define double_starred_kvpair_type 1131 +#define kvpair_type 1132 +#define for_if_clauses_type 1133 +#define for_if_clause_type 1134 +#define yield_expr_type 1135 +#define arguments_type 1136 +#define args_type 1137 +#define kwargs_type 1138 +#define starred_expression_type 1139 +#define kwarg_or_starred_type 1140 +#define kwarg_or_double_starred_type 1141 +#define star_targets_type 1142 +#define star_targets_seq_type 1143 +#define star_target_type 1144 +#define star_atom_type 1145 +#define single_target_type 1146 +#define single_subscript_attribute_target_type 1147 +#define del_targets_type 1148 +#define del_target_type 1149 +#define del_t_atom_type 1150 +#define del_target_end_type 1151 +#define targets_type 1152 +#define target_type 1153 +#define t_primary_type 1154 // Left-recursive +#define t_lookahead_type 1155 +#define t_atom_type 1156 +#define incorrect_arguments_type 1157 +#define invalid_kwarg_type 1158 +#define invalid_named_expression_type 1159 +#define invalid_assignment_type 1160 +#define invalid_block_type 1161 +#define invalid_comprehension_type 1162 +#define invalid_dict_comprehension_type 1163 +#define invalid_parameters_type 1164 +#define invalid_star_etc_type 1165 +#define invalid_lambda_star_etc_type 1166 +#define invalid_double_type_comments_type 1167 +#define invalid_del_target_type 1168 +#define invalid_import_from_targets_type 1169 +#define _loop0_1_type 1170 +#define _loop0_2_type 1171 +#define _loop0_4_type 1172 +#define _gather_3_type 1173 +#define _loop0_6_type 1174 +#define _gather_5_type 1175 +#define _loop0_8_type 1176 +#define _gather_7_type 1177 +#define _loop0_10_type 1178 +#define _gather_9_type 1179 +#define _loop1_11_type 1180 +#define _loop0_13_type 1181 +#define _gather_12_type 1182 +#define _tmp_14_type 1183 +#define _tmp_15_type 1184 +#define _tmp_16_type 1185 +#define _tmp_17_type 1186 +#define _tmp_18_type 1187 +#define _tmp_19_type 1188 +#define _tmp_20_type 1189 +#define _tmp_21_type 1190 +#define _loop1_22_type 1191 +#define _tmp_23_type 1192 +#define _tmp_24_type 1193 +#define _loop0_26_type 1194 +#define _gather_25_type 1195 +#define _loop0_28_type 1196 +#define _gather_27_type 1197 +#define _tmp_29_type 1198 +#define _loop0_30_type 1199 +#define _loop1_31_type 1200 +#define _loop0_33_type 1201 +#define _gather_32_type 1202 +#define _tmp_34_type 1203 +#define _loop0_36_type 1204 +#define _gather_35_type 1205 +#define _tmp_37_type 1206 +#define _loop0_39_type 1207 +#define _gather_38_type 1208 +#define _loop0_41_type 1209 +#define _gather_40_type 1210 +#define _loop0_43_type 1211 +#define _gather_42_type 1212 +#define _loop0_45_type 1213 +#define _gather_44_type 1214 +#define _tmp_46_type 1215 +#define _loop1_47_type 1216 +#define _tmp_48_type 1217 +#define _loop1_49_type 1218 +#define _tmp_50_type 1219 +#define _loop0_52_type 1220 +#define _gather_51_type 1221 +#define _tmp_53_type 1222 +#define _loop0_55_type 1223 +#define _gather_54_type 1224 +#define _loop0_57_type 1225 +#define _gather_56_type 1226 +#define _loop0_59_type 1227 +#define _gather_58_type 1228 +#define _loop0_61_type 1229 +#define _gather_60_type 1230 +#define _loop0_63_type 1231 +#define _gather_62_type 1232 +#define _loop0_65_type 1233 +#define _gather_64_type 1234 +#define _loop0_67_type 1235 +#define _gather_66_type 1236 +#define _loop0_69_type 1237 +#define _gather_68_type 1238 +#define _loop0_71_type 1239 +#define _gather_70_type 1240 +#define _loop0_73_type 1241 +#define _gather_72_type 1242 +#define _tmp_74_type 1243 +#define _tmp_75_type 1244 +#define _tmp_76_type 1245 +#define _tmp_77_type 1246 +#define _loop0_78_type 1247 +#define _loop0_79_type 1248 +#define _loop0_80_type 1249 +#define _loop1_81_type 1250 +#define _loop0_82_type 1251 +#define _loop1_83_type 1252 +#define _loop1_84_type 1253 +#define _loop1_85_type 1254 +#define _loop0_86_type 1255 +#define _loop1_87_type 1256 +#define _loop0_88_type 1257 +#define _loop1_89_type 1258 +#define _loop0_90_type 1259 +#define _loop1_91_type 1260 +#define _loop1_92_type 1261 +#define _tmp_93_type 1262 +#define _loop0_95_type 1263 +#define _gather_94_type 1264 +#define _loop1_96_type 1265 +#define _loop0_98_type 1266 +#define _gather_97_type 1267 +#define _loop1_99_type 1268 +#define _loop0_100_type 1269 +#define _loop0_101_type 1270 +#define _loop0_102_type 1271 +#define _loop1_103_type 1272 +#define _loop0_104_type 1273 +#define _loop1_105_type 1274 +#define _loop1_106_type 1275 +#define _loop1_107_type 1276 +#define _loop0_108_type 1277 +#define _loop1_109_type 1278 +#define _loop0_110_type 1279 +#define _loop1_111_type 1280 +#define _loop0_112_type 1281 +#define _loop1_113_type 1282 +#define _loop1_114_type 1283 +#define _loop1_115_type 1284 +#define _loop1_116_type 1285 +#define _tmp_117_type 1286 +#define _loop0_119_type 1287 +#define _gather_118_type 1288 +#define _tmp_120_type 1289 +#define _tmp_121_type 1290 +#define _tmp_122_type 1291 +#define _tmp_123_type 1292 +#define _loop1_124_type 1293 +#define _tmp_125_type 1294 +#define _tmp_126_type 1295 +#define _loop0_128_type 1296 +#define _gather_127_type 1297 +#define _loop1_129_type 1298 +#define _loop0_130_type 1299 +#define _loop0_131_type 1300 +#define _tmp_132_type 1301 +#define _tmp_133_type 1302 +#define _loop0_135_type 1303 +#define _gather_134_type 1304 +#define _loop0_137_type 1305 +#define _gather_136_type 1306 +#define _loop0_139_type 1307 +#define _gather_138_type 1308 +#define _loop0_141_type 1309 +#define _gather_140_type 1310 +#define _loop0_142_type 1311 +#define _loop0_144_type 1312 +#define _gather_143_type 1313 +#define _tmp_145_type 1314 +#define _loop0_147_type 1315 +#define _gather_146_type 1316 +#define _loop0_149_type 1317 +#define _gather_148_type 1318 +#define _tmp_150_type 1319 +#define _loop0_151_type 1320 +#define _tmp_152_type 1321 +#define _tmp_153_type 1322 +#define _tmp_154_type 1323 +#define _tmp_155_type 1324 +#define _loop0_156_type 1325 +#define _tmp_157_type 1326 +#define _tmp_158_type 1327 +#define _tmp_159_type 1328 +#define _tmp_160_type 1329 +#define _tmp_161_type 1330 +#define _tmp_162_type 1331 +#define _tmp_163_type 1332 +#define _tmp_164_type 1333 +#define _tmp_165_type 1334 +#define _tmp_166_type 1335 +#define _tmp_167_type 1336 +#define _tmp_168_type 1337 +#define _tmp_169_type 1338 +#define _tmp_170_type 1339 +#define _tmp_171_type 1340 +#define _tmp_172_type 1341 +#define _tmp_173_type 1342 +#define _loop1_174_type 1343 +#define _tmp_175_type 1344 +#define _tmp_176_type 1345 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -418,6 +460,20 @@ static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); +static stmt_ty match_stmt_rule(Parser *p); +static void *case_block_rule(Parser *p); +static void *pattern_rule(Parser *p); +static void *or_pattern_rule(Parser *p); +static void *closed_pattern_rule(Parser *p); +static void *name_pattern_rule(Parser *p); +static void *literal_pattern_rule(Parser *p); +static void *constant_pattern_rule(Parser *p); +static void *group_pattern_rule(Parser *p); +static void *sequence_pattern_rule(Parser *p); +static void *mapping_pattern_rule(Parser *p); +static void *key_pattern_rule(Parser *p); +static void *class_pattern_rule(Parser *p); +static void *pattern_args_rule(Parser *p); static stmt_ty return_stmt_rule(Parser *p); static stmt_ty raise_stmt_rule(Parser *p); static stmt_ty function_def_rule(Parser *p); @@ -584,106 +640,134 @@ static asdl_seq *_gather_44_rule(Parser *p); static void *_tmp_46_rule(Parser *p); static asdl_seq *_loop1_47_rule(Parser *p); static void *_tmp_48_rule(Parser *p); -static void *_tmp_49_rule(Parser *p); +static asdl_seq *_loop1_49_rule(Parser *p); static void *_tmp_50_rule(Parser *p); -static void *_tmp_51_rule(Parser *p); -static void *_tmp_52_rule(Parser *p); -static asdl_seq *_loop0_53_rule(Parser *p); -static asdl_seq *_loop0_54_rule(Parser *p); +static asdl_seq *_loop0_52_rule(Parser *p); +static asdl_seq *_gather_51_rule(Parser *p); +static void *_tmp_53_rule(Parser *p); static asdl_seq *_loop0_55_rule(Parser *p); -static asdl_seq *_loop1_56_rule(Parser *p); +static asdl_seq *_gather_54_rule(Parser *p); static asdl_seq *_loop0_57_rule(Parser *p); -static asdl_seq *_loop1_58_rule(Parser *p); -static asdl_seq *_loop1_59_rule(Parser *p); -static asdl_seq *_loop1_60_rule(Parser *p); +static asdl_seq *_gather_56_rule(Parser *p); +static asdl_seq *_loop0_59_rule(Parser *p); +static asdl_seq *_gather_58_rule(Parser *p); static asdl_seq *_loop0_61_rule(Parser *p); -static asdl_seq *_loop1_62_rule(Parser *p); +static asdl_seq *_gather_60_rule(Parser *p); static asdl_seq *_loop0_63_rule(Parser *p); -static asdl_seq *_loop1_64_rule(Parser *p); +static asdl_seq *_gather_62_rule(Parser *p); static asdl_seq *_loop0_65_rule(Parser *p); -static asdl_seq *_loop1_66_rule(Parser *p); -static asdl_seq *_loop1_67_rule(Parser *p); -static void *_tmp_68_rule(Parser *p); -static asdl_seq *_loop0_70_rule(Parser *p); -static asdl_seq *_gather_69_rule(Parser *p); -static asdl_seq *_loop1_71_rule(Parser *p); +static asdl_seq *_gather_64_rule(Parser *p); +static asdl_seq *_loop0_67_rule(Parser *p); +static asdl_seq *_gather_66_rule(Parser *p); +static asdl_seq *_loop0_69_rule(Parser *p); +static asdl_seq *_gather_68_rule(Parser *p); +static asdl_seq *_loop0_71_rule(Parser *p); +static asdl_seq *_gather_70_rule(Parser *p); static asdl_seq *_loop0_73_rule(Parser *p); static asdl_seq *_gather_72_rule(Parser *p); -static asdl_seq *_loop1_74_rule(Parser *p); -static asdl_seq *_loop0_75_rule(Parser *p); -static asdl_seq *_loop0_76_rule(Parser *p); -static asdl_seq *_loop0_77_rule(Parser *p); -static asdl_seq *_loop1_78_rule(Parser *p); +static void *_tmp_74_rule(Parser *p); +static void *_tmp_75_rule(Parser *p); +static void *_tmp_76_rule(Parser *p); +static void *_tmp_77_rule(Parser *p); +static asdl_seq *_loop0_78_rule(Parser *p); static asdl_seq *_loop0_79_rule(Parser *p); -static asdl_seq *_loop1_80_rule(Parser *p); +static asdl_seq *_loop0_80_rule(Parser *p); static asdl_seq *_loop1_81_rule(Parser *p); -static asdl_seq *_loop1_82_rule(Parser *p); -static asdl_seq *_loop0_83_rule(Parser *p); +static asdl_seq *_loop0_82_rule(Parser *p); +static asdl_seq *_loop1_83_rule(Parser *p); static asdl_seq *_loop1_84_rule(Parser *p); -static asdl_seq *_loop0_85_rule(Parser *p); -static asdl_seq *_loop1_86_rule(Parser *p); -static asdl_seq *_loop0_87_rule(Parser *p); -static asdl_seq *_loop1_88_rule(Parser *p); +static asdl_seq *_loop1_85_rule(Parser *p); +static asdl_seq *_loop0_86_rule(Parser *p); +static asdl_seq *_loop1_87_rule(Parser *p); +static asdl_seq *_loop0_88_rule(Parser *p); static asdl_seq *_loop1_89_rule(Parser *p); -static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop0_90_rule(Parser *p); static asdl_seq *_loop1_91_rule(Parser *p); -static void *_tmp_92_rule(Parser *p); -static asdl_seq *_loop0_94_rule(Parser *p); -static asdl_seq *_gather_93_rule(Parser *p); -static void *_tmp_95_rule(Parser *p); -static void *_tmp_96_rule(Parser *p); -static void *_tmp_97_rule(Parser *p); -static void *_tmp_98_rule(Parser *p); +static asdl_seq *_loop1_92_rule(Parser *p); +static void *_tmp_93_rule(Parser *p); +static asdl_seq *_loop0_95_rule(Parser *p); +static asdl_seq *_gather_94_rule(Parser *p); +static asdl_seq *_loop1_96_rule(Parser *p); +static asdl_seq *_loop0_98_rule(Parser *p); +static asdl_seq *_gather_97_rule(Parser *p); static asdl_seq *_loop1_99_rule(Parser *p); -static void *_tmp_100_rule(Parser *p); -static void *_tmp_101_rule(Parser *p); -static asdl_seq *_loop0_103_rule(Parser *p); -static asdl_seq *_gather_102_rule(Parser *p); -static asdl_seq *_loop1_104_rule(Parser *p); -static asdl_seq *_loop0_105_rule(Parser *p); -static asdl_seq *_loop0_106_rule(Parser *p); -static void *_tmp_107_rule(Parser *p); -static void *_tmp_108_rule(Parser *p); +static asdl_seq *_loop0_100_rule(Parser *p); +static asdl_seq *_loop0_101_rule(Parser *p); +static asdl_seq *_loop0_102_rule(Parser *p); +static asdl_seq *_loop1_103_rule(Parser *p); +static asdl_seq *_loop0_104_rule(Parser *p); +static asdl_seq *_loop1_105_rule(Parser *p); +static asdl_seq *_loop1_106_rule(Parser *p); +static asdl_seq *_loop1_107_rule(Parser *p); +static asdl_seq *_loop0_108_rule(Parser *p); +static asdl_seq *_loop1_109_rule(Parser *p); static asdl_seq *_loop0_110_rule(Parser *p); -static asdl_seq *_gather_109_rule(Parser *p); +static asdl_seq *_loop1_111_rule(Parser *p); static asdl_seq *_loop0_112_rule(Parser *p); -static asdl_seq *_gather_111_rule(Parser *p); -static asdl_seq *_loop0_114_rule(Parser *p); -static asdl_seq *_gather_113_rule(Parser *p); -static asdl_seq *_loop0_116_rule(Parser *p); -static asdl_seq *_gather_115_rule(Parser *p); -static asdl_seq *_loop0_117_rule(Parser *p); +static asdl_seq *_loop1_113_rule(Parser *p); +static asdl_seq *_loop1_114_rule(Parser *p); +static asdl_seq *_loop1_115_rule(Parser *p); +static asdl_seq *_loop1_116_rule(Parser *p); +static void *_tmp_117_rule(Parser *p); static asdl_seq *_loop0_119_rule(Parser *p); static asdl_seq *_gather_118_rule(Parser *p); static void *_tmp_120_rule(Parser *p); -static asdl_seq *_loop0_122_rule(Parser *p); -static asdl_seq *_gather_121_rule(Parser *p); -static asdl_seq *_loop0_124_rule(Parser *p); -static asdl_seq *_gather_123_rule(Parser *p); +static void *_tmp_121_rule(Parser *p); +static void *_tmp_122_rule(Parser *p); +static void *_tmp_123_rule(Parser *p); +static asdl_seq *_loop1_124_rule(Parser *p); static void *_tmp_125_rule(Parser *p); -static asdl_seq *_loop0_126_rule(Parser *p); -static void *_tmp_127_rule(Parser *p); -static void *_tmp_128_rule(Parser *p); -static void *_tmp_129_rule(Parser *p); -static void *_tmp_130_rule(Parser *p); +static void *_tmp_126_rule(Parser *p); +static asdl_seq *_loop0_128_rule(Parser *p); +static asdl_seq *_gather_127_rule(Parser *p); +static asdl_seq *_loop1_129_rule(Parser *p); +static asdl_seq *_loop0_130_rule(Parser *p); static asdl_seq *_loop0_131_rule(Parser *p); static void *_tmp_132_rule(Parser *p); static void *_tmp_133_rule(Parser *p); -static void *_tmp_134_rule(Parser *p); -static void *_tmp_135_rule(Parser *p); -static void *_tmp_136_rule(Parser *p); -static void *_tmp_137_rule(Parser *p); -static void *_tmp_138_rule(Parser *p); -static void *_tmp_139_rule(Parser *p); -static void *_tmp_140_rule(Parser *p); -static void *_tmp_141_rule(Parser *p); -static void *_tmp_142_rule(Parser *p); -static void *_tmp_143_rule(Parser *p); -static void *_tmp_144_rule(Parser *p); +static asdl_seq *_loop0_135_rule(Parser *p); +static asdl_seq *_gather_134_rule(Parser *p); +static asdl_seq *_loop0_137_rule(Parser *p); +static asdl_seq *_gather_136_rule(Parser *p); +static asdl_seq *_loop0_139_rule(Parser *p); +static asdl_seq *_gather_138_rule(Parser *p); +static asdl_seq *_loop0_141_rule(Parser *p); +static asdl_seq *_gather_140_rule(Parser *p); +static asdl_seq *_loop0_142_rule(Parser *p); +static asdl_seq *_loop0_144_rule(Parser *p); +static asdl_seq *_gather_143_rule(Parser *p); static void *_tmp_145_rule(Parser *p); -static asdl_seq *_loop1_146_rule(Parser *p); -static void *_tmp_147_rule(Parser *p); -static void *_tmp_148_rule(Parser *p); +static asdl_seq *_loop0_147_rule(Parser *p); +static asdl_seq *_gather_146_rule(Parser *p); +static asdl_seq *_loop0_149_rule(Parser *p); +static asdl_seq *_gather_148_rule(Parser *p); +static void *_tmp_150_rule(Parser *p); +static asdl_seq *_loop0_151_rule(Parser *p); +static void *_tmp_152_rule(Parser *p); +static void *_tmp_153_rule(Parser *p); +static void *_tmp_154_rule(Parser *p); +static void *_tmp_155_rule(Parser *p); +static asdl_seq *_loop0_156_rule(Parser *p); +static void *_tmp_157_rule(Parser *p); +static void *_tmp_158_rule(Parser *p); +static void *_tmp_159_rule(Parser *p); +static void *_tmp_160_rule(Parser *p); +static void *_tmp_161_rule(Parser *p); +static void *_tmp_162_rule(Parser *p); +static void *_tmp_163_rule(Parser *p); +static void *_tmp_164_rule(Parser *p); +static void *_tmp_165_rule(Parser *p); +static void *_tmp_166_rule(Parser *p); +static void *_tmp_167_rule(Parser *p); +static void *_tmp_168_rule(Parser *p); +static void *_tmp_169_rule(Parser *p); +static void *_tmp_170_rule(Parser *p); +static void *_tmp_171_rule(Parser *p); +static void *_tmp_172_rule(Parser *p); +static void *_tmp_173_rule(Parser *p); +static asdl_seq *_loop1_174_rule(Parser *p); +static void *_tmp_175_rule(Parser *p); +static void *_tmp_176_rule(Parser *p); // file: statements? $ @@ -1832,6 +1916,7 @@ small_stmt_rule(Parser *p) // | &('for' | ASYNC) for_stmt // | &'try' try_stmt // | &'while' while_stmt +// | match_stmt static stmt_ty compound_stmt_rule(Parser *p) { @@ -1989,6 +2074,25 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); } + { // match_stmt + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); + stmt_ty match_stmt_var; + if ( + (match_stmt_var = match_stmt_rule(p)) // match_stmt + ) + { + D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt")); + _res = match_stmt_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt")); + } _res = NULL; done: D(p->level--); @@ -4518,9 +4622,9 @@ finally_block_rule(Parser *p) return _res; } -// return_stmt: 'return' star_expressions? +// match_stmt: "match" expression ':' NEWLINE INDENT case_block+ DEDENT static stmt_ty -return_stmt_rule(Parser *p) +match_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -4538,21 +4642,36 @@ return_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'return' star_expressions? + { // "match" expression ':' NEWLINE INDENT case_block+ DEDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); - Token * _keyword; - void *a; + D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); + expr_ty _keyword; + Token * _literal; + asdl_seq * cases; + Token * dedent_var; + Token * indent_var; + Token * newline_var; + expr_ty target; if ( - (_keyword = _PyPegen_expect_token(p, 500)) // token='return' + (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' && - (a = star_expressions_rule(p), 1) // star_expressions? + (target = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' + && + (cases = _loop1_49_rule(p)) // case_block+ + && + (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) { - D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4562,7 +4681,7 @@ return_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Return ( a , EXTRA ); + _res = _Py_Match ( target , cases , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4571,8 +4690,8 @@ return_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); + D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); } _res = NULL; done: @@ -4580,16 +4699,69 @@ return_stmt_rule(Parser *p) return _res; } -// raise_stmt: 'raise' expression ['from' expression] | 'raise' -static stmt_ty -raise_stmt_rule(Parser *p) +// case_block: "case" pattern ['if' named_expression] ':' block +static void * +case_block_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; + int _mark = p->mark; + { // "case" pattern ['if' named_expression] ':' block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + expr_ty _keyword; + Token * _literal; + asdl_seq* body; + void *guard; + void *pattern; + if ( + (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' + && + (pattern = pattern_rule(p)) // pattern + && + (guard = _tmp_50_rule(p), 1) // ['if' named_expression] + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (body = block_rule(p)) // block + ) + { + D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + _res = _Py_match_case ( pattern , guard , body , p -> arena ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// pattern: NAME ':=' or_pattern | or_pattern +static void * +pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -4600,24 +4772,24 @@ raise_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'raise' expression ['from' expression] + { // NAME ':=' or_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); - Token * _keyword; + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); + Token * _literal; expr_ty a; void *b; if ( - (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' + (a = _PyPegen_name_token(p)) // NAME && - (a = expression_rule(p)) // expression + (_literal = _PyPegen_expect_token(p, 53)) // token=':=' && - (b = _tmp_49_rule(p), 1) // ['from' expression] + (b = or_pattern_rule(p)) // or_pattern ) { - D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4627,7 +4799,7 @@ raise_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Raise ( a , b , EXTRA ); + _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4636,41 +4808,27 @@ raise_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); + D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' or_pattern")); } - { // 'raise' + { // or_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); - Token * _keyword; + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); + void *or_pattern_var; if ( - (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' + (or_pattern_var = or_pattern_rule(p)) // or_pattern ) { - D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Raise ( NULL , NULL , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); + _res = or_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); + D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); } _res = NULL; done: @@ -4678,62 +4836,35 @@ raise_stmt_rule(Parser *p) return _res; } -// function_def: decorators function_def_raw | function_def_raw -static stmt_ty -function_def_rule(Parser *p) +// or_pattern: '|'.closed_pattern+ +static void * +or_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // decorators function_def_raw - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); - asdl_seq* d; - stmt_ty f; - if ( - (d = decorators_rule(p)) // decorators - && - (f = function_def_raw_rule(p)) // function_def_raw - ) - { - D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); - _res = _PyPegen_function_def_decorators ( p , d , f ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); - } - { // function_def_raw + { // '|'.closed_pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); - stmt_ty function_def_raw_var; + D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); + asdl_seq * _gather_51_var; if ( - (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw + (_gather_51_var = _gather_51_rule(p)) // '|'.closed_pattern+ ) { - D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); - _res = function_def_raw_var; + D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); + _res = _gather_51_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); + D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); } _res = NULL; done: @@ -4741,231 +4872,156 @@ function_def_rule(Parser *p) return _res; } -// function_def_raw: -// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block -// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block -static stmt_ty -function_def_raw_rule(Parser *p) +// closed_pattern: +// | name_pattern +// | literal_pattern +// | constant_pattern +// | group_pattern +// | sequence_pattern +// | mapping_pattern +// | class_pattern +static void * +closed_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + { // name_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_pattern")); + void *name_pattern_var; + if ( + (name_pattern_var = name_pattern_rule(p)) // name_pattern + ) + { + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_pattern")); + _res = name_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_pattern")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block + { // literal_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); - Token * _keyword; - Token * _literal; - Token * _literal_1; - Token * _literal_2; - void *a; - asdl_seq* b; - expr_ty n; - void *params; - void *tc; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + void *literal_pattern_var; if ( - (_keyword = _PyPegen_expect_token(p, 522)) // token='def' - && - (n = _PyPegen_name_token(p)) // NAME - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (params = params_rule(p), 1) // params? - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' - && - (a = _tmp_50_rule(p), 1) // ['->' expression] - && - (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' - && - (tc = func_type_comment_rule(p), 1) // func_type_comment? - && - (b = block_rule(p)) // block + (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + _res = literal_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } - { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block + { // constant_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); - Token * _keyword; - Token * _literal; - Token * _literal_1; - Token * _literal_2; - void *a; - Token * async_var; - asdl_seq* b; - expr_ty n; - void *params; - void *tc; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + void *constant_pattern_var; if ( - (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' - && - (_keyword = _PyPegen_expect_token(p, 522)) // token='def' - && - (n = _PyPegen_name_token(p)) // NAME - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (params = params_rule(p), 1) // params? - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' - && - (a = _tmp_51_rule(p), 1) // ['->' expression] - && - (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' - && - (tc = func_type_comment_rule(p), 1) // func_type_comment? - && - (b = block_rule(p)) // block + (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) { - D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + _res = constant_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// func_type_comment: -// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) -// | invalid_double_type_comments -// | TYPE_COMMENT -static Token* -func_type_comment_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + { // group_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern")); + void *group_pattern_var; + if ( + (group_pattern_var = group_pattern_rule(p)) // group_pattern + ) + { + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern")); + _res = group_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern")); } - Token* _res = NULL; - int _mark = p->mark; - { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) + { // sequence_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); - Token * newline_var; - Token * t; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); + void *sequence_pattern_var; if ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - && - (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' - && - _PyPegen_lookahead(1, _tmp_52_rule, p) + (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern ) { - D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); - _res = t; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); + _res = sequence_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern")); } - { // invalid_double_type_comments + { // mapping_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); - void *invalid_double_type_comments_var; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); + void *mapping_pattern_var; if ( - (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments + (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern ) { - D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); - _res = invalid_double_type_comments_var; + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); + _res = mapping_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern")); } - { // TYPE_COMMENT + { // class_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); - Token * type_comment_var; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern")); + void *class_pattern_var; if ( - (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' + (class_pattern_var = class_pattern_rule(p)) // class_pattern ) { - D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); - _res = type_comment_var; + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern")); + _res = class_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern")); } _res = NULL; done: @@ -4973,54 +5029,42 @@ func_type_comment_rule(Parser *p) return _res; } -// params: invalid_parameters | parameters -static arguments_ty -params_rule(Parser *p) +// name_pattern: NAME !('.' | '(') +static void * +name_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arguments_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // invalid_parameters - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); - void *invalid_parameters_var; - if ( - (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters - ) - { - D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); - _res = invalid_parameters_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); - } - { // parameters + { // NAME !('.' | '(') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); - arguments_ty parameters_var; + D(fprintf(stderr, "%*c> name_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(')")); + expr_ty a; if ( - (parameters_var = parameters_rule(p)) // parameters + (a = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(0, _tmp_53_rule, p) ) { - D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); - _res = parameters_var; + D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(')")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); + D(fprintf(stderr, "%*c%s name_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !('.' | '(')")); } _res = NULL; done: @@ -5028,165 +5072,111 @@ params_rule(Parser *p) return _res; } -// parameters: -// | slash_no_default param_no_default* param_with_default* star_etc? -// | slash_with_default param_with_default* star_etc? -// | param_no_default+ param_with_default* star_etc? -// | param_with_default+ star_etc? -// | star_etc -static arguments_ty -parameters_rule(Parser *p) +// literal_pattern: NUMBER | strings | 'None' | 'True' | 'False' +static void * +literal_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arguments_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // slash_no_default param_no_default* param_with_default* star_etc? + { // NUMBER if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); - asdl_seq* a; - asdl_seq * b; - asdl_seq * c; - void *d; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); + expr_ty number_var; if ( - (a = slash_no_default_rule(p)) // slash_no_default - && - (b = _loop0_53_rule(p)) // param_no_default* - && - (c = _loop0_54_rule(p)) // param_with_default* - && - (d = star_etc_rule(p), 1) // star_etc? + (number_var = _PyPegen_number_token(p)) // NUMBER ) { - D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); - _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); + _res = number_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); } - { // slash_with_default param_with_default* star_etc? + { // strings if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); - SlashWithDefault* a; - asdl_seq * b; - void *c; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings")); + expr_ty strings_var; if ( - (a = slash_with_default_rule(p)) // slash_with_default - && - (b = _loop0_55_rule(p)) // param_with_default* - && - (c = star_etc_rule(p), 1) // star_etc? + (strings_var = strings_rule(p)) // strings ) { - D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings")); + _res = strings_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings")); } - { // param_no_default+ param_with_default* star_etc? + { // 'None' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); - asdl_seq * a; - asdl_seq * b; - void *c; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); + Token * _keyword; if ( - (a = _loop1_56_rule(p)) // param_no_default+ - && - (b = _loop0_57_rule(p)) // param_with_default* - && - (c = star_etc_rule(p), 1) // star_etc? + (_keyword = _PyPegen_expect_token(p, 522)) // token='None' ) { - D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); } - { // param_with_default+ star_etc? + { // 'True' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); - asdl_seq * a; - void *b; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); + Token * _keyword; if ( - (a = _loop1_58_rule(p)) // param_with_default+ - && - (b = star_etc_rule(p), 1) // star_etc? + (_keyword = _PyPegen_expect_token(p, 523)) // token='True' ) { - D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); } - { // star_etc + { // 'False' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); - StarEtc* a; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); + Token * _keyword; if ( - (a = star_etc_rule(p)) // star_etc + (_keyword = _PyPegen_expect_token(p, 524)) // token='False' ) { - D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); } _res = NULL; done: @@ -5194,64 +5184,100 @@ parameters_rule(Parser *p) return _res; } -// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' -static asdl_seq* -slash_no_default_rule(Parser *p) +// constant_pattern: '.' NAME | '.'.NAME+ !'(' +static void * +constant_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq* _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // param_no_default+ '/' ',' + { // '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); Token * _literal; - Token * _literal_1; - asdl_seq * a; + expr_ty name_var; if ( - (a = _loop1_59_rule(p)) // param_no_default+ - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + _res = _PyPegen_dummy_name(p, _literal, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); + } + { // '.'.NAME+ !'(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ !'('")); + asdl_seq * a; + if ( + (a = _gather_54_rule(p)) // '.'.NAME+ + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='(' + ) + { + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ !'('")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); return NULL; } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); + D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'.NAME+ !'('")); } - { // param_no_default+ '/' &')' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// group_pattern: '(' pattern ')' +static void * +group_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '(' pattern ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); + D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); Token * _literal; - asdl_seq * a; + Token * _literal_1; + void *a; if ( - (a = _loop1_60_rule(p)) // param_no_default+ + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' + (a = pattern_rule(p)) // pattern && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); + D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5261,8 +5287,8 @@ slash_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); + D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); } _res = NULL; done: @@ -5270,41 +5296,54 @@ slash_no_default_rule(Parser *p) return _res; } -// slash_with_default: -// | param_no_default* param_with_default+ '/' ',' -// | param_no_default* param_with_default+ '/' &')' -static SlashWithDefault* -slash_with_default_rule(Parser *p) +// sequence_pattern: '[' ','.pattern+? ']' | '(' ','.pattern+? ')' +static void * +sequence_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - SlashWithDefault* _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // param_no_default* param_with_default+ '/' ',' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '[' ','.pattern+? ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' ','.pattern+? ']'")); Token * _literal; Token * _literal_1; - asdl_seq * a; - asdl_seq * b; + void *a; if ( - (a = _loop0_61_rule(p)) // param_no_default* - && - (b = _loop1_62_rule(p)) // param_with_default+ + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' + (a = _gather_56_rule(p), 1) // ','.pattern+? && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); - _res = _PyPegen_slash_with_default ( p , a , b ); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' ','.pattern+? ']'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_List ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5313,30 +5352,37 @@ slash_with_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); + D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' ','.pattern+? ']'")); } - { // param_no_default* param_with_default+ '/' &')' + { // '(' ','.pattern+? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ','.pattern+? ')'")); Token * _literal; - asdl_seq * a; - asdl_seq * b; + Token * _literal_1; + void *a; if ( - (a = _loop0_63_rule(p)) // param_no_default* - && - (b = _loop1_64_rule(p)) // param_with_default+ + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' + (a = _gather_58_rule(p), 1) // ','.pattern+? && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); - _res = _PyPegen_slash_with_default ( p , a , b ); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ','.pattern+? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5345,8 +5391,8 @@ slash_with_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); + D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ','.pattern+? ')'")); } _res = NULL; done: @@ -5354,43 +5400,36 @@ slash_with_default_rule(Parser *p) return _res; } -// star_etc: -// | '*' param_no_default param_maybe_default* kwds? -// | '*' ',' param_maybe_default+ kwds? -// | kwds -// | invalid_star_etc -static StarEtc* -star_etc_rule(Parser *p) +// mapping_pattern: '{' ','.(key_pattern ':' closed_pattern)+ '}' +static void * +mapping_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - StarEtc* _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // '*' param_no_default param_maybe_default* kwds? + { // '{' ','.(key_pattern ':' closed_pattern)+ '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); + D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); + asdl_seq * _gather_60_var; Token * _literal; - arg_ty a; - asdl_seq * b; - void *c; + Token * _literal_1; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (a = param_no_default_rule(p)) // param_no_default + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (b = _loop0_65_rule(p)) // param_maybe_default* + (_gather_60_var = _gather_60_rule(p)) // ','.(key_pattern ':' closed_pattern)+ && - (c = kwds_rule(p), 1) // kwds? + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); - _res = _PyPegen_star_etc ( p , a , b , c ); + D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); + _res = NULL; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5399,31 +5438,41 @@ star_etc_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); + D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); } - { // '*' ',' param_maybe_default+ kwds? + _res = NULL; + done: + D(p->level--); + return _res; +} + +// key_pattern: literal_pattern &':' | '|'.literal_pattern+ +static void * +key_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // literal_pattern &':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); - Token * _literal; - Token * _literal_1; - asdl_seq * b; - void *c; + D(fprintf(stderr, "%*c> key_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern &':'")); + void *a; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' - && - (b = _loop1_66_rule(p)) // param_maybe_default+ + (a = literal_pattern_rule(p)) // literal_pattern && - (c = kwds_rule(p), 1) // kwds? + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' ) { - D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); - _res = _PyPegen_star_etc ( p , NULL , b , c ); + D(fprintf(stderr, "%*c+ key_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern &':'")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5432,22 +5481,22 @@ star_etc_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); + D(fprintf(stderr, "%*c%s key_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern &':'")); } - { // kwds + { // '|'.literal_pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); - arg_ty a; + D(fprintf(stderr, "%*c> key_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.literal_pattern+")); + asdl_seq * a; if ( - (a = kwds_rule(p)) // kwds + (a = _gather_62_rule(p)) // '|'.literal_pattern+ ) { - D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); - _res = _PyPegen_star_etc ( p , NULL , NULL , a ); + D(fprintf(stderr, "%*c+ key_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.literal_pattern+")); + _res = NULL; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5456,27 +5505,8 @@ star_etc_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); - } - { // invalid_star_etc - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); - void *invalid_star_etc_var; - if ( - (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc - ) - { - D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); - _res = invalid_star_etc_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); + D(fprintf(stderr, "%*c%s key_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.literal_pattern+")); } _res = NULL; done: @@ -5484,43 +5514,44 @@ star_etc_rule(Parser *p) return _res; } -// kwds: '**' param_no_default -static arg_ty -kwds_rule(Parser *p) +// class_pattern: '.'.NAME+ '(' pattern_args ')' +static void * +class_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arg_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // '**' param_no_default + { // '.'.NAME+ '(' pattern_args ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); + asdl_seq * _gather_64_var; Token * _literal; - arg_ty a; + Token * _literal_1; + void *pattern_args_var; if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (_gather_64_var = _gather_64_rule(p)) // '.'.NAME+ && - (a = param_no_default_rule(p)) // param_no_default + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (pattern_args_var = pattern_args_rule(p)) // pattern_args + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); + _res = _PyPegen_dummy_name(p, _gather_64_var, _literal, pattern_args_var, _literal_1); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); } _res = NULL; done: @@ -5528,36 +5559,39 @@ kwds_rule(Parser *p) return _res; } -// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' -static arg_ty -param_no_default_rule(Parser *p) +// pattern_args: +// | ','.pattern+ ',' ','.(NAME '=' or_pattern)+ +// | ','.(NAME '=' or_pattern)+ +// | ','.pattern+ +static void * +pattern_args_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arg_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // param ',' TYPE_COMMENT? + { // ','.pattern+ ',' ','.(NAME '=' or_pattern)+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); + D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); + asdl_seq * _gather_66_var; + asdl_seq * _gather_68_var; Token * _literal; - arg_ty a; - void *tc; if ( - (a = param_rule(p)) // param + (_gather_66_var = _gather_66_rule(p)) // ','.pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? + (_gather_68_var = _gather_68_rule(p)) // ','.(NAME '=' or_pattern)+ ) { - D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); - _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); + D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); + _res = NULL; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5566,27 +5600,22 @@ param_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); + D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); } - { // param TYPE_COMMENT? &')' + { // ','.(NAME '=' or_pattern)+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); - arg_ty a; - void *tc; + D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(NAME '=' or_pattern)+")); + asdl_seq * _gather_70_var; if ( - (a = param_rule(p)) // param - && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + (_gather_70_var = _gather_70_rule(p)) // ','.(NAME '=' or_pattern)+ ) { - D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); - _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); + D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(NAME '=' or_pattern)+")); + _res = NULL; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5595,80 +5624,22 @@ param_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); + D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(NAME '=' or_pattern)+")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' -static NameDefaultPair* -param_with_default_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - NameDefaultPair* _res = NULL; - int _mark = p->mark; - { // param default ',' TYPE_COMMENT? - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); - Token * _literal; - arg_ty a; - expr_ty c; - void *tc; - if ( - (a = param_rule(p)) // param - && - (c = default_rule(p)) // default - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? - ) - { - D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); - _res = _PyPegen_name_default_pair ( p , a , c , tc ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); - } - { // param default TYPE_COMMENT? &')' + { // ','.pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); - arg_ty a; - expr_ty c; - void *tc; + D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); + asdl_seq * a; if ( - (a = param_rule(p)) // param - && - (c = default_rule(p)) // default - && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + (a = _gather_72_rule(p)) // ','.pattern+ ) { - D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); - _res = _PyPegen_name_default_pair ( p , a , c , tc ); + D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5677,8 +5648,8 @@ param_with_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); + D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); } _res = NULL; done: @@ -5686,73 +5657,51 @@ param_with_default_rule(Parser *p) return _res; } -// param_maybe_default: -// | param default? ',' TYPE_COMMENT? -// | param default? TYPE_COMMENT? &')' -static NameDefaultPair* -param_maybe_default_rule(Parser *p) +// return_stmt: 'return' star_expressions? +static stmt_ty +return_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - NameDefaultPair* _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; - { // param default? ',' TYPE_COMMENT? + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'return' star_expressions? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); - Token * _literal; - arg_ty a; - void *c; - void *tc; + D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + Token * _keyword; + void *a; if ( - (a = param_rule(p)) // param - && - (c = default_rule(p), 1) // default? - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_keyword = _PyPegen_expect_token(p, 500)) // token='return' && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? + (a = star_expressions_rule(p), 1) // star_expressions? ) { - D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); - _res = _PyPegen_name_default_pair ( p , a , c , tc ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; + D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { D(p->level--); return NULL; } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); - } - { // param default? TYPE_COMMENT? &')' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); - arg_ty a; - void *c; - void *tc; - if ( - (a = param_rule(p)) // param - && - (c = default_rule(p), 1) // default? - && - (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' - ) - { - D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); - _res = _PyPegen_name_default_pair ( p , a , c , tc ); + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Return ( a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5761,8 +5710,8 @@ param_maybe_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); + D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); } _res = NULL; done: @@ -5770,16 +5719,16 @@ param_maybe_default_rule(Parser *p) return _res; } -// param: NAME annotation? -static arg_ty -param_rule(Parser *p) +// raise_stmt: 'raise' expression ['from' expression] | 'raise' +static stmt_ty +raise_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arg_ty _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5790,21 +5739,24 @@ param_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME annotation? + { // 'raise' expression ['from' expression] if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); + D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); + Token * _keyword; expr_ty a; void *b; if ( - (a = _PyPegen_name_token(p)) // NAME + (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' && - (b = annotation_rule(p), 1) // annotation? + (a = expression_rule(p)) // expression + && + (b = _tmp_74_rule(p), 1) // ['from' expression] ) { - D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); + D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5814,7 +5766,7 @@ param_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); + _res = _Py_Raise ( a , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5823,42 +5775,31 @@ param_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// annotation: ':' expression -static expr_ty -annotation_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); } - expr_ty _res = NULL; - int _mark = p->mark; - { // ':' expression + { // 'raise' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); + Token * _keyword; if ( - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (a = expression_rule(p)) // expression + (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' ) { - D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); - _res = a; + D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Raise ( NULL , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5867,8 +5808,8 @@ annotation_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); + D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); } _res = NULL; done: @@ -5876,33 +5817,33 @@ annotation_rule(Parser *p) return _res; } -// default: '=' expression -static expr_ty -default_rule(Parser *p) +// function_def: decorators function_def_raw | function_def_raw +static stmt_ty +function_def_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; - { // '=' expression + { // decorators function_def_raw if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); + asdl_seq* d; + stmt_ty f; if ( - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (d = decorators_rule(p)) // decorators && - (a = expression_rule(p)) // expression + (f = function_def_raw_rule(p)) // function_def_raw ) { - D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); - _res = a; + D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); + _res = _PyPegen_function_def_decorators ( p , d , f ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5911,49 +5852,27 @@ default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); + D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// decorators: (('@' named_expression NEWLINE))+ -static asdl_seq* -decorators_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq* _res = NULL; - int _mark = p->mark; - { // (('@' named_expression NEWLINE))+ + { // function_def_raw if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); - asdl_seq * a; + D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); + stmt_ty function_def_raw_var; if ( - (a = _loop1_67_rule(p)) // (('@' named_expression NEWLINE))+ + (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw ) { - D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); + _res = function_def_raw_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); + D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); } _res = NULL; done: @@ -5961,9 +5880,11 @@ decorators_rule(Parser *p) return _res; } -// class_def: decorators class_def_raw | class_def_raw +// function_def_raw: +// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block +// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block static stmt_ty -class_def_rule(Parser *p) +function_def_raw_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5972,22 +5893,61 @@ class_def_rule(Parser *p) } stmt_ty _res = NULL; int _mark = p->mark; - { // decorators class_def_raw + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); - asdl_seq* a; - stmt_ty b; + D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); + Token * _keyword; + Token * _literal; + Token * _literal_1; + Token * _literal_2; + void *a; + asdl_seq* b; + expr_ty n; + void *params; + void *tc; if ( - (a = decorators_rule(p)) // decorators + (_keyword = _PyPegen_expect_token(p, 525)) // token='def' && - (b = class_def_raw_rule(p)) // class_def_raw + (n = _PyPegen_name_token(p)) // NAME + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (params = params_rule(p), 1) // params? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + && + (a = _tmp_75_rule(p), 1) // ['->' expression] + && + (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' + && + (tc = func_type_comment_rule(p), 1) // func_type_comment? + && + (b = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); - _res = _PyPegen_class_def_decorators ( p , a , b ); + D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5996,78 +5956,48 @@ class_def_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); - } - { // class_def_raw - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); - stmt_ty class_def_raw_var; - if ( - (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw - ) - { - D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); - _res = class_def_raw_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block -static stmt_ty -class_def_raw_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - stmt_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'class' NAME ['(' arguments? ')'] ':' block + { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); + D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); Token * _keyword; Token * _literal; - expr_ty a; - void *b; - asdl_seq* c; + Token * _literal_1; + Token * _literal_2; + void *a; + Token * async_var; + asdl_seq* b; + expr_ty n; + void *params; + void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 523)) // token='class' + (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (a = _PyPegen_name_token(p)) // NAME + (_keyword = _PyPegen_expect_token(p, 525)) // token='def' && - (b = _tmp_68_rule(p), 1) // ['(' arguments? ')'] + (n = _PyPegen_name_token(p)) // NAME && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (c = block_rule(p)) // block + (params = params_rule(p), 1) // params? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + && + (a = _tmp_76_rule(p), 1) // ['->' expression] + && + (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' + && + (tc = func_type_comment_rule(p), 1) // func_type_comment? + && + (b = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); + D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6077,7 +6007,7 @@ class_def_raw_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA ); + _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6086,8 +6016,8 @@ class_def_raw_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); + D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block")); } _res = NULL; done: @@ -6095,43 +6025,38 @@ class_def_raw_rule(Parser *p) return _res; } -// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block -static asdl_seq* -block_rule(Parser *p) +// func_type_comment: +// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) +// | invalid_double_type_comments +// | TYPE_COMMENT +static Token* +func_type_comment_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq* _res = NULL; - if (_PyPegen_is_memoized(p, block_type, &_res)) { - D(p->level--); - return _res; - } + Token* _res = NULL; int _mark = p->mark; - { // NEWLINE INDENT statements DEDENT + { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); - asdl_seq* a; - Token * dedent_var; - Token * indent_var; + D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); Token * newline_var; + Token * t; if ( (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' && - (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' - && - (a = statements_rule(p)) // statements + (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' + _PyPegen_lookahead(1, _tmp_77_rule, p) ) { - D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); - _res = a; + D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); + _res = t; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6140,92 +6065,101 @@ block_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); + D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); } - { // simple_stmt + { // invalid_double_type_comments if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - asdl_seq* simple_stmt_var; + D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); + void *invalid_double_type_comments_var; if ( - (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt + (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments ) { - D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - _res = simple_stmt_var; + D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); + _res = invalid_double_type_comments_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); + D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); } - { // invalid_block + { // TYPE_COMMENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); - void *invalid_block_var; + D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); + Token * type_comment_var; if ( - (invalid_block_var = invalid_block_rule(p)) // invalid_block + (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' ) { - D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); - _res = invalid_block_var; + D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); + _res = type_comment_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); + D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, block_type, _res); D(p->level--); return _res; } -// expressions_list: ','.star_expression+ ','? -static asdl_seq* -expressions_list_rule(Parser *p) +// params: invalid_parameters | parameters +static arguments_ty +params_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq* _res = NULL; + arguments_ty _res = NULL; int _mark = p->mark; - { // ','.star_expression+ ','? + { // invalid_parameters if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * a; - if ( - (a = _gather_69_rule(p)) // ','.star_expression+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); + void *invalid_parameters_var; + if ( + (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters ) { - D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); + _res = invalid_parameters_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?")); + D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); + } + { // parameters + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); + arguments_ty parameters_var; + if ( + (parameters_var = parameters_rule(p)) // parameters + ) + { + D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); + _res = parameters_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); } _res = NULL; done: @@ -6233,58 +6167,44 @@ expressions_list_rule(Parser *p) return _res; } -// star_expressions: -// | star_expression ((',' star_expression))+ ','? -// | star_expression ',' -// | star_expression -static expr_ty -star_expressions_rule(Parser *p) +// parameters: +// | slash_no_default param_no_default* param_with_default* star_etc? +// | slash_with_default param_with_default* star_etc? +// | param_no_default+ param_with_default* star_etc? +// | param_with_default+ star_etc? +// | star_etc +static arguments_ty +parameters_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + arguments_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // star_expression ((',' star_expression))+ ','? + { // slash_no_default param_no_default* param_with_default* star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; + D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); + asdl_seq* a; asdl_seq * b; + asdl_seq * c; + void *d; if ( - (a = star_expression_rule(p)) // star_expression + (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop1_71_rule(p)) // ((',' star_expression))+ + (b = _loop0_78_rule(p)) // param_no_default* && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (c = _loop0_79_rule(p)) // param_with_default* + && + (d = star_etc_rule(p), 1) // star_etc? ) { - D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); + D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); + _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6293,34 +6213,28 @@ star_expressions_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); + D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); } - { // star_expression ',' + { // slash_with_default param_with_default* star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); + SlashWithDefault* a; + asdl_seq * b; + void *c; if ( - (a = star_expression_rule(p)) // star_expression + (a = slash_with_default_rule(p)) // slash_with_default && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (b = _loop0_80_rule(p)) // param_with_default* + && + (c = star_etc_rule(p), 1) // star_etc? ) { - D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); + D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6329,83 +6243,55 @@ star_expressions_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); + D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); } - { // star_expression + { // param_no_default+ param_with_default* star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); - expr_ty star_expression_var; + D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); + asdl_seq * a; + asdl_seq * b; + void *c; if ( - (star_expression_var = star_expression_rule(p)) // star_expression + (a = _loop1_81_rule(p)) // param_no_default+ + && + (b = _loop0_82_rule(p)) // param_with_default* + && + (c = star_etc_rule(p), 1) // star_etc? ) { - D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); - _res = star_expression_var; + D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// star_expression: '*' bitwise_or | expression -static expr_ty -star_expression_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '*' bitwise_or + { // param_with_default+ star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); + asdl_seq * a; + void *b; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (a = _loop1_83_rule(p)) // param_with_default+ && - (a = bitwise_or_rule(p)) // bitwise_or + (b = star_etc_rule(p), 1) // star_etc? ) { - D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Starred ( a , Load , EXTRA ); + D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6414,38 +6300,42 @@ star_expression_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); + D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); } - { // expression + { // star_etc if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); - expr_ty expression_var; + D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); + StarEtc* a; if ( - (expression_var = expression_rule(p)) // expression + (a = star_etc_rule(p)) // star_etc ) { - D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); - _res = expression_var; + D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); + D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, star_expression_type, _res); D(p->level--); return _res; } -// star_named_expressions: ','.star_named_expression+ ','? +// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' static asdl_seq* -star_named_expressions_rule(Parser *p) +slash_no_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6454,22 +6344,24 @@ star_named_expressions_rule(Parser *p) } asdl_seq* _res = NULL; int _mark = p->mark; - { // ','.star_named_expression+ ','? + { // param_no_default+ '/' ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings + D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); + Token * _literal; + Token * _literal_1; asdl_seq * a; if ( - (a = _gather_72_rule(p)) // ','.star_named_expression+ + (a = _loop1_84_rule(p)) // param_no_default+ && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); + D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6479,60 +6371,79 @@ star_named_expressions_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); + D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); } - _res = NULL; - done: - D(p->level--); + { // param_no_default+ '/' &')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); + Token * _literal; + asdl_seq * a; + if ( + (a = _loop1_85_rule(p)) // param_no_default+ + && + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + ) + { + D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); + } + _res = NULL; + done: + D(p->level--); return _res; } -// star_named_expression: '*' bitwise_or | named_expression -static expr_ty -star_named_expression_rule(Parser *p) +// slash_with_default: +// | param_no_default* param_with_default+ '/' ',' +// | param_no_default* param_with_default+ '/' &')' +static SlashWithDefault* +slash_with_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + SlashWithDefault* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '*' bitwise_or + { // param_no_default* param_with_default+ '/' ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); + D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); Token * _literal; - expr_ty a; + Token * _literal_1; + asdl_seq * a; + asdl_seq * b; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (a = _loop0_86_rule(p)) // param_no_default* && - (a = bitwise_or_rule(p)) // bitwise_or + (b = _loop1_87_rule(p)) // param_with_default+ + && + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Starred ( a , Load , EXTRA ); + D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); + _res = _PyPegen_slash_with_default ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6541,27 +6452,40 @@ star_named_expression_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); + D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); } - { // named_expression + { // param_no_default* param_with_default+ '/' &')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); - expr_ty named_expression_var; + D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); + Token * _literal; + asdl_seq * a; + asdl_seq * b; if ( - (named_expression_var = named_expression_rule(p)) // named_expression + (a = _loop0_88_rule(p)) // param_no_default* + && + (b = _loop1_89_rule(p)) // param_with_default+ + && + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' ) { - D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); - _res = named_expression_var; + D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); + _res = _PyPegen_slash_with_default ( p , a , b ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); } _res = NULL; done: @@ -6569,54 +6493,76 @@ star_named_expression_rule(Parser *p) return _res; } -// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression -static expr_ty -named_expression_rule(Parser *p) +// star_etc: +// | '*' param_no_default param_maybe_default* kwds? +// | '*' ',' param_maybe_default+ kwds? +// | kwds +// | invalid_star_etc +static StarEtc* +star_etc_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + StarEtc* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME ':=' expression + { // '*' param_no_default param_maybe_default* kwds? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); + D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); Token * _literal; - expr_ty a; - expr_ty b; + arg_ty a; + asdl_seq * b; + void *c; if ( - (a = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_literal = _PyPegen_expect_token(p, 53)) // token=':=' + (a = param_no_default_rule(p)) // param_no_default && - (b = expression_rule(p)) // expression + (b = _loop0_90_rule(p)) // param_maybe_default* + && + (c = kwds_rule(p), 1) // kwds? ) { - D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { + D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); + _res = _PyPegen_star_etc ( p , a , b , c ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; D(p->level--); return NULL; } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); + } + { // '*' ',' param_maybe_default+ kwds? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); + Token * _literal; + Token * _literal_1; + asdl_seq * b; + void *c; + if ( + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (b = _loop1_91_rule(p)) // param_maybe_default+ + && + (c = kwds_rule(p), 1) // kwds? + ) + { + D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); + _res = _PyPegen_star_etc ( p , NULL , b , c ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6625,48 +6571,51 @@ named_expression_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' expression")); + D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); } - { // expression !':=' + { // kwds if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); - expr_ty expression_var; + D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); + arg_ty a; if ( - (expression_var = expression_rule(p)) // expression - && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' + (a = kwds_rule(p)) // kwds ) { - D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); - _res = expression_var; + D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); + _res = _PyPegen_star_etc ( p , NULL , NULL , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); } - { // invalid_named_expression + { // invalid_star_etc if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); - void *invalid_named_expression_var; + D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); + void *invalid_star_etc_var; if ( - (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression + (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc ) { - D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); - _res = invalid_named_expression_var; + D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); + _res = invalid_star_etc_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); + D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); } _res = NULL; done: @@ -6674,54 +6623,43 @@ named_expression_rule(Parser *p) return _res; } -// annotated_rhs: yield_expr | star_expressions -static expr_ty -annotated_rhs_rule(Parser *p) +// kwds: '**' param_no_default +static arg_ty +kwds_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + arg_ty _res = NULL; int _mark = p->mark; - { // yield_expr + { // '**' param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); - expr_ty yield_expr_var; + D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); + Token * _literal; + arg_ty a; if ( - (yield_expr_var = yield_expr_rule(p)) // yield_expr + (_literal = _PyPegen_expect_token(p, 35)) // token='**' + && + (a = param_no_default_rule(p)) // param_no_default ) { - D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); - _res = yield_expr_var; + D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); - } - { // star_expressions - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); - expr_ty star_expressions_var; - if ( - (star_expressions_var = star_expressions_rule(p)) // star_expressions - ) - { - D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); - _res = star_expressions_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); } _res = NULL; done: @@ -6729,55 +6667,36 @@ annotated_rhs_rule(Parser *p) return _res; } -// expressions: expression ((',' expression))+ ','? | expression ',' | expression -static expr_ty -expressions_rule(Parser *p) +// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' +static arg_ty +param_no_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + arg_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // expression ((',' expression))+ ','? + { // param ',' TYPE_COMMENT? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; - asdl_seq * b; + D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); + Token * _literal; + arg_ty a; + void *tc; if ( - (a = expression_rule(p)) // expression + (a = param_rule(p)) // param && - (b = _loop1_74_rule(p)) // ((',' expression))+ + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? ) { - D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); + D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); + _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6786,34 +6705,27 @@ expressions_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); + D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); } - { // expression ',' + { // param TYPE_COMMENT? &')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); + arg_ty a; + void *tc; if ( - (a = expression_rule(p)) // expression + (a = param_rule(p)) // param && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' ) { - D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); + D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); + _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6822,27 +6734,8 @@ expressions_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); - } - { // expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); - expr_ty expression_var; - if ( - (expression_var = expression_rule(p)) // expression - ) - { - D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); - _res = expression_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); + D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); } _res = NULL; done: @@ -6850,64 +6743,39 @@ expressions_rule(Parser *p) return _res; } -// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef -static expr_ty -expression_rule(Parser *p) +// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' +static NameDefaultPair* +param_with_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, expression_type, &_res)) { - D(p->level--); - return _res; - } + NameDefaultPair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // disjunction 'if' disjunction 'else' expression + { // param default ',' TYPE_COMMENT? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); - Token * _keyword; - Token * _keyword_1; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); + Token * _literal; + arg_ty a; expr_ty c; + void *tc; if ( - (a = disjunction_rule(p)) // disjunction - && - (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + (a = param_rule(p)) // param && - (b = disjunction_rule(p)) // disjunction + (c = default_rule(p)) // default && - (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (c = expression_rule(p)) // expression + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? ) { - D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_IfExp ( b , a , c , EXTRA ); + D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); + _res = _PyPegen_name_default_pair ( p , a , c , tc ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6916,105 +6784,82 @@ expression_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); - } - { // disjunction - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); - expr_ty disjunction_var; - if ( - (disjunction_var = disjunction_rule(p)) // disjunction - ) - { - D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); - _res = disjunction_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); + D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); } - { // lambdef + { // param default TYPE_COMMENT? &')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); - expr_ty lambdef_var; + D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); + arg_ty a; + expr_ty c; + void *tc; if ( - (lambdef_var = lambdef_rule(p)) // lambdef + (a = param_rule(p)) // param + && + (c = default_rule(p)) // default + && + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' ) { - D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); - _res = lambdef_var; + D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); + _res = _PyPegen_name_default_pair ( p , a , c , tc ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); + D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, expression_type, _res); D(p->level--); return _res; } -// lambdef: 'lambda' lambda_parameters? ':' expression -static expr_ty -lambdef_rule(Parser *p) +// param_maybe_default: +// | param default? ',' TYPE_COMMENT? +// | param default? TYPE_COMMENT? &')' +static NameDefaultPair* +param_maybe_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + NameDefaultPair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'lambda' lambda_parameters? ':' expression + { // param default? ',' TYPE_COMMENT? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); - Token * _keyword; + D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); Token * _literal; - void *a; - expr_ty b; + arg_ty a; + void *c; + void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 524)) // token='lambda' + (a = param_rule(p)) // param && - (a = lambda_parameters_rule(p), 1) // lambda_parameters? + (c = default_rule(p), 1) // default? && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = expression_rule(p)) // expression + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? ) { - D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); + D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); + _res = _PyPegen_name_default_pair ( p , a , c , tc ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7023,53 +6868,30 @@ lambdef_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// lambda_parameters: -// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? -// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? -// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? -// | lambda_param_with_default+ lambda_star_etc? -// | lambda_star_etc -static arguments_ty -lambda_parameters_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); } - arguments_ty _res = NULL; - int _mark = p->mark; - { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? + { // param default? TYPE_COMMENT? &')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); - asdl_seq* a; - asdl_seq * b; - asdl_seq * c; - void *d; + D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); + arg_ty a; + void *c; + void *tc; if ( - (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default + (a = param_rule(p)) // param && - (b = _loop0_75_rule(p)) // lambda_param_no_default* + (c = default_rule(p), 1) // default? && - (c = _loop0_76_rule(p)) // lambda_param_with_default* + (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? && - (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' ) { - D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); - _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); + D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); + _res = _PyPegen_name_default_pair ( p , a , c , tc ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7078,58 +6900,60 @@ lambda_parameters_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); + D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); } - { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? + _res = NULL; + done: + D(p->level--); + return _res; +} + +// param: NAME annotation? +static arg_ty +param_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + arg_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME annotation? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); - SlashWithDefault* a; - asdl_seq * b; - void *c; + D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); + expr_ty a; + void *b; if ( - (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default - && - (b = _loop0_77_rule(p)) // lambda_param_with_default* + (a = _PyPegen_name_token(p)) // NAME && - (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? + (b = annotation_rule(p), 1) // annotation? ) { - D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; + D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { D(p->level--); return NULL; } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); - } - { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); - asdl_seq * a; - asdl_seq * b; - void *c; - if ( - (a = _loop1_78_rule(p)) // lambda_param_no_default+ - && - (b = _loop0_79_rule(p)) // lambda_param_with_default* - && - (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? - ) - { - D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7138,25 +6962,42 @@ lambda_parameters_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); + D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); } - { // lambda_param_with_default+ lambda_star_etc? + _res = NULL; + done: + D(p->level--); + return _res; +} + +// annotation: ':' expression +static expr_ty +annotation_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // ':' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); - asdl_seq * a; - void *b; + D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); + Token * _literal; + expr_ty a; if ( - (a = _loop1_80_rule(p)) // lambda_param_with_default+ + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && - (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); + D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7165,22 +7006,42 @@ lambda_parameters_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); + D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); } - { // lambda_star_etc + _res = NULL; + done: + D(p->level--); + return _res; +} + +// default: '=' expression +static expr_ty +default_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // '=' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); - StarEtc* a; + D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); + Token * _literal; + expr_ty a; if ( - (a = lambda_star_etc_rule(p)) // lambda_star_etc + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + && + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); - _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); + D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7189,8 +7050,8 @@ lambda_parameters_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); + D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); } _res = NULL; done: @@ -7198,11 +7059,9 @@ lambda_parameters_rule(Parser *p) return _res; } -// lambda_slash_no_default: -// | lambda_param_no_default+ '/' ',' -// | lambda_param_no_default+ '/' &':' +// decorators: (('@' named_expression NEWLINE))+ static asdl_seq* -lambda_slash_no_default_rule(Parser *p) +decorators_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -7211,24 +7070,18 @@ lambda_slash_no_default_rule(Parser *p) } asdl_seq* _res = NULL; int _mark = p->mark; - { // lambda_param_no_default+ '/' ',' + { // (('@' named_expression NEWLINE))+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_81_rule(p)) // lambda_param_no_default+ - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + (a = _loop1_92_rule(p)) // (('@' named_expression NEWLINE))+ ) { - D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); + D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -7238,37 +7091,8 @@ lambda_slash_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); - } - { // lambda_param_no_default+ '/' &':' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); - Token * _literal; - asdl_seq * a; - if ( - (a = _loop1_82_rule(p)) // lambda_param_no_default+ - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' - ) - { - D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); + D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); } _res = NULL; done: @@ -7276,41 +7100,33 @@ lambda_slash_no_default_rule(Parser *p) return _res; } -// lambda_slash_with_default: -// | lambda_param_no_default* lambda_param_with_default+ '/' ',' -// | lambda_param_no_default* lambda_param_with_default+ '/' &':' -static SlashWithDefault* -lambda_slash_with_default_rule(Parser *p) +// class_def: decorators class_def_raw | class_def_raw +static stmt_ty +class_def_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - SlashWithDefault* _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; - { // lambda_param_no_default* lambda_param_with_default+ '/' ',' + { // decorators class_def_raw if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); - Token * _literal; - Token * _literal_1; - asdl_seq * a; - asdl_seq * b; + D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); + asdl_seq* a; + stmt_ty b; if ( - (a = _loop0_83_rule(p)) // lambda_param_no_default* - && - (b = _loop1_84_rule(p)) // lambda_param_with_default+ - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' + (a = decorators_rule(p)) // decorators && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + (b = class_def_raw_rule(p)) // class_def_raw ) { - D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); - _res = _PyPegen_slash_with_default ( p , a , b ); + D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); + _res = _PyPegen_class_def_decorators ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7319,40 +7135,27 @@ lambda_slash_with_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); + D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); } - { // lambda_param_no_default* lambda_param_with_default+ '/' &':' + { // class_def_raw if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); - Token * _literal; - asdl_seq * a; - asdl_seq * b; + D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); + stmt_ty class_def_raw_var; if ( - (a = _loop0_85_rule(p)) // lambda_param_no_default* - && - (b = _loop1_86_rule(p)) // lambda_param_with_default+ - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw ) { - D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); - _res = _PyPegen_slash_with_default ( p , a , b ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); + _res = class_def_raw_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); + D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); } _res = NULL; done: @@ -7360,43 +7163,60 @@ lambda_slash_with_default_rule(Parser *p) return _res; } -// lambda_star_etc: -// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? -// | '*' ',' lambda_param_maybe_default+ lambda_kwds? -// | lambda_kwds -// | invalid_lambda_star_etc -static StarEtc* -lambda_star_etc_rule(Parser *p) +// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block +static stmt_ty +class_def_raw_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - StarEtc* _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; - { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'class' NAME ['(' arguments? ')'] ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); + D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); + Token * _keyword; Token * _literal; - arg_ty a; - asdl_seq * b; - void *c; + expr_ty a; + void *b; + asdl_seq* c; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (_keyword = _PyPegen_expect_token(p, 526)) // token='class' && - (a = lambda_param_no_default_rule(p)) // lambda_param_no_default + (a = _PyPegen_name_token(p)) // NAME && - (b = _loop0_87_rule(p)) // lambda_param_maybe_default* + (b = _tmp_93_rule(p), 1) // ['(' arguments? ')'] && - (c = lambda_kwds_rule(p), 1) // lambda_kwds? + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (c = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); - _res = _PyPegen_star_etc ( p , a , b , c ); + D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7405,31 +7225,52 @@ lambda_star_etc_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); + D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); } - { // '*' ',' lambda_param_maybe_default+ lambda_kwds? + _res = NULL; + done: + D(p->level--); + return _res; +} + +// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block +static asdl_seq* +block_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq* _res = NULL; + if (_PyPegen_is_memoized(p, block_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + { // NEWLINE INDENT statements DEDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); - Token * _literal; - Token * _literal_1; - asdl_seq * b; - void *c; + D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); + asdl_seq* a; + Token * dedent_var; + Token * indent_var; + Token * newline_var; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' && - (b = _loop1_88_rule(p)) // lambda_param_maybe_default+ + (a = statements_rule(p)) // statements && - (c = lambda_kwds_rule(p), 1) // lambda_kwds? + (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) { - D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); - _res = _PyPegen_star_etc ( p , NULL , b , c ); + D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7438,84 +7279,81 @@ lambda_star_etc_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); + D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); } - { // lambda_kwds + { // simple_stmt if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); - arg_ty a; + D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); + asdl_seq* simple_stmt_var; if ( - (a = lambda_kwds_rule(p)) // lambda_kwds + (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt ) { - D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); - _res = _PyPegen_star_etc ( p , NULL , NULL , a ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); + _res = simple_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); + D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); } - { // invalid_lambda_star_etc + { // invalid_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); - void *invalid_lambda_star_etc_var; + D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); + void *invalid_block_var; if ( - (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc + (invalid_block_var = invalid_block_rule(p)) // invalid_block ) { - D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); - _res = invalid_lambda_star_etc_var; + D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); + _res = invalid_block_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); + D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, block_type, _res); D(p->level--); return _res; } -// lambda_kwds: '**' lambda_param_no_default -static arg_ty -lambda_kwds_rule(Parser *p) +// expressions_list: ','.star_expression+ ','? +static asdl_seq* +expressions_list_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arg_ty _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; - { // '**' lambda_param_no_default + { // ','.star_expression+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); - Token * _literal; - arg_ty a; + D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (a = _gather_94_rule(p)) // ','.star_expression+ && - (a = lambda_param_no_default_rule(p)) // lambda_param_no_default + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); + D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -7525,8 +7363,8 @@ lambda_kwds_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); + D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?")); } _res = NULL; done: @@ -7534,33 +7372,58 @@ lambda_kwds_rule(Parser *p) return _res; } -// lambda_param_no_default: lambda_param ',' | lambda_param &':' -static arg_ty -lambda_param_no_default_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; +// star_expressions: +// | star_expression ((',' star_expression))+ ','? +// | star_expression ',' +// | star_expression +static expr_ty +star_expressions_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - arg_ty _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // lambda_param ',' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // star_expression ((',' star_expression))+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); - Token * _literal; - arg_ty a; + D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; + asdl_seq * b; if ( - (a = lambda_param_rule(p)) // lambda_param + (a = star_expression_rule(p)) // star_expression && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (b = _loop1_96_rule(p)) // ((',' star_expression))+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); - _res = a; + D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7569,24 +7432,34 @@ lambda_param_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); + D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); } - { // lambda_param &':' + { // star_expression ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); - arg_ty a; + D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); + Token * _literal; + expr_ty a; if ( - (a = lambda_param_rule(p)) // lambda_param + (a = star_expression_rule(p)) // star_expression && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); - _res = a; + D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7595,8 +7468,27 @@ lambda_param_no_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); + D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); + } + { // star_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); + expr_ty star_expression_var; + if ( + (star_expression_var = star_expression_rule(p)) // star_expression + ) + { + D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); + _res = star_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); } _res = NULL; done: @@ -7604,36 +7496,55 @@ lambda_param_no_default_rule(Parser *p) return _res; } -// lambda_param_with_default: lambda_param default ',' | lambda_param default &':' -static NameDefaultPair* -lambda_param_with_default_rule(Parser *p) +// star_expression: '*' bitwise_or | expression +static expr_ty +star_expression_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - NameDefaultPair* _res = NULL; + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; - { // lambda_param default ',' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '*' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); + D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); Token * _literal; - arg_ty a; - expr_ty c; + expr_ty a; if ( - (a = lambda_param_rule(p)) // lambda_param - && - (c = default_rule(p)) // default + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); - _res = _PyPegen_name_default_pair ( p , a , c , NULL ); + D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Starred ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7642,103 +7553,63 @@ lambda_param_with_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); + D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); } - { // lambda_param default &':' + { // expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); - arg_ty a; - expr_ty c; + D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); + expr_ty expression_var; if ( - (a = lambda_param_rule(p)) // lambda_param - && - (c = default_rule(p)) // default - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + (expression_var = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); - _res = _PyPegen_name_default_pair ( p , a , c , NULL ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); + _res = expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); + D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, star_expression_type, _res); D(p->level--); return _res; } -// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' -static NameDefaultPair* -lambda_param_maybe_default_rule(Parser *p) +// star_named_expressions: ','.star_named_expression+ ','? +static asdl_seq* +star_named_expressions_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - NameDefaultPair* _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; - { // lambda_param default? ',' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); - Token * _literal; - arg_ty a; - void *c; - if ( - (a = lambda_param_rule(p)) // lambda_param - && - (c = default_rule(p), 1) // default? - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - ) - { - D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); - _res = _PyPegen_name_default_pair ( p , a , c , NULL ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); - } - { // lambda_param default? &':' + { // ','.star_named_expression+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); - arg_ty a; - void *c; + D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; if ( - (a = lambda_param_rule(p)) // lambda_param - && - (c = default_rule(p), 1) // default? + (a = _gather_97_rule(p)) // ','.star_named_expression+ && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); - _res = _PyPegen_name_default_pair ( p , a , c , NULL ); + D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7747,8 +7618,8 @@ lambda_param_maybe_default_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); + D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); } _res = NULL; done: @@ -7756,16 +7627,16 @@ lambda_param_maybe_default_rule(Parser *p) return _res; } -// lambda_param: NAME -static arg_ty -lambda_param_rule(Parser *p) +// star_named_expression: '*' bitwise_or | named_expression +static expr_ty +star_named_expression_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - arg_ty _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -7776,18 +7647,21 @@ lambda_param_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME + { // '*' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); + Token * _literal; expr_ty a; if ( - (a = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -7797,7 +7671,7 @@ lambda_param_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); + _res = _Py_Starred ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7806,8 +7680,27 @@ lambda_param_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); + } + { // named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + expr_ty named_expression_var; + if ( + (named_expression_var = named_expression_rule(p)) // named_expression + ) + { + D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + _res = named_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; done: @@ -7815,9 +7708,9 @@ lambda_param_rule(Parser *p) return _res; } -// disjunction: conjunction (('or' conjunction))+ | conjunction +// named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression static expr_ty -disjunction_rule(Parser *p) +named_expression_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -7825,10 +7718,6 @@ disjunction_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { - D(p->level--); - return _res; - } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -7839,21 +7728,24 @@ disjunction_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // conjunction (('or' conjunction))+ + { // NAME ':=' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); + D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); + Token * _literal; expr_ty a; - asdl_seq * b; + expr_ty b; if ( - (a = conjunction_rule(p)) // conjunction + (a = _PyPegen_name_token(p)) // NAME && - (b = _loop1_89_rule(p)) // (('or' conjunction))+ + (_literal = _PyPegen_expect_token(p, 53)) // token=':=' + && + (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); + D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -7863,7 +7755,7 @@ disjunction_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); + _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -7872,38 +7764,58 @@ disjunction_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); + D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' expression")); } - { // conjunction + { // expression !':=' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); - expr_ty conjunction_var; + D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); + expr_ty expression_var; if ( - (conjunction_var = conjunction_rule(p)) // conjunction + (expression_var = expression_rule(p)) // expression + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' ) { - D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); - _res = conjunction_var; + D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); + _res = expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); + D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); + } + { // invalid_named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); + void *invalid_named_expression_var; + if ( + (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression + ) + { + D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); + _res = invalid_named_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, disjunction_type, _res); D(p->level--); return _res; } -// conjunction: inversion (('and' inversion))+ | inversion +// annotated_rhs: yield_expr | star_expressions static expr_ty -conjunction_rule(Parser *p) +annotated_rhs_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -7911,85 +7823,54 @@ conjunction_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { - D(p->level--); - return _res; - } int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // inversion (('and' inversion))+ + { // yield_expr if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); - expr_ty a; - asdl_seq * b; + D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + expr_ty yield_expr_var; if ( - (a = inversion_rule(p)) // inversion - && - (b = _loop1_90_rule(p)) // (('and' inversion))+ + (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); + D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } - { // inversion + { // star_expressions if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); - expr_ty inversion_var; + D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + expr_ty star_expressions_var; if ( - (inversion_var = inversion_rule(p)) // inversion + (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); - _res = inversion_var; + D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); + D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, conjunction_type, _res); D(p->level--); return _res; } -// inversion: 'not' inversion | comparison +// expressions: expression ((',' expression))+ ','? | expression ',' | expression static expr_ty -inversion_rule(Parser *p) +expressions_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -7997,10 +7878,6 @@ inversion_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, inversion_type, &_res)) { - D(p->level--); - return _res; - } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -8011,21 +7888,25 @@ inversion_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'not' inversion + { // expression ((',' expression))+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); - Token * _keyword; + D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings expr_ty a; + asdl_seq * b; if ( - (_keyword = _PyPegen_expect_token(p, 525)) // token='not' + (a = expression_rule(p)) // expression && - (a = inversion_rule(p)) // inversion + (b = _loop1_99_rule(p)) // ((',' expression))+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); + D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -8035,7 +7916,7 @@ inversion_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( Not , a , EXTRA ); + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8044,38 +7925,73 @@ inversion_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); + D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); } - { // comparison + { // expression ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); - expr_ty comparison_var; + D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); + Token * _literal; + expr_ty a; if ( - (comparison_var = comparison_rule(p)) // comparison + (a = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); - _res = comparison_var; + D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); + D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); + } + { // expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); + expr_ty expression_var; + if ( + (expression_var = expression_rule(p)) // expression + ) + { + D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); + _res = expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, inversion_type, _res); D(p->level--); return _res; } -// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or +// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef static expr_ty -comparison_rule(Parser *p) +expression_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -8083,6 +7999,10 @@ comparison_rule(Parser *p) return NULL; } expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, expression_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -8093,21 +8013,30 @@ comparison_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // bitwise_or compare_op_bitwise_or_pair+ + { // disjunction 'if' disjunction 'else' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); + D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); + Token * _keyword; + Token * _keyword_1; expr_ty a; - asdl_seq * b; - if ( - (a = bitwise_or_rule(p)) // bitwise_or + expr_ty b; + expr_ty c; + if ( + (a = disjunction_rule(p)) // disjunction + && + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + && + (b = disjunction_rule(p)) // disjunction + && + (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' && - (b = _loop1_91_rule(p)) // compare_op_bitwise_or_pair+ + (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); + D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -8117,7 +8046,7 @@ comparison_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA ); + _res = _Py_IfExp ( b , a , c , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8126,244 +8055,281 @@ comparison_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); + D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); } - { // bitwise_or + { // disjunction if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); - expr_ty bitwise_or_var; + D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); + expr_ty disjunction_var; if ( - (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or + (disjunction_var = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); - _res = bitwise_or_var; + D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); + _res = disjunction_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); + D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); + } + { // lambdef + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); + expr_ty lambdef_var; + if ( + (lambdef_var = lambdef_rule(p)) // lambdef + ) + { + D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); + _res = lambdef_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, expression_type, _res); D(p->level--); return _res; } -// compare_op_bitwise_or_pair: -// | eq_bitwise_or -// | noteq_bitwise_or -// | lte_bitwise_or -// | lt_bitwise_or -// | gte_bitwise_or -// | gt_bitwise_or -// | notin_bitwise_or -// | in_bitwise_or -// | isnot_bitwise_or -// | is_bitwise_or -static CmpopExprPair* -compare_op_bitwise_or_pair_rule(Parser *p) +// lambdef: 'lambda' lambda_parameters? ':' expression +static expr_ty +lambdef_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // eq_bitwise_or + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'lambda' lambda_parameters? ':' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); - CmpopExprPair* eq_bitwise_or_var; + D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); + Token * _keyword; + Token * _literal; + void *a; + expr_ty b; if ( - (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or + (_keyword = _PyPegen_expect_token(p, 527)) // token='lambda' + && + (a = lambda_parameters_rule(p), 1) // lambda_parameters? + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); - _res = eq_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); + D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); } - { // noteq_bitwise_or + _res = NULL; + done: + D(p->level--); + return _res; +} + +// lambda_parameters: +// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? +// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? +// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? +// | lambda_param_with_default+ lambda_star_etc? +// | lambda_star_etc +static arguments_ty +lambda_parameters_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + arguments_ty _res = NULL; + int _mark = p->mark; + { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); - CmpopExprPair* noteq_bitwise_or_var; + D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); + asdl_seq* a; + asdl_seq * b; + asdl_seq * c; + void *d; if ( - (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or + (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default + && + (b = _loop0_100_rule(p)) // lambda_param_no_default* + && + (c = _loop0_101_rule(p)) // lambda_param_with_default* + && + (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); - _res = noteq_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); + _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); } - { // lte_bitwise_or + { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); - CmpopExprPair* lte_bitwise_or_var; + D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); + SlashWithDefault* a; + asdl_seq * b; + void *c; if ( - (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or + (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default + && + (b = _loop0_102_rule(p)) // lambda_param_with_default* + && + (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); - _res = lte_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); } - { // lt_bitwise_or + { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); - CmpopExprPair* lt_bitwise_or_var; + D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); + asdl_seq * a; + asdl_seq * b; + void *c; if ( - (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or + (a = _loop1_103_rule(p)) // lambda_param_no_default+ + && + (b = _loop0_104_rule(p)) // lambda_param_with_default* + && + (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); - _res = lt_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); } - { // gte_bitwise_or + { // lambda_param_with_default+ lambda_star_etc? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); - CmpopExprPair* gte_bitwise_or_var; + D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); + asdl_seq * a; + void *b; if ( - (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or + (a = _loop1_105_rule(p)) // lambda_param_with_default+ + && + (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); - _res = gte_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); } - { // gt_bitwise_or + { // lambda_star_etc if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); - CmpopExprPair* gt_bitwise_or_var; + D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); + StarEtc* a; if ( - (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or + (a = lambda_star_etc_rule(p)) // lambda_star_etc ) { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); - _res = gt_bitwise_or_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); - } - { // notin_bitwise_or - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); - CmpopExprPair* notin_bitwise_or_var; - if ( - (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or - ) - { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); - _res = notin_bitwise_or_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); - } - { // in_bitwise_or - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); - CmpopExprPair* in_bitwise_or_var; - if ( - (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or - ) - { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); - _res = in_bitwise_or_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); - } - { // isnot_bitwise_or - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); - CmpopExprPair* isnot_bitwise_or_var; - if ( - (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or - ) - { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); - _res = isnot_bitwise_or_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); - } - { // is_bitwise_or - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); - CmpopExprPair* is_bitwise_or_var; - if ( - (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or - ) - { - D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); - _res = is_bitwise_or_var; + D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); + _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); } _res = NULL; done: @@ -8371,33 +8337,38 @@ compare_op_bitwise_or_pair_rule(Parser *p) return _res; } -// eq_bitwise_or: '==' bitwise_or -static CmpopExprPair* -eq_bitwise_or_rule(Parser *p) +// lambda_slash_no_default: +// | lambda_param_no_default+ '/' ',' +// | lambda_param_no_default+ '/' &':' +static asdl_seq* +lambda_slash_no_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; - { // '==' bitwise_or + { // lambda_param_no_default+ '/' ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); + D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); Token * _literal; - expr_ty a; + Token * _literal_1; + asdl_seq * a; if ( - (_literal = _PyPegen_expect_token(p, 27)) // token='==' + (a = _loop1_106_rule(p)) // lambda_param_no_default+ && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); + D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8406,42 +8377,27 @@ eq_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// noteq_bitwise_or: ('!=') bitwise_or -static CmpopExprPair* -noteq_bitwise_or_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); } - CmpopExprPair* _res = NULL; - int _mark = p->mark; - { // ('!=') bitwise_or + { // lambda_param_no_default+ '/' &':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_92_var; - expr_ty a; + D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); + Token * _literal; + asdl_seq * a; if ( - (_tmp_92_var = _tmp_92_rule(p)) // '!=' + (a = _loop1_107_rule(p)) // lambda_param_no_default+ && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' ) { - D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); + D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8450,8 +8406,8 @@ noteq_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); } _res = NULL; done: @@ -8459,33 +8415,41 @@ noteq_bitwise_or_rule(Parser *p) return _res; } -// lte_bitwise_or: '<=' bitwise_or -static CmpopExprPair* -lte_bitwise_or_rule(Parser *p) +// lambda_slash_with_default: +// | lambda_param_no_default* lambda_param_with_default+ '/' ',' +// | lambda_param_no_default* lambda_param_with_default+ '/' &':' +static SlashWithDefault* +lambda_slash_with_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + SlashWithDefault* _res = NULL; int _mark = p->mark; - { // '<=' bitwise_or + { // lambda_param_no_default* lambda_param_with_default+ '/' ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); + D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); Token * _literal; - expr_ty a; + Token * _literal_1; + asdl_seq * a; + asdl_seq * b; if ( - (_literal = _PyPegen_expect_token(p, 29)) // token='<=' + (a = _loop0_108_rule(p)) // lambda_param_no_default* && - (a = bitwise_or_rule(p)) // bitwise_or + (b = _loop1_109_rule(p)) // lambda_param_with_default+ + && + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); + D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); + _res = _PyPegen_slash_with_default ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8494,42 +8458,30 @@ lte_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// lt_bitwise_or: '<' bitwise_or -static CmpopExprPair* -lt_bitwise_or_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); } - CmpopExprPair* _res = NULL; - int _mark = p->mark; - { // '<' bitwise_or + { // lambda_param_no_default* lambda_param_with_default+ '/' &':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); + D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); Token * _literal; - expr_ty a; + asdl_seq * a; + asdl_seq * b; if ( - (_literal = _PyPegen_expect_token(p, 20)) // token='<' + (a = _loop0_110_rule(p)) // lambda_param_no_default* && - (a = bitwise_or_rule(p)) // bitwise_or + (b = _loop1_111_rule(p)) // lambda_param_with_default+ + && + (_literal = _PyPegen_expect_token(p, 17)) // token='/' + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' ) { - D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); + D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); + _res = _PyPegen_slash_with_default ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8538,8 +8490,8 @@ lt_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); } _res = NULL; done: @@ -8547,33 +8499,43 @@ lt_bitwise_or_rule(Parser *p) return _res; } -// gte_bitwise_or: '>=' bitwise_or -static CmpopExprPair* -gte_bitwise_or_rule(Parser *p) +// lambda_star_etc: +// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? +// | '*' ',' lambda_param_maybe_default+ lambda_kwds? +// | lambda_kwds +// | invalid_lambda_star_etc +static StarEtc* +lambda_star_etc_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + StarEtc* _res = NULL; int _mark = p->mark; - { // '>=' bitwise_or + { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); + D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); Token * _literal; - expr_ty a; + arg_ty a; + asdl_seq * b; + void *c; if ( - (_literal = _PyPegen_expect_token(p, 30)) // token='>=' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = bitwise_or_rule(p)) // bitwise_or + (a = lambda_param_no_default_rule(p)) // lambda_param_no_default + && + (b = _loop0_112_rule(p)) // lambda_param_maybe_default* + && + (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) { - D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); + D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); + _res = _PyPegen_star_etc ( p , a , b , c ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8582,42 +8544,31 @@ gte_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// gt_bitwise_or: '>' bitwise_or -static CmpopExprPair* -gt_bitwise_or_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); } - CmpopExprPair* _res = NULL; - int _mark = p->mark; - { // '>' bitwise_or + { // '*' ',' lambda_param_maybe_default+ lambda_kwds? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); + D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); Token * _literal; - expr_ty a; + Token * _literal_1; + asdl_seq * b; + void *c; if ( - (_literal = _PyPegen_expect_token(p, 21)) // token='>' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (b = _loop1_113_rule(p)) // lambda_param_maybe_default+ + && + (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) { - D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); + D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); + _res = _PyPegen_star_etc ( p , NULL , b , c ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8626,8 +8577,51 @@ gt_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); + } + { // lambda_kwds + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); + arg_ty a; + if ( + (a = lambda_kwds_rule(p)) // lambda_kwds + ) + { + D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); + _res = _PyPegen_star_etc ( p , NULL , NULL , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); + } + { // invalid_lambda_star_etc + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); + void *invalid_lambda_star_etc_var; + if ( + (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc + ) + { + D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); + _res = invalid_lambda_star_etc_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); } _res = NULL; done: @@ -8635,36 +8629,33 @@ gt_bitwise_or_rule(Parser *p) return _res; } -// notin_bitwise_or: 'not' 'in' bitwise_or -static CmpopExprPair* -notin_bitwise_or_rule(Parser *p) +// lambda_kwds: '**' lambda_param_no_default +static arg_ty +lambda_kwds_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + arg_ty _res = NULL; int _mark = p->mark; - { // 'not' 'in' bitwise_or + { // '**' lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); - Token * _keyword; - Token * _keyword_1; - expr_ty a; + D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); + Token * _literal; + arg_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 525)) // token='not' - && - (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' + (_literal = _PyPegen_expect_token(p, 35)) // token='**' && - (a = bitwise_or_rule(p)) // bitwise_or + (a = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); + D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8673,8 +8664,8 @@ notin_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); } _res = NULL; done: @@ -8682,33 +8673,33 @@ notin_bitwise_or_rule(Parser *p) return _res; } -// in_bitwise_or: 'in' bitwise_or -static CmpopExprPair* -in_bitwise_or_rule(Parser *p) +// lambda_param_no_default: lambda_param ',' | lambda_param &':' +static arg_ty +lambda_param_no_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + arg_ty _res = NULL; int _mark = p->mark; - { // 'in' bitwise_or + { // lambda_param ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); - Token * _keyword; - expr_ty a; + D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); + Token * _literal; + arg_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 518)) // token='in' + (a = lambda_param_rule(p)) // lambda_param && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , In , a ); + D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8717,8 +8708,34 @@ in_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); + } + { // lambda_param &':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); + arg_ty a; + if ( + (a = lambda_param_rule(p)) // lambda_param + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + ) + { + D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); } _res = NULL; done: @@ -8726,36 +8743,36 @@ in_bitwise_or_rule(Parser *p) return _res; } -// isnot_bitwise_or: 'is' 'not' bitwise_or -static CmpopExprPair* -isnot_bitwise_or_rule(Parser *p) +// lambda_param_with_default: lambda_param default ',' | lambda_param default &':' +static NameDefaultPair* +lambda_param_with_default_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - CmpopExprPair* _res = NULL; + NameDefaultPair* _res = NULL; int _mark = p->mark; - { // 'is' 'not' bitwise_or + { // lambda_param default ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); - Token * _keyword; - Token * _keyword_1; - expr_ty a; + D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); + Token * _literal; + arg_ty a; + expr_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 526)) // token='is' + (a = lambda_param_rule(p)) // lambda_param && - (_keyword_1 = _PyPegen_expect_token(p, 525)) // token='not' + (c = default_rule(p)) // default && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); + D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); + _res = _PyPegen_name_default_pair ( p , a , c , NULL ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8764,42 +8781,27 @@ isnot_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// is_bitwise_or: 'is' bitwise_or -static CmpopExprPair* -is_bitwise_or_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); } - CmpopExprPair* _res = NULL; - int _mark = p->mark; - { // 'is' bitwise_or + { // lambda_param default &':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); - Token * _keyword; - expr_ty a; + D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); + arg_ty a; + expr_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 526)) // token='is' + (a = lambda_param_rule(p)) // lambda_param && - (a = bitwise_or_rule(p)) // bitwise_or + (c = default_rule(p)) // default + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' ) { - D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); - _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); + D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); + _res = _PyPegen_name_default_pair ( p , a , c , NULL ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8808,8 +8810,8 @@ is_bitwise_or_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); + D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); } _res = NULL; done: @@ -8817,46 +8819,92 @@ is_bitwise_or_rule(Parser *p) return _res; } -// Left-recursive -// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor -static expr_ty bitwise_or_raw(Parser *); -static expr_ty -bitwise_or_rule(Parser *p) +// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' +static NameDefaultPair* +lambda_param_maybe_default_rule(Parser *p) { D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; } + NameDefaultPair* _res = NULL; int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); - if (tmpvar_1) { + { // lambda_param default? ',' + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; + } + D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); + Token * _literal; + arg_ty a; + void *c; + if ( + (a = lambda_param_rule(p)) // lambda_param + && + (c = default_rule(p), 1) // default? + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); + _res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; } p->mark = _mark; - void *_raw = bitwise_or_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; + D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); } - p->mark = _resmark; + { // lambda_param default? &':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); + arg_ty a; + void *c; + if ( + (a = lambda_param_rule(p)) // lambda_param + && + (c = default_rule(p), 1) // default? + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + ) + { + D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); + _res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); + } + _res = NULL; + done: D(p->level--); return _res; } -static expr_ty -bitwise_or_raw(Parser *p) + +// lambda_param: NAME +static arg_ty +lambda_param_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + arg_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -8867,24 +8915,18 @@ bitwise_or_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // bitwise_or '|' bitwise_xor + { // NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); - Token * _literal; + D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); expr_ty a; - expr_ty b; if ( - (a = bitwise_or_rule(p)) // bitwise_or - && - (_literal = _PyPegen_expect_token(p, 18)) // token='|' - && - (b = bitwise_xor_rule(p)) // bitwise_xor + (a = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); + D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -8894,7 +8936,7 @@ bitwise_or_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , BitOr , b , EXTRA ); + _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -8903,27 +8945,8 @@ bitwise_or_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); - } - { // bitwise_xor - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); - expr_ty bitwise_xor_var; - if ( - (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor - ) - { - D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); - _res = bitwise_xor_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); + D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); } _res = NULL; done: @@ -8931,39 +8954,9 @@ bitwise_or_raw(Parser *p) return _res; } -// Left-recursive -// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and -static expr_ty bitwise_xor_raw(Parser *); -static expr_ty -bitwise_xor_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); - if (tmpvar_2) { - D(p->level--); - return _res; - } - p->mark = _mark; - void *_raw = bitwise_xor_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} +// disjunction: conjunction (('or' conjunction))+ | conjunction static expr_ty -bitwise_xor_raw(Parser *p) +disjunction_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -8971,6 +8964,10 @@ bitwise_xor_raw(Parser *p) return NULL; } expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -8981,24 +8978,21 @@ bitwise_xor_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // bitwise_xor '^' bitwise_and + { // conjunction (('or' conjunction))+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); - Token * _literal; + D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); expr_ty a; - expr_ty b; + asdl_seq * b; if ( - (a = bitwise_xor_rule(p)) // bitwise_xor - && - (_literal = _PyPegen_expect_token(p, 32)) // token='^' + (a = conjunction_rule(p)) // conjunction && - (b = bitwise_and_rule(p)) // bitwise_and + (b = _loop1_114_rule(p)) // (('or' conjunction))+ ) { - D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); + D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -9008,7 +9002,7 @@ bitwise_xor_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , BitXor , b , EXTRA ); + _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -9017,67 +9011,38 @@ bitwise_xor_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); + D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); } - { // bitwise_and + { // conjunction if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); - expr_ty bitwise_and_var; + D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); + expr_ty conjunction_var; if ( - (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and + (conjunction_var = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); - _res = bitwise_and_var; + D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); + _res = conjunction_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); + D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, disjunction_type, _res); D(p->level--); return _res; } -// Left-recursive -// bitwise_and: bitwise_and '&' shift_expr | shift_expr -static expr_ty bitwise_and_raw(Parser *); -static expr_ty -bitwise_and_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); - if (tmpvar_3) { - D(p->level--); - return _res; - } - p->mark = _mark; - void *_raw = bitwise_and_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} +// conjunction: inversion (('and' inversion))+ | inversion static expr_ty -bitwise_and_raw(Parser *p) +conjunction_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -9085,6 +9050,10 @@ bitwise_and_raw(Parser *p) return NULL; } expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -9095,24 +9064,21 @@ bitwise_and_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // bitwise_and '&' shift_expr + { // inversion (('and' inversion))+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); - Token * _literal; + D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); expr_ty a; - expr_ty b; + asdl_seq * b; if ( - (a = bitwise_and_rule(p)) // bitwise_and - && - (_literal = _PyPegen_expect_token(p, 19)) // token='&' + (a = inversion_rule(p)) // inversion && - (b = shift_expr_rule(p)) // shift_expr + (b = _loop1_115_rule(p)) // (('and' inversion))+ ) { - D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); + D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -9122,7 +9088,7 @@ bitwise_and_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); + _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -9131,67 +9097,38 @@ bitwise_and_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); + D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); } - { // shift_expr + { // inversion if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); - expr_ty shift_expr_var; + D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); + expr_ty inversion_var; if ( - (shift_expr_var = shift_expr_rule(p)) // shift_expr + (inversion_var = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); - _res = shift_expr_var; + D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); + _res = inversion_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); + D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, conjunction_type, _res); D(p->level--); return _res; } -// Left-recursive -// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum -static expr_ty shift_expr_raw(Parser *); -static expr_ty -shift_expr_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); - if (tmpvar_4) { - D(p->level--); - return _res; - } - p->mark = _mark; - void *_raw = shift_expr_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} +// inversion: 'not' inversion | comparison static expr_ty -shift_expr_raw(Parser *p) +inversion_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -9199,6 +9136,10 @@ shift_expr_raw(Parser *p) return NULL; } expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, inversion_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -9209,63 +9150,21 @@ shift_expr_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // shift_expr '<<' sum - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); - Token * _literal; - expr_ty a; - expr_ty b; - if ( - (a = shift_expr_rule(p)) // shift_expr - && - (_literal = _PyPegen_expect_token(p, 33)) // token='<<' - && - (b = sum_rule(p)) // sum - ) - { - D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , LShift , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); - } - { // shift_expr '>>' sum + { // 'not' inversion if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); - Token * _literal; + D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); + Token * _keyword; expr_ty a; - expr_ty b; if ( - (a = shift_expr_rule(p)) // shift_expr + (_keyword = _PyPegen_expect_token(p, 528)) // token='not' && - (_literal = _PyPegen_expect_token(p, 34)) // token='>>' - && - (b = sum_rule(p)) // sum + (a = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); + D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -9275,7 +9174,7 @@ shift_expr_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , RShift , b , EXTRA ); + _res = _Py_UnaryOp ( Not , a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -9284,67 +9183,38 @@ shift_expr_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); + D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); } - { // sum + { // comparison if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); - expr_ty sum_var; + D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); + expr_ty comparison_var; if ( - (sum_var = sum_rule(p)) // sum + (comparison_var = comparison_rule(p)) // comparison ) { - D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); - _res = sum_var; + D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); + _res = comparison_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); + D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, inversion_type, _res); D(p->level--); return _res; } -// Left-recursive -// sum: sum '+' term | sum '-' term | term -static expr_ty sum_raw(Parser *); -static expr_ty -sum_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, sum_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res); - if (tmpvar_5) { - D(p->level--); - return _res; - } - p->mark = _mark; - void *_raw = sum_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} +// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or static expr_ty -sum_raw(Parser *p) +comparison_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -9362,63 +9232,21 @@ sum_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // sum '+' term - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); - Token * _literal; - expr_ty a; - expr_ty b; - if ( - (a = sum_rule(p)) // sum - && - (_literal = _PyPegen_expect_token(p, 14)) // token='+' - && - (b = term_rule(p)) // term - ) - { - D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Add , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); - } - { // sum '-' term + { // bitwise_or compare_op_bitwise_or_pair+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); - Token * _literal; + D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); expr_ty a; - expr_ty b; + asdl_seq * b; if ( - (a = sum_rule(p)) // sum - && - (_literal = _PyPegen_expect_token(p, 15)) // token='-' + (a = bitwise_or_rule(p)) // bitwise_or && - (b = term_rule(p)) // term + (b = _loop1_116_rule(p)) // compare_op_bitwise_or_pair+ ) { - D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); + D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -9428,7 +9256,7 @@ sum_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Sub , b , EXTRA ); + _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -9437,27 +9265,27 @@ sum_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); + D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); } - { // term + { // bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); - expr_ty term_var; + D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); + expr_ty bitwise_or_var; if ( - (term_var = term_rule(p)) // term + (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); - _res = term_var; + D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); + _res = bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); + D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); } _res = NULL; done: @@ -9465,488 +9293,250 @@ sum_raw(Parser *p) return _res; } -// Left-recursive -// term: -// | term '*' factor -// | term '/' factor -// | term '//' factor -// | term '%' factor -// | term '@' factor -// | factor -static expr_ty term_raw(Parser *); -static expr_ty -term_rule(Parser *p) +// compare_op_bitwise_or_pair: +// | eq_bitwise_or +// | noteq_bitwise_or +// | lte_bitwise_or +// | lt_bitwise_or +// | gte_bitwise_or +// | gt_bitwise_or +// | notin_bitwise_or +// | in_bitwise_or +// | isnot_bitwise_or +// | is_bitwise_or +static CmpopExprPair* +compare_op_bitwise_or_pair_rule(Parser *p) { D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, term_type, &_res)) { + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; } + CmpopExprPair* _res = NULL; int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res); - if (tmpvar_6) { + { // eq_bitwise_or + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; + } + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); + CmpopExprPair* eq_bitwise_or_var; + if ( + (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or + ) + { + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); + _res = eq_bitwise_or_var; + goto done; } p->mark = _mark; - void *_raw = term_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} -static expr_ty -term_raw(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // term '*' factor + { // noteq_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); - Token * _literal; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); + CmpopExprPair* noteq_bitwise_or_var; if ( - (a = term_rule(p)) // term - && - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (b = factor_rule(p)) // factor + (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Mult , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); + _res = noteq_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); } - { // term '/' factor + { // lte_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); - Token * _literal; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); + CmpopExprPair* lte_bitwise_or_var; if ( - (a = term_rule(p)) // term - && - (_literal = _PyPegen_expect_token(p, 17)) // token='/' - && - (b = factor_rule(p)) // factor + (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Div , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); + _res = lte_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); } - { // term '//' factor + { // lt_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); - Token * _literal; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); + CmpopExprPair* lt_bitwise_or_var; if ( - (a = term_rule(p)) // term - && - (_literal = _PyPegen_expect_token(p, 47)) // token='//' - && - (b = factor_rule(p)) // factor + (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); + _res = lt_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); } - { // term '%' factor + { // gte_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); - Token * _literal; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); + CmpopExprPair* gte_bitwise_or_var; if ( - (a = term_rule(p)) // term - && - (_literal = _PyPegen_expect_token(p, 24)) // token='%' - && - (b = factor_rule(p)) // factor + (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Mod , b , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); + _res = gte_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); } - { // term '@' factor + { // gt_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); - Token * _literal; - expr_ty a; - expr_ty b; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); + CmpopExprPair* gt_bitwise_or_var; if ( - (a = term_rule(p)) // term - && - (_literal = _PyPegen_expect_token(p, 49)) // token='@' - && - (b = factor_rule(p)) // factor + (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); + _res = gt_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); } - { // factor + { // notin_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); - expr_ty factor_var; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); + CmpopExprPair* notin_bitwise_or_var; if ( - (factor_var = factor_rule(p)) // factor + (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or ) { - D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); - _res = factor_var; + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); + _res = notin_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// factor: '+' factor | '-' factor | '~' factor | power -static expr_ty -factor_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, factor_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '+' factor - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); - Token * _literal; - expr_ty a; - if ( - (_literal = _PyPegen_expect_token(p, 14)) // token='+' - && - (a = factor_rule(p)) // factor - ) - { - D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( UAdd , a , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); - } - { // '-' factor + { // in_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); + CmpopExprPair* in_bitwise_or_var; if ( - (_literal = _PyPegen_expect_token(p, 15)) // token='-' - && - (a = factor_rule(p)) // factor + (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or ) { - D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( USub , a , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); + _res = in_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); } - { // '~' factor + { // isnot_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); + CmpopExprPair* isnot_bitwise_or_var; if ( - (_literal = _PyPegen_expect_token(p, 31)) // token='~' - && - (a = factor_rule(p)) // factor + (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or ) { - D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( Invert , a , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); + _res = isnot_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); } - { // power + { // is_bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); - expr_ty power_var; + D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); + CmpopExprPair* is_bitwise_or_var; if ( - (power_var = power_rule(p)) // power + (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or ) { - D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); - _res = power_var; + D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); + _res = is_bitwise_or_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); + D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, factor_type, _res); D(p->level--); return _res; } -// power: await_primary '**' factor | await_primary -static expr_ty -power_rule(Parser *p) +// eq_bitwise_or: '==' bitwise_or +static CmpopExprPair* +eq_bitwise_or_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + CmpopExprPair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // await_primary '**' factor + { // '==' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); + D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); Token * _literal; expr_ty a; - expr_ty b; if ( - (a = await_primary_rule(p)) // await_primary - && - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (_literal = _PyPegen_expect_token(p, 27)) // token='==' && - (b = factor_rule(p)) // factor + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BinOp ( a , Pow , b , EXTRA ); + D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -9955,27 +9545,52 @@ power_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); + D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); } - { // await_primary + _res = NULL; + done: + D(p->level--); + return _res; +} + +// noteq_bitwise_or: ('!=') bitwise_or +static CmpopExprPair* +noteq_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // ('!=') bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); - expr_ty await_primary_var; + D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); + void *_tmp_117_var; + expr_ty a; if ( - (await_primary_var = await_primary_rule(p)) // await_primary + (_tmp_117_var = _tmp_117_rule(p)) // '!=' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); - _res = await_primary_var; + D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); + D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); } _res = NULL; done: @@ -9983,55 +9598,33 @@ power_rule(Parser *p) return _res; } -// await_primary: AWAIT primary | primary -static expr_ty -await_primary_rule(Parser *p) +// lte_bitwise_or: '<=' bitwise_or +static CmpopExprPair* +lte_bitwise_or_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { - D(p->level--); - return _res; - } + CmpopExprPair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // AWAIT primary + { // '<=' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); + D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); + Token * _literal; expr_ty a; - Token * await_var; if ( - (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' + (_literal = _PyPegen_expect_token(p, 29)) // token='<=' && - (a = primary_rule(p)) // primary + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) ); + D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10040,118 +9633,130 @@ await_primary_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); + D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); } - { // primary + _res = NULL; + done: + D(p->level--); + return _res; +} + +// lt_bitwise_or: '<' bitwise_or +static CmpopExprPair* +lt_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // '<' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); - expr_ty primary_var; + D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); + Token * _literal; + expr_ty a; if ( - (primary_var = primary_rule(p)) // primary + (_literal = _PyPegen_expect_token(p, 20)) // token='<' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); - _res = primary_var; + D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); + D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, await_primary_type, _res); D(p->level--); return _res; } -// Left-recursive -// primary: -// | primary '.' NAME -// | primary genexp -// | primary '(' arguments? ')' -// | primary '[' slices ']' -// | atom -static expr_ty primary_raw(Parser *); -static expr_ty -primary_rule(Parser *p) +// gte_bitwise_or: '>=' bitwise_or +static CmpopExprPair* +gte_bitwise_or_rule(Parser *p) { D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, primary_type, &_res)) { + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; } + CmpopExprPair* _res = NULL; int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res); - if (tmpvar_7) { + { // '>=' bitwise_or + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; + } + D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); + Token * _literal; + expr_ty a; + if ( + (_literal = _PyPegen_expect_token(p, 30)) // token='>=' + && + (a = bitwise_or_rule(p)) // bitwise_or + ) + { + D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; } p->mark = _mark; - void *_raw = primary_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; + D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); } - p->mark = _resmark; + _res = NULL; + done: D(p->level--); return _res; } -static expr_ty -primary_raw(Parser *p) + +// gt_bitwise_or: '>' bitwise_or +static CmpopExprPair* +gt_bitwise_or_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + CmpopExprPair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // primary '.' NAME + { // '>' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); + D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); Token * _literal; expr_ty a; - expr_ty b; if ( - (a = primary_rule(p)) // primary - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_literal = _PyPegen_expect_token(p, 21)) // token='>' && - (b = _PyPegen_name_token(p)) // NAME + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); + D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10160,34 +9765,45 @@ primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); + D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); } - { // primary genexp + _res = NULL; + done: + D(p->level--); + return _res; +} + +// notin_bitwise_or: 'not' 'in' bitwise_or +static CmpopExprPair* +notin_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // 'not' 'in' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); + D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); + Token * _keyword; + Token * _keyword_1; expr_ty a; - expr_ty b; if ( - (a = primary_rule(p)) // primary + (_keyword = _PyPegen_expect_token(p, 528)) // token='not' && - (b = genexp_rule(p)) // genexp + (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); + D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10196,40 +9812,42 @@ primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); + D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); } - { // primary '(' arguments? ')' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// in_bitwise_or: 'in' bitwise_or +static CmpopExprPair* +in_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // 'in' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); + Token * _keyword; expr_ty a; - void *b; if ( - (a = primary_rule(p)) // primary - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (b = arguments_rule(p), 1) // arguments? + (_keyword = _PyPegen_expect_token(p, 518)) // token='in' && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , In , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10238,40 +9856,45 @@ primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); + D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); } - { // primary '[' slices ']' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); - Token * _literal; - Token * _literal_1; + _res = NULL; + done: + D(p->level--); + return _res; +} + +// isnot_bitwise_or: 'is' 'not' bitwise_or +static CmpopExprPair* +isnot_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // 'is' 'not' bitwise_or + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); + Token * _keyword; + Token * _keyword_1; expr_ty a; - expr_ty b; if ( - (a = primary_rule(p)) // primary - && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (_keyword = _PyPegen_expect_token(p, 529)) // token='is' && - (b = slices_rule(p)) // slices + (_keyword_1 = _PyPegen_expect_token(p, 528)) // token='not' && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Load , EXTRA ); + D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10280,27 +9903,52 @@ primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); + D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); } - { // atom + _res = NULL; + done: + D(p->level--); + return _res; +} + +// is_bitwise_or: 'is' bitwise_or +static CmpopExprPair* +is_bitwise_or_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + CmpopExprPair* _res = NULL; + int _mark = p->mark; + { // 'is' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); - expr_ty atom_var; + D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); + Token * _keyword; + expr_ty a; if ( - (atom_var = atom_rule(p)) // atom + (_keyword = _PyPegen_expect_token(p, 529)) // token='is' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); - _res = atom_var; + D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); + _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); + D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); } _res = NULL; done: @@ -10308,9 +9956,39 @@ primary_raw(Parser *p) return _res; } -// slices: slice !',' | ','.slice+ ','? +// Left-recursive +// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor +static expr_ty bitwise_or_raw(Parser *); static expr_ty -slices_rule(Parser *p) +bitwise_or_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); + if (tmpvar_1) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = bitwise_or_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +bitwise_or_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -10328,21 +10006,34 @@ slices_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // slice !',' + { // bitwise_or '|' bitwise_xor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); + D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); + Token * _literal; expr_ty a; + expr_ty b; if ( - (a = slice_rule(p)) // slice + (a = bitwise_or_rule(p)) // bitwise_or && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' + (_literal = _PyPegen_expect_token(p, 18)) // token='|' + && + (b = bitwise_xor_rule(p)) // bitwise_xor ) { - D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); - _res = a; + D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BinOp ( a , BitOr , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10351,45 +10042,27 @@ slices_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); + D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); } - { // ','.slice+ ','? + { // bitwise_xor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * a; + D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); + expr_ty bitwise_xor_var; if ( - (a = _gather_93_rule(p)) // ','.slice+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor ) { - D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( a , Load , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); + _res = bitwise_xor_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); + D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); } _res = NULL; done: @@ -10397,9 +10070,39 @@ slices_rule(Parser *p) return _res; } -// slice: expression? ':' expression? [':' expression?] | expression +// Left-recursive +// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and +static expr_ty bitwise_xor_raw(Parser *); static expr_ty -slice_rule(Parser *p) +bitwise_xor_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); + if (tmpvar_2) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = bitwise_xor_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +bitwise_xor_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -10417,27 +10120,24 @@ slice_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // expression? ':' expression? [':' expression?] + { // bitwise_xor '^' bitwise_and if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); + D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); Token * _literal; - void *a; - void *b; - void *c; + expr_ty a; + expr_ty b; if ( - (a = expression_rule(p), 1) // expression? - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (a = bitwise_xor_rule(p)) // bitwise_xor && - (b = expression_rule(p), 1) // expression? + (_literal = _PyPegen_expect_token(p, 32)) // token='^' && - (c = _tmp_95_rule(p), 1) // [':' expression?] + (b = bitwise_and_rule(p)) // bitwise_and ) { - D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); + D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -10447,7 +10147,7 @@ slice_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Slice ( a , b , c , EXTRA ); + _res = _Py_BinOp ( a , BitXor , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10456,32 +10156,27 @@ slice_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); + D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); } - { // expression + { // bitwise_and if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); - expr_ty a; + D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); + expr_ty bitwise_and_var; if ( - (a = expression_rule(p)) // expression + (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and ) { - D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); + _res = bitwise_and_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); + D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); } _res = NULL; done: @@ -10489,20 +10184,39 @@ slice_rule(Parser *p) return _res; } -// atom: -// | NAME -// | 'True' -// | 'False' -// | 'None' -// | '__new_parser__' -// | &STRING strings -// | NUMBER -// | &'(' (tuple | group | genexp) -// | &'[' (list | listcomp) -// | &'{' (dict | set | dictcomp | setcomp) -// | '...' +// Left-recursive +// bitwise_and: bitwise_and '&' shift_expr | shift_expr +static expr_ty bitwise_and_raw(Parser *); static expr_ty -atom_rule(Parser *p) +bitwise_and_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); + if (tmpvar_3) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = bitwise_and_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +bitwise_and_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -10520,37 +10234,24 @@ atom_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); - expr_ty name_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = name_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); - } - { // 'True' + { // bitwise_and '&' shift_expr if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); - Token * _keyword; + D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); + Token * _literal; + expr_ty a; + expr_ty b; if ( - (_keyword = _PyPegen_expect_token(p, 527)) // token='True' + (a = bitwise_and_rule(p)) // bitwise_and + && + (_literal = _PyPegen_expect_token(p, 19)) // token='&' + && + (b = shift_expr_rule(p)) // shift_expr ) { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -10560,7 +10261,7 @@ atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Constant ( Py_True , NULL , EXTRA ); + _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10569,54 +10270,102 @@ atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); } - { // 'False' + { // shift_expr if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); - Token * _keyword; + D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); + expr_ty shift_expr_var; if ( - (_keyword = _PyPegen_expect_token(p, 528)) // token='False' + (shift_expr_var = shift_expr_rule(p)) // shift_expr ) { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Constant ( Py_False , NULL , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); + _res = shift_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); } - { // 'None' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// Left-recursive +// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum +static expr_ty shift_expr_raw(Parser *); +static expr_ty +shift_expr_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); + if (tmpvar_4) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = shift_expr_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +shift_expr_raw(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // shift_expr '<<' sum if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); - Token * _keyword; + D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); + Token * _literal; + expr_ty a; + expr_ty b; if ( - (_keyword = _PyPegen_expect_token(p, 529)) // token='None' + (a = shift_expr_rule(p)) // shift_expr + && + (_literal = _PyPegen_expect_token(p, 33)) // token='<<' + && + (b = sum_rule(p)) // sum ) { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -10626,7 +10375,7 @@ atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Constant ( Py_None , NULL , EXTRA ); + _res = _Py_BinOp ( a , LShift , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10635,22 +10384,37 @@ atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); } - { // '__new_parser__' + { // shift_expr '>>' sum if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); - Token * _keyword; + D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); + Token * _literal; + expr_ty a; + expr_ty b; if ( - (_keyword = _PyPegen_expect_token(p, 530)) // token='__new_parser__' + (a = shift_expr_rule(p)) // shift_expr + && + (_literal = _PyPegen_expect_token(p, 34)) // token='>>' + && + (b = sum_rule(p)) // sum ) { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); - _res = RAISE_SYNTAX_ERROR ( "You found it!" ); + D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BinOp ( a , RShift , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10659,144 +10423,27 @@ atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'__new_parser__'")); + D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); } - { // &STRING strings + { // sum if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings")); - expr_ty strings_var; + D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); + expr_ty sum_var; if ( - _PyPegen_lookahead(1, _PyPegen_string_token, p) - && - (strings_var = strings_rule(p)) // strings + (sum_var = sum_rule(p)) // sum ) { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings")); - _res = strings_var; + D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); + _res = sum_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); - } - { // NUMBER - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); - expr_ty number_var; - if ( - (number_var = _PyPegen_number_token(p)) // NUMBER - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); - _res = number_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); - } - { // &'(' (tuple | group | genexp) - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_96_var; - if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' - && - (_tmp_96_var = _tmp_96_rule(p)) // tuple | group | genexp - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_96_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); - } - { // &'[' (list | listcomp) - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_97_var; - if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' - && - (_tmp_97_var = _tmp_97_rule(p)) // list | listcomp - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_97_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); - } - { // &'{' (dict | set | dictcomp | setcomp) - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_98_var; - if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' - && - (_tmp_98_var = _tmp_98_rule(p)) // dict | set | dictcomp | setcomp - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_98_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - } - { // '...' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 52)) // token='...' - ) - { - D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); } _res = NULL; done: @@ -10804,55 +10451,39 @@ atom_rule(Parser *p) return _res; } -// strings: STRING+ +// Left-recursive +// sum: sum '+' term | sum '-' term | term +static expr_ty sum_raw(Parser *); static expr_ty -strings_rule(Parser *p) +sum_rule(Parser *p) { D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, strings_type, &_res)) { + if (_PyPegen_is_memoized(p, sum_type, &_res)) { D(p->level--); return _res; } int _mark = p->mark; - { // STRING+ - if (p->error_indicator) { + int _resmark = p->mark; + while (1) { + int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res); + if (tmpvar_5) { D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); - asdl_seq * a; - if ( - (a = _loop1_99_rule(p)) // STRING+ - ) - { - D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); - _res = _PyPegen_concatenate_strings ( p , a ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; + return _res; } p->mark = _mark; - D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); + void *_raw = sum_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; } - _res = NULL; - done: - _PyPegen_insert_memo(p, _mark, strings_type, _res); + p->mark = _resmark; D(p->level--); return _res; } - -// list: '[' star_named_expressions? ']' static expr_ty -list_rule(Parser *p) +sum_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -10870,24 +10501,24 @@ list_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '[' star_named_expressions? ']' + { // sum '+' term if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); + D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); Token * _literal; - Token * _literal_1; - void *a; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (a = sum_rule(p)) // sum && - (a = star_named_expressions_rule(p), 1) // star_named_expressions? + (_literal = _PyPegen_expect_token(p, 14)) // token='+' && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (b = term_rule(p)) // term ) { - D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); + D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -10897,7 +10528,7 @@ list_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( a , Load , EXTRA ); + _res = _Py_BinOp ( a , Add , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10906,56 +10537,27 @@ list_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension -static expr_ty -listcomp_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '[' named_expression for_if_clauses ']' + { // sum '-' term if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); + D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); Token * _literal; - Token * _literal_1; expr_ty a; - asdl_seq* b; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (a = named_expression_rule(p)) // named_expression + (a = sum_rule(p)) // sum && - (b = for_if_clauses_rule(p)) // for_if_clauses + (_literal = _PyPegen_expect_token(p, 15)) // token='-' && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (b = term_rule(p)) // term ) { - D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); + D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -10965,7 +10567,7 @@ listcomp_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_ListComp ( a , b , EXTRA ); + _res = _Py_BinOp ( a , Sub , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -10974,27 +10576,27 @@ listcomp_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); + D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); } - { // invalid_comprehension + { // term if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - void *invalid_comprehension_var; + D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); + expr_ty term_var; if ( - (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension + (term_var = term_rule(p)) // term ) { - D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - _res = invalid_comprehension_var; + D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); + _res = term_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); + D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); } _res = NULL; done: @@ -11002,18 +10604,54 @@ listcomp_rule(Parser *p) return _res; } -// tuple: '(' [star_named_expression ',' star_named_expressions?] ')' +// Left-recursive +// term: +// | term '*' factor +// | term '/' factor +// | term '//' factor +// | term '%' factor +// | term '@' factor +// | factor +static expr_ty term_raw(Parser *); static expr_ty -tuple_rule(Parser *p) +term_rule(Parser *p) { D(p->level++); - if (p->error_indicator) { + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, term_type, &_res)) { D(p->level--); - return NULL; + return _res; } - expr_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + int _resmark = p->mark; + while (1) { + int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res); + if (tmpvar_6) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = term_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +term_raw(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; D(p->level--); return NULL; @@ -11022,24 +10660,24 @@ tuple_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '(' [star_named_expression ',' star_named_expressions?] ')' + { // term '*' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); Token * _literal; - Token * _literal_1; - void *a; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (a = term_rule(p)) // term && - (a = _tmp_100_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11049,7 +10687,7 @@ tuple_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( a , Load , EXTRA ); + _res = _Py_BinOp ( a , Mult , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11058,45 +10696,37 @@ tuple_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// group: '(' (yield_expr | named_expression) ')' -static expr_ty -group_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); } - expr_ty _res = NULL; - int _mark = p->mark; - { // '(' (yield_expr | named_expression) ')' + { // term '/' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); Token * _literal; - Token * _literal_1; - void *a; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (a = term_rule(p)) // term && - (a = _tmp_101_rule(p)) // yield_expr | named_expression + (_literal = _PyPegen_expect_token(p, 17)) // token='/' && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); - _res = a; + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BinOp ( a , Div , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11105,56 +10735,27 @@ group_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// genexp: '(' expression for_if_clauses ')' | invalid_comprehension -static expr_ty -genexp_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '(' expression for_if_clauses ')' + { // term '//' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); Token * _literal; - Token * _literal_1; expr_ty a; - asdl_seq* b; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (a = expression_rule(p)) // expression + (a = term_rule(p)) // term && - (b = for_if_clauses_rule(p)) // for_if_clauses + (_literal = _PyPegen_expect_token(p, 47)) // token='//' && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11164,7 +10765,7 @@ genexp_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_GeneratorExp ( a , b , EXTRA ); + _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11173,72 +10774,66 @@ genexp_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression for_if_clauses ')'")); + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); } - { // invalid_comprehension + { // term '%' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - void *invalid_comprehension_var; + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); + Token * _literal; + expr_ty a; + expr_ty b; if ( - (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension + (a = term_rule(p)) // term + && + (_literal = _PyPegen_expect_token(p, 24)) // token='%' + && + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - _res = invalid_comprehension_var; + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BinOp ( a , Mod , b , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// set: '{' expressions_list '}' -static expr_ty -set_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' expressions_list '}' + { // term '@' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); Token * _literal; - Token * _literal_1; - asdl_seq* a; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + (a = term_rule(p)) // term && - (a = expressions_list_rule(p)) // expressions_list + (_literal = _PyPegen_expect_token(p, 49)) // token='@' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11248,7 +10843,7 @@ set_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Set ( a , EXTRA ); + _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11257,8 +10852,27 @@ set_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'")); + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); + } + { // factor + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); + expr_ty factor_var; + if ( + (factor_var = factor_rule(p)) // factor + ) + { + D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); + _res = factor_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); } _res = NULL; done: @@ -11266,9 +10880,9 @@ set_rule(Parser *p) return _res; } -// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension +// factor: '+' factor | '-' factor | '~' factor | power static expr_ty -setcomp_rule(Parser *p) +factor_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -11276,9 +10890,13 @@ setcomp_rule(Parser *p) return NULL; } expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; + if (_PyPegen_is_memoized(p, factor_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; D(p->level--); return NULL; } @@ -11286,27 +10904,93 @@ setcomp_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' expression for_if_clauses '}' + { // '+' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); + D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); Token * _literal; - Token * _literal_1; expr_ty a; - asdl_seq* b; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + (_literal = _PyPegen_expect_token(p, 14)) // token='+' && - (a = expression_rule(p)) // expression + (a = factor_rule(p)) // factor + ) + { + D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_UnaryOp ( UAdd , a , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); + } + { // '-' factor + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); + Token * _literal; + expr_ty a; + if ( + (_literal = _PyPegen_expect_token(p, 15)) // token='-' && - (b = for_if_clauses_rule(p)) // for_if_clauses + (a = factor_rule(p)) // factor + ) + { + D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_UnaryOp ( USub , a , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); + } + { // '~' factor + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); + Token * _literal; + expr_ty a; + if ( + (_literal = _PyPegen_expect_token(p, 31)) // token='~' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (a = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); + D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11316,7 +11000,7 @@ setcomp_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_SetComp ( a , b , EXTRA ); + _res = _Py_UnaryOp ( Invert , a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11325,37 +11009,38 @@ setcomp_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression for_if_clauses '}'")); + D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); } - { // invalid_comprehension + { // power if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - void *invalid_comprehension_var; + D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); + expr_ty power_var; if ( - (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension + (power_var = power_rule(p)) // power ) { - D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); - _res = invalid_comprehension_var; + D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); + _res = power_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); + D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, factor_type, _res); D(p->level--); return _res; } -// dict: '{' double_starred_kvpairs? '}' +// power: await_primary '**' factor | await_primary static expr_ty -dict_rule(Parser *p) +power_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -11373,24 +11058,24 @@ dict_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' double_starred_kvpairs? '}' + { // await_primary '**' factor if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); + D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); Token * _literal; - Token * _literal_1; - void *a; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + (a = await_primary_rule(p)) // await_primary && - (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? + (_literal = _PyPegen_expect_token(p, 35)) // token='**' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (b = factor_rule(p)) // factor ) { - D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); + D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11400,7 +11085,7 @@ dict_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA ); + _res = _Py_BinOp ( a , Pow , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11409,8 +11094,27 @@ dict_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); + D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); + } + { // await_primary + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); + expr_ty await_primary_var; + if ( + (await_primary_var = await_primary_rule(p)) // await_primary + ) + { + D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); + _res = await_primary_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); } _res = NULL; done: @@ -11418,9 +11122,9 @@ dict_rule(Parser *p) return _res; } -// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension +// await_primary: AWAIT primary | primary static expr_ty -dictcomp_rule(Parser *p) +await_primary_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -11428,6 +11132,10 @@ dictcomp_rule(Parser *p) return NULL; } expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -11438,27 +11146,21 @@ dictcomp_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' kvpair for_if_clauses '}' + { // AWAIT primary if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); - Token * _literal; - Token * _literal_1; - KeyValuePair* a; - asdl_seq* b; + D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); + expr_ty a; + Token * await_var; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' - && - (a = kvpair_rule(p)) // kvpair - && - (b = for_if_clauses_rule(p)) // for_if_clauses + (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (a = primary_rule(p)) // primary ) { - D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); + D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11468,7 +11170,7 @@ dictcomp_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); + _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11477,106 +11179,118 @@ dictcomp_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); + D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); } - { // invalid_dict_comprehension + { // primary if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); - void *invalid_dict_comprehension_var; + D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); + expr_ty primary_var; if ( - (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension + (primary_var = primary_rule(p)) // primary ) { - D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); - _res = invalid_dict_comprehension_var; + D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); + _res = primary_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); + D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, await_primary_type, _res); D(p->level--); return _res; } -// double_starred_kvpairs: ','.double_starred_kvpair+ ','? -static asdl_seq* -double_starred_kvpairs_rule(Parser *p) +// Left-recursive +// primary: +// | primary '.' NAME +// | primary genexp +// | primary '(' arguments? ')' +// | primary '[' slices ']' +// | atom +static expr_ty primary_raw(Parser *); +static expr_ty +primary_rule(Parser *p) { D(p->level++); - if (p->error_indicator) { + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, primary_type, &_res)) { D(p->level--); - return NULL; + return _res; } - asdl_seq* _res = NULL; int _mark = p->mark; - { // ','.double_starred_kvpair+ ','? - if (p->error_indicator) { + int _resmark = p->mark; + while (1) { + int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res); + if (tmpvar_7) { D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * a; - if ( - (a = _gather_102_rule(p)) // ','.double_starred_kvpair+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? - ) - { - D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; + return _res; } p->mark = _mark; - D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); + void *_raw = primary_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; } - _res = NULL; - done: + p->mark = _resmark; D(p->level--); return _res; } - -// double_starred_kvpair: '**' bitwise_or | kvpair -static KeyValuePair* -double_starred_kvpair_rule(Parser *p) +static expr_ty +primary_raw(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - KeyValuePair* _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // '**' bitwise_or + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // primary '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); + D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); Token * _literal; expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (a = primary_rule(p)) // primary && - (a = bitwise_or_rule(p)) // bitwise_or + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (b = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); - _res = _PyPegen_key_value_pair ( p , NULL , a ); + D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11585,64 +11299,118 @@ double_starred_kvpair_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); + D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); } - { // kvpair + { // primary genexp if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); - KeyValuePair* kvpair_var; + D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); + expr_ty a; + expr_ty b; if ( - (kvpair_var = kvpair_rule(p)) // kvpair + (a = primary_rule(p)) // primary + && + (b = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); - _res = kvpair_var; + D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); + D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// kvpair: expression ':' expression -static KeyValuePair* -kvpair_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + { // primary '(' arguments? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); + Token * _literal; + Token * _literal_1; + expr_ty a; + void *b; + if ( + (a = primary_rule(p)) // primary + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (b = arguments_rule(p), 1) // arguments? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); } - KeyValuePair* _res = NULL; - int _mark = p->mark; - { // expression ':' expression + { // primary '[' slices ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); + D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); Token * _literal; + Token * _literal_1; expr_ty a; expr_ty b; if ( - (a = expression_rule(p)) // expression + (a = primary_rule(p)) // primary && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (b = expression_rule(p)) // expression + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); - _res = _PyPegen_key_value_pair ( p , a , b ); + D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11651,44 +11419,27 @@ kvpair_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// for_if_clauses: for_if_clause+ -static asdl_seq* -for_if_clauses_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); } - asdl_seq* _res = NULL; - int _mark = p->mark; - { // for_if_clause+ + { // atom if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_104_var; + D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); + expr_ty atom_var; if ( - (_loop1_104_var = _loop1_104_rule(p)) // for_if_clause+ + (atom_var = atom_rule(p)) // atom ) { - D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_104_var; + D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); + _res = atom_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); + D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); } _res = NULL; done: @@ -11696,47 +11447,41 @@ for_if_clauses_rule(Parser *p) return _res; } -// for_if_clause: -// | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* -// | 'for' star_targets 'in' disjunction (('if' disjunction))* -static comprehension_ty -for_if_clause_rule(Parser *p) +// slices: slice !',' | ','.slice+ ','? +static expr_ty +slices_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - comprehension_ty _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // slice !',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); - Token * _keyword; - Token * _keyword_1; + D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); expr_ty a; - Token * async_var; - expr_ty b; - asdl_seq * c; if ( - (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' - && - (_keyword = _PyPegen_expect_token(p, 517)) // token='for' - && - (a = star_targets_rule(p)) // star_targets - && - (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' - && - (b = disjunction_rule(p)) // disjunction + (a = slice_rule(p)) // slice && - (c = _loop0_105_rule(p)) // (('if' disjunction))* + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' ) { - D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); - _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); + D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11745,34 +11490,35 @@ for_if_clause_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); + D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); } - { // 'for' star_targets 'in' disjunction (('if' disjunction))* + { // ','.slice+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); - Token * _keyword; - Token * _keyword_1; - expr_ty a; - expr_ty b; - asdl_seq * c; + D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; if ( - (_keyword = _PyPegen_expect_token(p, 517)) // token='for' + (a = _gather_118_rule(p)) // ','.slice+ && - (a = star_targets_rule(p)) // star_targets - && - (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' - && - (b = disjunction_rule(p)) // disjunction - && - (c = _loop0_106_rule(p)) // (('if' disjunction))* + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); - _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); + D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11781,8 +11527,8 @@ for_if_clause_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); + D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); } _res = NULL; done: @@ -11790,9 +11536,9 @@ for_if_clause_rule(Parser *p) return _res; } -// yield_expr: 'yield' 'from' expression | 'yield' star_expressions? +// slice: expression? ':' expression? [':' expression?] | expression static expr_ty -yield_expr_rule(Parser *p) +slice_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -11810,24 +11556,27 @@ yield_expr_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'yield' 'from' expression + { // expression? ':' expression? [':' expression?] if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); - Token * _keyword; - Token * _keyword_1; - expr_ty a; + D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); + Token * _literal; + void *a; + void *b; + void *c; if ( - (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' + (a = expression_rule(p), 1) // expression? && - (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && - (a = expression_rule(p)) // expression + (b = expression_rule(p), 1) // expression? + && + (c = _tmp_120_rule(p), 1) // [':' expression?] ) { - D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); + D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -11837,7 +11586,7 @@ yield_expr_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_YieldFrom ( a , EXTRA ); + _res = _Py_Slice ( a , b , c , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11846,34 +11595,22 @@ yield_expr_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); + D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); } - { // 'yield' star_expressions? + { // expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); - Token * _keyword; - void *a; + D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); + expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' - && - (a = star_expressions_rule(p), 1) // star_expressions? + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Yield ( a , EXTRA ); + D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -11882,8 +11619,8 @@ yield_expr_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); + D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); } _res = NULL; done: @@ -11891,9 +11628,20 @@ yield_expr_rule(Parser *p) return _res; } -// arguments: args ','? &')' | incorrect_arguments +// atom: +// | NAME +// | 'True' +// | 'False' +// | 'None' +// | '__new_parser__' +// | &STRING strings +// | NUMBER +// | &'(' (tuple | group | genexp) +// | &'[' (list | listcomp) +// | &'{' (dict | set | dictcomp | setcomp) +// | '...' static expr_ty -arguments_rule(Parser *p) +atom_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -11901,102 +11649,80 @@ arguments_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, arguments_type, &_res)) { + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; D(p->level--); - return _res; + return NULL; } - int _mark = p->mark; - { // args ','? &')' + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty name_var; if ( - (a = args_rule(p)) // args - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' + (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = name_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); } - { // incorrect_arguments + { // 'True' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); - void *incorrect_arguments_var; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); + Token * _keyword; if ( - (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments + (_keyword = _PyPegen_expect_token(p, 523)) // token='True' ) { - D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); - _res = incorrect_arguments_var; + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Constant ( Py_True , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments")); - } - _res = NULL; - done: - _PyPegen_insert_memo(p, _mark, arguments_type, _res); - D(p->level--); - return _res; -} - -// args: starred_expression [',' args] | kwargs | named_expression [',' args] -static expr_ty -args_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // starred_expression [',' args] + { // 'False' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); - expr_ty a; - void *b; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); + Token * _keyword; if ( - (a = starred_expression_rule(p)) // starred_expression - && - (b = _tmp_107_rule(p), 1) // [',' args] + (_keyword = _PyPegen_expect_token(p, 524)) // token='False' ) { - D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12006,7 +11732,7 @@ args_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + _res = _Py_Constant ( Py_False , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12015,21 +11741,21 @@ args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); } - { // kwargs + { // 'None' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); - asdl_seq* a; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); + Token * _keyword; if ( - (a = kwargs_rule(p)) // kwargs + (_keyword = _PyPegen_expect_token(p, 522)) // token='None' ) { - D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12039,7 +11765,7 @@ args_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA ); + _res = _Py_Constant ( Py_None , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12048,34 +11774,22 @@ args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); } - { // named_expression [',' args] + { // '__new_parser__' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); - expr_ty a; - void *b; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); + Token * _keyword; if ( - (a = named_expression_rule(p)) // named_expression - && - (b = _tmp_108_rule(p), 1) // [',' args] + (_keyword = _PyPegen_expect_token(p, 530)) // token='__new_parser__' ) { - D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'__new_parser__'")); + _res = RAISE_SYNTAX_ERROR ( "You found it!" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12084,96 +11798,144 @@ args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'__new_parser__'")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// kwargs: -// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ -// | ','.kwarg_or_starred+ -// | ','.kwarg_or_double_starred+ -static asdl_seq* -kwargs_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + { // &STRING strings + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings")); + expr_ty strings_var; + if ( + _PyPegen_lookahead(1, _PyPegen_string_token, p) + && + (strings_var = strings_rule(p)) // strings + ) + { + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings")); + _res = strings_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); } - asdl_seq* _res = NULL; - int _mark = p->mark; - { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ + { // NUMBER if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); - Token * _literal; - asdl_seq * a; - asdl_seq * b; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); + expr_ty number_var; + if ( + (number_var = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); + _res = number_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); + } + { // &'(' (tuple | group | genexp) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); + void *_tmp_121_var; if ( - (a = _gather_109_rule(p)) // ','.kwarg_or_starred+ + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_tmp_121_var = _tmp_121_rule(p)) // tuple | group | genexp + ) + { + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); + _res = _tmp_121_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); + } + { // &'[' (list | listcomp) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); + void *_tmp_122_var; + if ( + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (b = _gather_111_rule(p)) // ','.kwarg_or_double_starred+ + (_tmp_122_var = _tmp_122_rule(p)) // list | listcomp ) { - D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); - _res = _PyPegen_join_sequences ( p , a , b ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); + _res = _tmp_122_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); } - { // ','.kwarg_or_starred+ + { // &'{' (dict | set | dictcomp | setcomp) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_113_var; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); + void *_tmp_123_var; if ( - (_gather_113_var = _gather_113_rule(p)) // ','.kwarg_or_starred+ + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' + && + (_tmp_123_var = _tmp_123_rule(p)) // dict | set | dictcomp | setcomp ) { - D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_113_var; + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); + _res = _tmp_123_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); } - { // ','.kwarg_or_double_starred+ + { // '...' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_115_var; + D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + Token * _literal; if ( - (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_double_starred+ + (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_115_var; + D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); + D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; done: @@ -12181,9 +11943,55 @@ kwargs_rule(Parser *p) return _res; } -// starred_expression: '*' expression +// strings: STRING+ static expr_ty -starred_expression_rule(Parser *p) +strings_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, strings_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + { // STRING+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); + asdl_seq * a; + if ( + (a = _loop1_124_rule(p)) // STRING+ + ) + { + D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); + _res = _PyPegen_concatenate_strings ( p , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); + } + _res = NULL; + done: + _PyPegen_insert_memo(p, _mark, strings_type, _res); + D(p->level--); + return _res; +} + +// list: '[' star_named_expressions? ']' +static expr_ty +list_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -12201,21 +12009,24 @@ starred_expression_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '*' expression + { // '[' star_named_expressions? ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); + D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); Token * _literal; - expr_ty a; + Token * _literal_1; + void *a; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (a = expression_rule(p)) // expression + (a = star_named_expressions_rule(p), 1) // star_named_expressions? + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); + D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12225,7 +12036,7 @@ starred_expression_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Starred ( a , Load , EXTRA ); + _res = _Py_List ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12234,8 +12045,8 @@ starred_expression_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); + D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); } _res = NULL; done: @@ -12243,16 +12054,16 @@ starred_expression_rule(Parser *p) return _res; } -// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg -static KeywordOrStarred* -kwarg_or_starred_rule(Parser *p) +// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension +static expr_ty +listcomp_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - KeywordOrStarred* _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -12263,24 +12074,27 @@ kwarg_or_starred_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME '=' expression + { // '[' named_expression for_if_clauses ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); Token * _literal; + Token * _literal_1; expr_ty a; - expr_ty b; + asdl_seq* b; if ( - (a = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (a = named_expression_rule(p)) // named_expression && - (b = expression_rule(p)) // expression + (b = for_if_clauses_rule(p)) // for_if_clauses + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12290,7 +12104,7 @@ kwarg_or_starred_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); + _res = _Py_ListComp ( a , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12299,51 +12113,27 @@ kwarg_or_starred_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); } - { // starred_expression + { // invalid_comprehension if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); - expr_ty a; + D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + void *invalid_comprehension_var; if ( - (a = starred_expression_rule(p)) // starred_expression + (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension ) { - D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); - _res = _PyPegen_keyword_or_starred ( p , a , 0 ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + _res = invalid_comprehension_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); - } - { // invalid_kwarg - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); - void *invalid_kwarg_var; - if ( - (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg - ) - { - D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); - _res = invalid_kwarg_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); + D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); } _res = NULL; done: @@ -12351,16 +12141,16 @@ kwarg_or_starred_rule(Parser *p) return _res; } -// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg -static KeywordOrStarred* -kwarg_or_double_starred_rule(Parser *p) +// tuple: '(' [star_named_expression ',' star_named_expressions?] ')' +static expr_ty +tuple_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - KeywordOrStarred* _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -12371,24 +12161,24 @@ kwarg_or_double_starred_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME '=' expression + { // '(' [star_named_expression ',' star_named_expressions?] ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); Token * _literal; - expr_ty a; - expr_ty b; + Token * _literal_1; + void *a; if ( - (a = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (a = _tmp_125_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && - (b = expression_rule(p)) // expression + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12398,7 +12188,7 @@ kwarg_or_double_starred_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); + _res = _Py_Tuple ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12407,34 +12197,45 @@ kwarg_or_double_starred_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); + D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); } - { // '**' expression + _res = NULL; + done: + D(p->level--); + return _res; +} + +// group: '(' (yield_expr | named_expression) ')' +static expr_ty +group_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // '(' (yield_expr | named_expression) ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); + D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); Token * _literal; - expr_ty a; + Token * _literal_1; + void *a; if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = expression_rule(p)) // expression + (a = _tmp_126_rule(p)) // yield_expr | named_expression + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 ); + D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12443,27 +12244,8 @@ kwarg_or_double_starred_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); - } - { // invalid_kwarg - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); - void *invalid_kwarg_var; - if ( - (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg - ) - { - D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); - _res = invalid_kwarg_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); + D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); } _res = NULL; done: @@ -12471,9 +12253,9 @@ kwarg_or_double_starred_rule(Parser *p) return _res; } -// star_targets: star_target !',' | star_target ((',' star_target))* ','? +// genexp: '(' expression for_if_clauses ')' | invalid_comprehension static expr_ty -star_targets_rule(Parser *p) +genexp_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -12491,51 +12273,27 @@ star_targets_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // star_target !',' + { // '(' expression for_if_clauses ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); + D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); + Token * _literal; + Token * _literal_1; expr_ty a; + asdl_seq* b; if ( - (a = star_target_rule(p)) // star_target + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' - ) - { - D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); - } - { // star_target ((',' star_target))* ','? - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; - asdl_seq * b; - if ( - (a = star_target_rule(p)) // star_target + (a = expression_rule(p)) // expression && - (b = _loop0_117_rule(p)) // ((',' star_target))* + (b = for_if_clauses_rule(p)) // for_if_clauses && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); + D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression for_if_clauses ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12545,7 +12303,7 @@ star_targets_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); + _res = _Py_GeneratorExp ( a , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12554,53 +12312,27 @@ star_targets_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// star_targets_seq: ','.star_target+ ','? -static asdl_seq* -star_targets_seq_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression for_if_clauses ')'")); } - asdl_seq* _res = NULL; - int _mark = p->mark; - { // ','.star_target+ ','? + { // invalid_comprehension if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * a; + D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + void *invalid_comprehension_var; if ( - (a = _gather_118_rule(p)) // ','.star_target+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension ) { - D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + _res = invalid_comprehension_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); + D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); } _res = NULL; done: @@ -12608,13 +12340,9 @@ star_targets_seq_rule(Parser *p) return _res; } -// star_target: -// | '*' (!'*' star_target) -// | t_primary '.' NAME !t_lookahead -// | t_primary '[' slices ']' !t_lookahead -// | star_atom +// set: '{' expressions_list '}' static expr_ty -star_target_rule(Parser *p) +set_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -12622,10 +12350,6 @@ star_target_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, star_target_type, &_res)) { - D(p->level--); - return _res; - } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -12636,21 +12360,24 @@ star_target_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '*' (!'*' star_target) + { // '{' expressions_list '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); + D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); Token * _literal; - void *a; + Token * _literal_1; + asdl_seq* a; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (_literal = _PyPegen_expect_token(p, 25)) // token='{' + && + (a = expressions_list_rule(p)) // expressions_list && - (a = _tmp_120_rule(p)) // !'*' star_target + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); + D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12660,7 +12387,7 @@ star_target_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); + _res = _Py_Set ( a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12669,73 +12396,56 @@ star_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); + D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'")); } - { // t_primary '.' NAME !t_lookahead - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); - Token * _literal; - expr_ty a; - expr_ty b; - if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - && - (b = _PyPegen_name_token(p)) // NAME - && - _PyPegen_lookahead(0, t_lookahead_rule, p) - ) - { - D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + _res = NULL; + done: + D(p->level--); + return _res; +} + +// setcomp: '{' expression for_if_clauses '}' | invalid_comprehension +static expr_ty +setcomp_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // t_primary '[' slices ']' !t_lookahead + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '{' expression for_if_clauses '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); Token * _literal; Token * _literal_1; expr_ty a; - expr_ty b; + asdl_seq* b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (b = slices_rule(p)) // slices + (a = expression_rule(p)) // expression && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (b = for_if_clauses_rule(p)) // for_if_clauses && - _PyPegen_lookahead(0, t_lookahead_rule, p) + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression for_if_clauses '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12745,7 +12455,7 @@ star_target_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Store , EXTRA ); + _res = _Py_SetComp ( a , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12754,42 +12464,37 @@ star_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression for_if_clauses '}'")); } - { // star_atom + { // invalid_comprehension if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom")); - expr_ty star_atom_var; + D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + void *invalid_comprehension_var; if ( - (star_atom_var = star_atom_rule(p)) // star_atom + (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension ) { - D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom")); - _res = star_atom_var; + D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); + _res = invalid_comprehension_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); + D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, star_target_type, _res); D(p->level--); return _res; } -// star_atom: -// | NAME -// | '(' star_target ')' -// | '(' star_targets_seq? ')' -// | '[' star_targets_seq? ']' +// dict: '{' double_starred_kvpairs? '}' static expr_ty -star_atom_rule(Parser *p) +dict_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -12807,49 +12512,34 @@ star_atom_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); - expr_ty a; - if ( - (a = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = _PyPegen_set_expr_context ( p , a , Store ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); - } - { // '(' star_target ')' + { // '{' double_starred_kvpairs? '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); + D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); Token * _literal; Token * _literal_1; - expr_ty a; + void *a; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (a = star_target_rule(p)) // star_target + (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); - _res = _PyPegen_set_expr_context ( p , a , Store ); + D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12858,27 +12548,56 @@ star_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'")); + D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); } - { // '(' star_targets_seq? ')' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension +static expr_ty +dictcomp_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '{' kvpair for_if_clauses '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); + D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); Token * _literal; Token * _literal_1; - void *a; + KeyValuePair* a; + asdl_seq* b; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (a = star_targets_seq_rule(p), 1) // star_targets_seq? + (a = kvpair_rule(p)) // kvpair && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (b = for_if_clauses_rule(p)) // for_if_clauses + && + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); + D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -12888,7 +12607,7 @@ star_atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( a , Store , EXTRA ); + _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12897,47 +12616,27 @@ star_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'")); + D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); } - { // '[' star_targets_seq? ']' + { // invalid_dict_comprehension if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); - Token * _literal; - Token * _literal_1; - void *a; + D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); + void *invalid_dict_comprehension_var; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (a = star_targets_seq_rule(p), 1) // star_targets_seq? - && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension ) { - D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( a , Store , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); + _res = invalid_dict_comprehension_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'")); + D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); } _res = NULL; done: @@ -12945,49 +12644,78 @@ star_atom_rule(Parser *p) return _res; } -// single_target: single_subscript_attribute_target | NAME | '(' single_target ')' -static expr_ty -single_target_rule(Parser *p) +// double_starred_kvpairs: ','.double_starred_kvpair+ ','? +static asdl_seq* +double_starred_kvpairs_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; - { // single_subscript_attribute_target + { // ','.double_starred_kvpair+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); - expr_ty single_subscript_attribute_target_var; + D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; if ( - (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target - ) + (a = _gather_127_rule(p)) // ','.double_starred_kvpair+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + ) { - D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); - _res = single_subscript_attribute_target_var; + D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); + D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); } - { // NAME + _res = NULL; + done: + D(p->level--); + return _res; +} + +// double_starred_kvpair: '**' bitwise_or | kvpair +static KeyValuePair* +double_starred_kvpair_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + KeyValuePair* _res = NULL; + int _mark = p->mark; + { // '**' bitwise_or if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); + Token * _literal; expr_ty a; if ( - (a = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 35)) // token='**' + && + (a = bitwise_or_rule(p)) // bitwise_or ) { - D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = _PyPegen_set_expr_context ( p , a , Store ); + D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); + _res = _PyPegen_key_value_pair ( p , NULL , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -12996,38 +12724,27 @@ single_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); } - { // '(' single_target ')' + { // kvpair if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); - Token * _literal; - Token * _literal_1; - expr_ty a; + D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); + KeyValuePair* kvpair_var; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (a = single_target_rule(p)) // single_target - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (kvpair_var = kvpair_rule(p)) // kvpair ) { - D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); + _res = kvpair_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); + D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); } _res = NULL; done: @@ -13035,102 +12752,36 @@ single_target_rule(Parser *p) return _res; } -// single_subscript_attribute_target: -// | t_primary '.' NAME !t_lookahead -// | t_primary '[' slices ']' !t_lookahead -static expr_ty -single_subscript_attribute_target_rule(Parser *p) +// kvpair: expression ':' expression +static KeyValuePair* +kvpair_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + KeyValuePair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // t_primary '.' NAME !t_lookahead - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); - Token * _literal; - expr_ty a; - expr_ty b; - if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - && - (b = _PyPegen_name_token(p)) // NAME - && - _PyPegen_lookahead(0, t_lookahead_rule, p) - ) - { - D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); - } - { // t_primary '[' slices ']' !t_lookahead + { // expression ':' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); Token * _literal; - Token * _literal_1; expr_ty a; expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (b = slices_rule(p)) // slices + (a = expression_rule(p)) // expression && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && - _PyPegen_lookahead(0, t_lookahead_rule, p) + (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Store , EXTRA ); + D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); + _res = _PyPegen_key_value_pair ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13139,8 +12790,8 @@ single_subscript_attribute_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); } _res = NULL; done: @@ -13148,9 +12799,9 @@ single_subscript_attribute_target_rule(Parser *p) return _res; } -// del_targets: ','.del_target+ ','? +// for_if_clauses: for_if_clause+ static asdl_seq* -del_targets_rule(Parser *p) +for_if_clauses_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -13159,33 +12810,24 @@ del_targets_rule(Parser *p) } asdl_seq* _res = NULL; int _mark = p->mark; - { // ','.del_target+ ','? + { // for_if_clause+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * a; + D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); + asdl_seq * _loop1_129_var; if ( - (a = _gather_121_rule(p)) // ','.del_target+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (_loop1_129_var = _loop1_129_rule(p)) // for_if_clause+ ) { - D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); + _res = _loop1_129_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); + D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); } _res = NULL; done: @@ -13193,63 +12835,47 @@ del_targets_rule(Parser *p) return _res; } -// del_target: -// | t_primary '.' NAME &del_target_end -// | t_primary '[' slices ']' &del_target_end -// | del_t_atom -static expr_ty -del_target_rule(Parser *p) +// for_if_clause: +// | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* +// | 'for' star_targets 'in' disjunction (('if' disjunction))* +static comprehension_ty +for_if_clause_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, del_target_type, &_res)) { - D(p->level--); - return _res; - } + comprehension_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // t_primary '.' NAME &del_target_end + { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); - Token * _literal; + D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); + Token * _keyword; + Token * _keyword_1; expr_ty a; + Token * async_var; expr_ty b; + asdl_seq * c; if ( - (a = t_primary_rule(p)) // t_primary + (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_keyword = _PyPegen_expect_token(p, 517)) // token='for' && - (b = _PyPegen_name_token(p)) // NAME + (a = star_targets_rule(p)) // star_targets && - _PyPegen_lookahead(1, del_target_end_rule, p) + (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' + && + (b = disjunction_rule(p)) // disjunction + && + (c = _loop0_130_rule(p)) // (('if' disjunction))* ) { - D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); + D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); + _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13258,42 +12884,34 @@ del_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &del_target_end")); - } - { // t_primary '[' slices ']' &del_target_end + D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); + } + { // 'for' star_targets 'in' disjunction (('if' disjunction))* if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); + Token * _keyword; + Token * _keyword_1; expr_ty a; expr_ty b; + asdl_seq * c; if ( - (a = t_primary_rule(p)) // t_primary + (_keyword = _PyPegen_expect_token(p, 517)) // token='for' && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (a = star_targets_rule(p)) // star_targets && - (b = slices_rule(p)) // slices + (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (b = disjunction_rule(p)) // disjunction && - _PyPegen_lookahead(1, del_target_end_rule, p) + (c = _loop0_131_rule(p)) // (('if' disjunction))* ) { - D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Del , EXTRA ); + D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); + _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13302,43 +12920,18 @@ del_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); - } - { // del_t_atom - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); - expr_ty del_t_atom_var; - if ( - (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom - ) - { - D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); - _res = del_t_atom_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); + D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, del_target_type, _res); D(p->level--); return _res; } -// del_t_atom: -// | NAME &del_target_end -// | '(' del_target ')' -// | '(' del_targets? ')' -// | '[' del_targets? ']' -// | invalid_del_target +// yield_expr: 'yield' 'from' expression | 'yield' star_expressions? static expr_ty -del_t_atom_rule(Parser *p) +yield_expr_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -13356,51 +12949,34 @@ del_t_atom_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME &del_target_end + { // 'yield' 'from' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); + D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); + Token * _keyword; + Token * _keyword_1; expr_ty a; if ( - (a = _PyPegen_name_token(p)) // NAME + (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' && - _PyPegen_lookahead(1, del_target_end_rule, p) + (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' + && + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); - _res = _PyPegen_set_expr_context ( p , a , Del ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; + D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { D(p->level--); return NULL; } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME &del_target_end")); - } - { // '(' del_target ')' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); - Token * _literal; - Token * _literal_1; - expr_ty a; - if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (a = del_target_rule(p)) // del_target - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' - ) - { - D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); - _res = _PyPegen_set_expr_context ( p , a , Del ); + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_YieldFrom ( a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13409,27 +12985,24 @@ del_t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); + D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); } - { // '(' del_targets? ')' + { // 'yield' star_expressions? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); + Token * _keyword; void *a; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (a = del_targets_rule(p), 1) // del_targets? + (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (a = star_expressions_rule(p), 1) // star_expressions? ) { - D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); + D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13439,7 +13012,7 @@ del_t_atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( a , Del , EXTRA ); + _res = _Py_Yield ( a , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13448,37 +13021,49 @@ del_t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); + D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); } - { // '[' del_targets? ']' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// arguments: args ','? &')' | incorrect_arguments +static expr_ty +arguments_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, arguments_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + { // args ','? &')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); - Token * _literal; - Token * _literal_1; - void *a; + D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (a = args_rule(p)) // args && - (a = del_targets_rule(p), 1) // del_targets? + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' ) { - D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( a , Del , EXTRA ); + D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13487,139 +13072,159 @@ del_t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); + D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); } - { // invalid_del_target + { // incorrect_arguments if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); - void *invalid_del_target_var; + D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); + void *incorrect_arguments_var; if ( - (invalid_del_target_var = invalid_del_target_rule(p)) // invalid_del_target + (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments ) { - D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); - _res = invalid_del_target_var; + D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments")); + _res = incorrect_arguments_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_target")); + D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, arguments_type, _res); D(p->level--); return _res; } -// del_target_end: ')' | ']' | ',' | ';' | NEWLINE -static void * -del_target_end_rule(Parser *p) +// args: starred_expression [',' args] | kwargs | named_expression [',' args] +static expr_ty +args_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // ')' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 8)) // token=')' - ) - { - D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - { // ']' + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // starred_expression [',' args] if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "']'")); - Token * _literal; + D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); + expr_ty a; + void *b; if ( - (_literal = _PyPegen_expect_token(p, 10)) // token=']' + (a = starred_expression_rule(p)) // starred_expression + && + (b = _tmp_132_rule(p), 1) // [',' args] ) { - D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "']'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "']'")); - } - { // ',' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - ) - { - D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); - _res = _literal; + D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); + D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]")); } - { // ';' + { // kwargs if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); - Token * _literal; + D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); + asdl_seq* a; if ( - (_literal = _PyPegen_expect_token(p, 13)) // token=';' + (a = kwargs_rule(p)) // kwargs ) { - D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); - _res = _literal; + D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); + D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); } - { // NEWLINE + { // named_expression [',' args] if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); - Token * newline_var; + D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); + expr_ty a; + void *b; if ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (a = named_expression_rule(p)) // named_expression + && + (b = _tmp_133_rule(p), 1) // [',' args] ) { - D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); - _res = newline_var; + D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( _PyPegen_dummy_name ( p ) , ( b ) ? CHECK ( _PyPegen_seq_insert_in_front ( p , a , ( ( expr_ty ) b ) -> v . Call . args ) ) : CHECK ( _PyPegen_singleton_seq ( p , a ) ) , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]")); } _res = NULL; done: @@ -13627,9 +13232,12 @@ del_target_end_rule(Parser *p) return _res; } -// targets: ','.target+ ','? +// kwargs: +// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ +// | ','.kwarg_or_starred+ +// | ','.kwarg_or_double_starred+ static asdl_seq* -targets_rule(Parser *p) +kwargs_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -13638,23 +13246,25 @@ targets_rule(Parser *p) } asdl_seq* _res = NULL; int _mark = p->mark; - { // ','.target+ ','? + { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings + D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); + Token * _literal; asdl_seq * a; + asdl_seq * b; if ( - (a = _gather_123_rule(p)) // ','.target+ + (a = _gather_134_rule(p)) // ','.kwarg_or_starred+ && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (b = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ ) { - D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); - _res = a; + D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); + _res = _PyPegen_join_sequences ( p , a , b ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13663,8 +13273,46 @@ targets_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); + D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); + } + { // ','.kwarg_or_starred+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); + asdl_seq * _gather_138_var; + if ( + (_gather_138_var = _gather_138_rule(p)) // ','.kwarg_or_starred+ + ) + { + D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); + _res = _gather_138_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); + } + { // ','.kwarg_or_double_starred+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); + asdl_seq * _gather_140_var; + if ( + (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_double_starred+ + ) + { + D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); + _res = _gather_140_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); } _res = NULL; done: @@ -13672,12 +13320,9 @@ targets_rule(Parser *p) return _res; } -// target: -// | t_primary '.' NAME !t_lookahead -// | t_primary '[' slices ']' !t_lookahead -// | t_atom +// starred_expression: '*' expression static expr_ty -target_rule(Parser *p) +starred_expression_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -13685,10 +13330,6 @@ target_rule(Parser *p) return NULL; } expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, target_type, &_res)) { - D(p->level--); - return _res; - } int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -13699,26 +13340,21 @@ target_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // t_primary '.' NAME !t_lookahead + { // '*' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); Token * _literal; expr_ty a; - expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - && - (b = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - _PyPegen_lookahead(0, t_lookahead_rule, p) + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13728,7 +13364,7 @@ target_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); + _res = _Py_Starred ( a , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13737,32 +13373,53 @@ target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); } - { // t_primary '[' slices ']' !t_lookahead + _res = NULL; + done: + D(p->level--); + return _res; +} + +// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg +static KeywordOrStarred* +kwarg_or_starred_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + KeywordOrStarred* _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME '=' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); Token * _literal; - Token * _literal_1; expr_ty a; expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (b = slices_rule(p)) // slices + (a = _PyPegen_name_token(p)) // NAME && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - _PyPegen_lookahead(0, t_lookahead_rule, p) + (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13772,7 +13429,7 @@ target_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Store , EXTRA ); + _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13781,80 +13438,68 @@ target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); } - { // t_atom + { // starred_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom")); - expr_ty t_atom_var; + D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + expr_ty a; if ( - (t_atom_var = t_atom_rule(p)) // t_atom + (a = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom")); - _res = t_atom_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); - } - _res = NULL; - done: - _PyPegen_insert_memo(p, _mark, target_type, _res); - D(p->level--); - return _res; -} - -// Left-recursive -// t_primary: -// | t_primary '.' NAME &t_lookahead -// | t_primary '[' slices ']' &t_lookahead -// | t_primary genexp &t_lookahead -// | t_primary '(' arguments? ')' &t_lookahead -// | atom &t_lookahead -static expr_ty t_primary_raw(Parser *); -static expr_ty -t_primary_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { - D(p->level--); - return _res; + D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + _res = _PyPegen_keyword_or_starred ( p , a , 0 ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); - if (tmpvar_8) { + { // invalid_kwarg + if (p->error_indicator) { D(p->level--); - return _res; + return NULL; + } + D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); + void *invalid_kwarg_var; + if ( + (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg + ) + { + D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); + _res = invalid_kwarg_var; + goto done; } p->mark = _mark; - void *_raw = t_primary_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; + D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); } - p->mark = _resmark; + _res = NULL; + done: D(p->level--); return _res; } -static expr_ty -t_primary_raw(Parser *p) + +// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg +static KeywordOrStarred* +kwarg_or_double_starred_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + KeywordOrStarred* _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -13865,26 +13510,24 @@ t_primary_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // t_primary '.' NAME &t_lookahead + { // NAME '=' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); Token * _literal; expr_ty a; expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (a = _PyPegen_name_token(p)) // NAME && - (b = _PyPegen_name_token(p)) // NAME + (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - _PyPegen_lookahead(1, t_lookahead_rule, p) + (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13894,7 +13537,7 @@ t_primary_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); + _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13903,32 +13546,24 @@ t_primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); } - { // t_primary '[' slices ']' &t_lookahead + { // '**' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); Token * _literal; - Token * _literal_1; expr_ty a; - expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (b = slices_rule(p)) // slices - && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (_literal = _PyPegen_expect_token(p, 35)) // token='**' && - _PyPegen_lookahead(1, t_lookahead_rule, p) + (a = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13938,7 +13573,7 @@ t_primary_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Subscript ( a , b , Load , EXTRA ); + _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13947,36 +13582,69 @@ t_primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); } - { // t_primary genexp &t_lookahead + { // invalid_kwarg if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); + D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); + void *invalid_kwarg_var; + if ( + (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg + ) + { + D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); + _res = invalid_kwarg_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// star_targets: star_target !',' | star_target ((',' star_target))* ','? +static expr_ty +star_targets_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // star_target !',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); expr_ty a; - expr_ty b; if ( - (a = t_primary_rule(p)) // t_primary - && - (b = genexp_rule(p)) // genexp + (a = star_target_rule(p)) // star_target && - _PyPegen_lookahead(1, t_lookahead_rule, p) + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' ) { - D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); + D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -13985,32 +13653,28 @@ t_primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); + D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); } - { // t_primary '(' arguments? ')' &t_lookahead + { // star_target ((',' star_target))* ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings expr_ty a; - void *b; + asdl_seq * b; if ( - (a = t_primary_rule(p)) // t_primary - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (b = arguments_rule(p), 1) // arguments? + (a = star_target_rule(p)) // star_target && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (b = _loop0_142_rule(p)) // ((',' star_target))* && - _PyPegen_lookahead(1, t_lookahead_rule, p) + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); + D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -14020,7 +13684,7 @@ t_primary_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14029,23 +13693,42 @@ t_primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); + D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); } - { // atom &t_lookahead + _res = NULL; + done: + D(p->level--); + return _res; +} + +// star_targets_seq: ','.star_target+ ','? +static asdl_seq* +star_targets_seq_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq* _res = NULL; + int _mark = p->mark; + { // ','.star_target+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); - expr_ty a; + D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; if ( - (a = atom_rule(p)) // atom + (a = _gather_143_rule(p)) // ','.star_target+ && - _PyPegen_lookahead(1, t_lookahead_rule, p) + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); + D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -14055,8 +13738,8 @@ t_primary_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); + D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); } _res = NULL; done: @@ -14064,83 +13747,188 @@ t_primary_raw(Parser *p) return _res; } -// t_lookahead: '(' | '[' | '.' -static void * -t_lookahead_rule(Parser *p) -{ +// star_target: +// | '*' (!'*' star_target) +// | t_primary '.' NAME !t_lookahead +// | t_primary '[' slices ']' !t_lookahead +// | star_atom +static expr_ty +star_target_rule(Parser *p) +{ D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, star_target_type, &_res)) { + D(p->level--); + return _res; + } int _mark = p->mark; - { // '(' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '*' (!'*' star_target) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); Token * _literal; + void *a; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (a = _tmp_145_rule(p)) // !'*' star_target ) { - D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); - _res = _literal; + D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); } - { // '[' + { // t_primary '.' NAME !t_lookahead if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); Token * _literal; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (b = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(0, t_lookahead_rule, p) ) { - D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); - _res = _literal; + D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); } - { // '.' + { // t_primary '[' slices ']' !t_lookahead if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); Token * _literal; + Token * _literal_1; + expr_ty a; + expr_ty b; if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + && + _PyPegen_lookahead(0, t_lookahead_rule, p) ) { - D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; + D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + } + { // star_atom + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom")); + expr_ty star_atom_var; + if ( + (star_atom_var = star_atom_rule(p)) // star_atom + ) + { + D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom")); + _res = star_atom_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); } _res = NULL; done: + _PyPegen_insert_memo(p, _mark, star_target_type, _res); D(p->level--); return _res; } -// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' +// star_atom: +// | NAME +// | '(' star_target ')' +// | '(' star_targets_seq? ')' +// | '[' star_targets_seq? ']' static expr_ty -t_atom_rule(Parser *p) +star_atom_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -14163,13 +13951,13 @@ t_atom_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); expr_ty a; if ( (a = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); _res = _PyPegen_set_expr_context ( p , a , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -14179,27 +13967,27 @@ t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); } - { // '(' target ')' + { // '(' star_target ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); + D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); Token * _literal; Token * _literal_1; expr_ty a; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = target_rule(p)) // target + (a = star_target_rule(p)) // star_target && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); + D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'")); _res = _PyPegen_set_expr_context ( p , a , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -14209,27 +13997,27 @@ t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); + D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'")); } - { // '(' targets? ')' + { // '(' star_targets_seq? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); + D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); Token * _literal; Token * _literal_1; - void *b; + void *a; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (b = targets_rule(p), 1) // targets? + (a = star_targets_seq_rule(p), 1) // star_targets_seq? && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); + D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -14239,7 +14027,7 @@ t_atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( b , Store , EXTRA ); + _res = _Py_Tuple ( a , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14248,27 +14036,27 @@ t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); + D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'")); } - { // '[' targets? ']' + { // '[' star_targets_seq? ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); + D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); Token * _literal; Token * _literal_1; - void *b; + void *a; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (b = targets_rule(p), 1) // targets? + (a = star_targets_seq_rule(p), 1) // star_targets_seq? && (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); + D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -14278,7 +14066,7 @@ t_atom_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( b , Store , EXTRA ); + _res = _Py_List ( a , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14287,8 +14075,8 @@ t_atom_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); + D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'")); } _res = NULL; done: @@ -14296,75 +14084,49 @@ t_atom_rule(Parser *p) return _res; } -// incorrect_arguments: -// | args ',' '*' -// | expression for_if_clauses ',' [args | expression for_if_clauses] -// | args for_if_clauses -// | args ',' expression for_if_clauses -// | args ',' args -static void * -incorrect_arguments_rule(Parser *p) +// single_target: single_subscript_attribute_target | NAME | '(' single_target ')' +static expr_ty +single_target_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; - { // args ',' '*' + { // single_subscript_attribute_target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); - Token * _literal; - Token * _literal_1; - expr_ty args_var; + D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); + expr_ty single_subscript_attribute_target_var; if ( - (args_var = args_rule(p)) // args - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' + (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target ) { - D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); - _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); + _res = single_subscript_attribute_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); + D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); } - { // expression for_if_clauses ',' [args | expression for_if_clauses] + { // NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); - Token * _literal; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings + D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); expr_ty a; - asdl_seq* for_if_clauses_var; if ( - (a = expression_rule(p)) // expression - && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (_opt_var = _tmp_125_rule(p), 1) // [args | expression for_if_clauses] + (a = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); + D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = _PyPegen_set_expr_context ( p , a , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14373,25 +14135,28 @@ incorrect_arguments_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); + D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); } - { // args for_if_clauses + { // '(' single_target ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); + D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); + Token * _literal; + Token * _literal_1; expr_ty a; - asdl_seq* for_if_clauses_var; if ( - (a = args_rule(p)) // args + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + (a = single_target_rule(p)) // single_target + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); - _res = _PyPegen_nonparen_genexp_in_call ( p , a ); + D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); + _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14400,31 +14165,67 @@ incorrect_arguments_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); + D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); } - { // args ',' expression for_if_clauses + _res = NULL; + done: + D(p->level--); + return _res; +} + +// single_subscript_attribute_target: +// | t_primary '.' NAME !t_lookahead +// | t_primary '[' slices ']' !t_lookahead +static expr_ty +single_subscript_attribute_target_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // t_primary '.' NAME !t_lookahead if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); + D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); Token * _literal; expr_ty a; - expr_ty args_var; - asdl_seq* for_if_clauses_var; + expr_ty b; if ( - (args_var = args_rule(p)) // args + (a = t_primary_rule(p)) // t_primary && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (a = expression_rule(p)) // expression + (b = _PyPegen_name_token(p)) // NAME && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + _PyPegen_lookahead(0, t_lookahead_rule, p) ) { - D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); + D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14433,28 +14234,42 @@ incorrect_arguments_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); + D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); } - { // args ',' args + { // t_primary '[' slices ']' !t_lookahead if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args")); + D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); Token * _literal; + Token * _literal_1; expr_ty a; - expr_ty args_var; + expr_ty b; if ( - (a = args_rule(p)) // args + (a = t_primary_rule(p)) // t_primary && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (args_var = args_rule(p)) // args + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + && + _PyPegen_lookahead(0, t_lookahead_rule, p) ) { - D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args")); - _res = _PyPegen_arguments_parsing_error ( p , a ); + D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -14463,52 +14278,2436 @@ incorrect_arguments_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); + D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); } _res = NULL; done: D(p->level--); - return _res; + return _res; +} + +// del_targets: ','.del_target+ ','? +static asdl_seq* +del_targets_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq* _res = NULL; + int _mark = p->mark; + { // ','.del_target+ ','? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; + if ( + (a = _gather_146_rule(p)) // ','.del_target+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + ) + { + D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// del_target: +// | t_primary '.' NAME &del_target_end +// | t_primary '[' slices ']' &del_target_end +// | del_t_atom +static expr_ty +del_target_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, del_target_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // t_primary '.' NAME &del_target_end + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); + Token * _literal; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (b = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(1, del_target_end_rule, p) + ) + { + D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &del_target_end")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &del_target_end")); + } + { // t_primary '[' slices ']' &del_target_end + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); + Token * _literal; + Token * _literal_1; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + && + _PyPegen_lookahead(1, del_target_end_rule, p) + ) + { + D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Del , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &del_target_end")); + } + { // del_t_atom + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); + expr_ty del_t_atom_var; + if ( + (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom + ) + { + D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); + _res = del_t_atom_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); + } + _res = NULL; + done: + _PyPegen_insert_memo(p, _mark, del_target_type, _res); + D(p->level--); + return _res; +} + +// del_t_atom: +// | NAME &del_target_end +// | '(' del_target ')' +// | '(' del_targets? ')' +// | '[' del_targets? ']' +// | invalid_del_target +static expr_ty +del_t_atom_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME &del_target_end + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); + expr_ty a; + if ( + (a = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(1, del_target_end_rule, p) + ) + { + D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); + _res = _PyPegen_set_expr_context ( p , a , Del ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME &del_target_end")); + } + { // '(' del_target ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); + Token * _literal; + Token * _literal_1; + expr_ty a; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (a = del_target_rule(p)) // del_target + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); + _res = _PyPegen_set_expr_context ( p , a , Del ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); + } + { // '(' del_targets? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); + Token * _literal; + Token * _literal_1; + void *a; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (a = del_targets_rule(p), 1) // del_targets? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( a , Del , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); + } + { // '[' del_targets? ']' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); + Token * _literal; + Token * _literal_1; + void *a; + if ( + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (a = del_targets_rule(p), 1) // del_targets? + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + ) + { + D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_List ( a , Del , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); + } + { // invalid_del_target + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); + void *invalid_del_target_var; + if ( + (invalid_del_target_var = invalid_del_target_rule(p)) // invalid_del_target + ) + { + D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_target")); + _res = invalid_del_target_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_target")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// del_target_end: ')' | ']' | ',' | ';' | NEWLINE +static void * +del_target_end_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); + } + { // ']' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "']'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 10)) // token=']' + ) + { + D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "']'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "']'")); + } + { // ',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); + } + { // ';' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 13)) // token=';' + ) + { + D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); + } + { // NEWLINE + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> del_target_end[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); + Token * newline_var; + if ( + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + ) + { + D(fprintf(stderr, "%*c+ del_target_end[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); + _res = newline_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// targets: ','.target+ ','? +static asdl_seq* +targets_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq* _res = NULL; + int _mark = p->mark; + { // ','.target+ ','? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * a; + if ( + (a = _gather_148_rule(p)) // ','.target+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + ) + { + D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// target: +// | t_primary '.' NAME !t_lookahead +// | t_primary '[' slices ']' !t_lookahead +// | t_atom +static expr_ty +target_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, target_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // t_primary '.' NAME !t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + Token * _literal; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (b = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(0, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); + } + { // t_primary '[' slices ']' !t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + Token * _literal; + Token * _literal_1; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + && + _PyPegen_lookahead(0, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); + } + { // t_atom + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom")); + expr_ty t_atom_var; + if ( + (t_atom_var = t_atom_rule(p)) // t_atom + ) + { + D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom")); + _res = t_atom_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); + } + _res = NULL; + done: + _PyPegen_insert_memo(p, _mark, target_type, _res); + D(p->level--); + return _res; +} + +// Left-recursive +// t_primary: +// | t_primary '.' NAME &t_lookahead +// | t_primary '[' slices ']' &t_lookahead +// | t_primary genexp &t_lookahead +// | t_primary '(' arguments? ')' &t_lookahead +// | atom &t_lookahead +static expr_ty t_primary_raw(Parser *); +static expr_ty +t_primary_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); + if (tmpvar_8) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = t_primary_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +t_primary_raw(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // t_primary '.' NAME &t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + Token * _literal; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (b = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(1, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); + } + { // t_primary '[' slices ']' &t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + Token * _literal; + Token * _literal_1; + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (b = slices_rule(p)) // slices + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + && + _PyPegen_lookahead(1, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Subscript ( a , b , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); + } + { // t_primary genexp &t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); + expr_ty a; + expr_ty b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (b = genexp_rule(p)) // genexp + && + _PyPegen_lookahead(1, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); + } + { // t_primary '(' arguments? ')' &t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); + Token * _literal; + Token * _literal_1; + expr_ty a; + void *b; + if ( + (a = t_primary_rule(p)) // t_primary + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (b = arguments_rule(p), 1) // arguments? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + && + _PyPegen_lookahead(1, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); + } + { // atom &t_lookahead + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); + expr_ty a; + if ( + (a = atom_rule(p)) // atom + && + _PyPegen_lookahead(1, t_lookahead_rule, p) + ) + { + D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// t_lookahead: '(' | '[' | '.' +static void * +t_lookahead_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + ) + { + D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + } + { // '[' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + ) + { + D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); + } + { // '.' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + ) + { + D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' +static expr_ty +t_atom_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty a; + if ( + (a = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = _PyPegen_set_expr_context ( p , a , Store ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + } + { // '(' target ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); + Token * _literal; + Token * _literal_1; + expr_ty a; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (a = target_rule(p)) // target + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'")); + _res = _PyPegen_set_expr_context ( p , a , Store ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); + } + { // '(' targets? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); + Token * _literal; + Token * _literal_1; + void *b; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (b = targets_rule(p), 1) // targets? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( b , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); + } + { // '[' targets? ']' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); + Token * _literal; + Token * _literal_1; + void *b; + if ( + (_literal = _PyPegen_expect_token(p, 9)) // token='[' + && + (b = targets_rule(p), 1) // targets? + && + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + ) + { + D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_List ( b , Store , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// incorrect_arguments: +// | args ',' '*' +// | expression for_if_clauses ',' [args | expression for_if_clauses] +// | args for_if_clauses +// | args ',' expression for_if_clauses +// | args ',' args +static void * +incorrect_arguments_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // args ',' '*' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); + Token * _literal; + Token * _literal_1; + expr_ty args_var; + if ( + (args_var = args_rule(p)) // args + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' + ) + { + D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'")); + _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); + } + { // expression for_if_clauses ',' [args | expression for_if_clauses] + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); + Token * _literal; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; + asdl_seq* for_if_clauses_var; + if ( + (a = expression_rule(p)) // expression + && + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_opt_var = _tmp_150_rule(p), 1) // [args | expression for_if_clauses] + ) + { + D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); + } + { // args for_if_clauses + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); + expr_ty a; + asdl_seq* for_if_clauses_var; + if ( + (a = args_rule(p)) // args + && + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + ) + { + D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); + _res = _PyPegen_nonparen_genexp_in_call ( p , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); + } + { // args ',' expression for_if_clauses + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); + Token * _literal; + expr_ty a; + expr_ty args_var; + asdl_seq* for_if_clauses_var; + if ( + (args_var = args_rule(p)) // args + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (a = expression_rule(p)) // expression + && + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + ) + { + D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); + } + { // args ',' args + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args")); + Token * _literal; + expr_ty a; + expr_ty args_var; + if ( + (a = args_rule(p)) // args + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (args_var = args_rule(p)) // args + ) + { + D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args")); + _res = _PyPegen_arguments_parsing_error ( p , a ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_kwarg: expression '=' +static void * +invalid_kwarg_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // expression '=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='")); + Token * _literal; + expr_ty a; + if ( + (a = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + ) + { + D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_named_expression: expression ':=' expression +static void * +invalid_named_expression_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // expression ':=' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); + Token * _literal; + expr_ty a; + expr_ty expression_var; + if ( + (a = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 53)) // token=':=' + && + (expression_var = expression_rule(p)) // expression + ) + { + D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_assignment: +// | list ':' +// | tuple ':' +// | star_named_expression ',' star_named_expressions* ':' +// | expression ':' expression ['=' annotated_rhs] +// | star_expressions '=' (yield_expr | star_expressions) +// | star_expressions augassign (yield_expr | star_expressions) +static void * +invalid_assignment_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // list ':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list ':'")); + Token * _literal; + expr_ty a; + if ( + (a = list_rule(p)) // list + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list ':'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not list) can be annotated" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list ':'")); + } + { // tuple ':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple ':'")); + Token * _literal; + expr_ty a; + if ( + (a = tuple_rule(p)) // tuple + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple ':'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple ':'")); + } + { // star_named_expression ',' star_named_expressions* ':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); + Token * _literal; + Token * _literal_1; + asdl_seq * _loop0_151_var; + expr_ty a; + if ( + (a = star_named_expression_rule(p)) // star_named_expression + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_loop0_151_var = _loop0_151_rule(p)) // star_named_expressions* + && + (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); + } + { // expression ':' expression ['=' annotated_rhs] + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); + Token * _literal; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; + expr_ty expression_var; + if ( + (a = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (expression_var = expression_rule(p)) // expression + && + (_opt_var = _tmp_152_rule(p), 1) // ['=' annotated_rhs] + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); + } + { // star_expressions '=' (yield_expr | star_expressions) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); + Token * _literal; + void *_tmp_153_var; + expr_ty a; + if ( + (a = star_expressions_rule(p)) // star_expressions + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + && + (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( _PyPegen_get_invalid_target ( a ) , "cannot assign to %s" , _PyPegen_get_expr_name ( _PyPegen_get_invalid_target ( a ) ) ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); + } + { // star_expressions augassign (yield_expr | star_expressions) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); + void *_tmp_154_var; + expr_ty a; + AugOperator* augassign_var; + if ( + (a = star_expressions_rule(p)) // star_expressions + && + (augassign_var = augassign_rule(p)) // augassign + && + (_tmp_154_var = _tmp_154_rule(p)) // yield_expr | star_expressions + ) + { + D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_block: NEWLINE !INDENT +static void * +invalid_block_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // NEWLINE !INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); + Token * newline_var; + if ( + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + ) + { + D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); + _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses +static void * +invalid_comprehension_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ('[' | '(' | '{') starred_expression for_if_clauses + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); + void *_tmp_155_var; + expr_ty a; + asdl_seq* for_if_clauses_var; + if ( + (_tmp_155_var = _tmp_155_rule(p)) // '[' | '(' | '{' + && + (a = starred_expression_rule(p)) // starred_expression + && + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + ) + { + D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' +static void * +invalid_dict_comprehension_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '{' '**' bitwise_or for_if_clauses '}' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); + Token * _literal; + Token * _literal_1; + Token * a; + expr_ty bitwise_or_var; + asdl_seq* for_if_clauses_var; + if ( + (_literal = _PyPegen_expect_token(p, 25)) // token='{' + && + (a = _PyPegen_expect_token(p, 35)) // token='**' + && + (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or + && + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + && + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + ) + { + D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_parameters: +// | param_no_default* (slash_with_default | param_with_default+) param_no_default +static void * +invalid_parameters_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // param_no_default* (slash_with_default | param_with_default+) param_no_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); + asdl_seq * _loop0_156_var; + void *_tmp_157_var; + arg_ty param_no_default_var; + if ( + (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* + && + (_tmp_157_var = _tmp_157_rule(p)) // slash_with_default | param_with_default+ + && + (param_no_default_var = param_no_default_rule(p)) // param_no_default + ) + { + D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); + _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT +static void * +invalid_star_etc_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '*' (')' | ',' (')' | '**')) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); + Token * _literal; + void *_tmp_158_var; + if ( + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (_tmp_158_var = _tmp_158_rule(p)) // ')' | ',' (')' | '**') + ) + { + D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); + _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); + } + { // '*' ',' TYPE_COMMENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); + Token * _literal; + Token * _literal_1; + Token * type_comment_var; + if ( + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' + ) + { + D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); + _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) +static void * +invalid_lambda_star_etc_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '*' (':' | ',' (':' | '**')) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); + Token * _literal; + void *_tmp_159_var; + if ( + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (_tmp_159_var = _tmp_159_rule(p)) // ':' | ',' (':' | '**') + ) + { + D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); + _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT +static void * +invalid_double_type_comments_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); + Token * indent_var; + Token * newline_var; + Token * newline_var_1; + Token * type_comment_var; + Token * type_comment_var_1; + if ( + (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' + && + (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' + ) + { + D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); + _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_del_target: star_expression &del_target_end +static void * +invalid_del_target_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // star_expression &del_target_end + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); + expr_ty a; + if ( + (a = star_expression_rule(p)) // star_expression + && + _PyPegen_lookahead(1, del_target_end_rule, p) + ) + { + D(fprintf(stderr, "%*c+ invalid_del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot delete %s" , _PyPegen_get_expr_name ( a ) ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_del_target[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression &del_target_end")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_import_from_targets: import_from_as_names ',' +static void * +invalid_import_from_targets_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // import_from_as_names ',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); + Token * _literal; + asdl_seq* import_from_as_names_var; + if ( + (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); + _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_1: NEWLINE +static asdl_seq * +_loop0_1_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // NEWLINE + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); + Token * newline_var; + while ( + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + ) + { + _res = newline_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); + D(p->level--); + return _seq; +} + +// _loop0_2: NEWLINE +static asdl_seq * +_loop0_2_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // NEWLINE + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); + Token * newline_var; + while ( + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + ) + { + _res = newline_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); + D(p->level--); + return _seq; +} + +// _loop0_4: ',' expression +static asdl_seq * +_loop0_4_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + Token * _literal; + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = expression_rule(p)) // expression + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_3: expression _loop0_4 +static asdl_seq * +_gather_3_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // expression _loop0_4 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = expression_rule(p)) // expression + && + (seq = _loop0_4_rule(p)) // _loop0_4 + ) + { + D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_6: ',' expression +static asdl_seq * +_loop0_6_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + Token * _literal; + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = expression_rule(p)) // expression + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); + D(p->level--); + return _seq; } -// invalid_kwarg: expression '=' -static void * -invalid_kwarg_rule(Parser *p) +// _gather_5: expression _loop0_6 +static asdl_seq * +_gather_5_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // expression '=' + { // expression _loop0_6 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); + expr_ty elem; + asdl_seq * seq; if ( - (a = expression_rule(p)) // expression + (elem = expression_rule(p)) // expression && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (seq = _loop0_6_rule(p)) // _loop0_6 ) { - D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); + D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); } _res = NULL; done: @@ -14516,293 +16715,412 @@ invalid_kwarg_rule(Parser *p) return _res; } -// invalid_named_expression: expression ':=' expression -static void * -invalid_named_expression_rule(Parser *p) +// _loop0_8: ',' expression +static asdl_seq * +_loop0_8_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // expression ':=' expression + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); + D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; - expr_ty a; - expr_ty expression_var; - if ( - (a = expression_rule(p)) // expression - && - (_literal = _PyPegen_expect_token(p, 53)) // token=':=' + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (expression_var = expression_rule(p)) // expression + (elem = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); + _res = elem; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; + PyMem_Free(_children); D(p->level--); return NULL; } - goto done; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); + D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } - _res = NULL; - done: + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); D(p->level--); - return _res; + return _seq; } -// invalid_assignment: -// | list ':' -// | tuple ':' -// | star_named_expression ',' star_named_expressions* ':' -// | expression ':' expression ['=' annotated_rhs] -// | star_expressions '=' (yield_expr | star_expressions) -// | star_expressions augassign (yield_expr | star_expressions) -static void * -invalid_assignment_rule(Parser *p) +// _gather_7: expression _loop0_8 +static asdl_seq * +_gather_7_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // list ':' + { // expression _loop0_8 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list ':'")); - Token * _literal; - expr_ty a; + D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); + expr_ty elem; + asdl_seq * seq; if ( - (a = list_rule(p)) // list + (elem = expression_rule(p)) // expression && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (seq = _loop0_8_rule(p)) // _loop0_8 ) { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list ':'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not list) can be annotated" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list ':'")); + D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); } - { // tuple ':' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple ':'")); - Token * _literal; - expr_ty a; - if ( - (a = tuple_rule(p)) // tuple - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - ) - { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple ':'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple ':'")); + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_10: ',' expression +static asdl_seq * +_loop0_10_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // star_named_expression ',' star_named_expressions* ':' + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); + D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; - Token * _literal_1; - asdl_seq * _loop0_126_var; - expr_ty a; - if ( - (a = star_named_expression_rule(p)) // star_named_expression - && + expr_ty elem; + while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_126_var = _loop0_126_rule(p)) // star_named_expressions* - && - (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' + (elem = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); + _res = elem; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; + PyMem_Free(_children); D(p->level--); return NULL; } - goto done; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); + D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_9: expression _loop0_10 +static asdl_seq * +_gather_9_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // expression ':' expression ['=' annotated_rhs] + asdl_seq * _res = NULL; + int _mark = p->mark; + { // expression _loop0_10 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); - Token * _literal; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; - expr_ty expression_var; + D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); + expr_ty elem; + asdl_seq * seq; if ( - (a = expression_rule(p)) // expression - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (expression_var = expression_rule(p)) // expression + (elem = expression_rule(p)) // expression && - (_opt_var = _tmp_127_rule(p), 1) // ['=' annotated_rhs] + (seq = _loop0_10_rule(p)) // _loop0_10 ) { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); + D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); } - { // star_expressions '=' (yield_expr | star_expressions) + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop1_11: statement +static asdl_seq * +_loop1_11_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // statement if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); - Token * _literal; - void *_tmp_128_var; - expr_ty a; - if ( - (a = star_expressions_rule(p)) // star_expressions - && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' - && - (_tmp_128_var = _tmp_128_rule(p)) // yield_expr | star_expressions + D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement")); + asdl_seq* statement_var; + while ( + (statement_var = statement_rule(p)) // statement ) { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( _PyPegen_get_invalid_target ( a ) , "cannot assign to %s" , _PyPegen_get_expr_name ( _PyPegen_get_invalid_target ( a ) ) ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; + _res = statement_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; } - goto done; + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); + D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); } - { // star_expressions augassign (yield_expr | star_expressions) + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); + D(p->level--); + return _seq; +} + +// _loop0_13: ';' small_stmt +static asdl_seq * +_loop0_13_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ';' small_stmt if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_129_var; - expr_ty a; - AugOperator* augassign_var; - if ( - (a = star_expressions_rule(p)) // star_expressions - && - (augassign_var = augassign_rule(p)) // augassign + D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt")); + Token * _literal; + stmt_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 13)) // token=';' && - (_tmp_129_var = _tmp_129_rule(p)) // yield_expr | star_expressions + (elem = small_stmt_rule(p)) // small_stmt ) { - D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); + _res = elem; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; + PyMem_Free(_children); D(p->level--); return NULL; } - goto done; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); + D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt")); } - _res = NULL; - done: + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); D(p->level--); - return _res; + return _seq; } -// invalid_block: NEWLINE !INDENT -static void * -invalid_block_rule(Parser *p) +// _gather_12: small_stmt _loop0_13 +static asdl_seq * +_gather_12_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // NEWLINE !INDENT + { // small_stmt _loop0_13 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); - Token * newline_var; + D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); + stmt_ty elem; + asdl_seq * seq; if ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (elem = small_stmt_rule(p)) // small_stmt && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + (seq = _loop0_13_rule(p)) // _loop0_13 ) { - D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); - _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); + D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13")); } _res = NULL; done: @@ -14810,9 +17128,9 @@ invalid_block_rule(Parser *p) return _res; } -// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses +// _tmp_14: 'import' | 'from' static void * -invalid_comprehension_rule(Parser *p) +_tmp_14_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -14821,35 +17139,43 @@ invalid_comprehension_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ('[' | '(' | '{') starred_expression for_if_clauses + { // 'import' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_130_var; - expr_ty a; - asdl_seq* for_if_clauses_var; + D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); + Token * _keyword; + if ( + (_keyword = _PyPegen_expect_token(p, 513)) // token='import' + ) + { + D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); + _res = _keyword; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); + } + { // 'from' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); + Token * _keyword; if ( - (_tmp_130_var = _tmp_130_rule(p)) // '[' | '(' | '{' - && - (a = starred_expression_rule(p)) // starred_expression - && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses + (_keyword = _PyPegen_expect_token(p, 514)) // token='from' ) { - D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); + D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); } _res = NULL; done: @@ -14857,9 +17183,9 @@ invalid_comprehension_rule(Parser *p) return _res; } -// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' +// _tmp_15: 'def' | '@' | ASYNC static void * -invalid_dict_comprehension_rule(Parser *p) +_tmp_15_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -14868,41 +17194,62 @@ invalid_dict_comprehension_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '{' '**' bitwise_or for_if_clauses '}' + { // 'def' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); + D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); + Token * _keyword; + if ( + (_keyword = _PyPegen_expect_token(p, 525)) // token='def' + ) + { + D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); + _res = _keyword; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); + } + { // '@' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); Token * _literal; - Token * _literal_1; - Token * a; - expr_ty bitwise_or_var; - asdl_seq* for_if_clauses_var; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' - && - (a = _PyPegen_expect_token(p, 35)) // token='**' - && - (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or - && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses - && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (_literal = _PyPegen_expect_token(p, 49)) // token='@' ) { - D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); + D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); + } + { // ASYNC + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); + Token * async_var; + if ( + (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' + ) + { + D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); + _res = async_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); } _res = NULL; done: @@ -14910,10 +17257,9 @@ invalid_dict_comprehension_rule(Parser *p) return _res; } -// invalid_parameters: -// | param_no_default* (slash_with_default | param_with_default+) param_no_default +// _tmp_16: 'class' | '@' static void * -invalid_parameters_rule(Parser *p) +_tmp_16_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -14922,35 +17268,43 @@ invalid_parameters_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // param_no_default* (slash_with_default | param_with_default+) param_no_default + { // 'class' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_131_var; - void *_tmp_132_var; - arg_ty param_no_default_var; + D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); + Token * _keyword; if ( - (_loop0_131_var = _loop0_131_rule(p)) // param_no_default* - && - (_tmp_132_var = _tmp_132_rule(p)) // slash_with_default | param_with_default+ - && - (param_no_default_var = param_no_default_rule(p)) // param_no_default + (_keyword = _PyPegen_expect_token(p, 526)) // token='class' ) { - D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); + D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); + } + { // '@' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 49)) // token='@' + ) + { + D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); } _res = NULL; done: @@ -14958,9 +17312,9 @@ invalid_parameters_rule(Parser *p) return _res; } -// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT +// _tmp_17: 'with' | ASYNC static void * -invalid_star_etc_rule(Parser *p) +_tmp_17_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -14969,62 +17323,43 @@ invalid_star_etc_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '*' (')' | ',' (')' | '**')) + { // 'with' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); - Token * _literal; - void *_tmp_133_var; + D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); + Token * _keyword; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (_tmp_133_var = _tmp_133_rule(p)) // ')' | ',' (')' | '**') + (_keyword = _PyPegen_expect_token(p, 519)) // token='with' ) { - D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); - _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); + D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); } - { // '*' ',' TYPE_COMMENT + { // ASYNC if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); - Token * _literal; - Token * _literal_1; - Token * type_comment_var; + D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); + Token * async_var; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' - && - (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' + (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' ) { - D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); - _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); + _res = async_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); + D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); } _res = NULL; done: @@ -15032,9 +17367,9 @@ invalid_star_etc_rule(Parser *p) return _res; } -// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) +// _tmp_18: 'for' | ASYNC static void * -invalid_lambda_star_etc_rule(Parser *p) +_tmp_18_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15043,32 +17378,43 @@ invalid_lambda_star_etc_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '*' (':' | ',' (':' | '**')) + { // 'for' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); - Token * _literal; - void *_tmp_134_var; + D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); + Token * _keyword; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (_tmp_134_var = _tmp_134_rule(p)) // ':' | ',' (':' | '**') + (_keyword = _PyPegen_expect_token(p, 517)) // token='for' ) { - D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); - _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); + _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); + D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); + } + { // ASYNC + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); + Token * async_var; + if ( + (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' + ) + { + D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); + _res = async_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); } _res = NULL; done: @@ -15076,9 +17422,9 @@ invalid_lambda_star_etc_rule(Parser *p) return _res; } -// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT +// _tmp_19: '=' annotated_rhs static void * -invalid_double_type_comments_rule(Parser *p) +_tmp_19_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15087,31 +17433,22 @@ invalid_double_type_comments_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT + { // '=' annotated_rhs if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); - Token * indent_var; - Token * newline_var; - Token * newline_var_1; - Token * type_comment_var; - Token * type_comment_var_1; + D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + Token * _literal; + expr_ty d; if ( - (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' - && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - && - (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' - && - (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' + (d = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); - _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); + D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -15120,8 +17457,8 @@ invalid_double_type_comments_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); + D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; done: @@ -15129,9 +17466,9 @@ invalid_double_type_comments_rule(Parser *p) return _res; } -// invalid_del_target: star_expression &del_target_end +// _tmp_20: '(' single_target ')' | single_subscript_attribute_target static void * -invalid_del_target_rule(Parser *p) +_tmp_20_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15140,21 +17477,25 @@ invalid_del_target_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // star_expression &del_target_end + { // '(' single_target ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); - expr_ty a; + D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); + Token * _literal; + Token * _literal_1; + expr_ty b; if ( - (a = star_expression_rule(p)) // star_expression + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - _PyPegen_lookahead(1, del_target_end_rule, p) + (b = single_target_rule(p)) // single_target + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ invalid_del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression &del_target_end")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot delete %s" , _PyPegen_get_expr_name ( a ) ); + D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); + _res = b; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -15163,8 +17504,27 @@ invalid_del_target_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_del_target[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression &del_target_end")); + D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); + } + { // single_subscript_attribute_target + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); + expr_ty single_subscript_attribute_target_var; + if ( + (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target + ) + { + D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); + _res = single_subscript_attribute_target_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); } _res = NULL; done: @@ -15172,9 +17532,9 @@ invalid_del_target_rule(Parser *p) return _res; } -// invalid_import_from_targets: import_from_as_names ',' +// _tmp_21: '=' annotated_rhs static void * -invalid_import_from_targets_rule(Parser *p) +_tmp_21_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15183,22 +17543,22 @@ invalid_import_from_targets_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // import_from_as_names ',' + { // '=' annotated_rhs if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); + D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; - asdl_seq* import_from_as_names_var; + expr_ty d; if ( - (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names + (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (d = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','")); - _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); + D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -15207,8 +17567,8 @@ invalid_import_from_targets_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); + D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; done: @@ -15216,9 +17576,9 @@ invalid_import_from_targets_rule(Parser *p) return _res; } -// _loop0_1: NEWLINE +// _loop1_22: (star_targets '=') static asdl_seq * -_loop0_1_rule(Parser *p) +_loop1_22_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15237,18 +17597,18 @@ _loop0_1_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // NEWLINE + { // (star_targets '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); - Token * newline_var; + D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_160_var; while ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (_tmp_160_var = _tmp_160_rule(p)) // star_targets '=' ) { - _res = newline_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -15264,8 +17624,13 @@ _loop0_1_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15277,80 +17642,124 @@ _loop0_1_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); D(p->level--); return _seq; } -// _loop0_2: NEWLINE -static asdl_seq * -_loop0_2_rule(Parser *p) +// _tmp_23: yield_expr | star_expressions +static void * +_tmp_23_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + { // yield_expr + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + expr_ty yield_expr_var; + if ( + (yield_expr_var = yield_expr_rule(p)) // yield_expr + ) + { + D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + _res = yield_expr_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // NEWLINE + { // star_expressions if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); - Token * newline_var; - while ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + expr_ty star_expressions_var; + if ( + (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - _res = newline_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + _res = star_expressions_var; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_24: yield_expr | star_expressions +static void * +_tmp_24_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { D(p->level--); return NULL; } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); + void * _res = NULL; + int _mark = p->mark; + { // yield_expr + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + expr_ty yield_expr_var; + if ( + (yield_expr_var = yield_expr_rule(p)) // yield_expr + ) + { + D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + _res = yield_expr_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); + } + { // star_expressions + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + expr_ty star_expressions_var; + if ( + (star_expressions_var = star_expressions_rule(p)) // star_expressions + ) + { + D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + _res = star_expressions_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); + } + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _loop0_4: ',' expression +// _loop0_26: ',' NAME static asdl_seq * -_loop0_4_rule(Parser *p) +_loop0_26_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15369,18 +17778,18 @@ _loop0_4_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' expression + { // ',' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = expression_rule(p)) // expression + (elem = _PyPegen_name_token(p)) // NAME ) { _res = elem; @@ -15405,8 +17814,8 @@ _loop0_4_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15418,14 +17827,14 @@ _loop0_4_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); D(p->level--); return _seq; } -// _gather_3: expression _loop0_4 +// _gather_25: NAME _loop0_26 static asdl_seq * -_gather_3_rule(Parser *p) +_gather_25_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15434,27 +17843,27 @@ _gather_3_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_4 + { // NAME _loop0_26 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); + D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); expr_ty elem; asdl_seq * seq; if ( - (elem = expression_rule(p)) // expression + (elem = _PyPegen_name_token(p)) // NAME && - (seq = _loop0_4_rule(p)) // _loop0_4 + (seq = _loop0_26_rule(p)) // _loop0_26 ) { - D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4")); + D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); + D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); } _res = NULL; done: @@ -15462,9 +17871,9 @@ _gather_3_rule(Parser *p) return _res; } -// _loop0_6: ',' expression +// _loop0_28: ',' NAME static asdl_seq * -_loop0_6_rule(Parser *p) +_loop0_28_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15483,18 +17892,18 @@ _loop0_6_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' expression + { // ',' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = expression_rule(p)) // expression + (elem = _PyPegen_name_token(p)) // NAME ) { _res = elem; @@ -15519,8 +17928,8 @@ _loop0_6_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15532,14 +17941,14 @@ _loop0_6_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); D(p->level--); return _seq; } -// _gather_5: expression _loop0_6 +// _gather_27: NAME _loop0_28 static asdl_seq * -_gather_5_rule(Parser *p) +_gather_27_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15548,27 +17957,27 @@ _gather_5_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_6 + { // NAME _loop0_28 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); + D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); expr_ty elem; asdl_seq * seq; if ( - (elem = expression_rule(p)) // expression + (elem = _PyPegen_name_token(p)) // NAME && - (seq = _loop0_6_rule(p)) // _loop0_6 + (seq = _loop0_28_rule(p)) // _loop0_28 ) { - D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6")); + D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); + D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); } _res = NULL; done: @@ -15576,9 +17985,53 @@ _gather_5_rule(Parser *p) return _res; } -// _loop0_8: ',' expression +// _tmp_29: ',' expression +static void * +_tmp_29_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ',' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + Token * _literal; + expr_ty z; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (z = expression_rule(p)) // expression + ) + { + D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_30: ('.' | '...') static asdl_seq * -_loop0_8_rule(Parser *p) +_loop0_30_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15597,27 +18050,18 @@ _loop0_8_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' expression + { // ('.' | '...') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); - Token * _literal; - expr_ty elem; + D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); + void *_tmp_161_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = expression_rule(p)) // expression + (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -15633,8 +18077,8 @@ _loop0_8_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15646,53 +18090,85 @@ _loop0_8_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); D(p->level--); return _seq; } -// _gather_7: expression _loop0_8 +// _loop1_31: ('.' | '...') static asdl_seq * -_gather_7_rule(Parser *p) +_loop1_31_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // expression _loop0_8 + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ('.' | '...') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = expression_rule(p)) // expression - && - (seq = _loop0_8_rule(p)) // _loop0_8 + D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); + void *_tmp_162_var; + while ( + (_tmp_162_var = _tmp_162_rule(p)) // '.' | '...' ) { - D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; + _res = _tmp_162_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); + D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); } - _res = NULL; - done: + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); D(p->level--); - return _res; + return _seq; } -// _loop0_10: ',' expression +// _loop0_33: ',' import_from_as_name static asdl_seq * -_loop0_10_rule(Parser *p) +_loop0_33_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15711,18 +18187,18 @@ _loop0_10_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' expression + { // ',' import_from_as_name if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); Token * _literal; - expr_ty elem; + alias_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = expression_rule(p)) // expression + (elem = import_from_as_name_rule(p)) // import_from_as_name ) { _res = elem; @@ -15747,8 +18223,8 @@ _loop0_10_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15760,14 +18236,14 @@ _loop0_10_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); D(p->level--); return _seq; } -// _gather_9: expression _loop0_10 +// _gather_32: import_from_as_name _loop0_33 static asdl_seq * -_gather_9_rule(Parser *p) +_gather_32_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15776,27 +18252,27 @@ _gather_9_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_10 + { // import_from_as_name _loop0_33 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); + alias_ty elem; asdl_seq * seq; if ( - (elem = expression_rule(p)) // expression + (elem = import_from_as_name_rule(p)) // import_from_as_name && - (seq = _loop0_10_rule(p)) // _loop0_10 + (seq = _loop0_33_rule(p)) // _loop0_33 ) { - D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10")); + D(fprintf(stderr, "%*c+ _gather_32[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); + D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_33")); } _res = NULL; done: @@ -15804,80 +18280,53 @@ _gather_9_rule(Parser *p) return _res; } -// _loop1_11: statement -static asdl_seq * -_loop1_11_rule(Parser *p) +// _tmp_34: 'as' NAME +static void * +_tmp_34_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // statement + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement")); - asdl_seq* statement_var; - while ( - (statement_var = statement_rule(p)) // statement - ) - { - _res = statement_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; + D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - _children[_n++] = _res; - _mark = p->mark; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _loop0_13: ';' small_stmt +// _loop0_36: ',' dotted_as_name static asdl_seq * -_loop0_13_rule(Parser *p) +_loop0_36_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15896,18 +18345,18 @@ _loop0_13_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ';' small_stmt + { // ',' dotted_as_name if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt")); + D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); Token * _literal; - stmt_ty elem; + alias_ty elem; while ( - (_literal = _PyPegen_expect_token(p, 13)) // token=';' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = small_stmt_rule(p)) // small_stmt + (elem = dotted_as_name_rule(p)) // dotted_as_name ) { _res = elem; @@ -15932,8 +18381,8 @@ _loop0_13_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt")); + D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -15945,14 +18394,14 @@ _loop0_13_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); D(p->level--); return _seq; } -// _gather_12: small_stmt _loop0_13 +// _gather_35: dotted_as_name _loop0_36 static asdl_seq * -_gather_12_rule(Parser *p) +_gather_35_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -15961,27 +18410,27 @@ _gather_12_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // small_stmt _loop0_13 + { // dotted_as_name _loop0_36 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); - stmt_ty elem; + D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); + alias_ty elem; asdl_seq * seq; if ( - (elem = small_stmt_rule(p)) // small_stmt + (elem = dotted_as_name_rule(p)) // dotted_as_name && - (seq = _loop0_13_rule(p)) // _loop0_13 + (seq = _loop0_36_rule(p)) // _loop0_36 ) { - D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); + D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13")); + D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); } _res = NULL; done: @@ -15989,9 +18438,9 @@ _gather_12_rule(Parser *p) return _res; } -// _tmp_14: 'import' | 'from' +// _tmp_37: 'as' NAME static void * -_tmp_14_rule(Parser *p) +_tmp_37_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16000,43 +18449,32 @@ _tmp_14_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'import' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); - Token * _keyword; - if ( - (_keyword = _PyPegen_expect_token(p, 513)) // token='import' - ) - { - D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); - _res = _keyword; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); - } - { // 'from' + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); + D(fprintf(stderr, "%*c> _tmp_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; + expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 514)) // token='from' + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); - _res = _keyword; + D(fprintf(stderr, "%*c+ _tmp_37[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); + D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; done: @@ -16044,128 +18482,113 @@ _tmp_14_rule(Parser *p) return _res; } -// _tmp_15: 'def' | '@' | ASYNC -static void * -_tmp_15_rule(Parser *p) +// _loop0_39: ',' with_item +static asdl_seq * +_loop0_39_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // 'def' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); - Token * _keyword; - if ( - (_keyword = _PyPegen_expect_token(p, 522)) // token='def' - ) - { - D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); - _res = _keyword; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; } - { // '@' + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); + D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 49)) // token='@' + withitem_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = with_item_rule(p)) // with_item ) { - D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); - _res = _literal; - goto done; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); + D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } - { // ASYNC - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); - Token * async_var; - if ( - (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' - ) - { - D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); - _res = async_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; } - _res = NULL; - done: + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_16: 'class' | '@' -static void * -_tmp_16_rule(Parser *p) +// _gather_38: with_item _loop0_39 +static asdl_seq * +_gather_38_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; - int _mark = p->mark; - { // 'class' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); - Token * _keyword; - if ( - (_keyword = _PyPegen_expect_token(p, 523)) // token='class' - ) - { - D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); - _res = _keyword; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); - } - { // '@' + asdl_seq * _res = NULL; + int _mark = p->mark; + { // with_item _loop0_39 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); - Token * _literal; + D(fprintf(stderr, "%*c> _gather_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); + withitem_ty elem; + asdl_seq * seq; if ( - (_literal = _PyPegen_expect_token(p, 49)) // token='@' + (elem = with_item_rule(p)) // with_item + && + (seq = _loop0_39_rule(p)) // _loop0_39 ) { - D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _gather_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); + D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); } _res = NULL; done: @@ -16173,54 +18596,113 @@ _tmp_16_rule(Parser *p) return _res; } -// _tmp_17: 'with' | ASYNC -static void * -_tmp_17_rule(Parser *p) +// _loop0_41: ',' with_item +static asdl_seq * +_loop0_41_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // 'with' + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); - Token * _keyword; - if ( - (_keyword = _PyPegen_expect_token(p, 519)) // token='with' + D(fprintf(stderr, "%*c> _loop0_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + Token * _literal; + withitem_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = with_item_rule(p)) // with_item ) { - D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); - _res = _keyword; - goto done; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); + D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } - { // ASYNC + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_40: with_item _loop0_41 +static asdl_seq * +_gather_40_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // with_item _loop0_41 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); - Token * async_var; + D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); + withitem_ty elem; + asdl_seq * seq; if ( - (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' + (elem = with_item_rule(p)) // with_item + && + (seq = _loop0_41_rule(p)) // _loop0_41 ) { - D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); - _res = async_var; + D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); + D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); } _res = NULL; done: @@ -16228,54 +18710,113 @@ _tmp_17_rule(Parser *p) return _res; } -// _tmp_18: 'for' | ASYNC -static void * -_tmp_18_rule(Parser *p) +// _loop0_43: ',' with_item +static asdl_seq * +_loop0_43_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // 'for' + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); - Token * _keyword; - if ( - (_keyword = _PyPegen_expect_token(p, 517)) // token='for' + D(fprintf(stderr, "%*c> _loop0_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + Token * _literal; + withitem_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = with_item_rule(p)) // with_item ) { - D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); - _res = _keyword; - goto done; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); + D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } - { // ASYNC + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_42: with_item _loop0_43 +static asdl_seq * +_gather_42_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // with_item _loop0_43 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC")); - Token * async_var; + D(fprintf(stderr, "%*c> _gather_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); + withitem_ty elem; + asdl_seq * seq; if ( - (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' + (elem = with_item_rule(p)) // with_item + && + (seq = _loop0_43_rule(p)) // _loop0_43 ) { - D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); - _res = async_var; + D(fprintf(stderr, "%*c+ _gather_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); + D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); } _res = NULL; done: @@ -16283,109 +18824,113 @@ _tmp_18_rule(Parser *p) return _res; } -// _tmp_19: '=' annotated_rhs -static void * -_tmp_19_rule(Parser *p) +// _loop0_45: ',' with_item +static asdl_seq * +_loop0_45_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // '=' annotated_rhs + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _loop0_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); Token * _literal; - expr_ty d; - if ( - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + withitem_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (d = annotated_rhs_rule(p)) // annotated_rhs + (elem = with_item_rule(p)) // with_item ) { - D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); - _res = d; + _res = elem; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; + PyMem_Free(_children); D(p->level--); return NULL; } - goto done; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } - _res = NULL; - done: + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_20: '(' single_target ')' | single_subscript_attribute_target -static void * -_tmp_20_rule(Parser *p) +// _gather_44: with_item _loop0_45 +static asdl_seq * +_gather_44_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // '(' single_target ')' + { // with_item _loop0_45 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); - Token * _literal; - Token * _literal_1; - expr_ty b; + D(fprintf(stderr, "%*c> _gather_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); + withitem_ty elem; + asdl_seq * seq; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (b = single_target_rule(p)) // single_target + (elem = with_item_rule(p)) // with_item && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' - ) - { - D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); - _res = b; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); - } - { // single_subscript_attribute_target - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); - expr_ty single_subscript_attribute_target_var; - if ( - (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target + (seq = _loop0_45_rule(p)) // _loop0_45 ) { - D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); - _res = single_subscript_attribute_target_var; + D(fprintf(stderr, "%*c+ _gather_44[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); + D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); } _res = NULL; done: @@ -16393,9 +18938,9 @@ _tmp_20_rule(Parser *p) return _res; } -// _tmp_21: '=' annotated_rhs +// _tmp_46: 'as' target static void * -_tmp_21_rule(Parser *p) +_tmp_46_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16404,22 +18949,22 @@ _tmp_21_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '=' annotated_rhs + { // 'as' target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); - Token * _literal; - expr_ty d; + D(fprintf(stderr, "%*c> _tmp_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' target")); + Token * _keyword; + expr_ty t; if ( - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' && - (d = annotated_rhs_rule(p)) // annotated_rhs + (t = target_rule(p)) // target ) { - D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); - _res = d; + D(fprintf(stderr, "%*c+ _tmp_46[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' target")); + _res = t; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -16428,8 +18973,8 @@ _tmp_21_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); } _res = NULL; done: @@ -16437,9 +18982,9 @@ _tmp_21_rule(Parser *p) return _res; } -// _loop1_22: (star_targets '=') +// _loop1_47: except_block static asdl_seq * -_loop1_22_rule(Parser *p) +_loop1_47_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16458,18 +19003,18 @@ _loop1_22_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (star_targets '=') + { // except_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_135_var; + D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); + excepthandler_ty except_block_var; while ( - (_tmp_135_var = _tmp_135_rule(p)) // star_targets '=' + (except_block_var = except_block_rule(p)) // except_block ) { - _res = _tmp_135_var; + _res = except_block_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -16485,8 +19030,8 @@ _loop1_22_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); + D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -16503,69 +19048,14 @@ _loop1_22_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); D(p->level--); return _seq; } -// _tmp_23: yield_expr | star_expressions -static void * -_tmp_23_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // yield_expr - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); - expr_ty yield_expr_var; - if ( - (yield_expr_var = yield_expr_rule(p)) // yield_expr - ) - { - D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); - _res = yield_expr_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); - } - { // star_expressions - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); - expr_ty star_expressions_var; - if ( - (star_expressions_var = star_expressions_rule(p)) // star_expressions - ) - { - D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); - _res = star_expressions_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_24: yield_expr | star_expressions +// _tmp_48: 'as' NAME static void * -_tmp_24_rule(Parser *p) +_tmp_48_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16574,43 +19064,32 @@ _tmp_24_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // yield_expr - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); - expr_ty yield_expr_var; - if ( - (yield_expr_var = yield_expr_rule(p)) // yield_expr - ) - { - D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); - _res = yield_expr_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); - } - { // star_expressions + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); - expr_ty star_expressions_var; + D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; if ( - (star_expressions_var = star_expressions_rule(p)) // star_expressions + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); - _res = star_expressions_var; + D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; done: @@ -16618,9 +19097,9 @@ _tmp_24_rule(Parser *p) return _res; } -// _loop0_26: ',' NAME +// _loop1_49: case_block static asdl_seq * -_loop0_26_rule(Parser *p) +_loop1_49_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16639,27 +19118,18 @@ _loop0_26_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' NAME + { // case_block if (p->error_indicator) { D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = _PyPegen_name_token(p)) // NAME - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + return NULL; + } + D(fprintf(stderr, "%*c> _loop1_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); + void *case_block_var; + while ( + (case_block_var = case_block_rule(p)) // case_block + ) + { + _res = case_block_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -16675,8 +19145,13 @@ _loop0_26_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); + D(fprintf(stderr, "%*c%s _loop1_49[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -16688,43 +19163,48 @@ _loop0_26_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_49_type, _seq); D(p->level--); return _seq; } -// _gather_25: NAME _loop0_26 -static asdl_seq * -_gather_25_rule(Parser *p) +// _tmp_50: 'if' named_expression +static void * +_tmp_50_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // NAME _loop0_26 + { // 'if' named_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); - expr_ty elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + Token * _keyword; + expr_ty a; if ( - (elem = _PyPegen_name_token(p)) // NAME + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' && - (seq = _loop0_26_rule(p)) // _loop0_26 + (a = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + _res = a; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); + D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); } _res = NULL; done: @@ -16732,9 +19212,9 @@ _gather_25_rule(Parser *p) return _res; } -// _loop0_28: ',' NAME +// _loop0_52: '|' closed_pattern static asdl_seq * -_loop0_28_rule(Parser *p) +_loop0_52_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16753,18 +19233,18 @@ _loop0_28_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' NAME + { // '|' closed_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); + D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); Token * _literal; - expr_ty elem; + void *elem; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 18)) // token='|' && - (elem = _PyPegen_name_token(p)) // NAME + (elem = closed_pattern_rule(p)) // closed_pattern ) { _res = elem; @@ -16789,8 +19269,8 @@ _loop0_28_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); + D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -16802,14 +19282,14 @@ _loop0_28_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq); D(p->level--); return _seq; } -// _gather_27: NAME _loop0_28 +// _gather_51: closed_pattern _loop0_52 static asdl_seq * -_gather_27_rule(Parser *p) +_gather_51_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16818,27 +19298,27 @@ _gather_27_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // NAME _loop0_28 + { // closed_pattern _loop0_52 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); + void *elem; asdl_seq * seq; if ( - (elem = _PyPegen_name_token(p)) // NAME + (elem = closed_pattern_rule(p)) // closed_pattern && - (seq = _loop0_28_rule(p)) // _loop0_28 + (seq = _loop0_52_rule(p)) // _loop0_52 ) { - D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); + D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); + D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52")); } _res = NULL; done: @@ -16846,9 +19326,9 @@ _gather_27_rule(Parser *p) return _res; } -// _tmp_29: ',' expression +// _tmp_53: '.' | '(' static void * -_tmp_29_rule(Parser *p) +_tmp_53_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16857,32 +19337,43 @@ _tmp_29_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' expression + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; - expr_ty z; if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (z = expression_rule(p)) // expression + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + ) + { + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } _res = NULL; done: @@ -16890,9 +19381,9 @@ _tmp_29_rule(Parser *p) return _res; } -// _loop0_30: ('.' | '...') +// _loop0_55: '.' NAME static asdl_seq * -_loop0_30_rule(Parser *p) +_loop0_55_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16911,18 +19402,27 @@ _loop0_30_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ('.' | '...') + { // '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_136_var; + D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + Token * _literal; + expr_ty elem; while ( - (_tmp_136_var = _tmp_136_rule(p)) // '.' | '...' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (elem = _PyPegen_name_token(p)) // NAME ) { - _res = _tmp_136_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -16938,8 +19438,8 @@ _loop0_30_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); + D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -16951,14 +19451,53 @@ _loop0_30_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); D(p->level--); return _seq; } -// _loop1_31: ('.' | '...') +// _gather_54: NAME _loop0_55 static asdl_seq * -_loop1_31_rule(Parser *p) +_gather_54_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // NAME _loop0_55 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_55")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = _PyPegen_name_token(p)) // NAME + && + (seq = _loop0_55_rule(p)) // _loop0_55 + ) + { + D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_55")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_55")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_57: ',' pattern +static asdl_seq * +_loop0_57_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -16977,18 +19516,27 @@ _loop1_31_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ('.' | '...') + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_137_var; + D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + Token * _literal; + void *elem; while ( - (_tmp_137_var = _tmp_137_rule(p)) // '.' | '...' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = pattern_rule(p)) // pattern ) { - _res = _tmp_137_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17004,13 +19552,8 @@ _loop1_31_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17022,14 +19565,53 @@ _loop1_31_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); D(p->level--); return _seq; } -// _loop0_33: ',' import_from_as_name +// _gather_56: pattern _loop0_57 static asdl_seq * -_loop0_33_rule(Parser *p) +_gather_56_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // pattern _loop0_57 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); + void *elem; + asdl_seq * seq; + if ( + (elem = pattern_rule(p)) // pattern + && + (seq = _loop0_57_rule(p)) // _loop0_57 + ) + { + D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_57")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_59: ',' pattern +static asdl_seq * +_loop0_59_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17048,18 +19630,18 @@ _loop0_33_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' import_from_as_name + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); + D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; - alias_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = import_from_as_name_rule(p)) // import_from_as_name + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -17084,8 +19666,8 @@ _loop0_33_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); + D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17097,14 +19679,14 @@ _loop0_33_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_59_type, _seq); D(p->level--); return _seq; } -// _gather_32: import_from_as_name _loop0_33 +// _gather_58: pattern _loop0_59 static asdl_seq * -_gather_32_rule(Parser *p) +_gather_58_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17113,71 +19695,27 @@ _gather_32_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // import_from_as_name _loop0_33 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); - alias_ty elem; - asdl_seq * seq; - if ( - (elem = import_from_as_name_rule(p)) // import_from_as_name - && - (seq = _loop0_33_rule(p)) // _loop0_33 - ) - { - D(fprintf(stderr, "%*c+ _gather_32[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_33")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_34: 'as' NAME -static void * -_tmp_34_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'as' NAME + { // pattern _loop0_59 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; + D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); + void *elem; + asdl_seq * seq; if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + (elem = pattern_rule(p)) // pattern && - (z = _PyPegen_name_token(p)) // NAME + (seq = _loop0_59_rule(p)) // _loop0_59 ) { - D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_59")); } _res = NULL; done: @@ -17185,9 +19723,9 @@ _tmp_34_rule(Parser *p) return _res; } -// _loop0_36: ',' dotted_as_name +// _loop0_61: ',' (key_pattern ':' closed_pattern) static asdl_seq * -_loop0_36_rule(Parser *p) +_loop0_61_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17206,18 +19744,18 @@ _loop0_36_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' dotted_as_name + { // ',' (key_pattern ':' closed_pattern) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); + D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (key_pattern ':' closed_pattern)")); Token * _literal; - alias_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = dotted_as_name_rule(p)) // dotted_as_name + (elem = _tmp_163_rule(p)) // key_pattern ':' closed_pattern ) { _res = elem; @@ -17242,8 +19780,8 @@ _loop0_36_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); + D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (key_pattern ':' closed_pattern)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17255,14 +19793,14 @@ _loop0_36_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); D(p->level--); return _seq; } -// _gather_35: dotted_as_name _loop0_36 +// _gather_60: (key_pattern ':' closed_pattern) _loop0_61 static asdl_seq * -_gather_35_rule(Parser *p) +_gather_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17271,27 +19809,27 @@ _gather_35_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // dotted_as_name _loop0_36 + { // (key_pattern ':' closed_pattern) _loop0_61 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); - alias_ty elem; + D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); + void *elem; asdl_seq * seq; if ( - (elem = dotted_as_name_rule(p)) // dotted_as_name + (elem = _tmp_163_rule(p)) // key_pattern ':' closed_pattern && - (seq = _loop0_36_rule(p)) // _loop0_36 + (seq = _loop0_61_rule(p)) // _loop0_61 ) { - D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); + D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); + D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); } _res = NULL; done: @@ -17299,43 +19837,113 @@ _gather_35_rule(Parser *p) return _res; } -// _tmp_37: 'as' NAME -static void * -_tmp_37_rule(Parser *p) +// _loop0_63: '|' literal_pattern +static asdl_seq * +_loop0_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // 'as' NAME + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // '|' literal_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' literal_pattern")); + Token * _literal; + void *elem; + while ( + (_literal = _PyPegen_expect_token(p, 18)) // token='|' && - (z = _PyPegen_name_token(p)) // NAME + (elem = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_37[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = z; + _res = elem; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; + PyMem_Free(_children); D(p->level--); return NULL; } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' literal_pattern")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_62: literal_pattern _loop0_63 +static asdl_seq * +_gather_62_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // literal_pattern _loop0_63 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern _loop0_63")); + void *elem; + asdl_seq * seq; + if ( + (elem = literal_pattern_rule(p)) // literal_pattern + && + (seq = _loop0_63_rule(p)) // _loop0_63 + ) + { + D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern _loop0_63")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern _loop0_63")); } _res = NULL; done: @@ -17343,9 +19951,9 @@ _tmp_37_rule(Parser *p) return _res; } -// _loop0_39: ',' with_item +// _loop0_65: '.' NAME static asdl_seq * -_loop0_39_rule(Parser *p) +_loop0_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17364,18 +19972,18 @@ _loop0_39_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); Token * _literal; - withitem_ty elem; + expr_ty elem; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (elem = with_item_rule(p)) // with_item + (elem = _PyPegen_name_token(p)) // NAME ) { _res = elem; @@ -17400,8 +20008,8 @@ _loop0_39_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17413,14 +20021,14 @@ _loop0_39_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); D(p->level--); return _seq; } -// _gather_38: with_item _loop0_39 +// _gather_64: NAME _loop0_65 static asdl_seq * -_gather_38_rule(Parser *p) +_gather_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17429,27 +20037,27 @@ _gather_38_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_39 + { // NAME _loop0_65 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_65")); + expr_ty elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = _PyPegen_name_token(p)) // NAME && - (seq = _loop0_39_rule(p)) // _loop0_39 + (seq = _loop0_65_rule(p)) // _loop0_65 ) { - D(fprintf(stderr, "%*c+ _gather_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); + D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_65")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); + D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_65")); } _res = NULL; done: @@ -17457,9 +20065,9 @@ _gather_38_rule(Parser *p) return _res; } -// _loop0_41: ',' with_item +// _loop0_67: ',' pattern static asdl_seq * -_loop0_41_rule(Parser *p) +_loop0_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17478,18 +20086,18 @@ _loop0_41_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; - withitem_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = with_item_rule(p)) // with_item + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -17514,8 +20122,8 @@ _loop0_41_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_67[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17527,14 +20135,14 @@ _loop0_41_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_67_type, _seq); D(p->level--); return _seq; } -// _gather_40: with_item _loop0_41 +// _gather_66: pattern _loop0_67 static asdl_seq * -_gather_40_rule(Parser *p) +_gather_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17543,27 +20151,27 @@ _gather_40_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_41 + { // pattern _loop0_67 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_67")); + void *elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = pattern_rule(p)) // pattern && - (seq = _loop0_41_rule(p)) // _loop0_41 + (seq = _loop0_67_rule(p)) // _loop0_67 ) { - D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); + D(fprintf(stderr, "%*c+ _gather_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_67")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); + D(fprintf(stderr, "%*c%s _gather_66[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_67")); } _res = NULL; done: @@ -17571,9 +20179,9 @@ _gather_40_rule(Parser *p) return _res; } -// _loop0_43: ',' with_item +// _loop0_69: ',' (NAME '=' or_pattern) static asdl_seq * -_loop0_43_rule(Parser *p) +_loop0_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17592,18 +20200,18 @@ _loop0_43_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ',' (NAME '=' or_pattern) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (NAME '=' or_pattern)")); Token * _literal; - withitem_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = with_item_rule(p)) // with_item + (elem = _tmp_164_rule(p)) // NAME '=' or_pattern ) { _res = elem; @@ -17628,8 +20236,8 @@ _loop0_43_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (NAME '=' or_pattern)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17641,14 +20249,14 @@ _loop0_43_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); D(p->level--); return _seq; } -// _gather_42: with_item _loop0_43 +// _gather_68: (NAME '=' or_pattern) _loop0_69 static asdl_seq * -_gather_42_rule(Parser *p) +_gather_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17657,27 +20265,27 @@ _gather_42_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_43 + { // (NAME '=' or_pattern) _loop0_69 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); + void *elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = _tmp_164_rule(p)) // NAME '=' or_pattern && - (seq = _loop0_43_rule(p)) // _loop0_43 + (seq = _loop0_69_rule(p)) // _loop0_69 ) { - D(fprintf(stderr, "%*c+ _gather_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); + D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); + D(fprintf(stderr, "%*c%s _gather_68[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); } _res = NULL; done: @@ -17685,9 +20293,9 @@ _gather_42_rule(Parser *p) return _res; } -// _loop0_45: ',' with_item +// _loop0_71: ',' (NAME '=' or_pattern) static asdl_seq * -_loop0_45_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17706,18 +20314,18 @@ _loop0_45_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ',' (NAME '=' or_pattern) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (NAME '=' or_pattern)")); Token * _literal; - withitem_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = with_item_rule(p)) // with_item + (elem = _tmp_165_rule(p)) // NAME '=' or_pattern ) { _res = elem; @@ -17742,8 +20350,8 @@ _loop0_45_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (NAME '=' or_pattern)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17755,14 +20363,14 @@ _loop0_45_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _gather_44: with_item _loop0_45 +// _gather_70: (NAME '=' or_pattern) _loop0_71 static asdl_seq * -_gather_44_rule(Parser *p) +_gather_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17771,71 +20379,27 @@ _gather_44_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_45 + { // (NAME '=' or_pattern) _loop0_71 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); + void *elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = _tmp_165_rule(p)) // NAME '=' or_pattern && - (seq = _loop0_45_rule(p)) // _loop0_45 + (seq = _loop0_71_rule(p)) // _loop0_71 ) { - D(fprintf(stderr, "%*c+ _gather_44[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); + D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_46: 'as' target -static void * -_tmp_46_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'as' target - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' target")); - Token * _keyword; - expr_ty t; - if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' - && - (t = target_rule(p)) // target - ) - { - D(fprintf(stderr, "%*c+ _tmp_46[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' target")); - _res = t; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); + D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); } _res = NULL; done: @@ -17843,9 +20407,9 @@ _tmp_46_rule(Parser *p) return _res; } -// _loop1_47: except_block +// _loop0_73: ',' pattern static asdl_seq * -_loop1_47_rule(Parser *p) +_loop0_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17864,18 +20428,27 @@ _loop1_47_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // except_block + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); - excepthandler_ty except_block_var; + D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + Token * _literal; + void *elem; while ( - (except_block_var = except_block_rule(p)) // except_block + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = pattern_rule(p)) // pattern ) { - _res = except_block_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17891,13 +20464,8 @@ _loop1_47_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -17909,48 +20477,43 @@ _loop1_47_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); D(p->level--); return _seq; } -// _tmp_48: 'as' NAME -static void * -_tmp_48_rule(Parser *p) +// _gather_72: pattern _loop0_73 +static asdl_seq * +_gather_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // 'as' NAME + { // pattern _loop0_73 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; + D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_73")); + void *elem; + asdl_seq * seq; if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + (elem = pattern_rule(p)) // pattern && - (z = _PyPegen_name_token(p)) // NAME + (seq = _loop0_73_rule(p)) // _loop0_73 ) { - D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_73")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_73")); } _res = NULL; done: @@ -17958,9 +20521,9 @@ _tmp_48_rule(Parser *p) return _res; } -// _tmp_49: 'from' expression +// _tmp_74: 'from' expression static void * -_tmp_49_rule(Parser *p) +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -17974,7 +20537,7 @@ _tmp_49_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); Token * _keyword; expr_ty z; if ( @@ -17983,7 +20546,7 @@ _tmp_49_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -17993,7 +20556,7 @@ _tmp_49_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -18002,9 +20565,9 @@ _tmp_49_rule(Parser *p) return _res; } -// _tmp_50: '->' expression +// _tmp_75: '->' expression static void * -_tmp_50_rule(Parser *p) +_tmp_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18018,7 +20581,7 @@ _tmp_50_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -18027,7 +20590,7 @@ _tmp_50_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -18037,7 +20600,7 @@ _tmp_50_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -18046,9 +20609,9 @@ _tmp_50_rule(Parser *p) return _res; } -// _tmp_51: '->' expression +// _tmp_76: '->' expression static void * -_tmp_51_rule(Parser *p) +_tmp_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18062,7 +20625,7 @@ _tmp_51_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -18071,7 +20634,7 @@ _tmp_51_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -18081,7 +20644,7 @@ _tmp_51_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -18090,9 +20653,9 @@ _tmp_51_rule(Parser *p) return _res; } -// _tmp_52: NEWLINE INDENT +// _tmp_77: NEWLINE INDENT static void * -_tmp_52_rule(Parser *p) +_tmp_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18106,7 +20669,7 @@ _tmp_52_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -18115,12 +20678,12 @@ _tmp_52_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -18129,9 +20692,9 @@ _tmp_52_rule(Parser *p) return _res; } -// _loop0_53: param_no_default +// _loop0_78: param_no_default static asdl_seq * -_loop0_53_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18155,7 +20718,7 @@ _loop0_53_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18177,7 +20740,7 @@ _loop0_53_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18190,14 +20753,14 @@ _loop0_53_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_53_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _loop0_54: param_with_default +// _loop0_79: param_with_default static asdl_seq * -_loop0_54_rule(Parser *p) +_loop0_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18221,7 +20784,7 @@ _loop0_54_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18243,7 +20806,7 @@ _loop0_54_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18256,14 +20819,14 @@ _loop0_54_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); D(p->level--); return _seq; } -// _loop0_55: param_with_default +// _loop0_80: param_with_default static asdl_seq * -_loop0_55_rule(Parser *p) +_loop0_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18287,7 +20850,7 @@ _loop0_55_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18309,7 +20872,7 @@ _loop0_55_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18322,14 +20885,14 @@ _loop0_55_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); D(p->level--); return _seq; } -// _loop1_56: param_no_default +// _loop1_81: param_no_default static asdl_seq * -_loop1_56_rule(Parser *p) +_loop1_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18353,7 +20916,7 @@ _loop1_56_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18375,7 +20938,7 @@ _loop1_56_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_56[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -18393,14 +20956,14 @@ _loop1_56_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_56_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); D(p->level--); return _seq; } -// _loop0_57: param_with_default +// _loop0_82: param_with_default static asdl_seq * -_loop0_57_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18424,7 +20987,7 @@ _loop0_57_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18446,7 +21009,7 @@ _loop0_57_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18459,14 +21022,14 @@ _loop0_57_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_58: param_with_default +// _loop1_83: param_with_default static asdl_seq * -_loop1_58_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18490,7 +21053,7 @@ _loop1_58_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18512,7 +21075,7 @@ _loop1_58_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_58[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -18530,14 +21093,14 @@ _loop1_58_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_58_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop1_59: param_no_default +// _loop1_84: param_no_default static asdl_seq * -_loop1_59_rule(Parser *p) +_loop1_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18561,7 +21124,7 @@ _loop1_59_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18583,7 +21146,7 @@ _loop1_59_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -18601,14 +21164,14 @@ _loop1_59_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); D(p->level--); return _seq; } -// _loop1_60: param_no_default +// _loop1_85: param_no_default static asdl_seq * -_loop1_60_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18632,7 +21195,7 @@ _loop1_60_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18654,7 +21217,7 @@ _loop1_60_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -18672,14 +21235,14 @@ _loop1_60_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); D(p->level--); return _seq; } -// _loop0_61: param_no_default +// _loop0_86: param_no_default static asdl_seq * -_loop0_61_rule(Parser *p) +_loop0_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18703,7 +21266,7 @@ _loop0_61_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18725,7 +21288,7 @@ _loop0_61_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18738,14 +21301,14 @@ _loop0_61_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); D(p->level--); return _seq; } -// _loop1_62: param_with_default +// _loop1_87: param_with_default static asdl_seq * -_loop1_62_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18769,7 +21332,7 @@ _loop1_62_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18791,7 +21354,7 @@ _loop1_62_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_62[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -18809,14 +21372,14 @@ _loop1_62_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_62_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop0_63: param_no_default +// _loop0_88: param_no_default static asdl_seq * -_loop0_63_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18840,7 +21403,7 @@ _loop0_63_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -18862,7 +21425,7 @@ _loop0_63_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -18875,14 +21438,14 @@ _loop0_63_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _loop1_64: param_with_default +// _loop1_89: param_with_default static asdl_seq * -_loop1_64_rule(Parser *p) +_loop1_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18906,7 +21469,7 @@ _loop1_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -18928,7 +21491,7 @@ _loop1_64_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -18946,14 +21509,14 @@ _loop1_64_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_64_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); D(p->level--); return _seq; } -// _loop0_65: param_maybe_default +// _loop0_90: param_maybe_default static asdl_seq * -_loop0_65_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18977,7 +21540,7 @@ _loop0_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -18999,7 +21562,7 @@ _loop0_65_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19012,14 +21575,14 @@ _loop0_65_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _loop1_66: param_maybe_default +// _loop1_91: param_maybe_default static asdl_seq * -_loop1_66_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19043,7 +21606,7 @@ _loop1_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -19065,7 +21628,7 @@ _loop1_66_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -19083,14 +21646,14 @@ _loop1_66_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_66_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _loop1_67: ('@' named_expression NEWLINE) +// _loop1_92: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_67_rule(Parser *p) +_loop1_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19114,13 +21677,13 @@ _loop1_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_138_var; + D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_166_var; while ( - (_tmp_138_var = _tmp_138_rule(p)) // '@' named_expression NEWLINE + (_tmp_166_var = _tmp_166_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_138_var; + _res = _tmp_166_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19136,7 +21699,7 @@ _loop1_67_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -19154,14 +21717,14 @@ _loop1_67_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); D(p->level--); return _seq; } -// _tmp_68: '(' arguments? ')' +// _tmp_93: '(' arguments? ')' static void * -_tmp_68_rule(Parser *p) +_tmp_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19175,7 +21738,7 @@ _tmp_68_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -19187,7 +21750,7 @@ _tmp_68_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -19197,7 +21760,7 @@ _tmp_68_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -19206,9 +21769,9 @@ _tmp_68_rule(Parser *p) return _res; } -// _loop0_70: ',' star_expression +// _loop0_95: ',' star_expression static asdl_seq * -_loop0_70_rule(Parser *p) +_loop0_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19232,7 +21795,7 @@ _loop0_70_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -19263,7 +21826,7 @@ _loop0_70_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19276,14 +21839,14 @@ _loop0_70_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); D(p->level--); return _seq; } -// _gather_69: star_expression _loop0_70 +// _gather_94: star_expression _loop0_95 static asdl_seq * -_gather_69_rule(Parser *p) +_gather_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19292,27 +21855,27 @@ _gather_69_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_70 + { // star_expression _loop0_95 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_70")); + D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_70_rule(p)) // _loop0_70 + (seq = _loop0_95_rule(p)) // _loop0_95 ) { - D(fprintf(stderr, "%*c+ _gather_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_70")); + D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_70")); + D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_95")); } _res = NULL; done: @@ -19320,9 +21883,9 @@ _gather_69_rule(Parser *p) return _res; } -// _loop1_71: (',' star_expression) +// _loop1_96: (',' star_expression) static asdl_seq * -_loop1_71_rule(Parser *p) +_loop1_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19346,13 +21909,13 @@ _loop1_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_139_var; + D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_167_var; while ( - (_tmp_139_var = _tmp_139_rule(p)) // ',' star_expression + (_tmp_167_var = _tmp_167_rule(p)) // ',' star_expression ) { - _res = _tmp_139_var; + _res = _tmp_167_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19368,7 +21931,7 @@ _loop1_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -19386,14 +21949,14 @@ _loop1_71_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); D(p->level--); return _seq; } -// _loop0_73: ',' star_named_expression +// _loop0_98: ',' star_named_expression static asdl_seq * -_loop0_73_rule(Parser *p) +_loop0_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19417,7 +21980,7 @@ _loop0_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -19448,7 +22011,7 @@ _loop0_73_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19461,14 +22024,14 @@ _loop0_73_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); D(p->level--); return _seq; } -// _gather_72: star_named_expression _loop0_73 +// _gather_97: star_named_expression _loop0_98 static asdl_seq * -_gather_72_rule(Parser *p) +_gather_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19477,27 +22040,27 @@ _gather_72_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_73 + { // star_named_expression _loop0_98 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_73")); + D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_73_rule(p)) // _loop0_73 + (seq = _loop0_98_rule(p)) // _loop0_98 ) { - D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_73")); + D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_73")); + D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_98")); } _res = NULL; done: @@ -19505,9 +22068,9 @@ _gather_72_rule(Parser *p) return _res; } -// _loop1_74: (',' expression) +// _loop1_99: (',' expression) static asdl_seq * -_loop1_74_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19531,13 +22094,13 @@ _loop1_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_140_var; + D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_168_var; while ( - (_tmp_140_var = _tmp_140_rule(p)) // ',' expression + (_tmp_168_var = _tmp_168_rule(p)) // ',' expression ) { - _res = _tmp_140_var; + _res = _tmp_168_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19553,7 +22116,7 @@ _loop1_74_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -19571,14 +22134,14 @@ _loop1_74_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_74_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop0_75: lambda_param_no_default +// _loop0_100: lambda_param_no_default static asdl_seq * -_loop0_75_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19602,7 +22165,7 @@ _loop0_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -19624,7 +22187,7 @@ _loop0_75_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19637,14 +22200,14 @@ _loop0_75_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop0_76: lambda_param_with_default +// _loop0_101: lambda_param_with_default static asdl_seq * -_loop0_76_rule(Parser *p) +_loop0_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19668,7 +22231,7 @@ _loop0_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -19690,7 +22253,7 @@ _loop0_76_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19703,14 +22266,14 @@ _loop0_76_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); D(p->level--); return _seq; } -// _loop0_77: lambda_param_with_default +// _loop0_102: lambda_param_with_default static asdl_seq * -_loop0_77_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19734,7 +22297,7 @@ _loop0_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -19756,7 +22319,7 @@ _loop0_77_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19769,14 +22332,14 @@ _loop0_77_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop1_78: lambda_param_no_default +// _loop1_103: lambda_param_no_default static asdl_seq * -_loop1_78_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19800,7 +22363,7 @@ _loop1_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -19822,7 +22385,7 @@ _loop1_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -19840,14 +22403,14 @@ _loop1_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop0_79: lambda_param_with_default +// _loop0_104: lambda_param_with_default static asdl_seq * -_loop0_79_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19871,7 +22434,7 @@ _loop0_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -19893,7 +22456,7 @@ _loop0_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -19906,14 +22469,14 @@ _loop0_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_80: lambda_param_with_default +// _loop1_105: lambda_param_with_default static asdl_seq * -_loop1_80_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19937,7 +22500,7 @@ _loop1_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -19959,7 +22522,7 @@ _loop1_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -19977,14 +22540,14 @@ _loop1_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop1_81: lambda_param_no_default +// _loop1_106: lambda_param_no_default static asdl_seq * -_loop1_81_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20008,7 +22571,7 @@ _loop1_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -20030,7 +22593,7 @@ _loop1_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -20048,14 +22611,14 @@ _loop1_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _loop1_82: lambda_param_no_default +// _loop1_107: lambda_param_no_default static asdl_seq * -_loop1_82_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20079,7 +22642,7 @@ _loop1_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -20101,7 +22664,7 @@ _loop1_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -20119,14 +22682,14 @@ _loop1_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop0_83: lambda_param_no_default +// _loop0_108: lambda_param_no_default static asdl_seq * -_loop0_83_rule(Parser *p) +_loop0_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20150,7 +22713,7 @@ _loop0_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -20172,7 +22735,7 @@ _loop0_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20185,14 +22748,14 @@ _loop0_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); D(p->level--); return _seq; } -// _loop1_84: lambda_param_with_default +// _loop1_109: lambda_param_with_default static asdl_seq * -_loop1_84_rule(Parser *p) +_loop1_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20216,7 +22779,7 @@ _loop1_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -20238,7 +22801,7 @@ _loop1_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -20256,14 +22819,14 @@ _loop1_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); D(p->level--); return _seq; } -// _loop0_85: lambda_param_no_default +// _loop0_110: lambda_param_no_default static asdl_seq * -_loop0_85_rule(Parser *p) +_loop0_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20287,7 +22850,7 @@ _loop0_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -20309,7 +22872,7 @@ _loop0_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20322,14 +22885,14 @@ _loop0_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); D(p->level--); return _seq; } -// _loop1_86: lambda_param_with_default +// _loop1_111: lambda_param_with_default static asdl_seq * -_loop1_86_rule(Parser *p) +_loop1_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20353,7 +22916,7 @@ _loop1_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -20375,7 +22938,7 @@ _loop1_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -20393,14 +22956,14 @@ _loop1_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); D(p->level--); return _seq; } -// _loop0_87: lambda_param_maybe_default +// _loop0_112: lambda_param_maybe_default static asdl_seq * -_loop0_87_rule(Parser *p) +_loop0_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20424,7 +22987,7 @@ _loop0_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -20446,7 +23009,7 @@ _loop0_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20459,14 +23022,14 @@ _loop0_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); D(p->level--); return _seq; } -// _loop1_88: lambda_param_maybe_default +// _loop1_113: lambda_param_maybe_default static asdl_seq * -_loop1_88_rule(Parser *p) +_loop1_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20490,7 +23053,7 @@ _loop1_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -20512,7 +23075,7 @@ _loop1_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -20530,14 +23093,14 @@ _loop1_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); D(p->level--); return _seq; } -// _loop1_89: ('or' conjunction) +// _loop1_114: ('or' conjunction) static asdl_seq * -_loop1_89_rule(Parser *p) +_loop1_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20561,13 +23124,13 @@ _loop1_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_141_var; + D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_169_var; while ( - (_tmp_141_var = _tmp_141_rule(p)) // 'or' conjunction + (_tmp_169_var = _tmp_169_rule(p)) // 'or' conjunction ) { - _res = _tmp_141_var; + _res = _tmp_169_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20583,7 +23146,7 @@ _loop1_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -20601,14 +23164,14 @@ _loop1_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); D(p->level--); return _seq; } -// _loop1_90: ('and' inversion) +// _loop1_115: ('and' inversion) static asdl_seq * -_loop1_90_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20632,13 +23195,13 @@ _loop1_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_142_var; + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_170_var; while ( - (_tmp_142_var = _tmp_142_rule(p)) // 'and' inversion + (_tmp_170_var = _tmp_170_rule(p)) // 'and' inversion ) { - _res = _tmp_142_var; + _res = _tmp_170_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20654,7 +23217,7 @@ _loop1_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -20672,14 +23235,14 @@ _loop1_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _loop1_91: compare_op_bitwise_or_pair +// _loop1_116: compare_op_bitwise_or_pair static asdl_seq * -_loop1_91_rule(Parser *p) +_loop1_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20703,7 +23266,7 @@ _loop1_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -20725,7 +23288,7 @@ _loop1_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -20743,14 +23306,14 @@ _loop1_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); D(p->level--); return _seq; } -// _tmp_92: '!=' +// _tmp_117: '!=' static void * -_tmp_92_rule(Parser *p) +_tmp_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20764,13 +23327,13 @@ _tmp_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20780,7 +23343,7 @@ _tmp_92_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -20789,9 +23352,9 @@ _tmp_92_rule(Parser *p) return _res; } -// _loop0_94: ',' slice +// _loop0_119: ',' slice static asdl_seq * -_loop0_94_rule(Parser *p) +_loop0_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20815,7 +23378,7 @@ _loop0_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -20846,7 +23409,7 @@ _loop0_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20859,14 +23422,14 @@ _loop0_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); D(p->level--); return _seq; } -// _gather_93: slice _loop0_94 +// _gather_118: slice _loop0_119 static asdl_seq * -_gather_93_rule(Parser *p) +_gather_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20875,27 +23438,27 @@ _gather_93_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_94 + { // slice _loop0_119 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_94")); + D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_94_rule(p)) // _loop0_94 + (seq = _loop0_119_rule(p)) // _loop0_119 ) { - D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_94")); + D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_94")); + D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_119")); } _res = NULL; done: @@ -20903,9 +23466,9 @@ _gather_93_rule(Parser *p) return _res; } -// _tmp_95: ':' expression? +// _tmp_120: ':' expression? static void * -_tmp_95_rule(Parser *p) +_tmp_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20919,7 +23482,7 @@ _tmp_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -20928,7 +23491,7 @@ _tmp_95_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20938,7 +23501,7 @@ _tmp_95_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -20947,9 +23510,9 @@ _tmp_95_rule(Parser *p) return _res; } -// _tmp_96: tuple | group | genexp +// _tmp_121: tuple | group | genexp static void * -_tmp_96_rule(Parser *p) +_tmp_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20963,18 +23526,18 @@ _tmp_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -20982,18 +23545,18 @@ _tmp_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -21001,18 +23564,18 @@ _tmp_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -21021,9 +23584,9 @@ _tmp_96_rule(Parser *p) return _res; } -// _tmp_97: list | listcomp +// _tmp_122: list | listcomp static void * -_tmp_97_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21037,18 +23600,18 @@ _tmp_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -21056,18 +23619,18 @@ _tmp_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -21076,9 +23639,9 @@ _tmp_97_rule(Parser *p) return _res; } -// _tmp_98: dict | set | dictcomp | setcomp +// _tmp_123: dict | set | dictcomp | setcomp static void * -_tmp_98_rule(Parser *p) +_tmp_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21092,18 +23655,18 @@ _tmp_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -21111,18 +23674,18 @@ _tmp_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -21130,18 +23693,18 @@ _tmp_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -21149,18 +23712,18 @@ _tmp_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -21169,9 +23732,9 @@ _tmp_98_rule(Parser *p) return _res; } -// _loop1_99: STRING +// _loop1_124: STRING static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21195,7 +23758,7 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -21217,7 +23780,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -21235,14 +23798,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_124_type, _seq); D(p->level--); return _seq; } -// _tmp_100: star_named_expression ',' star_named_expressions? +// _tmp_125: star_named_expression ',' star_named_expressions? static void * -_tmp_100_rule(Parser *p) +_tmp_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21256,7 +23819,7 @@ _tmp_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -21268,7 +23831,7 @@ _tmp_100_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_100[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21278,7 +23841,7 @@ _tmp_100_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -21287,9 +23850,9 @@ _tmp_100_rule(Parser *p) return _res; } -// _tmp_101: yield_expr | named_expression +// _tmp_126: yield_expr | named_expression static void * -_tmp_101_rule(Parser *p) +_tmp_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21303,18 +23866,18 @@ _tmp_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -21322,18 +23885,18 @@ _tmp_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -21342,9 +23905,9 @@ _tmp_101_rule(Parser *p) return _res; } -// _loop0_103: ',' double_starred_kvpair +// _loop0_128: ',' double_starred_kvpair static asdl_seq * -_loop0_103_rule(Parser *p) +_loop0_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21368,7 +23931,7 @@ _loop0_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -21399,7 +23962,7 @@ _loop0_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21412,14 +23975,14 @@ _loop0_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); D(p->level--); return _seq; } -// _gather_102: double_starred_kvpair _loop0_103 +// _gather_127: double_starred_kvpair _loop0_128 static asdl_seq * -_gather_102_rule(Parser *p) +_gather_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21428,27 +23991,27 @@ _gather_102_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_103 + { // double_starred_kvpair _loop0_128 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_103")); + D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_103_rule(p)) // _loop0_103 + (seq = _loop0_128_rule(p)) // _loop0_128 ) { - D(fprintf(stderr, "%*c+ _gather_102[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_103")); + D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_102[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_103")); + D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_128")); } _res = NULL; done: @@ -21456,9 +24019,9 @@ _gather_102_rule(Parser *p) return _res; } -// _loop1_104: for_if_clause +// _loop1_129: for_if_clause static asdl_seq * -_loop1_104_rule(Parser *p) +_loop1_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21482,7 +24045,7 @@ _loop1_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -21504,7 +24067,7 @@ _loop1_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_129[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -21522,14 +24085,14 @@ _loop1_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_129_type, _seq); D(p->level--); return _seq; } -// _loop0_105: ('if' disjunction) +// _loop0_130: ('if' disjunction) static asdl_seq * -_loop0_105_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21553,13 +24116,13 @@ _loop0_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_143_var; + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_171_var; while ( - (_tmp_143_var = _tmp_143_rule(p)) // 'if' disjunction + (_tmp_171_var = _tmp_171_rule(p)) // 'if' disjunction ) { - _res = _tmp_143_var; + _res = _tmp_171_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21575,7 +24138,7 @@ _loop0_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21588,14 +24151,14 @@ _loop0_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _loop0_106: ('if' disjunction) +// _loop0_131: ('if' disjunction) static asdl_seq * -_loop0_106_rule(Parser *p) +_loop0_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21619,13 +24182,13 @@ _loop0_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_144_var; + D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_172_var; while ( - (_tmp_144_var = _tmp_144_rule(p)) // 'if' disjunction + (_tmp_172_var = _tmp_172_rule(p)) // 'if' disjunction ) { - _res = _tmp_144_var; + _res = _tmp_172_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21641,7 +24204,7 @@ _loop0_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21654,14 +24217,14 @@ _loop0_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); D(p->level--); return _seq; } -// _tmp_107: ',' args +// _tmp_132: ',' args static void * -_tmp_107_rule(Parser *p) +_tmp_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21675,7 +24238,7 @@ _tmp_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -21684,7 +24247,7 @@ _tmp_107_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21694,7 +24257,7 @@ _tmp_107_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -21703,9 +24266,9 @@ _tmp_107_rule(Parser *p) return _res; } -// _tmp_108: ',' args +// _tmp_133: ',' args static void * -_tmp_108_rule(Parser *p) +_tmp_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21719,7 +24282,7 @@ _tmp_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -21728,7 +24291,7 @@ _tmp_108_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21738,7 +24301,7 @@ _tmp_108_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -21747,9 +24310,9 @@ _tmp_108_rule(Parser *p) return _res; } -// _loop0_110: ',' kwarg_or_starred +// _loop0_135: ',' kwarg_or_starred static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21773,7 +24336,7 @@ _loop0_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -21804,7 +24367,7 @@ _loop0_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21817,14 +24380,14 @@ _loop0_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_109: kwarg_or_starred _loop0_110 +// _gather_134: kwarg_or_starred _loop0_135 static asdl_seq * -_gather_109_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21833,27 +24396,27 @@ _gather_109_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_110 + { // kwarg_or_starred _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110")); + D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_110_rule(p)) // _loop0_110 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110")); + D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_110")); + D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); } _res = NULL; done: @@ -21861,9 +24424,9 @@ _gather_109_rule(Parser *p) return _res; } -// _loop0_112: ',' kwarg_or_double_starred +// _loop0_137: ',' kwarg_or_double_starred static asdl_seq * -_loop0_112_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21887,7 +24450,7 @@ _loop0_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -21918,7 +24481,7 @@ _loop0_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21931,14 +24494,14 @@ _loop0_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_111: kwarg_or_double_starred _loop0_112 +// _gather_136: kwarg_or_double_starred _loop0_137 static asdl_seq * -_gather_111_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21947,27 +24510,27 @@ _gather_111_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_112 + { // kwarg_or_double_starred _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112")); + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_112_rule(p)) // _loop0_112 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112")); + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_112")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); } _res = NULL; done: @@ -21975,9 +24538,9 @@ _gather_111_rule(Parser *p) return _res; } -// _loop0_114: ',' kwarg_or_starred +// _loop0_139: ',' kwarg_or_starred static asdl_seq * -_loop0_114_rule(Parser *p) +_loop0_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22001,7 +24564,7 @@ _loop0_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -22032,7 +24595,7 @@ _loop0_114_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22045,14 +24608,14 @@ _loop0_114_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); D(p->level--); return _seq; } -// _gather_113: kwarg_or_starred _loop0_114 +// _gather_138: kwarg_or_starred _loop0_139 static asdl_seq * -_gather_113_rule(Parser *p) +_gather_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22061,27 +24624,27 @@ _gather_113_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_114 + { // kwarg_or_starred _loop0_139 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114")); + D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_114_rule(p)) // _loop0_114 + (seq = _loop0_139_rule(p)) // _loop0_139 ) { - D(fprintf(stderr, "%*c+ _gather_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114")); + D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_114")); + D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_139")); } _res = NULL; done: @@ -22089,9 +24652,9 @@ _gather_113_rule(Parser *p) return _res; } -// _loop0_116: ',' kwarg_or_double_starred +// _loop0_141: ',' kwarg_or_double_starred static asdl_seq * -_loop0_116_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22115,7 +24678,7 @@ _loop0_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -22146,7 +24709,7 @@ _loop0_116_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22159,14 +24722,14 @@ _loop0_116_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _gather_115: kwarg_or_double_starred _loop0_116 +// _gather_140: kwarg_or_double_starred _loop0_141 static asdl_seq * -_gather_115_rule(Parser *p) +_gather_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22175,27 +24738,27 @@ _gather_115_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_116 + { // kwarg_or_double_starred _loop0_141 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116")); + D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_116_rule(p)) // _loop0_116 + (seq = _loop0_141_rule(p)) // _loop0_141 ) { - D(fprintf(stderr, "%*c+ _gather_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116")); + D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_116")); + D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_141")); } _res = NULL; done: @@ -22203,9 +24766,9 @@ _gather_115_rule(Parser *p) return _res; } -// _loop0_117: (',' star_target) +// _loop0_142: (',' star_target) static asdl_seq * -_loop0_117_rule(Parser *p) +_loop0_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22229,13 +24792,13 @@ _loop0_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_145_var; + D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_173_var; while ( - (_tmp_145_var = _tmp_145_rule(p)) // ',' star_target + (_tmp_173_var = _tmp_173_rule(p)) // ',' star_target ) { - _res = _tmp_145_var; + _res = _tmp_173_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22251,7 +24814,7 @@ _loop0_117_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22264,14 +24827,14 @@ _loop0_117_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); D(p->level--); return _seq; } -// _loop0_119: ',' star_target +// _loop0_144: ',' star_target static asdl_seq * -_loop0_119_rule(Parser *p) +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22295,7 +24858,7 @@ _loop0_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -22326,7 +24889,7 @@ _loop0_119_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22339,14 +24902,14 @@ _loop0_119_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); D(p->level--); return _seq; } -// _gather_118: star_target _loop0_119 +// _gather_143: star_target _loop0_144 static asdl_seq * -_gather_118_rule(Parser *p) +_gather_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22355,27 +24918,27 @@ _gather_118_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_119 + { // star_target _loop0_144 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119")); + D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_119_rule(p)) // _loop0_119 + (seq = _loop0_144_rule(p)) // _loop0_144 ) { - D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119")); + D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_119")); + D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_144")); } _res = NULL; done: @@ -22383,9 +24946,9 @@ _gather_118_rule(Parser *p) return _res; } -// _tmp_120: !'*' star_target +// _tmp_145: !'*' star_target static void * -_tmp_120_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22399,7 +24962,7 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -22407,12 +24970,12 @@ _tmp_120_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -22421,9 +24984,9 @@ _tmp_120_rule(Parser *p) return _res; } -// _loop0_122: ',' del_target +// _loop0_147: ',' del_target static asdl_seq * -_loop0_122_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22447,7 +25010,7 @@ _loop0_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -22478,7 +25041,7 @@ _loop0_122_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22491,14 +25054,14 @@ _loop0_122_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _gather_121: del_target _loop0_122 +// _gather_146: del_target _loop0_147 static asdl_seq * -_gather_121_rule(Parser *p) +_gather_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22507,27 +25070,27 @@ _gather_121_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_122 + { // del_target _loop0_147 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122")); + D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_122_rule(p)) // _loop0_122 + (seq = _loop0_147_rule(p)) // _loop0_147 ) { - D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122")); + D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_122")); + D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_147")); } _res = NULL; done: @@ -22535,9 +25098,9 @@ _gather_121_rule(Parser *p) return _res; } -// _loop0_124: ',' target +// _loop0_149: ',' target static asdl_seq * -_loop0_124_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22561,7 +25124,7 @@ _loop0_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -22592,7 +25155,7 @@ _loop0_124_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22605,14 +25168,14 @@ _loop0_124_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _gather_123: target _loop0_124 +// _gather_148: target _loop0_149 static asdl_seq * -_gather_123_rule(Parser *p) +_gather_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22621,27 +25184,27 @@ _gather_123_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_124 + { // target _loop0_149 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_124")); + D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_124_rule(p)) // _loop0_124 + (seq = _loop0_149_rule(p)) // _loop0_149 ) { - D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_124")); + D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_124")); + D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_149")); } _res = NULL; done: @@ -22649,9 +25212,9 @@ _gather_123_rule(Parser *p) return _res; } -// _tmp_125: args | expression for_if_clauses +// _tmp_150: args | expression for_if_clauses static void * -_tmp_125_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22665,18 +25228,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -22684,7 +25247,7 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -22693,12 +25256,12 @@ _tmp_125_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -22707,9 +25270,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _loop0_126: star_named_expressions +// _loop0_151: star_named_expressions static asdl_seq * -_loop0_126_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22733,7 +25296,7 @@ _loop0_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -22755,7 +25318,7 @@ _loop0_126_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22768,14 +25331,14 @@ _loop0_126_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); D(p->level--); return _seq; } -// _tmp_127: '=' annotated_rhs +// _tmp_152: '=' annotated_rhs static void * -_tmp_127_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22789,7 +25352,7 @@ _tmp_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -22798,12 +25361,12 @@ _tmp_127_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -22812,9 +25375,9 @@ _tmp_127_rule(Parser *p) return _res; } -// _tmp_128: yield_expr | star_expressions +// _tmp_153: yield_expr | star_expressions static void * -_tmp_128_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22828,18 +25391,18 @@ _tmp_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -22847,18 +25410,18 @@ _tmp_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -22867,9 +25430,9 @@ _tmp_128_rule(Parser *p) return _res; } -// _tmp_129: yield_expr | star_expressions +// _tmp_154: yield_expr | star_expressions static void * -_tmp_129_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22883,18 +25446,18 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -22902,18 +25465,18 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -22922,9 +25485,9 @@ _tmp_129_rule(Parser *p) return _res; } -// _tmp_130: '[' | '(' | '{' +// _tmp_155: '[' | '(' | '{' static void * -_tmp_130_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22938,18 +25501,18 @@ _tmp_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -22957,18 +25520,18 @@ _tmp_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -22976,18 +25539,18 @@ _tmp_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -22996,9 +25559,9 @@ _tmp_130_rule(Parser *p) return _res; } -// _loop0_131: param_no_default +// _loop0_156: param_no_default static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23022,7 +25585,7 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -23044,7 +25607,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23057,14 +25620,14 @@ _loop0_131_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); D(p->level--); return _seq; } -// _tmp_132: slash_with_default | param_with_default+ +// _tmp_157: slash_with_default | param_with_default+ static void * -_tmp_132_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23078,18 +25641,18 @@ _tmp_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -23097,18 +25660,18 @@ _tmp_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_146_var; + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_174_var; if ( - (_loop1_146_var = _loop1_146_rule(p)) // param_with_default+ + (_loop1_174_var = _loop1_174_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_146_var; + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_174_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -23117,9 +25680,9 @@ _tmp_132_rule(Parser *p) return _res; } -// _tmp_133: ')' | ',' (')' | '**') +// _tmp_158: ')' | ',' (')' | '**') static void * -_tmp_133_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23133,18 +25696,18 @@ _tmp_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -23152,21 +25715,21 @@ _tmp_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_147_var; + void *_tmp_175_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_147_var = _tmp_147_rule(p)) // ')' | '**' + (_tmp_175_var = _tmp_175_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_147_var); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_175_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -23175,9 +25738,9 @@ _tmp_133_rule(Parser *p) return _res; } -// _tmp_134: ':' | ',' (':' | '**') +// _tmp_159: ':' | ',' (':' | '**') static void * -_tmp_134_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23191,18 +25754,18 @@ _tmp_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -23210,21 +25773,21 @@ _tmp_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_148_var; + void *_tmp_176_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_148_var = _tmp_148_rule(p)) // ':' | '**' + (_tmp_176_var = _tmp_176_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_148_var); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_176_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -23233,9 +25796,9 @@ _tmp_134_rule(Parser *p) return _res; } -// _tmp_135: star_targets '=' +// _tmp_160: star_targets '=' static void * -_tmp_135_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23249,7 +25812,7 @@ _tmp_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -23258,7 +25821,7 @@ _tmp_135_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23268,7 +25831,7 @@ _tmp_135_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -23277,9 +25840,9 @@ _tmp_135_rule(Parser *p) return _res; } -// _tmp_136: '.' | '...' +// _tmp_161: '.' | '...' static void * -_tmp_136_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23293,18 +25856,18 @@ _tmp_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -23312,18 +25875,18 @@ _tmp_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -23332,9 +25895,9 @@ _tmp_136_rule(Parser *p) return _res; } -// _tmp_137: '.' | '...' +// _tmp_162: '.' | '...' static void * -_tmp_137_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23348,18 +25911,18 @@ _tmp_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -23367,18 +25930,18 @@ _tmp_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -23387,9 +25950,135 @@ _tmp_137_rule(Parser *p) return _res; } -// _tmp_138: '@' named_expression NEWLINE +// _tmp_163: key_pattern ':' closed_pattern +static void * +_tmp_163_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // key_pattern ':' closed_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_pattern ':' closed_pattern")); + Token * _literal; + void *closed_pattern_var; + void *key_pattern_var; + if ( + (key_pattern_var = key_pattern_rule(p)) // key_pattern + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (closed_pattern_var = closed_pattern_rule(p)) // closed_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_pattern ':' closed_pattern")); + _res = _PyPegen_dummy_name(p, key_pattern_var, _literal, closed_pattern_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_pattern ':' closed_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_164: NAME '=' or_pattern +static void * +_tmp_164_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // NAME '=' or_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + Token * _literal; + expr_ty name_var; + void *or_pattern_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + && + (or_pattern_var = or_pattern_rule(p)) // or_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + _res = _PyPegen_dummy_name(p, name_var, _literal, or_pattern_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_165: NAME '=' or_pattern +static void * +_tmp_165_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // NAME '=' or_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + Token * _literal; + expr_ty name_var; + void *or_pattern_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + && + (or_pattern_var = or_pattern_rule(p)) // or_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + _res = _PyPegen_dummy_name(p, name_var, _literal, or_pattern_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_166: '@' named_expression NEWLINE static void * -_tmp_138_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23403,7 +26092,7 @@ _tmp_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -23415,7 +26104,7 @@ _tmp_138_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23425,7 +26114,7 @@ _tmp_138_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -23434,9 +26123,9 @@ _tmp_138_rule(Parser *p) return _res; } -// _tmp_139: ',' star_expression +// _tmp_167: ',' star_expression static void * -_tmp_139_rule(Parser *p) +_tmp_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23450,7 +26139,7 @@ _tmp_139_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -23459,7 +26148,7 @@ _tmp_139_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23469,7 +26158,7 @@ _tmp_139_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -23478,9 +26167,9 @@ _tmp_139_rule(Parser *p) return _res; } -// _tmp_140: ',' expression +// _tmp_168: ',' expression static void * -_tmp_140_rule(Parser *p) +_tmp_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23494,7 +26183,7 @@ _tmp_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -23503,7 +26192,7 @@ _tmp_140_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23513,7 +26202,7 @@ _tmp_140_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -23522,9 +26211,9 @@ _tmp_140_rule(Parser *p) return _res; } -// _tmp_141: 'or' conjunction +// _tmp_169: 'or' conjunction static void * -_tmp_141_rule(Parser *p) +_tmp_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23538,7 +26227,7 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -23547,7 +26236,7 @@ _tmp_141_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23557,7 +26246,7 @@ _tmp_141_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -23566,9 +26255,9 @@ _tmp_141_rule(Parser *p) return _res; } -// _tmp_142: 'and' inversion +// _tmp_170: 'and' inversion static void * -_tmp_142_rule(Parser *p) +_tmp_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23582,7 +26271,7 @@ _tmp_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -23591,7 +26280,7 @@ _tmp_142_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23601,7 +26290,7 @@ _tmp_142_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -23610,9 +26299,9 @@ _tmp_142_rule(Parser *p) return _res; } -// _tmp_143: 'if' disjunction +// _tmp_171: 'if' disjunction static void * -_tmp_143_rule(Parser *p) +_tmp_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23626,7 +26315,7 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -23635,7 +26324,7 @@ _tmp_143_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23645,7 +26334,7 @@ _tmp_143_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -23654,9 +26343,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _tmp_144: 'if' disjunction +// _tmp_172: 'if' disjunction static void * -_tmp_144_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23670,7 +26359,7 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -23679,7 +26368,7 @@ _tmp_144_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23689,7 +26378,7 @@ _tmp_144_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -23698,9 +26387,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: ',' star_target +// _tmp_173: ',' star_target static void * -_tmp_145_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23714,7 +26403,7 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -23723,7 +26412,7 @@ _tmp_145_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23733,7 +26422,7 @@ _tmp_145_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -23742,9 +26431,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _loop1_146: param_with_default +// _loop1_174: param_with_default static asdl_seq * -_loop1_146_rule(Parser *p) +_loop1_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23768,7 +26457,7 @@ _loop1_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -23790,7 +26479,7 @@ _loop1_146_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23808,14 +26497,14 @@ _loop1_146_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_146_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_174_type, _seq); D(p->level--); return _seq; } -// _tmp_147: ')' | '**' +// _tmp_175: ')' | '**' static void * -_tmp_147_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23829,18 +26518,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -23848,18 +26537,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -23868,9 +26557,9 @@ _tmp_147_rule(Parser *p) return _res; } -// _tmp_148: ':' | '**' +// _tmp_176: ':' | '**' static void * -_tmp_148_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23884,18 +26573,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -23903,18 +26592,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; From 67354ad6669bc65493a80c4b0dd8585547efaae9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 16:33:22 -0700 Subject: [PATCH 010/218] Add tests for or-patterns --- Lib/test/test_patma.py | 64 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 20d8ce23ae3028..daac830273ec51 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -12,7 +12,9 @@ class MatchCase(typing.NamedTuple): guard: typing.Optional[str] = None -class PatMaTests(unittest.TestCase): +class TestAST(unittest.TestCase): + """Tests that predate parser support, and just execute ASTs instead.""" + @staticmethod def parse_stmts(stmts: str) -> typing.List[ast.stmt]: return ast.parse(stmts, FILENAME, "exec").body @@ -191,3 +193,63 @@ def test_walrus_5(self) -> None: self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) + + def test_pipe_0(self) -> None: + match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + + def test_pipe_1(self) -> None: + match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + namespace = self.execute_match("x = 1", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 1) + self.assertEqual(namespace.get("y"), 0) + + def test_pipe_2(self) -> None: + match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + namespace = self.execute_match("x = 2", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 2) + self.assertEqual(namespace.get("y"), 0) + + def test_pipe_3(self) -> None: + match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + namespace = self.execute_match("x = 3", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 3) + self.assertNotIn("y", namespace) + + def test_pipe_4(self) -> None: + match_cases = [ + MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + ] + namespace = self.execute_match("x = 0", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 0) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 0) + + def test_pipe_5(self) -> None: + match_cases = [ + MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + ] + namespace = self.execute_match("x = 1", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 1) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 1) + + def test_pipe_6(self) -> None: + match_cases = [ + MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + ] + namespace = self.execute_match("x = 2", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 2) + self.assertNotIn("y", namespace) + self.assertEqual(namespace.get("z"), 2) + + def test_pipe_7(self) -> None: + match_cases = [ + MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + ] + namespace = self.execute_match("x = 3", "x", match_cases, "") + self.assertEqual(namespace.get("x"), 3) + self.assertNotIn("y", namespace) + self.assertNotIn("z", namespace) From 5d609c7866671f2d5a7ac9e6eb14727e9289ba81 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 25 May 2020 16:33:35 -0700 Subject: [PATCH 011/218] Add support for or-patterns --- Python/ast.c | 6 ++++++ Python/compile.c | 28 ++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 207133fee15a01..82f7e3fa53a363 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -310,6 +310,12 @@ validate_pattern(expr_ty p) return validate_constant(p->v.Constant.value); case NamedExpr_kind: return validate_pattern(p->v.NamedExpr.value); + case BinOp_kind: + if (p->v.BinOp.op != BitOr) { + break; + } + return (validate_pattern(p->v.BinOp.left) + && validate_pattern(p->v.BinOp.right)); default: break; } diff --git a/Python/compile.c b/Python/compile.c index 4e2b9ca14b0d0f..eb2129e14efa47 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2747,20 +2747,37 @@ compiler_if(struct compiler *c, stmt_ty s) } static int -compiler_pattern(struct compiler *c, expr_ty p, basicblock *next) +compiler_pattern(struct compiler *c, expr_ty p, basicblock *body, basicblock *next) { + basicblock *block; + // TODO: We can probably simplify some of the jumping-around. switch (p->kind) { case Constant_kind: VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); + ADDOP_JREL(c, JUMP_FORWARD, body); return 1; case NamedExpr_kind: - if (!compiler_pattern(c, p->v.NamedExpr.value, next)) { + block = compiler_new_block(c); + if (!compiler_pattern(c, p->v.NamedExpr.value, block, next)) { return 0; } + compiler_use_next_block(c, block); ADDOP(c, DUP_TOP); VISIT(c, expr, p->v.NamedExpr.target); + ADDOP_JREL(c, JUMP_FORWARD, body); + return 1; + case BinOp_kind: + block = compiler_new_block(c); + if (!compiler_pattern(c, p->v.BinOp.left, body, block)) { + return 0; + } + compiler_use_next_block(c, block); + ADDOP(c, DUP_TOP); + if (!compiler_pattern(c, p->v.BinOp.right, body, next)) { + return 0; + } return 1; default: break; @@ -2775,13 +2792,16 @@ compiler_match(struct compiler *c, stmt_ty s) basicblock *end = compiler_new_block(c); VISIT(c, expr, s->v.Match.target); match_case_ty m; - basicblock *next; + basicblock *body, *next; Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); for (Py_ssize_t i = 0; i < cases; i++) { + // TODO: We can probably simplify some of the jumping-around. m = asdl_seq_GET(s->v.Match.cases, i); + body = compiler_new_block(c); next = compiler_new_block(c); ADDOP(c, DUP_TOP); - compiler_pattern(c, m->pattern, next); + compiler_pattern(c, m->pattern, body, next); + compiler_use_next_block(c, body); if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { return 0; } From 1f8bcbd737ab1fc7465ea153f16a004c8c821dfe Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 07:05:52 -0700 Subject: [PATCH 012/218] Clean up pattern matching compiler --- Python/compile.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index eb2129e14efa47..e195f2454bced3 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2747,35 +2747,34 @@ compiler_if(struct compiler *c, stmt_ty s) } static int -compiler_pattern(struct compiler *c, expr_ty p, basicblock *body, basicblock *next) +compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) { basicblock *block; - // TODO: We can probably simplify some of the jumping-around. switch (p->kind) { case Constant_kind: + ADDOP(c, DUP_TOP); VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); - ADDOP_JREL(c, JUMP_FORWARD, body); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); + ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; case NamedExpr_kind: block = compiler_new_block(c); - if (!compiler_pattern(c, p->v.NamedExpr.value, block, next)) { + if (!compiler_pattern(c, p->v.NamedExpr.value, block, no)) { return 0; } compiler_use_next_block(c, block); ADDOP(c, DUP_TOP); VISIT(c, expr, p->v.NamedExpr.target); - ADDOP_JREL(c, JUMP_FORWARD, body); + ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; case BinOp_kind: block = compiler_new_block(c); - if (!compiler_pattern(c, p->v.BinOp.left, body, block)) { + if (!compiler_pattern(c, p->v.BinOp.left, yes, block)) { return 0; } compiler_use_next_block(c, block); - ADDOP(c, DUP_TOP); - if (!compiler_pattern(c, p->v.BinOp.right, body, next)) { + if (!compiler_pattern(c, p->v.BinOp.right, yes, no)) { return 0; } return 1; @@ -2789,17 +2788,14 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *body, basicblock *ne static int compiler_match(struct compiler *c, stmt_ty s) { - basicblock *end = compiler_new_block(c); VISIT(c, expr, s->v.Match.target); match_case_ty m; - basicblock *body, *next; + basicblock *body, *next, *end = compiler_new_block(c); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); for (Py_ssize_t i = 0; i < cases; i++) { - // TODO: We can probably simplify some of the jumping-around. m = asdl_seq_GET(s->v.Match.cases, i); body = compiler_new_block(c); next = compiler_new_block(c); - ADDOP(c, DUP_TOP); compiler_pattern(c, m->pattern, body, next); compiler_use_next_block(c, body); if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { From eb704d4284fd1be743faecd7c9ac07dc3978f747 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 07:35:13 -0700 Subject: [PATCH 013/218] Add attribute/name support --- Python/ast.c | 12 ++++++++---- Python/compile.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 82f7e3fa53a363..da15a9ab1aaa65 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -306,16 +306,20 @@ static int validate_pattern(expr_ty p) { switch (p->kind) { - case Constant_kind: - return validate_constant(p->v.Constant.value); - case NamedExpr_kind: - return validate_pattern(p->v.NamedExpr.value); + case Attribute_kind: + return validate_expr(p, Load); case BinOp_kind: if (p->v.BinOp.op != BitOr) { break; } return (validate_pattern(p->v.BinOp.left) && validate_pattern(p->v.BinOp.right)); + case Constant_kind: + return validate_constant(p->v.Constant.value); + case Name_kind: + return validate_expr(p, p->v.Name.ctx); + case NamedExpr_kind: + return validate_pattern(p->v.NamedExpr.value); default: break; } diff --git a/Python/compile.c b/Python/compile.c index e195f2454bced3..3a230716fd333a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2751,6 +2751,15 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) { basicblock *block; switch (p->kind) { + // Atomic patterns: + case Name_kind: + if (p->v.Name.ctx == Store) { + ADDOP(c, DUP_TOP); + VISIT(c, expr, p); + ADDOP_JREL(c, JUMP_FORWARD, yes); + return 1; + } // Down we go... + case Attribute_kind: case Constant_kind: ADDOP(c, DUP_TOP); VISIT(c, expr, p); @@ -2758,6 +2767,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; + // Nested patterns: case NamedExpr_kind: block = compiler_new_block(c); if (!compiler_pattern(c, p->v.NamedExpr.value, block, no)) { From 5a361bff2ba14a6a5140292c5a7e007c4e547de9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 07:59:59 -0700 Subject: [PATCH 014/218] Validate name context --- Python/ast.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Python/ast.c b/Python/ast.c index da15a9ab1aaa65..e8b6d19912b9b0 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -317,6 +317,9 @@ validate_pattern(expr_ty p) case Constant_kind: return validate_constant(p->v.Constant.value); case Name_kind: + if (p->v.Name.ctx != Load && p->v.Name.ctx != Store) { + break; + } return validate_expr(p, p->v.Name.ctx); case NamedExpr_kind: return validate_pattern(p->v.NamedExpr.value); From 9c2e61cb51c052c770baa6e0213eea601cb3ffd9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 08:00:42 -0700 Subject: [PATCH 015/218] Clean up pattern compiler --- Python/compile.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 3a230716fd333a..9050a03499d8c9 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2752,32 +2752,18 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) basicblock *block; switch (p->kind) { // Atomic patterns: - case Name_kind: - if (p->v.Name.ctx == Store) { - ADDOP(c, DUP_TOP); - VISIT(c, expr, p); - ADDOP_JREL(c, JUMP_FORWARD, yes); - return 1; - } // Down we go... case Attribute_kind: case Constant_kind: + case Name_kind: ADDOP(c, DUP_TOP); VISIT(c, expr, p); - ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); - ADDOP_JREL(c, JUMP_FORWARD, yes); - return 1; - // Nested patterns: - case NamedExpr_kind: - block = compiler_new_block(c); - if (!compiler_pattern(c, p->v.NamedExpr.value, block, no)) { - return 0; + if (p->kind != Name_kind || p->v.Name.ctx == Load) { + ADDOP_COMPARE(c, Eq); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); } - compiler_use_next_block(c, block); - ADDOP(c, DUP_TOP); - VISIT(c, expr, p->v.NamedExpr.target); ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; + // Nested patterns: case BinOp_kind: block = compiler_new_block(c); if (!compiler_pattern(c, p->v.BinOp.left, yes, block)) { @@ -2788,11 +2774,19 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) return 0; } return 1; + case NamedExpr_kind: + block = compiler_new_block(c); + if (!compiler_pattern(c, p->v.NamedExpr.value, block, no)) { + return 0; + } + compiler_use_next_block(c, block); + ADDOP(c, DUP_TOP); + VISIT(c, expr, p->v.NamedExpr.target); + ADDOP_JREL(c, JUMP_FORWARD, yes); + return 1; default: - break; + Py_UNREACHABLE(); } - PyErr_SetString(PyExc_SystemError, "invalid match pattern"); - return 0; } static int From dddcca8c11fb7eb72fea6aedb75ac57d1828710d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 10:29:43 -0700 Subject: [PATCH 016/218] Don't bind _ --- Lib/test/test_patma.py | 6 +++++- Python/compile.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index daac830273ec51..3de1c1fb4ed9b1 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -13,7 +13,11 @@ class MatchCase(typing.NamedTuple): class TestAST(unittest.TestCase): - """Tests that predate parser support, and just execute ASTs instead.""" + """Tests that predate parser support, and just execute ASTs instead. + + No tests for name loads/stores, since these need a patma parser to + disambiguate. + """ @staticmethod def parse_stmts(stmts: str) -> typing.List[ast.stmt]: diff --git a/Python/compile.c b/Python/compile.c index 9050a03499d8c9..1a58ddeb1c10bf 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2752,15 +2752,21 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) basicblock *block; switch (p->kind) { // Atomic patterns: + case Name_kind: + if (p->v.Name.ctx == Store) { + if (!_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { + ADDOP(c, DUP_TOP); + VISIT(c, expr, p); + } + ADDOP_JREL(c, JUMP_FORWARD, yes); + return 1; + } // Loads fall through. case Attribute_kind: case Constant_kind: - case Name_kind: ADDOP(c, DUP_TOP); VISIT(c, expr, p); - if (p->kind != Name_kind || p->v.Name.ctx == Load) { - ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); - } + ADDOP_COMPARE(c, Eq); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; // Nested patterns: From af70c74b47b493da893377e0b06367d9f00b40a6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 13:41:47 -0700 Subject: [PATCH 017/218] Add sequence tests --- Lib/test/test_patma.py | 80 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 3de1c1fb4ed9b1..2ff9d08e53d83d 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,4 +1,5 @@ import ast +import types import typing import unittest @@ -35,15 +36,21 @@ def parse_match_case(cls, match_case: MatchCase) -> ast.expr: return ast.match_case(pattern=pattern, guard=guard, body=body) @classmethod - def execute_match( + def compile_match( cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str - ) -> typing.Dict[str, typing.Any]: + ) -> types.CodeType: cases = [cls.parse_match_case(case) for case in match_cases] match = ast.Match(target=cls.parse_expr(target), cases=cases) body = [*cls.parse_stmts(pre), match, *cls.parse_stmts(post)] tree = ast.fix_missing_locations(ast.Module(body=body, type_ignores=[])) + return compile(tree, FILENAME, "exec") + + @classmethod + def execute_match( + cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str + ) -> typing.Dict[str, typing.Any]: namespace = {} - exec(compile(tree, FILENAME, "exec"), None, namespace) + exec(cls.compile_match(pre, target, match_cases, post), None, namespace) return namespace def test_steroid_switch_0(self) -> None: @@ -257,3 +264,70 @@ def test_pipe_7(self) -> None: self.assertEqual(namespace.get("x"), 3) self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) + + def test_iter_0(self) -> None: + match_cases = [MatchCase("()", "y = 0")] + namespace = self.execute_match("x = ()", "x", match_cases, "") + self.assertEqual(namespace.get("x"), ()) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_1(self) -> None: + match_cases = [MatchCase("[]", "y = 0")] + namespace = self.execute_match("x = ()", "x", match_cases, "") + self.assertEqual(namespace.get("x"), ()) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_2(self) -> None: + match_cases = [MatchCase("[0]", "y = 0")] + namespace = self.execute_match("x = (0,)", "x", match_cases, "") + self.assertEqual(namespace.get("x"), (0,)) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_3(self) -> None: + match_cases = [MatchCase("[[]]", "y = 0")] + namespace = self.execute_match("x = ((),)", "x", match_cases, "") + self.assertEqual(namespace.get("x"), ((),)) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_4(self) -> None: + match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") + self.assertEqual(namespace.get("x"), [0, 1]) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_5(self) -> None: + match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") + self.assertEqual(namespace.get("x"), [1, 0]) + self.assertEqual(namespace.get("y"), 0) + + def test_iter_6(self) -> None: + match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") + self.assertEqual(namespace.get("x"), [0, 0]) + self.assertNotIn("y", namespace) + + def test_iter_7(self) -> None: + match_cases = [MatchCase("(w := 0,)", "y = 0"), MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1")] + namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") + self.assertNotIn("w", namespace) + self.assertEqual(namespace.get("x"), [1, 0]) + self.assertEqual(namespace.get("y"), 1) + self.assertEqual(namespace.get("z"), 0) + + def test_iter_8(self) -> None: + match_cases = [ + MatchCase("(0,)", "y = 0"), + MatchCase("(1, 0)", "y = 1", "(x := x[:0])"), + MatchCase("(1, 0)", "y = 2"), + ] + namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") + self.assertEqual(namespace.get("x"), []) + self.assertEqual(namespace.get("y"), 2) + + +if __name__ == "__main__": # XXX: For quick test debugging... + import dis + + match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + dis.dis(TestAST.compile_match("x = [0, 0]", "x", match_cases, "")) From 4191858df60100d2247fa707fc800ba1655e3231 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 13:41:56 -0700 Subject: [PATCH 018/218] Add basic sequence support --- Python/ast.c | 12 ++++++++++ Python/compile.c | 58 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index e8b6d19912b9b0..b8a193bdbc8a30 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -305,6 +305,8 @@ validate_expr(expr_ty exp, expr_context_ty ctx) static int validate_pattern(expr_ty p) { + asdl_seq *elts; + Py_ssize_t i, size; switch (p->kind) { case Attribute_kind: return validate_expr(p, Load); @@ -316,6 +318,16 @@ validate_pattern(expr_ty p) && validate_pattern(p->v.BinOp.right)); case Constant_kind: return validate_constant(p->v.Constant.value); + case List_kind: + case Tuple_kind: + elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + size = asdl_seq_LEN(elts); + for (i = 0; i < size; i++) { + if (!validate_pattern(asdl_seq_GET(elts, i))) { + return 0; + } + } + return 1; case Name_kind: if (p->v.Name.ctx != Load && p->v.Name.ctx != Store) { break; diff --git a/Python/compile.c b/Python/compile.c index 1a58ddeb1c10bf..19fb623cd11127 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2749,13 +2749,17 @@ compiler_if(struct compiler *c, stmt_ty s) static int compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) { - basicblock *block; + // TODO: This inital implementation keeps things simple(-ish), but creates a + // TON of blocks and zero-length jumps, especially for sequences. Simplify? + // The zero-length jumps can probably be peep-holed. + basicblock *sub_no, *sub_yes; + asdl_seq *elts; + Py_ssize_t i, size; switch (p->kind) { // Atomic patterns: case Name_kind: if (p->v.Name.ctx == Store) { if (!_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { - ADDOP(c, DUP_TOP); VISIT(c, expr, p); } ADDOP_JREL(c, JUMP_FORWARD, yes); @@ -2763,7 +2767,6 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) } // Loads fall through. case Attribute_kind: case Constant_kind: - ADDOP(c, DUP_TOP); VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); @@ -2771,24 +2774,58 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) return 1; // Nested patterns: case BinOp_kind: - block = compiler_new_block(c); - if (!compiler_pattern(c, p->v.BinOp.left, yes, block)) { + ADDOP(c, DUP_TOP); + sub_yes = compiler_new_block(c); + sub_no = compiler_new_block(c); + if (!compiler_pattern(c, p->v.BinOp.left, sub_yes, sub_no)) { return 0; } - compiler_use_next_block(c, block); + compiler_use_next_block(c, sub_no); if (!compiler_pattern(c, p->v.BinOp.right, yes, no)) { return 0; } + compiler_use_next_block(c, sub_yes); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, yes); + return 1; + case List_kind: + case Tuple_kind: + // TODO: Need to add a MATCH_SEQ that handles checking for + // Sequence (but not str, bytes, bytearray), and popping/jumping to + // "no" on failure: + ADDOP(c, GET_ITER); + sub_no = compiler_new_block(c); + elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + size = asdl_seq_LEN(elts); + for (i = 0; i < size; i++) { + sub_yes = compiler_new_block(c); + ADDOP_JREL(c, FOR_ITER, no); + if (!compiler_pattern(c, asdl_seq_GET(elts, i), sub_yes, sub_no)) { + return 0; + } + compiler_use_next_block(c, sub_yes); + } + ADDOP_JREL(c, FOR_ITER, yes); + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, no); + compiler_use_next_block(c, sub_no); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, no); return 1; case NamedExpr_kind: - block = compiler_new_block(c); - if (!compiler_pattern(c, p->v.NamedExpr.value, block, no)) { + ADDOP(c, DUP_TOP); + sub_yes = compiler_new_block(c); + sub_no = compiler_new_block(c); + if (!compiler_pattern(c, p->v.NamedExpr.value, sub_yes, sub_no)) { return 0; } - compiler_use_next_block(c, block); - ADDOP(c, DUP_TOP); + compiler_use_next_block(c, sub_yes); VISIT(c, expr, p->v.NamedExpr.target); ADDOP_JREL(c, JUMP_FORWARD, yes); + compiler_use_next_block(c, sub_no); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, no); return 1; default: Py_UNREACHABLE(); @@ -2806,6 +2843,7 @@ compiler_match(struct compiler *c, stmt_ty s) m = asdl_seq_GET(s->v.Match.cases, i); body = compiler_new_block(c); next = compiler_new_block(c); + ADDOP(c, DUP_TOP); compiler_pattern(c, m->pattern, body, next); compiler_use_next_block(c, body); if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { From 33633c17bffb230b17f3187bbe779a6d45afe105 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 17:34:55 -0700 Subject: [PATCH 019/218] Add support for starred sub-patterns in sequences --- Python/ast.c | 14 +++++++--- Python/compile.c | 68 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index b8a193bdbc8a30..f5c82d2b1745ad 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -306,13 +306,15 @@ static int validate_pattern(expr_ty p) { asdl_seq *elts; + expr_ty elt; Py_ssize_t i, size; + char *error = "invalid Match pattern"; switch (p->kind) { case Attribute_kind: return validate_expr(p, Load); case BinOp_kind: if (p->v.BinOp.op != BitOr) { - break; + error = "BinOp op in pattern must be BitOr"; } return (validate_pattern(p->v.BinOp.left) && validate_pattern(p->v.BinOp.right)); @@ -323,14 +325,18 @@ validate_pattern(expr_ty p) elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; size = asdl_seq_LEN(elts); for (i = 0; i < size; i++) { - if (!validate_pattern(asdl_seq_GET(elts, i))) { + elt = asdl_seq_GET(elts, i); + if (elt->kind == Starred_kind) { + elt = elt->v.Starred.value; + } + if (!validate_pattern(elt)) { return 0; } } return 1; case Name_kind: if (p->v.Name.ctx != Load && p->v.Name.ctx != Store) { - break; + error = "Name ctx in pattern must be either Load or Store"; } return validate_expr(p, p->v.Name.ctx); case NamedExpr_kind: @@ -338,7 +344,7 @@ validate_pattern(expr_ty p) default: break; } - PyErr_SetString(PyExc_SystemError, "invalid match pattern"); + PyErr_SetString(PyExc_ValueError, error); return 0; } diff --git a/Python/compile.c b/Python/compile.c index 19fb623cd11127..248a52f1cc69f5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2746,6 +2746,20 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } +static int +compiler_pattern_name_store(struct compiler *c, expr_ty p) +{ + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Store); + if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { + ADDOP(c, POP_TOP); + } + else { + VISIT(c, expr, p); + } + return 1; +} + static int compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) { @@ -2753,19 +2767,24 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) // TON of blocks and zero-length jumps, especially for sequences. Simplify? // The zero-length jumps can probably be peep-holed. basicblock *sub_no, *sub_yes; + Py_ssize_t i, size, star; asdl_seq *elts; - Py_ssize_t i, size; + expr_ty elt; switch (p->kind) { // Atomic patterns: case Name_kind: if (p->v.Name.ctx == Store) { - if (!_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { - VISIT(c, expr, p); + if (!compiler_pattern_name_store(c, p)) { + return 0; } ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; - } // Loads fall through. + } + assert(p->v.Name.ctx == Load); + // Fall through... case Attribute_kind: + assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); + // Fall through.... case Constant_kind: VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); @@ -2774,6 +2793,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) return 1; // Nested patterns: case BinOp_kind: + assert(p->v.BinOp.op == BitOr); ADDOP(c, DUP_TOP); sub_yes = compiler_new_block(c); sub_no = compiler_new_block(c); @@ -2797,11 +2817,45 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) sub_no = compiler_new_block(c); elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; size = asdl_seq_LEN(elts); + star = -1; + for (i = 0; i < size; i++) { + elt = asdl_seq_GET(elts, i); + if (elt->kind != Starred_kind) { + continue; + } + if (elt->kind != Name_kind || elt->v.Name.ctx != Store) { + return compiler_error(c, + "starred sub-patterns must be names"); + } + if (star >= 0) { + return compiler_error(c, + "multiple starred names in pattern"); + } + if ((size - i - 1) << 8 >= INT_MAX) { + return compiler_error(c, + "too many sub-patterns follow starred sub-pattern"); + } + star = i; + } for (i = 0; i < size; i++) { sub_yes = compiler_new_block(c); - ADDOP_JREL(c, FOR_ITER, no); - if (!compiler_pattern(c, asdl_seq_GET(elts, i), sub_yes, sub_no)) { - return 0; + elt = asdl_seq_GET(elts, i); + if (i == star) { + assert(elt->kind == Starred_kind); + ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); + if (!compiler_pattern_name_store(c, elt->v.Starred.value)) { + return 0; + } + if (size - i - 1) { + ADDOP_I(c, BUILD_TUPLE, size - i - 1); + ADDOP(c, GET_ITER); + } + } + else { + ADDOP_JREL(c, FOR_ITER, no); + if (!compiler_pattern(c, elt, sub_yes, sub_no)) { + return 0; + } } compiler_use_next_block(c, sub_yes); } From a36542eca04410328beb25f0c0a134faf509f010 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 26 May 2020 17:35:04 -0700 Subject: [PATCH 020/218] Format tests --- Lib/test/test_patma.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2ff9d08e53d83d..3ee59e620584ea 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -308,7 +308,10 @@ def test_iter_6(self) -> None: self.assertNotIn("y", namespace) def test_iter_7(self) -> None: - match_cases = [MatchCase("(w := 0,)", "y = 0"), MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1")] + match_cases = [ + MatchCase("(w := 0,)", "y = 0"), + MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1"), + ] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertNotIn("w", namespace) self.assertEqual(namespace.get("x"), [1, 0]) From 76d108c38c2339c2bc8da3ff75790e1822984cc8 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 10:26:44 -0700 Subject: [PATCH 021/218] Simplify control-flow --- Python/compile.c | 73 ++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 248a52f1cc69f5..ede1e662867d1e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2761,12 +2761,9 @@ compiler_pattern_name_store(struct compiler *c, expr_ty p) } static int -compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) +compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) { - // TODO: This inital implementation keeps things simple(-ish), but creates a - // TON of blocks and zero-length jumps, especially for sequences. Simplify? - // The zero-length jumps can probably be peep-holed. - basicblock *sub_no, *sub_yes; + basicblock *sub_yes, *sub_no; Py_ssize_t i, size, star; asdl_seq *elts; expr_ty elt; @@ -2774,11 +2771,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) // Atomic patterns: case Name_kind: if (p->v.Name.ctx == Store) { - if (!compiler_pattern_name_store(c, p)) { - return 0; - } - ADDOP_JREL(c, JUMP_FORWARD, yes); - return 1; + return compiler_pattern_name_store(c, p); } assert(p->v.Name.ctx == Load); // Fall through... @@ -2788,33 +2781,27 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) case Constant_kind: VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, no); - ADDOP_JREL(c, JUMP_FORWARD, yes); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, fail); return 1; // Nested patterns: case BinOp_kind: assert(p->v.BinOp.op == BitOr); - ADDOP(c, DUP_TOP); sub_yes = compiler_new_block(c); sub_no = compiler_new_block(c); - if (!compiler_pattern(c, p->v.BinOp.left, sub_yes, sub_no)) { + ADDOP(c, DUP_TOP); + if (!compiler_pattern(c, p->v.BinOp.left, sub_no)) { return 0; } + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, sub_yes); compiler_use_next_block(c, sub_no); - if (!compiler_pattern(c, p->v.BinOp.right, yes, no)) { + if (!compiler_pattern(c, p->v.BinOp.right, fail)) { return 0; } compiler_use_next_block(c, sub_yes); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, yes); return 1; case List_kind: case Tuple_kind: - // TODO: Need to add a MATCH_SEQ that handles checking for - // Sequence (but not str, bytes, bytearray), and popping/jumping to - // "no" on failure: - ADDOP(c, GET_ITER); - sub_no = compiler_new_block(c); elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; size = asdl_seq_LEN(elts); star = -1; @@ -2837,8 +2824,13 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) } star = i; } + sub_yes = compiler_new_block(c); + sub_no = compiler_new_block(c); + // TODO: Need to add a GET_MATCH_ITER that handles checking for + // Sequence (but not str, bytes, bytearray), and popping/jumping to + // "fail" on failure: + ADDOP(c, GET_ITER); for (i = 0; i < size; i++) { - sub_yes = compiler_new_block(c); elt = asdl_seq_GET(elts, i); if (i == star) { assert(elt->kind == Starred_kind); @@ -2848,38 +2840,41 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *yes, basicblock *no) } if (size - i - 1) { ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP(c, GET_ITER); + ADDOP(c, GET_ITER); // TODO: GET_MATCH_ITER + } + else { + ADDOP_JREL(c, JUMP_FORWARD, sub_yes); } } else { - ADDOP_JREL(c, FOR_ITER, no); - if (!compiler_pattern(c, elt, sub_yes, sub_no)) { + ADDOP_JREL(c, FOR_ITER, fail); + if (!compiler_pattern(c, elt, sub_no)) { return 0; } } - compiler_use_next_block(c, sub_yes); } - ADDOP_JREL(c, FOR_ITER, yes); - ADDOP(c, POP_TOP); + // TODO: This could be simplified with VM support too. Pop top, and + // jump to "fail" if items remain. JUMP_IF_NOT_EMPTY? + ADDOP_JREL(c, FOR_ITER, sub_yes); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, no); compiler_use_next_block(c, sub_no); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, no); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, sub_yes); return 1; case NamedExpr_kind: - ADDOP(c, DUP_TOP); sub_yes = compiler_new_block(c); sub_no = compiler_new_block(c); - if (!compiler_pattern(c, p->v.NamedExpr.value, sub_yes, sub_no)) { + ADDOP(c, DUP_TOP); + if (!compiler_pattern(c, p->v.NamedExpr.value, sub_no)) { return 0; } - compiler_use_next_block(c, sub_yes); VISIT(c, expr, p->v.NamedExpr.target); - ADDOP_JREL(c, JUMP_FORWARD, yes); + ADDOP_JREL(c, JUMP_FORWARD, sub_yes); compiler_use_next_block(c, sub_no); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, no); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, sub_yes); return 1; default: Py_UNREACHABLE(); @@ -2891,15 +2886,13 @@ compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.target); match_case_ty m; - basicblock *body, *next, *end = compiler_new_block(c); + basicblock *next, *end = compiler_new_block(c); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); for (Py_ssize_t i = 0; i < cases; i++) { m = asdl_seq_GET(s->v.Match.cases, i); - body = compiler_new_block(c); next = compiler_new_block(c); ADDOP(c, DUP_TOP); - compiler_pattern(c, m->pattern, body, next); - compiler_use_next_block(c, body); + compiler_pattern(c, m->pattern, next); if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { return 0; } From 34c54a0f1216788f9992f17d1cc41e35b47904be Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 11:42:31 -0700 Subject: [PATCH 022/218] Rename blocks --- Python/compile.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index ede1e662867d1e..dfde8c4ce72f95 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2763,7 +2763,7 @@ compiler_pattern_name_store(struct compiler *c, expr_ty p) static int compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) { - basicblock *sub_yes, *sub_no; + basicblock *end, *block; Py_ssize_t i, size, star; asdl_seq *elts; expr_ty elt; @@ -2786,19 +2786,19 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) // Nested patterns: case BinOp_kind: assert(p->v.BinOp.op == BitOr); - sub_yes = compiler_new_block(c); - sub_no = compiler_new_block(c); + end = compiler_new_block(c); + block = compiler_new_block(c); ADDOP(c, DUP_TOP); - if (!compiler_pattern(c, p->v.BinOp.left, sub_no)) { + if (!compiler_pattern(c, p->v.BinOp.left, block)) { return 0; } ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, sub_yes); - compiler_use_next_block(c, sub_no); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); if (!compiler_pattern(c, p->v.BinOp.right, fail)) { return 0; } - compiler_use_next_block(c, sub_yes); + compiler_use_next_block(c, end); return 1; case List_kind: case Tuple_kind: @@ -2824,8 +2824,8 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } star = i; } - sub_yes = compiler_new_block(c); - sub_no = compiler_new_block(c); + end = compiler_new_block(c); + block = compiler_new_block(c); // TODO: Need to add a GET_MATCH_ITER that handles checking for // Sequence (but not str, bytes, bytearray), and popping/jumping to // "fail" on failure: @@ -2843,38 +2843,38 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) ADDOP(c, GET_ITER); // TODO: GET_MATCH_ITER } else { - ADDOP_JREL(c, JUMP_FORWARD, sub_yes); + ADDOP_JREL(c, JUMP_FORWARD, end); } } else { ADDOP_JREL(c, FOR_ITER, fail); - if (!compiler_pattern(c, elt, sub_no)) { + if (!compiler_pattern(c, elt, block)) { return 0; } } } - // TODO: This could be simplified with VM support too. Pop top, and - // jump to "fail" if items remain. JUMP_IF_NOT_EMPTY? - ADDOP_JREL(c, FOR_ITER, sub_yes); + // TODO: This could be simplified with VM support. Pop top, and jump + // to "fail" if items remain. JUMP_IF_NOT_EMPTY? + ADDOP_JREL(c, FOR_ITER, end); ADDOP(c, POP_TOP); - compiler_use_next_block(c, sub_no); + compiler_use_next_block(c, block); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, sub_yes); + compiler_use_next_block(c, end); return 1; case NamedExpr_kind: - sub_yes = compiler_new_block(c); - sub_no = compiler_new_block(c); + end = compiler_new_block(c); + block = compiler_new_block(c); ADDOP(c, DUP_TOP); - if (!compiler_pattern(c, p->v.NamedExpr.value, sub_no)) { + if (!compiler_pattern(c, p->v.NamedExpr.value, block)) { return 0; } VISIT(c, expr, p->v.NamedExpr.target); - ADDOP_JREL(c, JUMP_FORWARD, sub_yes); - compiler_use_next_block(c, sub_no); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, sub_yes); + compiler_use_next_block(c, end); return 1; default: Py_UNREACHABLE(); From 8bc9ae5d9f6a9364867dea640f0d4679ff328f06 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 15:57:11 -0700 Subject: [PATCH 023/218] Add GET_MATCH_ITER opcode --- Doc/library/dis.rst | 9 ++ Include/opcode.h | 1 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/opcode.py | 1 + Python/ceval.c | 13 ++ Python/compile.c | 10 +- Python/importlib_external.h | 230 +++++++++++++-------------- Python/opcode_targets.h | 2 +- 8 files changed, 146 insertions(+), 123 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index f871ec4f13def8..a91ae8c7b65fa1 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -990,6 +990,15 @@ All of the following opcodes use their arguments. code counter is incremented by *delta*. +.. opcode:: GET_MATCH_ITER (delta) + + Used for pattern matching. Much like :opcode:`GET_ITER`, but pops TOS and + increments the byte code counter by *delta* if TOS is not a :term:`sequence` + or is an instance of :class:`str`, :class:`bytes`, or :class:`bytearray`. + + .. versionadded:: 3.10 + + .. opcode:: LOAD_GLOBAL (namei) Loads the global named ``co_names[namei]`` onto the stack. diff --git a/Include/opcode.h b/Include/opcode.h index 19944fac0b9f2b..325e61d3f61142 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -127,6 +127,7 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 +#define GET_MATCH_ITER 166 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 25a3f8c0e09343..959e8ba45f614f 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,6 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) +# Python 3.10a0 3435 (add GET_MATCH_ITER) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -286,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3425).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3435).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index ac1aa535f66ff6..09a1d079be5524 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -213,5 +213,6 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) +jrel_op('GET_MATCH_ITER', 166) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index a79773f85118ad..b8df9b3f5040ec 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3284,6 +3284,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } + case TARGET(GET_MATCH_ITER): { + PyObject *target = TOP(); + if (!PySequence_Check(target) + || PyObject_TypeCheck(target, &PyUnicode_Type) + || PyObject_TypeCheck(target, &PyBytes_Type) + || PyObject_TypeCheck(target, &PyByteArray_Type) + ) { + STACK_SHRINK(1); + Py_DECREF(target); + JUMPBY(oparg); + DISPATCH(); + } + } // Fall... case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index dfde8c4ce72f95..a9a8501c4856db 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -980,7 +980,8 @@ stack_effect(int opcode, int oparg, int jump) case FOR_ITER: /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; - + case GET_MATCH_ITER: + return -(jump > 0); case STORE_ATTR: return -2; case DELETE_ATTR: @@ -2826,10 +2827,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } end = compiler_new_block(c); block = compiler_new_block(c); - // TODO: Need to add a GET_MATCH_ITER that handles checking for - // Sequence (but not str, bytes, bytearray), and popping/jumping to - // "fail" on failure: - ADDOP(c, GET_ITER); + ADDOP_JREL(c, GET_MATCH_ITER, fail); for (i = 0; i < size; i++) { elt = asdl_seq_GET(elts, i); if (i == star) { @@ -2840,7 +2838,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } if (size - i - 1) { ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP(c, GET_ITER); // TODO: GET_MATCH_ITER + ADDOP_JREL(c, GET_MATCH_ITER, fail); } else { ADDOP_JREL(c, JUMP_FORWARD, end); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index dd237428867ba7..8010e6e269e67b 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,97,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,107,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, @@ -400,7 +400,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,102,105,108,101,110,97,109,101,218,8,102,105,108,101,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,115, - 111,117,114,99,101,45,1,0,0,115,72,0,0,0,0,18, + 111,117,114,99,101,46,1,0,0,115,72,0,0,0,0,18, 8,1,6,1,2,255,4,2,8,1,4,1,8,1,12,1, 10,1,12,1,16,1,8,1,8,1,8,1,24,1,8,1, 12,1,6,2,8,1,8,1,8,1,8,1,14,1,14,1, @@ -481,7 +481,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,101, 110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,109, - 95,99,97,99,104,101,116,1,0,0,115,68,0,0,0,0, + 95,99,97,99,104,101,117,1,0,0,115,68,0,0,0,0, 9,12,1,8,1,10,1,12,1,4,1,10,1,12,1,14, 1,16,1,4,1,4,1,12,1,8,1,2,1,2,255,4, 1,2,255,8,2,10,1,8,1,16,1,10,1,16,1,10, @@ -517,7 +517,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, 95,112,97,116,104,114,5,0,0,0,114,5,0,0,0,114, 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,156,1,0,0,115,20,0,0,0,0,7, + 101,102,105,108,101,157,1,0,0,115,20,0,0,0,0,7, 12,1,4,1,16,1,24,1,4,1,2,1,12,1,16,1, 18,1,114,108,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,0, @@ -530,7 +530,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 112,108,101,114,101,0,0,0,114,97,0,0,0,114,82,0, 0,0,114,88,0,0,0,41,1,114,96,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 103,101,116,95,99,97,99,104,101,100,175,1,0,0,115,16, + 103,101,116,95,99,97,99,104,101,100,176,1,0,0,115,16, 0,0,0,0,1,14,1,2,1,10,1,12,1,8,1,14, 1,4,2,114,112,0,0,0,99,1,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, @@ -545,7 +545,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,51,0,0,0,114,50,0,0,0,41,2,114,44,0,0, 0,114,52,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,10,95,99,97,108,99,95,109,111,100, - 101,187,1,0,0,115,12,0,0,0,0,2,2,1,14,1, + 101,188,1,0,0,115,12,0,0,0,0,2,2,1,14,1, 12,1,10,3,8,1,114,114,0,0,0,99,1,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,0, 3,0,0,0,115,66,0,0,0,100,6,135,0,102,1,100, @@ -583,7 +583,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,114,103,115,218,6,107,119,97,114,103,115,169,1,218,6, 109,101,116,104,111,100,114,5,0,0,0,114,8,0,0,0, 218,19,95,99,104,101,99,107,95,110,97,109,101,95,119,114, - 97,112,112,101,114,207,1,0,0,115,18,0,0,0,0,1, + 97,112,112,101,114,208,1,0,0,115,18,0,0,0,0,1, 8,1,8,1,10,1,4,1,8,255,2,1,2,255,6,2, 122,40,95,99,104,101,99,107,95,110,97,109,101,46,60,108, 111,99,97,108,115,62,46,95,99,104,101,99,107,95,110,97, @@ -601,7 +601,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 8,95,95,100,105,99,116,95,95,218,6,117,112,100,97,116, 101,41,3,90,3,110,101,119,90,3,111,108,100,114,67,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,5,95,119,114,97,112,218,1,0,0,115,8,0,0, + 0,218,5,95,119,114,97,112,219,1,0,0,115,8,0,0, 0,0,1,8,1,10,1,20,1,122,26,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,119,114,97,112,41,1,78,41,3,218,10,95,98,111,111, @@ -609,7 +609,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,69,114,114,111,114,41,3,114,122,0,0,0,114,123,0, 0,0,114,133,0,0,0,114,5,0,0,0,114,121,0,0, 0,114,8,0,0,0,218,11,95,99,104,101,99,107,95,110, - 97,109,101,199,1,0,0,115,14,0,0,0,0,8,14,7, + 97,109,101,200,1,0,0,115,14,0,0,0,0,8,14,7, 2,1,10,1,12,2,14,5,10,1,114,136,0,0,0,99, 2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, 6,0,0,0,67,0,0,0,115,60,0,0,0,124,0,160, @@ -637,7 +637,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110, 115,218,3,109,115,103,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,17,95,102,105,110,100,95,109,111,100, - 117,108,101,95,115,104,105,109,227,1,0,0,115,10,0,0, + 117,108,101,95,115,104,105,109,228,1,0,0,115,10,0,0, 0,0,10,14,1,16,1,4,1,22,1,114,143,0,0,0, 99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0, 0,4,0,0,0,67,0,0,0,115,166,0,0,0,124,0, @@ -704,7 +704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,120,99,95,100,101,116,97,105,108,115,90,5,109,97,103, 105,99,114,92,0,0,0,114,2,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,13,95,99,108, - 97,115,115,105,102,121,95,112,121,99,244,1,0,0,115,28, + 97,115,115,105,102,121,95,112,121,99,245,1,0,0,115,28, 0,0,0,0,16,12,1,8,1,16,1,12,1,16,1,12, 1,10,1,12,1,8,1,16,2,8,1,16,1,16,1,114, 152,0,0,0,99,5,0,0,0,0,0,0,0,0,0,0, @@ -759,7 +759,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 122,101,114,116,0,0,0,114,151,0,0,0,114,92,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,23,95,118,97,108,105,100,97,116,101,95,116,105,109,101, - 115,116,97,109,112,95,112,121,99,21,2,0,0,115,16,0, + 115,116,97,109,112,95,112,121,99,22,2,0,0,115,16,0, 0,0,0,19,24,1,10,1,12,1,16,1,8,1,22,255, 2,2,114,156,0,0,0,99,4,0,0,0,0,0,0,0, 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, @@ -805,7 +805,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,11,115,111,117,114,99,101,95,104,97,115,104,114, 116,0,0,0,114,151,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,18,95,118,97,108,105,100, - 97,116,101,95,104,97,115,104,95,112,121,99,49,2,0,0, + 97,116,101,95,104,97,115,104,95,112,121,99,50,2,0,0, 115,12,0,0,0,0,17,16,1,2,1,8,255,4,2,2, 254,114,158,0,0,0,99,4,0,0,0,0,0,0,0,0, 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, @@ -829,7 +829,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,116,0,0,0,114,106,0,0,0,114, 107,0,0,0,218,4,99,111,100,101,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,17,95,99,111,109,112, - 105,108,101,95,98,121,116,101,99,111,100,101,73,2,0,0, + 105,108,101,95,98,121,116,101,99,111,100,101,74,2,0,0, 115,18,0,0,0,0,2,10,1,10,1,12,1,8,1,12, 1,4,2,10,1,4,255,114,165,0,0,0,114,73,0,0, 0,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0, @@ -848,7 +848,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,114,155,0,0,0,114,26,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,22,95,99,111, 100,101,95,116,111,95,116,105,109,101,115,116,97,109,112,95, - 112,121,99,86,2,0,0,115,12,0,0,0,0,2,8,1, + 112,121,99,87,2,0,0,115,12,0,0,0,0,2,8,1, 14,1,14,1,14,1,16,1,114,170,0,0,0,84,99,3, 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5, 0,0,0,67,0,0,0,115,80,0,0,0,116,0,116,1, @@ -866,7 +866,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,7,99,104,101,99,107,101,100,114,26,0,0,0,114, 2,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,104,97, - 115,104,95,112,121,99,96,2,0,0,115,14,0,0,0,0, + 115,104,95,112,121,99,97,2,0,0,115,14,0,0,0,0, 2,8,1,12,1,14,1,16,1,10,1,16,1,114,171,0, 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,5, 0,0,0,6,0,0,0,67,0,0,0,115,62,0,0,0, @@ -893,7 +893,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,107, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,108, 2,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,176,0,0,0,169,2,114,140,0,0,0,218,26, 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, @@ -955,7 +955,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,182,0,0,0,90,7,100,105,114,110,97,109,101,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,23,115, 112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111, - 99,97,116,105,111,110,124,2,0,0,115,62,0,0,0,0, + 99,97,116,105,111,110,125,2,0,0,115,62,0,0,0,0, 12,8,4,4,1,10,2,2,1,14,1,12,1,8,2,10, 8,16,1,6,3,8,1,14,1,14,1,10,1,6,1,6, 2,4,3,8,2,10,1,2,1,14,1,12,1,6,2,4, @@ -992,7 +992,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,73, 78,69,41,2,218,3,99,108,115,114,7,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,14,95, - 111,112,101,110,95,114,101,103,105,115,116,114,121,204,2,0, + 111,112,101,110,95,114,101,103,105,115,116,114,121,205,2,0, 0,115,8,0,0,0,0,2,2,1,16,1,12,1,122,36, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105, @@ -1020,7 +1020,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, 104,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, - 114,121,211,2,0,0,115,24,0,0,0,0,2,6,1,8, + 114,121,212,2,0,0,115,24,0,0,0,0,2,6,1,8, 2,6,1,6,1,16,255,6,2,2,1,12,1,46,1,12, 1,8,1,122,38,87,105,110,100,111,119,115,82,101,103,105, 115,116,114,121,70,105,110,100,101,114,46,95,115,101,97,114, @@ -1042,7 +1042,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,6,116,97,114,103,101,116,114,199,0,0,0,114, 140,0,0,0,114,189,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,9,102, - 105,110,100,95,115,112,101,99,226,2,0,0,115,28,0,0, + 105,110,100,95,115,112,101,99,227,2,0,0,115,28,0,0, 0,0,2,10,1,8,1,4,1,2,1,12,1,12,1,8, 1,14,1,14,1,6,1,8,1,2,254,6,3,122,31,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, @@ -1061,7 +1061,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 2,114,203,0,0,0,114,140,0,0,0,169,4,114,193,0, 0,0,114,139,0,0,0,114,44,0,0,0,114,187,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,11,102,105,110,100,95,109,111,100,117,108,101,242,2,0, + 218,11,102,105,110,100,95,109,111,100,117,108,101,243,2,0, 0,115,8,0,0,0,0,7,12,1,8,1,6,2,122,33, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,102,105,110,100,95,109,111,100,117,108, @@ -1071,7 +1071,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,97,115,115,109,101,116,104,111,100,114,194,0,0,0,114, 200,0,0,0,114,203,0,0,0,114,206,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,191,0,0,0,192,2,0,0,115,28,0,0,0, + 0,0,114,191,0,0,0,193,2,0,0,115,28,0,0,0, 8,2,4,3,2,255,2,4,2,255,2,3,4,2,2,1, 10,6,2,1,10,14,2,1,12,15,2,1,114,191,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1107,7 +1107,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 139,0,0,0,114,96,0,0,0,90,13,102,105,108,101,110, 97,109,101,95,98,97,115,101,90,9,116,97,105,108,95,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,182,0,0,0,5,3,0,0,115,8,0,0,0, + 0,0,114,182,0,0,0,6,3,0,0,115,8,0,0,0, 0,3,18,1,16,1,14,1,122,24,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1118,7 +1118,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,46,78,114,5,0,0,0,169,2,114,118,0,0,0,114, 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,13,3,0,0,115,2,0,0,0,0,1,122,27,95, + 108,101,14,3,0,0,115,2,0,0,0,0,1,122,27,95, 76,111,97,100,101,114,66,97,115,105,99,115,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,5,0,0,0,67, @@ -1138,7 +1138,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 131,0,0,0,41,3,114,118,0,0,0,218,6,109,111,100, 117,108,101,114,164,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,11,101,120,101,99,95,109,111, - 100,117,108,101,16,3,0,0,115,12,0,0,0,0,2,12, + 100,117,108,101,17,3,0,0,115,12,0,0,0,0,2,12, 1,8,1,6,1,4,255,6,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1149,14 +1149,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,169,2,114,118,0,0,0,114,139,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,24,3, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,25,3, 0,0,115,2,0,0,0,0,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,125,0,0,0,114,124,0,0, 0,114,126,0,0,0,114,127,0,0,0,114,182,0,0,0, 114,212,0,0,0,114,217,0,0,0,114,220,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,208,0,0,0,0,3,0,0,115,10,0,0, + 0,0,0,114,208,0,0,0,1,3,0,0,115,10,0,0, 0,8,2,4,3,8,8,8,3,8,8,114,208,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,64,0,0,0,115,74,0,0,0,101,0, @@ -1181,7 +1181,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,32,32,78,41,1,114,50,0,0,0,169, 2,114,118,0,0,0,114,44,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,10,112,97,116,104, - 95,109,116,105,109,101,31,3,0,0,115,2,0,0,0,0, + 95,109,116,105,109,101,32,3,0,0,115,2,0,0,0,0, 6,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, @@ -1215,7 +1215,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,32,32,32,32,32,32,32,32,114,169,0,0,0, 41,1,114,223,0,0,0,114,222,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,39,3,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,40,3,0,0,115,2,0,0,0, 0,12,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, @@ -1239,7 +1239,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,107,0,0,0,90,10,99,97,99,104,101,95,112,97,116, 104,114,26,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,15,95,99,97,99,104,101,95,98,121, - 116,101,99,111,100,101,53,3,0,0,115,2,0,0,0,0, + 116,101,99,111,100,101,54,3,0,0,115,2,0,0,0,0, 8,122,28,83,111,117,114,99,101,76,111,97,100,101,114,46, 95,99,97,99,104,101,95,98,121,116,101,99,111,100,101,99, 3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, @@ -1256,7 +1256,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,46,10,32,32,32,32,32,32,32,32,78,114,5,0,0, 0,41,3,114,118,0,0,0,114,44,0,0,0,114,26,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,225,0,0,0,63,3,0,0,115,2,0,0,0,0, + 0,114,225,0,0,0,64,3,0,0,115,2,0,0,0,0, 1,122,21,83,111,117,114,99,101,76,111,97,100,101,114,46, 115,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0, 0,0,0,0,0,5,0,0,0,10,0,0,0,67,0,0, @@ -1277,7 +1277,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,41,5,114,118,0,0,0,114,139,0,0,0,114,44,0, 0,0,114,174,0,0,0,218,3,101,120,99,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,103,101,116, - 95,115,111,117,114,99,101,70,3,0,0,115,20,0,0,0, + 95,115,111,117,114,99,101,71,3,0,0,115,20,0,0,0, 0,2,10,1,2,1,14,1,14,1,4,1,2,255,4,1, 2,255,24,2,122,23,83,111,117,114,99,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,114,104,0, @@ -1299,7 +1299,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,7,99,111,109,112,105,108,101,41,4,114,118,0,0,0, 114,26,0,0,0,114,44,0,0,0,114,230,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,14, - 115,111,117,114,99,101,95,116,111,95,99,111,100,101,80,3, + 115,111,117,114,99,101,95,116,111,95,99,111,100,101,81,3, 0,0,115,6,0,0,0,0,5,12,1,4,255,122,27,83, 111,117,114,99,101,76,111,97,100,101,114,46,115,111,117,114, 99,101,95,116,111,95,99,111,100,101,99,2,0,0,0,0, @@ -1376,7 +1376,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,151,0,0,0,114,2,0,0,0,90, 10,98,121,116,101,115,95,100,97,116,97,90,11,99,111,100, 101,95,111,98,106,101,99,116,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,213,0,0,0,88,3,0,0, + 0,0,114,8,0,0,0,114,213,0,0,0,89,3,0,0, 115,152,0,0,0,0,7,10,1,4,1,4,1,4,1,4, 1,4,1,2,1,12,1,12,1,12,2,2,1,14,1,12, 1,8,2,12,1,2,1,14,1,12,1,6,3,2,1,2, @@ -1393,7 +1393,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,226,0,0,0,114,225,0,0,0,114,229,0,0,0,114, 233,0,0,0,114,213,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,221,0, - 0,0,29,3,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,30,3,0,0,115,14,0,0,0,8,2,8,8,8, 14,8,10,8,7,8,10,14,8,114,221,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 0,0,0,0,0,0,0,115,124,0,0,0,101,0,90,1, @@ -1422,7 +1422,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,102,105,110,100,101,114,46,78,114,159,0, 0,0,41,3,114,118,0,0,0,114,139,0,0,0,114,44, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,209,0,0,0,178,3,0,0,115,4,0,0,0, + 0,0,114,209,0,0,0,179,3,0,0,115,4,0,0,0, 0,3,6,1,122,19,70,105,108,101,76,111,97,100,101,114, 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, @@ -1431,7 +1431,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,2,218,9,95,95,99,108,97,115,115,95, 95,114,131,0,0,0,169,2,114,118,0,0,0,90,5,111, 116,104,101,114,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,6,95,95,101,113,95,95,184,3,0,0,115, + 0,0,0,218,6,95,95,101,113,95,95,185,3,0,0,115, 6,0,0,0,0,1,12,1,10,255,122,17,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, @@ -1440,7 +1440,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,3,218,4,104,97,115,104,114,116,0,0, 0,114,44,0,0,0,169,1,114,118,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,218,8,95,95, - 104,97,115,104,95,95,188,3,0,0,115,2,0,0,0,0, + 104,97,115,104,95,95,189,3,0,0,115,2,0,0,0,0, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,115, @@ -1454,7 +1454,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5, 115,117,112,101,114,114,239,0,0,0,114,220,0,0,0,114, 219,0,0,0,169,1,114,241,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,220,0,0,0,191,3,0,0,115,2, + 114,8,0,0,0,114,220,0,0,0,192,3,0,0,115,2, 0,0,0,0,10,122,22,70,105,108,101,76,111,97,100,101, 114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1464,7 +1464,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,114, 48,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,179,0,0,0,203,3,0, + 0,0,0,114,8,0,0,0,114,179,0,0,0,204,3,0, 0,115,2,0,0,0,0,3,122,23,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,109, 101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1486,7 +1486,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,90,4,114,101,97,100,114,65,0,0,0,41,3,114, 118,0,0,0,114,44,0,0,0,114,68,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,227,0, - 0,0,208,3,0,0,115,10,0,0,0,0,2,14,1,16, + 0,0,209,3,0,0,115,10,0,0,0,0,2,14,1,16, 1,40,2,14,1,122,19,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,100,97,116,97,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1495,7 +1495,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,182,0,0,0,169,2,114,118,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, 0,218,19,103,101,116,95,114,101,115,111,117,114,99,101,95, - 114,101,97,100,101,114,219,3,0,0,115,6,0,0,0,0, + 114,101,97,100,101,114,220,3,0,0,115,6,0,0,0,0, 2,10,1,4,1,122,30,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,114,101,115,111,117,114,99,101,95,114, 101,97,100,101,114,99,2,0,0,0,0,0,0,0,0,0, @@ -1507,7 +1507,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,64,0,0,0,114,65,0,0,0,169,3,114,118,0, 0,0,90,8,114,101,115,111,117,114,99,101,114,44,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,225, + 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,226, 3,0,0,115,4,0,0,0,0,1,20,1,122,24,70,105, 108,101,76,111,97,100,101,114,46,111,112,101,110,95,114,101, 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0, @@ -1520,7 +1520,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,114,38,0,0,0,114,47,0,0,0,114,44, 0,0,0,114,255,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,13,114,101,115,111,117,114,99, - 101,95,112,97,116,104,229,3,0,0,115,8,0,0,0,0, + 101,95,112,97,116,104,230,3,0,0,115,8,0,0,0,0, 1,10,1,4,1,20,1,122,24,70,105,108,101,76,111,97, 100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,116, 104,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1532,7 +1532,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,44,0,0,0,114,54,0,0,0,169,3,114,118,0, 0,0,114,116,0,0,0,114,44,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,2,1,0,0, - 235,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, + 236,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, 1,122,22,70,105,108,101,76,111,97,100,101,114,46,105,115, 95,114,101,115,111,117,114,99,101,99,1,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,0, @@ -1542,7 +1542,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,7,108,105,115,116,100,105,114,114,47,0,0,0,114, 44,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,8,99,111,110,116,101,110, - 116,115,241,3,0,0,115,2,0,0,0,0,1,122,19,70, + 116,115,242,3,0,0,115,2,0,0,0,0,1,122,19,70, 105,108,101,76,111,97,100,101,114,46,99,111,110,116,101,110, 116,115,41,17,114,125,0,0,0,114,124,0,0,0,114,126, 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, @@ -1551,7 +1551,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,0,1,0,0,114,4,1,0,0,114,2,1,0,0,114, 8,1,0,0,90,13,95,95,99,108,97,115,115,99,101,108, 108,95,95,114,5,0,0,0,114,5,0,0,0,114,249,0, - 0,0,114,8,0,0,0,114,239,0,0,0,173,3,0,0, + 0,0,114,8,0,0,0,114,239,0,0,0,174,3,0,0, 115,30,0,0,0,8,2,4,3,8,6,8,4,8,3,2, 1,14,11,2,1,10,4,8,11,2,1,10,5,8,4,8, 6,8,6,114,239,0,0,0,99,0,0,0,0,0,0,0, @@ -1574,7 +1574,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 49,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, 115,116,95,115,105,122,101,41,3,114,118,0,0,0,114,44, 0,0,0,114,238,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,224,0,0,0,249,3,0,0, + 0,0,114,8,0,0,0,114,224,0,0,0,250,3,0,0, 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,0, @@ -1585,7 +1585,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 225,0,0,0,41,5,114,118,0,0,0,114,107,0,0,0, 114,106,0,0,0,114,26,0,0,0,114,52,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,226, - 0,0,0,254,3,0,0,115,4,0,0,0,0,2,8,1, + 0,0,0,255,3,0,0,115,4,0,0,0,0,2,8,1, 122,32,83,111,117,114,99,101,70,105,108,101,76,111,97,100, 101,114,46,95,99,97,99,104,101,95,98,121,116,101,99,111, 100,101,114,60,0,0,0,114,11,1,0,0,99,3,0,0, @@ -1620,7 +1620,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,0,0,218,6,112,97,114,101,110,116,114,96,0,0,0, 114,37,0,0,0,114,33,0,0,0,114,228,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,225, - 0,0,0,3,4,0,0,115,46,0,0,0,0,2,12,1, + 0,0,0,4,4,0,0,115,46,0,0,0,0,2,12,1, 4,2,12,1,12,1,12,2,12,1,10,1,2,1,14,1, 12,2,8,1,14,3,6,1,4,255,4,2,28,1,2,1, 12,1,16,1,16,2,8,1,2,255,122,25,83,111,117,114, @@ -1629,7 +1629,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,126,0,0,0,114,127,0,0,0,114,224,0,0, 0,114,226,0,0,0,114,225,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 9,1,0,0,245,3,0,0,115,8,0,0,0,8,2,4, + 9,1,0,0,246,3,0,0,115,8,0,0,0,8,2,4, 2,8,5,8,5,114,9,1,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, @@ -1651,7 +1651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,235,0,0,0,41,5,114,118,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,26,0,0,0,114,151,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 213,0,0,0,38,4,0,0,115,22,0,0,0,0,1,10, + 213,0,0,0,39,4,0,0,115,22,0,0,0,0,1,10, 1,10,4,2,1,2,254,6,4,12,1,2,1,14,1,2, 1,2,253,122,29,83,111,117,114,99,101,108,101,115,115,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, @@ -1661,14 +1661,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,110,101,32,97,115,32,116,104,101,114,101,32,105,115,32, 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, 114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,229,0,0,0,54,4, + 5,0,0,0,114,8,0,0,0,114,229,0,0,0,55,4, 0,0,115,2,0,0,0,0,2,122,31,83,111,117,114,99, 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,78,41,6,114,125,0, 0,0,114,124,0,0,0,114,126,0,0,0,114,127,0,0, 0,114,213,0,0,0,114,229,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 15,1,0,0,34,4,0,0,115,6,0,0,0,8,2,4, + 15,1,0,0,35,4,0,0,115,6,0,0,0,8,2,4, 2,8,16,114,15,1,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, 0,115,92,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1688,7 +1688,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,16,0,0,0,124,1,124,0,95,0,124,2,124,0, 95,1,100,0,83,0,114,109,0,0,0,114,159,0,0,0, 114,5,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,71,4,0,0,115,4,0, + 8,0,0,0,114,209,0,0,0,72,4,0,0,115,4,0, 0,0,0,1,6,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1696,7 +1696,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,124,0,106,0,124,1,106,0,107,2,111,22,124,0, 106,1,124,1,106,1,107,2,83,0,114,109,0,0,0,114, 240,0,0,0,114,242,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,243,0,0,0,75,4,0, + 0,0,0,114,8,0,0,0,114,243,0,0,0,76,4,0, 0,115,6,0,0,0,0,1,12,1,10,255,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1704,7 +1704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,20,0,0,0,116,0,124,0,106,1,131,1,116,0, 124,0,106,2,131,1,65,0,83,0,114,109,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,247,0,0,0,79,4,0, + 0,0,0,114,8,0,0,0,114,247,0,0,0,80,4,0, 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, @@ -1721,7 +1721,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,116,101,95,100,121,110,97,109,105,99,114,149,0,0,0, 114,116,0,0,0,114,44,0,0,0,41,3,114,118,0,0, 0,114,187,0,0,0,114,216,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,82, + 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,83, 4,0,0,115,14,0,0,0,0,2,4,1,6,255,4,2, 6,1,8,255,4,2,122,33,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,97, @@ -1738,7 +1738,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 214,0,0,0,114,163,0,0,0,90,12,101,120,101,99,95, 100,121,110,97,109,105,99,114,149,0,0,0,114,116,0,0, 0,114,44,0,0,0,114,253,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,90, + 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,91, 4,0,0,115,8,0,0,0,0,2,14,1,6,1,8,255, 122,31,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, @@ -1757,7 +1757,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,169,2,114,32,0,0,0,218,6,115,117,102,102,105, 120,169,1,90,9,102,105,108,101,95,110,97,109,101,114,5, 0,0,0,114,8,0,0,0,218,9,60,103,101,110,101,120, - 112,114,62,99,4,0,0,115,4,0,0,0,4,1,2,255, + 112,114,62,100,4,0,0,115,4,0,0,0,4,1,2,255, 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, @@ -1765,7 +1765,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, 83,85,70,70,73,88,69,83,114,219,0,0,0,114,5,0, 0,0,114,18,1,0,0,114,8,0,0,0,114,182,0,0, - 0,96,4,0,0,115,8,0,0,0,0,2,14,1,12,1, + 0,97,4,0,0,115,8,0,0,0,0,2,14,1,12,1, 2,255,122,30,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1776,7 +1776,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,32,99,114,101,97,116,101,32,97,32,99,111,100,101,32, 111,98,106,101,99,116,46,78,114,5,0,0,0,114,219,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,213,0,0,0,102,4,0,0,115,2,0,0,0,0, + 0,114,213,0,0,0,103,4,0,0,115,2,0,0,0,0, 2,122,28,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1786,14 +1786,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,117,108,101,115,32,104,97,118,101,32,110,111,32,115,111, 117,114,99,101,32,99,111,100,101,46,78,114,5,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,229,0,0,0,106,4,0,0,115,2,0, + 8,0,0,0,114,229,0,0,0,107,4,0,0,115,2,0, 0,0,0,2,122,30,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, 117,114,99,101,99,2,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,6,0, 0,0,124,0,106,0,83,0,114,250,0,0,0,114,48,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,179,0,0,0,110,4,0,0,115, + 0,114,8,0,0,0,114,179,0,0,0,111,4,0,0,115, 2,0,0,0,0,3,122,32,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 102,105,108,101,110,97,109,101,78,41,14,114,125,0,0,0, @@ -1802,7 +1802,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,217,0,0,0,114,182,0,0,0,114,213,0, 0,0,114,229,0,0,0,114,136,0,0,0,114,179,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,252,0,0,0,63,4,0,0,115,22, + 114,8,0,0,0,114,252,0,0,0,64,4,0,0,115,22, 0,0,0,8,2,4,6,8,4,8,4,8,3,8,8,8, 6,8,6,8,4,8,4,2,1,114,252,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1845,7 +1845,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 169,4,114,118,0,0,0,114,116,0,0,0,114,44,0,0, 0,90,11,112,97,116,104,95,102,105,110,100,101,114,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,209,0, - 0,0,123,4,0,0,115,8,0,0,0,0,1,6,1,6, + 0,0,124,4,0,0,115,8,0,0,0,0,1,6,1,6, 1,14,1,122,23,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0, @@ -1862,7 +1862,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,14,1,0,0,218,3,100,111,116,90, 2,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,23,95,102,105,110,100,95,112,97,114,101,110,116, - 95,112,97,116,104,95,110,97,109,101,115,129,4,0,0,115, + 95,112,97,116,104,95,110,97,109,101,115,130,4,0,0,115, 8,0,0,0,0,2,18,1,8,2,4,3,122,38,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,102,105, 110,100,95,112,97,114,101,110,116,95,112,97,116,104,95,110, @@ -1875,7 +1875,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 118,0,0,0,90,18,112,97,114,101,110,116,95,109,111,100, 117,108,101,95,110,97,109,101,90,14,112,97,116,104,95,97, 116,116,114,95,110,97,109,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,25,1,0,0,139,4,0,0, + 0,0,114,8,0,0,0,114,25,1,0,0,140,4,0,0, 115,4,0,0,0,0,1,12,1,122,31,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,103,101,116,95,112, 97,114,101,110,116,95,112,97,116,104,99,1,0,0,0,0, @@ -1891,7 +1891,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,24,1,0,0,41,3,114,118,0,0,0,90,11, 112,97,114,101,110,116,95,112,97,116,104,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,114,101,99,97,108,99,117,108,97,116,101,143,4,0, + 12,95,114,101,99,97,108,99,117,108,97,116,101,144,4,0, 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, @@ -1900,7 +1900,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,6,1,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,8,95,95,105,116,101,114,95,95,156,4,0,0, + 0,0,218,8,95,95,105,116,101,114,95,95,157,4,0,0, 115,2,0,0,0,0,1,122,23,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,105,116,101,114,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1909,7 +1909,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,32,1,0,0,41,2,114,118,0,0,0,218,5,105, 110,100,101,120,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,95,95,103,101,116,105,116,101,109,95,95, - 159,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, + 160,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, 109,101,115,112,97,99,101,80,97,116,104,46,95,95,103,101, 116,105,116,101,109,95,95,99,3,0,0,0,0,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1917,7 +1917,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,83,0,114,109,0,0,0,41,1,114,24,1,0,0,41, 3,114,118,0,0,0,114,35,1,0,0,114,44,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,162,4,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,163,4,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, @@ -1925,7 +1925,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,23,0,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,7,95,95,108,101,110,95,95,165,4,0,0,115, + 0,0,218,7,95,95,108,101,110,95,95,166,4,0,0,115, 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, @@ -1934,7 +1934,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125, 41,41,2,114,62,0,0,0,114,24,1,0,0,114,246,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,8,95,95,114,101,112,114,95,95,168,4,0,0,115, + 0,218,8,95,95,114,101,112,114,95,95,169,4,0,0,115, 2,0,0,0,0,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,114,101,112,114,95,95,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1942,7 +1942,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,160,0,161,0,118,0,83,0,114,109,0,0,0,114,34, 1,0,0,169,2,114,118,0,0,0,218,4,105,116,101,109, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,95,99,111,110,116,97,105,110,115,95,95,171,4,0, + 12,95,95,99,111,110,116,97,105,110,115,95,95,172,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,99,111,110,116,97, 105,110,115,95,95,99,2,0,0,0,0,0,0,0,0,0, @@ -1950,7 +1950,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,124,0,106,0,160,1,124,1,161,1,1,0,100, 0,83,0,114,109,0,0,0,41,2,114,24,1,0,0,114, 186,0,0,0,114,40,1,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,186,0,0,0,174,4,0, + 0,0,0,114,8,0,0,0,114,186,0,0,0,175,4,0, 0,115,2,0,0,0,0,1,122,21,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,97,112,112,101,110,100,78, 41,15,114,125,0,0,0,114,124,0,0,0,114,126,0,0, @@ -1959,7 +1959,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 36,1,0,0,114,37,1,0,0,114,38,1,0,0,114,39, 1,0,0,114,42,1,0,0,114,186,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,22,1,0,0,116,4,0,0,115,24,0,0,0,8, + 0,114,22,1,0,0,117,4,0,0,115,24,0,0,0,8, 1,4,6,8,6,8,10,8,4,8,13,8,3,8,3,8, 3,8,3,8,3,8,3,114,22,1,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, @@ -1975,7 +1975,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,2,124,3,131,3,124,0,95,1,100,0,83,0,114,109, 0,0,0,41,2,114,22,1,0,0,114,24,1,0,0,114, 28,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,209,0,0,0,180,4,0,0,115,2,0,0, + 0,0,0,114,209,0,0,0,181,4,0,0,115,2,0,0, 0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, @@ -1992,21 +1992,21 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,109,101,115,112,97,99,101,41,62,41,2,114,62,0,0, 0,114,125,0,0,0,41,2,114,193,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,109,111,100,117,108,101,95,114,101,112,114,183,4, + 0,218,11,109,111,100,117,108,101,95,114,101,112,114,184,4, 0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117, 108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, 115,4,0,0,0,100,1,83,0,41,2,78,84,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,182,0,0,0,192,4,0,0,115, + 0,114,8,0,0,0,114,182,0,0,0,193,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, 97,103,101,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, 0,100,1,83,0,41,2,78,114,40,0,0,0,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,229,0,0,0,195,4,0,0,115, + 0,114,8,0,0,0,114,229,0,0,0,196,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2016,20 +2016,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,103,62,114,215,0,0,0,84,41,1,114,231,0,0,0, 41,1,114,232,0,0,0,114,219,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,213,0,0,0, - 198,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, + 199,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, 109,101,115,112,97,99,101,76,111,97,100,101,114,46,103,101, 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,114,210,0,0,0,114,5,0, 0,0,114,211,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,212,0,0,0,201,4,0,0,115, + 0,114,8,0,0,0,114,212,0,0,0,202,4,0,0,115, 2,0,0,0,0,1,122,30,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,99,114,101,97,116,101,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,0,83,0,114,109,0,0,0,114,5,0, 0,0,114,253,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,217,0,0,0,204,4,0,0,115, + 0,114,8,0,0,0,114,217,0,0,0,205,4,0,0,115, 2,0,0,0,0,1,122,28,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2047,7 +2047,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,112,97,116,104,32,123,33,114,125,41,4,114,134,0,0, 0,114,149,0,0,0,114,24,1,0,0,114,218,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,220,0,0,0,207,4,0,0,115,8,0, + 8,0,0,0,114,220,0,0,0,208,4,0,0,115,8,0, 0,0,0,7,6,1,4,255,4,2,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,108,111,97, 100,95,109,111,100,117,108,101,78,41,12,114,125,0,0,0, @@ -2056,7 +2056,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,213,0,0,0,114,212,0,0,0,114,217,0, 0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,43,1,0,0, - 179,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, + 180,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, 8,8,3,8,3,8,3,8,3,8,3,114,43,1,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,4,0,0,0,64,0,0,0,115,118,0,0,0,101,0, @@ -2093,7 +2093,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,46,1,0,0,41,3,114,193,0,0,0,114, 116,0,0,0,218,6,102,105,110,100,101,114,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,46,1,0,0, - 225,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, + 226,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, 1,10,1,122,28,80,97,116,104,70,105,110,100,101,114,46, 105,110,118,97,108,105,100,97,116,101,95,99,97,99,104,101, 115,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -2113,7 +2113,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,0,0,0,41,3,114,193,0,0,0,114,44,0,0,0, 90,4,104,111,111,107,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,235,4,0,0,115,16,0,0,0,0,3,16,1,12, + 107,115,236,4,0,0,115,16,0,0,0,0,3,16,1,12, 1,10,1,2,1,14,1,12,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2144,7 +2144,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,44,0,0,0,114,50,1,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,20,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,248,4,0,0,115,22,0,0,0,0,8,8,1,2,1, + 101,249,4,0,0,115,22,0,0,0,0,8,8,1,2,1, 12,1,12,3,8,1,2,1,14,1,12,1,10,1,16,1, 122,31,80,97,116,104,70,105,110,100,101,114,46,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, @@ -2161,7 +2161,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,193,0,0,0,114,139,0,0,0,114,50,1,0,0,114, 140,0,0,0,114,141,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,16,95, - 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,14, + 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,15, 5,0,0,115,18,0,0,0,0,4,10,1,16,2,10,1, 4,1,8,1,12,1,12,1,6,1,122,27,80,97,116,104, 70,105,110,100,101,114,46,95,108,101,103,97,99,121,95,103, @@ -2193,7 +2193,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,112,97,116,104,90,5,101,110,116,114,121,114,50,1,0, 0,114,187,0,0,0,114,141,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,9,95,103,101,116, - 95,115,112,101,99,29,5,0,0,115,40,0,0,0,0,5, + 95,115,112,101,99,30,5,0,0,115,40,0,0,0,0,5, 4,1,8,1,14,1,2,1,10,1,8,1,10,1,14,2, 12,1,8,1,2,1,10,1,8,1,6,1,8,1,8,5, 12,2,12,1,6,1,122,20,80,97,116,104,70,105,110,100, @@ -2220,7 +2220,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,22,1,0,0,41,6,114,193,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,202,0,0,0,114,187,0,0,0, 114,57,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,203,0,0,0,61,5,0,0,115,26,0, + 8,0,0,0,114,203,0,0,0,62,5,0,0,115,26,0, 0,0,0,6,8,1,6,1,14,1,8,1,4,1,10,1, 6,1,4,3,6,1,16,1,4,2,6,2,122,20,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,115,112, @@ -2240,7 +2240,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, 100,46,10,10,32,32,32,32,32,32,32,32,78,114,204,0, 0,0,114,205,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,206,0,0,0,85,5,0,0,115, + 0,114,8,0,0,0,114,206,0,0,0,86,5,0,0,115, 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, @@ -2272,7 +2272,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,95,100,105,115,116,114,105,98,117,116,105,111,110,115,41, 4,114,193,0,0,0,114,119,0,0,0,114,120,0,0,0, 114,59,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,60,1,0,0,98,5,0,0,115,4,0, + 8,0,0,0,114,60,1,0,0,99,5,0,0,115,4,0, 0,0,0,10,12,1,122,29,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,100,105,115,116,114,105,98,117, 116,105,111,110,115,41,1,78,41,2,78,78,41,1,78,41, @@ -2281,7 +2281,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 52,1,0,0,114,54,1,0,0,114,55,1,0,0,114,58, 1,0,0,114,203,0,0,0,114,206,0,0,0,114,60,1, 0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,45,1,0,0,221,4,0,0,115, + 0,114,8,0,0,0,114,45,1,0,0,222,4,0,0,115, 34,0,0,0,8,2,4,2,2,1,10,9,2,1,10,12, 2,1,10,21,2,1,10,14,2,1,12,31,2,1,12,23, 2,1,12,12,2,1,114,45,1,0,0,99,0,0,0,0, @@ -2326,7 +2326,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 14,125,1,124,1,136,0,102,2,86,0,1,0,113,2,100, 0,83,0,114,109,0,0,0,114,5,0,0,0,114,16,1, 0,0,169,1,114,140,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,19,1,0,0,127,5,0,0,243,0,0,0, + 0,0,0,114,19,1,0,0,128,5,0,0,243,0,0,0, 0,122,38,70,105,108,101,70,105,110,100,101,114,46,95,95, 105,110,105,116,95,95,46,60,108,111,99,97,108,115,62,46, 60,103,101,110,101,120,112,114,62,114,71,0,0,0,114,104, @@ -2338,7 +2338,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,44,0,0,0,218,14,108,111,97,100, 101,114,95,100,101,116,97,105,108,115,90,7,108,111,97,100, 101,114,115,114,189,0,0,0,114,5,0,0,0,114,62,1, - 0,0,114,8,0,0,0,114,209,0,0,0,121,5,0,0, + 0,0,114,8,0,0,0,114,209,0,0,0,122,5,0,0, 115,16,0,0,0,0,4,4,1,12,1,26,1,6,2,10, 1,6,1,8,1,122,19,70,105,108,101,70,105,110,100,101, 114,46,95,95,105,110,105,116,95,95,99,1,0,0,0,0, @@ -2348,7 +2348,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, 116,105,109,101,46,114,104,0,0,0,78,41,1,114,65,1, 0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,46,1,0,0,135,5,0,0,115, + 0,114,8,0,0,0,114,46,1,0,0,136,5,0,0,115, 2,0,0,0,0,2,122,28,70,105,108,101,70,105,110,100, 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, 99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2371,7 +2371,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,78,41,3,114,203,0,0,0,114,140,0, 0,0,114,178,0,0,0,41,3,114,118,0,0,0,114,139, 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,137,0,0,0,141,5,0,0, + 0,0,114,8,0,0,0,114,137,0,0,0,142,5,0,0, 115,8,0,0,0,0,7,10,1,8,1,8,1,122,22,70, 105,108,101,70,105,110,100,101,114,46,102,105,110,100,95,108, 111,97,100,101,114,99,6,0,0,0,0,0,0,0,0,0, @@ -2382,7 +2382,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,188,0,0,0,114,139,0,0,0,114,44,0, 0,0,90,4,115,109,115,108,114,202,0,0,0,114,140,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,58,1,0,0,153,5,0,0,115,8,0,0,0,0, + 0,114,58,1,0,0,154,5,0,0,115,8,0,0,0,0, 1,10,1,8,1,2,255,122,20,70,105,108,101,70,105,110, 100,101,114,46,95,103,101,116,95,115,112,101,99,78,99,3, 0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,8, @@ -2436,7 +2436,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,17,1,0,0,114,188,0,0,0,90,13,105,110,105, 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, 95,112,97,116,104,114,187,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,203,0,0,0,158,5, + 5,0,0,0,114,8,0,0,0,114,203,0,0,0,159,5, 0,0,115,72,0,0,0,0,5,4,1,14,1,2,1,24, 1,12,1,10,1,10,1,8,1,6,2,6,1,6,1,10, 2,6,1,4,2,8,1,12,1,14,1,8,1,10,1,8, @@ -2468,7 +2468,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 161,0,146,2,113,4,83,0,114,5,0,0,0,41,1,114, 105,0,0,0,41,2,114,32,0,0,0,90,2,102,110,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,9, - 60,115,101,116,99,111,109,112,62,235,5,0,0,114,63,1, + 60,115,101,116,99,111,109,112,62,236,5,0,0,114,63,1, 0,0,122,41,70,105,108,101,70,105,110,100,101,114,46,95, 102,105,108,108,95,99,97,99,104,101,46,60,108,111,99,97, 108,115,62,46,60,115,101,116,99,111,109,112,62,78,41,18, @@ -2484,7 +2484,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 102,102,105,120,95,99,111,110,116,101,110,116,115,114,41,1, 0,0,114,116,0,0,0,114,29,1,0,0,114,17,1,0, 0,90,8,110,101,119,95,110,97,109,101,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,206, + 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,207, 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, 18,3,10,3,12,1,12,7,6,1,8,1,16,1,4,1, 18,2,4,1,12,1,6,1,12,1,122,22,70,105,108,101, @@ -2523,14 +2523,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,48,0,0,0,169,2,114,193,0,0,0,114,69,1, 0,0,114,5,0,0,0,114,8,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,247,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,248,5,0,0,115,6,0,0,0,0, 2,8,1,12,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, 111,114,95,70,105,108,101,70,105,110,100,101,114,114,5,0, 0,0,41,3,114,193,0,0,0,114,69,1,0,0,114,76, 1,0,0,114,5,0,0,0,114,75,1,0,0,114,8,0, - 0,0,218,9,112,97,116,104,95,104,111,111,107,237,5,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,238,5,0, 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -2539,7 +2539,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41, 2,114,62,0,0,0,114,44,0,0,0,114,246,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 39,1,0,0,255,5,0,0,115,2,0,0,0,0,1,122, + 39,1,0,0,0,6,0,0,115,2,0,0,0,0,1,122, 19,70,105,108,101,70,105,110,100,101,114,46,95,95,114,101, 112,114,95,95,41,1,78,41,15,114,125,0,0,0,114,124, 0,0,0,114,126,0,0,0,114,127,0,0,0,114,209,0, @@ -2547,7 +2547,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,137,0,0,0,114,58,1,0,0,114,203,0,0,0, 114,70,1,0,0,114,207,0,0,0,114,77,1,0,0,114, 39,1,0,0,114,5,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,61,1,0,0,112,5,0, + 0,0,0,114,8,0,0,0,114,61,1,0,0,113,5,0, 0,115,22,0,0,0,8,2,4,7,8,14,8,4,4,2, 8,12,8,5,10,48,8,31,2,1,10,17,114,61,1,0, 0,99,4,0,0,0,0,0,0,0,0,0,0,0,6,0, @@ -2571,7 +2571,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,112,97,116,104,110,97,109,101,114,140,0,0,0,114,187, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,5,6,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,6,6,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,14, 1,2,1,8,1,8,1,8,1,12,1,12,2,114,82,1, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, @@ -2591,7 +2591,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 10,101,120,116,101,110,115,105,111,110,115,90,6,115,111,117, 114,99,101,90,8,98,121,116,101,99,111,100,101,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,184,0,0, - 0,28,6,0,0,115,8,0,0,0,0,5,12,1,8,1, + 0,29,6,0,0,115,8,0,0,0,0,5,12,1,8,1, 8,1,114,184,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,10,0,0,0,9,0,0,0,67,0,0,0, 115,132,1,0,0,124,0,97,0,116,0,106,1,97,1,116, @@ -2639,7 +2639,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,83,0,41,2,114,39,0,0,0,78,41,1,114,23,0, 0,0,41,2,114,32,0,0,0,114,94,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,19,1, - 0,0,57,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,58,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,73,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2651,7 +2651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 157,2,146,2,113,4,83,0,41,1,114,74,0,0,0,114, 5,0,0,0,41,2,114,32,0,0,0,218,1,115,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,71,1, - 0,0,74,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,75,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,115,101, 116,99,111,109,112,62,41,3,114,64,0,0,0,114,75,0, 0,0,114,160,0,0,0,114,192,0,0,0,114,9,0,0, @@ -2671,7 +2671,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,116,105,110,95,110,97,109,101,115,90,12,98,117,105,108, 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, 110,95,109,111,100,117,108,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,39, + 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,40, 6,0,0,115,70,0,0,0,0,8,4,1,6,1,6,2, 10,3,22,1,12,2,22,1,8,1,10,1,10,1,6,2, 2,1,10,1,10,1,12,1,12,2,8,2,12,1,12,1, @@ -2691,7 +2691,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,186,0,0,0,114,45,1,0,0,41,2,114,88,1, 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, 97,100,101,114,115,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,105,110,115,116,97,108,108,96,6, + 8,0,0,0,218,8,95,105,110,115,116,97,108,108,97,6, 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, 91,1,0,0,41,1,114,60,0,0,0,41,1,78,41,3, 78,78,78,41,2,114,73,0,0,0,114,73,0,0,0,41, @@ -2725,7 +2725,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,8,60,109,111,100,117,108,101,62,1,0,0,0,115,126, 0,0,0,4,22,4,1,4,1,2,1,2,255,4,4,8, 17,8,5,8,5,8,6,8,6,8,12,8,10,8,9,8, - 5,8,7,8,9,10,22,10,127,0,20,16,1,12,2,4, + 5,8,7,8,9,10,22,10,127,0,21,16,1,12,2,4, 1,4,2,6,2,6,2,8,2,16,71,8,40,8,19,8, 12,8,12,8,28,8,17,8,33,8,28,8,24,10,13,10, 10,10,11,8,14,6,3,4,1,2,255,12,68,14,64,14, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 538fdbe3e0b5ae..6f2b3e791d1f29 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -165,7 +165,7 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&_unknown_opcode, + &&TARGET_GET_MATCH_ITER, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 2586ee67ca16b53e44f35d58ffd45771f978086f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 16:16:42 -0700 Subject: [PATCH 024/218] Add string tests --- Lib/test/test_patma.py | 58 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 3ee59e620584ea..b1c02c1e060357 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -328,9 +328,63 @@ def test_iter_8(self) -> None: self.assertEqual(namespace.get("x"), []) self.assertEqual(namespace.get("y"), 2) + def test_string_0(self) -> None: + match_cases = [MatchCase("['x']", "y = 0"), MatchCase("'x'", "y = 1")] + namespace = self.execute_match("x = 'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "x") + self.assertEqual(namespace.get("y"), 1) + + def test_string_1(self) -> None: + match_cases = [ + MatchCase("[b'x']", "y = 0"), + MatchCase("['x']", "y = 1"), + MatchCase("[120]", "y = 2"), + MatchCase("120", "y = 3"), + MatchCase("b'x'", "y = 4"), + ] + namespace = self.execute_match("x = b'x'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), b"x") + self.assertEqual(namespace.get("y"), 4) + + def test_string_2(self) -> None: + match_cases = [MatchCase("[120]", "y = 0"), MatchCase("120", "y = 1")] + namespace = self.execute_match("x = bytearray(b'x')", "x", match_cases, "") + self.assertEqual(namespace.get("x"), b"x") + self.assertNotIn("y", namespace) + + def test_string_3(self) -> None: + match_cases = [ + MatchCase("[]", "y = 0"), + MatchCase("['']", "y = 1"), + MatchCase("''", "y = 2"), + ] + namespace = self.execute_match("x = ''", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "") + self.assertEqual(namespace.get("y"), 2) + + def test_string_4(self) -> None: + match_cases = [ + MatchCase("['x', 'x', 'x']", "y = 0"), + MatchCase("['xxx']", "y = 1"), + MatchCase("'xxx'", "y = 2"), + ] + namespace = self.execute_match("x = 'xxx'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), "xxx") + self.assertEqual(namespace.get("y"), 2) + + def test_string_5(self) -> None: + match_cases = [ + MatchCase("[120, 120, 120]", "y = 0"), + MatchCase("[b'xxx']", "y = 1"), + MatchCase("b'xxx'", "y = 2"), + ] + namespace = self.execute_match("x = b'xxx'", "x", match_cases, "") + self.assertEqual(namespace.get("x"), b"xxx") + self.assertEqual(namespace.get("y"), 2) + if __name__ == "__main__": # XXX: For quick test debugging... import dis - match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] - dis.dis(TestAST.compile_match("x = [0, 0]", "x", match_cases, "")) + match_cases = [MatchCase("([0, 1]) | (1 | (z := 2), 0, q, [[[]]])", "pass")] + dis.dis(TestAST.compile_match("", "x", match_cases, "")) From adb04fd3f2bb6dc03593e519a163ddc52942ea36 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 23:09:21 -0700 Subject: [PATCH 025/218] Rename and add patma tests --- Lib/test/test_patma.py | 122 +++++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 46 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index b1c02c1e060357..20e4207ab20fe3 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -53,109 +53,109 @@ def execute_match( exec(cls.compile_match(pre, target, match_cases, post), None, namespace) return namespace - def test_steroid_switch_0(self) -> None: + def test_steroid_switch_00(self) -> None: match_cases = [MatchCase("0", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_1(self) -> None: + def test_steroid_switch_01(self) -> None: match_cases = [MatchCase("False", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_2(self) -> None: + def test_steroid_switch_02(self) -> None: match_cases = [MatchCase("1", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_3(self) -> None: + def test_steroid_switch_03(self) -> None: match_cases = [MatchCase("None", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_4(self) -> None: + def test_steroid_switch_04(self) -> None: match_cases = [MatchCase("0", "y = 0"), MatchCase("0", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_5(self) -> None: + def test_steroid_switch_05(self) -> None: match_cases = [MatchCase("1", "y = 0"), MatchCase("1", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_6(self) -> None: + def test_steroid_switch_06(self) -> None: match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_7(self) -> None: + def test_steroid_switch_07(self) -> None: match_cases = [MatchCase("'y'", "y = 0"), MatchCase("'x'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_8(self) -> None: + def test_steroid_switch_08(self) -> None: match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_9(self) -> None: + def test_steroid_switch_09(self) -> None: match_cases = [MatchCase("b'y'", "y = 0"), MatchCase("b'x'", "y = 1")] namespace = self.execute_match("x = b'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), b"x") self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_guard_0(self) -> None: + def test_steroid_switch_guard_00(self) -> None: match_cases = [MatchCase("0", "y = 0", "False"), MatchCase("0", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_guard_1(self) -> None: + def test_steroid_switch_guard_01(self) -> None: match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_guard_2(self) -> None: + def test_steroid_switch_guard_02(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_guard_3(self) -> None: + def test_steroid_switch_guard_03(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_guard_4(self) -> None: + def test_steroid_switch_guard_04(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 2) - def test_steroid_switch_guard_5(self) -> None: + def test_steroid_switch_guard_05(self) -> None: match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "1")] namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 2) - def test_steroid_switch_guard_6(self) -> None: + def test_steroid_switch_guard_06(self) -> None: match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("1", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertNotIn("y", namespace) - def test_walrus_0(self) -> None: + def test_walrus_00(self) -> None: match_cases = [ MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("(z := 0)", "y = 1"), @@ -165,7 +165,7 @@ def test_walrus_0(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) - def test_walrus_1(self) -> None: + def test_walrus_01(self) -> None: match_cases = [ MatchCase("(z := 1)", "y = 0", "not (x := 1)"), MatchCase("0", "y = 1"), @@ -175,21 +175,21 @@ def test_walrus_1(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertNotIn("z", namespace) - def test_walrus_2(self) -> None: + def test_walrus_02(self) -> None: match_cases = [MatchCase("(z := 0)", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_walrus_3(self) -> None: + def test_walrus_03(self) -> None: match_cases = [MatchCase("(z := 1)", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_walrus_4(self) -> None: + def test_walrus_04(self) -> None: match_cases = [MatchCase("(z := 0)", "y = 0", "(w := 0)")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("w"), 0) @@ -197,7 +197,7 @@ def test_walrus_4(self) -> None: self.assertNotIn("y", namespace) self.assertEqual(namespace.get("z"), 0) - def test_walrus_5(self) -> None: + def test_walrus_05(self) -> None: match_cases = [MatchCase("(z := (w := 0))", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("w"), 0) @@ -205,31 +205,31 @@ def test_walrus_5(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_pipe_0(self) -> None: + def test_pipe_00(self) -> None: match_cases = [MatchCase("0 | 1 | 2", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_pipe_1(self) -> None: + def test_pipe_01(self) -> None: match_cases = [MatchCase("0 | 1 | 2", "y = 0")] namespace = self.execute_match("x = 1", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertEqual(namespace.get("y"), 0) - def test_pipe_2(self) -> None: + def test_pipe_02(self) -> None: match_cases = [MatchCase("0 | 1 | 2", "y = 0")] namespace = self.execute_match("x = 2", "x", match_cases, "") self.assertEqual(namespace.get("x"), 2) self.assertEqual(namespace.get("y"), 0) - def test_pipe_3(self) -> None: + def test_pipe_03(self) -> None: match_cases = [MatchCase("0 | 1 | 2", "y = 0")] namespace = self.execute_match("x = 3", "x", match_cases, "") self.assertEqual(namespace.get("x"), 3) self.assertNotIn("y", namespace) - def test_pipe_4(self) -> None: + def test_pipe_04(self) -> None: match_cases = [ MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") ] @@ -238,7 +238,7 @@ def test_pipe_4(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_pipe_5(self) -> None: + def test_pipe_05(self) -> None: match_cases = [ MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") ] @@ -247,7 +247,7 @@ def test_pipe_5(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 1) - def test_pipe_6(self) -> None: + def test_pipe_06(self) -> None: match_cases = [ MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") ] @@ -256,7 +256,7 @@ def test_pipe_6(self) -> None: self.assertNotIn("y", namespace) self.assertEqual(namespace.get("z"), 2) - def test_pipe_7(self) -> None: + def test_pipe_07(self) -> None: match_cases = [ MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") ] @@ -265,49 +265,49 @@ def test_pipe_7(self) -> None: self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_iter_0(self) -> None: + def test_iter_00(self) -> None: match_cases = [MatchCase("()", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_iter_1(self) -> None: + def test_iter_01(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_iter_2(self) -> None: + def test_iter_02(self) -> None: match_cases = [MatchCase("[0]", "y = 0")] namespace = self.execute_match("x = (0,)", "x", match_cases, "") self.assertEqual(namespace.get("x"), (0,)) self.assertEqual(namespace.get("y"), 0) - def test_iter_3(self) -> None: + def test_iter_03(self) -> None: match_cases = [MatchCase("[[]]", "y = 0")] namespace = self.execute_match("x = ((),)", "x", match_cases, "") self.assertEqual(namespace.get("x"), ((),)) self.assertEqual(namespace.get("y"), 0) - def test_iter_4(self) -> None: + def test_iter_04(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 1]) self.assertEqual(namespace.get("y"), 0) - def test_iter_5(self) -> None: + def test_iter_05(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [1, 0]) self.assertEqual(namespace.get("y"), 0) - def test_iter_6(self) -> None: + def test_iter_06(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 0]) self.assertNotIn("y", namespace) - def test_iter_7(self) -> None: + def test_iter_07(self) -> None: match_cases = [ MatchCase("(w := 0,)", "y = 0"), MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1"), @@ -318,7 +318,7 @@ def test_iter_7(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) - def test_iter_8(self) -> None: + def test_iter_08(self) -> None: match_cases = [ MatchCase("(0,)", "y = 0"), MatchCase("(1, 0)", "y = 1", "(x := x[:0])"), @@ -328,13 +328,43 @@ def test_iter_8(self) -> None: self.assertEqual(namespace.get("x"), []) self.assertEqual(namespace.get("y"), 2) - def test_string_0(self) -> None: + def test_iter_09(self) -> None: + match_cases = [MatchCase("[0]", "y = 0")] + namespace = self.execute_match("x = {0}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0}) + self.assertNotIn("y", namespace) + + def test_iter_10(self) -> None: + match_cases = [MatchCase("()", "y = 0")] + namespace = self.execute_match("x = set()", "x", match_cases, "") + self.assertEqual(namespace.get("x"), set()) + self.assertNotIn("y", namespace) + + def test_iter_11(self) -> None: + match_cases = [MatchCase("[]", "y = 0")] + namespace = self.execute_match("x = iter([1,2,3])", "x", match_cases, "") + self.assertEqual(list(namespace.get("x")), [1, 2, 3]) + self.assertNotIn("y", namespace) + + def test_iter_12(self) -> None: + match_cases = [MatchCase("[]", "y = 0")] + namespace = self.execute_match("x = {}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {}) + self.assertNotIn("y", namespace) + + def test_iter_13(self) -> None: + match_cases = [MatchCase("(0, 1)", "y = 0")] + namespace = self.execute_match("x = {0: False, 1: True}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: False, 1: True}) + self.assertNotIn("y", namespace) + + def test_string_00(self) -> None: match_cases = [MatchCase("['x']", "y = 0"), MatchCase("'x'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 1) - def test_string_1(self) -> None: + def test_string_01(self) -> None: match_cases = [ MatchCase("[b'x']", "y = 0"), MatchCase("['x']", "y = 1"), @@ -346,13 +376,13 @@ def test_string_1(self) -> None: self.assertEqual(namespace.get("x"), b"x") self.assertEqual(namespace.get("y"), 4) - def test_string_2(self) -> None: + def test_string_02(self) -> None: match_cases = [MatchCase("[120]", "y = 0"), MatchCase("120", "y = 1")] namespace = self.execute_match("x = bytearray(b'x')", "x", match_cases, "") self.assertEqual(namespace.get("x"), b"x") self.assertNotIn("y", namespace) - def test_string_3(self) -> None: + def test_string_03(self) -> None: match_cases = [ MatchCase("[]", "y = 0"), MatchCase("['']", "y = 1"), @@ -362,7 +392,7 @@ def test_string_3(self) -> None: self.assertEqual(namespace.get("x"), "") self.assertEqual(namespace.get("y"), 2) - def test_string_4(self) -> None: + def test_string_04(self) -> None: match_cases = [ MatchCase("['x', 'x', 'x']", "y = 0"), MatchCase("['xxx']", "y = 1"), @@ -372,7 +402,7 @@ def test_string_4(self) -> None: self.assertEqual(namespace.get("x"), "xxx") self.assertEqual(namespace.get("y"), 2) - def test_string_5(self) -> None: + def test_string_05(self) -> None: match_cases = [ MatchCase("[120, 120, 120]", "y = 0"), MatchCase("[b'xxx']", "y = 1"), From 6eb67836273a75c7910f902f3847c22a37158ef8 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 23:21:21 -0700 Subject: [PATCH 026/218] Cleanup --- Lib/test/test_patma.py | 1 - Python/compile.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 20e4207ab20fe3..a3398b8fc444f6 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -369,7 +369,6 @@ def test_string_01(self) -> None: MatchCase("[b'x']", "y = 0"), MatchCase("['x']", "y = 1"), MatchCase("[120]", "y = 2"), - MatchCase("120", "y = 3"), MatchCase("b'x'", "y = 4"), ] namespace = self.execute_match("x = b'x'", "x", match_cases, "") diff --git a/Python/compile.c b/Python/compile.c index a9a8501c4856db..f1b3fd8e960d70 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -982,6 +982,7 @@ stack_effect(int opcode, int oparg, int jump) return jump > 0 ? -1 : 1; case GET_MATCH_ITER: return -(jump > 0); + case STORE_ATTR: return -2; case DELETE_ATTR: From f3c513d3647360e32ec4009d29c7bed4a78c1455 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 27 May 2020 23:38:12 -0700 Subject: [PATCH 027/218] Use Mapping/Sequence _collections_abc --- Include/internal/pycore_interp.h | 5 ++- Python/ceval.c | 54 +++++++++++++++++++++++++++++--- Python/pystate.c | 2 ++ 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index f04ea330d04571..072cb1b69939e5 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -97,6 +97,10 @@ struct _is { PyObject *builtins; PyObject *importlib; + // Kept handy for pattern matching: + PyObject *map_abc; // _collections_abc.Mapping + PyObject *seq_abc; // _collections_abc.Sequence + /* Used in Modules/_threadmodule.c. */ long num_threads; /* Support for runtime thread stack size tuning. @@ -192,4 +196,3 @@ PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *); } #endif #endif /* !Py_INTERNAL_INTERP_H */ - diff --git a/Python/ceval.c b/Python/ceval.c index b8df9b3f5040ec..90f6b83ae54641 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -848,6 +848,50 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) return 0; } +// Need these for pattern matching: + +// static int +// check_match_mapping_type(PyObject *target) +// { +// PyInterpreterState *interp = PyInterpreterState_Get(); +// if (!interp) { +// return -1; +// } +// if (!interp->map_abc) { +// PyObject *abc = PyImport_ImportModule("_collections_abc"); +// if (!abc) { +// return -1; +// } +// interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); +// Py_DECREF(abc); +// } +// return PyObject_IsInstance(target, interp->map_abc); +// } + +static int +check_match_sequence_type(PyObject *target) +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + return -1; + } + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return -1; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + Py_DECREF(abc); + } + return ( + PyObject_IsInstance(target, interp->seq_abc) + && !PyIter_Check(target) + && !PyObject_TypeCheck(target, &PyUnicode_Type) + && !PyObject_TypeCheck(target, &PyBytes_Type) + && !PyObject_TypeCheck(target, &PyByteArray_Type) + ); +} + static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **); @@ -3286,11 +3330,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(GET_MATCH_ITER): { PyObject *target = TOP(); - if (!PySequence_Check(target) - || PyObject_TypeCheck(target, &PyUnicode_Type) - || PyObject_TypeCheck(target, &PyBytes_Type) - || PyObject_TypeCheck(target, &PyByteArray_Type) - ) { + int check = check_match_sequence_type(target); + if (check < 0) { + goto error; + } + if (!check) { STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); diff --git a/Python/pystate.c b/Python/pystate.c index 119fe31a84ba12..25c1deec8211dd 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -315,6 +315,8 @@ PyInterpreterState_Clear(PyInterpreterState *interp) Py_CLEAR(interp->importlib); Py_CLEAR(interp->import_func); Py_CLEAR(interp->dict); + Py_CLEAR(interp->map_abc); + Py_CLEAR(interp->seq_abc); #ifdef HAVE_FORK Py_CLEAR(interp->before_forkers); Py_CLEAR(interp->after_forkers_parent); From fc472c7bc42ca88575c6d897a1e3ac219e97b892 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 07:46:11 -0700 Subject: [PATCH 028/218] Add missing error handling --- Python/ceval.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index 90f6b83ae54641..9efa875da4b31b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -864,6 +864,9 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // } // interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); // Py_DECREF(abc); +// if (!interp->map_abc) { +// return -1; +// } // } // return PyObject_IsInstance(target, interp->map_abc); // } @@ -882,6 +885,9 @@ check_match_sequence_type(PyObject *target) } interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); Py_DECREF(abc); + if (!interp->seq_abc) { + return -1; + } } return ( PyObject_IsInstance(target, interp->seq_abc) From 26dd4fdfe28c5c092b573615968420e9f030ff11 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 08:36:07 -0700 Subject: [PATCH 029/218] Add GET_MATCH_MAP --- Doc/library/dis.rst | 14 +- Include/opcode.h | 1 + Lib/importlib/_bootstrap_external.py | 1 + Lib/opcode.py | 1 + Python/ceval.c | 61 ++++--- Python/compile.c | 1 + Python/importlib_external.h | 228 +++++++++++++-------------- Python/opcode_targets.h | 2 +- 8 files changed, 172 insertions(+), 137 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index a91ae8c7b65fa1..1141a79ae9d335 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -993,8 +993,18 @@ All of the following opcodes use their arguments. .. opcode:: GET_MATCH_ITER (delta) Used for pattern matching. Much like :opcode:`GET_ITER`, but pops TOS and - increments the byte code counter by *delta* if TOS is not a :term:`sequence` - or is an instance of :class:`str`, :class:`bytes`, or :class:`bytearray`. + increments the byte code counter by *delta* if TOS *is not* an instance of + :class:`collections.abc.Sequence` or *is* an instance of + :class:`str`/:class:`bytes`/:class:`bytearray`. + + .. versionadded:: 3.10 + + +.. opcode:: GET_MATCH_MAP (delta) + + Used for pattern matching. TOS is popped. If it is an instance of + :class:`collections.abc.Mapping`, a :class:`dict` is built from it and pushed + in its place. Otherwise, the byte code counter is incremented by *delta*. .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index 325e61d3f61142..d5865a0b8c7ce5 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -128,6 +128,7 @@ extern "C" { #define DICT_MERGE 164 #define DICT_UPDATE 165 #define GET_MATCH_ITER 166 +#define GET_MATCH_MAP 167 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 959e8ba45f614f..31db5026e76d36 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,6 +278,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a0 3435 (add GET_MATCH_ITER) +# Python 3.10a0 3436 (add GET_MATCH_MAP) # # MAGIC must change whenever the bytecode emitted by the compiler may no diff --git a/Lib/opcode.py b/Lib/opcode.py index 09a1d079be5524..0ac03b373ffa88 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -214,5 +214,6 @@ def jabs_op(name, op): def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) jrel_op('GET_MATCH_ITER', 166) +jrel_op('GET_MATCH_MAP', 167) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index 9efa875da4b31b..abc042ecca430f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -850,26 +850,26 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: -// static int -// check_match_mapping_type(PyObject *target) -// { -// PyInterpreterState *interp = PyInterpreterState_Get(); -// if (!interp) { -// return -1; -// } -// if (!interp->map_abc) { -// PyObject *abc = PyImport_ImportModule("_collections_abc"); -// if (!abc) { -// return -1; -// } -// interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); -// Py_DECREF(abc); -// if (!interp->map_abc) { -// return -1; -// } -// } -// return PyObject_IsInstance(target, interp->map_abc); -// } +static int +check_match_mapping_type(PyObject *target) +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + return -1; + } + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return -1; + } + interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); + Py_DECREF(abc); + if (!interp->map_abc) { + return -1; + } + } + return PyObject_IsInstance(target, interp->map_abc); +} static int check_match_sequence_type(PyObject *target) @@ -3334,6 +3334,27 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } + case TARGET(GET_MATCH_MAP): { + PyObject *target = TOP(); + int check = check_match_mapping_type(target); + if (check < 0) { + goto error; + } + if (!check) { + STACK_SHRINK(1); + Py_DECREF(target); + JUMPBY(oparg); + DISPATCH(); + } + PyObject *map = PyDict_New(); + if (!map || PyDict_Update(map, target)) { + goto error; + } + Py_DECREF(target); + SET_TOP(map); + DISPATCH(); + } + case TARGET(GET_MATCH_ITER): { PyObject *target = TOP(); int check = check_match_sequence_type(target); diff --git a/Python/compile.c b/Python/compile.c index f1b3fd8e960d70..6dfc2d9695887d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -981,6 +981,7 @@ stack_effect(int opcode, int oparg, int jump) /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; case GET_MATCH_ITER: + case GET_MATCH_MAP: return -(jump > 0); case STORE_ATTR: diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 8010e6e269e67b..96ccf461abd2d8 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -400,7 +400,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,102,105,108,101,110,97,109,101,218,8,102,105,108,101,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,115, - 111,117,114,99,101,46,1,0,0,115,72,0,0,0,0,18, + 111,117,114,99,101,47,1,0,0,115,72,0,0,0,0,18, 8,1,6,1,2,255,4,2,8,1,4,1,8,1,12,1, 10,1,12,1,16,1,8,1,8,1,8,1,24,1,8,1, 12,1,6,2,8,1,8,1,8,1,8,1,14,1,14,1, @@ -481,7 +481,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,101, 110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,109, - 95,99,97,99,104,101,117,1,0,0,115,68,0,0,0,0, + 95,99,97,99,104,101,118,1,0,0,115,68,0,0,0,0, 9,12,1,8,1,10,1,12,1,4,1,10,1,12,1,14, 1,16,1,4,1,4,1,12,1,8,1,2,1,2,255,4, 1,2,255,8,2,10,1,8,1,16,1,10,1,16,1,10, @@ -517,7 +517,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, 95,112,97,116,104,114,5,0,0,0,114,5,0,0,0,114, 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,157,1,0,0,115,20,0,0,0,0,7, + 101,102,105,108,101,158,1,0,0,115,20,0,0,0,0,7, 12,1,4,1,16,1,24,1,4,1,2,1,12,1,16,1, 18,1,114,108,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,0, @@ -530,7 +530,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 112,108,101,114,101,0,0,0,114,97,0,0,0,114,82,0, 0,0,114,88,0,0,0,41,1,114,96,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 103,101,116,95,99,97,99,104,101,100,176,1,0,0,115,16, + 103,101,116,95,99,97,99,104,101,100,177,1,0,0,115,16, 0,0,0,0,1,14,1,2,1,10,1,12,1,8,1,14, 1,4,2,114,112,0,0,0,99,1,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, @@ -545,7 +545,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,51,0,0,0,114,50,0,0,0,41,2,114,44,0,0, 0,114,52,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,10,95,99,97,108,99,95,109,111,100, - 101,188,1,0,0,115,12,0,0,0,0,2,2,1,14,1, + 101,189,1,0,0,115,12,0,0,0,0,2,2,1,14,1, 12,1,10,3,8,1,114,114,0,0,0,99,1,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,0, 3,0,0,0,115,66,0,0,0,100,6,135,0,102,1,100, @@ -583,7 +583,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,114,103,115,218,6,107,119,97,114,103,115,169,1,218,6, 109,101,116,104,111,100,114,5,0,0,0,114,8,0,0,0, 218,19,95,99,104,101,99,107,95,110,97,109,101,95,119,114, - 97,112,112,101,114,208,1,0,0,115,18,0,0,0,0,1, + 97,112,112,101,114,209,1,0,0,115,18,0,0,0,0,1, 8,1,8,1,10,1,4,1,8,255,2,1,2,255,6,2, 122,40,95,99,104,101,99,107,95,110,97,109,101,46,60,108, 111,99,97,108,115,62,46,95,99,104,101,99,107,95,110,97, @@ -601,7 +601,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 8,95,95,100,105,99,116,95,95,218,6,117,112,100,97,116, 101,41,3,90,3,110,101,119,90,3,111,108,100,114,67,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,5,95,119,114,97,112,219,1,0,0,115,8,0,0, + 0,218,5,95,119,114,97,112,220,1,0,0,115,8,0,0, 0,0,1,8,1,10,1,20,1,122,26,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,119,114,97,112,41,1,78,41,3,218,10,95,98,111,111, @@ -609,7 +609,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,69,114,114,111,114,41,3,114,122,0,0,0,114,123,0, 0,0,114,133,0,0,0,114,5,0,0,0,114,121,0,0, 0,114,8,0,0,0,218,11,95,99,104,101,99,107,95,110, - 97,109,101,200,1,0,0,115,14,0,0,0,0,8,14,7, + 97,109,101,201,1,0,0,115,14,0,0,0,0,8,14,7, 2,1,10,1,12,2,14,5,10,1,114,136,0,0,0,99, 2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, 6,0,0,0,67,0,0,0,115,60,0,0,0,124,0,160, @@ -637,7 +637,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110, 115,218,3,109,115,103,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,17,95,102,105,110,100,95,109,111,100, - 117,108,101,95,115,104,105,109,228,1,0,0,115,10,0,0, + 117,108,101,95,115,104,105,109,229,1,0,0,115,10,0,0, 0,0,10,14,1,16,1,4,1,22,1,114,143,0,0,0, 99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0, 0,4,0,0,0,67,0,0,0,115,166,0,0,0,124,0, @@ -704,7 +704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,120,99,95,100,101,116,97,105,108,115,90,5,109,97,103, 105,99,114,92,0,0,0,114,2,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,13,95,99,108, - 97,115,115,105,102,121,95,112,121,99,245,1,0,0,115,28, + 97,115,115,105,102,121,95,112,121,99,246,1,0,0,115,28, 0,0,0,0,16,12,1,8,1,16,1,12,1,16,1,12, 1,10,1,12,1,8,1,16,2,8,1,16,1,16,1,114, 152,0,0,0,99,5,0,0,0,0,0,0,0,0,0,0, @@ -759,7 +759,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 122,101,114,116,0,0,0,114,151,0,0,0,114,92,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,23,95,118,97,108,105,100,97,116,101,95,116,105,109,101, - 115,116,97,109,112,95,112,121,99,22,2,0,0,115,16,0, + 115,116,97,109,112,95,112,121,99,23,2,0,0,115,16,0, 0,0,0,19,24,1,10,1,12,1,16,1,8,1,22,255, 2,2,114,156,0,0,0,99,4,0,0,0,0,0,0,0, 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, @@ -805,7 +805,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,11,115,111,117,114,99,101,95,104,97,115,104,114, 116,0,0,0,114,151,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,18,95,118,97,108,105,100, - 97,116,101,95,104,97,115,104,95,112,121,99,50,2,0,0, + 97,116,101,95,104,97,115,104,95,112,121,99,51,2,0,0, 115,12,0,0,0,0,17,16,1,2,1,8,255,4,2,2, 254,114,158,0,0,0,99,4,0,0,0,0,0,0,0,0, 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, @@ -829,7 +829,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,116,0,0,0,114,106,0,0,0,114, 107,0,0,0,218,4,99,111,100,101,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,17,95,99,111,109,112, - 105,108,101,95,98,121,116,101,99,111,100,101,74,2,0,0, + 105,108,101,95,98,121,116,101,99,111,100,101,75,2,0,0, 115,18,0,0,0,0,2,10,1,10,1,12,1,8,1,12, 1,4,2,10,1,4,255,114,165,0,0,0,114,73,0,0, 0,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0, @@ -848,7 +848,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,114,155,0,0,0,114,26,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,22,95,99,111, 100,101,95,116,111,95,116,105,109,101,115,116,97,109,112,95, - 112,121,99,87,2,0,0,115,12,0,0,0,0,2,8,1, + 112,121,99,88,2,0,0,115,12,0,0,0,0,2,8,1, 14,1,14,1,14,1,16,1,114,170,0,0,0,84,99,3, 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5, 0,0,0,67,0,0,0,115,80,0,0,0,116,0,116,1, @@ -866,7 +866,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,7,99,104,101,99,107,101,100,114,26,0,0,0,114, 2,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,104,97, - 115,104,95,112,121,99,97,2,0,0,115,14,0,0,0,0, + 115,104,95,112,121,99,98,2,0,0,115,14,0,0,0,0, 2,8,1,12,1,14,1,16,1,10,1,16,1,114,171,0, 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,5, 0,0,0,6,0,0,0,67,0,0,0,115,62,0,0,0, @@ -893,7 +893,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,108, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,109, 2,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,176,0,0,0,169,2,114,140,0,0,0,218,26, 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, @@ -955,7 +955,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,182,0,0,0,90,7,100,105,114,110,97,109,101,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,23,115, 112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111, - 99,97,116,105,111,110,125,2,0,0,115,62,0,0,0,0, + 99,97,116,105,111,110,126,2,0,0,115,62,0,0,0,0, 12,8,4,4,1,10,2,2,1,14,1,12,1,8,2,10, 8,16,1,6,3,8,1,14,1,14,1,10,1,6,1,6, 2,4,3,8,2,10,1,2,1,14,1,12,1,6,2,4, @@ -992,7 +992,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,73, 78,69,41,2,218,3,99,108,115,114,7,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,14,95, - 111,112,101,110,95,114,101,103,105,115,116,114,121,205,2,0, + 111,112,101,110,95,114,101,103,105,115,116,114,121,206,2,0, 0,115,8,0,0,0,0,2,2,1,16,1,12,1,122,36, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105, @@ -1020,7 +1020,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, 104,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, - 114,121,212,2,0,0,115,24,0,0,0,0,2,6,1,8, + 114,121,213,2,0,0,115,24,0,0,0,0,2,6,1,8, 2,6,1,6,1,16,255,6,2,2,1,12,1,46,1,12, 1,8,1,122,38,87,105,110,100,111,119,115,82,101,103,105, 115,116,114,121,70,105,110,100,101,114,46,95,115,101,97,114, @@ -1042,7 +1042,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,6,116,97,114,103,101,116,114,199,0,0,0,114, 140,0,0,0,114,189,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,9,102, - 105,110,100,95,115,112,101,99,227,2,0,0,115,28,0,0, + 105,110,100,95,115,112,101,99,228,2,0,0,115,28,0,0, 0,0,2,10,1,8,1,4,1,2,1,12,1,12,1,8, 1,14,1,14,1,6,1,8,1,2,254,6,3,122,31,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, @@ -1061,7 +1061,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 2,114,203,0,0,0,114,140,0,0,0,169,4,114,193,0, 0,0,114,139,0,0,0,114,44,0,0,0,114,187,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,11,102,105,110,100,95,109,111,100,117,108,101,243,2,0, + 218,11,102,105,110,100,95,109,111,100,117,108,101,244,2,0, 0,115,8,0,0,0,0,7,12,1,8,1,6,2,122,33, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,102,105,110,100,95,109,111,100,117,108, @@ -1071,7 +1071,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,97,115,115,109,101,116,104,111,100,114,194,0,0,0,114, 200,0,0,0,114,203,0,0,0,114,206,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,191,0,0,0,193,2,0,0,115,28,0,0,0, + 0,0,114,191,0,0,0,194,2,0,0,115,28,0,0,0, 8,2,4,3,2,255,2,4,2,255,2,3,4,2,2,1, 10,6,2,1,10,14,2,1,12,15,2,1,114,191,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1107,7 +1107,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 139,0,0,0,114,96,0,0,0,90,13,102,105,108,101,110, 97,109,101,95,98,97,115,101,90,9,116,97,105,108,95,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,182,0,0,0,6,3,0,0,115,8,0,0,0, + 0,0,114,182,0,0,0,7,3,0,0,115,8,0,0,0, 0,3,18,1,16,1,14,1,122,24,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1118,7 +1118,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,46,78,114,5,0,0,0,169,2,114,118,0,0,0,114, 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,14,3,0,0,115,2,0,0,0,0,1,122,27,95, + 108,101,15,3,0,0,115,2,0,0,0,0,1,122,27,95, 76,111,97,100,101,114,66,97,115,105,99,115,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,5,0,0,0,67, @@ -1138,7 +1138,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 131,0,0,0,41,3,114,118,0,0,0,218,6,109,111,100, 117,108,101,114,164,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,11,101,120,101,99,95,109,111, - 100,117,108,101,17,3,0,0,115,12,0,0,0,0,2,12, + 100,117,108,101,18,3,0,0,115,12,0,0,0,0,2,12, 1,8,1,6,1,4,255,6,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1149,14 +1149,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,169,2,114,118,0,0,0,114,139,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,25,3, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,26,3, 0,0,115,2,0,0,0,0,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,125,0,0,0,114,124,0,0, 0,114,126,0,0,0,114,127,0,0,0,114,182,0,0,0, 114,212,0,0,0,114,217,0,0,0,114,220,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,208,0,0,0,1,3,0,0,115,10,0,0, + 0,0,0,114,208,0,0,0,2,3,0,0,115,10,0,0, 0,8,2,4,3,8,8,8,3,8,8,114,208,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,64,0,0,0,115,74,0,0,0,101,0, @@ -1181,7 +1181,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,32,32,78,41,1,114,50,0,0,0,169, 2,114,118,0,0,0,114,44,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,10,112,97,116,104, - 95,109,116,105,109,101,32,3,0,0,115,2,0,0,0,0, + 95,109,116,105,109,101,33,3,0,0,115,2,0,0,0,0, 6,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, @@ -1215,7 +1215,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,32,32,32,32,32,32,32,32,114,169,0,0,0, 41,1,114,223,0,0,0,114,222,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,40,3,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,41,3,0,0,115,2,0,0,0, 0,12,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, @@ -1239,7 +1239,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,107,0,0,0,90,10,99,97,99,104,101,95,112,97,116, 104,114,26,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,15,95,99,97,99,104,101,95,98,121, - 116,101,99,111,100,101,54,3,0,0,115,2,0,0,0,0, + 116,101,99,111,100,101,55,3,0,0,115,2,0,0,0,0, 8,122,28,83,111,117,114,99,101,76,111,97,100,101,114,46, 95,99,97,99,104,101,95,98,121,116,101,99,111,100,101,99, 3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, @@ -1256,7 +1256,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,46,10,32,32,32,32,32,32,32,32,78,114,5,0,0, 0,41,3,114,118,0,0,0,114,44,0,0,0,114,26,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,225,0,0,0,64,3,0,0,115,2,0,0,0,0, + 0,114,225,0,0,0,65,3,0,0,115,2,0,0,0,0, 1,122,21,83,111,117,114,99,101,76,111,97,100,101,114,46, 115,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0, 0,0,0,0,0,5,0,0,0,10,0,0,0,67,0,0, @@ -1277,7 +1277,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,41,5,114,118,0,0,0,114,139,0,0,0,114,44,0, 0,0,114,174,0,0,0,218,3,101,120,99,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,103,101,116, - 95,115,111,117,114,99,101,71,3,0,0,115,20,0,0,0, + 95,115,111,117,114,99,101,72,3,0,0,115,20,0,0,0, 0,2,10,1,2,1,14,1,14,1,4,1,2,255,4,1, 2,255,24,2,122,23,83,111,117,114,99,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,114,104,0, @@ -1299,7 +1299,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,7,99,111,109,112,105,108,101,41,4,114,118,0,0,0, 114,26,0,0,0,114,44,0,0,0,114,230,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,14, - 115,111,117,114,99,101,95,116,111,95,99,111,100,101,81,3, + 115,111,117,114,99,101,95,116,111,95,99,111,100,101,82,3, 0,0,115,6,0,0,0,0,5,12,1,4,255,122,27,83, 111,117,114,99,101,76,111,97,100,101,114,46,115,111,117,114, 99,101,95,116,111,95,99,111,100,101,99,2,0,0,0,0, @@ -1376,7 +1376,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,151,0,0,0,114,2,0,0,0,90, 10,98,121,116,101,115,95,100,97,116,97,90,11,99,111,100, 101,95,111,98,106,101,99,116,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,213,0,0,0,89,3,0,0, + 0,0,114,8,0,0,0,114,213,0,0,0,90,3,0,0, 115,152,0,0,0,0,7,10,1,4,1,4,1,4,1,4, 1,4,1,2,1,12,1,12,1,12,2,2,1,14,1,12, 1,8,2,12,1,2,1,14,1,12,1,6,3,2,1,2, @@ -1393,7 +1393,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,226,0,0,0,114,225,0,0,0,114,229,0,0,0,114, 233,0,0,0,114,213,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,221,0, - 0,0,30,3,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,31,3,0,0,115,14,0,0,0,8,2,8,8,8, 14,8,10,8,7,8,10,14,8,114,221,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 0,0,0,0,0,0,0,115,124,0,0,0,101,0,90,1, @@ -1422,7 +1422,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,102,105,110,100,101,114,46,78,114,159,0, 0,0,41,3,114,118,0,0,0,114,139,0,0,0,114,44, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,209,0,0,0,179,3,0,0,115,4,0,0,0, + 0,0,114,209,0,0,0,180,3,0,0,115,4,0,0,0, 0,3,6,1,122,19,70,105,108,101,76,111,97,100,101,114, 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, @@ -1431,7 +1431,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,2,218,9,95,95,99,108,97,115,115,95, 95,114,131,0,0,0,169,2,114,118,0,0,0,90,5,111, 116,104,101,114,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,6,95,95,101,113,95,95,185,3,0,0,115, + 0,0,0,218,6,95,95,101,113,95,95,186,3,0,0,115, 6,0,0,0,0,1,12,1,10,255,122,17,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, @@ -1440,7 +1440,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,3,218,4,104,97,115,104,114,116,0,0, 0,114,44,0,0,0,169,1,114,118,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,218,8,95,95, - 104,97,115,104,95,95,189,3,0,0,115,2,0,0,0,0, + 104,97,115,104,95,95,190,3,0,0,115,2,0,0,0,0, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,115, @@ -1454,7 +1454,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5, 115,117,112,101,114,114,239,0,0,0,114,220,0,0,0,114, 219,0,0,0,169,1,114,241,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,220,0,0,0,192,3,0,0,115,2, + 114,8,0,0,0,114,220,0,0,0,193,3,0,0,115,2, 0,0,0,0,10,122,22,70,105,108,101,76,111,97,100,101, 114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1464,7 +1464,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,114, 48,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,179,0,0,0,204,3,0, + 0,0,0,114,8,0,0,0,114,179,0,0,0,205,3,0, 0,115,2,0,0,0,0,3,122,23,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,109, 101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1486,7 +1486,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,90,4,114,101,97,100,114,65,0,0,0,41,3,114, 118,0,0,0,114,44,0,0,0,114,68,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,227,0, - 0,0,209,3,0,0,115,10,0,0,0,0,2,14,1,16, + 0,0,210,3,0,0,115,10,0,0,0,0,2,14,1,16, 1,40,2,14,1,122,19,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,100,97,116,97,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1495,7 +1495,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,182,0,0,0,169,2,114,118,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, 0,218,19,103,101,116,95,114,101,115,111,117,114,99,101,95, - 114,101,97,100,101,114,220,3,0,0,115,6,0,0,0,0, + 114,101,97,100,101,114,221,3,0,0,115,6,0,0,0,0, 2,10,1,4,1,122,30,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,114,101,115,111,117,114,99,101,95,114, 101,97,100,101,114,99,2,0,0,0,0,0,0,0,0,0, @@ -1507,7 +1507,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,64,0,0,0,114,65,0,0,0,169,3,114,118,0, 0,0,90,8,114,101,115,111,117,114,99,101,114,44,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,226, + 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,227, 3,0,0,115,4,0,0,0,0,1,20,1,122,24,70,105, 108,101,76,111,97,100,101,114,46,111,112,101,110,95,114,101, 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0, @@ -1520,7 +1520,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,114,38,0,0,0,114,47,0,0,0,114,44, 0,0,0,114,255,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,13,114,101,115,111,117,114,99, - 101,95,112,97,116,104,230,3,0,0,115,8,0,0,0,0, + 101,95,112,97,116,104,231,3,0,0,115,8,0,0,0,0, 1,10,1,4,1,20,1,122,24,70,105,108,101,76,111,97, 100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,116, 104,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1532,7 +1532,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,44,0,0,0,114,54,0,0,0,169,3,114,118,0, 0,0,114,116,0,0,0,114,44,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,2,1,0,0, - 236,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, + 237,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, 1,122,22,70,105,108,101,76,111,97,100,101,114,46,105,115, 95,114,101,115,111,117,114,99,101,99,1,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,0, @@ -1542,7 +1542,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,7,108,105,115,116,100,105,114,114,47,0,0,0,114, 44,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,8,99,111,110,116,101,110, - 116,115,242,3,0,0,115,2,0,0,0,0,1,122,19,70, + 116,115,243,3,0,0,115,2,0,0,0,0,1,122,19,70, 105,108,101,76,111,97,100,101,114,46,99,111,110,116,101,110, 116,115,41,17,114,125,0,0,0,114,124,0,0,0,114,126, 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, @@ -1551,7 +1551,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,0,1,0,0,114,4,1,0,0,114,2,1,0,0,114, 8,1,0,0,90,13,95,95,99,108,97,115,115,99,101,108, 108,95,95,114,5,0,0,0,114,5,0,0,0,114,249,0, - 0,0,114,8,0,0,0,114,239,0,0,0,174,3,0,0, + 0,0,114,8,0,0,0,114,239,0,0,0,175,3,0,0, 115,30,0,0,0,8,2,4,3,8,6,8,4,8,3,2, 1,14,11,2,1,10,4,8,11,2,1,10,5,8,4,8, 6,8,6,114,239,0,0,0,99,0,0,0,0,0,0,0, @@ -1574,7 +1574,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 49,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, 115,116,95,115,105,122,101,41,3,114,118,0,0,0,114,44, 0,0,0,114,238,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,224,0,0,0,250,3,0,0, + 0,0,114,8,0,0,0,114,224,0,0,0,251,3,0,0, 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,0, @@ -1585,7 +1585,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 225,0,0,0,41,5,114,118,0,0,0,114,107,0,0,0, 114,106,0,0,0,114,26,0,0,0,114,52,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,226, - 0,0,0,255,3,0,0,115,4,0,0,0,0,2,8,1, + 0,0,0,0,4,0,0,115,4,0,0,0,0,2,8,1, 122,32,83,111,117,114,99,101,70,105,108,101,76,111,97,100, 101,114,46,95,99,97,99,104,101,95,98,121,116,101,99,111, 100,101,114,60,0,0,0,114,11,1,0,0,99,3,0,0, @@ -1620,7 +1620,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,0,0,218,6,112,97,114,101,110,116,114,96,0,0,0, 114,37,0,0,0,114,33,0,0,0,114,228,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,225, - 0,0,0,4,4,0,0,115,46,0,0,0,0,2,12,1, + 0,0,0,5,4,0,0,115,46,0,0,0,0,2,12,1, 4,2,12,1,12,1,12,2,12,1,10,1,2,1,14,1, 12,2,8,1,14,3,6,1,4,255,4,2,28,1,2,1, 12,1,16,1,16,2,8,1,2,255,122,25,83,111,117,114, @@ -1629,7 +1629,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,126,0,0,0,114,127,0,0,0,114,224,0,0, 0,114,226,0,0,0,114,225,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 9,1,0,0,246,3,0,0,115,8,0,0,0,8,2,4, + 9,1,0,0,247,3,0,0,115,8,0,0,0,8,2,4, 2,8,5,8,5,114,9,1,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, @@ -1651,7 +1651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,235,0,0,0,41,5,114,118,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,26,0,0,0,114,151,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 213,0,0,0,39,4,0,0,115,22,0,0,0,0,1,10, + 213,0,0,0,40,4,0,0,115,22,0,0,0,0,1,10, 1,10,4,2,1,2,254,6,4,12,1,2,1,14,1,2, 1,2,253,122,29,83,111,117,114,99,101,108,101,115,115,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, @@ -1661,14 +1661,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,110,101,32,97,115,32,116,104,101,114,101,32,105,115,32, 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, 114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,229,0,0,0,55,4, + 5,0,0,0,114,8,0,0,0,114,229,0,0,0,56,4, 0,0,115,2,0,0,0,0,2,122,31,83,111,117,114,99, 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,78,41,6,114,125,0, 0,0,114,124,0,0,0,114,126,0,0,0,114,127,0,0, 0,114,213,0,0,0,114,229,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 15,1,0,0,35,4,0,0,115,6,0,0,0,8,2,4, + 15,1,0,0,36,4,0,0,115,6,0,0,0,8,2,4, 2,8,16,114,15,1,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, 0,115,92,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1688,7 +1688,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,16,0,0,0,124,1,124,0,95,0,124,2,124,0, 95,1,100,0,83,0,114,109,0,0,0,114,159,0,0,0, 114,5,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,72,4,0,0,115,4,0, + 8,0,0,0,114,209,0,0,0,73,4,0,0,115,4,0, 0,0,0,1,6,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1696,7 +1696,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,124,0,106,0,124,1,106,0,107,2,111,22,124,0, 106,1,124,1,106,1,107,2,83,0,114,109,0,0,0,114, 240,0,0,0,114,242,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,243,0,0,0,76,4,0, + 0,0,0,114,8,0,0,0,114,243,0,0,0,77,4,0, 0,115,6,0,0,0,0,1,12,1,10,255,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1704,7 +1704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,20,0,0,0,116,0,124,0,106,1,131,1,116,0, 124,0,106,2,131,1,65,0,83,0,114,109,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,247,0,0,0,80,4,0, + 0,0,0,114,8,0,0,0,114,247,0,0,0,81,4,0, 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, @@ -1721,7 +1721,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,116,101,95,100,121,110,97,109,105,99,114,149,0,0,0, 114,116,0,0,0,114,44,0,0,0,41,3,114,118,0,0, 0,114,187,0,0,0,114,216,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,83, + 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,84, 4,0,0,115,14,0,0,0,0,2,4,1,6,255,4,2, 6,1,8,255,4,2,122,33,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,97, @@ -1738,7 +1738,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 214,0,0,0,114,163,0,0,0,90,12,101,120,101,99,95, 100,121,110,97,109,105,99,114,149,0,0,0,114,116,0,0, 0,114,44,0,0,0,114,253,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,91, + 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,92, 4,0,0,115,8,0,0,0,0,2,14,1,6,1,8,255, 122,31,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, @@ -1757,7 +1757,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,169,2,114,32,0,0,0,218,6,115,117,102,102,105, 120,169,1,90,9,102,105,108,101,95,110,97,109,101,114,5, 0,0,0,114,8,0,0,0,218,9,60,103,101,110,101,120, - 112,114,62,100,4,0,0,115,4,0,0,0,4,1,2,255, + 112,114,62,101,4,0,0,115,4,0,0,0,4,1,2,255, 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, @@ -1765,7 +1765,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, 83,85,70,70,73,88,69,83,114,219,0,0,0,114,5,0, 0,0,114,18,1,0,0,114,8,0,0,0,114,182,0,0, - 0,97,4,0,0,115,8,0,0,0,0,2,14,1,12,1, + 0,98,4,0,0,115,8,0,0,0,0,2,14,1,12,1, 2,255,122,30,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1776,7 +1776,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,32,99,114,101,97,116,101,32,97,32,99,111,100,101,32, 111,98,106,101,99,116,46,78,114,5,0,0,0,114,219,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,213,0,0,0,103,4,0,0,115,2,0,0,0,0, + 0,114,213,0,0,0,104,4,0,0,115,2,0,0,0,0, 2,122,28,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1786,14 +1786,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,117,108,101,115,32,104,97,118,101,32,110,111,32,115,111, 117,114,99,101,32,99,111,100,101,46,78,114,5,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,229,0,0,0,107,4,0,0,115,2,0, + 8,0,0,0,114,229,0,0,0,108,4,0,0,115,2,0, 0,0,0,2,122,30,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, 117,114,99,101,99,2,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,6,0, 0,0,124,0,106,0,83,0,114,250,0,0,0,114,48,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,179,0,0,0,111,4,0,0,115, + 0,114,8,0,0,0,114,179,0,0,0,112,4,0,0,115, 2,0,0,0,0,3,122,32,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 102,105,108,101,110,97,109,101,78,41,14,114,125,0,0,0, @@ -1802,7 +1802,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,217,0,0,0,114,182,0,0,0,114,213,0, 0,0,114,229,0,0,0,114,136,0,0,0,114,179,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,252,0,0,0,64,4,0,0,115,22, + 114,8,0,0,0,114,252,0,0,0,65,4,0,0,115,22, 0,0,0,8,2,4,6,8,4,8,4,8,3,8,8,8, 6,8,6,8,4,8,4,2,1,114,252,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1845,7 +1845,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 169,4,114,118,0,0,0,114,116,0,0,0,114,44,0,0, 0,90,11,112,97,116,104,95,102,105,110,100,101,114,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,209,0, - 0,0,124,4,0,0,115,8,0,0,0,0,1,6,1,6, + 0,0,125,4,0,0,115,8,0,0,0,0,1,6,1,6, 1,14,1,122,23,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0, @@ -1862,7 +1862,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,14,1,0,0,218,3,100,111,116,90, 2,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,23,95,102,105,110,100,95,112,97,114,101,110,116, - 95,112,97,116,104,95,110,97,109,101,115,130,4,0,0,115, + 95,112,97,116,104,95,110,97,109,101,115,131,4,0,0,115, 8,0,0,0,0,2,18,1,8,2,4,3,122,38,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,102,105, 110,100,95,112,97,114,101,110,116,95,112,97,116,104,95,110, @@ -1875,7 +1875,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 118,0,0,0,90,18,112,97,114,101,110,116,95,109,111,100, 117,108,101,95,110,97,109,101,90,14,112,97,116,104,95,97, 116,116,114,95,110,97,109,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,25,1,0,0,140,4,0,0, + 0,0,114,8,0,0,0,114,25,1,0,0,141,4,0,0, 115,4,0,0,0,0,1,12,1,122,31,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,103,101,116,95,112, 97,114,101,110,116,95,112,97,116,104,99,1,0,0,0,0, @@ -1891,7 +1891,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,24,1,0,0,41,3,114,118,0,0,0,90,11, 112,97,114,101,110,116,95,112,97,116,104,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,114,101,99,97,108,99,117,108,97,116,101,144,4,0, + 12,95,114,101,99,97,108,99,117,108,97,116,101,145,4,0, 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, @@ -1900,7 +1900,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,6,1,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,8,95,95,105,116,101,114,95,95,157,4,0,0, + 0,0,218,8,95,95,105,116,101,114,95,95,158,4,0,0, 115,2,0,0,0,0,1,122,23,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,105,116,101,114,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1909,7 +1909,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,32,1,0,0,41,2,114,118,0,0,0,218,5,105, 110,100,101,120,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,95,95,103,101,116,105,116,101,109,95,95, - 160,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, + 161,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, 109,101,115,112,97,99,101,80,97,116,104,46,95,95,103,101, 116,105,116,101,109,95,95,99,3,0,0,0,0,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1917,7 +1917,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,83,0,114,109,0,0,0,41,1,114,24,1,0,0,41, 3,114,118,0,0,0,114,35,1,0,0,114,44,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,163,4,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,164,4,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, @@ -1925,7 +1925,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,23,0,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,7,95,95,108,101,110,95,95,166,4,0,0,115, + 0,0,218,7,95,95,108,101,110,95,95,167,4,0,0,115, 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, @@ -1934,7 +1934,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125, 41,41,2,114,62,0,0,0,114,24,1,0,0,114,246,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,8,95,95,114,101,112,114,95,95,169,4,0,0,115, + 0,218,8,95,95,114,101,112,114,95,95,170,4,0,0,115, 2,0,0,0,0,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,114,101,112,114,95,95,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1942,7 +1942,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,160,0,161,0,118,0,83,0,114,109,0,0,0,114,34, 1,0,0,169,2,114,118,0,0,0,218,4,105,116,101,109, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,95,99,111,110,116,97,105,110,115,95,95,172,4,0, + 12,95,95,99,111,110,116,97,105,110,115,95,95,173,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,99,111,110,116,97, 105,110,115,95,95,99,2,0,0,0,0,0,0,0,0,0, @@ -1950,7 +1950,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,124,0,106,0,160,1,124,1,161,1,1,0,100, 0,83,0,114,109,0,0,0,41,2,114,24,1,0,0,114, 186,0,0,0,114,40,1,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,186,0,0,0,175,4,0, + 0,0,0,114,8,0,0,0,114,186,0,0,0,176,4,0, 0,115,2,0,0,0,0,1,122,21,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,97,112,112,101,110,100,78, 41,15,114,125,0,0,0,114,124,0,0,0,114,126,0,0, @@ -1959,7 +1959,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 36,1,0,0,114,37,1,0,0,114,38,1,0,0,114,39, 1,0,0,114,42,1,0,0,114,186,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,22,1,0,0,117,4,0,0,115,24,0,0,0,8, + 0,114,22,1,0,0,118,4,0,0,115,24,0,0,0,8, 1,4,6,8,6,8,10,8,4,8,13,8,3,8,3,8, 3,8,3,8,3,8,3,114,22,1,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, @@ -1975,7 +1975,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,2,124,3,131,3,124,0,95,1,100,0,83,0,114,109, 0,0,0,41,2,114,22,1,0,0,114,24,1,0,0,114, 28,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,209,0,0,0,181,4,0,0,115,2,0,0, + 0,0,0,114,209,0,0,0,182,4,0,0,115,2,0,0, 0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, @@ -1992,21 +1992,21 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,109,101,115,112,97,99,101,41,62,41,2,114,62,0,0, 0,114,125,0,0,0,41,2,114,193,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,109,111,100,117,108,101,95,114,101,112,114,184,4, + 0,218,11,109,111,100,117,108,101,95,114,101,112,114,185,4, 0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117, 108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, 115,4,0,0,0,100,1,83,0,41,2,78,84,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,182,0,0,0,193,4,0,0,115, + 0,114,8,0,0,0,114,182,0,0,0,194,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, 97,103,101,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, 0,100,1,83,0,41,2,78,114,40,0,0,0,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,229,0,0,0,196,4,0,0,115, + 0,114,8,0,0,0,114,229,0,0,0,197,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2016,20 +2016,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,103,62,114,215,0,0,0,84,41,1,114,231,0,0,0, 41,1,114,232,0,0,0,114,219,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,213,0,0,0, - 199,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, + 200,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, 109,101,115,112,97,99,101,76,111,97,100,101,114,46,103,101, 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,114,210,0,0,0,114,5,0, 0,0,114,211,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,212,0,0,0,202,4,0,0,115, + 0,114,8,0,0,0,114,212,0,0,0,203,4,0,0,115, 2,0,0,0,0,1,122,30,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,99,114,101,97,116,101,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,0,83,0,114,109,0,0,0,114,5,0, 0,0,114,253,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,217,0,0,0,205,4,0,0,115, + 0,114,8,0,0,0,114,217,0,0,0,206,4,0,0,115, 2,0,0,0,0,1,122,28,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2047,7 +2047,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,112,97,116,104,32,123,33,114,125,41,4,114,134,0,0, 0,114,149,0,0,0,114,24,1,0,0,114,218,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,220,0,0,0,208,4,0,0,115,8,0, + 8,0,0,0,114,220,0,0,0,209,4,0,0,115,8,0, 0,0,0,7,6,1,4,255,4,2,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,108,111,97, 100,95,109,111,100,117,108,101,78,41,12,114,125,0,0,0, @@ -2056,7 +2056,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,213,0,0,0,114,212,0,0,0,114,217,0, 0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,43,1,0,0, - 180,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, + 181,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, 8,8,3,8,3,8,3,8,3,8,3,114,43,1,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,4,0,0,0,64,0,0,0,115,118,0,0,0,101,0, @@ -2093,7 +2093,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,46,1,0,0,41,3,114,193,0,0,0,114, 116,0,0,0,218,6,102,105,110,100,101,114,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,46,1,0,0, - 226,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, + 227,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, 1,10,1,122,28,80,97,116,104,70,105,110,100,101,114,46, 105,110,118,97,108,105,100,97,116,101,95,99,97,99,104,101, 115,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -2113,7 +2113,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,0,0,0,41,3,114,193,0,0,0,114,44,0,0,0, 90,4,104,111,111,107,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,236,4,0,0,115,16,0,0,0,0,3,16,1,12, + 107,115,237,4,0,0,115,16,0,0,0,0,3,16,1,12, 1,10,1,2,1,14,1,12,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2144,7 +2144,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,44,0,0,0,114,50,1,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,20,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,249,4,0,0,115,22,0,0,0,0,8,8,1,2,1, + 101,250,4,0,0,115,22,0,0,0,0,8,8,1,2,1, 12,1,12,3,8,1,2,1,14,1,12,1,10,1,16,1, 122,31,80,97,116,104,70,105,110,100,101,114,46,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, @@ -2161,7 +2161,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,193,0,0,0,114,139,0,0,0,114,50,1,0,0,114, 140,0,0,0,114,141,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,16,95, - 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,15, + 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,16, 5,0,0,115,18,0,0,0,0,4,10,1,16,2,10,1, 4,1,8,1,12,1,12,1,6,1,122,27,80,97,116,104, 70,105,110,100,101,114,46,95,108,101,103,97,99,121,95,103, @@ -2193,7 +2193,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,112,97,116,104,90,5,101,110,116,114,121,114,50,1,0, 0,114,187,0,0,0,114,141,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,9,95,103,101,116, - 95,115,112,101,99,30,5,0,0,115,40,0,0,0,0,5, + 95,115,112,101,99,31,5,0,0,115,40,0,0,0,0,5, 4,1,8,1,14,1,2,1,10,1,8,1,10,1,14,2, 12,1,8,1,2,1,10,1,8,1,6,1,8,1,8,5, 12,2,12,1,6,1,122,20,80,97,116,104,70,105,110,100, @@ -2220,7 +2220,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,22,1,0,0,41,6,114,193,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,202,0,0,0,114,187,0,0,0, 114,57,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,203,0,0,0,62,5,0,0,115,26,0, + 8,0,0,0,114,203,0,0,0,63,5,0,0,115,26,0, 0,0,0,6,8,1,6,1,14,1,8,1,4,1,10,1, 6,1,4,3,6,1,16,1,4,2,6,2,122,20,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,115,112, @@ -2240,7 +2240,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, 100,46,10,10,32,32,32,32,32,32,32,32,78,114,204,0, 0,0,114,205,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,206,0,0,0,86,5,0,0,115, + 0,114,8,0,0,0,114,206,0,0,0,87,5,0,0,115, 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, @@ -2272,7 +2272,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,95,100,105,115,116,114,105,98,117,116,105,111,110,115,41, 4,114,193,0,0,0,114,119,0,0,0,114,120,0,0,0, 114,59,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,60,1,0,0,99,5,0,0,115,4,0, + 8,0,0,0,114,60,1,0,0,100,5,0,0,115,4,0, 0,0,0,10,12,1,122,29,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,100,105,115,116,114,105,98,117, 116,105,111,110,115,41,1,78,41,2,78,78,41,1,78,41, @@ -2281,7 +2281,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 52,1,0,0,114,54,1,0,0,114,55,1,0,0,114,58, 1,0,0,114,203,0,0,0,114,206,0,0,0,114,60,1, 0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,45,1,0,0,222,4,0,0,115, + 0,114,8,0,0,0,114,45,1,0,0,223,4,0,0,115, 34,0,0,0,8,2,4,2,2,1,10,9,2,1,10,12, 2,1,10,21,2,1,10,14,2,1,12,31,2,1,12,23, 2,1,12,12,2,1,114,45,1,0,0,99,0,0,0,0, @@ -2326,7 +2326,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 14,125,1,124,1,136,0,102,2,86,0,1,0,113,2,100, 0,83,0,114,109,0,0,0,114,5,0,0,0,114,16,1, 0,0,169,1,114,140,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,19,1,0,0,128,5,0,0,243,0,0,0, + 0,0,0,114,19,1,0,0,129,5,0,0,243,0,0,0, 0,122,38,70,105,108,101,70,105,110,100,101,114,46,95,95, 105,110,105,116,95,95,46,60,108,111,99,97,108,115,62,46, 60,103,101,110,101,120,112,114,62,114,71,0,0,0,114,104, @@ -2338,7 +2338,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,44,0,0,0,218,14,108,111,97,100, 101,114,95,100,101,116,97,105,108,115,90,7,108,111,97,100, 101,114,115,114,189,0,0,0,114,5,0,0,0,114,62,1, - 0,0,114,8,0,0,0,114,209,0,0,0,122,5,0,0, + 0,0,114,8,0,0,0,114,209,0,0,0,123,5,0,0, 115,16,0,0,0,0,4,4,1,12,1,26,1,6,2,10, 1,6,1,8,1,122,19,70,105,108,101,70,105,110,100,101, 114,46,95,95,105,110,105,116,95,95,99,1,0,0,0,0, @@ -2348,7 +2348,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, 116,105,109,101,46,114,104,0,0,0,78,41,1,114,65,1, 0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,46,1,0,0,136,5,0,0,115, + 0,114,8,0,0,0,114,46,1,0,0,137,5,0,0,115, 2,0,0,0,0,2,122,28,70,105,108,101,70,105,110,100, 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, 99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2371,7 +2371,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,78,41,3,114,203,0,0,0,114,140,0, 0,0,114,178,0,0,0,41,3,114,118,0,0,0,114,139, 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,137,0,0,0,142,5,0,0, + 0,0,114,8,0,0,0,114,137,0,0,0,143,5,0,0, 115,8,0,0,0,0,7,10,1,8,1,8,1,122,22,70, 105,108,101,70,105,110,100,101,114,46,102,105,110,100,95,108, 111,97,100,101,114,99,6,0,0,0,0,0,0,0,0,0, @@ -2382,7 +2382,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,188,0,0,0,114,139,0,0,0,114,44,0, 0,0,90,4,115,109,115,108,114,202,0,0,0,114,140,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,58,1,0,0,154,5,0,0,115,8,0,0,0,0, + 0,114,58,1,0,0,155,5,0,0,115,8,0,0,0,0, 1,10,1,8,1,2,255,122,20,70,105,108,101,70,105,110, 100,101,114,46,95,103,101,116,95,115,112,101,99,78,99,3, 0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,8, @@ -2436,7 +2436,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,17,1,0,0,114,188,0,0,0,90,13,105,110,105, 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, 95,112,97,116,104,114,187,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,203,0,0,0,159,5, + 5,0,0,0,114,8,0,0,0,114,203,0,0,0,160,5, 0,0,115,72,0,0,0,0,5,4,1,14,1,2,1,24, 1,12,1,10,1,10,1,8,1,6,2,6,1,6,1,10, 2,6,1,4,2,8,1,12,1,14,1,8,1,10,1,8, @@ -2468,7 +2468,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 161,0,146,2,113,4,83,0,114,5,0,0,0,41,1,114, 105,0,0,0,41,2,114,32,0,0,0,90,2,102,110,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,9, - 60,115,101,116,99,111,109,112,62,236,5,0,0,114,63,1, + 60,115,101,116,99,111,109,112,62,237,5,0,0,114,63,1, 0,0,122,41,70,105,108,101,70,105,110,100,101,114,46,95, 102,105,108,108,95,99,97,99,104,101,46,60,108,111,99,97, 108,115,62,46,60,115,101,116,99,111,109,112,62,78,41,18, @@ -2484,7 +2484,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 102,102,105,120,95,99,111,110,116,101,110,116,115,114,41,1, 0,0,114,116,0,0,0,114,29,1,0,0,114,17,1,0, 0,90,8,110,101,119,95,110,97,109,101,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,207, + 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,208, 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, 18,3,10,3,12,1,12,7,6,1,8,1,16,1,4,1, 18,2,4,1,12,1,6,1,12,1,122,22,70,105,108,101, @@ -2523,14 +2523,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,48,0,0,0,169,2,114,193,0,0,0,114,69,1, 0,0,114,5,0,0,0,114,8,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,248,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,249,5,0,0,115,6,0,0,0,0, 2,8,1,12,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, 111,114,95,70,105,108,101,70,105,110,100,101,114,114,5,0, 0,0,41,3,114,193,0,0,0,114,69,1,0,0,114,76, 1,0,0,114,5,0,0,0,114,75,1,0,0,114,8,0, - 0,0,218,9,112,97,116,104,95,104,111,111,107,238,5,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,239,5,0, 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -2539,7 +2539,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41, 2,114,62,0,0,0,114,44,0,0,0,114,246,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 39,1,0,0,0,6,0,0,115,2,0,0,0,0,1,122, + 39,1,0,0,1,6,0,0,115,2,0,0,0,0,1,122, 19,70,105,108,101,70,105,110,100,101,114,46,95,95,114,101, 112,114,95,95,41,1,78,41,15,114,125,0,0,0,114,124, 0,0,0,114,126,0,0,0,114,127,0,0,0,114,209,0, @@ -2547,7 +2547,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,137,0,0,0,114,58,1,0,0,114,203,0,0,0, 114,70,1,0,0,114,207,0,0,0,114,77,1,0,0,114, 39,1,0,0,114,5,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,61,1,0,0,113,5,0, + 0,0,0,114,8,0,0,0,114,61,1,0,0,114,5,0, 0,115,22,0,0,0,8,2,4,7,8,14,8,4,4,2, 8,12,8,5,10,48,8,31,2,1,10,17,114,61,1,0, 0,99,4,0,0,0,0,0,0,0,0,0,0,0,6,0, @@ -2571,7 +2571,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,112,97,116,104,110,97,109,101,114,140,0,0,0,114,187, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,6,6,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,7,6,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,14, 1,2,1,8,1,8,1,8,1,12,1,12,2,114,82,1, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, @@ -2591,7 +2591,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 10,101,120,116,101,110,115,105,111,110,115,90,6,115,111,117, 114,99,101,90,8,98,121,116,101,99,111,100,101,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,184,0,0, - 0,29,6,0,0,115,8,0,0,0,0,5,12,1,8,1, + 0,30,6,0,0,115,8,0,0,0,0,5,12,1,8,1, 8,1,114,184,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,10,0,0,0,9,0,0,0,67,0,0,0, 115,132,1,0,0,124,0,97,0,116,0,106,1,97,1,116, @@ -2639,7 +2639,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,83,0,41,2,114,39,0,0,0,78,41,1,114,23,0, 0,0,41,2,114,32,0,0,0,114,94,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,19,1, - 0,0,58,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,59,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,73,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2651,7 +2651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 157,2,146,2,113,4,83,0,41,1,114,74,0,0,0,114, 5,0,0,0,41,2,114,32,0,0,0,218,1,115,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,71,1, - 0,0,75,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,76,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,115,101, 116,99,111,109,112,62,41,3,114,64,0,0,0,114,75,0, 0,0,114,160,0,0,0,114,192,0,0,0,114,9,0,0, @@ -2671,7 +2671,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,116,105,110,95,110,97,109,101,115,90,12,98,117,105,108, 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, 110,95,109,111,100,117,108,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,40, + 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,41, 6,0,0,115,70,0,0,0,0,8,4,1,6,1,6,2, 10,3,22,1,12,2,22,1,8,1,10,1,10,1,6,2, 2,1,10,1,10,1,12,1,12,2,8,2,12,1,12,1, @@ -2691,7 +2691,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,186,0,0,0,114,45,1,0,0,41,2,114,88,1, 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, 97,100,101,114,115,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,105,110,115,116,97,108,108,97,6, + 8,0,0,0,218,8,95,105,110,115,116,97,108,108,98,6, 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, 91,1,0,0,41,1,114,60,0,0,0,41,1,78,41,3, 78,78,78,41,2,114,73,0,0,0,114,73,0,0,0,41, @@ -2725,7 +2725,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,8,60,109,111,100,117,108,101,62,1,0,0,0,115,126, 0,0,0,4,22,4,1,4,1,2,1,2,255,4,4,8, 17,8,5,8,5,8,6,8,6,8,12,8,10,8,9,8, - 5,8,7,8,9,10,22,10,127,0,21,16,1,12,2,4, + 5,8,7,8,9,10,22,10,127,0,22,16,1,12,2,4, 1,4,2,6,2,6,2,8,2,16,71,8,40,8,19,8, 12,8,12,8,28,8,17,8,33,8,28,8,24,10,13,10, 10,10,11,8,14,6,3,4,1,2,255,12,68,14,64,14, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 6f2b3e791d1f29..92f2e4004120e4 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -166,7 +166,7 @@ static void *opcode_targets[256] = { &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, &&TARGET_GET_MATCH_ITER, - &&_unknown_opcode, + &&TARGET_GET_MATCH_MAP, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 6ce6c345ce484b2ffa973fe44d5c735f6db4081d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 09:07:04 -0700 Subject: [PATCH 030/218] Simplify new opcodes --- Doc/library/dis.rst | 15 +- Include/opcode.h | 4 +- Lib/importlib/_bootstrap_external.py | 1 + Lib/opcode.py | 4 +- Python/ceval.c | 112 ++++++------- Python/compile.c | 10 +- Python/importlib_external.h | 228 +++++++++++++-------------- Python/opcode_targets.h | 4 +- 8 files changed, 179 insertions(+), 199 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 1141a79ae9d335..853eb46fdfc602 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -990,21 +990,20 @@ All of the following opcodes use their arguments. code counter is incremented by *delta*. -.. opcode:: GET_MATCH_ITER (delta) +.. opcode:: MATCH_SEQ_TYPE (delta) - Used for pattern matching. Much like :opcode:`GET_ITER`, but pops TOS and - increments the byte code counter by *delta* if TOS *is not* an instance of - :class:`collections.abc.Sequence` or *is* an instance of + Used for pattern matching. Pops TOS and increments the byte code counter by + *delta* if TOS is not an instance of :class:`collections.abc.Sequence`, is an + :term:`iterator`, or is an instance of :class:`str`/:class:`bytes`/:class:`bytearray`. .. versionadded:: 3.10 -.. opcode:: GET_MATCH_MAP (delta) +.. opcode:: MATCH_MAP_TYPE (delta) - Used for pattern matching. TOS is popped. If it is an instance of - :class:`collections.abc.Mapping`, a :class:`dict` is built from it and pushed - in its place. Otherwise, the byte code counter is incremented by *delta*. + Used for pattern matching. Pops TOS and increments the byte code counter by + *delta* if TOS is not an instance of :class:`collections.abc.Mapping`. .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index d5865a0b8c7ce5..826dc864125ad5 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -127,8 +127,8 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 -#define GET_MATCH_ITER 166 -#define GET_MATCH_MAP 167 +#define MATCH_SEQ_TYPE 166 +#define MATCH_MAP_TYPE 167 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 31db5026e76d36..1262a27aca0a02 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -279,6 +279,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a0 3435 (add GET_MATCH_ITER) # Python 3.10a0 3436 (add GET_MATCH_MAP) +# Python 3.10a0 3437 (GET_MATCH_* -> MATCH_*_TYPE) # # MAGIC must change whenever the bytecode emitted by the compiler may no diff --git a/Lib/opcode.py b/Lib/opcode.py index 0ac03b373ffa88..da3f4ac1aa69b6 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -213,7 +213,7 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -jrel_op('GET_MATCH_ITER', 166) -jrel_op('GET_MATCH_MAP', 167) +jrel_op('MATCH_SEQ_TYPE', 166) +jrel_op('MATCH_MAP_TYPE', 167) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index abc042ecca430f..cf4bf374773869 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -848,56 +848,6 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) return 0; } -// Need these for pattern matching: - -static int -check_match_mapping_type(PyObject *target) -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - return -1; - } - if (!interp->map_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return -1; - } - interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); - Py_DECREF(abc); - if (!interp->map_abc) { - return -1; - } - } - return PyObject_IsInstance(target, interp->map_abc); -} - -static int -check_match_sequence_type(PyObject *target) -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - return -1; - } - if (!interp->seq_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return -1; - } - interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - Py_DECREF(abc); - if (!interp->seq_abc) { - return -1; - } - } - return ( - PyObject_IsInstance(target, interp->seq_abc) - && !PyIter_Check(target) - && !PyObject_TypeCheck(target, &PyUnicode_Type) - && !PyObject_TypeCheck(target, &PyBytes_Type) - && !PyObject_TypeCheck(target, &PyByteArray_Type) - ); -} - static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **); @@ -2903,6 +2853,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(BUILD_MAP): { + PREDICTED(BUILD_MAP); Py_ssize_t i; PyObject *map = _PyDict_NewPresized((Py_ssize_t)oparg); if (map == NULL) @@ -3334,41 +3285,68 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(GET_MATCH_MAP): { - PyObject *target = TOP(); - int check = check_match_mapping_type(target); - if (check < 0) { + case TARGET(MATCH_MAP_TYPE): { + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { goto error; } - if (!check) { + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); + Py_DECREF(abc); + if (!interp->map_abc) { + goto error; + } + } + PyObject *target = TOP(); + if (!PyObject_IsInstance(target, interp->map_abc)) { STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); } - PyObject *map = PyDict_New(); - if (!map || PyDict_Update(map, target)) { - goto error; - } - Py_DECREF(target); - SET_TOP(map); + PREDICT(BUILD_MAP); DISPATCH(); } - case TARGET(GET_MATCH_ITER): { - PyObject *target = TOP(); - int check = check_match_sequence_type(target); - if (check < 0) { + case TARGET(MATCH_SEQ_TYPE): { + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { goto error; } - if (!check) { + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + Py_DECREF(abc); + if (!interp->seq_abc) { + goto error; + } + } + PyObject *target = TOP(); + if ( + !PyObject_IsInstance(target, interp->seq_abc) + || PyIter_Check(target) + || PyObject_TypeCheck(target, &PyUnicode_Type) + || PyObject_TypeCheck(target, &PyBytes_Type) + || PyObject_TypeCheck(target, &PyByteArray_Type) + ) { STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); } - } // Fall... + PREDICT(GET_ITER); + DISPATCH(); + } + case TARGET(GET_ITER): { + PREDICTED(GET_ITER); /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); PyObject *iter = PyObject_GetIter(iterable); diff --git a/Python/compile.c b/Python/compile.c index 6dfc2d9695887d..93951550d0db4c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -980,8 +980,8 @@ stack_effect(int opcode, int oparg, int jump) case FOR_ITER: /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; - case GET_MATCH_ITER: - case GET_MATCH_MAP: + case MATCH_SEQ_TYPE: + case MATCH_MAP_TYPE: return -(jump > 0); case STORE_ATTR: @@ -2829,7 +2829,8 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } end = compiler_new_block(c); block = compiler_new_block(c); - ADDOP_JREL(c, GET_MATCH_ITER, fail); + ADDOP_JREL(c, MATCH_SEQ_TYPE, fail); + ADDOP(c, GET_ITER); for (i = 0; i < size; i++) { elt = asdl_seq_GET(elts, i); if (i == star) { @@ -2840,7 +2841,8 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } if (size - i - 1) { ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP_JREL(c, GET_MATCH_ITER, fail); + ADDOP_JREL(c, MATCH_SEQ_TYPE, fail); + ADDOP(c, GET_ITER); } else { ADDOP_JREL(c, JUMP_FORWARD, end); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 96ccf461abd2d8..91843aad11f15c 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -400,7 +400,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,102,105,108,101,110,97,109,101,218,8,102,105,108,101,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,115, - 111,117,114,99,101,47,1,0,0,115,72,0,0,0,0,18, + 111,117,114,99,101,48,1,0,0,115,72,0,0,0,0,18, 8,1,6,1,2,255,4,2,8,1,4,1,8,1,12,1, 10,1,12,1,16,1,8,1,8,1,8,1,24,1,8,1, 12,1,6,2,8,1,8,1,8,1,8,1,14,1,14,1, @@ -481,7 +481,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,101, 110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,109, - 95,99,97,99,104,101,118,1,0,0,115,68,0,0,0,0, + 95,99,97,99,104,101,119,1,0,0,115,68,0,0,0,0, 9,12,1,8,1,10,1,12,1,4,1,10,1,12,1,14, 1,16,1,4,1,4,1,12,1,8,1,2,1,2,255,4, 1,2,255,8,2,10,1,8,1,16,1,10,1,16,1,10, @@ -517,7 +517,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, 95,112,97,116,104,114,5,0,0,0,114,5,0,0,0,114, 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,158,1,0,0,115,20,0,0,0,0,7, + 101,102,105,108,101,159,1,0,0,115,20,0,0,0,0,7, 12,1,4,1,16,1,24,1,4,1,2,1,12,1,16,1, 18,1,114,108,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,0, @@ -530,7 +530,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 112,108,101,114,101,0,0,0,114,97,0,0,0,114,82,0, 0,0,114,88,0,0,0,41,1,114,96,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 103,101,116,95,99,97,99,104,101,100,177,1,0,0,115,16, + 103,101,116,95,99,97,99,104,101,100,178,1,0,0,115,16, 0,0,0,0,1,14,1,2,1,10,1,12,1,8,1,14, 1,4,2,114,112,0,0,0,99,1,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, @@ -545,7 +545,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,51,0,0,0,114,50,0,0,0,41,2,114,44,0,0, 0,114,52,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,10,95,99,97,108,99,95,109,111,100, - 101,189,1,0,0,115,12,0,0,0,0,2,2,1,14,1, + 101,190,1,0,0,115,12,0,0,0,0,2,2,1,14,1, 12,1,10,3,8,1,114,114,0,0,0,99,1,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,0, 3,0,0,0,115,66,0,0,0,100,6,135,0,102,1,100, @@ -583,7 +583,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,114,103,115,218,6,107,119,97,114,103,115,169,1,218,6, 109,101,116,104,111,100,114,5,0,0,0,114,8,0,0,0, 218,19,95,99,104,101,99,107,95,110,97,109,101,95,119,114, - 97,112,112,101,114,209,1,0,0,115,18,0,0,0,0,1, + 97,112,112,101,114,210,1,0,0,115,18,0,0,0,0,1, 8,1,8,1,10,1,4,1,8,255,2,1,2,255,6,2, 122,40,95,99,104,101,99,107,95,110,97,109,101,46,60,108, 111,99,97,108,115,62,46,95,99,104,101,99,107,95,110,97, @@ -601,7 +601,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 8,95,95,100,105,99,116,95,95,218,6,117,112,100,97,116, 101,41,3,90,3,110,101,119,90,3,111,108,100,114,67,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,5,95,119,114,97,112,220,1,0,0,115,8,0,0, + 0,218,5,95,119,114,97,112,221,1,0,0,115,8,0,0, 0,0,1,8,1,10,1,20,1,122,26,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,119,114,97,112,41,1,78,41,3,218,10,95,98,111,111, @@ -609,7 +609,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,69,114,114,111,114,41,3,114,122,0,0,0,114,123,0, 0,0,114,133,0,0,0,114,5,0,0,0,114,121,0,0, 0,114,8,0,0,0,218,11,95,99,104,101,99,107,95,110, - 97,109,101,201,1,0,0,115,14,0,0,0,0,8,14,7, + 97,109,101,202,1,0,0,115,14,0,0,0,0,8,14,7, 2,1,10,1,12,2,14,5,10,1,114,136,0,0,0,99, 2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, 6,0,0,0,67,0,0,0,115,60,0,0,0,124,0,160, @@ -637,7 +637,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110, 115,218,3,109,115,103,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,17,95,102,105,110,100,95,109,111,100, - 117,108,101,95,115,104,105,109,229,1,0,0,115,10,0,0, + 117,108,101,95,115,104,105,109,230,1,0,0,115,10,0,0, 0,0,10,14,1,16,1,4,1,22,1,114,143,0,0,0, 99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0, 0,4,0,0,0,67,0,0,0,115,166,0,0,0,124,0, @@ -704,7 +704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,120,99,95,100,101,116,97,105,108,115,90,5,109,97,103, 105,99,114,92,0,0,0,114,2,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,13,95,99,108, - 97,115,115,105,102,121,95,112,121,99,246,1,0,0,115,28, + 97,115,115,105,102,121,95,112,121,99,247,1,0,0,115,28, 0,0,0,0,16,12,1,8,1,16,1,12,1,16,1,12, 1,10,1,12,1,8,1,16,2,8,1,16,1,16,1,114, 152,0,0,0,99,5,0,0,0,0,0,0,0,0,0,0, @@ -759,7 +759,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 122,101,114,116,0,0,0,114,151,0,0,0,114,92,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,23,95,118,97,108,105,100,97,116,101,95,116,105,109,101, - 115,116,97,109,112,95,112,121,99,23,2,0,0,115,16,0, + 115,116,97,109,112,95,112,121,99,24,2,0,0,115,16,0, 0,0,0,19,24,1,10,1,12,1,16,1,8,1,22,255, 2,2,114,156,0,0,0,99,4,0,0,0,0,0,0,0, 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, @@ -805,7 +805,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,11,115,111,117,114,99,101,95,104,97,115,104,114, 116,0,0,0,114,151,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,18,95,118,97,108,105,100, - 97,116,101,95,104,97,115,104,95,112,121,99,51,2,0,0, + 97,116,101,95,104,97,115,104,95,112,121,99,52,2,0,0, 115,12,0,0,0,0,17,16,1,2,1,8,255,4,2,2, 254,114,158,0,0,0,99,4,0,0,0,0,0,0,0,0, 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, @@ -829,7 +829,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,116,0,0,0,114,106,0,0,0,114, 107,0,0,0,218,4,99,111,100,101,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,17,95,99,111,109,112, - 105,108,101,95,98,121,116,101,99,111,100,101,75,2,0,0, + 105,108,101,95,98,121,116,101,99,111,100,101,76,2,0,0, 115,18,0,0,0,0,2,10,1,10,1,12,1,8,1,12, 1,4,2,10,1,4,255,114,165,0,0,0,114,73,0,0, 0,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0, @@ -848,7 +848,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,114,155,0,0,0,114,26,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,22,95,99,111, 100,101,95,116,111,95,116,105,109,101,115,116,97,109,112,95, - 112,121,99,88,2,0,0,115,12,0,0,0,0,2,8,1, + 112,121,99,89,2,0,0,115,12,0,0,0,0,2,8,1, 14,1,14,1,14,1,16,1,114,170,0,0,0,84,99,3, 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5, 0,0,0,67,0,0,0,115,80,0,0,0,116,0,116,1, @@ -866,7 +866,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,7,99,104,101,99,107,101,100,114,26,0,0,0,114, 2,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,104,97, - 115,104,95,112,121,99,98,2,0,0,115,14,0,0,0,0, + 115,104,95,112,121,99,99,2,0,0,115,14,0,0,0,0, 2,8,1,12,1,14,1,16,1,10,1,16,1,114,171,0, 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,5, 0,0,0,6,0,0,0,67,0,0,0,115,62,0,0,0, @@ -893,7 +893,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,109, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,110, 2,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,176,0,0,0,169,2,114,140,0,0,0,218,26, 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, @@ -955,7 +955,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,182,0,0,0,90,7,100,105,114,110,97,109,101,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,23,115, 112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111, - 99,97,116,105,111,110,126,2,0,0,115,62,0,0,0,0, + 99,97,116,105,111,110,127,2,0,0,115,62,0,0,0,0, 12,8,4,4,1,10,2,2,1,14,1,12,1,8,2,10, 8,16,1,6,3,8,1,14,1,14,1,10,1,6,1,6, 2,4,3,8,2,10,1,2,1,14,1,12,1,6,2,4, @@ -992,7 +992,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,73, 78,69,41,2,218,3,99,108,115,114,7,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,14,95, - 111,112,101,110,95,114,101,103,105,115,116,114,121,206,2,0, + 111,112,101,110,95,114,101,103,105,115,116,114,121,207,2,0, 0,115,8,0,0,0,0,2,2,1,16,1,12,1,122,36, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105, @@ -1020,7 +1020,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, 104,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, - 114,121,213,2,0,0,115,24,0,0,0,0,2,6,1,8, + 114,121,214,2,0,0,115,24,0,0,0,0,2,6,1,8, 2,6,1,6,1,16,255,6,2,2,1,12,1,46,1,12, 1,8,1,122,38,87,105,110,100,111,119,115,82,101,103,105, 115,116,114,121,70,105,110,100,101,114,46,95,115,101,97,114, @@ -1042,7 +1042,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,6,116,97,114,103,101,116,114,199,0,0,0,114, 140,0,0,0,114,189,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,9,102, - 105,110,100,95,115,112,101,99,228,2,0,0,115,28,0,0, + 105,110,100,95,115,112,101,99,229,2,0,0,115,28,0,0, 0,0,2,10,1,8,1,4,1,2,1,12,1,12,1,8, 1,14,1,14,1,6,1,8,1,2,254,6,3,122,31,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, @@ -1061,7 +1061,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 2,114,203,0,0,0,114,140,0,0,0,169,4,114,193,0, 0,0,114,139,0,0,0,114,44,0,0,0,114,187,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,11,102,105,110,100,95,109,111,100,117,108,101,244,2,0, + 218,11,102,105,110,100,95,109,111,100,117,108,101,245,2,0, 0,115,8,0,0,0,0,7,12,1,8,1,6,2,122,33, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,102,105,110,100,95,109,111,100,117,108, @@ -1071,7 +1071,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,97,115,115,109,101,116,104,111,100,114,194,0,0,0,114, 200,0,0,0,114,203,0,0,0,114,206,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,191,0,0,0,194,2,0,0,115,28,0,0,0, + 0,0,114,191,0,0,0,195,2,0,0,115,28,0,0,0, 8,2,4,3,2,255,2,4,2,255,2,3,4,2,2,1, 10,6,2,1,10,14,2,1,12,15,2,1,114,191,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1107,7 +1107,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 139,0,0,0,114,96,0,0,0,90,13,102,105,108,101,110, 97,109,101,95,98,97,115,101,90,9,116,97,105,108,95,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,182,0,0,0,7,3,0,0,115,8,0,0,0, + 0,0,114,182,0,0,0,8,3,0,0,115,8,0,0,0, 0,3,18,1,16,1,14,1,122,24,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1118,7 +1118,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,46,78,114,5,0,0,0,169,2,114,118,0,0,0,114, 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,15,3,0,0,115,2,0,0,0,0,1,122,27,95, + 108,101,16,3,0,0,115,2,0,0,0,0,1,122,27,95, 76,111,97,100,101,114,66,97,115,105,99,115,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,5,0,0,0,67, @@ -1138,7 +1138,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 131,0,0,0,41,3,114,118,0,0,0,218,6,109,111,100, 117,108,101,114,164,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,11,101,120,101,99,95,109,111, - 100,117,108,101,18,3,0,0,115,12,0,0,0,0,2,12, + 100,117,108,101,19,3,0,0,115,12,0,0,0,0,2,12, 1,8,1,6,1,4,255,6,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1149,14 +1149,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,169,2,114,118,0,0,0,114,139,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,26,3, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,27,3, 0,0,115,2,0,0,0,0,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,125,0,0,0,114,124,0,0, 0,114,126,0,0,0,114,127,0,0,0,114,182,0,0,0, 114,212,0,0,0,114,217,0,0,0,114,220,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,208,0,0,0,2,3,0,0,115,10,0,0, + 0,0,0,114,208,0,0,0,3,3,0,0,115,10,0,0, 0,8,2,4,3,8,8,8,3,8,8,114,208,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,64,0,0,0,115,74,0,0,0,101,0, @@ -1181,7 +1181,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,32,32,78,41,1,114,50,0,0,0,169, 2,114,118,0,0,0,114,44,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,10,112,97,116,104, - 95,109,116,105,109,101,33,3,0,0,115,2,0,0,0,0, + 95,109,116,105,109,101,34,3,0,0,115,2,0,0,0,0, 6,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, @@ -1215,7 +1215,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,32,32,32,32,32,32,32,32,114,169,0,0,0, 41,1,114,223,0,0,0,114,222,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,41,3,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,42,3,0,0,115,2,0,0,0, 0,12,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, @@ -1239,7 +1239,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,107,0,0,0,90,10,99,97,99,104,101,95,112,97,116, 104,114,26,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,15,95,99,97,99,104,101,95,98,121, - 116,101,99,111,100,101,55,3,0,0,115,2,0,0,0,0, + 116,101,99,111,100,101,56,3,0,0,115,2,0,0,0,0, 8,122,28,83,111,117,114,99,101,76,111,97,100,101,114,46, 95,99,97,99,104,101,95,98,121,116,101,99,111,100,101,99, 3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, @@ -1256,7 +1256,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,46,10,32,32,32,32,32,32,32,32,78,114,5,0,0, 0,41,3,114,118,0,0,0,114,44,0,0,0,114,26,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,225,0,0,0,65,3,0,0,115,2,0,0,0,0, + 0,114,225,0,0,0,66,3,0,0,115,2,0,0,0,0, 1,122,21,83,111,117,114,99,101,76,111,97,100,101,114,46, 115,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0, 0,0,0,0,0,5,0,0,0,10,0,0,0,67,0,0, @@ -1277,7 +1277,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,41,5,114,118,0,0,0,114,139,0,0,0,114,44,0, 0,0,114,174,0,0,0,218,3,101,120,99,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,103,101,116, - 95,115,111,117,114,99,101,72,3,0,0,115,20,0,0,0, + 95,115,111,117,114,99,101,73,3,0,0,115,20,0,0,0, 0,2,10,1,2,1,14,1,14,1,4,1,2,255,4,1, 2,255,24,2,122,23,83,111,117,114,99,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,114,104,0, @@ -1299,7 +1299,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,7,99,111,109,112,105,108,101,41,4,114,118,0,0,0, 114,26,0,0,0,114,44,0,0,0,114,230,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,14, - 115,111,117,114,99,101,95,116,111,95,99,111,100,101,82,3, + 115,111,117,114,99,101,95,116,111,95,99,111,100,101,83,3, 0,0,115,6,0,0,0,0,5,12,1,4,255,122,27,83, 111,117,114,99,101,76,111,97,100,101,114,46,115,111,117,114, 99,101,95,116,111,95,99,111,100,101,99,2,0,0,0,0, @@ -1376,7 +1376,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,151,0,0,0,114,2,0,0,0,90, 10,98,121,116,101,115,95,100,97,116,97,90,11,99,111,100, 101,95,111,98,106,101,99,116,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,213,0,0,0,90,3,0,0, + 0,0,114,8,0,0,0,114,213,0,0,0,91,3,0,0, 115,152,0,0,0,0,7,10,1,4,1,4,1,4,1,4, 1,4,1,2,1,12,1,12,1,12,2,2,1,14,1,12, 1,8,2,12,1,2,1,14,1,12,1,6,3,2,1,2, @@ -1393,7 +1393,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,226,0,0,0,114,225,0,0,0,114,229,0,0,0,114, 233,0,0,0,114,213,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,221,0, - 0,0,31,3,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,32,3,0,0,115,14,0,0,0,8,2,8,8,8, 14,8,10,8,7,8,10,14,8,114,221,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 0,0,0,0,0,0,0,115,124,0,0,0,101,0,90,1, @@ -1422,7 +1422,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,102,105,110,100,101,114,46,78,114,159,0, 0,0,41,3,114,118,0,0,0,114,139,0,0,0,114,44, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,209,0,0,0,180,3,0,0,115,4,0,0,0, + 0,0,114,209,0,0,0,181,3,0,0,115,4,0,0,0, 0,3,6,1,122,19,70,105,108,101,76,111,97,100,101,114, 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, @@ -1431,7 +1431,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,2,218,9,95,95,99,108,97,115,115,95, 95,114,131,0,0,0,169,2,114,118,0,0,0,90,5,111, 116,104,101,114,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,6,95,95,101,113,95,95,186,3,0,0,115, + 0,0,0,218,6,95,95,101,113,95,95,187,3,0,0,115, 6,0,0,0,0,1,12,1,10,255,122,17,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, @@ -1440,7 +1440,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,3,218,4,104,97,115,104,114,116,0,0, 0,114,44,0,0,0,169,1,114,118,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,218,8,95,95, - 104,97,115,104,95,95,190,3,0,0,115,2,0,0,0,0, + 104,97,115,104,95,95,191,3,0,0,115,2,0,0,0,0, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,115, @@ -1454,7 +1454,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5, 115,117,112,101,114,114,239,0,0,0,114,220,0,0,0,114, 219,0,0,0,169,1,114,241,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,220,0,0,0,193,3,0,0,115,2, + 114,8,0,0,0,114,220,0,0,0,194,3,0,0,115,2, 0,0,0,0,10,122,22,70,105,108,101,76,111,97,100,101, 114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1464,7 +1464,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,114, 48,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,179,0,0,0,205,3,0, + 0,0,0,114,8,0,0,0,114,179,0,0,0,206,3,0, 0,115,2,0,0,0,0,3,122,23,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,109, 101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1486,7 +1486,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,90,4,114,101,97,100,114,65,0,0,0,41,3,114, 118,0,0,0,114,44,0,0,0,114,68,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,227,0, - 0,0,210,3,0,0,115,10,0,0,0,0,2,14,1,16, + 0,0,211,3,0,0,115,10,0,0,0,0,2,14,1,16, 1,40,2,14,1,122,19,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,100,97,116,97,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1495,7 +1495,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,182,0,0,0,169,2,114,118,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, 0,218,19,103,101,116,95,114,101,115,111,117,114,99,101,95, - 114,101,97,100,101,114,221,3,0,0,115,6,0,0,0,0, + 114,101,97,100,101,114,222,3,0,0,115,6,0,0,0,0, 2,10,1,4,1,122,30,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,114,101,115,111,117,114,99,101,95,114, 101,97,100,101,114,99,2,0,0,0,0,0,0,0,0,0, @@ -1507,7 +1507,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,64,0,0,0,114,65,0,0,0,169,3,114,118,0, 0,0,90,8,114,101,115,111,117,114,99,101,114,44,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,227, + 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,228, 3,0,0,115,4,0,0,0,0,1,20,1,122,24,70,105, 108,101,76,111,97,100,101,114,46,111,112,101,110,95,114,101, 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0, @@ -1520,7 +1520,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,114,38,0,0,0,114,47,0,0,0,114,44, 0,0,0,114,255,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,13,114,101,115,111,117,114,99, - 101,95,112,97,116,104,231,3,0,0,115,8,0,0,0,0, + 101,95,112,97,116,104,232,3,0,0,115,8,0,0,0,0, 1,10,1,4,1,20,1,122,24,70,105,108,101,76,111,97, 100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,116, 104,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1532,7 +1532,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,44,0,0,0,114,54,0,0,0,169,3,114,118,0, 0,0,114,116,0,0,0,114,44,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,2,1,0,0, - 237,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, + 238,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, 1,122,22,70,105,108,101,76,111,97,100,101,114,46,105,115, 95,114,101,115,111,117,114,99,101,99,1,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,0, @@ -1542,7 +1542,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,7,108,105,115,116,100,105,114,114,47,0,0,0,114, 44,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,8,99,111,110,116,101,110, - 116,115,243,3,0,0,115,2,0,0,0,0,1,122,19,70, + 116,115,244,3,0,0,115,2,0,0,0,0,1,122,19,70, 105,108,101,76,111,97,100,101,114,46,99,111,110,116,101,110, 116,115,41,17,114,125,0,0,0,114,124,0,0,0,114,126, 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, @@ -1551,7 +1551,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,0,1,0,0,114,4,1,0,0,114,2,1,0,0,114, 8,1,0,0,90,13,95,95,99,108,97,115,115,99,101,108, 108,95,95,114,5,0,0,0,114,5,0,0,0,114,249,0, - 0,0,114,8,0,0,0,114,239,0,0,0,175,3,0,0, + 0,0,114,8,0,0,0,114,239,0,0,0,176,3,0,0, 115,30,0,0,0,8,2,4,3,8,6,8,4,8,3,2, 1,14,11,2,1,10,4,8,11,2,1,10,5,8,4,8, 6,8,6,114,239,0,0,0,99,0,0,0,0,0,0,0, @@ -1574,7 +1574,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 49,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, 115,116,95,115,105,122,101,41,3,114,118,0,0,0,114,44, 0,0,0,114,238,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,224,0,0,0,251,3,0,0, + 0,0,114,8,0,0,0,114,224,0,0,0,252,3,0,0, 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,0, @@ -1585,7 +1585,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 225,0,0,0,41,5,114,118,0,0,0,114,107,0,0,0, 114,106,0,0,0,114,26,0,0,0,114,52,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,226, - 0,0,0,0,4,0,0,115,4,0,0,0,0,2,8,1, + 0,0,0,1,4,0,0,115,4,0,0,0,0,2,8,1, 122,32,83,111,117,114,99,101,70,105,108,101,76,111,97,100, 101,114,46,95,99,97,99,104,101,95,98,121,116,101,99,111, 100,101,114,60,0,0,0,114,11,1,0,0,99,3,0,0, @@ -1620,7 +1620,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,0,0,218,6,112,97,114,101,110,116,114,96,0,0,0, 114,37,0,0,0,114,33,0,0,0,114,228,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,225, - 0,0,0,5,4,0,0,115,46,0,0,0,0,2,12,1, + 0,0,0,6,4,0,0,115,46,0,0,0,0,2,12,1, 4,2,12,1,12,1,12,2,12,1,10,1,2,1,14,1, 12,2,8,1,14,3,6,1,4,255,4,2,28,1,2,1, 12,1,16,1,16,2,8,1,2,255,122,25,83,111,117,114, @@ -1629,7 +1629,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,126,0,0,0,114,127,0,0,0,114,224,0,0, 0,114,226,0,0,0,114,225,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 9,1,0,0,247,3,0,0,115,8,0,0,0,8,2,4, + 9,1,0,0,248,3,0,0,115,8,0,0,0,8,2,4, 2,8,5,8,5,114,9,1,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, @@ -1651,7 +1651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,235,0,0,0,41,5,114,118,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,26,0,0,0,114,151,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 213,0,0,0,40,4,0,0,115,22,0,0,0,0,1,10, + 213,0,0,0,41,4,0,0,115,22,0,0,0,0,1,10, 1,10,4,2,1,2,254,6,4,12,1,2,1,14,1,2, 1,2,253,122,29,83,111,117,114,99,101,108,101,115,115,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, @@ -1661,14 +1661,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,110,101,32,97,115,32,116,104,101,114,101,32,105,115,32, 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, 114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,229,0,0,0,56,4, + 5,0,0,0,114,8,0,0,0,114,229,0,0,0,57,4, 0,0,115,2,0,0,0,0,2,122,31,83,111,117,114,99, 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,78,41,6,114,125,0, 0,0,114,124,0,0,0,114,126,0,0,0,114,127,0,0, 0,114,213,0,0,0,114,229,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 15,1,0,0,36,4,0,0,115,6,0,0,0,8,2,4, + 15,1,0,0,37,4,0,0,115,6,0,0,0,8,2,4, 2,8,16,114,15,1,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, 0,115,92,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1688,7 +1688,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,16,0,0,0,124,1,124,0,95,0,124,2,124,0, 95,1,100,0,83,0,114,109,0,0,0,114,159,0,0,0, 114,5,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,73,4,0,0,115,4,0, + 8,0,0,0,114,209,0,0,0,74,4,0,0,115,4,0, 0,0,0,1,6,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1696,7 +1696,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,124,0,106,0,124,1,106,0,107,2,111,22,124,0, 106,1,124,1,106,1,107,2,83,0,114,109,0,0,0,114, 240,0,0,0,114,242,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,243,0,0,0,77,4,0, + 0,0,0,114,8,0,0,0,114,243,0,0,0,78,4,0, 0,115,6,0,0,0,0,1,12,1,10,255,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1704,7 +1704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,20,0,0,0,116,0,124,0,106,1,131,1,116,0, 124,0,106,2,131,1,65,0,83,0,114,109,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,247,0,0,0,81,4,0, + 0,0,0,114,8,0,0,0,114,247,0,0,0,82,4,0, 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, @@ -1721,7 +1721,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,116,101,95,100,121,110,97,109,105,99,114,149,0,0,0, 114,116,0,0,0,114,44,0,0,0,41,3,114,118,0,0, 0,114,187,0,0,0,114,216,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,84, + 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,85, 4,0,0,115,14,0,0,0,0,2,4,1,6,255,4,2, 6,1,8,255,4,2,122,33,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,97, @@ -1738,7 +1738,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 214,0,0,0,114,163,0,0,0,90,12,101,120,101,99,95, 100,121,110,97,109,105,99,114,149,0,0,0,114,116,0,0, 0,114,44,0,0,0,114,253,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,92, + 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,93, 4,0,0,115,8,0,0,0,0,2,14,1,6,1,8,255, 122,31,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, @@ -1757,7 +1757,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,169,2,114,32,0,0,0,218,6,115,117,102,102,105, 120,169,1,90,9,102,105,108,101,95,110,97,109,101,114,5, 0,0,0,114,8,0,0,0,218,9,60,103,101,110,101,120, - 112,114,62,101,4,0,0,115,4,0,0,0,4,1,2,255, + 112,114,62,102,4,0,0,115,4,0,0,0,4,1,2,255, 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, @@ -1765,7 +1765,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, 83,85,70,70,73,88,69,83,114,219,0,0,0,114,5,0, 0,0,114,18,1,0,0,114,8,0,0,0,114,182,0,0, - 0,98,4,0,0,115,8,0,0,0,0,2,14,1,12,1, + 0,99,4,0,0,115,8,0,0,0,0,2,14,1,12,1, 2,255,122,30,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1776,7 +1776,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,32,99,114,101,97,116,101,32,97,32,99,111,100,101,32, 111,98,106,101,99,116,46,78,114,5,0,0,0,114,219,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,213,0,0,0,104,4,0,0,115,2,0,0,0,0, + 0,114,213,0,0,0,105,4,0,0,115,2,0,0,0,0, 2,122,28,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1786,14 +1786,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,117,108,101,115,32,104,97,118,101,32,110,111,32,115,111, 117,114,99,101,32,99,111,100,101,46,78,114,5,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,229,0,0,0,108,4,0,0,115,2,0, + 8,0,0,0,114,229,0,0,0,109,4,0,0,115,2,0, 0,0,0,2,122,30,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, 117,114,99,101,99,2,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,6,0, 0,0,124,0,106,0,83,0,114,250,0,0,0,114,48,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,179,0,0,0,112,4,0,0,115, + 0,114,8,0,0,0,114,179,0,0,0,113,4,0,0,115, 2,0,0,0,0,3,122,32,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 102,105,108,101,110,97,109,101,78,41,14,114,125,0,0,0, @@ -1802,7 +1802,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,217,0,0,0,114,182,0,0,0,114,213,0, 0,0,114,229,0,0,0,114,136,0,0,0,114,179,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,252,0,0,0,65,4,0,0,115,22, + 114,8,0,0,0,114,252,0,0,0,66,4,0,0,115,22, 0,0,0,8,2,4,6,8,4,8,4,8,3,8,8,8, 6,8,6,8,4,8,4,2,1,114,252,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1845,7 +1845,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 169,4,114,118,0,0,0,114,116,0,0,0,114,44,0,0, 0,90,11,112,97,116,104,95,102,105,110,100,101,114,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,209,0, - 0,0,125,4,0,0,115,8,0,0,0,0,1,6,1,6, + 0,0,126,4,0,0,115,8,0,0,0,0,1,6,1,6, 1,14,1,122,23,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0, @@ -1862,7 +1862,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,14,1,0,0,218,3,100,111,116,90, 2,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,23,95,102,105,110,100,95,112,97,114,101,110,116, - 95,112,97,116,104,95,110,97,109,101,115,131,4,0,0,115, + 95,112,97,116,104,95,110,97,109,101,115,132,4,0,0,115, 8,0,0,0,0,2,18,1,8,2,4,3,122,38,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,102,105, 110,100,95,112,97,114,101,110,116,95,112,97,116,104,95,110, @@ -1875,7 +1875,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 118,0,0,0,90,18,112,97,114,101,110,116,95,109,111,100, 117,108,101,95,110,97,109,101,90,14,112,97,116,104,95,97, 116,116,114,95,110,97,109,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,25,1,0,0,141,4,0,0, + 0,0,114,8,0,0,0,114,25,1,0,0,142,4,0,0, 115,4,0,0,0,0,1,12,1,122,31,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,103,101,116,95,112, 97,114,101,110,116,95,112,97,116,104,99,1,0,0,0,0, @@ -1891,7 +1891,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,24,1,0,0,41,3,114,118,0,0,0,90,11, 112,97,114,101,110,116,95,112,97,116,104,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,114,101,99,97,108,99,117,108,97,116,101,145,4,0, + 12,95,114,101,99,97,108,99,117,108,97,116,101,146,4,0, 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, @@ -1900,7 +1900,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,6,1,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,8,95,95,105,116,101,114,95,95,158,4,0,0, + 0,0,218,8,95,95,105,116,101,114,95,95,159,4,0,0, 115,2,0,0,0,0,1,122,23,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,105,116,101,114,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1909,7 +1909,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,32,1,0,0,41,2,114,118,0,0,0,218,5,105, 110,100,101,120,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,95,95,103,101,116,105,116,101,109,95,95, - 161,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, + 162,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, 109,101,115,112,97,99,101,80,97,116,104,46,95,95,103,101, 116,105,116,101,109,95,95,99,3,0,0,0,0,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1917,7 +1917,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,83,0,114,109,0,0,0,41,1,114,24,1,0,0,41, 3,114,118,0,0,0,114,35,1,0,0,114,44,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,164,4,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,165,4,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, @@ -1925,7 +1925,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,23,0,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,7,95,95,108,101,110,95,95,167,4,0,0,115, + 0,0,218,7,95,95,108,101,110,95,95,168,4,0,0,115, 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, @@ -1934,7 +1934,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125, 41,41,2,114,62,0,0,0,114,24,1,0,0,114,246,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,8,95,95,114,101,112,114,95,95,170,4,0,0,115, + 0,218,8,95,95,114,101,112,114,95,95,171,4,0,0,115, 2,0,0,0,0,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,114,101,112,114,95,95,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1942,7 +1942,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,160,0,161,0,118,0,83,0,114,109,0,0,0,114,34, 1,0,0,169,2,114,118,0,0,0,218,4,105,116,101,109, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,95,99,111,110,116,97,105,110,115,95,95,173,4,0, + 12,95,95,99,111,110,116,97,105,110,115,95,95,174,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,99,111,110,116,97, 105,110,115,95,95,99,2,0,0,0,0,0,0,0,0,0, @@ -1950,7 +1950,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,124,0,106,0,160,1,124,1,161,1,1,0,100, 0,83,0,114,109,0,0,0,41,2,114,24,1,0,0,114, 186,0,0,0,114,40,1,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,186,0,0,0,176,4,0, + 0,0,0,114,8,0,0,0,114,186,0,0,0,177,4,0, 0,115,2,0,0,0,0,1,122,21,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,97,112,112,101,110,100,78, 41,15,114,125,0,0,0,114,124,0,0,0,114,126,0,0, @@ -1959,7 +1959,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 36,1,0,0,114,37,1,0,0,114,38,1,0,0,114,39, 1,0,0,114,42,1,0,0,114,186,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,22,1,0,0,118,4,0,0,115,24,0,0,0,8, + 0,114,22,1,0,0,119,4,0,0,115,24,0,0,0,8, 1,4,6,8,6,8,10,8,4,8,13,8,3,8,3,8, 3,8,3,8,3,8,3,114,22,1,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, @@ -1975,7 +1975,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,2,124,3,131,3,124,0,95,1,100,0,83,0,114,109, 0,0,0,41,2,114,22,1,0,0,114,24,1,0,0,114, 28,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,209,0,0,0,182,4,0,0,115,2,0,0, + 0,0,0,114,209,0,0,0,183,4,0,0,115,2,0,0, 0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, @@ -1992,21 +1992,21 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,109,101,115,112,97,99,101,41,62,41,2,114,62,0,0, 0,114,125,0,0,0,41,2,114,193,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,109,111,100,117,108,101,95,114,101,112,114,185,4, + 0,218,11,109,111,100,117,108,101,95,114,101,112,114,186,4, 0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117, 108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, 115,4,0,0,0,100,1,83,0,41,2,78,84,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,182,0,0,0,194,4,0,0,115, + 0,114,8,0,0,0,114,182,0,0,0,195,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, 97,103,101,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, 0,100,1,83,0,41,2,78,114,40,0,0,0,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,229,0,0,0,197,4,0,0,115, + 0,114,8,0,0,0,114,229,0,0,0,198,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2016,20 +2016,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,103,62,114,215,0,0,0,84,41,1,114,231,0,0,0, 41,1,114,232,0,0,0,114,219,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,213,0,0,0, - 200,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, + 201,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, 109,101,115,112,97,99,101,76,111,97,100,101,114,46,103,101, 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,114,210,0,0,0,114,5,0, 0,0,114,211,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,212,0,0,0,203,4,0,0,115, + 0,114,8,0,0,0,114,212,0,0,0,204,4,0,0,115, 2,0,0,0,0,1,122,30,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,99,114,101,97,116,101,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,0,83,0,114,109,0,0,0,114,5,0, 0,0,114,253,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,217,0,0,0,206,4,0,0,115, + 0,114,8,0,0,0,114,217,0,0,0,207,4,0,0,115, 2,0,0,0,0,1,122,28,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2047,7 +2047,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,112,97,116,104,32,123,33,114,125,41,4,114,134,0,0, 0,114,149,0,0,0,114,24,1,0,0,114,218,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,220,0,0,0,209,4,0,0,115,8,0, + 8,0,0,0,114,220,0,0,0,210,4,0,0,115,8,0, 0,0,0,7,6,1,4,255,4,2,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,108,111,97, 100,95,109,111,100,117,108,101,78,41,12,114,125,0,0,0, @@ -2056,7 +2056,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,213,0,0,0,114,212,0,0,0,114,217,0, 0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,43,1,0,0, - 181,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, + 182,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, 8,8,3,8,3,8,3,8,3,8,3,114,43,1,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,4,0,0,0,64,0,0,0,115,118,0,0,0,101,0, @@ -2093,7 +2093,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,46,1,0,0,41,3,114,193,0,0,0,114, 116,0,0,0,218,6,102,105,110,100,101,114,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,46,1,0,0, - 227,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, + 228,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, 1,10,1,122,28,80,97,116,104,70,105,110,100,101,114,46, 105,110,118,97,108,105,100,97,116,101,95,99,97,99,104,101, 115,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -2113,7 +2113,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,0,0,0,41,3,114,193,0,0,0,114,44,0,0,0, 90,4,104,111,111,107,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,237,4,0,0,115,16,0,0,0,0,3,16,1,12, + 107,115,238,4,0,0,115,16,0,0,0,0,3,16,1,12, 1,10,1,2,1,14,1,12,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2144,7 +2144,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,44,0,0,0,114,50,1,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,20,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,250,4,0,0,115,22,0,0,0,0,8,8,1,2,1, + 101,251,4,0,0,115,22,0,0,0,0,8,8,1,2,1, 12,1,12,3,8,1,2,1,14,1,12,1,10,1,16,1, 122,31,80,97,116,104,70,105,110,100,101,114,46,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, @@ -2161,7 +2161,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,193,0,0,0,114,139,0,0,0,114,50,1,0,0,114, 140,0,0,0,114,141,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,16,95, - 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,16, + 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,17, 5,0,0,115,18,0,0,0,0,4,10,1,16,2,10,1, 4,1,8,1,12,1,12,1,6,1,122,27,80,97,116,104, 70,105,110,100,101,114,46,95,108,101,103,97,99,121,95,103, @@ -2193,7 +2193,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,112,97,116,104,90,5,101,110,116,114,121,114,50,1,0, 0,114,187,0,0,0,114,141,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,9,95,103,101,116, - 95,115,112,101,99,31,5,0,0,115,40,0,0,0,0,5, + 95,115,112,101,99,32,5,0,0,115,40,0,0,0,0,5, 4,1,8,1,14,1,2,1,10,1,8,1,10,1,14,2, 12,1,8,1,2,1,10,1,8,1,6,1,8,1,8,5, 12,2,12,1,6,1,122,20,80,97,116,104,70,105,110,100, @@ -2220,7 +2220,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,22,1,0,0,41,6,114,193,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,202,0,0,0,114,187,0,0,0, 114,57,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,203,0,0,0,63,5,0,0,115,26,0, + 8,0,0,0,114,203,0,0,0,64,5,0,0,115,26,0, 0,0,0,6,8,1,6,1,14,1,8,1,4,1,10,1, 6,1,4,3,6,1,16,1,4,2,6,2,122,20,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,115,112, @@ -2240,7 +2240,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, 100,46,10,10,32,32,32,32,32,32,32,32,78,114,204,0, 0,0,114,205,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,206,0,0,0,87,5,0,0,115, + 0,114,8,0,0,0,114,206,0,0,0,88,5,0,0,115, 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, @@ -2272,7 +2272,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,95,100,105,115,116,114,105,98,117,116,105,111,110,115,41, 4,114,193,0,0,0,114,119,0,0,0,114,120,0,0,0, 114,59,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,60,1,0,0,100,5,0,0,115,4,0, + 8,0,0,0,114,60,1,0,0,101,5,0,0,115,4,0, 0,0,0,10,12,1,122,29,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,100,105,115,116,114,105,98,117, 116,105,111,110,115,41,1,78,41,2,78,78,41,1,78,41, @@ -2281,7 +2281,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 52,1,0,0,114,54,1,0,0,114,55,1,0,0,114,58, 1,0,0,114,203,0,0,0,114,206,0,0,0,114,60,1, 0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,45,1,0,0,223,4,0,0,115, + 0,114,8,0,0,0,114,45,1,0,0,224,4,0,0,115, 34,0,0,0,8,2,4,2,2,1,10,9,2,1,10,12, 2,1,10,21,2,1,10,14,2,1,12,31,2,1,12,23, 2,1,12,12,2,1,114,45,1,0,0,99,0,0,0,0, @@ -2326,7 +2326,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 14,125,1,124,1,136,0,102,2,86,0,1,0,113,2,100, 0,83,0,114,109,0,0,0,114,5,0,0,0,114,16,1, 0,0,169,1,114,140,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,19,1,0,0,129,5,0,0,243,0,0,0, + 0,0,0,114,19,1,0,0,130,5,0,0,243,0,0,0, 0,122,38,70,105,108,101,70,105,110,100,101,114,46,95,95, 105,110,105,116,95,95,46,60,108,111,99,97,108,115,62,46, 60,103,101,110,101,120,112,114,62,114,71,0,0,0,114,104, @@ -2338,7 +2338,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,44,0,0,0,218,14,108,111,97,100, 101,114,95,100,101,116,97,105,108,115,90,7,108,111,97,100, 101,114,115,114,189,0,0,0,114,5,0,0,0,114,62,1, - 0,0,114,8,0,0,0,114,209,0,0,0,123,5,0,0, + 0,0,114,8,0,0,0,114,209,0,0,0,124,5,0,0, 115,16,0,0,0,0,4,4,1,12,1,26,1,6,2,10, 1,6,1,8,1,122,19,70,105,108,101,70,105,110,100,101, 114,46,95,95,105,110,105,116,95,95,99,1,0,0,0,0, @@ -2348,7 +2348,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, 116,105,109,101,46,114,104,0,0,0,78,41,1,114,65,1, 0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,46,1,0,0,137,5,0,0,115, + 0,114,8,0,0,0,114,46,1,0,0,138,5,0,0,115, 2,0,0,0,0,2,122,28,70,105,108,101,70,105,110,100, 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, 99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2371,7 +2371,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,78,41,3,114,203,0,0,0,114,140,0, 0,0,114,178,0,0,0,41,3,114,118,0,0,0,114,139, 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,137,0,0,0,143,5,0,0, + 0,0,114,8,0,0,0,114,137,0,0,0,144,5,0,0, 115,8,0,0,0,0,7,10,1,8,1,8,1,122,22,70, 105,108,101,70,105,110,100,101,114,46,102,105,110,100,95,108, 111,97,100,101,114,99,6,0,0,0,0,0,0,0,0,0, @@ -2382,7 +2382,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,188,0,0,0,114,139,0,0,0,114,44,0, 0,0,90,4,115,109,115,108,114,202,0,0,0,114,140,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,58,1,0,0,155,5,0,0,115,8,0,0,0,0, + 0,114,58,1,0,0,156,5,0,0,115,8,0,0,0,0, 1,10,1,8,1,2,255,122,20,70,105,108,101,70,105,110, 100,101,114,46,95,103,101,116,95,115,112,101,99,78,99,3, 0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,8, @@ -2436,7 +2436,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,17,1,0,0,114,188,0,0,0,90,13,105,110,105, 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, 95,112,97,116,104,114,187,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,203,0,0,0,160,5, + 5,0,0,0,114,8,0,0,0,114,203,0,0,0,161,5, 0,0,115,72,0,0,0,0,5,4,1,14,1,2,1,24, 1,12,1,10,1,10,1,8,1,6,2,6,1,6,1,10, 2,6,1,4,2,8,1,12,1,14,1,8,1,10,1,8, @@ -2468,7 +2468,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 161,0,146,2,113,4,83,0,114,5,0,0,0,41,1,114, 105,0,0,0,41,2,114,32,0,0,0,90,2,102,110,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,9, - 60,115,101,116,99,111,109,112,62,237,5,0,0,114,63,1, + 60,115,101,116,99,111,109,112,62,238,5,0,0,114,63,1, 0,0,122,41,70,105,108,101,70,105,110,100,101,114,46,95, 102,105,108,108,95,99,97,99,104,101,46,60,108,111,99,97, 108,115,62,46,60,115,101,116,99,111,109,112,62,78,41,18, @@ -2484,7 +2484,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 102,102,105,120,95,99,111,110,116,101,110,116,115,114,41,1, 0,0,114,116,0,0,0,114,29,1,0,0,114,17,1,0, 0,90,8,110,101,119,95,110,97,109,101,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,208, + 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,209, 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, 18,3,10,3,12,1,12,7,6,1,8,1,16,1,4,1, 18,2,4,1,12,1,6,1,12,1,122,22,70,105,108,101, @@ -2523,14 +2523,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,48,0,0,0,169,2,114,193,0,0,0,114,69,1, 0,0,114,5,0,0,0,114,8,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,249,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,250,5,0,0,115,6,0,0,0,0, 2,8,1,12,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, 111,114,95,70,105,108,101,70,105,110,100,101,114,114,5,0, 0,0,41,3,114,193,0,0,0,114,69,1,0,0,114,76, 1,0,0,114,5,0,0,0,114,75,1,0,0,114,8,0, - 0,0,218,9,112,97,116,104,95,104,111,111,107,239,5,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,240,5,0, 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -2539,7 +2539,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41, 2,114,62,0,0,0,114,44,0,0,0,114,246,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 39,1,0,0,1,6,0,0,115,2,0,0,0,0,1,122, + 39,1,0,0,2,6,0,0,115,2,0,0,0,0,1,122, 19,70,105,108,101,70,105,110,100,101,114,46,95,95,114,101, 112,114,95,95,41,1,78,41,15,114,125,0,0,0,114,124, 0,0,0,114,126,0,0,0,114,127,0,0,0,114,209,0, @@ -2547,7 +2547,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,137,0,0,0,114,58,1,0,0,114,203,0,0,0, 114,70,1,0,0,114,207,0,0,0,114,77,1,0,0,114, 39,1,0,0,114,5,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,61,1,0,0,114,5,0, + 0,0,0,114,8,0,0,0,114,61,1,0,0,115,5,0, 0,115,22,0,0,0,8,2,4,7,8,14,8,4,4,2, 8,12,8,5,10,48,8,31,2,1,10,17,114,61,1,0, 0,99,4,0,0,0,0,0,0,0,0,0,0,0,6,0, @@ -2571,7 +2571,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,112,97,116,104,110,97,109,101,114,140,0,0,0,114,187, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,7,6,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,8,6,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,14, 1,2,1,8,1,8,1,8,1,12,1,12,2,114,82,1, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, @@ -2591,7 +2591,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 10,101,120,116,101,110,115,105,111,110,115,90,6,115,111,117, 114,99,101,90,8,98,121,116,101,99,111,100,101,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,184,0,0, - 0,30,6,0,0,115,8,0,0,0,0,5,12,1,8,1, + 0,31,6,0,0,115,8,0,0,0,0,5,12,1,8,1, 8,1,114,184,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,10,0,0,0,9,0,0,0,67,0,0,0, 115,132,1,0,0,124,0,97,0,116,0,106,1,97,1,116, @@ -2639,7 +2639,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,83,0,41,2,114,39,0,0,0,78,41,1,114,23,0, 0,0,41,2,114,32,0,0,0,114,94,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,19,1, - 0,0,59,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,60,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,73,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2651,7 +2651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 157,2,146,2,113,4,83,0,41,1,114,74,0,0,0,114, 5,0,0,0,41,2,114,32,0,0,0,218,1,115,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,71,1, - 0,0,76,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,77,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,115,101, 116,99,111,109,112,62,41,3,114,64,0,0,0,114,75,0, 0,0,114,160,0,0,0,114,192,0,0,0,114,9,0,0, @@ -2671,7 +2671,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,116,105,110,95,110,97,109,101,115,90,12,98,117,105,108, 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, 110,95,109,111,100,117,108,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,41, + 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,42, 6,0,0,115,70,0,0,0,0,8,4,1,6,1,6,2, 10,3,22,1,12,2,22,1,8,1,10,1,10,1,6,2, 2,1,10,1,10,1,12,1,12,2,8,2,12,1,12,1, @@ -2691,7 +2691,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,186,0,0,0,114,45,1,0,0,41,2,114,88,1, 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, 97,100,101,114,115,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,105,110,115,116,97,108,108,98,6, + 8,0,0,0,218,8,95,105,110,115,116,97,108,108,99,6, 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, 91,1,0,0,41,1,114,60,0,0,0,41,1,78,41,3, 78,78,78,41,2,114,73,0,0,0,114,73,0,0,0,41, @@ -2725,7 +2725,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,8,60,109,111,100,117,108,101,62,1,0,0,0,115,126, 0,0,0,4,22,4,1,4,1,2,1,2,255,4,4,8, 17,8,5,8,5,8,6,8,6,8,12,8,10,8,9,8, - 5,8,7,8,9,10,22,10,127,0,22,16,1,12,2,4, + 5,8,7,8,9,10,22,10,127,0,23,16,1,12,2,4, 1,4,2,6,2,6,2,8,2,16,71,8,40,8,19,8, 12,8,12,8,28,8,17,8,33,8,28,8,24,10,13,10, 10,10,11,8,14,6,3,4,1,2,255,12,68,14,64,14, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 92f2e4004120e4..09a0c12e5f9c4f 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -165,8 +165,8 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&TARGET_GET_MATCH_ITER, - &&TARGET_GET_MATCH_MAP, + &&TARGET_MATCH_SEQ_TYPE, + &&TARGET_MATCH_MAP_TYPE, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From ea0de16e323c3e68329b7624cc4f6d384cba55d6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 10:23:58 -0700 Subject: [PATCH 031/218] Bump MAGIC_NUMBER --- Lib/importlib/_bootstrap_external.py | 2 +- Python/importlib_external.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 1262a27aca0a02..c799f8f002a415 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -289,7 +289,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3435).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3437).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 91843aad11f15c..4c7277b19b62f9 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,107,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,109,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, From 880a7c2b53b433de0b5cbfa48cf17b07d0157844 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 19:44:08 -0700 Subject: [PATCH 032/218] Add mapping support --- Doc/library/dis.rst | 27 +++- Include/opcode.h | 5 +- Lib/importlib/_bootstrap_external.py | 6 +- Lib/opcode.py | 5 +- Python/ast.c | 68 ++++++-- Python/ceval.c | 52 ++++-- Python/compile.c | 97 ++++++++--- Python/importlib_external.h | 230 +++++++++++++-------------- Python/opcode_targets.h | 6 +- 9 files changed, 311 insertions(+), 185 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 853eb46fdfc602..fbd71e24ee5da9 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -990,20 +990,31 @@ All of the following opcodes use their arguments. code counter is incremented by *delta*. -.. opcode:: MATCH_SEQ_TYPE (delta) +.. opcode:: MATCH_SEQ (delta) - Used for pattern matching. Pops TOS and increments the byte code counter by - *delta* if TOS is not an instance of :class:`collections.abc.Sequence`, is an - :term:`iterator`, or is an instance of - :class:`str`/:class:`bytes`/:class:`bytearray`. + Used to implement pattern matching. Pop TOS. If it is an instance of + :class:`collections.abc.Sequence`, is not an :term:`iterator`, and is not an + instance of :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator + from it and push that onto the stack. Otherwise, increment the bytecode + counter by ``delta``. .. versionadded:: 3.10 -.. opcode:: MATCH_MAP_TYPE (delta) +.. opcode:: MATCH_MAP (delta) - Used for pattern matching. Pops TOS and increments the byte code counter by - *delta* if TOS is not an instance of :class:`collections.abc.Mapping`. + Used to implement pattern matching. Pop TOS. If it is an instance of + :class:`collections.abc.Mapping`, copy it into a :class:`dict` and push that + onto the stack. Otherwise, increment the bytecode counter by *delta*. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_KEY (delta) + + Used to implement pattern matching. Pop TOS. If it is a key in the dict at + TOS1, remove it and push the associated value onto the stack. Otherwise, + increment the bytecode counter by *delta*. .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index 826dc864125ad5..6cff79517cccb7 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -127,8 +127,9 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 -#define MATCH_SEQ_TYPE 166 -#define MATCH_MAP_TYPE 167 +#define MATCH_SEQ 166 +#define MATCH_MAP 167 +#define MATCH_KEY 168 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index c799f8f002a415..eb3100b41dae4d 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,9 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3435 (add GET_MATCH_ITER) -# Python 3.10a0 3436 (add GET_MATCH_MAP) -# Python 3.10a0 3437 (GET_MATCH_* -> MATCH_*_TYPE) +# Python 3.10a0 3438 (add MATCH_KEY, MATCH_MAP, MATCH_SEQ) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -289,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3437).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3438).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index da3f4ac1aa69b6..67f0e3149aaf18 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -213,7 +213,8 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -jrel_op('MATCH_SEQ_TYPE', 166) -jrel_op('MATCH_MAP_TYPE', 167) +jrel_op('MATCH_SEQ', 166) +jrel_op('MATCH_MAP', 167) +jrel_op('MATCH_KEY', 168) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ast.c b/Python/ast.c index f5c82d2b1745ad..9d4df2a41f9a31 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -305,47 +305,81 @@ validate_expr(expr_ty exp, expr_context_ty ctx) static int validate_pattern(expr_ty p) { - asdl_seq *elts; - expr_ty elt; + asdl_seq *keys, *values; + expr_ty key, value; Py_ssize_t i, size; - char *error = "invalid Match pattern"; switch (p->kind) { case Attribute_kind: return validate_expr(p, Load); case BinOp_kind: if (p->v.BinOp.op != BitOr) { - error = "BinOp op in pattern must be BitOr"; + PyErr_SetString(PyExc_ValueError, + "BinOp op in pattern must be BitOr"); + return 0; } return (validate_pattern(p->v.BinOp.left) && validate_pattern(p->v.BinOp.right)); case Constant_kind: - return validate_constant(p->v.Constant.value); + return validate_expr(p, Load); + case Dict_kind: + keys = p->v.Dict.keys; + values = p->v.Dict.values; + size = asdl_seq_LEN(values); + if (asdl_seq_LEN(keys) != size) { + PyErr_SetString(PyExc_ValueError, + "Dict keys and values must be equal-length"); + return 0; + } + for (i = 0; i < size; i++) { + key = asdl_seq_GET(keys, i); + if (key) { + if (key->kind == Name_kind) { + if (key->v.Name.ctx != Load) { + PyErr_SetString(PyExc_ValueError, + "Name ctx in Dict keys pattern must be Load"); + return 0; + } + } + else if (key->kind != Constant_kind) { + PyErr_SetString(PyExc_ValueError, + "Dict keys pattern must be Constant or Name"); + return 0; + } + return validate_expr(key, Load); + } + if (!validate_pattern(asdl_seq_GET(values, i))) { + return 0; + } + } + return 0; case List_kind: - case Tuple_kind: - elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; - size = asdl_seq_LEN(elts); + case Tuple_kind: // TODO: Undecided yet if tuple syntax is legal. + values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + size = asdl_seq_LEN(values); for (i = 0; i < size; i++) { - elt = asdl_seq_GET(elts, i); - if (elt->kind == Starred_kind) { - elt = elt->v.Starred.value; + value = asdl_seq_GET(values, i); + if (value->kind == Starred_kind) { + value = value->v.Starred.value; } - if (!validate_pattern(elt)) { + if (!validate_pattern(value)) { return 0; } } return 1; case Name_kind: if (p->v.Name.ctx != Load && p->v.Name.ctx != Store) { - error = "Name ctx in pattern must be either Load or Store"; + PyErr_SetString(PyExc_ValueError, + "Name ctx in pattern must be Load or Store"); + return 0; } return validate_expr(p, p->v.Name.ctx); case NamedExpr_kind: - return validate_pattern(p->v.NamedExpr.value); + return (validate_pattern(p->v.NamedExpr.value) + && validate_expr(p->v.NamedExpr.target, Store)); default: - break; + PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); + return 0; } - PyErr_SetString(PyExc_ValueError, error); - return 0; } static int diff --git a/Python/ceval.c b/Python/ceval.c index cf4bf374773869..7ecb7d5756e064 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2853,7 +2853,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(BUILD_MAP): { - PREDICTED(BUILD_MAP); Py_ssize_t i; PyObject *map = _PyDict_NewPresized((Py_ssize_t)oparg); if (map == NULL) @@ -3285,7 +3284,31 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(MATCH_MAP_TYPE): { + case TARGET(MATCH_KEY): { + PyObject *key = TOP(); + PyObject *map = SECOND(); + assert(PyDict_CheckExact(map)); + PyObject *value = PyDict_GetItemWithError(map, key); + if (!value) { + if (_PyErr_Occurred(tstate)) { + goto error; + } + STACK_SHRINK(1); + Py_DECREF(key); + JUMPBY(oparg); + DISPATCH(); + } + Py_INCREF(value); + if (PyDict_DelItem(map, key)) { + Py_DECREF(value); + goto error; + } + Py_DECREF(key); + SET_TOP(value); + DISPATCH(); + } + + case TARGET(MATCH_MAP): { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { goto error; @@ -3308,11 +3331,26 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) JUMPBY(oparg); DISPATCH(); } - PREDICT(BUILD_MAP); + PyObject *copy; + if (PyDict_CheckExact(target)) { + copy = PyDict_Copy(target); + if (!copy) { + goto error; + } + } + else { + copy = PyDict_New(); + if (!copy || PyDict_Update(copy, target)) { + Py_XDECREF(copy); + goto error; + } + } + Py_DECREF(target); + SET_TOP(copy); DISPATCH(); } - case TARGET(MATCH_SEQ_TYPE): { + case TARGET(MATCH_SEQ): { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { goto error; @@ -3341,12 +3379,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) JUMPBY(oparg); DISPATCH(); } - PREDICT(GET_ITER); - DISPATCH(); - } - + } // Fall... case TARGET(GET_ITER): { - PREDICTED(GET_ITER); /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); PyObject *iter = PyObject_GetIter(iterable); diff --git a/Python/compile.c b/Python/compile.c index 93951550d0db4c..510ff8346a162b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -980,8 +980,9 @@ stack_effect(int opcode, int oparg, int jump) case FOR_ITER: /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; - case MATCH_SEQ_TYPE: - case MATCH_MAP_TYPE: + case MATCH_SEQ: + case MATCH_MAP: + case MATCH_KEY: return -(jump > 0); case STORE_ATTR: @@ -2750,7 +2751,7 @@ compiler_if(struct compiler *c, stmt_ty s) } static int -compiler_pattern_name_store(struct compiler *c, expr_ty p) +pattern_store_helper(struct compiler *c, expr_ty p) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); @@ -2768,19 +2769,19 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) { basicblock *end, *block; Py_ssize_t i, size, star; - asdl_seq *elts; - expr_ty elt; + asdl_seq *keys, *values; + expr_ty key, value; switch (p->kind) { // Atomic patterns: case Name_kind: if (p->v.Name.ctx == Store) { - return compiler_pattern_name_store(c, p); + return pattern_store_helper(c, p); } assert(p->v.Name.ctx == Load); - // Fall through... + // Fall... case Attribute_kind: assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); - // Fall through.... + // Fall.... case Constant_kind: VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); @@ -2803,17 +2804,66 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } compiler_use_next_block(c, end); return 1; + case Dict_kind: + keys = p->v.Dict.keys; + values = p->v.Dict.values; + size = asdl_seq_LEN(values); + star = 0; + // TODO: Rely on parser/validation for this? + for (i = 0; i < size; i++) { + if (asdl_seq_GET(keys, i)) { + continue; + } + value = asdl_seq_GET(values, i); + if (value->kind != Name_kind || value->v.Name.ctx != Store) { + return compiler_error(c, + "starred sub-patterns must be names"); + } + if (i != size - 1) { + return compiler_error(c, + "sub-patterns cannot follow starred name"); + } + star = 1; + } + end = compiler_new_block(c); + block = compiler_new_block(c); + ADDOP_JREL(c, MATCH_MAP, fail); + for (i = 0; i < size - star; i++) { + key = asdl_seq_GET(keys, i); + value = asdl_seq_GET(values, i); + assert(key); + assert(key->kind == Name_kind && key->v.Name.ctx == Load + || key->kind == Constant_kind); + VISIT(c, expr, key); + ADDOP_JREL(c, MATCH_KEY, block); + if (!compiler_pattern(c, value, block)) { + return 0; + } + } + if (!star) { + ADDOP(c, POP_TOP); + } + else if (!pattern_store_helper(c, asdl_seq_GET(values, size - 1))) { + return 0; + } + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); + return 1; case List_kind: - case Tuple_kind: - elts = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; - size = asdl_seq_LEN(elts); + case Tuple_kind: // TODO: Undecided yet if tuple syntax is legal. + values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + size = asdl_seq_LEN(values); star = -1; for (i = 0; i < size; i++) { - elt = asdl_seq_GET(elts, i); - if (elt->kind != Starred_kind) { + value = asdl_seq_GET(values, i); + if (value->kind != Starred_kind) { continue; } - if (elt->kind != Name_kind || elt->v.Name.ctx != Store) { + // TODO: Rely on parser/validation for this? + if (value->kind != Name_kind || value->v.Name.ctx != Store) { return compiler_error(c, "starred sub-patterns must be names"); } @@ -2821,28 +2871,27 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) return compiler_error(c, "multiple starred names in pattern"); } + // TODO: Test this math: if ((size - i - 1) << 8 >= INT_MAX) { return compiler_error(c, - "too many sub-patterns follow starred sub-pattern"); + "too many sub-patterns follow starred name"); } star = i; } end = compiler_new_block(c); block = compiler_new_block(c); - ADDOP_JREL(c, MATCH_SEQ_TYPE, fail); - ADDOP(c, GET_ITER); + ADDOP_JREL(c, MATCH_SEQ, fail); for (i = 0; i < size; i++) { - elt = asdl_seq_GET(elts, i); + value = asdl_seq_GET(values, i); if (i == star) { - assert(elt->kind == Starred_kind); + assert(value->kind == Starred_kind); ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); - if (!compiler_pattern_name_store(c, elt->v.Starred.value)) { + if (!pattern_store_helper(c, value->v.Starred.value)) { return 0; } if (size - i - 1) { ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP_JREL(c, MATCH_SEQ_TYPE, fail); - ADDOP(c, GET_ITER); + ADDOP_JREL(c, MATCH_SEQ, fail); } else { ADDOP_JREL(c, JUMP_FORWARD, end); @@ -2850,13 +2899,11 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) } else { ADDOP_JREL(c, FOR_ITER, fail); - if (!compiler_pattern(c, elt, block)) { + if (!compiler_pattern(c, value, block)) { return 0; } } } - // TODO: This could be simplified with VM support. Pop top, and jump - // to "fail" if items remain. JUMP_IF_NOT_EMPTY? ADDOP_JREL(c, FOR_ITER, end); ADDOP(c, POP_TOP); compiler_use_next_block(c, block); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 4c7277b19b62f9..ea266c93abde41 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,109,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,110,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, @@ -400,7 +400,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,102,105,108,101,110,97,109,101,218,8,102,105,108,101,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,115, - 111,117,114,99,101,48,1,0,0,115,72,0,0,0,0,18, + 111,117,114,99,101,46,1,0,0,115,72,0,0,0,0,18, 8,1,6,1,2,255,4,2,8,1,4,1,8,1,12,1, 10,1,12,1,16,1,8,1,8,1,8,1,24,1,8,1, 12,1,6,2,8,1,8,1,8,1,8,1,14,1,14,1, @@ -481,7 +481,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,101, 110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,109, - 95,99,97,99,104,101,119,1,0,0,115,68,0,0,0,0, + 95,99,97,99,104,101,117,1,0,0,115,68,0,0,0,0, 9,12,1,8,1,10,1,12,1,4,1,10,1,12,1,14, 1,16,1,4,1,4,1,12,1,8,1,2,1,2,255,4, 1,2,255,8,2,10,1,8,1,16,1,10,1,16,1,10, @@ -517,7 +517,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, 95,112,97,116,104,114,5,0,0,0,114,5,0,0,0,114, 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,159,1,0,0,115,20,0,0,0,0,7, + 101,102,105,108,101,157,1,0,0,115,20,0,0,0,0,7, 12,1,4,1,16,1,24,1,4,1,2,1,12,1,16,1, 18,1,114,108,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,0, @@ -530,7 +530,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 112,108,101,114,101,0,0,0,114,97,0,0,0,114,82,0, 0,0,114,88,0,0,0,41,1,114,96,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 103,101,116,95,99,97,99,104,101,100,178,1,0,0,115,16, + 103,101,116,95,99,97,99,104,101,100,176,1,0,0,115,16, 0,0,0,0,1,14,1,2,1,10,1,12,1,8,1,14, 1,4,2,114,112,0,0,0,99,1,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, @@ -545,7 +545,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,51,0,0,0,114,50,0,0,0,41,2,114,44,0,0, 0,114,52,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,10,95,99,97,108,99,95,109,111,100, - 101,190,1,0,0,115,12,0,0,0,0,2,2,1,14,1, + 101,188,1,0,0,115,12,0,0,0,0,2,2,1,14,1, 12,1,10,3,8,1,114,114,0,0,0,99,1,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,0, 3,0,0,0,115,66,0,0,0,100,6,135,0,102,1,100, @@ -583,7 +583,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,114,103,115,218,6,107,119,97,114,103,115,169,1,218,6, 109,101,116,104,111,100,114,5,0,0,0,114,8,0,0,0, 218,19,95,99,104,101,99,107,95,110,97,109,101,95,119,114, - 97,112,112,101,114,210,1,0,0,115,18,0,0,0,0,1, + 97,112,112,101,114,208,1,0,0,115,18,0,0,0,0,1, 8,1,8,1,10,1,4,1,8,255,2,1,2,255,6,2, 122,40,95,99,104,101,99,107,95,110,97,109,101,46,60,108, 111,99,97,108,115,62,46,95,99,104,101,99,107,95,110,97, @@ -601,7 +601,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 8,95,95,100,105,99,116,95,95,218,6,117,112,100,97,116, 101,41,3,90,3,110,101,119,90,3,111,108,100,114,67,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,5,95,119,114,97,112,221,1,0,0,115,8,0,0, + 0,218,5,95,119,114,97,112,219,1,0,0,115,8,0,0, 0,0,1,8,1,10,1,20,1,122,26,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,119,114,97,112,41,1,78,41,3,218,10,95,98,111,111, @@ -609,7 +609,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,69,114,114,111,114,41,3,114,122,0,0,0,114,123,0, 0,0,114,133,0,0,0,114,5,0,0,0,114,121,0,0, 0,114,8,0,0,0,218,11,95,99,104,101,99,107,95,110, - 97,109,101,202,1,0,0,115,14,0,0,0,0,8,14,7, + 97,109,101,200,1,0,0,115,14,0,0,0,0,8,14,7, 2,1,10,1,12,2,14,5,10,1,114,136,0,0,0,99, 2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, 6,0,0,0,67,0,0,0,115,60,0,0,0,124,0,160, @@ -637,7 +637,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110, 115,218,3,109,115,103,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,17,95,102,105,110,100,95,109,111,100, - 117,108,101,95,115,104,105,109,230,1,0,0,115,10,0,0, + 117,108,101,95,115,104,105,109,228,1,0,0,115,10,0,0, 0,0,10,14,1,16,1,4,1,22,1,114,143,0,0,0, 99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0, 0,4,0,0,0,67,0,0,0,115,166,0,0,0,124,0, @@ -704,7 +704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,120,99,95,100,101,116,97,105,108,115,90,5,109,97,103, 105,99,114,92,0,0,0,114,2,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,13,95,99,108, - 97,115,115,105,102,121,95,112,121,99,247,1,0,0,115,28, + 97,115,115,105,102,121,95,112,121,99,245,1,0,0,115,28, 0,0,0,0,16,12,1,8,1,16,1,12,1,16,1,12, 1,10,1,12,1,8,1,16,2,8,1,16,1,16,1,114, 152,0,0,0,99,5,0,0,0,0,0,0,0,0,0,0, @@ -759,7 +759,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 122,101,114,116,0,0,0,114,151,0,0,0,114,92,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,23,95,118,97,108,105,100,97,116,101,95,116,105,109,101, - 115,116,97,109,112,95,112,121,99,24,2,0,0,115,16,0, + 115,116,97,109,112,95,112,121,99,22,2,0,0,115,16,0, 0,0,0,19,24,1,10,1,12,1,16,1,8,1,22,255, 2,2,114,156,0,0,0,99,4,0,0,0,0,0,0,0, 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, @@ -805,7 +805,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,11,115,111,117,114,99,101,95,104,97,115,104,114, 116,0,0,0,114,151,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,18,95,118,97,108,105,100, - 97,116,101,95,104,97,115,104,95,112,121,99,52,2,0,0, + 97,116,101,95,104,97,115,104,95,112,121,99,50,2,0,0, 115,12,0,0,0,0,17,16,1,2,1,8,255,4,2,2, 254,114,158,0,0,0,99,4,0,0,0,0,0,0,0,0, 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, @@ -829,7 +829,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,116,0,0,0,114,106,0,0,0,114, 107,0,0,0,218,4,99,111,100,101,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,17,95,99,111,109,112, - 105,108,101,95,98,121,116,101,99,111,100,101,76,2,0,0, + 105,108,101,95,98,121,116,101,99,111,100,101,74,2,0,0, 115,18,0,0,0,0,2,10,1,10,1,12,1,8,1,12, 1,4,2,10,1,4,255,114,165,0,0,0,114,73,0,0, 0,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0, @@ -848,7 +848,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,114,155,0,0,0,114,26,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,22,95,99,111, 100,101,95,116,111,95,116,105,109,101,115,116,97,109,112,95, - 112,121,99,89,2,0,0,115,12,0,0,0,0,2,8,1, + 112,121,99,87,2,0,0,115,12,0,0,0,0,2,8,1, 14,1,14,1,14,1,16,1,114,170,0,0,0,84,99,3, 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5, 0,0,0,67,0,0,0,115,80,0,0,0,116,0,116,1, @@ -866,7 +866,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,7,99,104,101,99,107,101,100,114,26,0,0,0,114, 2,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,104,97, - 115,104,95,112,121,99,99,2,0,0,115,14,0,0,0,0, + 115,104,95,112,121,99,97,2,0,0,115,14,0,0,0,0, 2,8,1,12,1,14,1,16,1,10,1,16,1,114,171,0, 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,5, 0,0,0,6,0,0,0,67,0,0,0,115,62,0,0,0, @@ -893,7 +893,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,110, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,108, 2,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,176,0,0,0,169,2,114,140,0,0,0,218,26, 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, @@ -955,7 +955,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,182,0,0,0,90,7,100,105,114,110,97,109,101,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,23,115, 112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111, - 99,97,116,105,111,110,127,2,0,0,115,62,0,0,0,0, + 99,97,116,105,111,110,125,2,0,0,115,62,0,0,0,0, 12,8,4,4,1,10,2,2,1,14,1,12,1,8,2,10, 8,16,1,6,3,8,1,14,1,14,1,10,1,6,1,6, 2,4,3,8,2,10,1,2,1,14,1,12,1,6,2,4, @@ -992,7 +992,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,73, 78,69,41,2,218,3,99,108,115,114,7,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,14,95, - 111,112,101,110,95,114,101,103,105,115,116,114,121,207,2,0, + 111,112,101,110,95,114,101,103,105,115,116,114,121,205,2,0, 0,115,8,0,0,0,0,2,2,1,16,1,12,1,122,36, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105, @@ -1020,7 +1020,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, 104,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, - 114,121,214,2,0,0,115,24,0,0,0,0,2,6,1,8, + 114,121,212,2,0,0,115,24,0,0,0,0,2,6,1,8, 2,6,1,6,1,16,255,6,2,2,1,12,1,46,1,12, 1,8,1,122,38,87,105,110,100,111,119,115,82,101,103,105, 115,116,114,121,70,105,110,100,101,114,46,95,115,101,97,114, @@ -1042,7 +1042,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,6,116,97,114,103,101,116,114,199,0,0,0,114, 140,0,0,0,114,189,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,9,102, - 105,110,100,95,115,112,101,99,229,2,0,0,115,28,0,0, + 105,110,100,95,115,112,101,99,227,2,0,0,115,28,0,0, 0,0,2,10,1,8,1,4,1,2,1,12,1,12,1,8, 1,14,1,14,1,6,1,8,1,2,254,6,3,122,31,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, @@ -1061,7 +1061,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 2,114,203,0,0,0,114,140,0,0,0,169,4,114,193,0, 0,0,114,139,0,0,0,114,44,0,0,0,114,187,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,11,102,105,110,100,95,109,111,100,117,108,101,245,2,0, + 218,11,102,105,110,100,95,109,111,100,117,108,101,243,2,0, 0,115,8,0,0,0,0,7,12,1,8,1,6,2,122,33, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,102,105,110,100,95,109,111,100,117,108, @@ -1071,7 +1071,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,97,115,115,109,101,116,104,111,100,114,194,0,0,0,114, 200,0,0,0,114,203,0,0,0,114,206,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,191,0,0,0,195,2,0,0,115,28,0,0,0, + 0,0,114,191,0,0,0,193,2,0,0,115,28,0,0,0, 8,2,4,3,2,255,2,4,2,255,2,3,4,2,2,1, 10,6,2,1,10,14,2,1,12,15,2,1,114,191,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1107,7 +1107,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 139,0,0,0,114,96,0,0,0,90,13,102,105,108,101,110, 97,109,101,95,98,97,115,101,90,9,116,97,105,108,95,110, 97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,182,0,0,0,8,3,0,0,115,8,0,0,0, + 0,0,114,182,0,0,0,6,3,0,0,115,8,0,0,0, 0,3,18,1,16,1,14,1,122,24,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1118,7 +1118,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,46,78,114,5,0,0,0,169,2,114,118,0,0,0,114, 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,16,3,0,0,115,2,0,0,0,0,1,122,27,95, + 108,101,14,3,0,0,115,2,0,0,0,0,1,122,27,95, 76,111,97,100,101,114,66,97,115,105,99,115,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,5,0,0,0,67, @@ -1138,7 +1138,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 131,0,0,0,41,3,114,118,0,0,0,218,6,109,111,100, 117,108,101,114,164,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,11,101,120,101,99,95,109,111, - 100,117,108,101,19,3,0,0,115,12,0,0,0,0,2,12, + 100,117,108,101,17,3,0,0,115,12,0,0,0,0,2,12, 1,8,1,6,1,4,255,6,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1149,14 +1149,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,169,2,114,118,0,0,0,114,139,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,27,3, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,25,3, 0,0,115,2,0,0,0,0,2,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,125,0,0,0,114,124,0,0, 0,114,126,0,0,0,114,127,0,0,0,114,182,0,0,0, 114,212,0,0,0,114,217,0,0,0,114,220,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,208,0,0,0,3,3,0,0,115,10,0,0, + 0,0,0,114,208,0,0,0,1,3,0,0,115,10,0,0, 0,8,2,4,3,8,8,8,3,8,8,114,208,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,64,0,0,0,115,74,0,0,0,101,0, @@ -1181,7 +1181,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,32,32,78,41,1,114,50,0,0,0,169, 2,114,118,0,0,0,114,44,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,10,112,97,116,104, - 95,109,116,105,109,101,34,3,0,0,115,2,0,0,0,0, + 95,109,116,105,109,101,32,3,0,0,115,2,0,0,0,0, 6,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, @@ -1215,7 +1215,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,32,32,32,32,32,32,32,32,114,169,0,0,0, 41,1,114,223,0,0,0,114,222,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,42,3,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,40,3,0,0,115,2,0,0,0, 0,12,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0, @@ -1239,7 +1239,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,107,0,0,0,90,10,99,97,99,104,101,95,112,97,116, 104,114,26,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,15,95,99,97,99,104,101,95,98,121, - 116,101,99,111,100,101,56,3,0,0,115,2,0,0,0,0, + 116,101,99,111,100,101,54,3,0,0,115,2,0,0,0,0, 8,122,28,83,111,117,114,99,101,76,111,97,100,101,114,46, 95,99,97,99,104,101,95,98,121,116,101,99,111,100,101,99, 3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, @@ -1256,7 +1256,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,46,10,32,32,32,32,32,32,32,32,78,114,5,0,0, 0,41,3,114,118,0,0,0,114,44,0,0,0,114,26,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,225,0,0,0,66,3,0,0,115,2,0,0,0,0, + 0,114,225,0,0,0,64,3,0,0,115,2,0,0,0,0, 1,122,21,83,111,117,114,99,101,76,111,97,100,101,114,46, 115,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0, 0,0,0,0,0,5,0,0,0,10,0,0,0,67,0,0, @@ -1277,7 +1277,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,41,5,114,118,0,0,0,114,139,0,0,0,114,44,0, 0,0,114,174,0,0,0,218,3,101,120,99,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,10,103,101,116, - 95,115,111,117,114,99,101,73,3,0,0,115,20,0,0,0, + 95,115,111,117,114,99,101,71,3,0,0,115,20,0,0,0, 0,2,10,1,2,1,14,1,14,1,4,1,2,255,4,1, 2,255,24,2,122,23,83,111,117,114,99,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,114,104,0, @@ -1299,7 +1299,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,7,99,111,109,112,105,108,101,41,4,114,118,0,0,0, 114,26,0,0,0,114,44,0,0,0,114,230,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,14, - 115,111,117,114,99,101,95,116,111,95,99,111,100,101,83,3, + 115,111,117,114,99,101,95,116,111,95,99,111,100,101,81,3, 0,0,115,6,0,0,0,0,5,12,1,4,255,122,27,83, 111,117,114,99,101,76,111,97,100,101,114,46,115,111,117,114, 99,101,95,116,111,95,99,111,100,101,99,2,0,0,0,0, @@ -1376,7 +1376,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,26,0,0,0,114,151,0,0,0,114,2,0,0,0,90, 10,98,121,116,101,115,95,100,97,116,97,90,11,99,111,100, 101,95,111,98,106,101,99,116,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,213,0,0,0,91,3,0,0, + 0,0,114,8,0,0,0,114,213,0,0,0,89,3,0,0, 115,152,0,0,0,0,7,10,1,4,1,4,1,4,1,4, 1,4,1,2,1,12,1,12,1,12,2,2,1,14,1,12, 1,8,2,12,1,2,1,14,1,12,1,6,3,2,1,2, @@ -1393,7 +1393,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,226,0,0,0,114,225,0,0,0,114,229,0,0,0,114, 233,0,0,0,114,213,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,221,0, - 0,0,32,3,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,30,3,0,0,115,14,0,0,0,8,2,8,8,8, 14,8,10,8,7,8,10,14,8,114,221,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 0,0,0,0,0,0,0,115,124,0,0,0,101,0,90,1, @@ -1422,7 +1422,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,102,105,110,100,101,114,46,78,114,159,0, 0,0,41,3,114,118,0,0,0,114,139,0,0,0,114,44, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,209,0,0,0,181,3,0,0,115,4,0,0,0, + 0,0,114,209,0,0,0,179,3,0,0,115,4,0,0,0, 0,3,6,1,122,19,70,105,108,101,76,111,97,100,101,114, 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, @@ -1431,7 +1431,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,2,218,9,95,95,99,108,97,115,115,95, 95,114,131,0,0,0,169,2,114,118,0,0,0,90,5,111, 116,104,101,114,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,6,95,95,101,113,95,95,187,3,0,0,115, + 0,0,0,218,6,95,95,101,113,95,95,185,3,0,0,115, 6,0,0,0,0,1,12,1,10,255,122,17,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, @@ -1440,7 +1440,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,0,0,0,169,3,218,4,104,97,115,104,114,116,0,0, 0,114,44,0,0,0,169,1,114,118,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,218,8,95,95, - 104,97,115,104,95,95,191,3,0,0,115,2,0,0,0,0, + 104,97,115,104,95,95,189,3,0,0,115,2,0,0,0,0, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,115, @@ -1454,7 +1454,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5, 115,117,112,101,114,114,239,0,0,0,114,220,0,0,0,114, 219,0,0,0,169,1,114,241,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,220,0,0,0,194,3,0,0,115,2, + 114,8,0,0,0,114,220,0,0,0,192,3,0,0,115,2, 0,0,0,0,10,122,22,70,105,108,101,76,111,97,100,101, 114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1464,7 +1464,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,114, 48,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,179,0,0,0,206,3,0, + 0,0,0,114,8,0,0,0,114,179,0,0,0,204,3,0, 0,115,2,0,0,0,0,3,122,23,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,109, 101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1486,7 +1486,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,90,4,114,101,97,100,114,65,0,0,0,41,3,114, 118,0,0,0,114,44,0,0,0,114,68,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,227,0, - 0,0,211,3,0,0,115,10,0,0,0,0,2,14,1,16, + 0,0,209,3,0,0,115,10,0,0,0,0,2,14,1,16, 1,40,2,14,1,122,19,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,100,97,116,97,99,2,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1495,7 +1495,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,182,0,0,0,169,2,114,118,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, 0,218,19,103,101,116,95,114,101,115,111,117,114,99,101,95, - 114,101,97,100,101,114,222,3,0,0,115,6,0,0,0,0, + 114,101,97,100,101,114,220,3,0,0,115,6,0,0,0,0, 2,10,1,4,1,122,30,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,114,101,115,111,117,114,99,101,95,114, 101,97,100,101,114,99,2,0,0,0,0,0,0,0,0,0, @@ -1507,7 +1507,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,64,0,0,0,114,65,0,0,0,169,3,114,118,0, 0,0,90,8,114,101,115,111,117,114,99,101,114,44,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,228, + 218,13,111,112,101,110,95,114,101,115,111,117,114,99,101,226, 3,0,0,115,4,0,0,0,0,1,20,1,122,24,70,105, 108,101,76,111,97,100,101,114,46,111,112,101,110,95,114,101, 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0, @@ -1520,7 +1520,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,114,38,0,0,0,114,47,0,0,0,114,44, 0,0,0,114,255,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,13,114,101,115,111,117,114,99, - 101,95,112,97,116,104,232,3,0,0,115,8,0,0,0,0, + 101,95,112,97,116,104,230,3,0,0,115,8,0,0,0,0, 1,10,1,4,1,20,1,122,24,70,105,108,101,76,111,97, 100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,116, 104,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1532,7 +1532,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,44,0,0,0,114,54,0,0,0,169,3,114,118,0, 0,0,114,116,0,0,0,114,44,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,2,1,0,0, - 238,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, + 236,3,0,0,115,8,0,0,0,0,1,8,1,4,1,20, 1,122,22,70,105,108,101,76,111,97,100,101,114,46,105,115, 95,114,101,115,111,117,114,99,101,99,1,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,0, @@ -1542,7 +1542,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,7,108,105,115,116,100,105,114,114,47,0,0,0,114, 44,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,8,99,111,110,116,101,110, - 116,115,244,3,0,0,115,2,0,0,0,0,1,122,19,70, + 116,115,242,3,0,0,115,2,0,0,0,0,1,122,19,70, 105,108,101,76,111,97,100,101,114,46,99,111,110,116,101,110, 116,115,41,17,114,125,0,0,0,114,124,0,0,0,114,126, 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, @@ -1551,7 +1551,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,0,1,0,0,114,4,1,0,0,114,2,1,0,0,114, 8,1,0,0,90,13,95,95,99,108,97,115,115,99,101,108, 108,95,95,114,5,0,0,0,114,5,0,0,0,114,249,0, - 0,0,114,8,0,0,0,114,239,0,0,0,176,3,0,0, + 0,0,114,8,0,0,0,114,239,0,0,0,174,3,0,0, 115,30,0,0,0,8,2,4,3,8,6,8,4,8,3,2, 1,14,11,2,1,10,4,8,11,2,1,10,5,8,4,8, 6,8,6,114,239,0,0,0,99,0,0,0,0,0,0,0, @@ -1574,7 +1574,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 49,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, 115,116,95,115,105,122,101,41,3,114,118,0,0,0,114,44, 0,0,0,114,238,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,224,0,0,0,252,3,0,0, + 0,0,114,8,0,0,0,114,224,0,0,0,250,3,0,0, 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,0, @@ -1585,7 +1585,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 225,0,0,0,41,5,114,118,0,0,0,114,107,0,0,0, 114,106,0,0,0,114,26,0,0,0,114,52,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,226, - 0,0,0,1,4,0,0,115,4,0,0,0,0,2,8,1, + 0,0,0,255,3,0,0,115,4,0,0,0,0,2,8,1, 122,32,83,111,117,114,99,101,70,105,108,101,76,111,97,100, 101,114,46,95,99,97,99,104,101,95,98,121,116,101,99,111, 100,101,114,60,0,0,0,114,11,1,0,0,99,3,0,0, @@ -1620,7 +1620,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,0,0,218,6,112,97,114,101,110,116,114,96,0,0,0, 114,37,0,0,0,114,33,0,0,0,114,228,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,225, - 0,0,0,6,4,0,0,115,46,0,0,0,0,2,12,1, + 0,0,0,4,4,0,0,115,46,0,0,0,0,2,12,1, 4,2,12,1,12,1,12,2,12,1,10,1,2,1,14,1, 12,2,8,1,14,3,6,1,4,255,4,2,28,1,2,1, 12,1,16,1,16,2,8,1,2,255,122,25,83,111,117,114, @@ -1629,7 +1629,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,126,0,0,0,114,127,0,0,0,114,224,0,0, 0,114,226,0,0,0,114,225,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 9,1,0,0,248,3,0,0,115,8,0,0,0,8,2,4, + 9,1,0,0,246,3,0,0,115,8,0,0,0,8,2,4, 2,8,5,8,5,114,9,1,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, @@ -1651,7 +1651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,235,0,0,0,41,5,114,118,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,26,0,0,0,114,151,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 213,0,0,0,41,4,0,0,115,22,0,0,0,0,1,10, + 213,0,0,0,39,4,0,0,115,22,0,0,0,0,1,10, 1,10,4,2,1,2,254,6,4,12,1,2,1,14,1,2, 1,2,253,122,29,83,111,117,114,99,101,108,101,115,115,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, @@ -1661,14 +1661,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,110,101,32,97,115,32,116,104,101,114,101,32,105,115,32, 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, 114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,229,0,0,0,57,4, + 5,0,0,0,114,8,0,0,0,114,229,0,0,0,55,4, 0,0,115,2,0,0,0,0,2,122,31,83,111,117,114,99, 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,78,41,6,114,125,0, 0,0,114,124,0,0,0,114,126,0,0,0,114,127,0,0, 0,114,213,0,0,0,114,229,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 15,1,0,0,37,4,0,0,115,6,0,0,0,8,2,4, + 15,1,0,0,35,4,0,0,115,6,0,0,0,8,2,4, 2,8,16,114,15,1,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, 0,115,92,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1688,7 +1688,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,16,0,0,0,124,1,124,0,95,0,124,2,124,0, 95,1,100,0,83,0,114,109,0,0,0,114,159,0,0,0, 114,5,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,74,4,0,0,115,4,0, + 8,0,0,0,114,209,0,0,0,72,4,0,0,115,4,0, 0,0,0,1,6,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1696,7 +1696,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,124,0,106,0,124,1,106,0,107,2,111,22,124,0, 106,1,124,1,106,1,107,2,83,0,114,109,0,0,0,114, 240,0,0,0,114,242,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,243,0,0,0,78,4,0, + 0,0,0,114,8,0,0,0,114,243,0,0,0,76,4,0, 0,115,6,0,0,0,0,1,12,1,10,255,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1704,7 +1704,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,115,20,0,0,0,116,0,124,0,106,1,131,1,116,0, 124,0,106,2,131,1,65,0,83,0,114,109,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,247,0,0,0,82,4,0, + 0,0,0,114,8,0,0,0,114,247,0,0,0,80,4,0, 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,0, @@ -1721,7 +1721,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,116,101,95,100,121,110,97,109,105,99,114,149,0,0,0, 114,116,0,0,0,114,44,0,0,0,41,3,114,118,0,0, 0,114,187,0,0,0,114,216,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,85, + 114,5,0,0,0,114,8,0,0,0,114,212,0,0,0,83, 4,0,0,115,14,0,0,0,0,2,4,1,6,255,4,2, 6,1,8,255,4,2,122,33,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,97, @@ -1738,7 +1738,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 214,0,0,0,114,163,0,0,0,90,12,101,120,101,99,95, 100,121,110,97,109,105,99,114,149,0,0,0,114,116,0,0, 0,114,44,0,0,0,114,253,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,93, + 114,5,0,0,0,114,8,0,0,0,114,217,0,0,0,91, 4,0,0,115,8,0,0,0,0,2,14,1,6,1,8,255, 122,31,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, @@ -1757,7 +1757,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,169,2,114,32,0,0,0,218,6,115,117,102,102,105, 120,169,1,90,9,102,105,108,101,95,110,97,109,101,114,5, 0,0,0,114,8,0,0,0,218,9,60,103,101,110,101,120, - 112,114,62,102,4,0,0,115,4,0,0,0,4,1,2,255, + 112,114,62,100,4,0,0,115,4,0,0,0,4,1,2,255, 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, @@ -1765,7 +1765,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, 83,85,70,70,73,88,69,83,114,219,0,0,0,114,5,0, 0,0,114,18,1,0,0,114,8,0,0,0,114,182,0,0, - 0,99,4,0,0,115,8,0,0,0,0,2,14,1,12,1, + 0,97,4,0,0,115,8,0,0,0,0,2,14,1,12,1, 2,255,122,30,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1776,7 +1776,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,32,99,114,101,97,116,101,32,97,32,99,111,100,101,32, 111,98,106,101,99,116,46,78,114,5,0,0,0,114,219,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,213,0,0,0,105,4,0,0,115,2,0,0,0,0, + 0,114,213,0,0,0,103,4,0,0,115,2,0,0,0,0, 2,122,28,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1786,14 +1786,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,117,108,101,115,32,104,97,118,101,32,110,111,32,115,111, 117,114,99,101,32,99,111,100,101,46,78,114,5,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,229,0,0,0,109,4,0,0,115,2,0, + 8,0,0,0,114,229,0,0,0,107,4,0,0,115,2,0, 0,0,0,2,122,30,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, 117,114,99,101,99,2,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,6,0, 0,0,124,0,106,0,83,0,114,250,0,0,0,114,48,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,179,0,0,0,113,4,0,0,115, + 0,114,8,0,0,0,114,179,0,0,0,111,4,0,0,115, 2,0,0,0,0,3,122,32,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 102,105,108,101,110,97,109,101,78,41,14,114,125,0,0,0, @@ -1802,7 +1802,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,217,0,0,0,114,182,0,0,0,114,213,0, 0,0,114,229,0,0,0,114,136,0,0,0,114,179,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,252,0,0,0,66,4,0,0,115,22, + 114,8,0,0,0,114,252,0,0,0,64,4,0,0,115,22, 0,0,0,8,2,4,6,8,4,8,4,8,3,8,8,8, 6,8,6,8,4,8,4,2,1,114,252,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1845,7 +1845,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 169,4,114,118,0,0,0,114,116,0,0,0,114,44,0,0, 0,90,11,112,97,116,104,95,102,105,110,100,101,114,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,209,0, - 0,0,126,4,0,0,115,8,0,0,0,0,1,6,1,6, + 0,0,124,4,0,0,115,8,0,0,0,0,1,6,1,6, 1,14,1,122,23,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0, @@ -1862,7 +1862,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,14,1,0,0,218,3,100,111,116,90, 2,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,23,95,102,105,110,100,95,112,97,114,101,110,116, - 95,112,97,116,104,95,110,97,109,101,115,132,4,0,0,115, + 95,112,97,116,104,95,110,97,109,101,115,130,4,0,0,115, 8,0,0,0,0,2,18,1,8,2,4,3,122,38,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,102,105, 110,100,95,112,97,114,101,110,116,95,112,97,116,104,95,110, @@ -1875,7 +1875,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 118,0,0,0,90,18,112,97,114,101,110,116,95,109,111,100, 117,108,101,95,110,97,109,101,90,14,112,97,116,104,95,97, 116,116,114,95,110,97,109,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,25,1,0,0,142,4,0,0, + 0,0,114,8,0,0,0,114,25,1,0,0,140,4,0,0, 115,4,0,0,0,0,1,12,1,122,31,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,103,101,116,95,112, 97,114,101,110,116,95,112,97,116,104,99,1,0,0,0,0, @@ -1891,7 +1891,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,24,1,0,0,41,3,114,118,0,0,0,90,11, 112,97,114,101,110,116,95,112,97,116,104,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,114,101,99,97,108,99,117,108,97,116,101,146,4,0, + 12,95,114,101,99,97,108,99,117,108,97,116,101,144,4,0, 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, @@ -1900,7 +1900,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,6,1,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,8,95,95,105,116,101,114,95,95,159,4,0,0, + 0,0,218,8,95,95,105,116,101,114,95,95,157,4,0,0, 115,2,0,0,0,0,1,122,23,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,105,116,101,114,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1909,7 +1909,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,114,32,1,0,0,41,2,114,118,0,0,0,218,5,105, 110,100,101,120,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,95,95,103,101,116,105,116,101,109,95,95, - 162,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, + 160,4,0,0,115,2,0,0,0,0,1,122,26,95,78,97, 109,101,115,112,97,99,101,80,97,116,104,46,95,95,103,101, 116,105,116,101,109,95,95,99,3,0,0,0,0,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1917,7 +1917,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,83,0,114,109,0,0,0,41,1,114,24,1,0,0,41, 3,114,118,0,0,0,114,35,1,0,0,114,44,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,165,4,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,163,4,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, @@ -1925,7 +1925,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, 0,0,41,2,114,23,0,0,0,114,32,1,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,7,95,95,108,101,110,95,95,168,4,0,0,115, + 0,0,218,7,95,95,108,101,110,95,95,166,4,0,0,115, 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, @@ -1934,7 +1934,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125, 41,41,2,114,62,0,0,0,114,24,1,0,0,114,246,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,8,95,95,114,101,112,114,95,95,171,4,0,0,115, + 0,218,8,95,95,114,101,112,114,95,95,169,4,0,0,115, 2,0,0,0,0,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,114,101,112,114,95,95,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1942,7 +1942,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,160,0,161,0,118,0,83,0,114,109,0,0,0,114,34, 1,0,0,169,2,114,118,0,0,0,218,4,105,116,101,109, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 12,95,95,99,111,110,116,97,105,110,115,95,95,174,4,0, + 12,95,95,99,111,110,116,97,105,110,115,95,95,172,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,99,111,110,116,97, 105,110,115,95,95,99,2,0,0,0,0,0,0,0,0,0, @@ -1950,7 +1950,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,124,0,106,0,160,1,124,1,161,1,1,0,100, 0,83,0,114,109,0,0,0,41,2,114,24,1,0,0,114, 186,0,0,0,114,40,1,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,186,0,0,0,177,4,0, + 0,0,0,114,8,0,0,0,114,186,0,0,0,175,4,0, 0,115,2,0,0,0,0,1,122,21,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,97,112,112,101,110,100,78, 41,15,114,125,0,0,0,114,124,0,0,0,114,126,0,0, @@ -1959,7 +1959,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 36,1,0,0,114,37,1,0,0,114,38,1,0,0,114,39, 1,0,0,114,42,1,0,0,114,186,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,22,1,0,0,119,4,0,0,115,24,0,0,0,8, + 0,114,22,1,0,0,117,4,0,0,115,24,0,0,0,8, 1,4,6,8,6,8,10,8,4,8,13,8,3,8,3,8, 3,8,3,8,3,8,3,114,22,1,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, @@ -1975,7 +1975,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,2,124,3,131,3,124,0,95,1,100,0,83,0,114,109, 0,0,0,41,2,114,22,1,0,0,114,24,1,0,0,114, 28,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,209,0,0,0,183,4,0,0,115,2,0,0, + 0,0,0,114,209,0,0,0,181,4,0,0,115,2,0,0, 0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, @@ -1992,21 +1992,21 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,109,101,115,112,97,99,101,41,62,41,2,114,62,0,0, 0,114,125,0,0,0,41,2,114,193,0,0,0,114,216,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,109,111,100,117,108,101,95,114,101,112,114,186,4, + 0,218,11,109,111,100,117,108,101,95,114,101,112,114,184,4, 0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117, 108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, 115,4,0,0,0,100,1,83,0,41,2,78,84,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,182,0,0,0,195,4,0,0,115, + 0,114,8,0,0,0,114,182,0,0,0,193,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, 97,103,101,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, 0,100,1,83,0,41,2,78,114,40,0,0,0,114,5,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,229,0,0,0,198,4,0,0,115, + 0,114,8,0,0,0,114,229,0,0,0,196,4,0,0,115, 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2016,20 +2016,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,103,62,114,215,0,0,0,84,41,1,114,231,0,0,0, 41,1,114,232,0,0,0,114,219,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,213,0,0,0, - 201,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, + 199,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97, 109,101,115,112,97,99,101,76,111,97,100,101,114,46,103,101, 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,114,210,0,0,0,114,5,0, 0,0,114,211,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,212,0,0,0,204,4,0,0,115, + 0,114,8,0,0,0,114,212,0,0,0,202,4,0,0,115, 2,0,0,0,0,1,122,30,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,99,114,101,97,116,101,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,0,83,0,114,109,0,0,0,114,5,0, 0,0,114,253,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,217,0,0,0,207,4,0,0,115, + 0,114,8,0,0,0,114,217,0,0,0,205,4,0,0,115, 2,0,0,0,0,1,122,28,95,78,97,109,101,115,112,97, 99,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2047,7 +2047,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,112,97,116,104,32,123,33,114,125,41,4,114,134,0,0, 0,114,149,0,0,0,114,24,1,0,0,114,218,0,0,0, 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,220,0,0,0,210,4,0,0,115,8,0, + 8,0,0,0,114,220,0,0,0,208,4,0,0,115,8,0, 0,0,0,7,6,1,4,255,4,2,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,108,111,97, 100,95,109,111,100,117,108,101,78,41,12,114,125,0,0,0, @@ -2056,7 +2056,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,213,0,0,0,114,212,0,0,0,114,217,0, 0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,43,1,0,0, - 182,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, + 180,4,0,0,115,18,0,0,0,8,1,8,3,2,1,10, 8,8,3,8,3,8,3,8,3,8,3,114,43,1,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,4,0,0,0,64,0,0,0,115,118,0,0,0,101,0, @@ -2093,7 +2093,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,46,1,0,0,41,3,114,193,0,0,0,114, 116,0,0,0,218,6,102,105,110,100,101,114,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,46,1,0,0, - 228,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, + 226,4,0,0,115,10,0,0,0,0,4,22,1,8,1,10, 1,10,1,122,28,80,97,116,104,70,105,110,100,101,114,46, 105,110,118,97,108,105,100,97,116,101,95,99,97,99,104,101, 115,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -2113,7 +2113,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,0,0,0,41,3,114,193,0,0,0,114,44,0,0,0, 90,4,104,111,111,107,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,238,4,0,0,115,16,0,0,0,0,3,16,1,12, + 107,115,236,4,0,0,115,16,0,0,0,0,3,16,1,12, 1,10,1,2,1,14,1,12,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2144,7 +2144,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,44,0,0,0,114,50,1,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,20,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,251,4,0,0,115,22,0,0,0,0,8,8,1,2,1, + 101,249,4,0,0,115,22,0,0,0,0,8,8,1,2,1, 12,1,12,3,8,1,2,1,14,1,12,1,10,1,16,1, 122,31,80,97,116,104,70,105,110,100,101,114,46,95,112,97, 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, @@ -2161,7 +2161,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,193,0,0,0,114,139,0,0,0,114,50,1,0,0,114, 140,0,0,0,114,141,0,0,0,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,16,95, - 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,17, + 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,15, 5,0,0,115,18,0,0,0,0,4,10,1,16,2,10,1, 4,1,8,1,12,1,12,1,6,1,122,27,80,97,116,104, 70,105,110,100,101,114,46,95,108,101,103,97,99,121,95,103, @@ -2193,7 +2193,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,112,97,116,104,90,5,101,110,116,114,121,114,50,1,0, 0,114,187,0,0,0,114,141,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,9,95,103,101,116, - 95,115,112,101,99,32,5,0,0,115,40,0,0,0,0,5, + 95,115,112,101,99,30,5,0,0,115,40,0,0,0,0,5, 4,1,8,1,14,1,2,1,10,1,8,1,10,1,14,2, 12,1,8,1,2,1,10,1,8,1,6,1,8,1,8,5, 12,2,12,1,6,1,122,20,80,97,116,104,70,105,110,100, @@ -2220,7 +2220,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,22,1,0,0,41,6,114,193,0,0,0,114,139,0,0, 0,114,44,0,0,0,114,202,0,0,0,114,187,0,0,0, 114,57,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,203,0,0,0,64,5,0,0,115,26,0, + 8,0,0,0,114,203,0,0,0,62,5,0,0,115,26,0, 0,0,0,6,8,1,6,1,14,1,8,1,4,1,10,1, 6,1,4,3,6,1,16,1,4,2,6,2,122,20,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,115,112, @@ -2240,7 +2240,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, 100,46,10,10,32,32,32,32,32,32,32,32,78,114,204,0, 0,0,114,205,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,206,0,0,0,88,5,0,0,115, + 0,114,8,0,0,0,114,206,0,0,0,86,5,0,0,115, 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, @@ -2272,7 +2272,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,95,100,105,115,116,114,105,98,117,116,105,111,110,115,41, 4,114,193,0,0,0,114,119,0,0,0,114,120,0,0,0, 114,59,1,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,60,1,0,0,101,5,0,0,115,4,0, + 8,0,0,0,114,60,1,0,0,99,5,0,0,115,4,0, 0,0,0,10,12,1,122,29,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,100,105,115,116,114,105,98,117, 116,105,111,110,115,41,1,78,41,2,78,78,41,1,78,41, @@ -2281,7 +2281,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 52,1,0,0,114,54,1,0,0,114,55,1,0,0,114,58, 1,0,0,114,203,0,0,0,114,206,0,0,0,114,60,1, 0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,45,1,0,0,224,4,0,0,115, + 0,114,8,0,0,0,114,45,1,0,0,222,4,0,0,115, 34,0,0,0,8,2,4,2,2,1,10,9,2,1,10,12, 2,1,10,21,2,1,10,14,2,1,12,31,2,1,12,23, 2,1,12,12,2,1,114,45,1,0,0,99,0,0,0,0, @@ -2326,7 +2326,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 14,125,1,124,1,136,0,102,2,86,0,1,0,113,2,100, 0,83,0,114,109,0,0,0,114,5,0,0,0,114,16,1, 0,0,169,1,114,140,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,19,1,0,0,130,5,0,0,243,0,0,0, + 0,0,0,114,19,1,0,0,128,5,0,0,243,0,0,0, 0,122,38,70,105,108,101,70,105,110,100,101,114,46,95,95, 105,110,105,116,95,95,46,60,108,111,99,97,108,115,62,46, 60,103,101,110,101,120,112,114,62,114,71,0,0,0,114,104, @@ -2338,7 +2338,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,44,0,0,0,218,14,108,111,97,100, 101,114,95,100,101,116,97,105,108,115,90,7,108,111,97,100, 101,114,115,114,189,0,0,0,114,5,0,0,0,114,62,1, - 0,0,114,8,0,0,0,114,209,0,0,0,124,5,0,0, + 0,0,114,8,0,0,0,114,209,0,0,0,122,5,0,0, 115,16,0,0,0,0,4,4,1,12,1,26,1,6,2,10, 1,6,1,8,1,122,19,70,105,108,101,70,105,110,100,101, 114,46,95,95,105,110,105,116,95,95,99,1,0,0,0,0, @@ -2348,7 +2348,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, 116,105,109,101,46,114,104,0,0,0,78,41,1,114,65,1, 0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,46,1,0,0,138,5,0,0,115, + 0,114,8,0,0,0,114,46,1,0,0,136,5,0,0,115, 2,0,0,0,0,2,122,28,70,105,108,101,70,105,110,100, 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, 99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,0, @@ -2371,7 +2371,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,78,41,3,114,203,0,0,0,114,140,0, 0,0,114,178,0,0,0,41,3,114,118,0,0,0,114,139, 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,137,0,0,0,144,5,0,0, + 0,0,114,8,0,0,0,114,137,0,0,0,142,5,0,0, 115,8,0,0,0,0,7,10,1,8,1,8,1,122,22,70, 105,108,101,70,105,110,100,101,114,46,102,105,110,100,95,108, 111,97,100,101,114,99,6,0,0,0,0,0,0,0,0,0, @@ -2382,7 +2382,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,188,0,0,0,114,139,0,0,0,114,44,0, 0,0,90,4,115,109,115,108,114,202,0,0,0,114,140,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,58,1,0,0,156,5,0,0,115,8,0,0,0,0, + 0,114,58,1,0,0,154,5,0,0,115,8,0,0,0,0, 1,10,1,8,1,2,255,122,20,70,105,108,101,70,105,110, 100,101,114,46,95,103,101,116,95,115,112,101,99,78,99,3, 0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,8, @@ -2436,7 +2436,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,17,1,0,0,114,188,0,0,0,90,13,105,110,105, 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, 95,112,97,116,104,114,187,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,203,0,0,0,161,5, + 5,0,0,0,114,8,0,0,0,114,203,0,0,0,159,5, 0,0,115,72,0,0,0,0,5,4,1,14,1,2,1,24, 1,12,1,10,1,10,1,8,1,6,2,6,1,6,1,10, 2,6,1,4,2,8,1,12,1,14,1,8,1,10,1,8, @@ -2468,7 +2468,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 161,0,146,2,113,4,83,0,114,5,0,0,0,41,1,114, 105,0,0,0,41,2,114,32,0,0,0,90,2,102,110,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,9, - 60,115,101,116,99,111,109,112,62,238,5,0,0,114,63,1, + 60,115,101,116,99,111,109,112,62,236,5,0,0,114,63,1, 0,0,122,41,70,105,108,101,70,105,110,100,101,114,46,95, 102,105,108,108,95,99,97,99,104,101,46,60,108,111,99,97, 108,115,62,46,60,115,101,116,99,111,109,112,62,78,41,18, @@ -2484,7 +2484,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 102,102,105,120,95,99,111,110,116,101,110,116,115,114,41,1, 0,0,114,116,0,0,0,114,29,1,0,0,114,17,1,0, 0,90,8,110,101,119,95,110,97,109,101,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,209, + 114,5,0,0,0,114,8,0,0,0,114,70,1,0,0,207, 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, 18,3,10,3,12,1,12,7,6,1,8,1,16,1,4,1, 18,2,4,1,12,1,6,1,12,1,122,22,70,105,108,101, @@ -2523,14 +2523,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,48,0,0,0,169,2,114,193,0,0,0,114,69,1, 0,0,114,5,0,0,0,114,8,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,250,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,248,5,0,0,115,6,0,0,0,0, 2,8,1,12,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, 111,114,95,70,105,108,101,70,105,110,100,101,114,114,5,0, 0,0,41,3,114,193,0,0,0,114,69,1,0,0,114,76, 1,0,0,114,5,0,0,0,114,75,1,0,0,114,8,0, - 0,0,218,9,112,97,116,104,95,104,111,111,107,240,5,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,238,5,0, 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -2539,7 +2539,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41, 2,114,62,0,0,0,114,44,0,0,0,114,246,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 39,1,0,0,2,6,0,0,115,2,0,0,0,0,1,122, + 39,1,0,0,0,6,0,0,115,2,0,0,0,0,1,122, 19,70,105,108,101,70,105,110,100,101,114,46,95,95,114,101, 112,114,95,95,41,1,78,41,15,114,125,0,0,0,114,124, 0,0,0,114,126,0,0,0,114,127,0,0,0,114,209,0, @@ -2547,7 +2547,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,137,0,0,0,114,58,1,0,0,114,203,0,0,0, 114,70,1,0,0,114,207,0,0,0,114,77,1,0,0,114, 39,1,0,0,114,5,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,61,1,0,0,115,5,0, + 0,0,0,114,8,0,0,0,114,61,1,0,0,113,5,0, 0,115,22,0,0,0,8,2,4,7,8,14,8,4,4,2, 8,12,8,5,10,48,8,31,2,1,10,17,114,61,1,0, 0,99,4,0,0,0,0,0,0,0,0,0,0,0,6,0, @@ -2571,7 +2571,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,112,97,116,104,110,97,109,101,114,140,0,0,0,114,187, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,8,6,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,6,6,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,14, 1,2,1,8,1,8,1,8,1,12,1,12,2,114,82,1, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, @@ -2591,7 +2591,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 10,101,120,116,101,110,115,105,111,110,115,90,6,115,111,117, 114,99,101,90,8,98,121,116,101,99,111,100,101,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,184,0,0, - 0,31,6,0,0,115,8,0,0,0,0,5,12,1,8,1, + 0,29,6,0,0,115,8,0,0,0,0,5,12,1,8,1, 8,1,114,184,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,10,0,0,0,9,0,0,0,67,0,0,0, 115,132,1,0,0,124,0,97,0,116,0,106,1,97,1,116, @@ -2639,7 +2639,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,83,0,41,2,114,39,0,0,0,78,41,1,114,23,0, 0,0,41,2,114,32,0,0,0,114,94,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,19,1, - 0,0,60,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,58,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,73,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2651,7 +2651,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 157,2,146,2,113,4,83,0,41,1,114,74,0,0,0,114, 5,0,0,0,41,2,114,32,0,0,0,218,1,115,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,71,1, - 0,0,77,6,0,0,114,63,1,0,0,122,25,95,115,101, + 0,0,75,6,0,0,114,63,1,0,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,115,101, 116,99,111,109,112,62,41,3,114,64,0,0,0,114,75,0, 0,0,114,160,0,0,0,114,192,0,0,0,114,9,0,0, @@ -2671,7 +2671,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,116,105,110,95,110,97,109,101,115,90,12,98,117,105,108, 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, 110,95,109,111,100,117,108,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,42, + 0,0,114,8,0,0,0,218,6,95,115,101,116,117,112,40, 6,0,0,115,70,0,0,0,0,8,4,1,6,1,6,2, 10,3,22,1,12,2,22,1,8,1,10,1,10,1,6,2, 2,1,10,1,10,1,12,1,12,2,8,2,12,1,12,1, @@ -2691,7 +2691,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 104,114,186,0,0,0,114,45,1,0,0,41,2,114,88,1, 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, 97,100,101,114,115,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,105,110,115,116,97,108,108,99,6, + 8,0,0,0,218,8,95,105,110,115,116,97,108,108,97,6, 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, 91,1,0,0,41,1,114,60,0,0,0,41,1,78,41,3, 78,78,78,41,2,114,73,0,0,0,114,73,0,0,0,41, @@ -2725,7 +2725,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,8,60,109,111,100,117,108,101,62,1,0,0,0,115,126, 0,0,0,4,22,4,1,4,1,2,1,2,255,4,4,8, 17,8,5,8,5,8,6,8,6,8,12,8,10,8,9,8, - 5,8,7,8,9,10,22,10,127,0,23,16,1,12,2,4, + 5,8,7,8,9,10,22,10,127,0,21,16,1,12,2,4, 1,4,2,6,2,6,2,8,2,16,71,8,40,8,19,8, 12,8,12,8,28,8,17,8,33,8,28,8,24,10,13,10, 10,10,11,8,14,6,3,4,1,2,255,12,68,14,64,14, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 09a0c12e5f9c4f..955fa3bf1668c7 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -165,9 +165,9 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&TARGET_MATCH_SEQ_TYPE, - &&TARGET_MATCH_MAP_TYPE, - &&_unknown_opcode, + &&TARGET_MATCH_SEQ, + &&TARGET_MATCH_MAP, + &&TARGET_MATCH_KEY, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 297ceb2b8a625dfbefe570e110efa574f28fbb30 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 22:13:39 -0700 Subject: [PATCH 033/218] Add a bunch of mapping tests, plus cleanup --- Lib/test/test_patma.py | 160 +++++++++++++++++++++++++++++++++++++---- Python/ast.c | 2 +- 2 files changed, 146 insertions(+), 16 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index a3398b8fc444f6..3fcb430f48f513 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -265,49 +265,49 @@ def test_pipe_07(self) -> None: self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_iter_00(self) -> None: + def test_sequence_00(self) -> None: match_cases = [MatchCase("()", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_iter_01(self) -> None: + def test_sequence_01(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_iter_02(self) -> None: + def test_sequence_02(self) -> None: match_cases = [MatchCase("[0]", "y = 0")] namespace = self.execute_match("x = (0,)", "x", match_cases, "") self.assertEqual(namespace.get("x"), (0,)) self.assertEqual(namespace.get("y"), 0) - def test_iter_03(self) -> None: + def test_sequence_03(self) -> None: match_cases = [MatchCase("[[]]", "y = 0")] namespace = self.execute_match("x = ((),)", "x", match_cases, "") self.assertEqual(namespace.get("x"), ((),)) self.assertEqual(namespace.get("y"), 0) - def test_iter_04(self) -> None: + def test_sequence_04(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 1]) self.assertEqual(namespace.get("y"), 0) - def test_iter_05(self) -> None: + def test_sequence_05(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [1, 0]) self.assertEqual(namespace.get("y"), 0) - def test_iter_06(self) -> None: + def test_sequence_06(self) -> None: match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 0]) self.assertNotIn("y", namespace) - def test_iter_07(self) -> None: + def test_sequence_07(self) -> None: match_cases = [ MatchCase("(w := 0,)", "y = 0"), MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1"), @@ -318,7 +318,7 @@ def test_iter_07(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) - def test_iter_08(self) -> None: + def test_sequence_08(self) -> None: match_cases = [ MatchCase("(0,)", "y = 0"), MatchCase("(1, 0)", "y = 1", "(x := x[:0])"), @@ -328,31 +328,31 @@ def test_iter_08(self) -> None: self.assertEqual(namespace.get("x"), []) self.assertEqual(namespace.get("y"), 2) - def test_iter_09(self) -> None: + def test_sequence_09(self) -> None: match_cases = [MatchCase("[0]", "y = 0")] namespace = self.execute_match("x = {0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0}) self.assertNotIn("y", namespace) - def test_iter_10(self) -> None: + def test_sequence_10(self) -> None: match_cases = [MatchCase("()", "y = 0")] namespace = self.execute_match("x = set()", "x", match_cases, "") self.assertEqual(namespace.get("x"), set()) self.assertNotIn("y", namespace) - def test_iter_11(self) -> None: + def test_sequence_11(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = iter([1,2,3])", "x", match_cases, "") self.assertEqual(list(namespace.get("x")), [1, 2, 3]) self.assertNotIn("y", namespace) - def test_iter_12(self) -> None: + def test_sequence_12(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = {}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {}) self.assertNotIn("y", namespace) - def test_iter_13(self) -> None: + def test_sequence_13(self) -> None: match_cases = [MatchCase("(0, 1)", "y = 0")] namespace = self.execute_match("x = {0: False, 1: True}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: False, 1: True}) @@ -411,9 +411,139 @@ def test_string_05(self) -> None: self.assertEqual(namespace.get("x"), b"xxx") self.assertEqual(namespace.get("y"), 2) + def test_mapping_00(self) -> None: + match_cases = [MatchCase("{}", "y = 0")] + namespace = self.execute_match("x = {}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {}) + self.assertEqual(namespace.get("y"), 0) + + def test_mapping_01(self) -> None: + match_cases = [MatchCase("{}", "y = 0")] + namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 0}) + self.assertEqual(namespace.get("y"), 0) + + def test_mapping_02(self) -> None: + match_cases = [MatchCase("{0: 0}", "y = 0")] + namespace = self.execute_match("x = {}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {}) + self.assertNotIn("y", namespace) + + def test_mapping_03(self) -> None: + match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 0}) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 0) + + def test_mapping_04(self) -> None: + match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + namespace = self.execute_match("x = {0: 1}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 1}) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 1) + + def test_mapping_05(self) -> None: + match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + namespace = self.execute_match("x = {0: 2}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 2}) + self.assertEqual(namespace.get("y"), 0) + self.assertEqual(namespace.get("z"), 2) + + def test_mapping_06(self) -> None: + match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + namespace = self.execute_match("x = {0: 3}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 3}) + self.assertNotIn("y", namespace) + self.assertNotIn("z", namespace) + + def test_mapping_07(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match("x = {}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {}) + self.assertNotIn("y", namespace) + + def test_mapping_08(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match( + "x = {False: (True, 2.0, {})}", "x", match_cases, "" + ) + self.assertEqual(namespace.get("x"), {False: (True, 2.0, {})}) + self.assertEqual(namespace.get("y"), 0) + + def test_mapping_09(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match( + "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" + ) + self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) + self.assertEqual(namespace.get("y"), 0) + + def test_mapping_10(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2]}", "y = 0"), + MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match( + "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" + ) + self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) + self.assertEqual(namespace.get("y"), 1) + + def test_mapping_11(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match("x = []", "x", match_cases, "") + self.assertEqual(namespace.get("x"), []) + self.assertEqual(namespace.get("y"), 2) + + def test_mapping_12(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase( + "{0: [1, 2, {}] | False} | {1: [()]} | {0: [1, 2, {}]} | [] | 'X' | {}", + "y = 1", + ), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 0}) + self.assertEqual(namespace.get("y"), 1) + + def test_mapping_13(self) -> None: + match_cases = [ + MatchCase("{0: [1, 2, {}]}", "y = 0"), + MatchCase( + "{0: [1, 2, {}] | True} | {1: [()]} | {0: [1, 2, {}]} | [] | 'X' | {}", + "y = 1", + ), + MatchCase("()", "y = 2"), + ] + namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") + self.assertEqual(namespace.get("x"), {0: 0}) + self.assertEqual(namespace.get("y"), 1) + if __name__ == "__main__": # XXX: For quick test debugging... import dis - match_cases = [MatchCase("([0, 1]) | (1 | (z := 2), 0, q, [[[]]])", "pass")] + match_cases = [ + MatchCase("([0, 1]) | {'XXX': (1 | (z := 2))} | (0, q, [[[{}]]])", "pass") + ] dis.dis(TestAST.compile_match("", "x", match_cases, "")) diff --git a/Python/ast.c b/Python/ast.c index 9d4df2a41f9a31..7d06aeed048c9d 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -351,7 +351,7 @@ validate_pattern(expr_ty p) return 0; } } - return 0; + return 1; case List_kind: case Tuple_kind: // TODO: Undecided yet if tuple syntax is legal. values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; From 1902b2143937534aa29649ce154f7194a5f14f81 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 28 May 2020 23:37:22 -0700 Subject: [PATCH 034/218] Reorganize pattern compiler --- Python/compile.c | 325 ++++++++++++++++++++++++----------------------- 1 file changed, 165 insertions(+), 160 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 510ff8346a162b..8048301f27f3e4 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -222,6 +222,8 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); +static int compiler_pattern(struct compiler *, expr_ty, basicblock *); + static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -1550,6 +1552,11 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b, int absolute) } \ } +#define CHECK(X) \ + if (!(X)) { \ + return 0; \ + } + /* These macros allows to check only for errors and not emmit bytecode * while visiting nodes. */ @@ -2751,180 +2758,179 @@ compiler_if(struct compiler *c, stmt_ty s) } static int -pattern_store_helper(struct compiler *c, expr_ty p) -{ +compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) +{ + assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); + assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); + assert(p->kind != Name_kind || p->v.Name.ctx == Load); + VISIT(c, expr, p); + ADDOP_COMPARE(c, Eq); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, fail); + return 1; +} + +static int +compiler_pattern_store(struct compiler *c, expr_ty p) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { ADDOP(c, POP_TOP); + return 1; + } + VISIT(c, expr, p); + return 1; +} + +static int +compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail) +{ + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Load || p->v.Name.ctx == Store); + if (p->v.Name.ctx == Load) { + return compiler_pattern_load(c, p, fail); + } + return compiler_pattern_store(c, p); +} + +static int +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) +{ + assert(p->kind == NamedExpr_kind); + basicblock *block = compiler_new_block(c); + basicblock *end = compiler_new_block(c); + ADDOP(c, DUP_TOP); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, block)); + CHECK(compiler_pattern_store(c, p->v.NamedExpr.target)); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); + return 1; +} + +static int +compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) +{ + basicblock *block = compiler_new_block(c); + basicblock *end = compiler_new_block(c); + asdl_seq *keys = p->v.Dict.keys; + asdl_seq *values = p->v.Dict.values; + Py_ssize_t size = asdl_seq_LEN(values); + int star = size ? !asdl_seq_GET(keys, size - 1) : 0; + ADDOP_JREL(c, MATCH_MAP, fail); + for (Py_ssize_t i = 0; i < size - star; i++) { + expr_ty key = asdl_seq_GET(keys, i); + expr_ty value = asdl_seq_GET(values, i); + assert(key); + assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); + assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); + assert(p->kind != Name_kind || p->v.Name.ctx == Load); + VISIT(c, expr, key); + ADDOP_JREL(c, MATCH_KEY, block); + CHECK(compiler_pattern(c, value, block)); + } + if (!star) { + ADDOP(c, POP_TOP); } else { - VISIT(c, expr, p); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1))); + } + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); + return 1; +} + +static int +compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) +{ + assert(p->kind == BinOp_kind); + assert(p->v.BinOp.op== BitOr); + basicblock *block = compiler_new_block(c); + basicblock *end = compiler_new_block(c); + ADDOP(c, DUP_TOP); + CHECK(compiler_pattern(c, p->v.BinOp.left, block)); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + CHECK(compiler_pattern(c, p->v.BinOp.right, fail)); + compiler_use_next_block(c, end); + return 1; +} + +static int +compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) +{ + assert(p->kind == List_kind || p->kind == Tuple_kind); + asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + Py_ssize_t size = asdl_seq_LEN(values); + Py_ssize_t star = -1; + for (Py_ssize_t i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (value->kind != Starred_kind) { + continue; + } + if (star >= 0) { + return compiler_error(c, "multiple starred names in pattern"); + } + // TODO: Test this math: + if ((size - i - 1) << 8 >= INT_MAX) { + return compiler_error(c, "too many sub-patterns follow starred name"); + } + star = i; + } + basicblock *block = compiler_new_block(c); + basicblock *end = compiler_new_block(c); + ADDOP_JREL(c, MATCH_SEQ, fail); + for (Py_ssize_t i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (i == star) { + assert(value->kind == Starred_kind); + ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); + CHECK(compiler_pattern_store(c, value->v.Starred.value)); + if (size - i - 1) { + ADDOP_I(c, BUILD_TUPLE, size - i - 1); + ADDOP_JREL(c, MATCH_SEQ, fail); + } + else { + ADDOP_JREL(c, JUMP_FORWARD, end); + } + } + else { + ADDOP_JREL(c, FOR_ITER, fail); + CHECK(compiler_pattern(c, value, block)); + } } + ADDOP_JREL(c, FOR_ITER, end); + ADDOP(c, POP_TOP); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); return 1; } static int compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) { - basicblock *end, *block; - Py_ssize_t i, size, star; - asdl_seq *keys, *values; - expr_ty key, value; switch (p->kind) { - // Atomic patterns: - case Name_kind: - if (p->v.Name.ctx == Store) { - return pattern_store_helper(c, p); - } - assert(p->v.Name.ctx == Load); - // Fall... case Attribute_kind: - assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); - // Fall.... case Constant_kind: - VISIT(c, expr, p); - ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, fail); - return 1; - // Nested patterns: + return compiler_pattern_load(c, p, fail); case BinOp_kind: - assert(p->v.BinOp.op == BitOr); - end = compiler_new_block(c); - block = compiler_new_block(c); - ADDOP(c, DUP_TOP); - if (!compiler_pattern(c, p->v.BinOp.left, block)) { - return 0; - } - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - if (!compiler_pattern(c, p->v.BinOp.right, fail)) { - return 0; - } - compiler_use_next_block(c, end); - return 1; + return compiler_pattern_or(c, p, fail); case Dict_kind: - keys = p->v.Dict.keys; - values = p->v.Dict.values; - size = asdl_seq_LEN(values); - star = 0; - // TODO: Rely on parser/validation for this? - for (i = 0; i < size; i++) { - if (asdl_seq_GET(keys, i)) { - continue; - } - value = asdl_seq_GET(values, i); - if (value->kind != Name_kind || value->v.Name.ctx != Store) { - return compiler_error(c, - "starred sub-patterns must be names"); - } - if (i != size - 1) { - return compiler_error(c, - "sub-patterns cannot follow starred name"); - } - star = 1; - } - end = compiler_new_block(c); - block = compiler_new_block(c); - ADDOP_JREL(c, MATCH_MAP, fail); - for (i = 0; i < size - star; i++) { - key = asdl_seq_GET(keys, i); - value = asdl_seq_GET(values, i); - assert(key); - assert(key->kind == Name_kind && key->v.Name.ctx == Load - || key->kind == Constant_kind); - VISIT(c, expr, key); - ADDOP_JREL(c, MATCH_KEY, block); - if (!compiler_pattern(c, value, block)) { - return 0; - } - } - if (!star) { - ADDOP(c, POP_TOP); - } - else if (!pattern_store_helper(c, asdl_seq_GET(values, size - 1))) { - return 0; - } - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, end); - return 1; + return compiler_pattern_mapping(c, p, fail); case List_kind: - case Tuple_kind: // TODO: Undecided yet if tuple syntax is legal. - values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; - size = asdl_seq_LEN(values); - star = -1; - for (i = 0; i < size; i++) { - value = asdl_seq_GET(values, i); - if (value->kind != Starred_kind) { - continue; - } - // TODO: Rely on parser/validation for this? - if (value->kind != Name_kind || value->v.Name.ctx != Store) { - return compiler_error(c, - "starred sub-patterns must be names"); - } - if (star >= 0) { - return compiler_error(c, - "multiple starred names in pattern"); - } - // TODO: Test this math: - if ((size - i - 1) << 8 >= INT_MAX) { - return compiler_error(c, - "too many sub-patterns follow starred name"); - } - star = i; - } - end = compiler_new_block(c); - block = compiler_new_block(c); - ADDOP_JREL(c, MATCH_SEQ, fail); - for (i = 0; i < size; i++) { - value = asdl_seq_GET(values, i); - if (i == star) { - assert(value->kind == Starred_kind); - ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); - if (!pattern_store_helper(c, value->v.Starred.value)) { - return 0; - } - if (size - i - 1) { - ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP_JREL(c, MATCH_SEQ, fail); - } - else { - ADDOP_JREL(c, JUMP_FORWARD, end); - } - } - else { - ADDOP_JREL(c, FOR_ITER, fail); - if (!compiler_pattern(c, value, block)) { - return 0; - } - } - } - ADDOP_JREL(c, FOR_ITER, end); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, end); - return 1; + case Tuple_kind: + return compiler_pattern_sequence(c, p, fail); + case Name_kind: + return compiler_pattern_name(c, p, fail); case NamedExpr_kind: - end = compiler_new_block(c); - block = compiler_new_block(c); - ADDOP(c, DUP_TOP); - if (!compiler_pattern(c, p->v.NamedExpr.value, block)) { - return 0; - } - VISIT(c, expr, p->v.NamedExpr.target); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, end); - return 1; + return compiler_pattern_namedexpr(c, p, fail); default: Py_UNREACHABLE(); } @@ -2934,16 +2940,15 @@ static int compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.target); - match_case_ty m; - basicblock *next, *end = compiler_new_block(c); + basicblock *end = compiler_new_block(c); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); for (Py_ssize_t i = 0; i < cases; i++) { - m = asdl_seq_GET(s->v.Match.cases, i); - next = compiler_new_block(c); + match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); + basicblock *next = compiler_new_block(c); ADDOP(c, DUP_TOP); compiler_pattern(c, m->pattern, next); - if (m->guard && !compiler_jump_if(c, m->guard, next, 0)) { - return 0; + if (m->guard) { + CHECK(compiler_jump_if(c, m->guard, next, 0)); } ADDOP(c, POP_TOP); VISIT_SEQ(c, stmt, m->body); From 09e8fdcc111e48da4f2d771d18d4d98d7f3965ed Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 08:28:02 -0700 Subject: [PATCH 035/218] Handle errors when creating new blocks --- Python/compile.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 8048301f27f3e4..cafaf56b666f0a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2796,8 +2796,9 @@ static int compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) { assert(p->kind == NamedExpr_kind); - basicblock *block = compiler_new_block(c); - basicblock *end = compiler_new_block(c); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, p->v.NamedExpr.value, block)); CHECK(compiler_pattern_store(c, p->v.NamedExpr.target)); @@ -2812,8 +2813,9 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) static int compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) { - basicblock *block = compiler_new_block(c); - basicblock *end = compiler_new_block(c); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); asdl_seq *keys = p->v.Dict.keys; asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); @@ -2849,8 +2851,9 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) { assert(p->kind == BinOp_kind); assert(p->v.BinOp.op== BitOr); - basicblock *block = compiler_new_block(c); - basicblock *end = compiler_new_block(c); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, p->v.BinOp.left, block)); ADDOP(c, POP_TOP); @@ -2882,8 +2885,9 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) } star = i; } - basicblock *block = compiler_new_block(c); - basicblock *end = compiler_new_block(c); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); ADDOP_JREL(c, MATCH_SEQ, fail); for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -2940,11 +2944,12 @@ static int compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.target); - basicblock *end = compiler_new_block(c); + basicblock *next, *end; + CHECK(end = compiler_new_block(c)); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); for (Py_ssize_t i = 0; i < cases; i++) { match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); - basicblock *next = compiler_new_block(c); + CHECK(next = compiler_new_block(c)); ADDOP(c, DUP_TOP); compiler_pattern(c, m->pattern, next); if (m->guard) { From f612a2740c8e6e7f43b8d60f240ef226469115d3 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 08:32:40 -0700 Subject: [PATCH 036/218] Break out _collections_abc stuff in ceval --- Python/ceval.c | 104 +++++++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 37 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 7ecb7d5756e064..0a8e87dfe558b5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -848,6 +848,56 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) return 0; } +// Need these for pattern matching: + +static int +match_map_type(PyObject *target) +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + return -1; + } + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return -1; + } + interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); + Py_DECREF(abc); + if (!interp->map_abc) { + return -1; + } + } + return PyObject_IsInstance(target, interp->map_abc); +} + +static int +match_seq_type(PyObject *target) +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + return -1; + } + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return -1; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + Py_DECREF(abc); + if (!interp->seq_abc) { + return -1; + } + } + return ( + PyObject_IsInstance(target, interp->seq_abc) + && !PyIter_Check(target) + && !PyObject_TypeCheck(target, &PyUnicode_Type) + && !PyObject_TypeCheck(target, &PyBytes_Type) + && !PyObject_TypeCheck(target, &PyByteArray_Type) + ); +} + static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **); @@ -3309,23 +3359,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_MAP): { - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { + PyObject *target = TOP(); + int match = match_map_type(target); + if (match < 0) { goto error; } - if (!interp->map_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - goto error; - } - interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); - Py_DECREF(abc); - if (!interp->map_abc) { - goto error; - } - } - PyObject *target = TOP(); - if (!PyObject_IsInstance(target, interp->map_abc)) { + if (!match) { STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); @@ -3351,35 +3390,26 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQ): { - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { + PyObject *target = TOP(); + int match = match_seq_type(target); + if (match < 0) { goto error; } - if (!interp->seq_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - goto error; - } - interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - Py_DECREF(abc); - if (!interp->seq_abc) { - goto error; - } - } - PyObject *target = TOP(); - if ( - !PyObject_IsInstance(target, interp->seq_abc) - || PyIter_Check(target) - || PyObject_TypeCheck(target, &PyUnicode_Type) - || PyObject_TypeCheck(target, &PyBytes_Type) - || PyObject_TypeCheck(target, &PyByteArray_Type) - ) { + if (!match) { STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); } - } // Fall... + PyObject *iter = PyObject_GetIter(target); + if (!iter) { + goto error; + } + Py_DECREF(target); + SET_TOP(iter); + DISPATCH(); + } + case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); From 21ac8790df5380e1e9b4340924a3e997aca7d70f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 08:35:31 -0700 Subject: [PATCH 037/218] Clean up new opcode docs --- Doc/library/dis.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index fbd71e24ee5da9..c64ea76c4ad7fd 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -992,29 +992,29 @@ All of the following opcodes use their arguments. .. opcode:: MATCH_SEQ (delta) - Used to implement pattern matching. Pop TOS. If it is an instance of - :class:`collections.abc.Sequence`, is not an :term:`iterator`, and is not an - instance of :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator - from it and push that onto the stack. Otherwise, increment the bytecode - counter by ``delta``. + Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not + an :term:`iterator`, and is not an instance of + :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator from it and + push that onto the stack. Otherwise, increment the bytecode counter by + ``delta``. .. versionadded:: 3.10 .. opcode:: MATCH_MAP (delta) - Used to implement pattern matching. Pop TOS. If it is an instance of - :class:`collections.abc.Mapping`, copy it into a :class:`dict` and push that - onto the stack. Otherwise, increment the bytecode counter by *delta*. + Pop TOS. If it is an instance of :class:`collections.abc.Mapping`, copy it + into a :class:`dict` and push that onto the stack. Otherwise, increment the + bytecode counter by ``delta``. .. versionadded:: 3.10 .. opcode:: MATCH_KEY (delta) - Used to implement pattern matching. Pop TOS. If it is a key in the dict at - TOS1, remove it and push the associated value onto the stack. Otherwise, - increment the bytecode counter by *delta*. + Pop TOS. If it is a key in the :class:`dict` at TOS1, remove it and push the + associated value onto the stack. Otherwise, increment the bytecode counter + by ``delta``. .. versionadded:: 3.10 From c103ab4dddf946f13dc707863fa440c54d51832c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 08:45:56 -0700 Subject: [PATCH 038/218] Simplify string checks --- Python/ceval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 0a8e87dfe558b5..a386b3b3671eb3 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -892,9 +892,9 @@ match_seq_type(PyObject *target) return ( PyObject_IsInstance(target, interp->seq_abc) && !PyIter_Check(target) - && !PyObject_TypeCheck(target, &PyUnicode_Type) - && !PyObject_TypeCheck(target, &PyBytes_Type) - && !PyObject_TypeCheck(target, &PyByteArray_Type) + && !PyUnicode_Check(target) + && !PyBytes_Check(target) + && !PyByteArray_Check(target) ); } From 14409e062c3e2233f21c5f5e06e23173ed1c15b4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 09:20:01 -0700 Subject: [PATCH 039/218] Add basic AST optimization --- Python/ast_opt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index ff786d6f8d63ef..87e6995ebcb379 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -395,6 +395,8 @@ static int astfold_keyword(keyword_ty node_, PyArena *ctx_, _PyASTOptimizeState static int astfold_arg(arg_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); static int astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); +static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); + #define CALL(FUNC, TYPE, ARG) \ if (!FUNC((ARG), ctx_, state)) \ return 0; @@ -710,6 +712,10 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case Expr_kind: CALL(astfold_expr, expr_ty, node_->v.Expr.value); break; + case Match_kind: + CALL(astfold_expr, expr_ty, node_->v.Match.target); + CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); + break; default: break; } @@ -738,6 +744,16 @@ astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) return 1; } +static int +astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) +{ + CALL_OPT(astfold_expr, expr_ty, node_->guard); + // TODO: Create pattern optimizer. + // Don't blindly optimize the pattern as an expr; it plays by its own rules! + CALL_SEQ(astfold_stmt, stmt_ty, node_->body); + return 1; +} + #undef CALL #undef CALL_OPT #undef CALL_SEQ From e91c4004f3e2873a9e5f57d90c04423c43d89226 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 11:02:39 -0700 Subject: [PATCH 040/218] Fix asserts --- Python/compile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index cafaf56b666f0a..45d0e32d6954e7 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2825,9 +2825,9 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) expr_ty key = asdl_seq_GET(keys, i); expr_ty value = asdl_seq_GET(values, i); assert(key); - assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); - assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); - assert(p->kind != Name_kind || p->v.Name.ctx == Load); + assert(key->kind == Attribute_kind || key->kind == Constant_kind || key->kind == Name_kind); + assert(key->kind != Attribute_kind || key->v.Attribute.ctx == Load); + assert(key->kind != Name_kind || key->v.Name.ctx == Load); VISIT(c, expr, key); ADDOP_JREL(c, MATCH_KEY, block); CHECK(compiler_pattern(c, value, block)); From 7fb4d11a9d59db463ed037318bc1ff6f407688d7 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 29 May 2020 17:35:20 -0700 Subject: [PATCH 041/218] Implement default object.__match__ --- Objects/clinic/typeobject.c.h | 11 ++++++++++- Objects/typeobject.c | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h index 8c70d76d916db3..afaec9c809e5fb 100644 --- a/Objects/clinic/typeobject.c.h +++ b/Objects/clinic/typeobject.c.h @@ -243,4 +243,13 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored)) { return object___dir___impl(self); } -/*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(object___match____doc__, +"__match__($type, target, /)\n" +"--\n" +"\n" +"Match all instances of this type, returning them for further destructuring."); + +#define OBJECT___MATCH___METHODDEF \ + {"__match__", (PyCFunction)object___match__, METH_O|METH_CLASS, object___match____doc__}, +/*[clinic end generated code: output=9fc91a27a50d735d input=a9049054013a1b77]*/ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 0e055d677f139e..fb95f6f8282f55 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4986,6 +4986,31 @@ object___dir___impl(PyObject *self) return result; } +/*[clinic input] +@classmethod +object.__match__ + + target: object + / + +Match all instances of this type, returning them for further destructuring. +[clinic start generated code]*/ + +static PyObject * +object___match__(PyTypeObject *type, PyObject *target) +/*[clinic end generated code: output=bcea50777819dfeb input=493f4963453b0072]*/ +{ + int match = PyObject_IsInstance(target, (PyObject *)type); + if (match < 0) { + return NULL; + } + if (match) { + Py_INCREF(target); + return target; + } + Py_RETURN_NONE; +} + static PyMethodDef object_methods[] = { OBJECT___REDUCE_EX___METHODDEF OBJECT___REDUCE___METHODDEF @@ -4996,6 +5021,7 @@ static PyMethodDef object_methods[] = { OBJECT___FORMAT___METHODDEF OBJECT___SIZEOF___METHODDEF OBJECT___DIR___METHODDEF + OBJECT___MATCH___METHODDEF {0} }; From 17356fb1ca49dddaea6dc36e2cbce38c0069f243 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 30 May 2020 17:58:33 -0700 Subject: [PATCH 042/218] Fix sequence matching bug --- Python/compile.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 45d0e32d6954e7..4075451d5bdc5c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -982,8 +982,6 @@ stack_effect(int opcode, int oparg, int jump) case FOR_ITER: /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; - case MATCH_SEQ: - case MATCH_MAP: case MATCH_KEY: return -(jump > 0); @@ -2849,17 +2847,21 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) static int compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) { - assert(p->kind == BinOp_kind); - assert(p->v.BinOp.op== BitOr); + assert(p->kind == BoolOp_kind); + assert(p->v.BoolOp.op== Or); basicblock *block, *end; - CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.BinOp.left, block)); + Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); + for (Py_ssize_t i = 0; i < size; i++) { + CHECK(block = compiler_new_block(c)); + ADDOP(c, DUP_TOP); + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), block)); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + } ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - CHECK(compiler_pattern(c, p->v.BinOp.right, fail)); + ADDOP_JREL(c, JUMP_FORWARD, fail); compiler_use_next_block(c, end); return 1; } @@ -2896,6 +2898,8 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); CHECK(compiler_pattern_store(c, value->v.Starred.value)); if (size - i - 1) { + ADDOP_I(c, BUILD_TUPLE, size - i - 1); + ADDOP_I(c, UNPACK_SEQUENCE, size - i - 1); ADDOP_I(c, BUILD_TUPLE, size - i - 1); ADDOP_JREL(c, MATCH_SEQ, fail); } @@ -2924,7 +2928,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) case Attribute_kind: case Constant_kind: return compiler_pattern_load(c, p, fail); - case BinOp_kind: + case BoolOp_kind: return compiler_pattern_or(c, p, fail); case Dict_kind: return compiler_pattern_mapping(c, p, fail); From 9d7bd070aaf4009d2d9199b20e72479c06128f34 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 30 May 2020 18:09:47 -0700 Subject: [PATCH 043/218] BinOp -> BoolOp --- Grammar/python.gram | 94 +- Lib/test/test_patma.py | 101 +- Parser/pegen/parse.c | 5055 ++++++++++++++++++++-------------------- Python/ast.c | 21 +- Python/compile.c | 2 + 5 files changed, 2681 insertions(+), 2592 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index dba18e16fc36f6..ef69ad240bdddd 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -193,17 +193,24 @@ except_block[excepthandler_ty]: finally_block[asdl_seq*]: 'finally' ':' a=block { a } match_stmt[stmt_ty]: - | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT {_Py_Match(target, cases, EXTRA) } + | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { + _Py_Match(target, cases, EXTRA) } case_block: - | "case" pattern=pattern guard=['if' a=named_expression { a }] ':' body=block { - _Py_match_case(pattern, guard, body, p->arena) } + | "case" pattern=pattern guard=[guard] ':' body=block { + _Py_match_case(pattern, guard, body, p->arena) } pattern: - | a=NAME ':=' b=or_pattern { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, a, Store)), b, EXTRA) } + | target=NAME ':=' value=or_pattern { + _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } | or_pattern +guard: + | 'if' guard=named_expression { + guard } or_pattern: - | '|'.closed_pattern+ + | value=closed_pattern '|' values='|'.closed_pattern+ { + _Py_BoolOp(Or, CHECK(_PyPegen_seq_insert_in_front(p, value, values)), EXTRA) } + | closed_pattern closed_pattern: | name_pattern @@ -215,32 +222,67 @@ closed_pattern: | class_pattern name_pattern: - | a=NAME !('.' | '(') { a } + | a=NAME !('.' | '(') { + _PyPegen_set_expr_context(p, a, Store) } literal_pattern: | NUMBER | strings - | 'None' - | 'True' - | 'False' + | 'None' { + _Py_Constant(Py_None, NULL, EXTRA) } + | 'True' { + _Py_Constant(Py_True, NULL, EXTRA) } + | 'False' { + _Py_Constant(Py_False, NULL, EXTRA) } constant_pattern: - | '.' NAME - | a='.'.NAME+ !'(' { a } + | '.' name=NAME { + name } + | value=name_or_attr '.' attr=NAME !'(' { + _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } group_pattern: - | '(' a=pattern ')' { a } + | '(' pattern=pattern ')' { + pattern } sequence_pattern: - | '[' a=[','.pattern+] ']' { _Py_List(a, Load, EXTRA) } - | '(' a=[','.pattern+] ')' { _Py_Tuple(a, Load, EXTRA) } + | '[' values=values_pattern ']' { + _Py_List(values, Load, EXTRA) } mapping_pattern: - | '{' ','.(key_pattern ':' closed_pattern)+ '}' { NULL } -key_pattern: - | a=literal_pattern &':' { a } - | a='|'.literal_pattern+ { NULL } + | '{' items=items_pattern '}' { + _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } class_pattern: - | '.'.NAME+ '(' pattern_args ')' -pattern_args: - | ','.pattern+ ',' ','.(NAME '=' or_pattern)+ { NULL } - | ','.(NAME '=' or_pattern)+ { NULL } - | a=','.pattern+ { a } + | func=name_or_attr '(' ')' { + _Py_Call(func, NULL, NULL, EXTRA) } + | func=name_or_attr '(' args=','.pattern+ [','] ')' { + _Py_Call(func, args, NULL, EXTRA) } + | func=name_or_attr '(' keywords=','.keyword_pattern+ [','] ')' { + _Py_Call(func, NULL, keywords, EXTRA) } + | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ [','] ')' { + _Py_Call(func, args, keywords, EXTRA) } + +name_or_attr: + | value=name_or_attr '.' attr=NAME { + _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } + | NAME +values_pattern: + | values=','.value_pattern+ [','] { + values } +items_pattern: + | items=','.key_value_pattern+ [','] { + items } +keyword_pattern: + | arg=NAME '=' value=or_pattern { + _Py_keyword(arg->v.Name.id, value, EXTRA) } + +value_pattern: + | '*' value=name_pattern { + _Py_Starred(value, Store, EXTRA) } + | pattern +key_value_pattern: + | key=literal_pattern ':' value=closed_pattern { + _PyPegen_key_value_pair(p, key, value) } + | key=constant_pattern ':' value=closed_pattern { + _PyPegen_key_value_pair(p, key, value) } + | '**' value=name_pattern { + _PyPegen_key_value_pair(p, NULL, value) } + return_stmt[stmt_ty]: | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) } @@ -702,12 +744,12 @@ invalid_assignment: _PyPegen_get_invalid_target(a), "cannot assign to %s", _PyPegen_get_expr_name(_PyPegen_get_invalid_target(a))) } | a=star_expressions augassign (yield_expr | star_expressions) { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION( - a, + RAISE_SYNTAX_ERROR_KNOWN_LOCATION( + a, "'%s' is an illegal expression for augmented assignment", _PyPegen_get_expr_name(a) )} - + invalid_block: | NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") } invalid_comprehension: diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 3fcb430f48f513..2c1c6fa879379e 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -18,6 +18,9 @@ class TestAST(unittest.TestCase): No tests for name loads/stores, since these need a patma parser to disambiguate. + + Note that we use "or" for "|" here, since the parser gives us a BoolOp-Or, + not a BinOp-BitOr. """ @staticmethod @@ -206,32 +209,32 @@ def test_walrus_05(self) -> None: self.assertEqual(namespace.get("z"), 0) def test_pipe_00(self) -> None: - match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) def test_pipe_01(self) -> None: - match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 1", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertEqual(namespace.get("y"), 0) def test_pipe_02(self) -> None: - match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 2", "x", match_cases, "") self.assertEqual(namespace.get("x"), 2) self.assertEqual(namespace.get("y"), 0) def test_pipe_03(self) -> None: - match_cases = [MatchCase("0 | 1 | 2", "y = 0")] + match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 3", "x", match_cases, "") self.assertEqual(namespace.get("x"), 3) self.assertNotIn("y", namespace) def test_pipe_04(self) -> None: match_cases = [ - MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) @@ -240,7 +243,7 @@ def test_pipe_04(self) -> None: def test_pipe_05(self) -> None: match_cases = [ - MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] namespace = self.execute_match("x = 1", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) @@ -249,7 +252,7 @@ def test_pipe_05(self) -> None: def test_pipe_06(self) -> None: match_cases = [ - MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] namespace = self.execute_match("x = 2", "x", match_cases, "") self.assertEqual(namespace.get("x"), 2) @@ -258,7 +261,7 @@ def test_pipe_06(self) -> None: def test_pipe_07(self) -> None: match_cases = [ - MatchCase("(z := 0) | (z := 1) | (z := 2)", "y = 0", "z == x % 2") + MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] namespace = self.execute_match("x = 3", "x", match_cases, "") self.assertEqual(namespace.get("x"), 3) @@ -290,19 +293,19 @@ def test_sequence_03(self) -> None: self.assertEqual(namespace.get("y"), 0) def test_sequence_04(self) -> None: - match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 1]) self.assertEqual(namespace.get("y"), 0) def test_sequence_05(self) -> None: - match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [1, 0]) self.assertEqual(namespace.get("y"), 0) def test_sequence_06(self) -> None: - match_cases = [MatchCase("(0, 1) | (1, 0)", "y = 0")] + match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 0]) self.assertNotIn("y", namespace) @@ -310,7 +313,7 @@ def test_sequence_06(self) -> None: def test_sequence_07(self) -> None: match_cases = [ MatchCase("(w := 0,)", "y = 0"), - MatchCase("[] | (1, z := (0 | 1)) | []", "y = 1"), + MatchCase("[] or (1, z := (0 or 1)) or []", "y = 1"), ] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertNotIn("w", namespace) @@ -430,28 +433,28 @@ def test_mapping_02(self) -> None: self.assertNotIn("y", namespace) def test_mapping_03(self) -> None: - match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 0}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) def test_mapping_04(self) -> None: - match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 1}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 1}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 1) def test_mapping_05(self) -> None: - match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 2}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 2}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 2) def test_mapping_06(self) -> None: - match_cases = [MatchCase("{0: (z := (0 | 1 | 2))}", "y = 0")] + match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 3}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 3}) self.assertNotIn("y", namespace) @@ -517,7 +520,7 @@ def test_mapping_12(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( - "{0: [1, 2, {}] | False} | {1: [()]} | {0: [1, 2, {}]} | [] | 'X' | {}", + "{0: [1, 2, {}] or False} or {1: [()]} or {0: [1, 2, {}]} or [] or 'X' or {}", "y = 1", ), MatchCase("()", "y = 2"), @@ -530,7 +533,7 @@ def test_mapping_13(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( - "{0: [1, 2, {}] | True} | {1: [()]} | {0: [1, 2, {}]} | [] | 'X' | {}", + "{0: [1, 2, {}] or True} or {1: [()]} or {0: [1, 2, {}]} or [] or 'X' or {}", "y = 1", ), MatchCase("()", "y = 2"), @@ -540,10 +543,70 @@ def test_mapping_13(self) -> None: self.assertEqual(namespace.get("y"), 1) +class TestMatch(unittest.TestCase): + + def test_grammar_00(self) -> None: + match 0: + case 0: + x = True + self.assertEqual(x, True) + + def test_grammar_01(self) -> None: + match 0: + case 0 if False: + x = False + case 0 if True: + x = True + self.assertEqual(x, True) + + def test_grammar_02(self) -> None: + match 0: + case 0: + x = True + case 0: + x = False + self.assertEqual(x, True) + + def test_grammar_03(self) -> None: + x = False + match 0: + case 0 | 1 | 2 | 3: + x = True + self.assertEqual(x, True) + + def test_grammar_04(self) -> None: + x = False + match 1: + case 0 | 1 | 2 | 3: + x = True + self.assertEqual(x, True) + + def test_grammar_05(self) -> None: + x = False + match 2: + case 0 | 1 | 2 | 3: + x = True + self.assertEqual(x, True) + + def test_grammar_06(self) -> None: + x = False + match 3: + case 0 | 1 | 2 | 3: + x = True + self.assertEqual(x, True) + + def test_grammar_07(self) -> None: + x = False + match 4: + case 0 | 1 | 2 | 3: + x = True + self.assertEqual(x, False) + + if __name__ == "__main__": # XXX: For quick test debugging... import dis match_cases = [ - MatchCase("([0, 1]) | {'XXX': (1 | (z := 2))} | (0, q, [[[{}]]])", "pass") + MatchCase("([0, 1]) or {'XXX': (1 or (z := 2))} or (0, q, [[[{}]]])", "pass") ] dis.dis(TestAST.compile_match("", "x", match_cases, "")) diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index f4d59b89f04281..5cdfc10302903d 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -116,311 +116,304 @@ static KeywordToken *reserved_keywords[] = { #define match_stmt_type 1038 #define case_block_type 1039 #define pattern_type 1040 -#define or_pattern_type 1041 -#define closed_pattern_type 1042 -#define name_pattern_type 1043 -#define literal_pattern_type 1044 -#define constant_pattern_type 1045 -#define group_pattern_type 1046 -#define sequence_pattern_type 1047 -#define mapping_pattern_type 1048 -#define key_pattern_type 1049 +#define guard_type 1041 +#define or_pattern_type 1042 +#define closed_pattern_type 1043 +#define name_pattern_type 1044 +#define literal_pattern_type 1045 +#define constant_pattern_type 1046 +#define group_pattern_type 1047 +#define sequence_pattern_type 1048 +#define mapping_pattern_type 1049 #define class_pattern_type 1050 -#define pattern_args_type 1051 -#define return_stmt_type 1052 -#define raise_stmt_type 1053 -#define function_def_type 1054 -#define function_def_raw_type 1055 -#define func_type_comment_type 1056 -#define params_type 1057 -#define parameters_type 1058 -#define slash_no_default_type 1059 -#define slash_with_default_type 1060 -#define star_etc_type 1061 -#define kwds_type 1062 -#define param_no_default_type 1063 -#define param_with_default_type 1064 -#define param_maybe_default_type 1065 -#define param_type 1066 -#define annotation_type 1067 -#define default_type 1068 -#define decorators_type 1069 -#define class_def_type 1070 -#define class_def_raw_type 1071 -#define block_type 1072 -#define expressions_list_type 1073 -#define star_expressions_type 1074 -#define star_expression_type 1075 -#define star_named_expressions_type 1076 -#define star_named_expression_type 1077 -#define named_expression_type 1078 -#define annotated_rhs_type 1079 -#define expressions_type 1080 -#define expression_type 1081 -#define lambdef_type 1082 -#define lambda_parameters_type 1083 -#define lambda_slash_no_default_type 1084 -#define lambda_slash_with_default_type 1085 -#define lambda_star_etc_type 1086 -#define lambda_kwds_type 1087 -#define lambda_param_no_default_type 1088 -#define lambda_param_with_default_type 1089 -#define lambda_param_maybe_default_type 1090 -#define lambda_param_type 1091 -#define disjunction_type 1092 -#define conjunction_type 1093 -#define inversion_type 1094 -#define comparison_type 1095 -#define compare_op_bitwise_or_pair_type 1096 -#define eq_bitwise_or_type 1097 -#define noteq_bitwise_or_type 1098 -#define lte_bitwise_or_type 1099 -#define lt_bitwise_or_type 1100 -#define gte_bitwise_or_type 1101 -#define gt_bitwise_or_type 1102 -#define notin_bitwise_or_type 1103 -#define in_bitwise_or_type 1104 -#define isnot_bitwise_or_type 1105 -#define is_bitwise_or_type 1106 -#define bitwise_or_type 1107 // Left-recursive -#define bitwise_xor_type 1108 // Left-recursive -#define bitwise_and_type 1109 // Left-recursive -#define shift_expr_type 1110 // Left-recursive -#define sum_type 1111 // Left-recursive -#define term_type 1112 // Left-recursive -#define factor_type 1113 -#define power_type 1114 -#define await_primary_type 1115 -#define primary_type 1116 // Left-recursive -#define slices_type 1117 -#define slice_type 1118 -#define atom_type 1119 -#define strings_type 1120 -#define list_type 1121 -#define listcomp_type 1122 -#define tuple_type 1123 -#define group_type 1124 -#define genexp_type 1125 -#define set_type 1126 -#define setcomp_type 1127 -#define dict_type 1128 -#define dictcomp_type 1129 -#define double_starred_kvpairs_type 1130 -#define double_starred_kvpair_type 1131 -#define kvpair_type 1132 -#define for_if_clauses_type 1133 -#define for_if_clause_type 1134 -#define yield_expr_type 1135 -#define arguments_type 1136 -#define args_type 1137 -#define kwargs_type 1138 -#define starred_expression_type 1139 -#define kwarg_or_starred_type 1140 -#define kwarg_or_double_starred_type 1141 -#define star_targets_type 1142 -#define star_targets_seq_type 1143 -#define star_target_type 1144 -#define star_atom_type 1145 -#define single_target_type 1146 -#define single_subscript_attribute_target_type 1147 -#define del_targets_type 1148 -#define del_target_type 1149 -#define del_t_atom_type 1150 -#define del_target_end_type 1151 -#define targets_type 1152 -#define target_type 1153 -#define t_primary_type 1154 // Left-recursive -#define t_lookahead_type 1155 -#define t_atom_type 1156 -#define incorrect_arguments_type 1157 -#define invalid_kwarg_type 1158 -#define invalid_named_expression_type 1159 -#define invalid_assignment_type 1160 -#define invalid_block_type 1161 -#define invalid_comprehension_type 1162 -#define invalid_dict_comprehension_type 1163 -#define invalid_parameters_type 1164 -#define invalid_star_etc_type 1165 -#define invalid_lambda_star_etc_type 1166 -#define invalid_double_type_comments_type 1167 -#define invalid_del_target_type 1168 -#define invalid_import_from_targets_type 1169 -#define _loop0_1_type 1170 -#define _loop0_2_type 1171 -#define _loop0_4_type 1172 -#define _gather_3_type 1173 -#define _loop0_6_type 1174 -#define _gather_5_type 1175 -#define _loop0_8_type 1176 -#define _gather_7_type 1177 -#define _loop0_10_type 1178 -#define _gather_9_type 1179 -#define _loop1_11_type 1180 -#define _loop0_13_type 1181 -#define _gather_12_type 1182 -#define _tmp_14_type 1183 -#define _tmp_15_type 1184 -#define _tmp_16_type 1185 -#define _tmp_17_type 1186 -#define _tmp_18_type 1187 -#define _tmp_19_type 1188 -#define _tmp_20_type 1189 -#define _tmp_21_type 1190 -#define _loop1_22_type 1191 -#define _tmp_23_type 1192 -#define _tmp_24_type 1193 -#define _loop0_26_type 1194 -#define _gather_25_type 1195 -#define _loop0_28_type 1196 -#define _gather_27_type 1197 -#define _tmp_29_type 1198 -#define _loop0_30_type 1199 -#define _loop1_31_type 1200 -#define _loop0_33_type 1201 -#define _gather_32_type 1202 -#define _tmp_34_type 1203 -#define _loop0_36_type 1204 -#define _gather_35_type 1205 -#define _tmp_37_type 1206 -#define _loop0_39_type 1207 -#define _gather_38_type 1208 -#define _loop0_41_type 1209 -#define _gather_40_type 1210 -#define _loop0_43_type 1211 -#define _gather_42_type 1212 -#define _loop0_45_type 1213 -#define _gather_44_type 1214 -#define _tmp_46_type 1215 -#define _loop1_47_type 1216 -#define _tmp_48_type 1217 -#define _loop1_49_type 1218 -#define _tmp_50_type 1219 -#define _loop0_52_type 1220 -#define _gather_51_type 1221 -#define _tmp_53_type 1222 -#define _loop0_55_type 1223 -#define _gather_54_type 1224 -#define _loop0_57_type 1225 -#define _gather_56_type 1226 -#define _loop0_59_type 1227 -#define _gather_58_type 1228 -#define _loop0_61_type 1229 -#define _gather_60_type 1230 -#define _loop0_63_type 1231 -#define _gather_62_type 1232 -#define _loop0_65_type 1233 -#define _gather_64_type 1234 -#define _loop0_67_type 1235 -#define _gather_66_type 1236 -#define _loop0_69_type 1237 -#define _gather_68_type 1238 -#define _loop0_71_type 1239 -#define _gather_70_type 1240 -#define _loop0_73_type 1241 -#define _gather_72_type 1242 -#define _tmp_74_type 1243 -#define _tmp_75_type 1244 -#define _tmp_76_type 1245 -#define _tmp_77_type 1246 -#define _loop0_78_type 1247 -#define _loop0_79_type 1248 -#define _loop0_80_type 1249 -#define _loop1_81_type 1250 -#define _loop0_82_type 1251 -#define _loop1_83_type 1252 -#define _loop1_84_type 1253 -#define _loop1_85_type 1254 -#define _loop0_86_type 1255 -#define _loop1_87_type 1256 -#define _loop0_88_type 1257 -#define _loop1_89_type 1258 -#define _loop0_90_type 1259 -#define _loop1_91_type 1260 -#define _loop1_92_type 1261 -#define _tmp_93_type 1262 -#define _loop0_95_type 1263 -#define _gather_94_type 1264 -#define _loop1_96_type 1265 -#define _loop0_98_type 1266 -#define _gather_97_type 1267 -#define _loop1_99_type 1268 -#define _loop0_100_type 1269 -#define _loop0_101_type 1270 -#define _loop0_102_type 1271 -#define _loop1_103_type 1272 -#define _loop0_104_type 1273 -#define _loop1_105_type 1274 -#define _loop1_106_type 1275 -#define _loop1_107_type 1276 -#define _loop0_108_type 1277 -#define _loop1_109_type 1278 -#define _loop0_110_type 1279 -#define _loop1_111_type 1280 -#define _loop0_112_type 1281 -#define _loop1_113_type 1282 -#define _loop1_114_type 1283 -#define _loop1_115_type 1284 -#define _loop1_116_type 1285 -#define _tmp_117_type 1286 -#define _loop0_119_type 1287 -#define _gather_118_type 1288 -#define _tmp_120_type 1289 -#define _tmp_121_type 1290 -#define _tmp_122_type 1291 -#define _tmp_123_type 1292 -#define _loop1_124_type 1293 -#define _tmp_125_type 1294 -#define _tmp_126_type 1295 -#define _loop0_128_type 1296 -#define _gather_127_type 1297 -#define _loop1_129_type 1298 -#define _loop0_130_type 1299 -#define _loop0_131_type 1300 -#define _tmp_132_type 1301 -#define _tmp_133_type 1302 -#define _loop0_135_type 1303 -#define _gather_134_type 1304 -#define _loop0_137_type 1305 -#define _gather_136_type 1306 -#define _loop0_139_type 1307 -#define _gather_138_type 1308 -#define _loop0_141_type 1309 -#define _gather_140_type 1310 -#define _loop0_142_type 1311 -#define _loop0_144_type 1312 -#define _gather_143_type 1313 -#define _tmp_145_type 1314 -#define _loop0_147_type 1315 -#define _gather_146_type 1316 -#define _loop0_149_type 1317 -#define _gather_148_type 1318 -#define _tmp_150_type 1319 -#define _loop0_151_type 1320 -#define _tmp_152_type 1321 -#define _tmp_153_type 1322 -#define _tmp_154_type 1323 -#define _tmp_155_type 1324 -#define _loop0_156_type 1325 -#define _tmp_157_type 1326 -#define _tmp_158_type 1327 -#define _tmp_159_type 1328 -#define _tmp_160_type 1329 -#define _tmp_161_type 1330 -#define _tmp_162_type 1331 -#define _tmp_163_type 1332 -#define _tmp_164_type 1333 -#define _tmp_165_type 1334 -#define _tmp_166_type 1335 -#define _tmp_167_type 1336 -#define _tmp_168_type 1337 -#define _tmp_169_type 1338 -#define _tmp_170_type 1339 -#define _tmp_171_type 1340 -#define _tmp_172_type 1341 -#define _tmp_173_type 1342 -#define _loop1_174_type 1343 -#define _tmp_175_type 1344 -#define _tmp_176_type 1345 +#define name_or_attr_type 1051 // Left-recursive +#define values_pattern_type 1052 +#define items_pattern_type 1053 +#define keyword_pattern_type 1054 +#define value_pattern_type 1055 +#define key_value_pattern_type 1056 +#define return_stmt_type 1057 +#define raise_stmt_type 1058 +#define function_def_type 1059 +#define function_def_raw_type 1060 +#define func_type_comment_type 1061 +#define params_type 1062 +#define parameters_type 1063 +#define slash_no_default_type 1064 +#define slash_with_default_type 1065 +#define star_etc_type 1066 +#define kwds_type 1067 +#define param_no_default_type 1068 +#define param_with_default_type 1069 +#define param_maybe_default_type 1070 +#define param_type 1071 +#define annotation_type 1072 +#define default_type 1073 +#define decorators_type 1074 +#define class_def_type 1075 +#define class_def_raw_type 1076 +#define block_type 1077 +#define expressions_list_type 1078 +#define star_expressions_type 1079 +#define star_expression_type 1080 +#define star_named_expressions_type 1081 +#define star_named_expression_type 1082 +#define named_expression_type 1083 +#define annotated_rhs_type 1084 +#define expressions_type 1085 +#define expression_type 1086 +#define lambdef_type 1087 +#define lambda_parameters_type 1088 +#define lambda_slash_no_default_type 1089 +#define lambda_slash_with_default_type 1090 +#define lambda_star_etc_type 1091 +#define lambda_kwds_type 1092 +#define lambda_param_no_default_type 1093 +#define lambda_param_with_default_type 1094 +#define lambda_param_maybe_default_type 1095 +#define lambda_param_type 1096 +#define disjunction_type 1097 +#define conjunction_type 1098 +#define inversion_type 1099 +#define comparison_type 1100 +#define compare_op_bitwise_or_pair_type 1101 +#define eq_bitwise_or_type 1102 +#define noteq_bitwise_or_type 1103 +#define lte_bitwise_or_type 1104 +#define lt_bitwise_or_type 1105 +#define gte_bitwise_or_type 1106 +#define gt_bitwise_or_type 1107 +#define notin_bitwise_or_type 1108 +#define in_bitwise_or_type 1109 +#define isnot_bitwise_or_type 1110 +#define is_bitwise_or_type 1111 +#define bitwise_or_type 1112 // Left-recursive +#define bitwise_xor_type 1113 // Left-recursive +#define bitwise_and_type 1114 // Left-recursive +#define shift_expr_type 1115 // Left-recursive +#define sum_type 1116 // Left-recursive +#define term_type 1117 // Left-recursive +#define factor_type 1118 +#define power_type 1119 +#define await_primary_type 1120 +#define primary_type 1121 // Left-recursive +#define slices_type 1122 +#define slice_type 1123 +#define atom_type 1124 +#define strings_type 1125 +#define list_type 1126 +#define listcomp_type 1127 +#define tuple_type 1128 +#define group_type 1129 +#define genexp_type 1130 +#define set_type 1131 +#define setcomp_type 1132 +#define dict_type 1133 +#define dictcomp_type 1134 +#define double_starred_kvpairs_type 1135 +#define double_starred_kvpair_type 1136 +#define kvpair_type 1137 +#define for_if_clauses_type 1138 +#define for_if_clause_type 1139 +#define yield_expr_type 1140 +#define arguments_type 1141 +#define args_type 1142 +#define kwargs_type 1143 +#define starred_expression_type 1144 +#define kwarg_or_starred_type 1145 +#define kwarg_or_double_starred_type 1146 +#define star_targets_type 1147 +#define star_targets_seq_type 1148 +#define star_target_type 1149 +#define star_atom_type 1150 +#define single_target_type 1151 +#define single_subscript_attribute_target_type 1152 +#define del_targets_type 1153 +#define del_target_type 1154 +#define del_t_atom_type 1155 +#define del_target_end_type 1156 +#define targets_type 1157 +#define target_type 1158 +#define t_primary_type 1159 // Left-recursive +#define t_lookahead_type 1160 +#define t_atom_type 1161 +#define incorrect_arguments_type 1162 +#define invalid_kwarg_type 1163 +#define invalid_named_expression_type 1164 +#define invalid_assignment_type 1165 +#define invalid_block_type 1166 +#define invalid_comprehension_type 1167 +#define invalid_dict_comprehension_type 1168 +#define invalid_parameters_type 1169 +#define invalid_star_etc_type 1170 +#define invalid_lambda_star_etc_type 1171 +#define invalid_double_type_comments_type 1172 +#define invalid_del_target_type 1173 +#define invalid_import_from_targets_type 1174 +#define _loop0_1_type 1175 +#define _loop0_2_type 1176 +#define _loop0_4_type 1177 +#define _gather_3_type 1178 +#define _loop0_6_type 1179 +#define _gather_5_type 1180 +#define _loop0_8_type 1181 +#define _gather_7_type 1182 +#define _loop0_10_type 1183 +#define _gather_9_type 1184 +#define _loop1_11_type 1185 +#define _loop0_13_type 1186 +#define _gather_12_type 1187 +#define _tmp_14_type 1188 +#define _tmp_15_type 1189 +#define _tmp_16_type 1190 +#define _tmp_17_type 1191 +#define _tmp_18_type 1192 +#define _tmp_19_type 1193 +#define _tmp_20_type 1194 +#define _tmp_21_type 1195 +#define _loop1_22_type 1196 +#define _tmp_23_type 1197 +#define _tmp_24_type 1198 +#define _loop0_26_type 1199 +#define _gather_25_type 1200 +#define _loop0_28_type 1201 +#define _gather_27_type 1202 +#define _tmp_29_type 1203 +#define _loop0_30_type 1204 +#define _loop1_31_type 1205 +#define _loop0_33_type 1206 +#define _gather_32_type 1207 +#define _tmp_34_type 1208 +#define _loop0_36_type 1209 +#define _gather_35_type 1210 +#define _tmp_37_type 1211 +#define _loop0_39_type 1212 +#define _gather_38_type 1213 +#define _loop0_41_type 1214 +#define _gather_40_type 1215 +#define _loop0_43_type 1216 +#define _gather_42_type 1217 +#define _loop0_45_type 1218 +#define _gather_44_type 1219 +#define _tmp_46_type 1220 +#define _loop1_47_type 1221 +#define _tmp_48_type 1222 +#define _loop1_49_type 1223 +#define _loop0_51_type 1224 +#define _gather_50_type 1225 +#define _tmp_52_type 1226 +#define _loop0_54_type 1227 +#define _gather_53_type 1228 +#define _loop0_56_type 1229 +#define _gather_55_type 1230 +#define _loop0_58_type 1231 +#define _gather_57_type 1232 +#define _loop0_60_type 1233 +#define _gather_59_type 1234 +#define _loop0_62_type 1235 +#define _gather_61_type 1236 +#define _loop0_64_type 1237 +#define _gather_63_type 1238 +#define _tmp_65_type 1239 +#define _tmp_66_type 1240 +#define _tmp_67_type 1241 +#define _tmp_68_type 1242 +#define _loop0_69_type 1243 +#define _loop0_70_type 1244 +#define _loop0_71_type 1245 +#define _loop1_72_type 1246 +#define _loop0_73_type 1247 +#define _loop1_74_type 1248 +#define _loop1_75_type 1249 +#define _loop1_76_type 1250 +#define _loop0_77_type 1251 +#define _loop1_78_type 1252 +#define _loop0_79_type 1253 +#define _loop1_80_type 1254 +#define _loop0_81_type 1255 +#define _loop1_82_type 1256 +#define _loop1_83_type 1257 +#define _tmp_84_type 1258 +#define _loop0_86_type 1259 +#define _gather_85_type 1260 +#define _loop1_87_type 1261 +#define _loop0_89_type 1262 +#define _gather_88_type 1263 +#define _loop1_90_type 1264 +#define _loop0_91_type 1265 +#define _loop0_92_type 1266 +#define _loop0_93_type 1267 +#define _loop1_94_type 1268 +#define _loop0_95_type 1269 +#define _loop1_96_type 1270 +#define _loop1_97_type 1271 +#define _loop1_98_type 1272 +#define _loop0_99_type 1273 +#define _loop1_100_type 1274 +#define _loop0_101_type 1275 +#define _loop1_102_type 1276 +#define _loop0_103_type 1277 +#define _loop1_104_type 1278 +#define _loop1_105_type 1279 +#define _loop1_106_type 1280 +#define _loop1_107_type 1281 +#define _tmp_108_type 1282 +#define _loop0_110_type 1283 +#define _gather_109_type 1284 +#define _tmp_111_type 1285 +#define _tmp_112_type 1286 +#define _tmp_113_type 1287 +#define _tmp_114_type 1288 +#define _loop1_115_type 1289 +#define _tmp_116_type 1290 +#define _tmp_117_type 1291 +#define _loop0_119_type 1292 +#define _gather_118_type 1293 +#define _loop1_120_type 1294 +#define _loop0_121_type 1295 +#define _loop0_122_type 1296 +#define _tmp_123_type 1297 +#define _tmp_124_type 1298 +#define _loop0_126_type 1299 +#define _gather_125_type 1300 +#define _loop0_128_type 1301 +#define _gather_127_type 1302 +#define _loop0_130_type 1303 +#define _gather_129_type 1304 +#define _loop0_132_type 1305 +#define _gather_131_type 1306 +#define _loop0_133_type 1307 +#define _loop0_135_type 1308 +#define _gather_134_type 1309 +#define _tmp_136_type 1310 +#define _loop0_138_type 1311 +#define _gather_137_type 1312 +#define _loop0_140_type 1313 +#define _gather_139_type 1314 +#define _tmp_141_type 1315 +#define _loop0_142_type 1316 +#define _tmp_143_type 1317 +#define _tmp_144_type 1318 +#define _tmp_145_type 1319 +#define _tmp_146_type 1320 +#define _loop0_147_type 1321 +#define _tmp_148_type 1322 +#define _tmp_149_type 1323 +#define _tmp_150_type 1324 +#define _tmp_151_type 1325 +#define _tmp_152_type 1326 +#define _tmp_153_type 1327 +#define _tmp_154_type 1328 +#define _tmp_155_type 1329 +#define _tmp_156_type 1330 +#define _tmp_157_type 1331 +#define _tmp_158_type 1332 +#define _tmp_159_type 1333 +#define _tmp_160_type 1334 +#define _tmp_161_type 1335 +#define _loop1_162_type 1336 +#define _tmp_163_type 1337 +#define _tmp_164_type 1338 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -463,6 +456,7 @@ static asdl_seq* finally_block_rule(Parser *p); static stmt_ty match_stmt_rule(Parser *p); static void *case_block_rule(Parser *p); static void *pattern_rule(Parser *p); +static void *guard_rule(Parser *p); static void *or_pattern_rule(Parser *p); static void *closed_pattern_rule(Parser *p); static void *name_pattern_rule(Parser *p); @@ -471,9 +465,13 @@ static void *constant_pattern_rule(Parser *p); static void *group_pattern_rule(Parser *p); static void *sequence_pattern_rule(Parser *p); static void *mapping_pattern_rule(Parser *p); -static void *key_pattern_rule(Parser *p); static void *class_pattern_rule(Parser *p); -static void *pattern_args_rule(Parser *p); +static void *name_or_attr_rule(Parser *p); +static void *values_pattern_rule(Parser *p); +static void *items_pattern_rule(Parser *p); +static void *keyword_pattern_rule(Parser *p); +static void *value_pattern_rule(Parser *p); +static void *key_value_pattern_rule(Parser *p); static stmt_ty return_stmt_rule(Parser *p); static stmt_ty raise_stmt_rule(Parser *p); static stmt_ty function_def_rule(Parser *p); @@ -641,133 +639,121 @@ static void *_tmp_46_rule(Parser *p); static asdl_seq *_loop1_47_rule(Parser *p); static void *_tmp_48_rule(Parser *p); static asdl_seq *_loop1_49_rule(Parser *p); -static void *_tmp_50_rule(Parser *p); -static asdl_seq *_loop0_52_rule(Parser *p); -static asdl_seq *_gather_51_rule(Parser *p); -static void *_tmp_53_rule(Parser *p); -static asdl_seq *_loop0_55_rule(Parser *p); -static asdl_seq *_gather_54_rule(Parser *p); -static asdl_seq *_loop0_57_rule(Parser *p); -static asdl_seq *_gather_56_rule(Parser *p); -static asdl_seq *_loop0_59_rule(Parser *p); -static asdl_seq *_gather_58_rule(Parser *p); -static asdl_seq *_loop0_61_rule(Parser *p); -static asdl_seq *_gather_60_rule(Parser *p); -static asdl_seq *_loop0_63_rule(Parser *p); -static asdl_seq *_gather_62_rule(Parser *p); -static asdl_seq *_loop0_65_rule(Parser *p); -static asdl_seq *_gather_64_rule(Parser *p); -static asdl_seq *_loop0_67_rule(Parser *p); -static asdl_seq *_gather_66_rule(Parser *p); +static asdl_seq *_loop0_51_rule(Parser *p); +static asdl_seq *_gather_50_rule(Parser *p); +static void *_tmp_52_rule(Parser *p); +static asdl_seq *_loop0_54_rule(Parser *p); +static asdl_seq *_gather_53_rule(Parser *p); +static asdl_seq *_loop0_56_rule(Parser *p); +static asdl_seq *_gather_55_rule(Parser *p); +static asdl_seq *_loop0_58_rule(Parser *p); +static asdl_seq *_gather_57_rule(Parser *p); +static asdl_seq *_loop0_60_rule(Parser *p); +static asdl_seq *_gather_59_rule(Parser *p); +static asdl_seq *_loop0_62_rule(Parser *p); +static asdl_seq *_gather_61_rule(Parser *p); +static asdl_seq *_loop0_64_rule(Parser *p); +static asdl_seq *_gather_63_rule(Parser *p); +static void *_tmp_65_rule(Parser *p); +static void *_tmp_66_rule(Parser *p); +static void *_tmp_67_rule(Parser *p); +static void *_tmp_68_rule(Parser *p); static asdl_seq *_loop0_69_rule(Parser *p); -static asdl_seq *_gather_68_rule(Parser *p); +static asdl_seq *_loop0_70_rule(Parser *p); static asdl_seq *_loop0_71_rule(Parser *p); -static asdl_seq *_gather_70_rule(Parser *p); +static asdl_seq *_loop1_72_rule(Parser *p); static asdl_seq *_loop0_73_rule(Parser *p); -static asdl_seq *_gather_72_rule(Parser *p); -static void *_tmp_74_rule(Parser *p); -static void *_tmp_75_rule(Parser *p); -static void *_tmp_76_rule(Parser *p); -static void *_tmp_77_rule(Parser *p); -static asdl_seq *_loop0_78_rule(Parser *p); +static asdl_seq *_loop1_74_rule(Parser *p); +static asdl_seq *_loop1_75_rule(Parser *p); +static asdl_seq *_loop1_76_rule(Parser *p); +static asdl_seq *_loop0_77_rule(Parser *p); +static asdl_seq *_loop1_78_rule(Parser *p); static asdl_seq *_loop0_79_rule(Parser *p); -static asdl_seq *_loop0_80_rule(Parser *p); -static asdl_seq *_loop1_81_rule(Parser *p); -static asdl_seq *_loop0_82_rule(Parser *p); +static asdl_seq *_loop1_80_rule(Parser *p); +static asdl_seq *_loop0_81_rule(Parser *p); +static asdl_seq *_loop1_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static asdl_seq *_loop1_84_rule(Parser *p); -static asdl_seq *_loop1_85_rule(Parser *p); +static void *_tmp_84_rule(Parser *p); static asdl_seq *_loop0_86_rule(Parser *p); +static asdl_seq *_gather_85_rule(Parser *p); static asdl_seq *_loop1_87_rule(Parser *p); -static asdl_seq *_loop0_88_rule(Parser *p); -static asdl_seq *_loop1_89_rule(Parser *p); -static asdl_seq *_loop0_90_rule(Parser *p); -static asdl_seq *_loop1_91_rule(Parser *p); -static asdl_seq *_loop1_92_rule(Parser *p); -static void *_tmp_93_rule(Parser *p); +static asdl_seq *_loop0_89_rule(Parser *p); +static asdl_seq *_gather_88_rule(Parser *p); +static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop0_91_rule(Parser *p); +static asdl_seq *_loop0_92_rule(Parser *p); +static asdl_seq *_loop0_93_rule(Parser *p); +static asdl_seq *_loop1_94_rule(Parser *p); static asdl_seq *_loop0_95_rule(Parser *p); -static asdl_seq *_gather_94_rule(Parser *p); static asdl_seq *_loop1_96_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_gather_97_rule(Parser *p); -static asdl_seq *_loop1_99_rule(Parser *p); -static asdl_seq *_loop0_100_rule(Parser *p); +static asdl_seq *_loop1_97_rule(Parser *p); +static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop0_99_rule(Parser *p); +static asdl_seq *_loop1_100_rule(Parser *p); static asdl_seq *_loop0_101_rule(Parser *p); -static asdl_seq *_loop0_102_rule(Parser *p); -static asdl_seq *_loop1_103_rule(Parser *p); -static asdl_seq *_loop0_104_rule(Parser *p); +static asdl_seq *_loop1_102_rule(Parser *p); +static asdl_seq *_loop0_103_rule(Parser *p); +static asdl_seq *_loop1_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); static asdl_seq *_loop1_106_rule(Parser *p); static asdl_seq *_loop1_107_rule(Parser *p); -static asdl_seq *_loop0_108_rule(Parser *p); -static asdl_seq *_loop1_109_rule(Parser *p); +static void *_tmp_108_rule(Parser *p); static asdl_seq *_loop0_110_rule(Parser *p); -static asdl_seq *_loop1_111_rule(Parser *p); -static asdl_seq *_loop0_112_rule(Parser *p); -static asdl_seq *_loop1_113_rule(Parser *p); -static asdl_seq *_loop1_114_rule(Parser *p); +static asdl_seq *_gather_109_rule(Parser *p); +static void *_tmp_111_rule(Parser *p); +static void *_tmp_112_rule(Parser *p); +static void *_tmp_113_rule(Parser *p); +static void *_tmp_114_rule(Parser *p); static asdl_seq *_loop1_115_rule(Parser *p); -static asdl_seq *_loop1_116_rule(Parser *p); +static void *_tmp_116_rule(Parser *p); static void *_tmp_117_rule(Parser *p); static asdl_seq *_loop0_119_rule(Parser *p); static asdl_seq *_gather_118_rule(Parser *p); -static void *_tmp_120_rule(Parser *p); -static void *_tmp_121_rule(Parser *p); -static void *_tmp_122_rule(Parser *p); +static asdl_seq *_loop1_120_rule(Parser *p); +static asdl_seq *_loop0_121_rule(Parser *p); +static asdl_seq *_loop0_122_rule(Parser *p); static void *_tmp_123_rule(Parser *p); -static asdl_seq *_loop1_124_rule(Parser *p); -static void *_tmp_125_rule(Parser *p); -static void *_tmp_126_rule(Parser *p); +static void *_tmp_124_rule(Parser *p); +static asdl_seq *_loop0_126_rule(Parser *p); +static asdl_seq *_gather_125_rule(Parser *p); static asdl_seq *_loop0_128_rule(Parser *p); static asdl_seq *_gather_127_rule(Parser *p); -static asdl_seq *_loop1_129_rule(Parser *p); static asdl_seq *_loop0_130_rule(Parser *p); -static asdl_seq *_loop0_131_rule(Parser *p); -static void *_tmp_132_rule(Parser *p); -static void *_tmp_133_rule(Parser *p); +static asdl_seq *_gather_129_rule(Parser *p); +static asdl_seq *_loop0_132_rule(Parser *p); +static asdl_seq *_gather_131_rule(Parser *p); +static asdl_seq *_loop0_133_rule(Parser *p); static asdl_seq *_loop0_135_rule(Parser *p); static asdl_seq *_gather_134_rule(Parser *p); -static asdl_seq *_loop0_137_rule(Parser *p); -static asdl_seq *_gather_136_rule(Parser *p); -static asdl_seq *_loop0_139_rule(Parser *p); -static asdl_seq *_gather_138_rule(Parser *p); -static asdl_seq *_loop0_141_rule(Parser *p); -static asdl_seq *_gather_140_rule(Parser *p); +static void *_tmp_136_rule(Parser *p); +static asdl_seq *_loop0_138_rule(Parser *p); +static asdl_seq *_gather_137_rule(Parser *p); +static asdl_seq *_loop0_140_rule(Parser *p); +static asdl_seq *_gather_139_rule(Parser *p); +static void *_tmp_141_rule(Parser *p); static asdl_seq *_loop0_142_rule(Parser *p); -static asdl_seq *_loop0_144_rule(Parser *p); -static asdl_seq *_gather_143_rule(Parser *p); +static void *_tmp_143_rule(Parser *p); +static void *_tmp_144_rule(Parser *p); static void *_tmp_145_rule(Parser *p); +static void *_tmp_146_rule(Parser *p); static asdl_seq *_loop0_147_rule(Parser *p); -static asdl_seq *_gather_146_rule(Parser *p); -static asdl_seq *_loop0_149_rule(Parser *p); -static asdl_seq *_gather_148_rule(Parser *p); +static void *_tmp_148_rule(Parser *p); +static void *_tmp_149_rule(Parser *p); static void *_tmp_150_rule(Parser *p); -static asdl_seq *_loop0_151_rule(Parser *p); +static void *_tmp_151_rule(Parser *p); static void *_tmp_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); static void *_tmp_155_rule(Parser *p); -static asdl_seq *_loop0_156_rule(Parser *p); +static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); static void *_tmp_159_rule(Parser *p); static void *_tmp_160_rule(Parser *p); static void *_tmp_161_rule(Parser *p); -static void *_tmp_162_rule(Parser *p); +static asdl_seq *_loop1_162_rule(Parser *p); static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); -static void *_tmp_165_rule(Parser *p); -static void *_tmp_166_rule(Parser *p); -static void *_tmp_167_rule(Parser *p); -static void *_tmp_168_rule(Parser *p); -static void *_tmp_169_rule(Parser *p); -static void *_tmp_170_rule(Parser *p); -static void *_tmp_171_rule(Parser *p); -static void *_tmp_172_rule(Parser *p); -static void *_tmp_173_rule(Parser *p); -static asdl_seq *_loop1_174_rule(Parser *p); -static void *_tmp_175_rule(Parser *p); -static void *_tmp_176_rule(Parser *p); // file: statements? $ @@ -4699,7 +4685,7 @@ match_stmt_rule(Parser *p) return _res; } -// case_block: "case" pattern ['if' named_expression] ':' block +// case_block: "case" pattern guard? ':' block static void * case_block_rule(Parser *p) { @@ -4710,12 +4696,12 @@ case_block_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // "case" pattern ['if' named_expression] ':' block + { // "case" pattern guard? ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern guard? ':' block")); expr_ty _keyword; Token * _literal; asdl_seq* body; @@ -4726,14 +4712,14 @@ case_block_rule(Parser *p) && (pattern = pattern_rule(p)) // pattern && - (guard = _tmp_50_rule(p), 1) // ['if' named_expression] + (guard = guard_rule(p), 1) // guard? && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (body = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern guard? ':' block")); _res = _Py_match_case ( pattern , guard , body , p -> arena ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -4744,7 +4730,7 @@ case_block_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern ['if' named_expression] ':' block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern guard? ':' block")); } _res = NULL; done: @@ -4779,14 +4765,14 @@ pattern_rule(Parser *p) } D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); Token * _literal; - expr_ty a; - void *b; + expr_ty target; + void *value; if ( - (a = _PyPegen_name_token(p)) // NAME + (target = _PyPegen_name_token(p)) // NAME && (_literal = _PyPegen_expect_token(p, 53)) // token=':=' && - (b = or_pattern_rule(p)) // or_pattern + (value = or_pattern_rule(p)) // or_pattern ) { D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); @@ -4799,7 +4785,7 @@ pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); + _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , target , Store ) ) , value , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4836,7 +4822,51 @@ pattern_rule(Parser *p) return _res; } -// or_pattern: '|'.closed_pattern+ +// guard: 'if' named_expression +static void * +guard_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'if' named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + Token * _keyword; + expr_ty guard; + if ( + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + && + (guard = named_expression_rule(p)) // named_expression + ) + { + D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + _res = guard; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// or_pattern: closed_pattern '|' '|'.closed_pattern+ | closed_pattern static void * or_pattern_rule(Parser *p) { @@ -4847,24 +4877,72 @@ or_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '|'.closed_pattern+ + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // closed_pattern '|' '|'.closed_pattern+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); + Token * _literal; + void *value; + asdl_seq * values; + if ( + (value = closed_pattern_rule(p)) // closed_pattern + && + (_literal = _PyPegen_expect_token(p, 18)) // token='|' + && + (values = _gather_50_rule(p)) // '|'.closed_pattern+ + ) + { + D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); + } + { // closed_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); - asdl_seq * _gather_51_var; + D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern")); + void *closed_pattern_var; if ( - (_gather_51_var = _gather_51_rule(p)) // '|'.closed_pattern+ + (closed_pattern_var = closed_pattern_rule(p)) // closed_pattern ) { - D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); - _res = _gather_51_var; + D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern")); + _res = closed_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern")); } _res = NULL; done: @@ -5050,11 +5128,11 @@ name_pattern_rule(Parser *p) if ( (a = _PyPegen_name_token(p)) // NAME && - _PyPegen_lookahead(0, _tmp_53_rule, p) + _PyPegen_lookahead(0, _tmp_52_rule, p) ) { D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(')")); - _res = a; + _res = _PyPegen_set_expr_context ( p , a , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5083,6 +5161,15 @@ literal_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro { // NUMBER if (p->error_indicator) { D(p->level--); @@ -5133,7 +5220,21 @@ literal_pattern_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); - _res = _keyword; + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Constant ( Py_None , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; @@ -5152,7 +5253,21 @@ literal_pattern_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); - _res = _keyword; + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Constant ( Py_True , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; @@ -5171,7 +5286,21 @@ literal_pattern_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); - _res = _keyword; + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Constant ( Py_False , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; @@ -5184,7 +5313,7 @@ literal_pattern_rule(Parser *p) return _res; } -// constant_pattern: '.' NAME | '.'.NAME+ !'(' +// constant_pattern: '.' NAME | name_or_attr '.' NAME !'(' static void * constant_pattern_rule(Parser *p) { @@ -5195,6 +5324,15 @@ constant_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro { // '.' NAME if (p->error_indicator) { D(p->level--); @@ -5202,36 +5340,56 @@ constant_pattern_rule(Parser *p) } D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); Token * _literal; - expr_ty name_var; + expr_ty name; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (name_var = _PyPegen_name_token(p)) // NAME + (name = _PyPegen_name_token(p)) // NAME ) { D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.' NAME")); - _res = _PyPegen_dummy_name(p, _literal, name_var); + _res = name; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); } - { // '.'.NAME+ !'(' + { // name_or_attr '.' NAME !'(' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ !'('")); - asdl_seq * a; + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME !'('")); + Token * _literal; + expr_ty attr; + void *value; if ( - (a = _gather_54_rule(p)) // '.'.NAME+ + (value = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + && + (attr = _PyPegen_name_token(p)) // NAME && _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='(' ) { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ !'('")); - _res = a; + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME !'('")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5241,7 +5399,7 @@ constant_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'.NAME+ !'('")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME !'('")); } _res = NULL; done: @@ -5268,17 +5426,17 @@ group_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); Token * _literal; Token * _literal_1; - void *a; + void *pattern; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = pattern_rule(p)) // pattern + (pattern = pattern_rule(p)) // pattern && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); - _res = a; + _res = pattern; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5296,7 +5454,7 @@ group_pattern_rule(Parser *p) return _res; } -// sequence_pattern: '[' ','.pattern+? ']' | '(' ','.pattern+? ')' +// sequence_pattern: '[' values_pattern ']' static void * sequence_pattern_rule(Parser *p) { @@ -5316,24 +5474,24 @@ sequence_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '[' ','.pattern+? ']' + { // '[' values_pattern ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' ','.pattern+? ']'")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' values_pattern ']'")); Token * _literal; Token * _literal_1; - void *a; + void *values; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (a = _gather_56_rule(p), 1) // ','.pattern+? + (values = values_pattern_rule(p)) // values_pattern && (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' ','.pattern+? ']'")); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' values_pattern ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5343,7 +5501,7 @@ sequence_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( a , Load , EXTRA ); + _res = _Py_List ( values , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5353,26 +5511,52 @@ sequence_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' ','.pattern+? ']'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' values_pattern ']'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// mapping_pattern: '{' items_pattern '}' +static void * +mapping_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // '(' ','.pattern+? ')' + void * _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '{' items_pattern '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ','.pattern+? ')'")); + D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern '}'")); Token * _literal; Token * _literal_1; - void *a; + void *items; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (a = _gather_58_rule(p), 1) // ','.pattern+? + (items = items_pattern_rule(p)) // items_pattern && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ','.pattern+? ')'")); + D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5382,7 +5566,7 @@ sequence_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( a , Load , EXTRA ); + _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , items ) ) , CHECK ( _PyPegen_get_values ( p , items ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5391,8 +5575,8 @@ sequence_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ','.pattern+? ')'")); + D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern '}'")); } _res = NULL; done: @@ -5400,9 +5584,13 @@ sequence_pattern_rule(Parser *p) return _res; } -// mapping_pattern: '{' ','.(key_pattern ':' closed_pattern)+ '}' +// class_pattern: +// | name_or_attr '(' ')' +// | name_or_attr '(' ','.pattern+ ','? ')' +// | name_or_attr '(' ','.keyword_pattern+ ','? ')' +// | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' static void * -mapping_pattern_rule(Parser *p) +class_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5411,25 +5599,43 @@ mapping_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '{' ','.(key_pattern ':' closed_pattern)+ '}' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // name_or_attr '(' ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); - asdl_seq * _gather_60_var; + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); Token * _literal; Token * _literal_1; + void *func; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + (func = name_or_attr_rule(p)) // name_or_attr && - (_gather_60_var = _gather_60_rule(p)) // ','.(key_pattern ':' closed_pattern)+ + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); - _res = NULL; + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , NULL , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5438,41 +5644,44 @@ mapping_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ','.(key_pattern ':' closed_pattern)+ '}'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// key_pattern: literal_pattern &':' | '|'.literal_pattern+ -static void * -key_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); } - void * _res = NULL; - int _mark = p->mark; - { // literal_pattern &':' + { // name_or_attr '(' ','.pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern &':'")); - void *a; - if ( - (a = literal_pattern_rule(p)) // literal_pattern - && - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * args; + void *func; + if ( + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (args = _gather_53_rule(p)) // ','.pattern+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ key_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern &':'")); - _res = a; + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , args , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5481,22 +5690,44 @@ key_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s key_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern &':'")); + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); } - { // '|'.literal_pattern+ + { // name_or_attr '(' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.literal_pattern+")); - asdl_seq * a; + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + void *func; + asdl_seq * keywords; if ( - (a = _gather_62_rule(p)) // '|'.literal_pattern+ + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (keywords = _gather_55_rule(p)) // ','.keyword_pattern+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ key_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.literal_pattern+")); - _res = NULL; + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , NULL , keywords , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5505,53 +5736,60 @@ key_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s key_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.literal_pattern+")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// class_pattern: '.'.NAME+ '(' pattern_args ')' -static void * -class_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); } - void * _res = NULL; - int _mark = p->mark; - { // '.'.NAME+ '(' pattern_args ')' + { // name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); - asdl_seq * _gather_64_var; + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); Token * _literal; Token * _literal_1; - void *pattern_args_var; + Token * _literal_2; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * args; + void *func; + asdl_seq * keywords; if ( - (_gather_64_var = _gather_64_rule(p)) // '.'.NAME+ + (func = name_or_attr_rule(p)) // name_or_attr && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (pattern_args_var = pattern_args_rule(p)) // pattern_args + (args = _gather_57_rule(p)) // ','.pattern+ && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (keywords = _gather_59_rule(p)) // ','.keyword_pattern+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); - _res = _PyPegen_dummy_name(p, _gather_64_var, _literal, pattern_args_var, _literal_1); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , args , keywords , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'.NAME+ '(' pattern_args ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); } _res = NULL; done: @@ -5559,12 +5797,39 @@ class_pattern_rule(Parser *p) return _res; } -// pattern_args: -// | ','.pattern+ ',' ','.(NAME '=' or_pattern)+ -// | ','.(NAME '=' or_pattern)+ -// | ','.pattern+ +// Left-recursive +// name_or_attr: name_or_attr '.' NAME | NAME +static void * name_or_attr_raw(Parser *); +static void * +name_or_attr_rule(Parser *p) +{ + D(p->level++); + void * _res = NULL; + if (_PyPegen_is_memoized(p, name_or_attr_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_1 = _PyPegen_update_memo(p, _mark, name_or_attr_type, _res); + if (tmpvar_1) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = name_or_attr_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} static void * -pattern_args_rule(Parser *p) +name_or_attr_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5573,25 +5838,43 @@ pattern_args_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ','.pattern+ ',' ','.(NAME '=' or_pattern)+ + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // name_or_attr '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); - asdl_seq * _gather_66_var; - asdl_seq * _gather_68_var; + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token * _literal; + expr_ty attr; + void *value; if ( - (_gather_66_var = _gather_66_rule(p)) // ','.pattern+ + (value = name_or_attr_rule(p)) // name_or_attr && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (_gather_68_var = _gather_68_rule(p)) // ','.(NAME '=' or_pattern)+ + (attr = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); - _res = NULL; + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5600,22 +5883,62 @@ pattern_args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ',' ','.(NAME '=' or_pattern)+")); + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); + } + { // NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty name_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = name_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// values_pattern: ','.value_pattern+ ','? +static void * +values_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // ','.(NAME '=' or_pattern)+ + void * _res = NULL; + int _mark = p->mark; + { // ','.value_pattern+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(NAME '=' or_pattern)+")); - asdl_seq * _gather_70_var; + D(fprintf(stderr, "%*c> values_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.value_pattern+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * values; if ( - (_gather_70_var = _gather_70_rule(p)) // ','.(NAME '=' or_pattern)+ + (values = _gather_61_rule(p)) // ','.value_pattern+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(NAME '=' or_pattern)+")); - _res = NULL; + D(fprintf(stderr, "%*c+ values_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.value_pattern+ ','?")); + _res = values; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5624,22 +5947,43 @@ pattern_args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(NAME '=' or_pattern)+")); + D(fprintf(stderr, "%*c%s values_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.value_pattern+ ','?")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// items_pattern: ','.key_value_pattern+ ','? +static void * +items_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // ','.pattern+ + void * _res = NULL; + int _mark = p->mark; + { // ','.key_value_pattern+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern_args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); - asdl_seq * a; + D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_seq * items; if ( - (a = _gather_72_rule(p)) // ','.pattern+ + (items = _gather_63_rule(p)) // ','.key_value_pattern+ + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ pattern_args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); - _res = a; + D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+ ','?")); + _res = items; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5648,8 +5992,8 @@ pattern_args_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern_args[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); + D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+ ','?")); } _res = NULL; done: @@ -5657,16 +6001,16 @@ pattern_args_rule(Parser *p) return _res; } -// return_stmt: 'return' star_expressions? -static stmt_ty -return_stmt_rule(Parser *p) +// keyword_pattern: NAME '=' or_pattern +static void * +keyword_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5677,21 +6021,24 @@ return_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'return' star_expressions? + { // NAME '=' or_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); - Token * _keyword; - void *a; + D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + Token * _literal; + expr_ty arg; + void *value; if ( - (_keyword = _PyPegen_expect_token(p, 500)) // token='return' + (arg = _PyPegen_name_token(p)) // NAME && - (a = star_expressions_rule(p), 1) // star_expressions? + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + && + (value = or_pattern_rule(p)) // or_pattern ) { - D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5701,7 +6048,7 @@ return_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Return ( a , EXTRA ); + _res = _Py_keyword ( arg -> v . Name . id , value , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5710,8 +6057,8 @@ return_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); + D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); } _res = NULL; done: @@ -5719,16 +6066,16 @@ return_stmt_rule(Parser *p) return _res; } -// raise_stmt: 'raise' expression ['from' expression] | 'raise' -static stmt_ty -raise_stmt_rule(Parser *p) +// value_pattern: '*' name_pattern | pattern +static void * +value_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5739,24 +6086,21 @@ raise_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'raise' expression ['from' expression] + { // '*' name_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); - Token * _keyword; - expr_ty a; - void *b; + D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' name_pattern")); + Token * _literal; + void *value; if ( - (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' - && - (a = expression_rule(p)) // expression + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (b = _tmp_74_rule(p), 1) // ['from' expression] + (value = name_pattern_rule(p)) // name_pattern ) { - D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); + D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' name_pattern")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5766,7 +6110,7 @@ raise_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Raise ( a , b , EXTRA ); + _res = _Py_Starred ( value , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5775,41 +6119,27 @@ raise_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); + D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' name_pattern")); } - { // 'raise' + { // pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); - Token * _keyword; + D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + void *pattern_var; if ( - (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' + (pattern_var = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Raise ( NULL , NULL , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); + D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); } _res = NULL; done: @@ -5817,23 +6147,290 @@ raise_stmt_rule(Parser *p) return _res; } -// function_def: decorators function_def_raw | function_def_raw -static stmt_ty -function_def_rule(Parser *p) +// key_value_pattern: +// | literal_pattern ':' closed_pattern +// | constant_pattern ':' closed_pattern +// | '**' name_pattern +static void * +key_value_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // decorators function_def_raw + { // literal_pattern ':' closed_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern ':' closed_pattern")); + Token * _literal; + void *key; + void *value; + if ( + (key = literal_pattern_rule(p)) // literal_pattern + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (value = closed_pattern_rule(p)) // closed_pattern + ) + { + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern ':' closed_pattern")); + _res = _PyPegen_key_value_pair ( p , key , value ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern ':' closed_pattern")); + } + { // constant_pattern ':' closed_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern ':' closed_pattern")); + Token * _literal; + void *key; + void *value; + if ( + (key = constant_pattern_rule(p)) // constant_pattern + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (value = closed_pattern_rule(p)) // closed_pattern + ) + { + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern ':' closed_pattern")); + _res = _PyPegen_key_value_pair ( p , key , value ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern ':' closed_pattern")); + } + { // '**' name_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' name_pattern")); + Token * _literal; + void *value; + if ( + (_literal = _PyPegen_expect_token(p, 35)) // token='**' + && + (value = name_pattern_rule(p)) // name_pattern + ) + { + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' name_pattern")); + _res = _PyPegen_key_value_pair ( p , NULL , value ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' name_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// return_stmt: 'return' star_expressions? +static stmt_ty +return_stmt_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + stmt_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'return' star_expressions? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + Token * _keyword; + void *a; + if ( + (_keyword = _PyPegen_expect_token(p, 500)) // token='return' + && + (a = star_expressions_rule(p), 1) // star_expressions? + ) + { + D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Return ( a , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// raise_stmt: 'raise' expression ['from' expression] | 'raise' +static stmt_ty +raise_stmt_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + stmt_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // 'raise' expression ['from' expression] + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); + Token * _keyword; + expr_ty a; + void *b; + if ( + (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' + && + (a = expression_rule(p)) // expression + && + (b = _tmp_65_rule(p), 1) // ['from' expression] + ) + { + D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Raise ( a , b , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); + } + { // 'raise' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); + Token * _keyword; + if ( + (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' + ) + { + D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Raise ( NULL , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// function_def: decorators function_def_raw | function_def_raw +static stmt_ty +function_def_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + stmt_ty _res = NULL; + int _mark = p->mark; + { // decorators function_def_raw + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); asdl_seq* d; stmt_ty f; if ( @@ -5928,7 +6525,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_75_rule(p), 1) // ['->' expression] + (a = _tmp_66_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -5988,7 +6585,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_76_rule(p), 1) // ['->' expression] + (a = _tmp_67_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6052,7 +6649,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_77_rule, p) + _PyPegen_lookahead(1, _tmp_68_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -6196,9 +6793,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_78_rule(p)) // param_no_default* + (b = _loop0_69_rule(p)) // param_no_default* && - (c = _loop0_79_rule(p)) // param_with_default* + (c = _loop0_70_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -6228,7 +6825,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_80_rule(p)) // param_with_default* + (b = _loop0_71_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -6256,9 +6853,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_81_rule(p)) // param_no_default+ + (a = _loop1_72_rule(p)) // param_no_default+ && - (b = _loop0_82_rule(p)) // param_with_default* + (b = _loop0_73_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -6285,7 +6882,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_83_rule(p)) // param_with_default+ + (a = _loop1_74_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -6354,7 +6951,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_84_rule(p)) // param_no_default+ + (a = _loop1_75_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -6383,7 +6980,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_85_rule(p)) // param_no_default+ + (a = _loop1_76_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -6433,9 +7030,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_86_rule(p)) // param_no_default* + (a = _loop0_77_rule(p)) // param_no_default* && - (b = _loop1_87_rule(p)) // param_with_default+ + (b = _loop1_78_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -6465,9 +7062,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_88_rule(p)) // param_no_default* + (a = _loop0_79_rule(p)) // param_no_default* && - (b = _loop1_89_rule(p)) // param_with_default+ + (b = _loop1_80_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -6523,7 +7120,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_90_rule(p)) // param_maybe_default* + (b = _loop0_81_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -6556,7 +7153,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_91_rule(p)) // param_maybe_default+ + (b = _loop1_82_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -7078,7 +7675,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_92_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_83_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -7199,7 +7796,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_93_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_84_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7348,7 +7945,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_94_rule(p)) // ','.star_expression+ + (a = _gather_85_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -7408,7 +8005,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_96_rule(p)) // ((',' star_expression))+ + (b = _loop1_87_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -7603,7 +8200,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_97_rule(p)) // ','.star_named_expression+ + (a = _gather_88_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -7901,7 +8498,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_99_rule(p)) // ((',' expression))+ + (b = _loop1_90_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8200,9 +8797,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_100_rule(p)) // lambda_param_no_default* + (b = _loop0_91_rule(p)) // lambda_param_no_default* && - (c = _loop0_101_rule(p)) // lambda_param_with_default* + (c = _loop0_92_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8232,7 +8829,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_102_rule(p)) // lambda_param_with_default* + (b = _loop0_93_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8260,9 +8857,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_103_rule(p)) // lambda_param_no_default+ + (a = _loop1_94_rule(p)) // lambda_param_no_default+ && - (b = _loop0_104_rule(p)) // lambda_param_with_default* + (b = _loop0_95_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8289,7 +8886,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_105_rule(p)) // lambda_param_with_default+ + (a = _loop1_96_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8360,7 +8957,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_106_rule(p)) // lambda_param_no_default+ + (a = _loop1_97_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -8389,7 +8986,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_107_rule(p)) // lambda_param_no_default+ + (a = _loop1_98_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -8439,9 +9036,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_108_rule(p)) // lambda_param_no_default* + (a = _loop0_99_rule(p)) // lambda_param_no_default* && - (b = _loop1_109_rule(p)) // lambda_param_with_default+ + (b = _loop1_100_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -8471,9 +9068,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_110_rule(p)) // lambda_param_no_default* + (a = _loop0_101_rule(p)) // lambda_param_no_default* && - (b = _loop1_111_rule(p)) // lambda_param_with_default+ + (b = _loop1_102_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -8529,7 +9126,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_112_rule(p)) // lambda_param_maybe_default* + (b = _loop0_103_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -8562,7 +9159,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_113_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_104_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -8989,7 +9586,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_114_rule(p)) // (('or' conjunction))+ + (b = _loop1_105_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -9075,7 +9672,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_115_rule(p)) // (('and' inversion))+ + (b = _loop1_106_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -9243,7 +9840,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_116_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_107_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -9571,10 +10168,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_117_var; + void *_tmp_108_var; expr_ty a; if ( - (_tmp_117_var = _tmp_117_rule(p)) // '!=' + (_tmp_108_var = _tmp_108_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -9971,8 +10568,8 @@ bitwise_or_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); - if (tmpvar_1) { + int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); + if (tmpvar_2) { D(p->level--); return _res; } @@ -10085,8 +10682,8 @@ bitwise_xor_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); - if (tmpvar_2) { + int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); + if (tmpvar_3) { D(p->level--); return _res; } @@ -10199,8 +10796,8 @@ bitwise_and_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); - if (tmpvar_3) { + int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); + if (tmpvar_4) { D(p->level--); return _res; } @@ -10313,8 +10910,8 @@ shift_expr_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); - if (tmpvar_4) { + int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); + if (tmpvar_5) { D(p->level--); return _res; } @@ -10466,8 +11063,8 @@ sum_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res); - if (tmpvar_5) { + int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res); + if (tmpvar_6) { D(p->level--); return _res; } @@ -10625,8 +11222,8 @@ term_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res); - if (tmpvar_6) { + int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res); + if (tmpvar_7) { D(p->level--); return _res; } @@ -11228,8 +11825,8 @@ primary_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res); - if (tmpvar_7) { + int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res); + if (tmpvar_8) { D(p->level--); return _res; } @@ -11503,7 +12100,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_118_rule(p)) // ','.slice+ + (a = _gather_109_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -11573,7 +12170,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_120_rule(p), 1) // [':' expression?] + (c = _tmp_111_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -11847,15 +12444,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_121_var; + void *_tmp_112_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_121_var = _tmp_121_rule(p)) // tuple | group | genexp + (_tmp_112_var = _tmp_112_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_121_var; + _res = _tmp_112_var; goto done; } p->mark = _mark; @@ -11868,15 +12465,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_122_var; + void *_tmp_113_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_122_var = _tmp_122_rule(p)) // list | listcomp + (_tmp_113_var = _tmp_113_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_122_var; + _res = _tmp_113_var; goto done; } p->mark = _mark; @@ -11889,15 +12486,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_123_var; + void *_tmp_114_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_123_var = _tmp_123_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_114_var = _tmp_114_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_123_var; + _res = _tmp_114_var; goto done; } p->mark = _mark; @@ -11966,7 +12563,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_124_rule(p)) // STRING+ + (a = _loop1_115_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -12173,7 +12770,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_125_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_116_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -12229,7 +12826,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_126_rule(p)) // yield_expr | named_expression + (a = _tmp_117_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -12665,7 +13262,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_127_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_118_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12816,13 +13413,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_129_var; + asdl_seq * _loop1_120_var; if ( - (_loop1_129_var = _loop1_129_rule(p)) // for_if_clause+ + (_loop1_120_var = _loop1_120_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_129_var; + _res = _loop1_120_var; goto done; } p->mark = _mark; @@ -12871,7 +13468,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_130_rule(p)) // (('if' disjunction))* + (c = _loop0_121_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -12907,7 +13504,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_131_rule(p)) // (('if' disjunction))* + (c = _loop0_122_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13132,7 +13729,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_132_rule(p), 1) // [',' args] + (b = _tmp_123_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -13201,7 +13798,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_133_rule(p), 1) // [',' args] + (b = _tmp_124_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -13256,11 +13853,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_134_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_125_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_127_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -13282,13 +13879,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_138_var; + asdl_seq * _gather_129_var; if ( - (_gather_138_var = _gather_138_rule(p)) // ','.kwarg_or_starred+ + (_gather_129_var = _gather_129_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_138_var; + _res = _gather_129_var; goto done; } p->mark = _mark; @@ -13301,13 +13898,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_140_var; + asdl_seq * _gather_131_var; if ( - (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_140_var; + _res = _gather_131_var; goto done; } p->mark = _mark; @@ -13669,7 +14266,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_142_rule(p)) // ((',' star_target))* + (b = _loop0_133_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13723,7 +14320,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_143_rule(p)) // ','.star_target+ + (a = _gather_134_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13786,7 +14383,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_145_rule(p)) // !'*' star_target + (a = _tmp_136_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -14308,7 +14905,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_146_rule(p)) // ','.del_target+ + (a = _gather_137_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14787,7 +15384,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_148_rule(p)) // ','.target+ + (a = _gather_139_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14969,8 +15566,8 @@ t_primary_rule(Parser *p) int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); - if (tmpvar_8) { + int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); + if (tmpvar_9) { D(p->level--); return _res; } @@ -15499,7 +16096,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_150_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_141_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -15781,14 +16378,14 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_151_var; + asdl_seq * _loop0_142_var; expr_ty a; if ( (a = star_named_expression_rule(p)) // star_named_expression && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_151_var = _loop0_151_rule(p)) // star_named_expressions* + (_loop0_142_var = _loop0_142_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -15824,7 +16421,7 @@ invalid_assignment_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_152_rule(p), 1) // ['=' annotated_rhs] + (_opt_var = _tmp_143_rule(p), 1) // ['=' annotated_rhs] ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); @@ -15847,14 +16444,14 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); Token * _literal; - void *_tmp_153_var; + void *_tmp_144_var; expr_ty a; if ( (a = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions + (_tmp_144_var = _tmp_144_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); @@ -15876,7 +16473,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_154_var; + void *_tmp_145_var; expr_ty a; AugOperator* augassign_var; if ( @@ -15884,7 +16481,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_154_var = _tmp_154_rule(p)) // yield_expr | star_expressions + (_tmp_145_var = _tmp_145_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -15966,11 +16563,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_155_var; + void *_tmp_146_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_155_var = _tmp_155_rule(p)) // '[' | '(' | '{' + (_tmp_146_var = _tmp_146_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -16067,13 +16664,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_156_var; - void *_tmp_157_var; + asdl_seq * _loop0_147_var; + void *_tmp_148_var; arg_ty param_no_default_var; if ( - (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* + (_loop0_147_var = _loop0_147_rule(p)) // param_no_default* && - (_tmp_157_var = _tmp_157_rule(p)) // slash_with_default | param_with_default+ + (_tmp_148_var = _tmp_148_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -16115,11 +16712,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_158_var; + void *_tmp_149_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_158_var = _tmp_158_rule(p)) // ')' | ',' (')' | '**') + (_tmp_149_var = _tmp_149_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -16189,11 +16786,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_159_var; + void *_tmp_150_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_159_var = _tmp_159_rule(p)) // ':' | ',' (':' | '**') + (_tmp_150_var = _tmp_150_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -17603,12 +18200,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_160_var; + void *_tmp_151_var; while ( - (_tmp_160_var = _tmp_160_rule(p)) // star_targets '=' + (_tmp_151_var = _tmp_151_rule(p)) // star_targets '=' ) { - _res = _tmp_160_var; + _res = _tmp_151_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17736,439 +18333,30 @@ _tmp_24_rule(Parser *p) if (p->error_indicator) { D(p->level--); return NULL; - } - D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); - expr_ty star_expressions_var; - if ( - (star_expressions_var = star_expressions_rule(p)) // star_expressions - ) - { - D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); - _res = star_expressions_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_26: ',' NAME -static asdl_seq * -_loop0_26_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = _PyPegen_name_token(p)) // NAME - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_25: NAME _loop0_26 -static asdl_seq * -_gather_25_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // NAME _loop0_26 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = _PyPegen_name_token(p)) // NAME - && - (seq = _loop0_26_rule(p)) // _loop0_26 - ) - { - D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_28: ',' NAME -static asdl_seq * -_loop0_28_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = _PyPegen_name_token(p)) // NAME - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_27: NAME _loop0_28 -static asdl_seq * -_gather_27_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // NAME _loop0_28 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = _PyPegen_name_token(p)) // NAME - && - (seq = _loop0_28_rule(p)) // _loop0_28 - ) - { - D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_29: ',' expression -static void * -_tmp_29_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ',' expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); - Token * _literal; - expr_ty z; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (z = expression_rule(p)) // expression - ) - { - D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_30: ('.' | '...') -static asdl_seq * -_loop0_30_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ('.' | '...') - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_161_var; - while ( - (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' - ) - { - _res = _tmp_161_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); - D(p->level--); - return _seq; -} - -// _loop1_31: ('.' | '...') -static asdl_seq * -_loop1_31_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ('.' | '...') - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_162_var; - while ( - (_tmp_162_var = _tmp_162_rule(p)) // '.' | '...' + } + D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + expr_ty star_expressions_var; + if ( + (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - _res = _tmp_162_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + _res = star_expressions_var; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _loop0_33: ',' import_from_as_name +// _loop0_26: ',' NAME static asdl_seq * -_loop0_33_rule(Parser *p) +_loop0_26_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18187,18 +18375,18 @@ _loop0_33_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' import_from_as_name + { // ',' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); + D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); Token * _literal; - alias_ty elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = import_from_as_name_rule(p)) // import_from_as_name + (elem = _PyPegen_name_token(p)) // NAME ) { _res = elem; @@ -18223,8 +18411,8 @@ _loop0_33_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); + D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -18236,14 +18424,14 @@ _loop0_33_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); D(p->level--); return _seq; } -// _gather_32: import_from_as_name _loop0_33 +// _gather_25: NAME _loop0_26 static asdl_seq * -_gather_32_rule(Parser *p) +_gather_25_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18252,71 +18440,27 @@ _gather_32_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // import_from_as_name _loop0_33 + { // NAME _loop0_26 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); - alias_ty elem; + D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); + expr_ty elem; asdl_seq * seq; if ( - (elem = import_from_as_name_rule(p)) // import_from_as_name + (elem = _PyPegen_name_token(p)) // NAME && - (seq = _loop0_33_rule(p)) // _loop0_33 + (seq = _loop0_26_rule(p)) // _loop0_26 ) { - D(fprintf(stderr, "%*c+ _gather_32[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); + D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_33")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_34: 'as' NAME -static void * -_tmp_34_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'as' NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' - && - (z = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); } _res = NULL; done: @@ -18324,9 +18468,9 @@ _tmp_34_rule(Parser *p) return _res; } -// _loop0_36: ',' dotted_as_name +// _loop0_28: ',' NAME static asdl_seq * -_loop0_36_rule(Parser *p) +_loop0_28_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18345,18 +18489,18 @@ _loop0_36_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' dotted_as_name + { // ',' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); + D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); Token * _literal; - alias_ty elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = dotted_as_name_rule(p)) // dotted_as_name + (elem = _PyPegen_name_token(p)) // NAME ) { _res = elem; @@ -18381,8 +18525,8 @@ _loop0_36_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); + D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -18394,14 +18538,14 @@ _loop0_36_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); D(p->level--); return _seq; } -// _gather_35: dotted_as_name _loop0_36 +// _gather_27: NAME _loop0_28 static asdl_seq * -_gather_35_rule(Parser *p) +_gather_27_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18410,27 +18554,27 @@ _gather_35_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // dotted_as_name _loop0_36 + { // NAME _loop0_28 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); - alias_ty elem; + D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); + expr_ty elem; asdl_seq * seq; if ( - (elem = dotted_as_name_rule(p)) // dotted_as_name + (elem = _PyPegen_name_token(p)) // NAME && - (seq = _loop0_36_rule(p)) // _loop0_36 + (seq = _loop0_28_rule(p)) // _loop0_28 ) { - D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); + D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); + D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); } _res = NULL; done: @@ -18438,9 +18582,9 @@ _gather_35_rule(Parser *p) return _res; } -// _tmp_37: 'as' NAME +// _tmp_29: ',' expression static void * -_tmp_37_rule(Parser *p) +_tmp_29_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18449,21 +18593,21 @@ _tmp_37_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'as' NAME + { // ',' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; + D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + Token * _literal; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (z = _PyPegen_name_token(p)) // NAME + (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_37[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -18473,8 +18617,8 @@ _tmp_37_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; done: @@ -18482,9 +18626,9 @@ _tmp_37_rule(Parser *p) return _res; } -// _loop0_39: ',' with_item +// _loop0_30: ('.' | '...') static asdl_seq * -_loop0_39_rule(Parser *p) +_loop0_30_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18503,27 +18647,18 @@ _loop0_39_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ('.' | '...') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); - Token * _literal; - withitem_ty elem; + D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); + void *_tmp_152_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = with_item_rule(p)) // with_item + (_tmp_152_var = _tmp_152_rule(p)) // '.' | '...' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = _tmp_152_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18539,66 +18674,27 @@ _loop0_39_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_38: with_item _loop0_39 -static asdl_seq * -_gather_38_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // with_item _loop0_39 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); - withitem_ty elem; - asdl_seq * seq; - if ( - (elem = with_item_rule(p)) // with_item - && - (seq = _loop0_39_rule(p)) // _loop0_39 - ) - { - D(fprintf(stderr, "%*c+ _gather_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; } - _res = NULL; - done: + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); D(p->level--); - return _res; + return _seq; } -// _loop0_41: ',' with_item +// _loop1_31: ('.' | '...') static asdl_seq * -_loop0_41_rule(Parser *p) +_loop1_31_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18617,27 +18713,18 @@ _loop0_41_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ('.' | '...') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); - Token * _literal; - withitem_ty elem; + D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); + void *_tmp_153_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = with_item_rule(p)) // with_item + (_tmp_153_var = _tmp_153_rule(p)) // '.' | '...' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = _tmp_153_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18653,8 +18740,13 @@ _loop0_41_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -18666,53 +18758,14 @@ _loop0_41_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); D(p->level--); return _seq; } -// _gather_40: with_item _loop0_41 -static asdl_seq * -_gather_40_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // with_item _loop0_41 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); - withitem_ty elem; - asdl_seq * seq; - if ( - (elem = with_item_rule(p)) // with_item - && - (seq = _loop0_41_rule(p)) // _loop0_41 - ) - { - D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_43: ',' with_item +// _loop0_33: ',' import_from_as_name static asdl_seq * -_loop0_43_rule(Parser *p) +_loop0_33_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18731,18 +18784,18 @@ _loop0_43_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ',' import_from_as_name if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); Token * _literal; - withitem_ty elem; + alias_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = with_item_rule(p)) // with_item + (elem = import_from_as_name_rule(p)) // import_from_as_name ) { _res = elem; @@ -18767,8 +18820,8 @@ _loop0_43_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -18780,14 +18833,14 @@ _loop0_43_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); D(p->level--); return _seq; } -// _gather_42: with_item _loop0_43 +// _gather_32: import_from_as_name _loop0_33 static asdl_seq * -_gather_42_rule(Parser *p) +_gather_32_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18796,27 +18849,27 @@ _gather_42_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_43 + { // import_from_as_name _loop0_33 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); + alias_ty elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = import_from_as_name_rule(p)) // import_from_as_name && - (seq = _loop0_43_rule(p)) // _loop0_43 + (seq = _loop0_33_rule(p)) // _loop0_33 ) { - D(fprintf(stderr, "%*c+ _gather_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); + D(fprintf(stderr, "%*c+ _gather_32[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_33")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); + D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_33")); } _res = NULL; done: @@ -18824,9 +18877,53 @@ _gather_42_rule(Parser *p) return _res; } -// _loop0_45: ',' with_item +// _tmp_34: 'as' NAME +static void * +_tmp_34_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_36: ',' dotted_as_name static asdl_seq * -_loop0_45_rule(Parser *p) +_loop0_36_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18845,18 +18942,18 @@ _loop0_45_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' with_item + { // ',' dotted_as_name if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); Token * _literal; - withitem_ty elem; + alias_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = with_item_rule(p)) // with_item + (elem = dotted_as_name_rule(p)) // dotted_as_name ) { _res = elem; @@ -18881,8 +18978,8 @@ _loop0_45_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); + D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -18894,14 +18991,14 @@ _loop0_45_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); D(p->level--); return _seq; } -// _gather_44: with_item _loop0_45 +// _gather_35: dotted_as_name _loop0_36 static asdl_seq * -_gather_44_rule(Parser *p) +_gather_35_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18910,27 +19007,27 @@ _gather_44_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // with_item _loop0_45 + { // dotted_as_name _loop0_36 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); - withitem_ty elem; + D(fprintf(stderr, "%*c> _gather_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); + alias_ty elem; asdl_seq * seq; if ( - (elem = with_item_rule(p)) // with_item + (elem = dotted_as_name_rule(p)) // dotted_as_name && - (seq = _loop0_45_rule(p)) // _loop0_45 + (seq = _loop0_36_rule(p)) // _loop0_36 ) { - D(fprintf(stderr, "%*c+ _gather_44[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); + D(fprintf(stderr, "%*c+ _gather_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_36")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); + D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); } _res = NULL; done: @@ -18938,9 +19035,9 @@ _gather_44_rule(Parser *p) return _res; } -// _tmp_46: 'as' target +// _tmp_37: 'as' NAME static void * -_tmp_46_rule(Parser *p) +_tmp_37_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -18949,22 +19046,22 @@ _tmp_46_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'as' target + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' target")); + D(fprintf(stderr, "%*c> _tmp_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; - expr_ty t; + expr_ty z; if ( (_keyword = _PyPegen_expect_token(p, 531)) // token='as' && - (t = target_rule(p)) // target + (z = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_46[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' target")); - _res = t; + D(fprintf(stderr, "%*c+ _tmp_37[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -18973,8 +19070,8 @@ _tmp_46_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); + D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; done: @@ -18982,9 +19079,9 @@ _tmp_46_rule(Parser *p) return _res; } -// _loop1_47: except_block +// _loop0_39: ',' with_item static asdl_seq * -_loop1_47_rule(Parser *p) +_loop0_39_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19003,18 +19100,27 @@ _loop1_47_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // except_block + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); - excepthandler_ty except_block_var; + D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + Token * _literal; + withitem_ty elem; while ( - (except_block_var = except_block_rule(p)) // except_block + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = with_item_rule(p)) // with_item ) { - _res = except_block_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19029,14 +19135,9 @@ _loop1_47_rule(Parser *p) _children[_n++] = _res; _mark = p->mark; } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19048,48 +19149,43 @@ _loop1_47_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); D(p->level--); return _seq; } -// _tmp_48: 'as' NAME -static void * -_tmp_48_rule(Parser *p) +// _gather_38: with_item _loop0_39 +static asdl_seq * +_gather_38_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // 'as' NAME + { // with_item _loop0_39 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; + D(fprintf(stderr, "%*c> _gather_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); + withitem_ty elem; + asdl_seq * seq; if ( - (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + (elem = with_item_rule(p)) // with_item && - (z = _PyPegen_name_token(p)) // NAME + (seq = _loop0_39_rule(p)) // _loop0_39 ) { - D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_39")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); } _res = NULL; done: @@ -19097,9 +19193,9 @@ _tmp_48_rule(Parser *p) return _res; } -// _loop1_49: case_block +// _loop0_41: ',' with_item static asdl_seq * -_loop1_49_rule(Parser *p) +_loop0_41_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19118,18 +19214,27 @@ _loop1_49_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // case_block + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); - void *case_block_var; + D(fprintf(stderr, "%*c> _loop0_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); + Token * _literal; + withitem_ty elem; while ( - (case_block_var = case_block_rule(p)) // case_block + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = with_item_rule(p)) // with_item ) { - _res = case_block_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19145,13 +19250,8 @@ _loop1_49_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_49[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19163,48 +19263,43 @@ _loop1_49_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_49_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); D(p->level--); return _seq; } -// _tmp_50: 'if' named_expression -static void * -_tmp_50_rule(Parser *p) +// _gather_40: with_item _loop0_41 +static asdl_seq * +_gather_40_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // 'if' named_expression + { // with_item _loop0_41 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); - Token * _keyword; - expr_ty a; + D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); + withitem_ty elem; + asdl_seq * seq; if ( - (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + (elem = with_item_rule(p)) // with_item && - (a = named_expression_rule(p)) // named_expression + (seq = _loop0_41_rule(p)) // _loop0_41 ) { - D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_41")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); + D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); } _res = NULL; done: @@ -19212,9 +19307,9 @@ _tmp_50_rule(Parser *p) return _res; } -// _loop0_52: '|' closed_pattern +// _loop0_43: ',' with_item static asdl_seq * -_loop0_52_rule(Parser *p) +_loop0_43_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19233,18 +19328,18 @@ _loop0_52_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // '|' closed_pattern + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); + D(fprintf(stderr, "%*c> _loop0_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); Token * _literal; - void *elem; + withitem_ty elem; while ( - (_literal = _PyPegen_expect_token(p, 18)) // token='|' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = closed_pattern_rule(p)) // closed_pattern + (elem = with_item_rule(p)) // with_item ) { _res = elem; @@ -19269,8 +19364,8 @@ _loop0_52_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); + D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19282,14 +19377,14 @@ _loop0_52_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); D(p->level--); return _seq; } -// _gather_51: closed_pattern _loop0_52 +// _gather_42: with_item _loop0_43 static asdl_seq * -_gather_51_rule(Parser *p) +_gather_42_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19298,82 +19393,27 @@ _gather_51_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // closed_pattern _loop0_52 + { // with_item _loop0_43 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); - void *elem; + D(fprintf(stderr, "%*c> _gather_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); + withitem_ty elem; asdl_seq * seq; if ( - (elem = closed_pattern_rule(p)) // closed_pattern + (elem = with_item_rule(p)) // with_item && - (seq = _loop0_52_rule(p)) // _loop0_52 + (seq = _loop0_43_rule(p)) // _loop0_43 ) { - D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52")); + D(fprintf(stderr, "%*c+ _gather_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_43")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_53: '.' | '(' -static void * -_tmp_53_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '.' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - ) - { - D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); - } - { // '(' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - ) - { - D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); } _res = NULL; done: @@ -19381,9 +19421,9 @@ _tmp_53_rule(Parser *p) return _res; } -// _loop0_55: '.' NAME +// _loop0_45: ',' with_item static asdl_seq * -_loop0_55_rule(Parser *p) +_loop0_45_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19402,18 +19442,18 @@ _loop0_55_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // '.' NAME + { // ',' with_item if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c> _loop0_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); Token * _literal; - expr_ty elem; + withitem_ty elem; while ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _PyPegen_name_token(p)) // NAME + (elem = with_item_rule(p)) // with_item ) { _res = elem; @@ -19438,8 +19478,8 @@ _loop0_55_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19451,14 +19491,14 @@ _loop0_55_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); D(p->level--); return _seq; } -// _gather_54: NAME _loop0_55 +// _gather_44: with_item _loop0_45 static asdl_seq * -_gather_54_rule(Parser *p) +_gather_44_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19467,27 +19507,71 @@ _gather_54_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // NAME _loop0_55 + { // with_item _loop0_45 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_55")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); + withitem_ty elem; asdl_seq * seq; if ( - (elem = _PyPegen_name_token(p)) // NAME + (elem = with_item_rule(p)) // with_item && - (seq = _loop0_55_rule(p)) // _loop0_55 + (seq = _loop0_45_rule(p)) // _loop0_45 ) { - D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_55")); + D(fprintf(stderr, "%*c+ _gather_44[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_45")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_55")); + D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_46: 'as' target +static void * +_tmp_46_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' target + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' target")); + Token * _keyword; + expr_ty t; + if ( + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' + && + (t = target_rule(p)) // target + ) + { + D(fprintf(stderr, "%*c+ _tmp_46[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' target")); + _res = t; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); } _res = NULL; done: @@ -19495,9 +19579,9 @@ _gather_54_rule(Parser *p) return _res; } -// _loop0_57: ',' pattern +// _loop1_47: except_block static asdl_seq * -_loop0_57_rule(Parser *p) +_loop1_47_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19516,27 +19600,18 @@ _loop0_57_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // except_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); - Token * _literal; - void *elem; + D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); + excepthandler_ty except_block_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = pattern_rule(p)) // pattern + (except_block_var = except_block_rule(p)) // except_block ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = except_block_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19552,8 +19627,13 @@ _loop0_57_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19565,43 +19645,48 @@ _loop0_57_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); D(p->level--); return _seq; } -// _gather_56: pattern _loop0_57 -static asdl_seq * -_gather_56_rule(Parser *p) +// _tmp_48: 'as' NAME +static void * +_tmp_48_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // pattern _loop0_57 + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); - void *elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; if ( - (elem = pattern_rule(p)) // pattern + (_keyword = _PyPegen_expect_token(p, 531)) // token='as' && - (seq = _loop0_57_rule(p)) // _loop0_57 + (z = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_57")); + D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; done: @@ -19609,9 +19694,9 @@ _gather_56_rule(Parser *p) return _res; } -// _loop0_59: ',' pattern +// _loop1_49: case_block static asdl_seq * -_loop0_59_rule(Parser *p) +_loop1_49_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19630,27 +19715,18 @@ _loop0_59_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // case_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); - Token * _literal; - void *elem; + D(fprintf(stderr, "%*c> _loop1_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); + void *case_block_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = pattern_rule(p)) // pattern + (case_block_var = case_block_rule(p)) // case_block ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = case_block_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19666,8 +19742,13 @@ _loop0_59_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c%s _loop1_49[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19679,53 +19760,14 @@ _loop0_59_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_59_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_49_type, _seq); D(p->level--); return _seq; } -// _gather_58: pattern _loop0_59 -static asdl_seq * -_gather_58_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // pattern _loop0_59 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); - void *elem; - asdl_seq * seq; - if ( - (elem = pattern_rule(p)) // pattern - && - (seq = _loop0_59_rule(p)) // _loop0_59 - ) - { - D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_59")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_61: ',' (key_pattern ':' closed_pattern) +// _loop0_51: '|' closed_pattern static asdl_seq * -_loop0_61_rule(Parser *p) +_loop0_51_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19744,18 +19786,18 @@ _loop0_61_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (key_pattern ':' closed_pattern) + { // '|' closed_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (key_pattern ':' closed_pattern)")); + D(fprintf(stderr, "%*c> _loop0_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); Token * _literal; void *elem; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 18)) // token='|' && - (elem = _tmp_163_rule(p)) // key_pattern ':' closed_pattern + (elem = closed_pattern_rule(p)) // closed_pattern ) { _res = elem; @@ -19780,8 +19822,8 @@ _loop0_61_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (key_pattern ':' closed_pattern)")); + D(fprintf(stderr, "%*c%s _loop0_51[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19793,14 +19835,14 @@ _loop0_61_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_51_type, _seq); D(p->level--); return _seq; } -// _gather_60: (key_pattern ':' closed_pattern) _loop0_61 +// _gather_50: closed_pattern _loop0_51 static asdl_seq * -_gather_60_rule(Parser *p) +_gather_50_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19809,27 +19851,82 @@ _gather_60_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (key_pattern ':' closed_pattern) _loop0_61 + { // closed_pattern _loop0_51 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); + D(fprintf(stderr, "%*c> _gather_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_51")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_163_rule(p)) // key_pattern ':' closed_pattern + (elem = closed_pattern_rule(p)) // closed_pattern && - (seq = _loop0_61_rule(p)) // _loop0_61 + (seq = _loop0_51_rule(p)) // _loop0_51 ) { - D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); + D(fprintf(stderr, "%*c+ _gather_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_51")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(key_pattern ':' closed_pattern) _loop0_61")); + D(fprintf(stderr, "%*c%s _gather_50[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_51")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_52: '.' | '(' +static void * +_tmp_52_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '.' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + ) + { + D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + ) + { + D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } _res = NULL; done: @@ -19837,9 +19934,9 @@ _gather_60_rule(Parser *p) return _res; } -// _loop0_63: '|' literal_pattern +// _loop0_54: ',' pattern static asdl_seq * -_loop0_63_rule(Parser *p) +_loop0_54_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19858,18 +19955,18 @@ _loop0_63_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // '|' literal_pattern + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' literal_pattern")); + D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; void *elem; while ( - (_literal = _PyPegen_expect_token(p, 18)) // token='|' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = literal_pattern_rule(p)) // literal_pattern + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -19894,8 +19991,8 @@ _loop0_63_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' literal_pattern")); + D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -19907,14 +20004,14 @@ _loop0_63_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq); D(p->level--); return _seq; } -// _gather_62: literal_pattern _loop0_63 +// _gather_53: pattern _loop0_54 static asdl_seq * -_gather_62_rule(Parser *p) +_gather_53_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19923,27 +20020,27 @@ _gather_62_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // literal_pattern _loop0_63 + { // pattern _loop0_54 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern _loop0_63")); + D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); void *elem; asdl_seq * seq; if ( - (elem = literal_pattern_rule(p)) // literal_pattern + (elem = pattern_rule(p)) // pattern && - (seq = _loop0_63_rule(p)) // _loop0_63 + (seq = _loop0_54_rule(p)) // _loop0_54 ) { - D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern _loop0_63")); + D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern _loop0_63")); + D(fprintf(stderr, "%*c%s _gather_53[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_54")); } _res = NULL; done: @@ -19951,9 +20048,9 @@ _gather_62_rule(Parser *p) return _res; } -// _loop0_65: '.' NAME +// _loop0_56: ',' keyword_pattern static asdl_seq * -_loop0_65_rule(Parser *p) +_loop0_56_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -19972,18 +20069,18 @@ _loop0_65_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // '.' NAME + { // ',' keyword_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; - expr_ty elem; + void *elem; while ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _PyPegen_name_token(p)) // NAME + (elem = keyword_pattern_rule(p)) // keyword_pattern ) { _res = elem; @@ -20008,8 +20105,8 @@ _loop0_65_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20021,14 +20118,14 @@ _loop0_65_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq); D(p->level--); return _seq; } -// _gather_64: NAME _loop0_65 +// _gather_55: keyword_pattern _loop0_56 static asdl_seq * -_gather_64_rule(Parser *p) +_gather_55_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20037,27 +20134,27 @@ _gather_64_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // NAME _loop0_65 + { // keyword_pattern _loop0_56 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_65")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_56")); + void *elem; asdl_seq * seq; if ( - (elem = _PyPegen_name_token(p)) // NAME + (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_65_rule(p)) // _loop0_65 + (seq = _loop0_56_rule(p)) // _loop0_56 ) { - D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_65")); + D(fprintf(stderr, "%*c+ _gather_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_56")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_65")); + D(fprintf(stderr, "%*c%s _gather_55[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_56")); } _res = NULL; done: @@ -20065,9 +20162,9 @@ _gather_64_rule(Parser *p) return _res; } -// _loop0_67: ',' pattern +// _loop0_58: ',' pattern static asdl_seq * -_loop0_67_rule(Parser *p) +_loop0_58_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20091,7 +20188,7 @@ _loop0_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; void *elem; while ( @@ -20122,7 +20219,7 @@ _loop0_67_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_67[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20135,14 +20232,14 @@ _loop0_67_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_67_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq); D(p->level--); return _seq; } -// _gather_66: pattern _loop0_67 +// _gather_57: pattern _loop0_58 static asdl_seq * -_gather_66_rule(Parser *p) +_gather_57_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20151,27 +20248,27 @@ _gather_66_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_67 + { // pattern _loop0_58 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_67")); + D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); void *elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_67_rule(p)) // _loop0_67 + (seq = _loop0_58_rule(p)) // _loop0_58 ) { - D(fprintf(stderr, "%*c+ _gather_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_67")); + D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_66[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_67")); + D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_58")); } _res = NULL; done: @@ -20179,9 +20276,9 @@ _gather_66_rule(Parser *p) return _res; } -// _loop0_69: ',' (NAME '=' or_pattern) +// _loop0_60: ',' keyword_pattern static asdl_seq * -_loop0_69_rule(Parser *p) +_loop0_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20200,18 +20297,18 @@ _loop0_69_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (NAME '=' or_pattern) + { // ',' keyword_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (NAME '=' or_pattern)")); + D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_164_rule(p)) // NAME '=' or_pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern ) { _res = elem; @@ -20236,8 +20333,8 @@ _loop0_69_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (NAME '=' or_pattern)")); + D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20249,14 +20346,14 @@ _loop0_69_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); D(p->level--); return _seq; } -// _gather_68: (NAME '=' or_pattern) _loop0_69 +// _gather_59: keyword_pattern _loop0_60 static asdl_seq * -_gather_68_rule(Parser *p) +_gather_59_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20265,27 +20362,27 @@ _gather_68_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (NAME '=' or_pattern) _loop0_69 + { // keyword_pattern _loop0_60 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); + D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_164_rule(p)) // NAME '=' or_pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_69_rule(p)) // _loop0_69 + (seq = _loop0_60_rule(p)) // _loop0_60 ) { - D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); + D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_68[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(NAME '=' or_pattern) _loop0_69")); + D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_60")); } _res = NULL; done: @@ -20293,9 +20390,9 @@ _gather_68_rule(Parser *p) return _res; } -// _loop0_71: ',' (NAME '=' or_pattern) +// _loop0_62: ',' value_pattern static asdl_seq * -_loop0_71_rule(Parser *p) +_loop0_62_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20314,18 +20411,18 @@ _loop0_71_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (NAME '=' or_pattern) + { // ',' value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (NAME '=' or_pattern)")); + D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_165_rule(p)) // NAME '=' or_pattern + (elem = value_pattern_rule(p)) // value_pattern ) { _res = elem; @@ -20350,8 +20447,8 @@ _loop0_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (NAME '=' or_pattern)")); + D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20363,14 +20460,14 @@ _loop0_71_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq); D(p->level--); return _seq; } -// _gather_70: (NAME '=' or_pattern) _loop0_71 +// _gather_61: value_pattern _loop0_62 static asdl_seq * -_gather_70_rule(Parser *p) +_gather_61_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20379,27 +20476,27 @@ _gather_70_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (NAME '=' or_pattern) _loop0_71 + { // value_pattern _loop0_62 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); + D(fprintf(stderr, "%*c> _gather_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_62")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_165_rule(p)) // NAME '=' or_pattern + (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_71_rule(p)) // _loop0_71 + (seq = _loop0_62_rule(p)) // _loop0_62 ) { - D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); + D(fprintf(stderr, "%*c+ _gather_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_62")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(NAME '=' or_pattern) _loop0_71")); + D(fprintf(stderr, "%*c%s _gather_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_62")); } _res = NULL; done: @@ -20407,9 +20504,9 @@ _gather_70_rule(Parser *p) return _res; } -// _loop0_73: ',' pattern +// _loop0_64: ',' key_value_pattern static asdl_seq * -_loop0_73_rule(Parser *p) +_loop0_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20428,18 +20525,18 @@ _loop0_73_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' key_value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = key_value_pattern_rule(p)) // key_value_pattern ) { _res = elem; @@ -20464,8 +20561,8 @@ _loop0_73_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20477,14 +20574,14 @@ _loop0_73_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq); D(p->level--); return _seq; } -// _gather_72: pattern _loop0_73 +// _gather_63: key_value_pattern _loop0_64 static asdl_seq * -_gather_72_rule(Parser *p) +_gather_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20493,27 +20590,27 @@ _gather_72_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_73 + { // key_value_pattern _loop0_64 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_73")); + D(fprintf(stderr, "%*c> _gather_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_64")); void *elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_73_rule(p)) // _loop0_73 + (seq = _loop0_64_rule(p)) // _loop0_64 ) { - D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_73")); + D(fprintf(stderr, "%*c+ _gather_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_64")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_73")); + D(fprintf(stderr, "%*c%s _gather_63[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_64")); } _res = NULL; done: @@ -20521,9 +20618,9 @@ _gather_72_rule(Parser *p) return _res; } -// _tmp_74: 'from' expression +// _tmp_65: 'from' expression static void * -_tmp_74_rule(Parser *p) +_tmp_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20537,7 +20634,7 @@ _tmp_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); Token * _keyword; expr_ty z; if ( @@ -20546,7 +20643,7 @@ _tmp_74_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20556,7 +20653,7 @@ _tmp_74_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -20565,9 +20662,9 @@ _tmp_74_rule(Parser *p) return _res; } -// _tmp_75: '->' expression +// _tmp_66: '->' expression static void * -_tmp_75_rule(Parser *p) +_tmp_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20581,7 +20678,7 @@ _tmp_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -20590,7 +20687,7 @@ _tmp_75_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20600,7 +20697,7 @@ _tmp_75_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -20609,9 +20706,9 @@ _tmp_75_rule(Parser *p) return _res; } -// _tmp_76: '->' expression +// _tmp_67: '->' expression static void * -_tmp_76_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20625,7 +20722,7 @@ _tmp_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -20634,7 +20731,7 @@ _tmp_76_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20644,7 +20741,7 @@ _tmp_76_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -20653,9 +20750,9 @@ _tmp_76_rule(Parser *p) return _res; } -// _tmp_77: NEWLINE INDENT +// _tmp_68: NEWLINE INDENT static void * -_tmp_77_rule(Parser *p) +_tmp_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20669,7 +20766,7 @@ _tmp_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -20678,12 +20775,12 @@ _tmp_77_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -20692,9 +20789,9 @@ _tmp_77_rule(Parser *p) return _res; } -// _loop0_78: param_no_default +// _loop0_69: param_no_default static asdl_seq * -_loop0_78_rule(Parser *p) +_loop0_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20718,7 +20815,7 @@ _loop0_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -20740,7 +20837,7 @@ _loop0_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20753,14 +20850,14 @@ _loop0_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); D(p->level--); return _seq; } -// _loop0_79: param_with_default +// _loop0_70: param_with_default static asdl_seq * -_loop0_79_rule(Parser *p) +_loop0_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20784,7 +20881,7 @@ _loop0_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -20806,7 +20903,7 @@ _loop0_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20819,14 +20916,14 @@ _loop0_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); D(p->level--); return _seq; } -// _loop0_80: param_with_default +// _loop0_71: param_with_default static asdl_seq * -_loop0_80_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20850,7 +20947,7 @@ _loop0_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -20872,7 +20969,7 @@ _loop0_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20885,14 +20982,14 @@ _loop0_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _loop1_81: param_no_default +// _loop1_72: param_no_default static asdl_seq * -_loop1_81_rule(Parser *p) +_loop1_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20916,7 +21013,7 @@ _loop1_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -20938,7 +21035,7 @@ _loop1_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -20956,14 +21053,14 @@ _loop1_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq); D(p->level--); return _seq; } -// _loop0_82: param_with_default +// _loop0_73: param_with_default static asdl_seq * -_loop0_82_rule(Parser *p) +_loop0_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20987,7 +21084,7 @@ _loop0_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21009,7 +21106,7 @@ _loop0_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21022,14 +21119,14 @@ _loop0_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); D(p->level--); return _seq; } -// _loop1_83: param_with_default +// _loop1_74: param_with_default static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21053,7 +21150,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21075,7 +21172,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21093,14 +21190,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_74_type, _seq); D(p->level--); return _seq; } -// _loop1_84: param_no_default +// _loop1_75: param_no_default static asdl_seq * -_loop1_84_rule(Parser *p) +_loop1_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21124,7 +21221,7 @@ _loop1_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21146,7 +21243,7 @@ _loop1_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21164,14 +21261,14 @@ _loop1_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); D(p->level--); return _seq; } -// _loop1_85: param_no_default +// _loop1_76: param_no_default static asdl_seq * -_loop1_85_rule(Parser *p) +_loop1_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21195,7 +21292,7 @@ _loop1_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21217,7 +21314,7 @@ _loop1_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21235,14 +21332,14 @@ _loop1_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); D(p->level--); return _seq; } -// _loop0_86: param_no_default +// _loop0_77: param_no_default static asdl_seq * -_loop0_86_rule(Parser *p) +_loop0_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21266,7 +21363,7 @@ _loop0_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21288,7 +21385,7 @@ _loop0_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21301,14 +21398,14 @@ _loop0_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); D(p->level--); return _seq; } -// _loop1_87: param_with_default +// _loop1_78: param_with_default static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21332,7 +21429,7 @@ _loop1_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21354,7 +21451,7 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21372,14 +21469,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq); D(p->level--); return _seq; } -// _loop0_88: param_no_default +// _loop0_79: param_no_default static asdl_seq * -_loop0_88_rule(Parser *p) +_loop0_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21403,7 +21500,7 @@ _loop0_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21425,7 +21522,7 @@ _loop0_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21438,14 +21535,14 @@ _loop0_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); D(p->level--); return _seq; } -// _loop1_89: param_with_default +// _loop1_80: param_with_default static asdl_seq * -_loop1_89_rule(Parser *p) +_loop1_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21469,7 +21566,7 @@ _loop1_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21491,7 +21588,7 @@ _loop1_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21509,14 +21606,14 @@ _loop1_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); D(p->level--); return _seq; } -// _loop0_90: param_maybe_default +// _loop0_81: param_maybe_default static asdl_seq * -_loop0_90_rule(Parser *p) +_loop0_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21540,7 +21637,7 @@ _loop0_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -21562,7 +21659,7 @@ _loop0_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21575,14 +21672,14 @@ _loop0_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); D(p->level--); return _seq; } -// _loop1_91: param_maybe_default +// _loop1_82: param_maybe_default static asdl_seq * -_loop1_91_rule(Parser *p) +_loop1_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21606,7 +21703,7 @@ _loop1_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -21628,7 +21725,7 @@ _loop1_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -21646,14 +21743,14 @@ _loop1_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); D(p->level--); return _seq; } -// _loop1_92: ('@' named_expression NEWLINE) +// _loop1_83: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_92_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21677,13 +21774,13 @@ _loop1_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_166_var; + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_154_var; while ( - (_tmp_166_var = _tmp_166_rule(p)) // '@' named_expression NEWLINE + (_tmp_154_var = _tmp_154_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_166_var; + _res = _tmp_154_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21699,7 +21796,7 @@ _loop1_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -21717,14 +21814,14 @@ _loop1_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _tmp_93: '(' arguments? ')' +// _tmp_84: '(' arguments? ')' static void * -_tmp_93_rule(Parser *p) +_tmp_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21738,7 +21835,7 @@ _tmp_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -21750,7 +21847,7 @@ _tmp_93_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21760,7 +21857,7 @@ _tmp_93_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -21769,9 +21866,9 @@ _tmp_93_rule(Parser *p) return _res; } -// _loop0_95: ',' star_expression +// _loop0_86: ',' star_expression static asdl_seq * -_loop0_95_rule(Parser *p) +_loop0_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21795,7 +21892,7 @@ _loop0_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -21826,7 +21923,7 @@ _loop0_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21839,14 +21936,14 @@ _loop0_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); D(p->level--); return _seq; } -// _gather_94: star_expression _loop0_95 +// _gather_85: star_expression _loop0_86 static asdl_seq * -_gather_94_rule(Parser *p) +_gather_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21855,27 +21952,27 @@ _gather_94_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_95 + { // star_expression _loop0_86 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c> _gather_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_86")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_95_rule(p)) // _loop0_95 + (seq = _loop0_86_rule(p)) // _loop0_86 ) { - D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c+ _gather_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_86")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c%s _gather_85[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_86")); } _res = NULL; done: @@ -21883,9 +21980,9 @@ _gather_94_rule(Parser *p) return _res; } -// _loop1_96: (',' star_expression) +// _loop1_87: (',' star_expression) static asdl_seq * -_loop1_96_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21909,13 +22006,13 @@ _loop1_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_167_var; + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_155_var; while ( - (_tmp_167_var = _tmp_167_rule(p)) // ',' star_expression + (_tmp_155_var = _tmp_155_rule(p)) // ',' star_expression ) { - _res = _tmp_167_var; + _res = _tmp_155_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21931,7 +22028,7 @@ _loop1_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -21949,14 +22046,14 @@ _loop1_96_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop0_98: ',' star_named_expression +// _loop0_89: ',' star_named_expression static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21980,7 +22077,7 @@ _loop0_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -22011,7 +22108,7 @@ _loop0_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22024,14 +22121,14 @@ _loop0_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_89_type, _seq); D(p->level--); return _seq; } -// _gather_97: star_named_expression _loop0_98 +// _gather_88: star_named_expression _loop0_89 static asdl_seq * -_gather_97_rule(Parser *p) +_gather_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22040,27 +22137,27 @@ _gather_97_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_98 + { // star_named_expression _loop0_89 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c> _gather_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_89")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_98_rule(p)) // _loop0_98 + (seq = _loop0_89_rule(p)) // _loop0_89 ) { - D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c+ _gather_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_89")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c%s _gather_88[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_89")); } _res = NULL; done: @@ -22068,9 +22165,9 @@ _gather_97_rule(Parser *p) return _res; } -// _loop1_99: (',' expression) +// _loop1_90: (',' expression) static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22094,13 +22191,13 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_168_var; + D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_156_var; while ( - (_tmp_168_var = _tmp_168_rule(p)) // ',' expression + (_tmp_156_var = _tmp_156_rule(p)) // ',' expression ) { - _res = _tmp_168_var; + _res = _tmp_156_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22116,7 +22213,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -22134,14 +22231,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_no_default +// _loop0_91: lambda_param_no_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22165,7 +22262,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22187,7 +22284,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22200,14 +22297,14 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); D(p->level--); return _seq; } -// _loop0_101: lambda_param_with_default +// _loop0_92: lambda_param_with_default static asdl_seq * -_loop0_101_rule(Parser *p) +_loop0_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22231,7 +22328,7 @@ _loop0_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22253,7 +22350,7 @@ _loop0_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22266,14 +22363,14 @@ _loop0_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); D(p->level--); return _seq; } -// _loop0_102: lambda_param_with_default +// _loop0_93: lambda_param_with_default static asdl_seq * -_loop0_102_rule(Parser *p) +_loop0_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22297,7 +22394,7 @@ _loop0_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22319,7 +22416,7 @@ _loop0_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22332,14 +22429,14 @@ _loop0_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq); D(p->level--); return _seq; } -// _loop1_103: lambda_param_no_default +// _loop1_94: lambda_param_no_default static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22363,7 +22460,7 @@ _loop1_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22385,7 +22482,7 @@ _loop1_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22403,14 +22500,14 @@ _loop1_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_with_default +// _loop0_95: lambda_param_with_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22434,7 +22531,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22456,7 +22553,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22469,14 +22566,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_with_default +// _loop1_96: lambda_param_with_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22500,7 +22597,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22522,7 +22619,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22540,14 +22637,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); D(p->level--); return _seq; } -// _loop1_106: lambda_param_no_default +// _loop1_97: lambda_param_no_default static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22571,7 +22668,7 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22593,7 +22690,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22611,14 +22708,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); D(p->level--); return _seq; } -// _loop1_107: lambda_param_no_default +// _loop1_98: lambda_param_no_default static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22642,7 +22739,7 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22664,7 +22761,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22682,14 +22779,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); D(p->level--); return _seq; } -// _loop0_108: lambda_param_no_default +// _loop0_99: lambda_param_no_default static asdl_seq * -_loop0_108_rule(Parser *p) +_loop0_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22713,7 +22810,7 @@ _loop0_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22735,7 +22832,7 @@ _loop0_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22748,14 +22845,14 @@ _loop0_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_99_type, _seq); D(p->level--); return _seq; } -// _loop1_109: lambda_param_with_default +// _loop1_100: lambda_param_with_default static asdl_seq * -_loop1_109_rule(Parser *p) +_loop1_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22779,7 +22876,7 @@ _loop1_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22801,7 +22898,7 @@ _loop1_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22819,14 +22916,14 @@ _loop1_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq); D(p->level--); return _seq; } -// _loop0_110: lambda_param_no_default +// _loop0_101: lambda_param_no_default static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22850,7 +22947,7 @@ _loop0_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22872,7 +22969,7 @@ _loop0_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22885,14 +22982,14 @@ _loop0_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); D(p->level--); return _seq; } -// _loop1_111: lambda_param_with_default +// _loop1_102: lambda_param_with_default static asdl_seq * -_loop1_111_rule(Parser *p) +_loop1_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22916,7 +23013,7 @@ _loop1_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22938,7 +23035,7 @@ _loop1_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22956,14 +23053,14 @@ _loop1_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); D(p->level--); return _seq; } -// _loop0_112: lambda_param_maybe_default +// _loop0_103: lambda_param_maybe_default static asdl_seq * -_loop0_112_rule(Parser *p) +_loop0_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22987,7 +23084,7 @@ _loop0_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23009,7 +23106,7 @@ _loop0_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23022,14 +23119,14 @@ _loop0_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); D(p->level--); return _seq; } -// _loop1_113: lambda_param_maybe_default +// _loop1_104: lambda_param_maybe_default static asdl_seq * -_loop1_113_rule(Parser *p) +_loop1_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23053,7 +23150,7 @@ _loop1_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23075,7 +23172,7 @@ _loop1_113_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -23093,14 +23190,14 @@ _loop1_113_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); D(p->level--); return _seq; } -// _loop1_114: ('or' conjunction) +// _loop1_105: ('or' conjunction) static asdl_seq * -_loop1_114_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23124,13 +23221,13 @@ _loop1_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_169_var; + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_157_var; while ( - (_tmp_169_var = _tmp_169_rule(p)) // 'or' conjunction + (_tmp_157_var = _tmp_157_rule(p)) // 'or' conjunction ) { - _res = _tmp_169_var; + _res = _tmp_157_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23146,7 +23243,7 @@ _loop1_114_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -23164,14 +23261,14 @@ _loop1_114_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop1_115: ('and' inversion) +// _loop1_106: ('and' inversion) static asdl_seq * -_loop1_115_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23195,13 +23292,13 @@ _loop1_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_170_var; + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_158_var; while ( - (_tmp_170_var = _tmp_170_rule(p)) // 'and' inversion + (_tmp_158_var = _tmp_158_rule(p)) // 'and' inversion ) { - _res = _tmp_170_var; + _res = _tmp_158_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23217,7 +23314,7 @@ _loop1_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -23235,14 +23332,14 @@ _loop1_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _loop1_116: compare_op_bitwise_or_pair +// _loop1_107: compare_op_bitwise_or_pair static asdl_seq * -_loop1_116_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23266,7 +23363,7 @@ _loop1_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -23288,7 +23385,7 @@ _loop1_116_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -23306,14 +23403,14 @@ _loop1_116_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _tmp_117: '!=' +// _tmp_108: '!=' static void * -_tmp_117_rule(Parser *p) +_tmp_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23327,13 +23424,13 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23343,7 +23440,7 @@ _tmp_117_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -23352,9 +23449,9 @@ _tmp_117_rule(Parser *p) return _res; } -// _loop0_119: ',' slice +// _loop0_110: ',' slice static asdl_seq * -_loop0_119_rule(Parser *p) +_loop0_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23378,7 +23475,7 @@ _loop0_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -23409,7 +23506,7 @@ _loop0_119_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23422,14 +23519,14 @@ _loop0_119_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); D(p->level--); return _seq; } -// _gather_118: slice _loop0_119 +// _gather_109: slice _loop0_110 static asdl_seq * -_gather_118_rule(Parser *p) +_gather_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23438,27 +23535,27 @@ _gather_118_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_119 + { // slice _loop0_110 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c> _gather_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_110")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_119_rule(p)) // _loop0_119 + (seq = _loop0_110_rule(p)) // _loop0_110 ) { - D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c+ _gather_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_110")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_110")); } _res = NULL; done: @@ -23466,9 +23563,9 @@ _gather_118_rule(Parser *p) return _res; } -// _tmp_120: ':' expression? +// _tmp_111: ':' expression? static void * -_tmp_120_rule(Parser *p) +_tmp_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23482,7 +23579,7 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -23491,7 +23588,7 @@ _tmp_120_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23501,7 +23598,7 @@ _tmp_120_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -23510,9 +23607,9 @@ _tmp_120_rule(Parser *p) return _res; } -// _tmp_121: tuple | group | genexp +// _tmp_112: tuple | group | genexp static void * -_tmp_121_rule(Parser *p) +_tmp_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23526,18 +23623,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -23545,18 +23642,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -23564,18 +23661,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -23584,9 +23681,9 @@ _tmp_121_rule(Parser *p) return _res; } -// _tmp_122: list | listcomp +// _tmp_113: list | listcomp static void * -_tmp_122_rule(Parser *p) +_tmp_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23600,18 +23697,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -23619,18 +23716,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -23639,9 +23736,9 @@ _tmp_122_rule(Parser *p) return _res; } -// _tmp_123: dict | set | dictcomp | setcomp +// _tmp_114: dict | set | dictcomp | setcomp static void * -_tmp_123_rule(Parser *p) +_tmp_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23655,18 +23752,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -23674,18 +23771,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -23693,18 +23790,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -23712,18 +23809,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -23732,9 +23829,9 @@ _tmp_123_rule(Parser *p) return _res; } -// _loop1_124: STRING +// _loop1_115: STRING static asdl_seq * -_loop1_124_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23758,7 +23855,7 @@ _loop1_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -23780,7 +23877,7 @@ _loop1_124_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -23798,14 +23895,14 @@ _loop1_124_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_124_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _tmp_125: star_named_expression ',' star_named_expressions? +// _tmp_116: star_named_expression ',' star_named_expressions? static void * -_tmp_125_rule(Parser *p) +_tmp_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23819,7 +23916,7 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -23831,7 +23928,7 @@ _tmp_125_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23841,7 +23938,7 @@ _tmp_125_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -23850,9 +23947,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _tmp_126: yield_expr | named_expression +// _tmp_117: yield_expr | named_expression static void * -_tmp_126_rule(Parser *p) +_tmp_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23866,18 +23963,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -23885,18 +23982,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -23905,9 +24002,9 @@ _tmp_126_rule(Parser *p) return _res; } -// _loop0_128: ',' double_starred_kvpair +// _loop0_119: ',' double_starred_kvpair static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23931,7 +24028,7 @@ _loop0_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -23962,7 +24059,7 @@ _loop0_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23975,14 +24072,14 @@ _loop0_128_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); D(p->level--); return _seq; } -// _gather_127: double_starred_kvpair _loop0_128 +// _gather_118: double_starred_kvpair _loop0_119 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23991,27 +24088,27 @@ _gather_127_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_128 + { // double_starred_kvpair _loop0_119 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_128_rule(p)) // _loop0_128 + (seq = _loop0_119_rule(p)) // _loop0_119 ) { - D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_119")); } _res = NULL; done: @@ -24019,9 +24116,9 @@ _gather_127_rule(Parser *p) return _res; } -// _loop1_129: for_if_clause +// _loop1_120: for_if_clause static asdl_seq * -_loop1_129_rule(Parser *p) +_loop1_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24045,7 +24142,7 @@ _loop1_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -24067,7 +24164,7 @@ _loop1_129_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -24085,14 +24182,14 @@ _loop1_129_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_129_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq); D(p->level--); return _seq; } -// _loop0_130: ('if' disjunction) +// _loop0_121: ('if' disjunction) static asdl_seq * -_loop0_130_rule(Parser *p) +_loop0_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24116,13 +24213,13 @@ _loop0_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_171_var; + D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_159_var; while ( - (_tmp_171_var = _tmp_171_rule(p)) // 'if' disjunction + (_tmp_159_var = _tmp_159_rule(p)) // 'if' disjunction ) { - _res = _tmp_171_var; + _res = _tmp_159_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24138,7 +24235,7 @@ _loop0_130_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24151,14 +24248,14 @@ _loop0_130_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); D(p->level--); return _seq; } -// _loop0_131: ('if' disjunction) +// _loop0_122: ('if' disjunction) static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24182,13 +24279,13 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_172_var; + D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_160_var; while ( - (_tmp_172_var = _tmp_172_rule(p)) // 'if' disjunction + (_tmp_160_var = _tmp_160_rule(p)) // 'if' disjunction ) { - _res = _tmp_172_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24204,7 +24301,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24217,14 +24314,14 @@ _loop0_131_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); D(p->level--); return _seq; } -// _tmp_132: ',' args +// _tmp_123: ',' args static void * -_tmp_132_rule(Parser *p) +_tmp_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24238,7 +24335,7 @@ _tmp_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24247,7 +24344,7 @@ _tmp_132_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24257,7 +24354,7 @@ _tmp_132_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24266,9 +24363,9 @@ _tmp_132_rule(Parser *p) return _res; } -// _tmp_133: ',' args +// _tmp_124: ',' args static void * -_tmp_133_rule(Parser *p) +_tmp_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24282,7 +24379,7 @@ _tmp_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24291,7 +24388,7 @@ _tmp_133_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24301,7 +24398,7 @@ _tmp_133_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24310,9 +24407,9 @@ _tmp_133_rule(Parser *p) return _res; } -// _loop0_135: ',' kwarg_or_starred +// _loop0_126: ',' kwarg_or_starred static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24336,7 +24433,7 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24367,7 +24464,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24380,14 +24477,14 @@ _loop0_135_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); D(p->level--); return _seq; } -// _gather_134: kwarg_or_starred _loop0_135 +// _gather_125: kwarg_or_starred _loop0_126 static asdl_seq * -_gather_134_rule(Parser *p) +_gather_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24396,27 +24493,27 @@ _gather_134_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_135 + { // kwarg_or_starred _loop0_126 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_135_rule(p)) // _loop0_135 + (seq = _loop0_126_rule(p)) // _loop0_126 ) { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_126")); } _res = NULL; done: @@ -24424,9 +24521,9 @@ _gather_134_rule(Parser *p) return _res; } -// _loop0_137: ',' kwarg_or_double_starred +// _loop0_128: ',' kwarg_or_double_starred static asdl_seq * -_loop0_137_rule(Parser *p) +_loop0_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24450,7 +24547,7 @@ _loop0_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24481,7 +24578,7 @@ _loop0_137_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24494,14 +24591,14 @@ _loop0_137_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); D(p->level--); return _seq; } -// _gather_136: kwarg_or_double_starred _loop0_137 +// _gather_127: kwarg_or_double_starred _loop0_128 static asdl_seq * -_gather_136_rule(Parser *p) +_gather_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24510,27 +24607,27 @@ _gather_136_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_137 + { // kwarg_or_double_starred _loop0_128 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_137_rule(p)) // _loop0_137 + (seq = _loop0_128_rule(p)) // _loop0_128 ) { - D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_128")); } _res = NULL; done: @@ -24538,9 +24635,9 @@ _gather_136_rule(Parser *p) return _res; } -// _loop0_139: ',' kwarg_or_starred +// _loop0_130: ',' kwarg_or_starred static asdl_seq * -_loop0_139_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24564,7 +24661,7 @@ _loop0_139_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24595,7 +24692,7 @@ _loop0_139_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24608,14 +24705,14 @@ _loop0_139_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _gather_138: kwarg_or_starred _loop0_139 +// _gather_129: kwarg_or_starred _loop0_130 static asdl_seq * -_gather_138_rule(Parser *p) +_gather_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24624,27 +24721,27 @@ _gather_138_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_139 + { // kwarg_or_starred _loop0_130 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_139_rule(p)) // _loop0_139 + (seq = _loop0_130_rule(p)) // _loop0_130 ) { - D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_130")); } _res = NULL; done: @@ -24652,9 +24749,9 @@ _gather_138_rule(Parser *p) return _res; } -// _loop0_141: ',' kwarg_or_double_starred +// _loop0_132: ',' kwarg_or_double_starred static asdl_seq * -_loop0_141_rule(Parser *p) +_loop0_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24678,7 +24775,7 @@ _loop0_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24709,7 +24806,7 @@ _loop0_141_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24722,14 +24819,14 @@ _loop0_141_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); D(p->level--); return _seq; } -// _gather_140: kwarg_or_double_starred _loop0_141 +// _gather_131: kwarg_or_double_starred _loop0_132 static asdl_seq * -_gather_140_rule(Parser *p) +_gather_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24738,27 +24835,27 @@ _gather_140_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_141 + { // kwarg_or_double_starred _loop0_132 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_141_rule(p)) // _loop0_141 + (seq = _loop0_132_rule(p)) // _loop0_132 ) { - D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_132")); } _res = NULL; done: @@ -24766,9 +24863,9 @@ _gather_140_rule(Parser *p) return _res; } -// _loop0_142: (',' star_target) +// _loop0_133: (',' star_target) static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24792,13 +24889,13 @@ _loop0_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_173_var; + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_161_var; while ( - (_tmp_173_var = _tmp_173_rule(p)) // ',' star_target + (_tmp_161_var = _tmp_161_rule(p)) // ',' star_target ) { - _res = _tmp_173_var; + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24814,7 +24911,7 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24827,14 +24924,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _loop0_144: ',' star_target +// _loop0_135: ',' star_target static asdl_seq * -_loop0_144_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24858,7 +24955,7 @@ _loop0_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -24889,7 +24986,7 @@ _loop0_144_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24902,14 +24999,14 @@ _loop0_144_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_143: star_target _loop0_144 +// _gather_134: star_target _loop0_135 static asdl_seq * -_gather_143_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24918,27 +25015,27 @@ _gather_143_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_144 + { // star_target _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_144_rule(p)) // _loop0_144 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_135")); } _res = NULL; done: @@ -24946,9 +25043,9 @@ _gather_143_rule(Parser *p) return _res; } -// _tmp_145: !'*' star_target +// _tmp_136: !'*' star_target static void * -_tmp_145_rule(Parser *p) +_tmp_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24962,7 +25059,7 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -24970,12 +25067,12 @@ _tmp_145_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -24984,9 +25081,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _loop0_147: ',' del_target +// _loop0_138: ',' del_target static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25010,7 +25107,7 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -25041,7 +25138,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25054,14 +25151,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); D(p->level--); return _seq; } -// _gather_146: del_target _loop0_147 +// _gather_137: del_target _loop0_138 static asdl_seq * -_gather_146_rule(Parser *p) +_gather_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25070,27 +25167,27 @@ _gather_146_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_147 + { // del_target _loop0_138 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_147_rule(p)) // _loop0_147 + (seq = _loop0_138_rule(p)) // _loop0_138 ) { - D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_138")); } _res = NULL; done: @@ -25098,9 +25195,9 @@ _gather_146_rule(Parser *p) return _res; } -// _loop0_149: ',' target +// _loop0_140: ',' target static asdl_seq * -_loop0_149_rule(Parser *p) +_loop0_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25124,7 +25221,7 @@ _loop0_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -25155,7 +25252,7 @@ _loop0_149_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25168,14 +25265,14 @@ _loop0_149_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); D(p->level--); return _seq; } -// _gather_148: target _loop0_149 +// _gather_139: target _loop0_140 static asdl_seq * -_gather_148_rule(Parser *p) +_gather_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25184,27 +25281,27 @@ _gather_148_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_149 + { // target _loop0_140 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_149_rule(p)) // _loop0_149 + (seq = _loop0_140_rule(p)) // _loop0_140 ) { - D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_140")); } _res = NULL; done: @@ -25212,9 +25309,9 @@ _gather_148_rule(Parser *p) return _res; } -// _tmp_150: args | expression for_if_clauses +// _tmp_141: args | expression for_if_clauses static void * -_tmp_150_rule(Parser *p) +_tmp_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25228,18 +25325,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -25247,7 +25344,7 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -25256,12 +25353,12 @@ _tmp_150_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -25270,9 +25367,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _loop0_151: star_named_expressions +// _loop0_142: star_named_expressions static asdl_seq * -_loop0_151_rule(Parser *p) +_loop0_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25296,7 +25393,7 @@ _loop0_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -25318,7 +25415,7 @@ _loop0_151_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25331,14 +25428,14 @@ _loop0_151_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); D(p->level--); return _seq; } -// _tmp_152: '=' annotated_rhs +// _tmp_143: '=' annotated_rhs static void * -_tmp_152_rule(Parser *p) +_tmp_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25352,7 +25449,7 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -25361,12 +25458,12 @@ _tmp_152_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -25375,9 +25472,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: yield_expr | star_expressions +// _tmp_144: yield_expr | star_expressions static void * -_tmp_153_rule(Parser *p) +_tmp_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25391,18 +25488,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25410,18 +25507,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25430,9 +25527,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: yield_expr | star_expressions +// _tmp_145: yield_expr | star_expressions static void * -_tmp_154_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25446,18 +25543,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25465,18 +25562,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25485,9 +25582,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: '[' | '(' | '{' +// _tmp_146: '[' | '(' | '{' static void * -_tmp_155_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25501,18 +25598,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -25520,18 +25617,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -25539,18 +25636,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -25559,9 +25656,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _loop0_156: param_no_default +// _loop0_147: param_no_default static asdl_seq * -_loop0_156_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25585,7 +25682,7 @@ _loop0_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -25607,7 +25704,7 @@ _loop0_156_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25620,14 +25717,14 @@ _loop0_156_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _tmp_157: slash_with_default | param_with_default+ +// _tmp_148: slash_with_default | param_with_default+ static void * -_tmp_157_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25641,18 +25738,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -25660,18 +25757,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_174_var; + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_162_var; if ( - (_loop1_174_var = _loop1_174_rule(p)) // param_with_default+ + (_loop1_162_var = _loop1_162_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_174_var; + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_162_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -25680,9 +25777,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: ')' | ',' (')' | '**') +// _tmp_149: ')' | ',' (')' | '**') static void * -_tmp_158_rule(Parser *p) +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25696,18 +25793,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -25715,21 +25812,21 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_175_var; + void *_tmp_163_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_175_var = _tmp_175_rule(p)) // ')' | '**' + (_tmp_163_var = _tmp_163_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_175_var); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_163_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -25738,9 +25835,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: ':' | ',' (':' | '**') +// _tmp_150: ':' | ',' (':' | '**') static void * -_tmp_159_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25754,18 +25851,18 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -25773,21 +25870,21 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_176_var; + void *_tmp_164_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_176_var = _tmp_176_rule(p)) // ':' | '**' + (_tmp_164_var = _tmp_164_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_176_var); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_164_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -25796,9 +25893,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: star_targets '=' +// _tmp_151: star_targets '=' static void * -_tmp_160_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25812,7 +25909,7 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -25821,7 +25918,7 @@ _tmp_160_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25831,7 +25928,7 @@ _tmp_160_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -25840,9 +25937,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: '.' | '...' +// _tmp_152: '.' | '...' static void * -_tmp_161_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25856,18 +25953,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -25875,18 +25972,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -25895,9 +25992,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _tmp_162: '.' | '...' +// _tmp_153: '.' | '...' static void * -_tmp_162_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25911,18 +26008,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -25930,18 +26027,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -25950,135 +26047,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _tmp_163: key_pattern ':' closed_pattern +// _tmp_154: '@' named_expression NEWLINE static void * -_tmp_163_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // key_pattern ':' closed_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_pattern ':' closed_pattern")); - Token * _literal; - void *closed_pattern_var; - void *key_pattern_var; - if ( - (key_pattern_var = key_pattern_rule(p)) // key_pattern - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (closed_pattern_var = closed_pattern_rule(p)) // closed_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_pattern ':' closed_pattern")); - _res = _PyPegen_dummy_name(p, key_pattern_var, _literal, closed_pattern_var); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_pattern ':' closed_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_164: NAME '=' or_pattern -static void * -_tmp_164_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // NAME '=' or_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); - Token * _literal; - expr_ty name_var; - void *or_pattern_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' - && - (or_pattern_var = or_pattern_rule(p)) // or_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); - _res = _PyPegen_dummy_name(p, name_var, _literal, or_pattern_var); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_165: NAME '=' or_pattern -static void * -_tmp_165_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // NAME '=' or_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); - Token * _literal; - expr_ty name_var; - void *or_pattern_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' - && - (or_pattern_var = or_pattern_rule(p)) // or_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); - _res = _PyPegen_dummy_name(p, name_var, _literal, or_pattern_var); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_166: '@' named_expression NEWLINE -static void * -_tmp_166_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26092,7 +26063,7 @@ _tmp_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -26104,7 +26075,7 @@ _tmp_166_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26114,7 +26085,7 @@ _tmp_166_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -26123,9 +26094,9 @@ _tmp_166_rule(Parser *p) return _res; } -// _tmp_167: ',' star_expression +// _tmp_155: ',' star_expression static void * -_tmp_167_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26139,7 +26110,7 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -26148,7 +26119,7 @@ _tmp_167_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26158,7 +26129,7 @@ _tmp_167_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -26167,9 +26138,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _tmp_168: ',' expression +// _tmp_156: ',' expression static void * -_tmp_168_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26183,7 +26154,7 @@ _tmp_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -26192,7 +26163,7 @@ _tmp_168_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26202,7 +26173,7 @@ _tmp_168_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -26211,9 +26182,9 @@ _tmp_168_rule(Parser *p) return _res; } -// _tmp_169: 'or' conjunction +// _tmp_157: 'or' conjunction static void * -_tmp_169_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26227,7 +26198,7 @@ _tmp_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -26236,7 +26207,7 @@ _tmp_169_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26246,7 +26217,7 @@ _tmp_169_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -26255,9 +26226,9 @@ _tmp_169_rule(Parser *p) return _res; } -// _tmp_170: 'and' inversion +// _tmp_158: 'and' inversion static void * -_tmp_170_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26271,7 +26242,7 @@ _tmp_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -26280,7 +26251,7 @@ _tmp_170_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26290,7 +26261,7 @@ _tmp_170_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -26299,9 +26270,9 @@ _tmp_170_rule(Parser *p) return _res; } -// _tmp_171: 'if' disjunction +// _tmp_159: 'if' disjunction static void * -_tmp_171_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26315,7 +26286,7 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26324,7 +26295,7 @@ _tmp_171_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26334,7 +26305,7 @@ _tmp_171_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26343,9 +26314,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: 'if' disjunction +// _tmp_160: 'if' disjunction static void * -_tmp_172_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26359,7 +26330,7 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26368,7 +26339,7 @@ _tmp_172_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26378,7 +26349,7 @@ _tmp_172_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26387,9 +26358,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: ',' star_target +// _tmp_161: ',' star_target static void * -_tmp_173_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26403,7 +26374,7 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -26412,7 +26383,7 @@ _tmp_173_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26422,7 +26393,7 @@ _tmp_173_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -26431,9 +26402,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _loop1_174: param_with_default +// _loop1_162: param_with_default static asdl_seq * -_loop1_174_rule(Parser *p) +_loop1_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26457,7 +26428,7 @@ _loop1_174_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -26479,7 +26450,7 @@ _loop1_174_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -26497,14 +26468,14 @@ _loop1_174_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_174_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_162_type, _seq); D(p->level--); return _seq; } -// _tmp_175: ')' | '**' +// _tmp_163: ')' | '**' static void * -_tmp_175_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26518,18 +26489,18 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -26537,18 +26508,18 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -26557,9 +26528,9 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: ':' | '**' +// _tmp_164: ':' | '**' static void * -_tmp_176_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26573,18 +26544,18 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -26592,18 +26563,18 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; diff --git a/Python/ast.c b/Python/ast.c index 7d06aeed048c9d..c50ee38f21fda7 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -311,14 +311,25 @@ validate_pattern(expr_ty p) switch (p->kind) { case Attribute_kind: return validate_expr(p, Load); - case BinOp_kind: - if (p->v.BinOp.op != BitOr) { + case BoolOp_kind: + if (p->v.BoolOp.op != Or) { + PyErr_SetString(PyExc_ValueError, + "BoolOp op in pattern must be Or"); + return 0; + } + values = p->v.BoolOp.values; + size = asdl_seq_LEN(values); + if (size < 2) { PyErr_SetString(PyExc_ValueError, - "BinOp op in pattern must be BitOr"); + "BoolOp must have at least two values"); return 0; } - return (validate_pattern(p->v.BinOp.left) - && validate_pattern(p->v.BinOp.right)); + for (i = 0; i < size; i++) { + if (!validate_pattern(asdl_seq_GET(values, i))) { + return 0; + } + } + return 1; case Constant_kind: return validate_expr(p, Load); case Dict_kind: diff --git a/Python/compile.c b/Python/compile.c index 4075451d5bdc5c..dfb9ff91174644 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -983,6 +983,8 @@ stack_effect(int opcode, int oparg, int jump) /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; case MATCH_KEY: + case MATCH_MAP: + case MATCH_SEQ: return -(jump > 0); case STORE_ATTR: From 77fc89dcf4aa73bda80e919e50764213af63d230 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 31 May 2020 00:16:45 -0700 Subject: [PATCH 044/218] Fix failing tests --- Lib/ast.py | 34 ++++++++++++++++++++++++++++++++++ Lib/test/test_descrtut.py | 1 + Lib/test/test_pydoc.py | 4 +++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Lib/ast.py b/Lib/ast.py index 6a5b39e270b9b5..53bc9449d15c3b 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -659,6 +659,7 @@ def __init__(self): self._precedences = {} self._type_ignores = {} self._indent = 0 + self._pattern = False def interleave(self, inter, f, seq): """Call f on each item in seq, calling inter() in between.""" @@ -720,6 +721,17 @@ def block(self, *, extra = None): yield self._indent -= 1 + @contextmanager + def pattern(self): + assert not self._pattern + self._pattern = True + yield + assert self._pattern + self._pattern = False + + def in_pattern(self): + return self._pattern + @contextmanager def delimit(self, start, end): """A context manager for preparing the source for expressions. It adds @@ -1320,6 +1332,11 @@ def visit_Compare(self, node): boolop_precedence = {"and": _Precedence.AND, "or": _Precedence.OR} def visit_BoolOp(self, node): + + if self.in_pattern(): + self.interleave(lambda: self.write(" | "), self.traverse, node.values) + return + operator = self.boolops[node.op.__class__.__name__] operator_precedence = self.boolop_precedence[operator] @@ -1399,6 +1416,13 @@ def visit_Slice(self, node): self.write(":") self.traverse(node.step) + def visit_Match(self, node): + self.fill("match ") + self.traverse(node.target) + with self.block(): + for case in node.cases: + self.traverse(case) + def visit_arg(self, node): self.write(node.arg) if node.annotation: @@ -1483,6 +1507,16 @@ def visit_withitem(self, node): self.write(" as ") self.traverse(node.optional_vars) + def visit_match_case(self, node): + self.fill("case ") + with self.pattern(): + self.traverse(node.pattern) + if node.guard: + self.write(" if ") + self.traverse(node.guard) + with self.block(): + self.traverse(node.body) + def unparse(ast_obj): unparser = _Unparser() return unparser.visit(ast_obj) diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index 8e25f58d7aa20e..f4567880955315 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -188,6 +188,7 @@ def merge(self, other): '__le__', '__len__', '__lt__', + '__match__', '__mul__', '__ne__', '__new__', diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index ffabb7f1b94072..8c8537f2d536ca 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -772,9 +772,11 @@ def method_returning_true(self): del expected['__doc__'] del expected['__class__'] # inspect resolves descriptors on type into methods, but vars doesn't, - # so we need to update __subclasshook__ and __init_subclass__. + # so we need to update __subclasshook__, __init_subclass__ and + # __match__. expected['__subclasshook__'] = TestClass.__subclasshook__ expected['__init_subclass__'] = TestClass.__init_subclass__ + expected['__match__'] = TestClass.__match__ methods = pydoc.allmethods(TestClass) self.assertDictEqual(methods, expected) From bad2fe2ef4a426cd81159abd92684d7cc7f953e7 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 31 May 2020 12:14:30 -0700 Subject: [PATCH 045/218] Add MATCH_TYPE opcode --- Doc/library/dis.rst | 29 ++++++++++++++------- Include/opcode.h | 5 ++-- Lib/importlib/_bootstrap_external.py | 4 +-- Lib/opcode.py | 5 ++-- Python/ceval.c | 39 ++++++++++++++++++++++++++++ Python/compile.c | 6 ++++- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 6 ++--- 8 files changed, 75 insertions(+), 21 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index c64ea76c4ad7fd..ce12b7a2fdb2d1 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -990,13 +990,11 @@ All of the following opcodes use their arguments. code counter is incremented by *delta*. -.. opcode:: MATCH_SEQ (delta) +.. opcode:: MATCH_KEY (delta) - Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not - an :term:`iterator`, and is not an instance of - :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator from it and - push that onto the stack. Otherwise, increment the bytecode counter by - ``delta``. + Pop TOS. If it is a key in the :class:`dict` at TOS1, remove it and push the + associated value onto the stack. Otherwise, increment the bytecode counter + by ``delta``. .. versionadded:: 3.10 @@ -1010,11 +1008,22 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_KEY (delta) +.. opcode:: MATCH_SEQ (delta) - Pop TOS. If it is a key in the :class:`dict` at TOS1, remove it and push the - associated value onto the stack. Otherwise, increment the bytecode counter - by ``delta``. + Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not + an :term:`iterator`, and is not an instance of + :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator from it and + push that onto the stack. Otherwise, increment the bytecode counter by + ``delta``. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_TYPE (delta) + + Pop TOS and TOS1. If TOS is an instance of :class:`type` and has a + ``__match__`` method, call it on TOS1 and push the result onto the stack if + it is not ``None``. Otherwise, increment the bytecode counter by ``delta``. .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index 6cff79517cccb7..00e68040f2ae4e 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -127,9 +127,10 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 -#define MATCH_SEQ 166 +#define MATCH_KEY 166 #define MATCH_MAP 167 -#define MATCH_KEY 168 +#define MATCH_SEQ 168 +#define MATCH_TYPE 169 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index eb3100b41dae4d..635e62ddaeb01b 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3438 (add MATCH_KEY, MATCH_MAP, MATCH_SEQ) +# Python 3.10a0 3439 (add MATCH_KEY, MATCH_MAP, MATCH_SEQ, MATCH_TYPE) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3438).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3439).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 67f0e3149aaf18..37a6ed4be6776b 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -213,8 +213,9 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -jrel_op('MATCH_SEQ', 166) +jrel_op('MATCH_KEY', 166) jrel_op('MATCH_MAP', 167) -jrel_op('MATCH_KEY', 168) +jrel_op('MATCH_SEQ', 168) +jrel_op('MATCH_TYPE', 169) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index a386b3b3671eb3..0fdd68e2422cd8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3410,6 +3410,45 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } + case TARGET(MATCH_TYPE): { + PyObject *type = TOP(); + PyObject *target = SECOND(); + if (!PyType_Check(type)) { + _PyErr_Format(tstate, PyExc_TypeError, + "called match pattern must be a type; " + "did you mean '%s'?", Py_TYPE(type)->tp_name); + goto error; + } + PyObject *method = PyObject_GetAttrString(type, "__match__"); + if (method == Py_None) { + Py_DECREF(method); + _PyErr_Format(tstate, PyExc_TypeError, + "type '%s' cannot be matched", + Py_TYPE(type)->tp_name); + goto error; + } + PyObject *match = PyObject_CallOneArg(method, target); + Py_DECREF(method); + if (!match) { + goto error; + } + if (match == Py_None) { + Py_DECREF(match); + STACK_SHRINK(2); + Py_DECREF(type); + Py_DECREF(target); + JUMPBY(oparg); + DISPATCH(); + } + STACK_SHRINK(1); + Py_DECREF(type); + Py_DECREF(target); + SET_TOP(match); + DISPATCH(); + } + + + case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index dfb9ff91174644..b9061f81e07446 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -985,7 +985,9 @@ stack_effect(int opcode, int oparg, int jump) case MATCH_KEY: case MATCH_MAP: case MATCH_SEQ: - return -(jump > 0); + return jump > 0 ? -1 : 0; + case MATCH_TYPE: + return jump > 0 ? -2 : 0; case STORE_ATTR: return -2; @@ -2901,6 +2903,8 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) CHECK(compiler_pattern_store(c, value->v.Starred.value)); if (size - i - 1) { ADDOP_I(c, BUILD_TUPLE, size - i - 1); + // Argh, our tuple is backwards! Unpacking and rebuilding is the + // simplest way to reverse it: ADDOP_I(c, UNPACK_SEQUENCE, size - i - 1); ADDOP_I(c, BUILD_TUPLE, size - i - 1); ADDOP_JREL(c, MATCH_SEQ, fail); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index ea266c93abde41..120adff2d1d04e 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,110,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,111,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 955fa3bf1668c7..785515709378b6 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -165,10 +165,10 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&TARGET_MATCH_SEQ, - &&TARGET_MATCH_MAP, &&TARGET_MATCH_KEY, - &&_unknown_opcode, + &&TARGET_MATCH_MAP, + &&TARGET_MATCH_SEQ, + &&TARGET_MATCH_TYPE, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 2924d2f5f47063977a8e2e55e43f2d9bc44b6990 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 31 May 2020 15:17:05 -0700 Subject: [PATCH 046/218] Fix parsing/unparsing of name contexts --- Grammar/python.gram | 2 +- Lib/ast.py | 9 +++++++-- Lib/test/test_patma.py | 25 +++++++++++++++++++++++++ Parser/pegen/parse.c | 40 ++++++++++++++++++++-------------------- 4 files changed, 53 insertions(+), 23 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index ef69ad240bdddd..3150129479ad10 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -258,9 +258,9 @@ class_pattern: _Py_Call(func, args, keywords, EXTRA) } name_or_attr: + | NAME | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } - | NAME values_pattern: | values=','.value_pattern+ [','] { values } diff --git a/Lib/ast.py b/Lib/ast.py index 53bc9449d15c3b..658323bf194483 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1106,6 +1106,8 @@ def _fstring_FormattedValue(self, node, write): write("}") def visit_Name(self, node): + if self.in_pattern() and isinstance(node.ctx, Load): + self.write(".") self.write(node.id) def _write_docstring(self, node): @@ -1351,8 +1353,11 @@ def increasing_level_traverse(node): self.interleave(lambda: self.write(s), increasing_level_traverse, node.values) def visit_Attribute(self, node): - self.set_precedence(_Precedence.ATOM, node.value) - self.traverse(node.value) + if self.in_pattern() and isinstance(node.value, Name): + self.write(node.value.id) + else: + self.set_precedence(_Precedence.ATOM, node.value) + self.traverse(node.value) # Special case: 3.__abs__() is a syntax error, so if node.value # is an integer literal then we need to either parenthesize # it or add an extra space to get 3 .__abs__(). diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2c1c6fa879379e..e22d37a12fb7fd 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -602,6 +602,31 @@ def test_grammar_07(self) -> None: x = True self.assertEqual(x, False) + def test_name_context_00(self) -> None: + x = 0 + y = 1 + match x: + case z := .y: + pass + self.assertEqual(x, 0) + self.assertEqual(y, 1) + with self.assertRaises(NameError): + z + + def test_name_context_01(self) -> None: + class A: + B = 0 + match 0: + case x if x: + z = 0 + case y := .x if y: + z = 1 + case A.B: + z = 2 + self.assertEqual(A.B, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 2) if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 5cdfc10302903d..5cdb7e135dc885 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -5798,7 +5798,7 @@ class_pattern_rule(Parser *p) } // Left-recursive -// name_or_attr: name_or_attr '.' NAME | NAME +// name_or_attr: NAME | name_or_attr '.' NAME static void * name_or_attr_raw(Parser *); static void * name_or_attr_rule(Parser *p) @@ -5847,6 +5847,25 @@ name_or_attr_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty name_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = name_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + } { // name_or_attr '.' NAME if (p->error_indicator) { D(p->level--); @@ -5886,25 +5905,6 @@ name_or_attr_raw(Parser *p) D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); } - { // NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); - expr_ty name_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = name_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); - } _res = NULL; done: D(p->level--); From 66852e9566b854d71d5c00d33461d1ba05871d0b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 31 May 2020 17:15:04 -0700 Subject: [PATCH 047/218] Clean up grammar --- Grammar/python.gram | 14 ++--- Lib/test/test_patma.py | 138 +++++++++++++++++++++++++++++++++-------- Parser/pegen/parse.c | 12 ++-- Python/ast.c | 3 +- Python/compile.c | 5 +- 5 files changed, 127 insertions(+), 45 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 3150129479ad10..f5601bf30478f8 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -196,7 +196,7 @@ match_stmt[stmt_ty]: | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block: - | "case" pattern=pattern guard=[guard] ':' body=block { + | "case" pattern=pattern guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } pattern: @@ -242,7 +242,7 @@ group_pattern: | '(' pattern=pattern ')' { pattern } sequence_pattern: - | '[' values=values_pattern ']' { + | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } mapping_pattern: | '{' items=items_pattern '}' { @@ -250,11 +250,11 @@ mapping_pattern: class_pattern: | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ [','] ')' { + | func=name_or_attr '(' args=','.pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } - | func=name_or_attr '(' keywords=','.keyword_pattern+ [','] ')' { + | func=name_or_attr '(' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, NULL, keywords, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ [','] ')' { + | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, args, keywords, EXTRA) } name_or_attr: @@ -262,10 +262,10 @@ name_or_attr: | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } values_pattern: - | values=','.value_pattern+ [','] { + | values=','.value_pattern+ ','? { values } items_pattern: - | items=','.key_value_pattern+ [','] { + | items=','.key_value_pattern+ ','? { items } keyword_pattern: | arg=NAME '=' value=or_pattern { diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index e22d37a12fb7fd..806a19abb50445 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -269,7 +269,7 @@ def test_pipe_07(self) -> None: self.assertNotIn("z", namespace) def test_sequence_00(self) -> None: - match_cases = [MatchCase("()", "y = 0")] + match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) @@ -293,27 +293,27 @@ def test_sequence_03(self) -> None: self.assertEqual(namespace.get("y"), 0) def test_sequence_04(self) -> None: - match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] + match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 1]) self.assertEqual(namespace.get("y"), 0) def test_sequence_05(self) -> None: - match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] + match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [1, 0]) self.assertEqual(namespace.get("y"), 0) def test_sequence_06(self) -> None: - match_cases = [MatchCase("(0, 1) or (1, 0)", "y = 0")] + match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 0]) self.assertNotIn("y", namespace) def test_sequence_07(self) -> None: match_cases = [ - MatchCase("(w := 0,)", "y = 0"), - MatchCase("[] or (1, z := (0 or 1)) or []", "y = 1"), + MatchCase("[w := 0,]", "y = 0"), + MatchCase("[] or [1, z := (0 or 1)] or []", "y = 1"), ] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertNotIn("w", namespace) @@ -323,9 +323,9 @@ def test_sequence_07(self) -> None: def test_sequence_08(self) -> None: match_cases = [ - MatchCase("(0,)", "y = 0"), - MatchCase("(1, 0)", "y = 1", "(x := x[:0])"), - MatchCase("(1, 0)", "y = 2"), + MatchCase("[0,]", "y = 0"), + MatchCase("[1, 0]", "y = 1", "(x := x[:0])"), + MatchCase("[1, 0]", "y = 2"), ] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), []) @@ -338,7 +338,7 @@ def test_sequence_09(self) -> None: self.assertNotIn("y", namespace) def test_sequence_10(self) -> None: - match_cases = [MatchCase("()", "y = 0")] + match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = set()", "x", match_cases, "") self.assertEqual(namespace.get("x"), set()) self.assertNotIn("y", namespace) @@ -356,7 +356,7 @@ def test_sequence_12(self) -> None: self.assertNotIn("y", namespace) def test_sequence_13(self) -> None: - match_cases = [MatchCase("(0, 1)", "y = 0")] + match_cases = [MatchCase("[0, 1]", "y = 0")] namespace = self.execute_match("x = {0: False, 1: True}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: False, 1: True}) self.assertNotIn("y", namespace) @@ -463,8 +463,8 @@ def test_mapping_06(self) -> None: def test_mapping_07(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), - MatchCase("()", "y = 2"), + MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match("x = {}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {}) @@ -473,8 +473,8 @@ def test_mapping_07(self) -> None: def test_mapping_08(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), - MatchCase("()", "y = 2"), + MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match( "x = {False: (True, 2.0, {})}", "x", match_cases, "" @@ -485,8 +485,8 @@ def test_mapping_08(self) -> None: def test_mapping_09(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), - MatchCase("()", "y = 2"), + MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match( "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" @@ -497,8 +497,8 @@ def test_mapping_09(self) -> None: def test_mapping_10(self) -> None: match_cases = [ MatchCase("{0: [1, 2]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), - MatchCase("()", "y = 2"), + MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match( "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" @@ -509,8 +509,8 @@ def test_mapping_10(self) -> None: def test_mapping_11(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [()]}", "y = 1"), - MatchCase("()", "y = 2"), + MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match("x = []", "x", match_cases, "") self.assertEqual(namespace.get("x"), []) @@ -520,10 +520,10 @@ def test_mapping_12(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( - "{0: [1, 2, {}] or False} or {1: [()]} or {0: [1, 2, {}]} or [] or 'X' or {}", + "{0: [1, 2, {}] or False} or {1: [[]]} or {0: [1, 2, {}]} or [] or 'X' or {}", "y = 1", ), - MatchCase("()", "y = 2"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 0}) @@ -533,10 +533,10 @@ def test_mapping_13(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( - "{0: [1, 2, {}] or True} or {1: [()]} or {0: [1, 2, {}]} or [] or 'X' or {}", + "{0: [1, 2, {}] or True} or {1: [[]]} or {0: [1, 2, {}]} or [] or 'X' or {}", "y = 1", ), - MatchCase("()", "y = 2"), + MatchCase("[]", "y = 2"), ] namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 0}) @@ -602,7 +602,7 @@ def test_grammar_07(self) -> None: x = True self.assertEqual(x, False) - def test_name_context_00(self) -> None: + def test_grammar_08(self) -> None: x = 0 y = 1 match x: @@ -613,7 +613,7 @@ def test_name_context_00(self) -> None: with self.assertRaises(NameError): z - def test_name_context_01(self) -> None: + def test_grammar_09(self) -> None: class A: B = 0 match 0: @@ -628,6 +628,90 @@ class A: self.assertEqual(y, 0) self.assertEqual(z, 2) + def test_grammar_10(self) -> None: + match (): + case []: + x = 0 + self.assertEqual(x, 0) + + def test_grammar_11(self) -> None: + match (0, 1, 2): + case [*x]: + y = 0 + self.assertEqual(x, [0, 1, 2]) + self.assertEqual(y, 0) + + def test_grammar_12(self) -> None: + match (0, 1, 2): + case [0, *x]: + y = 0 + self.assertEqual(x, [1, 2]) + self.assertEqual(y, 0) + + def test_grammar_13(self) -> None: + match (0, 1, 2): + case [0, 1, *x,]: + y = 0 + self.assertEqual(x, [2]) + self.assertEqual(y, 0) + + def test_grammar_14(self) -> None: + match (0, 1, 2): + case [0, 1, 2, *x]: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_grammar_15(self) -> None: + match (0, 1, 2): + case [*x, 2,]: + y = 0 + self.assertEqual(x, [0, 1]) + self.assertEqual(y, 0) + + def test_grammar_16(self) -> None: + match (0, 1, 2): + case [*x, 1, 2]: + y = 0 + self.assertEqual(x, [0]) + self.assertEqual(y, 0) + + def test_grammar_17(self) -> None: + match (0, 1, 2): + case [*x, 0, 1, 2,]: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_grammar_18(self) -> None: + match (0, 1, 2): + case [0, *x, 2]: + y = 0 + self.assertEqual(x, [1]) + self.assertEqual(y, 0) + + def test_grammar_19(self) -> None: + match (0, 1, 2): + case [0, 1, *x, 2,]: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_grammar_20(self) -> None: + match (0, 1, 2): + case [0, *x, 1, 2]: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_grammar_21(self) -> None: + match (0, 1, 2): + case [*x,]: + y = 0 + self.assertEqual(x, [0, 1, 2]) + self.assertEqual(y, 0) + + if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 5cdb7e135dc885..844715d7e439d6 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -5454,7 +5454,7 @@ group_pattern_rule(Parser *p) return _res; } -// sequence_pattern: '[' values_pattern ']' +// sequence_pattern: '[' values_pattern? ']' static void * sequence_pattern_rule(Parser *p) { @@ -5474,24 +5474,24 @@ sequence_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '[' values_pattern ']' + { // '[' values_pattern? ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' values_pattern ']'")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' values_pattern? ']'")); Token * _literal; Token * _literal_1; void *values; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (values = values_pattern_rule(p)) // values_pattern + (values = values_pattern_rule(p), 1) // values_pattern? && (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' values_pattern ']'")); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' values_pattern? ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5511,7 +5511,7 @@ sequence_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' values_pattern ']'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' values_pattern? ']'")); } _res = NULL; done: diff --git a/Python/ast.c b/Python/ast.c index c50ee38f21fda7..d498acb9eae74e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -364,8 +364,7 @@ validate_pattern(expr_ty p) } return 1; case List_kind: - case Tuple_kind: // TODO: Undecided yet if tuple syntax is legal. - values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + values = p->v.List.elts; size = asdl_seq_LEN(values); for (i = 0; i < size; i++) { value = asdl_seq_GET(values, i); diff --git a/Python/compile.c b/Python/compile.c index b9061f81e07446..044ff18de067a0 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2873,8 +2873,8 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) static int compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) { - assert(p->kind == List_kind || p->kind == Tuple_kind); - asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + assert(p->kind == List_kind); + asdl_seq *values = p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; for (Py_ssize_t i = 0; i < size; i++) { @@ -2939,7 +2939,6 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) case Dict_kind: return compiler_pattern_mapping(c, p, fail); case List_kind: - case Tuple_kind: return compiler_pattern_sequence(c, p, fail); case Name_kind: return compiler_pattern_name(c, p, fail); From f1a1eb942260591b7caa4cf49de0dfdeb844f65c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 08:47:11 -0700 Subject: [PATCH 048/218] Fix calls and error messages --- Grammar/python.gram | 21 +- Parser/pegen/parse.c | 3087 +++++++++++++++++++++++++----------------- Python/ast_opt.c | 1 + Python/compile.c | 36 +- 4 files changed, 1912 insertions(+), 1233 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index f5601bf30478f8..820a7bb8252c44 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -192,7 +192,7 @@ except_block[excepthandler_ty]: | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } finally_block[asdl_seq*]: 'finally' ':' a=block { a } -match_stmt[stmt_ty]: +match_stmt: | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block: @@ -245,17 +245,19 @@ sequence_pattern: | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } mapping_pattern: - | '{' items=items_pattern '}' { + | '{' items=items_pattern? '}' { _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } class_pattern: | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ ','? ')' { + | func=name_or_attr '(' args=','.arg_pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } | func=name_or_attr '(' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, NULL, keywords, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { + | func=name_or_attr '(' args=','.arg_pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, args, keywords, EXTRA) } + | func=name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' error=arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "positional pattern follows keyword pattern") } name_or_attr: | NAME @@ -267,23 +269,26 @@ values_pattern: items_pattern: | items=','.key_value_pattern+ ','? { items } +arg_pattern[expr_ty]: + | pattern !'=' + | error='*' NAME { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } keyword_pattern: | arg=NAME '=' value=or_pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } + | error='**' NAME { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } value_pattern: | '*' value=name_pattern { _Py_Starred(value, Store, EXTRA) } | pattern key_value_pattern: - | key=literal_pattern ':' value=closed_pattern { - _PyPegen_key_value_pair(p, key, value) } - | key=constant_pattern ':' value=closed_pattern { + | key=(literal_pattern | constant_pattern) ':' value=closed_pattern { _PyPegen_key_value_pair(p, key, value) } | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } - return_stmt[stmt_ty]: | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 844715d7e439d6..e9c2cdd3973500 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -129,291 +129,302 @@ static KeywordToken *reserved_keywords[] = { #define name_or_attr_type 1051 // Left-recursive #define values_pattern_type 1052 #define items_pattern_type 1053 -#define keyword_pattern_type 1054 -#define value_pattern_type 1055 -#define key_value_pattern_type 1056 -#define return_stmt_type 1057 -#define raise_stmt_type 1058 -#define function_def_type 1059 -#define function_def_raw_type 1060 -#define func_type_comment_type 1061 -#define params_type 1062 -#define parameters_type 1063 -#define slash_no_default_type 1064 -#define slash_with_default_type 1065 -#define star_etc_type 1066 -#define kwds_type 1067 -#define param_no_default_type 1068 -#define param_with_default_type 1069 -#define param_maybe_default_type 1070 -#define param_type 1071 -#define annotation_type 1072 -#define default_type 1073 -#define decorators_type 1074 -#define class_def_type 1075 -#define class_def_raw_type 1076 -#define block_type 1077 -#define expressions_list_type 1078 -#define star_expressions_type 1079 -#define star_expression_type 1080 -#define star_named_expressions_type 1081 -#define star_named_expression_type 1082 -#define named_expression_type 1083 -#define annotated_rhs_type 1084 -#define expressions_type 1085 -#define expression_type 1086 -#define lambdef_type 1087 -#define lambda_parameters_type 1088 -#define lambda_slash_no_default_type 1089 -#define lambda_slash_with_default_type 1090 -#define lambda_star_etc_type 1091 -#define lambda_kwds_type 1092 -#define lambda_param_no_default_type 1093 -#define lambda_param_with_default_type 1094 -#define lambda_param_maybe_default_type 1095 -#define lambda_param_type 1096 -#define disjunction_type 1097 -#define conjunction_type 1098 -#define inversion_type 1099 -#define comparison_type 1100 -#define compare_op_bitwise_or_pair_type 1101 -#define eq_bitwise_or_type 1102 -#define noteq_bitwise_or_type 1103 -#define lte_bitwise_or_type 1104 -#define lt_bitwise_or_type 1105 -#define gte_bitwise_or_type 1106 -#define gt_bitwise_or_type 1107 -#define notin_bitwise_or_type 1108 -#define in_bitwise_or_type 1109 -#define isnot_bitwise_or_type 1110 -#define is_bitwise_or_type 1111 -#define bitwise_or_type 1112 // Left-recursive -#define bitwise_xor_type 1113 // Left-recursive -#define bitwise_and_type 1114 // Left-recursive -#define shift_expr_type 1115 // Left-recursive -#define sum_type 1116 // Left-recursive -#define term_type 1117 // Left-recursive -#define factor_type 1118 -#define power_type 1119 -#define await_primary_type 1120 -#define primary_type 1121 // Left-recursive -#define slices_type 1122 -#define slice_type 1123 -#define atom_type 1124 -#define strings_type 1125 -#define list_type 1126 -#define listcomp_type 1127 -#define tuple_type 1128 -#define group_type 1129 -#define genexp_type 1130 -#define set_type 1131 -#define setcomp_type 1132 -#define dict_type 1133 -#define dictcomp_type 1134 -#define double_starred_kvpairs_type 1135 -#define double_starred_kvpair_type 1136 -#define kvpair_type 1137 -#define for_if_clauses_type 1138 -#define for_if_clause_type 1139 -#define yield_expr_type 1140 -#define arguments_type 1141 -#define args_type 1142 -#define kwargs_type 1143 -#define starred_expression_type 1144 -#define kwarg_or_starred_type 1145 -#define kwarg_or_double_starred_type 1146 -#define star_targets_type 1147 -#define star_targets_seq_type 1148 -#define star_target_type 1149 -#define star_atom_type 1150 -#define single_target_type 1151 -#define single_subscript_attribute_target_type 1152 -#define del_targets_type 1153 -#define del_target_type 1154 -#define del_t_atom_type 1155 -#define del_target_end_type 1156 -#define targets_type 1157 -#define target_type 1158 -#define t_primary_type 1159 // Left-recursive -#define t_lookahead_type 1160 -#define t_atom_type 1161 -#define incorrect_arguments_type 1162 -#define invalid_kwarg_type 1163 -#define invalid_named_expression_type 1164 -#define invalid_assignment_type 1165 -#define invalid_block_type 1166 -#define invalid_comprehension_type 1167 -#define invalid_dict_comprehension_type 1168 -#define invalid_parameters_type 1169 -#define invalid_star_etc_type 1170 -#define invalid_lambda_star_etc_type 1171 -#define invalid_double_type_comments_type 1172 -#define invalid_del_target_type 1173 -#define invalid_import_from_targets_type 1174 -#define _loop0_1_type 1175 -#define _loop0_2_type 1176 -#define _loop0_4_type 1177 -#define _gather_3_type 1178 -#define _loop0_6_type 1179 -#define _gather_5_type 1180 -#define _loop0_8_type 1181 -#define _gather_7_type 1182 -#define _loop0_10_type 1183 -#define _gather_9_type 1184 -#define _loop1_11_type 1185 -#define _loop0_13_type 1186 -#define _gather_12_type 1187 -#define _tmp_14_type 1188 -#define _tmp_15_type 1189 -#define _tmp_16_type 1190 -#define _tmp_17_type 1191 -#define _tmp_18_type 1192 -#define _tmp_19_type 1193 -#define _tmp_20_type 1194 -#define _tmp_21_type 1195 -#define _loop1_22_type 1196 -#define _tmp_23_type 1197 -#define _tmp_24_type 1198 -#define _loop0_26_type 1199 -#define _gather_25_type 1200 -#define _loop0_28_type 1201 -#define _gather_27_type 1202 -#define _tmp_29_type 1203 -#define _loop0_30_type 1204 -#define _loop1_31_type 1205 -#define _loop0_33_type 1206 -#define _gather_32_type 1207 -#define _tmp_34_type 1208 -#define _loop0_36_type 1209 -#define _gather_35_type 1210 -#define _tmp_37_type 1211 -#define _loop0_39_type 1212 -#define _gather_38_type 1213 -#define _loop0_41_type 1214 -#define _gather_40_type 1215 -#define _loop0_43_type 1216 -#define _gather_42_type 1217 -#define _loop0_45_type 1218 -#define _gather_44_type 1219 -#define _tmp_46_type 1220 -#define _loop1_47_type 1221 -#define _tmp_48_type 1222 -#define _loop1_49_type 1223 -#define _loop0_51_type 1224 -#define _gather_50_type 1225 -#define _tmp_52_type 1226 -#define _loop0_54_type 1227 -#define _gather_53_type 1228 -#define _loop0_56_type 1229 -#define _gather_55_type 1230 -#define _loop0_58_type 1231 -#define _gather_57_type 1232 -#define _loop0_60_type 1233 -#define _gather_59_type 1234 -#define _loop0_62_type 1235 -#define _gather_61_type 1236 -#define _loop0_64_type 1237 -#define _gather_63_type 1238 -#define _tmp_65_type 1239 -#define _tmp_66_type 1240 -#define _tmp_67_type 1241 -#define _tmp_68_type 1242 -#define _loop0_69_type 1243 -#define _loop0_70_type 1244 -#define _loop0_71_type 1245 -#define _loop1_72_type 1246 -#define _loop0_73_type 1247 -#define _loop1_74_type 1248 -#define _loop1_75_type 1249 -#define _loop1_76_type 1250 -#define _loop0_77_type 1251 -#define _loop1_78_type 1252 -#define _loop0_79_type 1253 -#define _loop1_80_type 1254 -#define _loop0_81_type 1255 -#define _loop1_82_type 1256 -#define _loop1_83_type 1257 -#define _tmp_84_type 1258 -#define _loop0_86_type 1259 -#define _gather_85_type 1260 -#define _loop1_87_type 1261 -#define _loop0_89_type 1262 -#define _gather_88_type 1263 -#define _loop1_90_type 1264 +#define arg_pattern_type 1054 +#define keyword_pattern_type 1055 +#define value_pattern_type 1056 +#define key_value_pattern_type 1057 +#define return_stmt_type 1058 +#define raise_stmt_type 1059 +#define function_def_type 1060 +#define function_def_raw_type 1061 +#define func_type_comment_type 1062 +#define params_type 1063 +#define parameters_type 1064 +#define slash_no_default_type 1065 +#define slash_with_default_type 1066 +#define star_etc_type 1067 +#define kwds_type 1068 +#define param_no_default_type 1069 +#define param_with_default_type 1070 +#define param_maybe_default_type 1071 +#define param_type 1072 +#define annotation_type 1073 +#define default_type 1074 +#define decorators_type 1075 +#define class_def_type 1076 +#define class_def_raw_type 1077 +#define block_type 1078 +#define expressions_list_type 1079 +#define star_expressions_type 1080 +#define star_expression_type 1081 +#define star_named_expressions_type 1082 +#define star_named_expression_type 1083 +#define named_expression_type 1084 +#define annotated_rhs_type 1085 +#define expressions_type 1086 +#define expression_type 1087 +#define lambdef_type 1088 +#define lambda_parameters_type 1089 +#define lambda_slash_no_default_type 1090 +#define lambda_slash_with_default_type 1091 +#define lambda_star_etc_type 1092 +#define lambda_kwds_type 1093 +#define lambda_param_no_default_type 1094 +#define lambda_param_with_default_type 1095 +#define lambda_param_maybe_default_type 1096 +#define lambda_param_type 1097 +#define disjunction_type 1098 +#define conjunction_type 1099 +#define inversion_type 1100 +#define comparison_type 1101 +#define compare_op_bitwise_or_pair_type 1102 +#define eq_bitwise_or_type 1103 +#define noteq_bitwise_or_type 1104 +#define lte_bitwise_or_type 1105 +#define lt_bitwise_or_type 1106 +#define gte_bitwise_or_type 1107 +#define gt_bitwise_or_type 1108 +#define notin_bitwise_or_type 1109 +#define in_bitwise_or_type 1110 +#define isnot_bitwise_or_type 1111 +#define is_bitwise_or_type 1112 +#define bitwise_or_type 1113 // Left-recursive +#define bitwise_xor_type 1114 // Left-recursive +#define bitwise_and_type 1115 // Left-recursive +#define shift_expr_type 1116 // Left-recursive +#define sum_type 1117 // Left-recursive +#define term_type 1118 // Left-recursive +#define factor_type 1119 +#define power_type 1120 +#define await_primary_type 1121 +#define primary_type 1122 // Left-recursive +#define slices_type 1123 +#define slice_type 1124 +#define atom_type 1125 +#define strings_type 1126 +#define list_type 1127 +#define listcomp_type 1128 +#define tuple_type 1129 +#define group_type 1130 +#define genexp_type 1131 +#define set_type 1132 +#define setcomp_type 1133 +#define dict_type 1134 +#define dictcomp_type 1135 +#define double_starred_kvpairs_type 1136 +#define double_starred_kvpair_type 1137 +#define kvpair_type 1138 +#define for_if_clauses_type 1139 +#define for_if_clause_type 1140 +#define yield_expr_type 1141 +#define arguments_type 1142 +#define args_type 1143 +#define kwargs_type 1144 +#define starred_expression_type 1145 +#define kwarg_or_starred_type 1146 +#define kwarg_or_double_starred_type 1147 +#define star_targets_type 1148 +#define star_targets_seq_type 1149 +#define star_target_type 1150 +#define star_atom_type 1151 +#define single_target_type 1152 +#define single_subscript_attribute_target_type 1153 +#define del_targets_type 1154 +#define del_target_type 1155 +#define del_t_atom_type 1156 +#define del_target_end_type 1157 +#define targets_type 1158 +#define target_type 1159 +#define t_primary_type 1160 // Left-recursive +#define t_lookahead_type 1161 +#define t_atom_type 1162 +#define incorrect_arguments_type 1163 +#define invalid_kwarg_type 1164 +#define invalid_named_expression_type 1165 +#define invalid_assignment_type 1166 +#define invalid_block_type 1167 +#define invalid_comprehension_type 1168 +#define invalid_dict_comprehension_type 1169 +#define invalid_parameters_type 1170 +#define invalid_star_etc_type 1171 +#define invalid_lambda_star_etc_type 1172 +#define invalid_double_type_comments_type 1173 +#define invalid_del_target_type 1174 +#define invalid_import_from_targets_type 1175 +#define _loop0_1_type 1176 +#define _loop0_2_type 1177 +#define _loop0_4_type 1178 +#define _gather_3_type 1179 +#define _loop0_6_type 1180 +#define _gather_5_type 1181 +#define _loop0_8_type 1182 +#define _gather_7_type 1183 +#define _loop0_10_type 1184 +#define _gather_9_type 1185 +#define _loop1_11_type 1186 +#define _loop0_13_type 1187 +#define _gather_12_type 1188 +#define _tmp_14_type 1189 +#define _tmp_15_type 1190 +#define _tmp_16_type 1191 +#define _tmp_17_type 1192 +#define _tmp_18_type 1193 +#define _tmp_19_type 1194 +#define _tmp_20_type 1195 +#define _tmp_21_type 1196 +#define _loop1_22_type 1197 +#define _tmp_23_type 1198 +#define _tmp_24_type 1199 +#define _loop0_26_type 1200 +#define _gather_25_type 1201 +#define _loop0_28_type 1202 +#define _gather_27_type 1203 +#define _tmp_29_type 1204 +#define _loop0_30_type 1205 +#define _loop1_31_type 1206 +#define _loop0_33_type 1207 +#define _gather_32_type 1208 +#define _tmp_34_type 1209 +#define _loop0_36_type 1210 +#define _gather_35_type 1211 +#define _tmp_37_type 1212 +#define _loop0_39_type 1213 +#define _gather_38_type 1214 +#define _loop0_41_type 1215 +#define _gather_40_type 1216 +#define _loop0_43_type 1217 +#define _gather_42_type 1218 +#define _loop0_45_type 1219 +#define _gather_44_type 1220 +#define _tmp_46_type 1221 +#define _loop1_47_type 1222 +#define _tmp_48_type 1223 +#define _loop1_49_type 1224 +#define _loop0_51_type 1225 +#define _gather_50_type 1226 +#define _tmp_52_type 1227 +#define _loop0_54_type 1228 +#define _gather_53_type 1229 +#define _loop0_56_type 1230 +#define _gather_55_type 1231 +#define _loop0_58_type 1232 +#define _gather_57_type 1233 +#define _loop0_60_type 1234 +#define _gather_59_type 1235 +#define _tmp_61_type 1236 +#define _loop0_63_type 1237 +#define _gather_62_type 1238 +#define _tmp_64_type 1239 +#define _loop0_66_type 1240 +#define _gather_65_type 1241 +#define _loop0_68_type 1242 +#define _gather_67_type 1243 +#define _tmp_69_type 1244 +#define _tmp_70_type 1245 +#define _tmp_71_type 1246 +#define _tmp_72_type 1247 +#define _tmp_73_type 1248 +#define _loop0_74_type 1249 +#define _loop0_75_type 1250 +#define _loop0_76_type 1251 +#define _loop1_77_type 1252 +#define _loop0_78_type 1253 +#define _loop1_79_type 1254 +#define _loop1_80_type 1255 +#define _loop1_81_type 1256 +#define _loop0_82_type 1257 +#define _loop1_83_type 1258 +#define _loop0_84_type 1259 +#define _loop1_85_type 1260 +#define _loop0_86_type 1261 +#define _loop1_87_type 1262 +#define _loop1_88_type 1263 +#define _tmp_89_type 1264 #define _loop0_91_type 1265 -#define _loop0_92_type 1266 -#define _loop0_93_type 1267 -#define _loop1_94_type 1268 -#define _loop0_95_type 1269 -#define _loop1_96_type 1270 -#define _loop1_97_type 1271 -#define _loop1_98_type 1272 -#define _loop0_99_type 1273 -#define _loop1_100_type 1274 -#define _loop0_101_type 1275 -#define _loop1_102_type 1276 -#define _loop0_103_type 1277 -#define _loop1_104_type 1278 -#define _loop1_105_type 1279 -#define _loop1_106_type 1280 -#define _loop1_107_type 1281 -#define _tmp_108_type 1282 -#define _loop0_110_type 1283 -#define _gather_109_type 1284 -#define _tmp_111_type 1285 -#define _tmp_112_type 1286 -#define _tmp_113_type 1287 -#define _tmp_114_type 1288 -#define _loop1_115_type 1289 -#define _tmp_116_type 1290 -#define _tmp_117_type 1291 -#define _loop0_119_type 1292 -#define _gather_118_type 1293 -#define _loop1_120_type 1294 -#define _loop0_121_type 1295 -#define _loop0_122_type 1296 -#define _tmp_123_type 1297 -#define _tmp_124_type 1298 -#define _loop0_126_type 1299 -#define _gather_125_type 1300 -#define _loop0_128_type 1301 -#define _gather_127_type 1302 -#define _loop0_130_type 1303 -#define _gather_129_type 1304 -#define _loop0_132_type 1305 -#define _gather_131_type 1306 +#define _gather_90_type 1266 +#define _loop1_92_type 1267 +#define _loop0_94_type 1268 +#define _gather_93_type 1269 +#define _loop1_95_type 1270 +#define _loop0_96_type 1271 +#define _loop0_97_type 1272 +#define _loop0_98_type 1273 +#define _loop1_99_type 1274 +#define _loop0_100_type 1275 +#define _loop1_101_type 1276 +#define _loop1_102_type 1277 +#define _loop1_103_type 1278 +#define _loop0_104_type 1279 +#define _loop1_105_type 1280 +#define _loop0_106_type 1281 +#define _loop1_107_type 1282 +#define _loop0_108_type 1283 +#define _loop1_109_type 1284 +#define _loop1_110_type 1285 +#define _loop1_111_type 1286 +#define _loop1_112_type 1287 +#define _tmp_113_type 1288 +#define _loop0_115_type 1289 +#define _gather_114_type 1290 +#define _tmp_116_type 1291 +#define _tmp_117_type 1292 +#define _tmp_118_type 1293 +#define _tmp_119_type 1294 +#define _loop1_120_type 1295 +#define _tmp_121_type 1296 +#define _tmp_122_type 1297 +#define _loop0_124_type 1298 +#define _gather_123_type 1299 +#define _loop1_125_type 1300 +#define _loop0_126_type 1301 +#define _loop0_127_type 1302 +#define _tmp_128_type 1303 +#define _tmp_129_type 1304 +#define _loop0_131_type 1305 +#define _gather_130_type 1306 #define _loop0_133_type 1307 -#define _loop0_135_type 1308 -#define _gather_134_type 1309 -#define _tmp_136_type 1310 -#define _loop0_138_type 1311 -#define _gather_137_type 1312 -#define _loop0_140_type 1313 -#define _gather_139_type 1314 -#define _tmp_141_type 1315 -#define _loop0_142_type 1316 -#define _tmp_143_type 1317 -#define _tmp_144_type 1318 -#define _tmp_145_type 1319 -#define _tmp_146_type 1320 -#define _loop0_147_type 1321 -#define _tmp_148_type 1322 -#define _tmp_149_type 1323 -#define _tmp_150_type 1324 -#define _tmp_151_type 1325 -#define _tmp_152_type 1326 -#define _tmp_153_type 1327 -#define _tmp_154_type 1328 -#define _tmp_155_type 1329 -#define _tmp_156_type 1330 -#define _tmp_157_type 1331 -#define _tmp_158_type 1332 -#define _tmp_159_type 1333 -#define _tmp_160_type 1334 -#define _tmp_161_type 1335 -#define _loop1_162_type 1336 -#define _tmp_163_type 1337 -#define _tmp_164_type 1338 +#define _gather_132_type 1308 +#define _loop0_135_type 1309 +#define _gather_134_type 1310 +#define _loop0_137_type 1311 +#define _gather_136_type 1312 +#define _loop0_138_type 1313 +#define _loop0_140_type 1314 +#define _gather_139_type 1315 +#define _tmp_141_type 1316 +#define _loop0_143_type 1317 +#define _gather_142_type 1318 +#define _loop0_145_type 1319 +#define _gather_144_type 1320 +#define _tmp_146_type 1321 +#define _loop0_147_type 1322 +#define _tmp_148_type 1323 +#define _tmp_149_type 1324 +#define _tmp_150_type 1325 +#define _tmp_151_type 1326 +#define _loop0_152_type 1327 +#define _tmp_153_type 1328 +#define _tmp_154_type 1329 +#define _tmp_155_type 1330 +#define _tmp_156_type 1331 +#define _tmp_157_type 1332 +#define _tmp_158_type 1333 +#define _loop0_160_type 1334 +#define _gather_159_type 1335 +#define _loop0_162_type 1336 +#define _gather_161_type 1337 +#define _tmp_163_type 1338 +#define _tmp_164_type 1339 +#define _tmp_165_type 1340 +#define _tmp_166_type 1341 +#define _tmp_167_type 1342 +#define _tmp_168_type 1343 +#define _tmp_169_type 1344 +#define _tmp_170_type 1345 +#define _loop1_171_type 1346 +#define _tmp_172_type 1347 +#define _tmp_173_type 1348 +#define _tmp_174_type 1349 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -453,7 +464,7 @@ static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); -static stmt_ty match_stmt_rule(Parser *p); +static void *match_stmt_rule(Parser *p); static void *case_block_rule(Parser *p); static void *pattern_rule(Parser *p); static void *guard_rule(Parser *p); @@ -469,6 +480,7 @@ static void *class_pattern_rule(Parser *p); static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); +static expr_ty arg_pattern_rule(Parser *p); static void *keyword_pattern_rule(Parser *p); static void *value_pattern_rule(Parser *p); static void *key_value_pattern_rule(Parser *p); @@ -650,110 +662,120 @@ static asdl_seq *_loop0_58_rule(Parser *p); static asdl_seq *_gather_57_rule(Parser *p); static asdl_seq *_loop0_60_rule(Parser *p); static asdl_seq *_gather_59_rule(Parser *p); -static asdl_seq *_loop0_62_rule(Parser *p); -static asdl_seq *_gather_61_rule(Parser *p); -static asdl_seq *_loop0_64_rule(Parser *p); -static asdl_seq *_gather_63_rule(Parser *p); -static void *_tmp_65_rule(Parser *p); -static void *_tmp_66_rule(Parser *p); -static void *_tmp_67_rule(Parser *p); -static void *_tmp_68_rule(Parser *p); -static asdl_seq *_loop0_69_rule(Parser *p); -static asdl_seq *_loop0_70_rule(Parser *p); -static asdl_seq *_loop0_71_rule(Parser *p); -static asdl_seq *_loop1_72_rule(Parser *p); -static asdl_seq *_loop0_73_rule(Parser *p); -static asdl_seq *_loop1_74_rule(Parser *p); -static asdl_seq *_loop1_75_rule(Parser *p); -static asdl_seq *_loop1_76_rule(Parser *p); -static asdl_seq *_loop0_77_rule(Parser *p); -static asdl_seq *_loop1_78_rule(Parser *p); -static asdl_seq *_loop0_79_rule(Parser *p); +static void *_tmp_61_rule(Parser *p); +static asdl_seq *_loop0_63_rule(Parser *p); +static asdl_seq *_gather_62_rule(Parser *p); +static void *_tmp_64_rule(Parser *p); +static asdl_seq *_loop0_66_rule(Parser *p); +static asdl_seq *_gather_65_rule(Parser *p); +static asdl_seq *_loop0_68_rule(Parser *p); +static asdl_seq *_gather_67_rule(Parser *p); +static void *_tmp_69_rule(Parser *p); +static void *_tmp_70_rule(Parser *p); +static void *_tmp_71_rule(Parser *p); +static void *_tmp_72_rule(Parser *p); +static void *_tmp_73_rule(Parser *p); +static asdl_seq *_loop0_74_rule(Parser *p); +static asdl_seq *_loop0_75_rule(Parser *p); +static asdl_seq *_loop0_76_rule(Parser *p); +static asdl_seq *_loop1_77_rule(Parser *p); +static asdl_seq *_loop0_78_rule(Parser *p); +static asdl_seq *_loop1_79_rule(Parser *p); static asdl_seq *_loop1_80_rule(Parser *p); -static asdl_seq *_loop0_81_rule(Parser *p); -static asdl_seq *_loop1_82_rule(Parser *p); +static asdl_seq *_loop1_81_rule(Parser *p); +static asdl_seq *_loop0_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static void *_tmp_84_rule(Parser *p); +static asdl_seq *_loop0_84_rule(Parser *p); +static asdl_seq *_loop1_85_rule(Parser *p); static asdl_seq *_loop0_86_rule(Parser *p); -static asdl_seq *_gather_85_rule(Parser *p); static asdl_seq *_loop1_87_rule(Parser *p); -static asdl_seq *_loop0_89_rule(Parser *p); -static asdl_seq *_gather_88_rule(Parser *p); -static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop1_88_rule(Parser *p); +static void *_tmp_89_rule(Parser *p); static asdl_seq *_loop0_91_rule(Parser *p); -static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_loop0_93_rule(Parser *p); -static asdl_seq *_loop1_94_rule(Parser *p); -static asdl_seq *_loop0_95_rule(Parser *p); -static asdl_seq *_loop1_96_rule(Parser *p); -static asdl_seq *_loop1_97_rule(Parser *p); -static asdl_seq *_loop1_98_rule(Parser *p); -static asdl_seq *_loop0_99_rule(Parser *p); -static asdl_seq *_loop1_100_rule(Parser *p); -static asdl_seq *_loop0_101_rule(Parser *p); +static asdl_seq *_gather_90_rule(Parser *p); +static asdl_seq *_loop1_92_rule(Parser *p); +static asdl_seq *_loop0_94_rule(Parser *p); +static asdl_seq *_gather_93_rule(Parser *p); +static asdl_seq *_loop1_95_rule(Parser *p); +static asdl_seq *_loop0_96_rule(Parser *p); +static asdl_seq *_loop0_97_rule(Parser *p); +static asdl_seq *_loop0_98_rule(Parser *p); +static asdl_seq *_loop1_99_rule(Parser *p); +static asdl_seq *_loop0_100_rule(Parser *p); +static asdl_seq *_loop1_101_rule(Parser *p); static asdl_seq *_loop1_102_rule(Parser *p); -static asdl_seq *_loop0_103_rule(Parser *p); -static asdl_seq *_loop1_104_rule(Parser *p); +static asdl_seq *_loop1_103_rule(Parser *p); +static asdl_seq *_loop0_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); -static asdl_seq *_loop1_106_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); static asdl_seq *_loop1_107_rule(Parser *p); -static void *_tmp_108_rule(Parser *p); -static asdl_seq *_loop0_110_rule(Parser *p); -static asdl_seq *_gather_109_rule(Parser *p); -static void *_tmp_111_rule(Parser *p); -static void *_tmp_112_rule(Parser *p); +static asdl_seq *_loop0_108_rule(Parser *p); +static asdl_seq *_loop1_109_rule(Parser *p); +static asdl_seq *_loop1_110_rule(Parser *p); +static asdl_seq *_loop1_111_rule(Parser *p); +static asdl_seq *_loop1_112_rule(Parser *p); static void *_tmp_113_rule(Parser *p); -static void *_tmp_114_rule(Parser *p); -static asdl_seq *_loop1_115_rule(Parser *p); +static asdl_seq *_loop0_115_rule(Parser *p); +static asdl_seq *_gather_114_rule(Parser *p); static void *_tmp_116_rule(Parser *p); static void *_tmp_117_rule(Parser *p); -static asdl_seq *_loop0_119_rule(Parser *p); -static asdl_seq *_gather_118_rule(Parser *p); +static void *_tmp_118_rule(Parser *p); +static void *_tmp_119_rule(Parser *p); static asdl_seq *_loop1_120_rule(Parser *p); -static asdl_seq *_loop0_121_rule(Parser *p); -static asdl_seq *_loop0_122_rule(Parser *p); -static void *_tmp_123_rule(Parser *p); -static void *_tmp_124_rule(Parser *p); +static void *_tmp_121_rule(Parser *p); +static void *_tmp_122_rule(Parser *p); +static asdl_seq *_loop0_124_rule(Parser *p); +static asdl_seq *_gather_123_rule(Parser *p); +static asdl_seq *_loop1_125_rule(Parser *p); static asdl_seq *_loop0_126_rule(Parser *p); -static asdl_seq *_gather_125_rule(Parser *p); -static asdl_seq *_loop0_128_rule(Parser *p); -static asdl_seq *_gather_127_rule(Parser *p); -static asdl_seq *_loop0_130_rule(Parser *p); -static asdl_seq *_gather_129_rule(Parser *p); -static asdl_seq *_loop0_132_rule(Parser *p); -static asdl_seq *_gather_131_rule(Parser *p); +static asdl_seq *_loop0_127_rule(Parser *p); +static void *_tmp_128_rule(Parser *p); +static void *_tmp_129_rule(Parser *p); +static asdl_seq *_loop0_131_rule(Parser *p); +static asdl_seq *_gather_130_rule(Parser *p); static asdl_seq *_loop0_133_rule(Parser *p); +static asdl_seq *_gather_132_rule(Parser *p); static asdl_seq *_loop0_135_rule(Parser *p); static asdl_seq *_gather_134_rule(Parser *p); -static void *_tmp_136_rule(Parser *p); +static asdl_seq *_loop0_137_rule(Parser *p); +static asdl_seq *_gather_136_rule(Parser *p); static asdl_seq *_loop0_138_rule(Parser *p); -static asdl_seq *_gather_137_rule(Parser *p); static asdl_seq *_loop0_140_rule(Parser *p); static asdl_seq *_gather_139_rule(Parser *p); static void *_tmp_141_rule(Parser *p); -static asdl_seq *_loop0_142_rule(Parser *p); -static void *_tmp_143_rule(Parser *p); -static void *_tmp_144_rule(Parser *p); -static void *_tmp_145_rule(Parser *p); +static asdl_seq *_loop0_143_rule(Parser *p); +static asdl_seq *_gather_142_rule(Parser *p); +static asdl_seq *_loop0_145_rule(Parser *p); +static asdl_seq *_gather_144_rule(Parser *p); static void *_tmp_146_rule(Parser *p); static asdl_seq *_loop0_147_rule(Parser *p); static void *_tmp_148_rule(Parser *p); static void *_tmp_149_rule(Parser *p); static void *_tmp_150_rule(Parser *p); static void *_tmp_151_rule(Parser *p); -static void *_tmp_152_rule(Parser *p); +static asdl_seq *_loop0_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); static void *_tmp_155_rule(Parser *p); static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); -static void *_tmp_159_rule(Parser *p); -static void *_tmp_160_rule(Parser *p); -static void *_tmp_161_rule(Parser *p); -static asdl_seq *_loop1_162_rule(Parser *p); +static asdl_seq *_loop0_160_rule(Parser *p); +static asdl_seq *_gather_159_rule(Parser *p); +static asdl_seq *_loop0_162_rule(Parser *p); +static asdl_seq *_gather_161_rule(Parser *p); static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); +static void *_tmp_165_rule(Parser *p); +static void *_tmp_166_rule(Parser *p); +static void *_tmp_167_rule(Parser *p); +static void *_tmp_168_rule(Parser *p); +static void *_tmp_169_rule(Parser *p); +static void *_tmp_170_rule(Parser *p); +static asdl_seq *_loop1_171_rule(Parser *p); +static void *_tmp_172_rule(Parser *p); +static void *_tmp_173_rule(Parser *p); +static void *_tmp_174_rule(Parser *p); // file: statements? $ @@ -2066,7 +2088,7 @@ compound_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); - stmt_ty match_stmt_var; + void *match_stmt_var; if ( (match_stmt_var = match_stmt_rule(p)) // match_stmt ) @@ -4609,7 +4631,7 @@ finally_block_rule(Parser *p) } // match_stmt: "match" expression ':' NEWLINE INDENT case_block+ DEDENT -static stmt_ty +static void * match_stmt_rule(Parser *p) { D(p->level++); @@ -4617,7 +4639,7 @@ match_stmt_rule(Parser *p) D(p->level--); return NULL; } - stmt_ty _res = NULL; + void * _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5519,7 +5541,7 @@ sequence_pattern_rule(Parser *p) return _res; } -// mapping_pattern: '{' items_pattern '}' +// mapping_pattern: '{' items_pattern? '}' static void * mapping_pattern_rule(Parser *p) { @@ -5539,24 +5561,24 @@ mapping_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' items_pattern '}' + { // '{' items_pattern? '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern '}'")); + D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); Token * _literal; Token * _literal_1; void *items; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (items = items_pattern_rule(p)) // items_pattern + (items = items_pattern_rule(p), 1) // items_pattern? && (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern '}'")); + D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5576,7 +5598,7 @@ mapping_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern '}'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern? '}'")); } _res = NULL; done: @@ -5586,9 +5608,10 @@ mapping_pattern_rule(Parser *p) // class_pattern: // | name_or_attr '(' ')' -// | name_or_attr '(' ','.pattern+ ','? ')' +// | name_or_attr '(' ','.arg_pattern+ ','? ')' // | name_or_attr '(' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' +// | name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')' +// | name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' static void * class_pattern_rule(Parser *p) { @@ -5647,12 +5670,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); } - { // name_or_attr '(' ','.pattern+ ','? ')' + { // name_or_attr '(' ','.arg_pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -5664,14 +5687,14 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_53_rule(p)) // ','.pattern+ + (args = _gather_53_rule(p)) // ','.arg_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5691,7 +5714,7 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); } { // name_or_attr '(' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { @@ -5739,12 +5762,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); } - { // name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' + { // name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); Token * _literal; Token * _literal_1; Token * _literal_2; @@ -5758,7 +5781,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_57_rule(p)) // ','.pattern+ + (args = _gather_57_rule(p)) // ','.arg_pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && @@ -5769,7 +5792,7 @@ class_pattern_rule(Parser *p) (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5789,7 +5812,58 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); + } + { // name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); + asdl_seq * _gather_62_var; + Token * _literal; + Token * _literal_1; + Token * _literal_2; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + void *_opt_var_1; + UNUSED(_opt_var_1); // Silence compiler warnings + void *_opt_var_2; + UNUSED(_opt_var_2); // Silence compiler warnings + expr_ty error; + void *func; + if ( + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (_opt_var = _tmp_61_rule(p), 1) // [','.arg_pattern+ ','] + && + (_gather_62_var = _gather_62_rule(p)) // ','.keyword_pattern+ + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (error = arg_pattern_rule(p)) // arg_pattern + && + (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.(arg_pattern | keyword_pattern)+] + && + (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "positional pattern follows keyword pattern" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); } _res = NULL; done: @@ -5932,7 +6006,7 @@ values_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * values; if ( - (values = _gather_61_rule(p)) // ','.value_pattern+ + (values = _gather_65_rule(p)) // ','.value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -5977,7 +6051,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_63_rule(p)) // ','.key_value_pattern+ + (items = _gather_67_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6001,7 +6075,72 @@ items_pattern_rule(Parser *p) return _res; } -// keyword_pattern: NAME '=' or_pattern +// arg_pattern: pattern !'=' | '*' NAME +static expr_ty +arg_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // pattern !'=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> arg_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern !'='")); + void *pattern_var; + if ( + (pattern_var = pattern_rule(p)) // pattern + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' + ) + { + D(fprintf(stderr, "%*c+ arg_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern !'='")); + _res = pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s arg_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern !'='")); + } + { // '*' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> arg_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME")); + Token * error; + expr_ty name_var; + if ( + (error = _PyPegen_expect_token(p, 16)) // token='*' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ arg_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s arg_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// keyword_pattern: NAME '=' or_pattern | '**' NAME static void * keyword_pattern_rule(Parser *p) { @@ -6060,6 +6199,33 @@ keyword_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); } + { // '**' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME")); + Token * error; + expr_ty name_var; + if ( + (error = _PyPegen_expect_token(p, 35)) // token='**' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME")); + } _res = NULL; done: D(p->level--); @@ -6148,8 +6314,7 @@ value_pattern_rule(Parser *p) } // key_value_pattern: -// | literal_pattern ':' closed_pattern -// | constant_pattern ':' closed_pattern +// | (literal_pattern | constant_pattern) ':' closed_pattern // | '**' name_pattern static void * key_value_pattern_rule(Parser *p) @@ -6161,54 +6326,24 @@ key_value_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // literal_pattern ':' closed_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern ':' closed_pattern")); - Token * _literal; - void *key; - void *value; - if ( - (key = literal_pattern_rule(p)) // literal_pattern - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (value = closed_pattern_rule(p)) // closed_pattern - ) - { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern ':' closed_pattern")); - _res = _PyPegen_key_value_pair ( p , key , value ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern ':' closed_pattern")); - } - { // constant_pattern ':' closed_pattern + { // (literal_pattern | constant_pattern) ':' closed_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern ':' closed_pattern")); + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); Token * _literal; void *key; void *value; if ( - (key = constant_pattern_rule(p)) // constant_pattern + (key = _tmp_69_rule(p)) // literal_pattern | constant_pattern && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (value = closed_pattern_rule(p)) // closed_pattern ) { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern ':' closed_pattern")); + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); _res = _PyPegen_key_value_pair ( p , key , value ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6219,7 +6354,7 @@ key_value_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern ':' closed_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); } { // '**' name_pattern if (p->error_indicator) { @@ -6350,7 +6485,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_65_rule(p), 1) // ['from' expression] + (b = _tmp_70_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -6525,7 +6660,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_66_rule(p), 1) // ['->' expression] + (a = _tmp_71_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6585,7 +6720,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_67_rule(p), 1) // ['->' expression] + (a = _tmp_72_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6649,7 +6784,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_68_rule, p) + _PyPegen_lookahead(1, _tmp_73_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -6793,9 +6928,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_69_rule(p)) // param_no_default* + (b = _loop0_74_rule(p)) // param_no_default* && - (c = _loop0_70_rule(p)) // param_with_default* + (c = _loop0_75_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -6825,7 +6960,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_71_rule(p)) // param_with_default* + (b = _loop0_76_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -6853,9 +6988,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_72_rule(p)) // param_no_default+ + (a = _loop1_77_rule(p)) // param_no_default+ && - (b = _loop0_73_rule(p)) // param_with_default* + (b = _loop0_78_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -6882,7 +7017,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_74_rule(p)) // param_with_default+ + (a = _loop1_79_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -6951,7 +7086,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_75_rule(p)) // param_no_default+ + (a = _loop1_80_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -6980,7 +7115,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_76_rule(p)) // param_no_default+ + (a = _loop1_81_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7030,9 +7165,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_77_rule(p)) // param_no_default* + (a = _loop0_82_rule(p)) // param_no_default* && - (b = _loop1_78_rule(p)) // param_with_default+ + (b = _loop1_83_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7062,9 +7197,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_79_rule(p)) // param_no_default* + (a = _loop0_84_rule(p)) // param_no_default* && - (b = _loop1_80_rule(p)) // param_with_default+ + (b = _loop1_85_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7120,7 +7255,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_81_rule(p)) // param_maybe_default* + (b = _loop0_86_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7153,7 +7288,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_82_rule(p)) // param_maybe_default+ + (b = _loop1_87_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -7675,7 +7810,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_83_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_88_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -7796,7 +7931,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_84_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_89_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7945,7 +8080,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_85_rule(p)) // ','.star_expression+ + (a = _gather_90_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8005,7 +8140,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_87_rule(p)) // ((',' star_expression))+ + (b = _loop1_92_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8200,7 +8335,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_88_rule(p)) // ','.star_named_expression+ + (a = _gather_93_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8498,7 +8633,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_90_rule(p)) // ((',' expression))+ + (b = _loop1_95_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8797,9 +8932,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_91_rule(p)) // lambda_param_no_default* + (b = _loop0_96_rule(p)) // lambda_param_no_default* && - (c = _loop0_92_rule(p)) // lambda_param_with_default* + (c = _loop0_97_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8829,7 +8964,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_93_rule(p)) // lambda_param_with_default* + (b = _loop0_98_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8857,9 +8992,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_94_rule(p)) // lambda_param_no_default+ + (a = _loop1_99_rule(p)) // lambda_param_no_default+ && - (b = _loop0_95_rule(p)) // lambda_param_with_default* + (b = _loop0_100_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8886,7 +9021,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_96_rule(p)) // lambda_param_with_default+ + (a = _loop1_101_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8957,7 +9092,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_97_rule(p)) // lambda_param_no_default+ + (a = _loop1_102_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -8986,7 +9121,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_98_rule(p)) // lambda_param_no_default+ + (a = _loop1_103_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9036,9 +9171,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_99_rule(p)) // lambda_param_no_default* + (a = _loop0_104_rule(p)) // lambda_param_no_default* && - (b = _loop1_100_rule(p)) // lambda_param_with_default+ + (b = _loop1_105_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9068,9 +9203,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_101_rule(p)) // lambda_param_no_default* + (a = _loop0_106_rule(p)) // lambda_param_no_default* && - (b = _loop1_102_rule(p)) // lambda_param_with_default+ + (b = _loop1_107_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9126,7 +9261,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_103_rule(p)) // lambda_param_maybe_default* + (b = _loop0_108_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9159,7 +9294,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_104_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_109_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9586,7 +9721,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_105_rule(p)) // (('or' conjunction))+ + (b = _loop1_110_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -9672,7 +9807,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_106_rule(p)) // (('and' inversion))+ + (b = _loop1_111_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -9840,7 +9975,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_107_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_112_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10168,10 +10303,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_108_var; + void *_tmp_113_var; expr_ty a; if ( - (_tmp_108_var = _tmp_108_rule(p)) // '!=' + (_tmp_113_var = _tmp_113_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12100,7 +12235,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_109_rule(p)) // ','.slice+ + (a = _gather_114_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12170,7 +12305,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_111_rule(p), 1) // [':' expression?] + (c = _tmp_116_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -12444,15 +12579,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_112_var; + void *_tmp_117_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_112_var = _tmp_112_rule(p)) // tuple | group | genexp + (_tmp_117_var = _tmp_117_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_112_var; + _res = _tmp_117_var; goto done; } p->mark = _mark; @@ -12465,15 +12600,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_113_var; + void *_tmp_118_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_113_var = _tmp_113_rule(p)) // list | listcomp + (_tmp_118_var = _tmp_118_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_113_var; + _res = _tmp_118_var; goto done; } p->mark = _mark; @@ -12486,15 +12621,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_114_var; + void *_tmp_119_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_114_var = _tmp_114_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_119_var = _tmp_119_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_114_var; + _res = _tmp_119_var; goto done; } p->mark = _mark; @@ -12563,7 +12698,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_115_rule(p)) // STRING+ + (a = _loop1_120_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -12770,7 +12905,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_116_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_121_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -12826,7 +12961,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_117_rule(p)) // yield_expr | named_expression + (a = _tmp_122_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13262,7 +13397,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_118_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_123_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13413,13 +13548,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_120_var; + asdl_seq * _loop1_125_var; if ( - (_loop1_120_var = _loop1_120_rule(p)) // for_if_clause+ + (_loop1_125_var = _loop1_125_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_120_var; + _res = _loop1_125_var; goto done; } p->mark = _mark; @@ -13468,7 +13603,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_121_rule(p)) // (('if' disjunction))* + (c = _loop0_126_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13504,7 +13639,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_122_rule(p)) // (('if' disjunction))* + (c = _loop0_127_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13729,7 +13864,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_123_rule(p), 1) // [',' args] + (b = _tmp_128_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -13798,7 +13933,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_124_rule(p), 1) // [',' args] + (b = _tmp_129_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -13853,11 +13988,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_125_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_130_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_127_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_132_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -13879,13 +14014,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_129_var; + asdl_seq * _gather_134_var; if ( - (_gather_129_var = _gather_129_rule(p)) // ','.kwarg_or_starred+ + (_gather_134_var = _gather_134_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_129_var; + _res = _gather_134_var; goto done; } p->mark = _mark; @@ -13898,13 +14033,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_131_var; + asdl_seq * _gather_136_var; if ( - (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_136_var = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_131_var; + _res = _gather_136_var; goto done; } p->mark = _mark; @@ -14266,7 +14401,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_133_rule(p)) // ((',' star_target))* + (b = _loop0_138_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14320,7 +14455,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_134_rule(p)) // ','.star_target+ + (a = _gather_139_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14383,7 +14518,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_136_rule(p)) // !'*' star_target + (a = _tmp_141_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -14905,7 +15040,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_137_rule(p)) // ','.del_target+ + (a = _gather_142_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15384,7 +15519,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_139_rule(p)) // ','.target+ + (a = _gather_144_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16096,7 +16231,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_141_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_146_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -16378,14 +16513,14 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_142_var; + asdl_seq * _loop0_147_var; expr_ty a; if ( (a = star_named_expression_rule(p)) // star_named_expression && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_142_var = _loop0_142_rule(p)) // star_named_expressions* + (_loop0_147_var = _loop0_147_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -16421,7 +16556,7 @@ invalid_assignment_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_143_rule(p), 1) // ['=' annotated_rhs] + (_opt_var = _tmp_148_rule(p), 1) // ['=' annotated_rhs] ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); @@ -16444,14 +16579,14 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); Token * _literal; - void *_tmp_144_var; + void *_tmp_149_var; expr_ty a; if ( (a = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_tmp_144_var = _tmp_144_rule(p)) // yield_expr | star_expressions + (_tmp_149_var = _tmp_149_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); @@ -16473,7 +16608,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_145_var; + void *_tmp_150_var; expr_ty a; AugOperator* augassign_var; if ( @@ -16481,7 +16616,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_145_var = _tmp_145_rule(p)) // yield_expr | star_expressions + (_tmp_150_var = _tmp_150_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -16563,11 +16698,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_146_var; + void *_tmp_151_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_146_var = _tmp_146_rule(p)) // '[' | '(' | '{' + (_tmp_151_var = _tmp_151_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -16664,13 +16799,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_147_var; - void *_tmp_148_var; + asdl_seq * _loop0_152_var; + void *_tmp_153_var; arg_ty param_no_default_var; if ( - (_loop0_147_var = _loop0_147_rule(p)) // param_no_default* + (_loop0_152_var = _loop0_152_rule(p)) // param_no_default* && - (_tmp_148_var = _tmp_148_rule(p)) // slash_with_default | param_with_default+ + (_tmp_153_var = _tmp_153_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -16712,11 +16847,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_149_var; + void *_tmp_154_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_149_var = _tmp_149_rule(p)) // ')' | ',' (')' | '**') + (_tmp_154_var = _tmp_154_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -16786,11 +16921,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_150_var; + void *_tmp_155_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_150_var = _tmp_150_rule(p)) // ':' | ',' (':' | '**') + (_tmp_155_var = _tmp_155_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18200,12 +18335,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_151_var; + void *_tmp_156_var; while ( - (_tmp_151_var = _tmp_151_rule(p)) // star_targets '=' + (_tmp_156_var = _tmp_156_rule(p)) // star_targets '=' ) { - _res = _tmp_151_var; + _res = _tmp_156_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18653,12 +18788,12 @@ _loop0_30_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_152_var; + void *_tmp_157_var; while ( - (_tmp_152_var = _tmp_152_rule(p)) // '.' | '...' + (_tmp_157_var = _tmp_157_rule(p)) // '.' | '...' ) { - _res = _tmp_152_var; + _res = _tmp_157_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18719,12 +18854,12 @@ _loop1_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_153_var; + void *_tmp_158_var; while ( - (_tmp_153_var = _tmp_153_rule(p)) // '.' | '...' + (_tmp_158_var = _tmp_158_rule(p)) // '.' | '...' ) { - _res = _tmp_153_var; + _res = _tmp_158_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19934,7 +20069,7 @@ _tmp_52_rule(Parser *p) return _res; } -// _loop0_54: ',' pattern +// _loop0_54: ',' arg_pattern static asdl_seq * _loop0_54_rule(Parser *p) { @@ -19955,18 +20090,18 @@ _loop0_54_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' arg_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); Token * _literal; - void *elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = arg_pattern_rule(p)) // arg_pattern ) { _res = elem; @@ -19992,7 +20127,7 @@ _loop0_54_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20009,7 +20144,7 @@ _loop0_54_rule(Parser *p) return _seq; } -// _gather_53: pattern _loop0_54 +// _gather_53: arg_pattern _loop0_54 static asdl_seq * _gather_53_rule(Parser *p) { @@ -20020,27 +20155,27 @@ _gather_53_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_54 + { // arg_pattern _loop0_54 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); - void *elem; + D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_54")); + expr_ty elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = arg_pattern_rule(p)) // arg_pattern && (seq = _loop0_54_rule(p)) // _loop0_54 ) { - D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); + D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_54")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_54")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_54")); } _res = NULL; done: @@ -20162,7 +20297,7 @@ _gather_55_rule(Parser *p) return _res; } -// _loop0_58: ',' pattern +// _loop0_58: ',' arg_pattern static asdl_seq * _loop0_58_rule(Parser *p) { @@ -20183,18 +20318,18 @@ _loop0_58_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' arg_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); Token * _literal; - void *elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = arg_pattern_rule(p)) // arg_pattern ) { _res = elem; @@ -20220,7 +20355,7 @@ _loop0_58_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20237,7 +20372,7 @@ _loop0_58_rule(Parser *p) return _seq; } -// _gather_57: pattern _loop0_58 +// _gather_57: arg_pattern _loop0_58 static asdl_seq * _gather_57_rule(Parser *p) { @@ -20248,27 +20383,27 @@ _gather_57_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_58 + { // arg_pattern _loop0_58 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); - void *elem; + D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_58")); + expr_ty elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = arg_pattern_rule(p)) // arg_pattern && (seq = _loop0_58_rule(p)) // _loop0_58 ) { - D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_58")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_58")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_58")); } _res = NULL; done: @@ -20390,9 +20525,48 @@ _gather_59_rule(Parser *p) return _res; } -// _loop0_62: ',' value_pattern +// _tmp_61: ','.arg_pattern+ ',' +static void * +_tmp_61_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ','.arg_pattern+ ',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.arg_pattern+ ','")); + asdl_seq * _gather_159_var; + Token * _literal; + if ( + (_gather_159_var = _gather_159_rule(p)) // ','.arg_pattern+ + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.arg_pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_159_var, _literal); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.arg_pattern+ ','")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_63: ',' keyword_pattern static asdl_seq * -_loop0_62_rule(Parser *p) +_loop0_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20411,18 +20585,18 @@ _loop0_62_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' value_pattern + { // ',' keyword_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = value_pattern_rule(p)) // value_pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern ) { _res = elem; @@ -20447,8 +20621,8 @@ _loop0_62_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20460,14 +20634,14 @@ _loop0_62_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); D(p->level--); return _seq; } -// _gather_61: value_pattern _loop0_62 +// _gather_62: keyword_pattern _loop0_63 static asdl_seq * -_gather_61_rule(Parser *p) +_gather_62_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20476,27 +20650,66 @@ _gather_61_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // value_pattern _loop0_62 + { // keyword_pattern _loop0_63 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_62")); + D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); void *elem; asdl_seq * seq; if ( - (elem = value_pattern_rule(p)) // value_pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_62_rule(p)) // _loop0_62 + (seq = _loop0_63_rule(p)) // _loop0_63 ) { - D(fprintf(stderr, "%*c+ _gather_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_62")); + D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_61[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_62")); + D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_63")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_64: ',' ','.(arg_pattern | keyword_pattern)+ +static void * +_tmp_64_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ',' ','.(arg_pattern | keyword_pattern)+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); + asdl_seq * _gather_161_var; + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_gather_161_var = _gather_161_rule(p)) // ','.(arg_pattern | keyword_pattern)+ + ) + { + D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_161_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); } _res = NULL; done: @@ -20504,9 +20717,9 @@ _gather_61_rule(Parser *p) return _res; } -// _loop0_64: ',' key_value_pattern +// _loop0_66: ',' value_pattern static asdl_seq * -_loop0_64_rule(Parser *p) +_loop0_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20525,18 +20738,18 @@ _loop0_64_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' key_value_pattern + { // ',' value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = key_value_pattern_rule(p)) // key_value_pattern + (elem = value_pattern_rule(p)) // value_pattern ) { _res = elem; @@ -20561,8 +20774,8 @@ _loop0_64_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20574,14 +20787,14 @@ _loop0_64_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq); D(p->level--); return _seq; } -// _gather_63: key_value_pattern _loop0_64 +// _gather_65: value_pattern _loop0_66 static asdl_seq * -_gather_63_rule(Parser *p) +_gather_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20590,27 +20803,27 @@ _gather_63_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_64 + { // value_pattern _loop0_66 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_64")); + D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_66")); void *elem; asdl_seq * seq; if ( - (elem = key_value_pattern_rule(p)) // key_value_pattern + (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_64_rule(p)) // _loop0_64 + (seq = _loop0_66_rule(p)) // _loop0_66 ) { - D(fprintf(stderr, "%*c+ _gather_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_64")); + D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_66")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_63[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_64")); + D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_66")); } _res = NULL; done: @@ -20618,32 +20831,201 @@ _gather_63_rule(Parser *p) return _res; } -// _tmp_65: 'from' expression -static void * -_tmp_65_rule(Parser *p) +// _loop0_68: ',' key_value_pattern +static asdl_seq * +_loop0_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // 'from' expression + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' key_value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 514)) // token='from' - && + D(fprintf(stderr, "%*c> _loop0_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + Token * _literal; + void *elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = key_value_pattern_rule(p)) // key_value_pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_68[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_68_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_67: key_value_pattern _loop0_68 +static asdl_seq * +_gather_67_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // key_value_pattern _loop0_68 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_68")); + void *elem; + asdl_seq * seq; + if ( + (elem = key_value_pattern_rule(p)) // key_value_pattern + && + (seq = _loop0_68_rule(p)) // _loop0_68 + ) + { + D(fprintf(stderr, "%*c+ _gather_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_68")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_67[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_68")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_69: literal_pattern | constant_pattern +static void * +_tmp_69_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // literal_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + void *literal_pattern_var; + if ( + (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + _res = literal_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); + } + { // constant_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + void *constant_pattern_var; + if ( + (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + _res = constant_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_70: 'from' expression +static void * +_tmp_70_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'from' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 514)) // token='from' + && (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20653,7 +21035,7 @@ _tmp_65_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -20662,9 +21044,9 @@ _tmp_65_rule(Parser *p) return _res; } -// _tmp_66: '->' expression +// _tmp_71: '->' expression static void * -_tmp_66_rule(Parser *p) +_tmp_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20678,7 +21060,7 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -20687,7 +21069,7 @@ _tmp_66_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20697,7 +21079,7 @@ _tmp_66_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -20706,9 +21088,9 @@ _tmp_66_rule(Parser *p) return _res; } -// _tmp_67: '->' expression +// _tmp_72: '->' expression static void * -_tmp_67_rule(Parser *p) +_tmp_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20722,7 +21104,7 @@ _tmp_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -20731,7 +21113,7 @@ _tmp_67_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20741,7 +21123,7 @@ _tmp_67_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -20750,9 +21132,9 @@ _tmp_67_rule(Parser *p) return _res; } -// _tmp_68: NEWLINE INDENT +// _tmp_73: NEWLINE INDENT static void * -_tmp_68_rule(Parser *p) +_tmp_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20766,7 +21148,7 @@ _tmp_68_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -20775,12 +21157,12 @@ _tmp_68_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -20789,9 +21171,9 @@ _tmp_68_rule(Parser *p) return _res; } -// _loop0_69: param_no_default +// _loop0_74: param_no_default static asdl_seq * -_loop0_69_rule(Parser *p) +_loop0_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20815,7 +21197,7 @@ _loop0_69_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -20837,7 +21219,7 @@ _loop0_69_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20850,14 +21232,14 @@ _loop0_69_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); D(p->level--); return _seq; } -// _loop0_70: param_with_default +// _loop0_75: param_with_default static asdl_seq * -_loop0_70_rule(Parser *p) +_loop0_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20881,7 +21263,7 @@ _loop0_70_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -20903,7 +21285,7 @@ _loop0_70_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20916,14 +21298,14 @@ _loop0_70_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq); D(p->level--); return _seq; } -// _loop0_71: param_with_default +// _loop0_76: param_with_default static asdl_seq * -_loop0_71_rule(Parser *p) +_loop0_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20947,7 +21329,7 @@ _loop0_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -20969,7 +21351,7 @@ _loop0_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20982,14 +21364,14 @@ _loop0_71_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); D(p->level--); return _seq; } -// _loop1_72: param_no_default +// _loop1_77: param_no_default static asdl_seq * -_loop1_72_rule(Parser *p) +_loop1_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21013,7 +21395,7 @@ _loop1_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21035,7 +21417,7 @@ _loop1_72_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21053,14 +21435,14 @@ _loop1_72_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); D(p->level--); return _seq; } -// _loop0_73: param_with_default +// _loop0_78: param_with_default static asdl_seq * -_loop0_73_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21084,7 +21466,7 @@ _loop0_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21106,7 +21488,7 @@ _loop0_73_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21119,14 +21501,14 @@ _loop0_73_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _loop1_74: param_with_default +// _loop1_79: param_with_default static asdl_seq * -_loop1_74_rule(Parser *p) +_loop1_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21150,7 +21532,7 @@ _loop1_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21172,7 +21554,7 @@ _loop1_74_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21190,14 +21572,14 @@ _loop1_74_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_74_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); D(p->level--); return _seq; } -// _loop1_75: param_no_default +// _loop1_80: param_no_default static asdl_seq * -_loop1_75_rule(Parser *p) +_loop1_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21221,7 +21603,7 @@ _loop1_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21243,7 +21625,7 @@ _loop1_75_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21261,14 +21643,14 @@ _loop1_75_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); D(p->level--); return _seq; } -// _loop1_76: param_no_default +// _loop1_81: param_no_default static asdl_seq * -_loop1_76_rule(Parser *p) +_loop1_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21292,7 +21674,7 @@ _loop1_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21314,7 +21696,7 @@ _loop1_76_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21332,14 +21714,14 @@ _loop1_76_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); D(p->level--); return _seq; } -// _loop0_77: param_no_default +// _loop0_82: param_no_default static asdl_seq * -_loop0_77_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21363,7 +21745,7 @@ _loop0_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21385,7 +21767,7 @@ _loop0_77_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21398,14 +21780,14 @@ _loop0_77_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_78: param_with_default +// _loop1_83: param_with_default static asdl_seq * -_loop1_78_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21429,7 +21811,7 @@ _loop1_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21451,7 +21833,7 @@ _loop1_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21469,14 +21851,14 @@ _loop1_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop0_79: param_no_default +// _loop0_84: param_no_default static asdl_seq * -_loop0_79_rule(Parser *p) +_loop0_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21500,7 +21882,7 @@ _loop0_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21522,7 +21904,7 @@ _loop0_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21535,14 +21917,14 @@ _loop0_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq); D(p->level--); return _seq; } -// _loop1_80: param_with_default +// _loop1_85: param_with_default static asdl_seq * -_loop1_80_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21566,7 +21948,7 @@ _loop1_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21588,7 +21970,7 @@ _loop1_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21606,14 +21988,14 @@ _loop1_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); D(p->level--); return _seq; } -// _loop0_81: param_maybe_default +// _loop0_86: param_maybe_default static asdl_seq * -_loop0_81_rule(Parser *p) +_loop0_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21637,7 +22019,7 @@ _loop0_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -21659,7 +22041,7 @@ _loop0_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21672,14 +22054,14 @@ _loop0_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); D(p->level--); return _seq; } -// _loop1_82: param_maybe_default +// _loop1_87: param_maybe_default static asdl_seq * -_loop1_82_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21703,7 +22085,7 @@ _loop1_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -21725,7 +22107,7 @@ _loop1_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -21743,14 +22125,14 @@ _loop1_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop1_83: ('@' named_expression NEWLINE) +// _loop1_88: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21774,13 +22156,13 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_154_var; + D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_163_var; while ( - (_tmp_154_var = _tmp_154_rule(p)) // '@' named_expression NEWLINE + (_tmp_163_var = _tmp_163_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_154_var; + _res = _tmp_163_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21796,7 +22178,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -21814,14 +22196,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); D(p->level--); return _seq; } -// _tmp_84: '(' arguments? ')' +// _tmp_89: '(' arguments? ')' static void * -_tmp_84_rule(Parser *p) +_tmp_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21835,7 +22217,7 @@ _tmp_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -21847,7 +22229,7 @@ _tmp_84_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21857,7 +22239,7 @@ _tmp_84_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -21866,9 +22248,9 @@ _tmp_84_rule(Parser *p) return _res; } -// _loop0_86: ',' star_expression +// _loop0_91: ',' star_expression static asdl_seq * -_loop0_86_rule(Parser *p) +_loop0_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21892,7 +22274,7 @@ _loop0_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -21923,7 +22305,7 @@ _loop0_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21936,14 +22318,14 @@ _loop0_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); D(p->level--); return _seq; } -// _gather_85: star_expression _loop0_86 +// _gather_90: star_expression _loop0_91 static asdl_seq * -_gather_85_rule(Parser *p) +_gather_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21952,27 +22334,27 @@ _gather_85_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_86 + { // star_expression _loop0_91 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_86")); + D(fprintf(stderr, "%*c> _gather_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_91")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_86_rule(p)) // _loop0_86 + (seq = _loop0_91_rule(p)) // _loop0_91 ) { - D(fprintf(stderr, "%*c+ _gather_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_86")); + D(fprintf(stderr, "%*c+ _gather_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_91")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_85[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_86")); + D(fprintf(stderr, "%*c%s _gather_90[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_91")); } _res = NULL; done: @@ -21980,9 +22362,9 @@ _gather_85_rule(Parser *p) return _res; } -// _loop1_87: (',' star_expression) +// _loop1_92: (',' star_expression) static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22006,13 +22388,13 @@ _loop1_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_155_var; + D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_164_var; while ( - (_tmp_155_var = _tmp_155_rule(p)) // ',' star_expression + (_tmp_164_var = _tmp_164_rule(p)) // ',' star_expression ) { - _res = _tmp_155_var; + _res = _tmp_164_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22028,7 +22410,7 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -22046,14 +22428,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); D(p->level--); return _seq; } -// _loop0_89: ',' star_named_expression +// _loop0_94: ',' star_named_expression static asdl_seq * -_loop0_89_rule(Parser *p) +_loop0_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22077,7 +22459,7 @@ _loop0_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -22108,7 +22490,7 @@ _loop0_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22121,14 +22503,14 @@ _loop0_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); D(p->level--); return _seq; } -// _gather_88: star_named_expression _loop0_89 +// _gather_93: star_named_expression _loop0_94 static asdl_seq * -_gather_88_rule(Parser *p) +_gather_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22137,27 +22519,27 @@ _gather_88_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_89 + { // star_named_expression _loop0_94 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_89")); + D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_94")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_89_rule(p)) // _loop0_89 + (seq = _loop0_94_rule(p)) // _loop0_94 ) { - D(fprintf(stderr, "%*c+ _gather_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_89")); + D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_94")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_88[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_89")); + D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_94")); } _res = NULL; done: @@ -22165,9 +22547,9 @@ _gather_88_rule(Parser *p) return _res; } -// _loop1_90: (',' expression) +// _loop1_95: (',' expression) static asdl_seq * -_loop1_90_rule(Parser *p) +_loop1_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22191,13 +22573,13 @@ _loop1_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_156_var; + D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_165_var; while ( - (_tmp_156_var = _tmp_156_rule(p)) // ',' expression + (_tmp_165_var = _tmp_165_rule(p)) // ',' expression ) { - _res = _tmp_156_var; + _res = _tmp_165_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22213,7 +22595,7 @@ _loop1_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -22231,14 +22613,14 @@ _loop1_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); D(p->level--); return _seq; } -// _loop0_91: lambda_param_no_default +// _loop0_96: lambda_param_no_default static asdl_seq * -_loop0_91_rule(Parser *p) +_loop0_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22262,7 +22644,7 @@ _loop0_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22284,7 +22666,7 @@ _loop0_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22297,14 +22679,14 @@ _loop0_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq); D(p->level--); return _seq; } -// _loop0_92: lambda_param_with_default +// _loop0_97: lambda_param_with_default static asdl_seq * -_loop0_92_rule(Parser *p) +_loop0_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22328,7 +22710,7 @@ _loop0_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22350,7 +22732,7 @@ _loop0_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22363,14 +22745,14 @@ _loop0_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); D(p->level--); return _seq; } -// _loop0_93: lambda_param_with_default +// _loop0_98: lambda_param_with_default static asdl_seq * -_loop0_93_rule(Parser *p) +_loop0_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22394,7 +22776,7 @@ _loop0_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22416,7 +22798,7 @@ _loop0_93_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22429,14 +22811,14 @@ _loop0_93_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); D(p->level--); return _seq; } -// _loop1_94: lambda_param_no_default +// _loop1_99: lambda_param_no_default static asdl_seq * -_loop1_94_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22460,7 +22842,7 @@ _loop1_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22482,7 +22864,7 @@ _loop1_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22500,14 +22882,14 @@ _loop1_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop0_95: lambda_param_with_default +// _loop0_100: lambda_param_with_default static asdl_seq * -_loop0_95_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22531,7 +22913,7 @@ _loop0_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22553,7 +22935,7 @@ _loop0_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22566,14 +22948,14 @@ _loop0_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop1_96: lambda_param_with_default +// _loop1_101: lambda_param_with_default static asdl_seq * -_loop1_96_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22597,7 +22979,7 @@ _loop1_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22619,7 +23001,7 @@ _loop1_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22637,14 +23019,14 @@ _loop1_96_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop1_97: lambda_param_no_default +// _loop1_102: lambda_param_no_default static asdl_seq * -_loop1_97_rule(Parser *p) +_loop1_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22668,7 +23050,7 @@ _loop1_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22690,7 +23072,7 @@ _loop1_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22708,14 +23090,14 @@ _loop1_97_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); D(p->level--); return _seq; } -// _loop1_98: lambda_param_no_default +// _loop1_103: lambda_param_no_default static asdl_seq * -_loop1_98_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22739,7 +23121,7 @@ _loop1_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22761,7 +23143,7 @@ _loop1_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22779,14 +23161,14 @@ _loop1_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop0_99: lambda_param_no_default +// _loop0_104: lambda_param_no_default static asdl_seq * -_loop0_99_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22810,7 +23192,7 @@ _loop0_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22832,7 +23214,7 @@ _loop0_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22845,14 +23227,14 @@ _loop0_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_100: lambda_param_with_default +// _loop1_105: lambda_param_with_default static asdl_seq * -_loop1_100_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22876,7 +23258,7 @@ _loop1_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22898,7 +23280,7 @@ _loop1_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22916,14 +23298,14 @@ _loop1_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop0_101: lambda_param_no_default +// _loop0_106: lambda_param_no_default static asdl_seq * -_loop0_101_rule(Parser *p) +_loop0_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22947,7 +23329,7 @@ _loop0_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22969,7 +23351,7 @@ _loop0_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22982,14 +23364,14 @@ _loop0_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); D(p->level--); return _seq; } -// _loop1_102: lambda_param_with_default +// _loop1_107: lambda_param_with_default static asdl_seq * -_loop1_102_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23013,7 +23395,7 @@ _loop1_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23035,7 +23417,7 @@ _loop1_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23053,14 +23435,14 @@ _loop1_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop0_103: lambda_param_maybe_default +// _loop0_108: lambda_param_maybe_default static asdl_seq * -_loop0_103_rule(Parser *p) +_loop0_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23084,7 +23466,7 @@ _loop0_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23106,7 +23488,7 @@ _loop0_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23119,14 +23501,14 @@ _loop0_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); D(p->level--); return _seq; } -// _loop1_104: lambda_param_maybe_default +// _loop1_109: lambda_param_maybe_default static asdl_seq * -_loop1_104_rule(Parser *p) +_loop1_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23150,7 +23532,7 @@ _loop1_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23172,7 +23554,7 @@ _loop1_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -23190,14 +23572,14 @@ _loop1_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); D(p->level--); return _seq; } -// _loop1_105: ('or' conjunction) +// _loop1_110: ('or' conjunction) static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23221,13 +23603,13 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_157_var; + D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_166_var; while ( - (_tmp_157_var = _tmp_157_rule(p)) // 'or' conjunction + (_tmp_166_var = _tmp_166_rule(p)) // 'or' conjunction ) { - _res = _tmp_157_var; + _res = _tmp_166_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23243,7 +23625,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -23261,14 +23643,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq); D(p->level--); return _seq; } -// _loop1_106: ('and' inversion) +// _loop1_111: ('and' inversion) static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23292,13 +23674,13 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_158_var; + D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_167_var; while ( - (_tmp_158_var = _tmp_158_rule(p)) // 'and' inversion + (_tmp_167_var = _tmp_167_rule(p)) // 'and' inversion ) { - _res = _tmp_158_var; + _res = _tmp_167_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23314,7 +23696,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -23332,14 +23714,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); D(p->level--); return _seq; } -// _loop1_107: compare_op_bitwise_or_pair +// _loop1_112: compare_op_bitwise_or_pair static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23363,7 +23745,7 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -23385,7 +23767,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -23403,14 +23785,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); D(p->level--); return _seq; } -// _tmp_108: '!=' +// _tmp_113: '!=' static void * -_tmp_108_rule(Parser *p) +_tmp_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23424,13 +23806,13 @@ _tmp_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23440,7 +23822,7 @@ _tmp_108_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -23449,9 +23831,9 @@ _tmp_108_rule(Parser *p) return _res; } -// _loop0_110: ',' slice +// _loop0_115: ',' slice static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23475,7 +23857,7 @@ _loop0_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -23506,7 +23888,7 @@ _loop0_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23519,14 +23901,14 @@ _loop0_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq); D(p->level--); return _seq; } -// _gather_109: slice _loop0_110 +// _gather_114: slice _loop0_115 static asdl_seq * -_gather_109_rule(Parser *p) +_gather_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23535,27 +23917,27 @@ _gather_109_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_110 + { // slice _loop0_115 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_110")); + D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_115")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_110_rule(p)) // _loop0_110 + (seq = _loop0_115_rule(p)) // _loop0_115 ) { - D(fprintf(stderr, "%*c+ _gather_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_110")); + D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_115")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_110")); + D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_115")); } _res = NULL; done: @@ -23563,9 +23945,9 @@ _gather_109_rule(Parser *p) return _res; } -// _tmp_111: ':' expression? +// _tmp_116: ':' expression? static void * -_tmp_111_rule(Parser *p) +_tmp_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23579,7 +23961,7 @@ _tmp_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -23588,7 +23970,7 @@ _tmp_111_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23598,7 +23980,7 @@ _tmp_111_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -23607,9 +23989,9 @@ _tmp_111_rule(Parser *p) return _res; } -// _tmp_112: tuple | group | genexp +// _tmp_117: tuple | group | genexp static void * -_tmp_112_rule(Parser *p) +_tmp_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23623,18 +24005,18 @@ _tmp_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -23642,18 +24024,18 @@ _tmp_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -23661,18 +24043,18 @@ _tmp_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -23681,9 +24063,9 @@ _tmp_112_rule(Parser *p) return _res; } -// _tmp_113: list | listcomp +// _tmp_118: list | listcomp static void * -_tmp_113_rule(Parser *p) +_tmp_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23697,18 +24079,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -23716,18 +24098,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -23736,9 +24118,9 @@ _tmp_113_rule(Parser *p) return _res; } -// _tmp_114: dict | set | dictcomp | setcomp +// _tmp_119: dict | set | dictcomp | setcomp static void * -_tmp_114_rule(Parser *p) +_tmp_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23752,18 +24134,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -23771,18 +24153,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -23790,18 +24172,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -23809,18 +24191,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -23829,9 +24211,9 @@ _tmp_114_rule(Parser *p) return _res; } -// _loop1_115: STRING +// _loop1_120: STRING static asdl_seq * -_loop1_115_rule(Parser *p) +_loop1_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23855,7 +24237,7 @@ _loop1_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -23877,7 +24259,7 @@ _loop1_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -23895,14 +24277,14 @@ _loop1_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq); D(p->level--); return _seq; } -// _tmp_116: star_named_expression ',' star_named_expressions? +// _tmp_121: star_named_expression ',' star_named_expressions? static void * -_tmp_116_rule(Parser *p) +_tmp_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23916,7 +24298,7 @@ _tmp_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -23928,7 +24310,7 @@ _tmp_116_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23938,7 +24320,7 @@ _tmp_116_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -23947,9 +24329,9 @@ _tmp_116_rule(Parser *p) return _res; } -// _tmp_117: yield_expr | named_expression +// _tmp_122: yield_expr | named_expression static void * -_tmp_117_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23963,18 +24345,18 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -23982,18 +24364,18 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -24002,9 +24384,9 @@ _tmp_117_rule(Parser *p) return _res; } -// _loop0_119: ',' double_starred_kvpair +// _loop0_124: ',' double_starred_kvpair static asdl_seq * -_loop0_119_rule(Parser *p) +_loop0_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24028,7 +24410,7 @@ _loop0_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -24059,7 +24441,7 @@ _loop0_119_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24072,14 +24454,14 @@ _loop0_119_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); D(p->level--); return _seq; } -// _gather_118: double_starred_kvpair _loop0_119 +// _gather_123: double_starred_kvpair _loop0_124 static asdl_seq * -_gather_118_rule(Parser *p) +_gather_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24088,27 +24470,27 @@ _gather_118_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_119 + { // double_starred_kvpair _loop0_124 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119")); + D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_124")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_119_rule(p)) // _loop0_119 + (seq = _loop0_124_rule(p)) // _loop0_124 ) { - D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119")); + D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_124")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_119")); + D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_124")); } _res = NULL; done: @@ -24116,9 +24498,9 @@ _gather_118_rule(Parser *p) return _res; } -// _loop1_120: for_if_clause +// _loop1_125: for_if_clause static asdl_seq * -_loop1_120_rule(Parser *p) +_loop1_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24142,7 +24524,7 @@ _loop1_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -24164,7 +24546,7 @@ _loop1_120_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -24182,14 +24564,14 @@ _loop1_120_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_125_type, _seq); D(p->level--); return _seq; } -// _loop0_121: ('if' disjunction) +// _loop0_126: ('if' disjunction) static asdl_seq * -_loop0_121_rule(Parser *p) +_loop0_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24213,13 +24595,13 @@ _loop0_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_159_var; + D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_168_var; while ( - (_tmp_159_var = _tmp_159_rule(p)) // 'if' disjunction + (_tmp_168_var = _tmp_168_rule(p)) // 'if' disjunction ) { - _res = _tmp_159_var; + _res = _tmp_168_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24235,7 +24617,7 @@ _loop0_121_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24248,14 +24630,14 @@ _loop0_121_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); D(p->level--); return _seq; } -// _loop0_122: ('if' disjunction) +// _loop0_127: ('if' disjunction) static asdl_seq * -_loop0_122_rule(Parser *p) +_loop0_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24279,13 +24661,13 @@ _loop0_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_160_var; + D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_169_var; while ( - (_tmp_160_var = _tmp_160_rule(p)) // 'if' disjunction + (_tmp_169_var = _tmp_169_rule(p)) // 'if' disjunction ) { - _res = _tmp_160_var; + _res = _tmp_169_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24301,7 +24683,7 @@ _loop0_122_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24314,14 +24696,14 @@ _loop0_122_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); D(p->level--); return _seq; } -// _tmp_123: ',' args +// _tmp_128: ',' args static void * -_tmp_123_rule(Parser *p) +_tmp_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24335,7 +24717,7 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24344,7 +24726,7 @@ _tmp_123_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24354,7 +24736,7 @@ _tmp_123_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24363,9 +24745,9 @@ _tmp_123_rule(Parser *p) return _res; } -// _tmp_124: ',' args +// _tmp_129: ',' args static void * -_tmp_124_rule(Parser *p) +_tmp_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24379,7 +24761,7 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24388,7 +24770,7 @@ _tmp_124_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24398,7 +24780,7 @@ _tmp_124_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24407,9 +24789,9 @@ _tmp_124_rule(Parser *p) return _res; } -// _loop0_126: ',' kwarg_or_starred +// _loop0_131: ',' kwarg_or_starred static asdl_seq * -_loop0_126_rule(Parser *p) +_loop0_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24433,7 +24815,7 @@ _loop0_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24464,7 +24846,7 @@ _loop0_126_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24477,14 +24859,14 @@ _loop0_126_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); D(p->level--); return _seq; } -// _gather_125: kwarg_or_starred _loop0_126 +// _gather_130: kwarg_or_starred _loop0_131 static asdl_seq * -_gather_125_rule(Parser *p) +_gather_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24493,27 +24875,27 @@ _gather_125_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_126 + { // kwarg_or_starred _loop0_131 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); + D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_126_rule(p)) // _loop0_126 + (seq = _loop0_131_rule(p)) // _loop0_131 ) { - D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); + D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_126")); + D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_131")); } _res = NULL; done: @@ -24521,9 +24903,9 @@ _gather_125_rule(Parser *p) return _res; } -// _loop0_128: ',' kwarg_or_double_starred +// _loop0_133: ',' kwarg_or_double_starred static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24547,7 +24929,7 @@ _loop0_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24578,7 +24960,7 @@ _loop0_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24591,14 +24973,14 @@ _loop0_128_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _gather_127: kwarg_or_double_starred _loop0_128 +// _gather_132: kwarg_or_double_starred _loop0_133 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24607,27 +24989,27 @@ _gather_127_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_128 + { // kwarg_or_double_starred _loop0_133 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); + D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_128_rule(p)) // _loop0_128 + (seq = _loop0_133_rule(p)) // _loop0_133 ) { - D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); + D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_128")); + D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_133")); } _res = NULL; done: @@ -24635,9 +25017,9 @@ _gather_127_rule(Parser *p) return _res; } -// _loop0_130: ',' kwarg_or_starred +// _loop0_135: ',' kwarg_or_starred static asdl_seq * -_loop0_130_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24661,7 +25043,7 @@ _loop0_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24692,7 +25074,7 @@ _loop0_130_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24705,14 +25087,14 @@ _loop0_130_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_129: kwarg_or_starred _loop0_130 +// _gather_134: kwarg_or_starred _loop0_135 static asdl_seq * -_gather_129_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24721,27 +25103,27 @@ _gather_129_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_130 + { // kwarg_or_starred _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); + D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_130_rule(p)) // _loop0_130 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); + D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_130")); + D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); } _res = NULL; done: @@ -24749,9 +25131,9 @@ _gather_129_rule(Parser *p) return _res; } -// _loop0_132: ',' kwarg_or_double_starred +// _loop0_137: ',' kwarg_or_double_starred static asdl_seq * -_loop0_132_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24775,7 +25157,7 @@ _loop0_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24806,7 +25188,7 @@ _loop0_132_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24819,14 +25201,14 @@ _loop0_132_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_131: kwarg_or_double_starred _loop0_132 +// _gather_136: kwarg_or_double_starred _loop0_137 static asdl_seq * -_gather_131_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24835,27 +25217,27 @@ _gather_131_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_132 + { // kwarg_or_double_starred _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_132_rule(p)) // _loop0_132 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_132")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); } _res = NULL; done: @@ -24863,9 +25245,9 @@ _gather_131_rule(Parser *p) return _res; } -// _loop0_133: (',' star_target) +// _loop0_138: (',' star_target) static asdl_seq * -_loop0_133_rule(Parser *p) +_loop0_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24889,13 +25271,13 @@ _loop0_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_161_var; + D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_170_var; while ( - (_tmp_161_var = _tmp_161_rule(p)) // ',' star_target + (_tmp_170_var = _tmp_170_rule(p)) // ',' star_target ) { - _res = _tmp_161_var; + _res = _tmp_170_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24911,7 +25293,7 @@ _loop0_133_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24924,14 +25306,14 @@ _loop0_133_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); D(p->level--); return _seq; } -// _loop0_135: ',' star_target +// _loop0_140: ',' star_target static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24955,7 +25337,7 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -24986,7 +25368,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24999,14 +25381,14 @@ _loop0_135_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); D(p->level--); return _seq; } -// _gather_134: star_target _loop0_135 +// _gather_139: star_target _loop0_140 static asdl_seq * -_gather_134_rule(Parser *p) +_gather_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25015,27 +25397,27 @@ _gather_134_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_135 + { // star_target _loop0_140 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); + D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_140")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_135_rule(p)) // _loop0_135 + (seq = _loop0_140_rule(p)) // _loop0_140 ) { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); + D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_140")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_135")); + D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_140")); } _res = NULL; done: @@ -25043,9 +25425,9 @@ _gather_134_rule(Parser *p) return _res; } -// _tmp_136: !'*' star_target +// _tmp_141: !'*' star_target static void * -_tmp_136_rule(Parser *p) +_tmp_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25059,7 +25441,7 @@ _tmp_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -25067,12 +25449,12 @@ _tmp_136_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -25081,9 +25463,9 @@ _tmp_136_rule(Parser *p) return _res; } -// _loop0_138: ',' del_target +// _loop0_143: ',' del_target static asdl_seq * -_loop0_138_rule(Parser *p) +_loop0_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25107,7 +25489,7 @@ _loop0_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -25138,7 +25520,7 @@ _loop0_138_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25151,14 +25533,14 @@ _loop0_138_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); D(p->level--); return _seq; } -// _gather_137: del_target _loop0_138 +// _gather_142: del_target _loop0_143 static asdl_seq * -_gather_137_rule(Parser *p) +_gather_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25167,27 +25549,27 @@ _gather_137_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_138 + { // del_target _loop0_143 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); + D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_143")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_138_rule(p)) // _loop0_138 + (seq = _loop0_143_rule(p)) // _loop0_143 ) { - D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); + D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_143")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_138")); + D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_143")); } _res = NULL; done: @@ -25195,9 +25577,9 @@ _gather_137_rule(Parser *p) return _res; } -// _loop0_140: ',' target +// _loop0_145: ',' target static asdl_seq * -_loop0_140_rule(Parser *p) +_loop0_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25221,7 +25603,7 @@ _loop0_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -25252,7 +25634,7 @@ _loop0_140_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25265,14 +25647,14 @@ _loop0_140_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); D(p->level--); return _seq; } -// _gather_139: target _loop0_140 +// _gather_144: target _loop0_145 static asdl_seq * -_gather_139_rule(Parser *p) +_gather_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25281,27 +25663,27 @@ _gather_139_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_140 + { // target _loop0_145 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); + D(fprintf(stderr, "%*c> _gather_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_145")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_140_rule(p)) // _loop0_140 + (seq = _loop0_145_rule(p)) // _loop0_145 ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); + D(fprintf(stderr, "%*c+ _gather_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_145")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_140")); + D(fprintf(stderr, "%*c%s _gather_144[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_145")); } _res = NULL; done: @@ -25309,9 +25691,9 @@ _gather_139_rule(Parser *p) return _res; } -// _tmp_141: args | expression for_if_clauses +// _tmp_146: args | expression for_if_clauses static void * -_tmp_141_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25325,18 +25707,18 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -25344,7 +25726,7 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -25353,12 +25735,12 @@ _tmp_141_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -25367,9 +25749,9 @@ _tmp_141_rule(Parser *p) return _res; } -// _loop0_142: star_named_expressions +// _loop0_147: star_named_expressions static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25393,7 +25775,7 @@ _loop0_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -25415,7 +25797,7 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25428,14 +25810,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _tmp_143: '=' annotated_rhs +// _tmp_148: '=' annotated_rhs static void * -_tmp_143_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25449,7 +25831,7 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -25458,12 +25840,12 @@ _tmp_143_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -25472,9 +25854,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _tmp_144: yield_expr | star_expressions +// _tmp_149: yield_expr | star_expressions static void * -_tmp_144_rule(Parser *p) +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25488,18 +25870,18 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25507,18 +25889,18 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25527,9 +25909,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: yield_expr | star_expressions +// _tmp_150: yield_expr | star_expressions static void * -_tmp_145_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25543,18 +25925,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25562,18 +25944,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25582,9 +25964,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _tmp_146: '[' | '(' | '{' +// _tmp_151: '[' | '(' | '{' static void * -_tmp_146_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25598,18 +25980,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -25617,18 +25999,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -25636,18 +26018,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -25656,9 +26038,9 @@ _tmp_146_rule(Parser *p) return _res; } -// _loop0_147: param_no_default +// _loop0_152: param_no_default static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25682,7 +26064,7 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -25704,7 +26086,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25717,14 +26099,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); D(p->level--); return _seq; } -// _tmp_148: slash_with_default | param_with_default+ +// _tmp_153: slash_with_default | param_with_default+ static void * -_tmp_148_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25738,18 +26120,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -25757,18 +26139,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_162_var; + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_171_var; if ( - (_loop1_162_var = _loop1_162_rule(p)) // param_with_default+ + (_loop1_171_var = _loop1_171_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_162_var; + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_171_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -25777,9 +26159,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _tmp_149: ')' | ',' (')' | '**') +// _tmp_154: ')' | ',' (')' | '**') static void * -_tmp_149_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25793,18 +26175,18 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -25812,21 +26194,21 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_163_var; + void *_tmp_172_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_163_var = _tmp_163_rule(p)) // ')' | '**' + (_tmp_172_var = _tmp_172_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_163_var); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_172_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -25835,9 +26217,9 @@ _tmp_149_rule(Parser *p) return _res; } -// _tmp_150: ':' | ',' (':' | '**') +// _tmp_155: ':' | ',' (':' | '**') static void * -_tmp_150_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25851,18 +26233,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -25870,21 +26252,21 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_164_var; + void *_tmp_173_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_164_var = _tmp_164_rule(p)) // ':' | '**' + (_tmp_173_var = _tmp_173_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_164_var); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_173_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -25893,9 +26275,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _tmp_151: star_targets '=' +// _tmp_156: star_targets '=' static void * -_tmp_151_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25909,7 +26291,7 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -25918,7 +26300,7 @@ _tmp_151_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25928,7 +26310,7 @@ _tmp_151_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -25937,9 +26319,9 @@ _tmp_151_rule(Parser *p) return _res; } -// _tmp_152: '.' | '...' +// _tmp_157: '.' | '...' static void * -_tmp_152_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25953,18 +26335,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -25972,18 +26354,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -25992,9 +26374,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: '.' | '...' +// _tmp_158: '.' | '...' static void * -_tmp_153_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26008,18 +26390,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26027,18 +26409,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26047,9 +26429,237 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: '@' named_expression NEWLINE +// _loop0_160: ',' arg_pattern +static asdl_seq * +_loop0_160_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' arg_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); + Token * _literal; + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = arg_pattern_rule(p)) // arg_pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_160[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_160_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_159: arg_pattern _loop0_160 +static asdl_seq * +_gather_159_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // arg_pattern _loop0_160 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_160")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = arg_pattern_rule(p)) // arg_pattern + && + (seq = _loop0_160_rule(p)) // _loop0_160 + ) + { + D(fprintf(stderr, "%*c+ _gather_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_160")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_159[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_160")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_162: ',' (arg_pattern | keyword_pattern) +static asdl_seq * +_loop0_162_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' (arg_pattern | keyword_pattern) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (arg_pattern | keyword_pattern)")); + Token * _literal; + void *elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = _tmp_174_rule(p)) // arg_pattern | keyword_pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_162[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (arg_pattern | keyword_pattern)")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_162_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_161: (arg_pattern | keyword_pattern) _loop0_162 +static asdl_seq * +_gather_161_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // (arg_pattern | keyword_pattern) _loop0_162 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + void *elem; + asdl_seq * seq; + if ( + (elem = _tmp_174_rule(p)) // arg_pattern | keyword_pattern + && + (seq = _loop0_162_rule(p)) // _loop0_162 + ) + { + D(fprintf(stderr, "%*c+ _gather_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_161[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_163: '@' named_expression NEWLINE static void * -_tmp_154_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26063,7 +26673,7 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -26075,7 +26685,7 @@ _tmp_154_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26085,7 +26695,7 @@ _tmp_154_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -26094,9 +26704,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: ',' star_expression +// _tmp_164: ',' star_expression static void * -_tmp_155_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26110,7 +26720,7 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -26119,7 +26729,7 @@ _tmp_155_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26129,7 +26739,7 @@ _tmp_155_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -26138,9 +26748,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _tmp_156: ',' expression +// _tmp_165: ',' expression static void * -_tmp_156_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26154,7 +26764,7 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -26163,7 +26773,7 @@ _tmp_156_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26173,7 +26783,7 @@ _tmp_156_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -26182,9 +26792,9 @@ _tmp_156_rule(Parser *p) return _res; } -// _tmp_157: 'or' conjunction +// _tmp_166: 'or' conjunction static void * -_tmp_157_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26198,7 +26808,7 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -26207,7 +26817,7 @@ _tmp_157_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26217,7 +26827,7 @@ _tmp_157_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -26226,9 +26836,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: 'and' inversion +// _tmp_167: 'and' inversion static void * -_tmp_158_rule(Parser *p) +_tmp_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26242,7 +26852,7 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -26251,7 +26861,7 @@ _tmp_158_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26261,7 +26871,7 @@ _tmp_158_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -26270,9 +26880,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: 'if' disjunction +// _tmp_168: 'if' disjunction static void * -_tmp_159_rule(Parser *p) +_tmp_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26286,7 +26896,7 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26295,7 +26905,7 @@ _tmp_159_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26305,7 +26915,7 @@ _tmp_159_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26314,9 +26924,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: 'if' disjunction +// _tmp_169: 'if' disjunction static void * -_tmp_160_rule(Parser *p) +_tmp_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26330,7 +26940,7 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26339,7 +26949,7 @@ _tmp_160_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26349,7 +26959,7 @@ _tmp_160_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26358,9 +26968,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: ',' star_target +// _tmp_170: ',' star_target static void * -_tmp_161_rule(Parser *p) +_tmp_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26374,7 +26984,7 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -26383,7 +26993,7 @@ _tmp_161_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26393,7 +27003,7 @@ _tmp_161_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -26402,9 +27012,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _loop1_162: param_with_default +// _loop1_171: param_with_default static asdl_seq * -_loop1_162_rule(Parser *p) +_loop1_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26428,7 +27038,7 @@ _loop1_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -26450,7 +27060,7 @@ _loop1_162_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -26468,14 +27078,14 @@ _loop1_162_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_162_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_171_type, _seq); D(p->level--); return _seq; } -// _tmp_163: ')' | '**' +// _tmp_172: ')' | '**' static void * -_tmp_163_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26489,18 +27099,18 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -26508,18 +27118,18 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -26528,9 +27138,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: ':' | '**' +// _tmp_173: ':' | '**' static void * -_tmp_164_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26544,18 +27154,18 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -26563,18 +27173,18 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -26583,6 +27193,61 @@ _tmp_164_rule(Parser *p) return _res; } +// _tmp_174: arg_pattern | keyword_pattern +static void * +_tmp_174_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // arg_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern")); + expr_ty arg_pattern_var; + if ( + (arg_pattern_var = arg_pattern_rule(p)) // arg_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern")); + _res = arg_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern")); + } + { // keyword_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + void *keyword_pattern_var; + if ( + (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + _res = keyword_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + void * _PyPegen_parse(Parser *p) { diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 87e6995ebcb379..d44d9fa641c928 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -715,6 +715,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case Match_kind: CALL(astfold_expr, expr_ty, node_->v.Match.target); CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); + // TODO: Mark unreachable cases for removal? Maybe pattern == NULL? break; default: break; diff --git a/Python/compile.c b/Python/compile.c index 044ff18de067a0..62debc301b894d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2772,10 +2772,13 @@ compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern_store(struct compiler *c, expr_ty p) { +compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { + if (!anon_ok) { + return compiler_error(c, "can't assign to '_' here; consider removing?"); + } ADDOP(c, POP_TOP); return 1; } @@ -2791,7 +2794,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail) if (p->v.Name.ctx == Load) { return compiler_pattern_load(c, p, fail); } - return compiler_pattern_store(c, p); + return compiler_pattern_store(c, p, 1); } static int @@ -2803,7 +2806,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, p->v.NamedExpr.value, block)); - CHECK(compiler_pattern_store(c, p->v.NamedExpr.target)); + CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, 0)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); @@ -2826,7 +2829,9 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) for (Py_ssize_t i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); expr_ty value = asdl_seq_GET(values, i); - assert(key); + if (!key) { + return compiler_error(c, "can't use starred pattern here; consider moving to end?"); + } assert(key->kind == Attribute_kind || key->kind == Constant_kind || key->kind == Name_kind); assert(key->kind != Attribute_kind || key->v.Attribute.ctx == Load); assert(key->kind != Name_kind || key->v.Name.ctx == Load); @@ -2838,7 +2843,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) ADDOP(c, POP_TOP); } else { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1))); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0)); } ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); @@ -2899,15 +2904,18 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) expr_ty value = asdl_seq_GET(values, i); if (i == star) { assert(value->kind == Starred_kind); - ADDOP_I(c, UNPACK_EX, (size - i - 1) << 8); - CHECK(compiler_pattern_store(c, value->v.Starred.value)); - if (size - i - 1) { - ADDOP_I(c, BUILD_TUPLE, size - i - 1); - // Argh, our tuple is backwards! Unpacking and rebuilding is the - // simplest way to reverse it: - ADDOP_I(c, UNPACK_SEQUENCE, size - i - 1); - ADDOP_I(c, BUILD_TUPLE, size - i - 1); - ADDOP_JREL(c, MATCH_SEQ, fail); + Py_ssize_t remaining = size - i - 1; + ADDOP_I(c, UNPACK_EX, remaining << 8); + CHECK(compiler_pattern_store(c, value->v.Starred.value, 1)); + if (remaining) { + ADDOP_I(c, BUILD_TUPLE, remaining); + if (remaining > 1) { + // Argh, our tuple is backwards! + // Unpacking and repacking is the easiest way to reverse it: + ADDOP_I(c, UNPACK_SEQUENCE, remaining); + ADDOP_I(c, BUILD_TUPLE, remaining); + } + ADDOP(c, GET_ITER); } else { ADDOP_JREL(c, JUMP_FORWARD, end); From de7c3f0799ff9950542313626eb06787de12d741 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 09:14:40 -0700 Subject: [PATCH 049/218] Miscellaneous cleanup --- Grammar/python.gram | 24 +- Lib/test/test_pydoc.py | 2 +- Parser/pegen/parse.c | 2789 ++++++++++++++++++++++++---------------- 3 files changed, 1671 insertions(+), 1144 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 820a7bb8252c44..099fe6a324d635 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -199,7 +199,7 @@ case_block: | "case" pattern=pattern guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } -pattern: +pattern[expr_ty]: | target=NAME ':=' value=or_pattern { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } | or_pattern @@ -222,7 +222,7 @@ closed_pattern: | class_pattern name_pattern: - | a=NAME !('.' | '(') { + | a=NAME !('.' | '(' | '=') { _PyPegen_set_expr_context(p, a, Store) } literal_pattern: | NUMBER @@ -250,14 +250,16 @@ mapping_pattern: class_pattern: | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } - | func=name_or_attr '(' args=','.arg_pattern+ ','? ')' { + | func=name_or_attr '(' args=','.pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } | func=name_or_attr '(' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, NULL, keywords, EXTRA) } - | func=name_or_attr '(' args=','.arg_pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { + | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, args, keywords, EXTRA) } - | func=name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' error=arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' { + | func=name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' error=pattern [',' ','.argument_pattern+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "positional pattern follows keyword pattern") } + | func=name_or_attr '(' [','.argument_pattern+ ','] error=error_star [',' ','.(argument_pattern | error_star)+] ','? ')' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } name_or_attr: | NAME @@ -269,15 +271,15 @@ values_pattern: items_pattern: | items=','.key_value_pattern+ ','? { items } -arg_pattern[expr_ty]: - | pattern !'=' - | error='*' NAME { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } keyword_pattern: | arg=NAME '=' value=or_pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } - | error='**' NAME { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } +argument_pattern: + | pattern + | keyword_pattern +error_star[expr_ty]: + | ('*' | '**') error=NAME { + error } value_pattern: | '*' value=name_pattern { diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 8c8537f2d536ca..5fe39779b12845 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -772,7 +772,7 @@ def method_returning_true(self): del expected['__doc__'] del expected['__class__'] # inspect resolves descriptors on type into methods, but vars doesn't, - # so we need to update __subclasshook__, __init_subclass__ and + # so we need to update __subclasshook__, __init_subclass__, and # __match__. expected['__subclasshook__'] = TestClass.__subclasshook__ expected['__init_subclass__'] = TestClass.__init_subclass__ diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index e9c2cdd3973500..697fe1fdfe79a5 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -129,8 +129,8 @@ static KeywordToken *reserved_keywords[] = { #define name_or_attr_type 1051 // Left-recursive #define values_pattern_type 1052 #define items_pattern_type 1053 -#define arg_pattern_type 1054 -#define keyword_pattern_type 1055 +#define keyword_pattern_type 1054 +#define error_star_type 1055 #define value_pattern_type 1056 #define key_value_pattern_type 1057 #define return_stmt_type 1058 @@ -315,116 +315,125 @@ static KeywordToken *reserved_keywords[] = { #define _loop0_63_type 1237 #define _gather_62_type 1238 #define _tmp_64_type 1239 -#define _loop0_66_type 1240 -#define _gather_65_type 1241 +#define _tmp_65_type 1240 +#define _tmp_66_type 1241 #define _loop0_68_type 1242 #define _gather_67_type 1243 -#define _tmp_69_type 1244 -#define _tmp_70_type 1245 +#define _loop0_70_type 1244 +#define _gather_69_type 1245 #define _tmp_71_type 1246 #define _tmp_72_type 1247 #define _tmp_73_type 1248 -#define _loop0_74_type 1249 -#define _loop0_75_type 1250 -#define _loop0_76_type 1251 -#define _loop1_77_type 1252 +#define _tmp_74_type 1249 +#define _tmp_75_type 1250 +#define _tmp_76_type 1251 +#define _loop0_77_type 1252 #define _loop0_78_type 1253 -#define _loop1_79_type 1254 +#define _loop0_79_type 1254 #define _loop1_80_type 1255 -#define _loop1_81_type 1256 -#define _loop0_82_type 1257 +#define _loop0_81_type 1256 +#define _loop1_82_type 1257 #define _loop1_83_type 1258 -#define _loop0_84_type 1259 -#define _loop1_85_type 1260 -#define _loop0_86_type 1261 -#define _loop1_87_type 1262 +#define _loop1_84_type 1259 +#define _loop0_85_type 1260 +#define _loop1_86_type 1261 +#define _loop0_87_type 1262 #define _loop1_88_type 1263 -#define _tmp_89_type 1264 -#define _loop0_91_type 1265 -#define _gather_90_type 1266 -#define _loop1_92_type 1267 +#define _loop0_89_type 1264 +#define _loop1_90_type 1265 +#define _loop1_91_type 1266 +#define _tmp_92_type 1267 #define _loop0_94_type 1268 #define _gather_93_type 1269 #define _loop1_95_type 1270 -#define _loop0_96_type 1271 -#define _loop0_97_type 1272 -#define _loop0_98_type 1273 -#define _loop1_99_type 1274 +#define _loop0_97_type 1271 +#define _gather_96_type 1272 +#define _loop1_98_type 1273 +#define _loop0_99_type 1274 #define _loop0_100_type 1275 -#define _loop1_101_type 1276 +#define _loop0_101_type 1276 #define _loop1_102_type 1277 -#define _loop1_103_type 1278 -#define _loop0_104_type 1279 +#define _loop0_103_type 1278 +#define _loop1_104_type 1279 #define _loop1_105_type 1280 -#define _loop0_106_type 1281 -#define _loop1_107_type 1282 -#define _loop0_108_type 1283 -#define _loop1_109_type 1284 +#define _loop1_106_type 1281 +#define _loop0_107_type 1282 +#define _loop1_108_type 1283 +#define _loop0_109_type 1284 #define _loop1_110_type 1285 -#define _loop1_111_type 1286 +#define _loop0_111_type 1286 #define _loop1_112_type 1287 -#define _tmp_113_type 1288 -#define _loop0_115_type 1289 -#define _gather_114_type 1290 +#define _loop1_113_type 1288 +#define _loop1_114_type 1289 +#define _loop1_115_type 1290 #define _tmp_116_type 1291 -#define _tmp_117_type 1292 -#define _tmp_118_type 1293 +#define _loop0_118_type 1292 +#define _gather_117_type 1293 #define _tmp_119_type 1294 -#define _loop1_120_type 1295 +#define _tmp_120_type 1295 #define _tmp_121_type 1296 #define _tmp_122_type 1297 -#define _loop0_124_type 1298 -#define _gather_123_type 1299 -#define _loop1_125_type 1300 -#define _loop0_126_type 1301 -#define _loop0_127_type 1302 -#define _tmp_128_type 1303 -#define _tmp_129_type 1304 -#define _loop0_131_type 1305 -#define _gather_130_type 1306 -#define _loop0_133_type 1307 -#define _gather_132_type 1308 -#define _loop0_135_type 1309 -#define _gather_134_type 1310 -#define _loop0_137_type 1311 -#define _gather_136_type 1312 -#define _loop0_138_type 1313 +#define _loop1_123_type 1298 +#define _tmp_124_type 1299 +#define _tmp_125_type 1300 +#define _loop0_127_type 1301 +#define _gather_126_type 1302 +#define _loop1_128_type 1303 +#define _loop0_129_type 1304 +#define _loop0_130_type 1305 +#define _tmp_131_type 1306 +#define _tmp_132_type 1307 +#define _loop0_134_type 1308 +#define _gather_133_type 1309 +#define _loop0_136_type 1310 +#define _gather_135_type 1311 +#define _loop0_138_type 1312 +#define _gather_137_type 1313 #define _loop0_140_type 1314 #define _gather_139_type 1315 -#define _tmp_141_type 1316 +#define _loop0_141_type 1316 #define _loop0_143_type 1317 #define _gather_142_type 1318 -#define _loop0_145_type 1319 -#define _gather_144_type 1320 -#define _tmp_146_type 1321 -#define _loop0_147_type 1322 -#define _tmp_148_type 1323 +#define _tmp_144_type 1319 +#define _loop0_146_type 1320 +#define _gather_145_type 1321 +#define _loop0_148_type 1322 +#define _gather_147_type 1323 #define _tmp_149_type 1324 -#define _tmp_150_type 1325 +#define _loop0_150_type 1325 #define _tmp_151_type 1326 -#define _loop0_152_type 1327 +#define _tmp_152_type 1327 #define _tmp_153_type 1328 #define _tmp_154_type 1329 -#define _tmp_155_type 1330 +#define _loop0_155_type 1330 #define _tmp_156_type 1331 #define _tmp_157_type 1332 #define _tmp_158_type 1333 -#define _loop0_160_type 1334 -#define _gather_159_type 1335 -#define _loop0_162_type 1336 -#define _gather_161_type 1337 -#define _tmp_163_type 1338 -#define _tmp_164_type 1339 -#define _tmp_165_type 1340 -#define _tmp_166_type 1341 -#define _tmp_167_type 1342 -#define _tmp_168_type 1343 -#define _tmp_169_type 1344 +#define _tmp_159_type 1334 +#define _tmp_160_type 1335 +#define _tmp_161_type 1336 +#define _loop0_163_type 1337 +#define _gather_162_type 1338 +#define _loop0_165_type 1339 +#define _gather_164_type 1340 +#define _loop0_167_type 1341 +#define _gather_166_type 1342 +#define _loop0_169_type 1343 +#define _gather_168_type 1344 #define _tmp_170_type 1345 -#define _loop1_171_type 1346 +#define _tmp_171_type 1346 #define _tmp_172_type 1347 #define _tmp_173_type 1348 #define _tmp_174_type 1349 +#define _tmp_175_type 1350 +#define _tmp_176_type 1351 +#define _tmp_177_type 1352 +#define _loop1_178_type 1353 +#define _tmp_179_type 1354 +#define _tmp_180_type 1355 +#define _tmp_181_type 1356 +#define _tmp_182_type 1357 +#define _tmp_183_type 1358 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -466,7 +475,7 @@ static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); static void *match_stmt_rule(Parser *p); static void *case_block_rule(Parser *p); -static void *pattern_rule(Parser *p); +static expr_ty pattern_rule(Parser *p); static void *guard_rule(Parser *p); static void *or_pattern_rule(Parser *p); static void *closed_pattern_rule(Parser *p); @@ -480,8 +489,8 @@ static void *class_pattern_rule(Parser *p); static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); -static expr_ty arg_pattern_rule(Parser *p); static void *keyword_pattern_rule(Parser *p); +static expr_ty error_star_rule(Parser *p); static void *value_pattern_rule(Parser *p); static void *key_value_pattern_rule(Parser *p); static stmt_ty return_stmt_rule(Parser *p); @@ -666,116 +675,125 @@ static void *_tmp_61_rule(Parser *p); static asdl_seq *_loop0_63_rule(Parser *p); static asdl_seq *_gather_62_rule(Parser *p); static void *_tmp_64_rule(Parser *p); -static asdl_seq *_loop0_66_rule(Parser *p); -static asdl_seq *_gather_65_rule(Parser *p); +static void *_tmp_65_rule(Parser *p); +static void *_tmp_66_rule(Parser *p); static asdl_seq *_loop0_68_rule(Parser *p); static asdl_seq *_gather_67_rule(Parser *p); -static void *_tmp_69_rule(Parser *p); -static void *_tmp_70_rule(Parser *p); +static asdl_seq *_loop0_70_rule(Parser *p); +static asdl_seq *_gather_69_rule(Parser *p); static void *_tmp_71_rule(Parser *p); static void *_tmp_72_rule(Parser *p); static void *_tmp_73_rule(Parser *p); -static asdl_seq *_loop0_74_rule(Parser *p); -static asdl_seq *_loop0_75_rule(Parser *p); -static asdl_seq *_loop0_76_rule(Parser *p); -static asdl_seq *_loop1_77_rule(Parser *p); +static void *_tmp_74_rule(Parser *p); +static void *_tmp_75_rule(Parser *p); +static void *_tmp_76_rule(Parser *p); +static asdl_seq *_loop0_77_rule(Parser *p); static asdl_seq *_loop0_78_rule(Parser *p); -static asdl_seq *_loop1_79_rule(Parser *p); +static asdl_seq *_loop0_79_rule(Parser *p); static asdl_seq *_loop1_80_rule(Parser *p); -static asdl_seq *_loop1_81_rule(Parser *p); -static asdl_seq *_loop0_82_rule(Parser *p); +static asdl_seq *_loop0_81_rule(Parser *p); +static asdl_seq *_loop1_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static asdl_seq *_loop0_84_rule(Parser *p); -static asdl_seq *_loop1_85_rule(Parser *p); -static asdl_seq *_loop0_86_rule(Parser *p); -static asdl_seq *_loop1_87_rule(Parser *p); +static asdl_seq *_loop1_84_rule(Parser *p); +static asdl_seq *_loop0_85_rule(Parser *p); +static asdl_seq *_loop1_86_rule(Parser *p); +static asdl_seq *_loop0_87_rule(Parser *p); static asdl_seq *_loop1_88_rule(Parser *p); -static void *_tmp_89_rule(Parser *p); -static asdl_seq *_loop0_91_rule(Parser *p); -static asdl_seq *_gather_90_rule(Parser *p); -static asdl_seq *_loop1_92_rule(Parser *p); +static asdl_seq *_loop0_89_rule(Parser *p); +static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop1_91_rule(Parser *p); +static void *_tmp_92_rule(Parser *p); static asdl_seq *_loop0_94_rule(Parser *p); static asdl_seq *_gather_93_rule(Parser *p); static asdl_seq *_loop1_95_rule(Parser *p); -static asdl_seq *_loop0_96_rule(Parser *p); static asdl_seq *_loop0_97_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_loop1_99_rule(Parser *p); +static asdl_seq *_gather_96_rule(Parser *p); +static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop0_99_rule(Parser *p); static asdl_seq *_loop0_100_rule(Parser *p); -static asdl_seq *_loop1_101_rule(Parser *p); +static asdl_seq *_loop0_101_rule(Parser *p); static asdl_seq *_loop1_102_rule(Parser *p); -static asdl_seq *_loop1_103_rule(Parser *p); -static asdl_seq *_loop0_104_rule(Parser *p); +static asdl_seq *_loop0_103_rule(Parser *p); +static asdl_seq *_loop1_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); -static asdl_seq *_loop0_106_rule(Parser *p); -static asdl_seq *_loop1_107_rule(Parser *p); -static asdl_seq *_loop0_108_rule(Parser *p); -static asdl_seq *_loop1_109_rule(Parser *p); +static asdl_seq *_loop1_106_rule(Parser *p); +static asdl_seq *_loop0_107_rule(Parser *p); +static asdl_seq *_loop1_108_rule(Parser *p); +static asdl_seq *_loop0_109_rule(Parser *p); static asdl_seq *_loop1_110_rule(Parser *p); -static asdl_seq *_loop1_111_rule(Parser *p); +static asdl_seq *_loop0_111_rule(Parser *p); static asdl_seq *_loop1_112_rule(Parser *p); -static void *_tmp_113_rule(Parser *p); -static asdl_seq *_loop0_115_rule(Parser *p); -static asdl_seq *_gather_114_rule(Parser *p); +static asdl_seq *_loop1_113_rule(Parser *p); +static asdl_seq *_loop1_114_rule(Parser *p); +static asdl_seq *_loop1_115_rule(Parser *p); static void *_tmp_116_rule(Parser *p); -static void *_tmp_117_rule(Parser *p); -static void *_tmp_118_rule(Parser *p); +static asdl_seq *_loop0_118_rule(Parser *p); +static asdl_seq *_gather_117_rule(Parser *p); static void *_tmp_119_rule(Parser *p); -static asdl_seq *_loop1_120_rule(Parser *p); +static void *_tmp_120_rule(Parser *p); static void *_tmp_121_rule(Parser *p); static void *_tmp_122_rule(Parser *p); -static asdl_seq *_loop0_124_rule(Parser *p); -static asdl_seq *_gather_123_rule(Parser *p); -static asdl_seq *_loop1_125_rule(Parser *p); -static asdl_seq *_loop0_126_rule(Parser *p); +static asdl_seq *_loop1_123_rule(Parser *p); +static void *_tmp_124_rule(Parser *p); +static void *_tmp_125_rule(Parser *p); static asdl_seq *_loop0_127_rule(Parser *p); -static void *_tmp_128_rule(Parser *p); -static void *_tmp_129_rule(Parser *p); -static asdl_seq *_loop0_131_rule(Parser *p); -static asdl_seq *_gather_130_rule(Parser *p); -static asdl_seq *_loop0_133_rule(Parser *p); -static asdl_seq *_gather_132_rule(Parser *p); -static asdl_seq *_loop0_135_rule(Parser *p); -static asdl_seq *_gather_134_rule(Parser *p); -static asdl_seq *_loop0_137_rule(Parser *p); -static asdl_seq *_gather_136_rule(Parser *p); +static asdl_seq *_gather_126_rule(Parser *p); +static asdl_seq *_loop1_128_rule(Parser *p); +static asdl_seq *_loop0_129_rule(Parser *p); +static asdl_seq *_loop0_130_rule(Parser *p); +static void *_tmp_131_rule(Parser *p); +static void *_tmp_132_rule(Parser *p); +static asdl_seq *_loop0_134_rule(Parser *p); +static asdl_seq *_gather_133_rule(Parser *p); +static asdl_seq *_loop0_136_rule(Parser *p); +static asdl_seq *_gather_135_rule(Parser *p); static asdl_seq *_loop0_138_rule(Parser *p); +static asdl_seq *_gather_137_rule(Parser *p); static asdl_seq *_loop0_140_rule(Parser *p); static asdl_seq *_gather_139_rule(Parser *p); -static void *_tmp_141_rule(Parser *p); +static asdl_seq *_loop0_141_rule(Parser *p); static asdl_seq *_loop0_143_rule(Parser *p); static asdl_seq *_gather_142_rule(Parser *p); -static asdl_seq *_loop0_145_rule(Parser *p); -static asdl_seq *_gather_144_rule(Parser *p); -static void *_tmp_146_rule(Parser *p); -static asdl_seq *_loop0_147_rule(Parser *p); -static void *_tmp_148_rule(Parser *p); +static void *_tmp_144_rule(Parser *p); +static asdl_seq *_loop0_146_rule(Parser *p); +static asdl_seq *_gather_145_rule(Parser *p); +static asdl_seq *_loop0_148_rule(Parser *p); +static asdl_seq *_gather_147_rule(Parser *p); static void *_tmp_149_rule(Parser *p); -static void *_tmp_150_rule(Parser *p); +static asdl_seq *_loop0_150_rule(Parser *p); static void *_tmp_151_rule(Parser *p); -static asdl_seq *_loop0_152_rule(Parser *p); +static void *_tmp_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); -static void *_tmp_155_rule(Parser *p); +static asdl_seq *_loop0_155_rule(Parser *p); static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); -static asdl_seq *_loop0_160_rule(Parser *p); -static asdl_seq *_gather_159_rule(Parser *p); -static asdl_seq *_loop0_162_rule(Parser *p); -static asdl_seq *_gather_161_rule(Parser *p); -static void *_tmp_163_rule(Parser *p); -static void *_tmp_164_rule(Parser *p); -static void *_tmp_165_rule(Parser *p); -static void *_tmp_166_rule(Parser *p); -static void *_tmp_167_rule(Parser *p); -static void *_tmp_168_rule(Parser *p); -static void *_tmp_169_rule(Parser *p); +static void *_tmp_159_rule(Parser *p); +static void *_tmp_160_rule(Parser *p); +static void *_tmp_161_rule(Parser *p); +static asdl_seq *_loop0_163_rule(Parser *p); +static asdl_seq *_gather_162_rule(Parser *p); +static asdl_seq *_loop0_165_rule(Parser *p); +static asdl_seq *_gather_164_rule(Parser *p); +static asdl_seq *_loop0_167_rule(Parser *p); +static asdl_seq *_gather_166_rule(Parser *p); +static asdl_seq *_loop0_169_rule(Parser *p); +static asdl_seq *_gather_168_rule(Parser *p); static void *_tmp_170_rule(Parser *p); -static asdl_seq *_loop1_171_rule(Parser *p); +static void *_tmp_171_rule(Parser *p); static void *_tmp_172_rule(Parser *p); static void *_tmp_173_rule(Parser *p); static void *_tmp_174_rule(Parser *p); +static void *_tmp_175_rule(Parser *p); +static void *_tmp_176_rule(Parser *p); +static void *_tmp_177_rule(Parser *p); +static asdl_seq *_loop1_178_rule(Parser *p); +static void *_tmp_179_rule(Parser *p); +static void *_tmp_180_rule(Parser *p); +static void *_tmp_181_rule(Parser *p); +static void *_tmp_182_rule(Parser *p); +static void *_tmp_183_rule(Parser *p); // file: statements? $ @@ -4728,7 +4746,7 @@ case_block_rule(Parser *p) Token * _literal; asdl_seq* body; void *guard; - void *pattern; + expr_ty pattern; if ( (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' && @@ -4761,7 +4779,7 @@ case_block_rule(Parser *p) } // pattern: NAME ':=' or_pattern | or_pattern -static void * +static expr_ty pattern_rule(Parser *p) { D(p->level++); @@ -4769,7 +4787,7 @@ pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5129,7 +5147,7 @@ closed_pattern_rule(Parser *p) return _res; } -// name_pattern: NAME !('.' | '(') +// name_pattern: NAME !('.' | '(' | '=') static void * name_pattern_rule(Parser *p) { @@ -5140,12 +5158,12 @@ name_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // NAME !('.' | '(') + { // NAME !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> name_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(')")); + D(fprintf(stderr, "%*c> name_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); expr_ty a; if ( (a = _PyPegen_name_token(p)) // NAME @@ -5153,7 +5171,7 @@ name_pattern_rule(Parser *p) _PyPegen_lookahead(0, _tmp_52_rule, p) ) { - D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(')")); + D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); _res = _PyPegen_set_expr_context ( p , a , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5164,7 +5182,7 @@ name_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s name_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !('.' | '(')")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !('.' | '(' | '=')")); } _res = NULL; done: @@ -5448,7 +5466,7 @@ group_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); Token * _literal; Token * _literal_1; - void *pattern; + expr_ty pattern; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && @@ -5608,10 +5626,11 @@ mapping_pattern_rule(Parser *p) // class_pattern: // | name_or_attr '(' ')' -// | name_or_attr '(' ','.arg_pattern+ ','? ')' +// | name_or_attr '(' ','.pattern+ ','? ')' // | name_or_attr '(' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' +// | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' +// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')' +// | name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')' static void * class_pattern_rule(Parser *p) { @@ -5670,12 +5689,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); } - { // name_or_attr '(' ','.arg_pattern+ ','? ')' + { // name_or_attr '(' ','.pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -5687,14 +5706,14 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_53_rule(p)) // ','.arg_pattern+ + (args = _gather_53_rule(p)) // ','.pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5714,7 +5733,7 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); } { // name_or_attr '(' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { @@ -5762,12 +5781,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); } - { // name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')' + { // name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); Token * _literal; Token * _literal_1; Token * _literal_2; @@ -5781,7 +5800,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_57_rule(p)) // ','.arg_pattern+ + (args = _gather_57_rule(p)) // ','.pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && @@ -5792,7 +5811,7 @@ class_pattern_rule(Parser *p) (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5812,14 +5831,14 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.arg_pattern+ ',' ','.keyword_pattern+ ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); } - { // name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')' + { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); asdl_seq * _gather_62_var; Token * _literal; Token * _literal_1; @@ -5837,22 +5856,22 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_61_rule(p), 1) // [','.arg_pattern+ ','] + (_opt_var = _tmp_61_rule(p), 1) // [','.pattern+ ','] && (_gather_62_var = _gather_62_rule(p)) // ','.keyword_pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (error = arg_pattern_rule(p)) // arg_pattern + (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.(arg_pattern | keyword_pattern)+] + (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.(pattern | keyword_pattern)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "positional pattern follows keyword pattern" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5863,7 +5882,52 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.arg_pattern+ ','] ','.keyword_pattern+ ',' arg_pattern [',' ','.(arg_pattern | keyword_pattern)+] ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); + } + { // name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + void *_opt_var_1; + UNUSED(_opt_var_1); // Silence compiler warnings + void *_opt_var_2; + UNUSED(_opt_var_2); // Silence compiler warnings + expr_ty error; + void *func; + if ( + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (_opt_var = _tmp_65_rule(p), 1) // [','.(pattern | keyword_pattern)+ ','] + && + (error = error_star_rule(p)) // error_star + && + (_opt_var_1 = _tmp_66_rule(p), 1) // [',' ','.(pattern | keyword_pattern | error_star)+] + && + (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); } _res = NULL; done: @@ -6006,7 +6070,7 @@ values_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * values; if ( - (values = _gather_65_rule(p)) // ','.value_pattern+ + (values = _gather_67_rule(p)) // ','.value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6051,7 +6115,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_67_rule(p)) // ','.key_value_pattern+ + (items = _gather_69_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6075,72 +6139,7 @@ items_pattern_rule(Parser *p) return _res; } -// arg_pattern: pattern !'=' | '*' NAME -static expr_ty -arg_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - { // pattern !'=' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> arg_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern !'='")); - void *pattern_var; - if ( - (pattern_var = pattern_rule(p)) // pattern - && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' - ) - { - D(fprintf(stderr, "%*c+ arg_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern !'='")); - _res = pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s arg_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern !'='")); - } - { // '*' NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> arg_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME")); - Token * error; - expr_ty name_var; - if ( - (error = _PyPegen_expect_token(p, 16)) // token='*' - && - (name_var = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ arg_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s arg_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// keyword_pattern: NAME '=' or_pattern | '**' NAME +// keyword_pattern: NAME '=' or_pattern static void * keyword_pattern_rule(Parser *p) { @@ -6199,22 +6198,39 @@ keyword_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); } - { // '**' NAME + _res = NULL; + done: + D(p->level--); + return _res; +} + +// error_star: ('*' | '**') NAME +static expr_ty +error_star_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // ('*' | '**') NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME")); - Token * error; - expr_ty name_var; + D(fprintf(stderr, "%*c> error_star[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); + void *_tmp_71_var; + expr_ty error; if ( - (error = _PyPegen_expect_token(p, 35)) // token='**' + (_tmp_71_var = _tmp_71_rule(p)) // '*' | '**' && - (name_var = _PyPegen_name_token(p)) // NAME + (error = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); + D(fprintf(stderr, "%*c+ error_star[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); + _res = error; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6223,8 +6239,8 @@ keyword_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME")); + D(fprintf(stderr, "%*c%s error_star[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('*' | '**') NAME")); } _res = NULL; done: @@ -6294,7 +6310,7 @@ value_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - void *pattern_var; + expr_ty pattern_var; if ( (pattern_var = pattern_rule(p)) // pattern ) @@ -6336,7 +6352,7 @@ key_value_pattern_rule(Parser *p) void *key; void *value; if ( - (key = _tmp_69_rule(p)) // literal_pattern | constant_pattern + (key = _tmp_72_rule(p)) // literal_pattern | constant_pattern && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6485,7 +6501,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_70_rule(p), 1) // ['from' expression] + (b = _tmp_73_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -6660,7 +6676,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_71_rule(p), 1) // ['->' expression] + (a = _tmp_74_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6720,7 +6736,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_72_rule(p), 1) // ['->' expression] + (a = _tmp_75_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6784,7 +6800,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_73_rule, p) + _PyPegen_lookahead(1, _tmp_76_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -6928,9 +6944,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_74_rule(p)) // param_no_default* + (b = _loop0_77_rule(p)) // param_no_default* && - (c = _loop0_75_rule(p)) // param_with_default* + (c = _loop0_78_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -6960,7 +6976,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_76_rule(p)) // param_with_default* + (b = _loop0_79_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -6988,9 +7004,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_77_rule(p)) // param_no_default+ + (a = _loop1_80_rule(p)) // param_no_default+ && - (b = _loop0_78_rule(p)) // param_with_default* + (b = _loop0_81_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7017,7 +7033,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_79_rule(p)) // param_with_default+ + (a = _loop1_82_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -7086,7 +7102,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_80_rule(p)) // param_no_default+ + (a = _loop1_83_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7115,7 +7131,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_81_rule(p)) // param_no_default+ + (a = _loop1_84_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7165,9 +7181,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_82_rule(p)) // param_no_default* + (a = _loop0_85_rule(p)) // param_no_default* && - (b = _loop1_83_rule(p)) // param_with_default+ + (b = _loop1_86_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7197,9 +7213,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_84_rule(p)) // param_no_default* + (a = _loop0_87_rule(p)) // param_no_default* && - (b = _loop1_85_rule(p)) // param_with_default+ + (b = _loop1_88_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7255,7 +7271,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_86_rule(p)) // param_maybe_default* + (b = _loop0_89_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7288,7 +7304,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_87_rule(p)) // param_maybe_default+ + (b = _loop1_90_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -7810,7 +7826,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_88_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_91_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -7931,7 +7947,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_89_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_92_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -8080,7 +8096,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_90_rule(p)) // ','.star_expression+ + (a = _gather_93_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8140,7 +8156,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_92_rule(p)) // ((',' star_expression))+ + (b = _loop1_95_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8335,7 +8351,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_93_rule(p)) // ','.star_named_expression+ + (a = _gather_96_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8633,7 +8649,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_95_rule(p)) // ((',' expression))+ + (b = _loop1_98_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8932,9 +8948,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_96_rule(p)) // lambda_param_no_default* + (b = _loop0_99_rule(p)) // lambda_param_no_default* && - (c = _loop0_97_rule(p)) // lambda_param_with_default* + (c = _loop0_100_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8964,7 +8980,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_98_rule(p)) // lambda_param_with_default* + (b = _loop0_101_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -8992,9 +9008,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_99_rule(p)) // lambda_param_no_default+ + (a = _loop1_102_rule(p)) // lambda_param_no_default+ && - (b = _loop0_100_rule(p)) // lambda_param_with_default* + (b = _loop0_103_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9021,7 +9037,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_101_rule(p)) // lambda_param_with_default+ + (a = _loop1_104_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9092,7 +9108,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_102_rule(p)) // lambda_param_no_default+ + (a = _loop1_105_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9121,7 +9137,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_103_rule(p)) // lambda_param_no_default+ + (a = _loop1_106_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9171,9 +9187,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_104_rule(p)) // lambda_param_no_default* + (a = _loop0_107_rule(p)) // lambda_param_no_default* && - (b = _loop1_105_rule(p)) // lambda_param_with_default+ + (b = _loop1_108_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9203,9 +9219,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_106_rule(p)) // lambda_param_no_default* + (a = _loop0_109_rule(p)) // lambda_param_no_default* && - (b = _loop1_107_rule(p)) // lambda_param_with_default+ + (b = _loop1_110_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9261,7 +9277,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_108_rule(p)) // lambda_param_maybe_default* + (b = _loop0_111_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9294,7 +9310,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_109_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_112_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9721,7 +9737,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_110_rule(p)) // (('or' conjunction))+ + (b = _loop1_113_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -9807,7 +9823,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_111_rule(p)) // (('and' inversion))+ + (b = _loop1_114_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -9975,7 +9991,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_112_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_115_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10303,10 +10319,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_113_var; + void *_tmp_116_var; expr_ty a; if ( - (_tmp_113_var = _tmp_113_rule(p)) // '!=' + (_tmp_116_var = _tmp_116_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12235,7 +12251,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_114_rule(p)) // ','.slice+ + (a = _gather_117_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12305,7 +12321,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_116_rule(p), 1) // [':' expression?] + (c = _tmp_119_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -12579,15 +12595,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_117_var; + void *_tmp_120_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_117_var = _tmp_117_rule(p)) // tuple | group | genexp + (_tmp_120_var = _tmp_120_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_117_var; + _res = _tmp_120_var; goto done; } p->mark = _mark; @@ -12600,15 +12616,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_118_var; + void *_tmp_121_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_118_var = _tmp_118_rule(p)) // list | listcomp + (_tmp_121_var = _tmp_121_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_118_var; + _res = _tmp_121_var; goto done; } p->mark = _mark; @@ -12621,15 +12637,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_119_var; + void *_tmp_122_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_119_var = _tmp_119_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_122_var = _tmp_122_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_119_var; + _res = _tmp_122_var; goto done; } p->mark = _mark; @@ -12698,7 +12714,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_120_rule(p)) // STRING+ + (a = _loop1_123_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -12905,7 +12921,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_121_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_124_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -12961,7 +12977,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_122_rule(p)) // yield_expr | named_expression + (a = _tmp_125_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13397,7 +13413,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_123_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_126_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13548,13 +13564,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_125_var; + asdl_seq * _loop1_128_var; if ( - (_loop1_125_var = _loop1_125_rule(p)) // for_if_clause+ + (_loop1_128_var = _loop1_128_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_125_var; + _res = _loop1_128_var; goto done; } p->mark = _mark; @@ -13603,7 +13619,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_126_rule(p)) // (('if' disjunction))* + (c = _loop0_129_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13639,7 +13655,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_127_rule(p)) // (('if' disjunction))* + (c = _loop0_130_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13864,7 +13880,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_128_rule(p), 1) // [',' args] + (b = _tmp_131_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -13933,7 +13949,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_129_rule(p), 1) // [',' args] + (b = _tmp_132_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -13988,11 +14004,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_130_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_133_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_132_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_135_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14014,13 +14030,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_134_var; + asdl_seq * _gather_137_var; if ( - (_gather_134_var = _gather_134_rule(p)) // ','.kwarg_or_starred+ + (_gather_137_var = _gather_137_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_134_var; + _res = _gather_137_var; goto done; } p->mark = _mark; @@ -14033,13 +14049,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_136_var; + asdl_seq * _gather_139_var; if ( - (_gather_136_var = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_139_var = _gather_139_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_136_var; + _res = _gather_139_var; goto done; } p->mark = _mark; @@ -14401,7 +14417,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_138_rule(p)) // ((',' star_target))* + (b = _loop0_141_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14455,7 +14471,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_139_rule(p)) // ','.star_target+ + (a = _gather_142_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14518,7 +14534,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_141_rule(p)) // !'*' star_target + (a = _tmp_144_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15040,7 +15056,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_142_rule(p)) // ','.del_target+ + (a = _gather_145_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15519,7 +15535,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_144_rule(p)) // ','.target+ + (a = _gather_147_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16231,7 +16247,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_146_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_149_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -16513,14 +16529,14 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_147_var; + asdl_seq * _loop0_150_var; expr_ty a; if ( (a = star_named_expression_rule(p)) // star_named_expression && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_147_var = _loop0_147_rule(p)) // star_named_expressions* + (_loop0_150_var = _loop0_150_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -16556,7 +16572,7 @@ invalid_assignment_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_148_rule(p), 1) // ['=' annotated_rhs] + (_opt_var = _tmp_151_rule(p), 1) // ['=' annotated_rhs] ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); @@ -16579,14 +16595,14 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); Token * _literal; - void *_tmp_149_var; + void *_tmp_152_var; expr_ty a; if ( (a = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_tmp_149_var = _tmp_149_rule(p)) // yield_expr | star_expressions + (_tmp_152_var = _tmp_152_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); @@ -16608,7 +16624,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_150_var; + void *_tmp_153_var; expr_ty a; AugOperator* augassign_var; if ( @@ -16616,7 +16632,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_150_var = _tmp_150_rule(p)) // yield_expr | star_expressions + (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -16698,11 +16714,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_151_var; + void *_tmp_154_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_151_var = _tmp_151_rule(p)) // '[' | '(' | '{' + (_tmp_154_var = _tmp_154_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -16799,13 +16815,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_152_var; - void *_tmp_153_var; + asdl_seq * _loop0_155_var; + void *_tmp_156_var; arg_ty param_no_default_var; if ( - (_loop0_152_var = _loop0_152_rule(p)) // param_no_default* + (_loop0_155_var = _loop0_155_rule(p)) // param_no_default* && - (_tmp_153_var = _tmp_153_rule(p)) // slash_with_default | param_with_default+ + (_tmp_156_var = _tmp_156_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -16847,11 +16863,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_154_var; + void *_tmp_157_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_154_var = _tmp_154_rule(p)) // ')' | ',' (')' | '**') + (_tmp_157_var = _tmp_157_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -16921,11 +16937,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_155_var; + void *_tmp_158_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_155_var = _tmp_155_rule(p)) // ':' | ',' (':' | '**') + (_tmp_158_var = _tmp_158_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18335,12 +18351,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_156_var; + void *_tmp_159_var; while ( - (_tmp_156_var = _tmp_156_rule(p)) // star_targets '=' + (_tmp_159_var = _tmp_159_rule(p)) // star_targets '=' ) { - _res = _tmp_156_var; + _res = _tmp_159_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18788,12 +18804,12 @@ _loop0_30_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_157_var; + void *_tmp_160_var; while ( - (_tmp_157_var = _tmp_157_rule(p)) // '.' | '...' + (_tmp_160_var = _tmp_160_rule(p)) // '.' | '...' ) { - _res = _tmp_157_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18854,12 +18870,12 @@ _loop1_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_158_var; + void *_tmp_161_var; while ( - (_tmp_158_var = _tmp_158_rule(p)) // '.' | '...' + (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' ) { - _res = _tmp_158_var; + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20014,7 +20030,7 @@ _gather_50_rule(Parser *p) return _res; } -// _tmp_52: '.' | '(' +// _tmp_52: '.' | '(' | '=' static void * _tmp_52_rule(Parser *p) { @@ -20063,13 +20079,32 @@ _tmp_52_rule(Parser *p) D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } + { // '=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + ) + { + D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); + } _res = NULL; done: D(p->level--); return _res; } -// _loop0_54: ',' arg_pattern +// _loop0_54: ',' pattern static asdl_seq * _loop0_54_rule(Parser *p) { @@ -20090,18 +20125,18 @@ _loop0_54_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' arg_pattern + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); + D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -20127,7 +20162,7 @@ _loop0_54_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20144,7 +20179,7 @@ _loop0_54_rule(Parser *p) return _seq; } -// _gather_53: arg_pattern _loop0_54 +// _gather_53: pattern _loop0_54 static asdl_seq * _gather_53_rule(Parser *p) { @@ -20155,27 +20190,27 @@ _gather_53_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // arg_pattern _loop0_54 + { // pattern _loop0_54 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_54")); + D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); expr_ty elem; asdl_seq * seq; if ( - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern && (seq = _loop0_54_rule(p)) // _loop0_54 ) { - D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_54")); + D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_54")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_54")); } _res = NULL; done: @@ -20297,7 +20332,7 @@ _gather_55_rule(Parser *p) return _res; } -// _loop0_58: ',' arg_pattern +// _loop0_58: ',' pattern static asdl_seq * _loop0_58_rule(Parser *p) { @@ -20318,18 +20353,18 @@ _loop0_58_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' arg_pattern + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); + D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -20355,7 +20390,7 @@ _loop0_58_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20372,7 +20407,7 @@ _loop0_58_rule(Parser *p) return _seq; } -// _gather_57: arg_pattern _loop0_58 +// _gather_57: pattern _loop0_58 static asdl_seq * _gather_57_rule(Parser *p) { @@ -20383,27 +20418,27 @@ _gather_57_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // arg_pattern _loop0_58 + { // pattern _loop0_58 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_58")); + D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); expr_ty elem; asdl_seq * seq; if ( - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern && (seq = _loop0_58_rule(p)) // _loop0_58 ) { - D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_58")); + D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_58")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_58")); } _res = NULL; done: @@ -20525,7 +20560,7 @@ _gather_59_rule(Parser *p) return _res; } -// _tmp_61: ','.arg_pattern+ ',' +// _tmp_61: ','.pattern+ ',' static void * _tmp_61_rule(Parser *p) { @@ -20536,27 +20571,27 @@ _tmp_61_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ','.arg_pattern+ ',' + { // ','.pattern+ ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.arg_pattern+ ','")); - asdl_seq * _gather_159_var; + D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + asdl_seq * _gather_162_var; Token * _literal; if ( - (_gather_159_var = _gather_159_rule(p)) // ','.arg_pattern+ + (_gather_162_var = _gather_162_rule(p)) // ','.pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.arg_pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_159_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_162_var, _literal); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.arg_pattern+ ','")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ','")); } _res = NULL; done: @@ -20678,7 +20713,7 @@ _gather_62_rule(Parser *p) return _res; } -// _tmp_64: ',' ','.(arg_pattern | keyword_pattern)+ +// _tmp_64: ',' ','.(pattern | keyword_pattern)+ static void * _tmp_64_rule(Parser *p) { @@ -20689,27 +20724,105 @@ _tmp_64_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.(arg_pattern | keyword_pattern)+ + { // ',' ','.(pattern | keyword_pattern)+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); - asdl_seq * _gather_161_var; + D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + asdl_seq * _gather_164_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_161_var = _gather_161_rule(p)) // ','.(arg_pattern | keyword_pattern)+ + (_gather_164_var = _gather_164_rule(p)) // ','.(pattern | keyword_pattern)+ ) { - D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_161_var); + D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_164_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(arg_pattern | keyword_pattern)+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_65: ','.(pattern | keyword_pattern)+ ',' +static void * +_tmp_65_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ','.(pattern | keyword_pattern)+ ',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + asdl_seq * _gather_166_var; + Token * _literal; + if ( + (_gather_166_var = _gather_166_rule(p)) // ','.(pattern | keyword_pattern)+ + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + _res = _PyPegen_dummy_name(p, _gather_166_var, _literal); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_66: ',' ','.(pattern | keyword_pattern | error_star)+ +static void * +_tmp_66_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ',' ','.(pattern | keyword_pattern | error_star)+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); + asdl_seq * _gather_168_var; + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_gather_168_var = _gather_168_rule(p)) // ','.(pattern | keyword_pattern | error_star)+ + ) + { + D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_168_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); } _res = NULL; done: @@ -20717,9 +20830,9 @@ _tmp_64_rule(Parser *p) return _res; } -// _loop0_66: ',' value_pattern +// _loop0_68: ',' value_pattern static asdl_seq * -_loop0_66_rule(Parser *p) +_loop0_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20743,7 +20856,7 @@ _loop0_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c> _loop0_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; void *elem; while ( @@ -20774,7 +20887,7 @@ _loop0_66_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20787,14 +20900,14 @@ _loop0_66_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_68_type, _seq); D(p->level--); return _seq; } -// _gather_65: value_pattern _loop0_66 +// _gather_67: value_pattern _loop0_68 static asdl_seq * -_gather_65_rule(Parser *p) +_gather_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20803,27 +20916,27 @@ _gather_65_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // value_pattern _loop0_66 + { // value_pattern _loop0_68 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_66")); + D(fprintf(stderr, "%*c> _gather_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_68")); void *elem; asdl_seq * seq; if ( (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_66_rule(p)) // _loop0_66 + (seq = _loop0_68_rule(p)) // _loop0_68 ) { - D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_66")); + D(fprintf(stderr, "%*c+ _gather_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_68")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_66")); + D(fprintf(stderr, "%*c%s _gather_67[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_68")); } _res = NULL; done: @@ -20831,9 +20944,9 @@ _gather_65_rule(Parser *p) return _res; } -// _loop0_68: ',' key_value_pattern +// _loop0_70: ',' key_value_pattern static asdl_seq * -_loop0_68_rule(Parser *p) +_loop0_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20857,7 +20970,7 @@ _loop0_68_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; void *elem; while ( @@ -20888,7 +21001,7 @@ _loop0_68_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_68[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20901,14 +21014,14 @@ _loop0_68_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_68_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); D(p->level--); return _seq; } -// _gather_67: key_value_pattern _loop0_68 +// _gather_69: key_value_pattern _loop0_70 static asdl_seq * -_gather_67_rule(Parser *p) +_gather_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20917,27 +21030,27 @@ _gather_67_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_68 + { // key_value_pattern _loop0_70 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_68")); + D(fprintf(stderr, "%*c> _gather_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_70")); void *elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_68_rule(p)) // _loop0_68 + (seq = _loop0_70_rule(p)) // _loop0_70 ) { - D(fprintf(stderr, "%*c+ _gather_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_68")); + D(fprintf(stderr, "%*c+ _gather_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_70")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_67[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_68")); + D(fprintf(stderr, "%*c%s _gather_69[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_70")); } _res = NULL; done: @@ -20945,9 +21058,9 @@ _gather_67_rule(Parser *p) return _res; } -// _tmp_69: literal_pattern | constant_pattern +// _tmp_71: '*' | '**' static void * -_tmp_69_rule(Parser *p) +_tmp_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20956,43 +21069,43 @@ _tmp_69_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // literal_pattern + { // '*' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - void *literal_pattern_var; + D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); + Token * _literal; if ( - (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern + (_literal = _PyPegen_expect_token(p, 16)) // token='*' ) { - D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - _res = literal_pattern_var; + D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); } - { // constant_pattern + { // '**' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - void *constant_pattern_var; + D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + Token * _literal; if ( - (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern + (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - _res = constant_pattern_var; + D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; done: @@ -21000,9 +21113,9 @@ _tmp_69_rule(Parser *p) return _res; } -// _tmp_70: 'from' expression +// _tmp_72: literal_pattern | constant_pattern static void * -_tmp_70_rule(Parser *p) +_tmp_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21011,42 +21124,97 @@ _tmp_70_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'from' expression + { // literal_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); - Token * _keyword; - expr_ty z; + D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + void *literal_pattern_var; if ( - (_keyword = _PyPegen_expect_token(p, 514)) // token='from' - && - (z = expression_rule(p)) // expression + (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + _res = literal_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } - _res = NULL; - done: - D(p->level--); + { // constant_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + void *constant_pattern_var; + if ( + (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + _res = constant_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); + } + _res = NULL; + done: + D(p->level--); return _res; } -// _tmp_71: '->' expression +// _tmp_73: 'from' expression static void * -_tmp_71_rule(Parser *p) +_tmp_73_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'from' expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 514)) // token='from' + && + (z = expression_rule(p)) // expression + ) + { + D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_74: '->' expression +static void * +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21060,7 +21228,7 @@ _tmp_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21069,7 +21237,7 @@ _tmp_71_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21079,7 +21247,7 @@ _tmp_71_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21088,9 +21256,9 @@ _tmp_71_rule(Parser *p) return _res; } -// _tmp_72: '->' expression +// _tmp_75: '->' expression static void * -_tmp_72_rule(Parser *p) +_tmp_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21104,7 +21272,7 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21113,7 +21281,7 @@ _tmp_72_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21123,7 +21291,7 @@ _tmp_72_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21132,9 +21300,9 @@ _tmp_72_rule(Parser *p) return _res; } -// _tmp_73: NEWLINE INDENT +// _tmp_76: NEWLINE INDENT static void * -_tmp_73_rule(Parser *p) +_tmp_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21148,7 +21316,7 @@ _tmp_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -21157,12 +21325,12 @@ _tmp_73_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -21171,9 +21339,9 @@ _tmp_73_rule(Parser *p) return _res; } -// _loop0_74: param_no_default +// _loop0_77: param_no_default static asdl_seq * -_loop0_74_rule(Parser *p) +_loop0_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21197,7 +21365,7 @@ _loop0_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21219,7 +21387,7 @@ _loop0_74_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21232,14 +21400,14 @@ _loop0_74_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); D(p->level--); return _seq; } -// _loop0_75: param_with_default +// _loop0_78: param_with_default static asdl_seq * -_loop0_75_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21263,7 +21431,7 @@ _loop0_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21285,7 +21453,7 @@ _loop0_75_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21298,14 +21466,14 @@ _loop0_75_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _loop0_76: param_with_default +// _loop0_79: param_with_default static asdl_seq * -_loop0_76_rule(Parser *p) +_loop0_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21329,7 +21497,7 @@ _loop0_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21351,7 +21519,7 @@ _loop0_76_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21364,14 +21532,14 @@ _loop0_76_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); D(p->level--); return _seq; } -// _loop1_77: param_no_default +// _loop1_80: param_no_default static asdl_seq * -_loop1_77_rule(Parser *p) +_loop1_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21395,7 +21563,7 @@ _loop1_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21417,7 +21585,7 @@ _loop1_77_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21435,14 +21603,14 @@ _loop1_77_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); D(p->level--); return _seq; } -// _loop0_78: param_with_default +// _loop0_81: param_with_default static asdl_seq * -_loop0_78_rule(Parser *p) +_loop0_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21466,7 +21634,7 @@ _loop0_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21488,7 +21656,7 @@ _loop0_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21501,14 +21669,14 @@ _loop0_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); D(p->level--); return _seq; } -// _loop1_79: param_with_default +// _loop1_82: param_with_default static asdl_seq * -_loop1_79_rule(Parser *p) +_loop1_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21532,7 +21700,7 @@ _loop1_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21554,7 +21722,7 @@ _loop1_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21572,14 +21740,14 @@ _loop1_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); D(p->level--); return _seq; } -// _loop1_80: param_no_default +// _loop1_83: param_no_default static asdl_seq * -_loop1_80_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21603,7 +21771,7 @@ _loop1_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21625,7 +21793,7 @@ _loop1_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21643,14 +21811,14 @@ _loop1_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop1_81: param_no_default +// _loop1_84: param_no_default static asdl_seq * -_loop1_81_rule(Parser *p) +_loop1_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21674,7 +21842,7 @@ _loop1_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21696,7 +21864,7 @@ _loop1_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21714,14 +21882,14 @@ _loop1_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); D(p->level--); return _seq; } -// _loop0_82: param_no_default +// _loop0_85: param_no_default static asdl_seq * -_loop0_82_rule(Parser *p) +_loop0_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21745,7 +21913,7 @@ _loop0_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21767,7 +21935,7 @@ _loop0_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21780,14 +21948,14 @@ _loop0_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); D(p->level--); return _seq; } -// _loop1_83: param_with_default +// _loop1_86: param_with_default static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21811,7 +21979,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21833,7 +22001,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21851,14 +22019,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); D(p->level--); return _seq; } -// _loop0_84: param_no_default +// _loop0_87: param_no_default static asdl_seq * -_loop0_84_rule(Parser *p) +_loop0_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21882,7 +22050,7 @@ _loop0_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21904,7 +22072,7 @@ _loop0_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21917,14 +22085,14 @@ _loop0_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); D(p->level--); return _seq; } -// _loop1_85: param_with_default +// _loop1_88: param_with_default static asdl_seq * -_loop1_85_rule(Parser *p) +_loop1_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21948,7 +22116,7 @@ _loop1_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21970,7 +22138,7 @@ _loop1_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21988,14 +22156,14 @@ _loop1_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); D(p->level--); return _seq; } -// _loop0_86: param_maybe_default +// _loop0_89: param_maybe_default static asdl_seq * -_loop0_86_rule(Parser *p) +_loop0_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22019,7 +22187,7 @@ _loop0_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22041,7 +22209,7 @@ _loop0_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22054,14 +22222,14 @@ _loop0_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_89_type, _seq); D(p->level--); return _seq; } -// _loop1_87: param_maybe_default +// _loop1_90: param_maybe_default static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22085,7 +22253,7 @@ _loop1_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22107,7 +22275,7 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -22125,14 +22293,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); D(p->level--); return _seq; } -// _loop1_88: ('@' named_expression NEWLINE) +// _loop1_91: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_88_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22156,13 +22324,13 @@ _loop1_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_163_var; + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_170_var; while ( - (_tmp_163_var = _tmp_163_rule(p)) // '@' named_expression NEWLINE + (_tmp_170_var = _tmp_170_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_163_var; + _res = _tmp_170_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22178,7 +22346,7 @@ _loop1_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -22196,14 +22364,14 @@ _loop1_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _tmp_89: '(' arguments? ')' +// _tmp_92: '(' arguments? ')' static void * -_tmp_89_rule(Parser *p) +_tmp_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22217,7 +22385,7 @@ _tmp_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -22229,7 +22397,7 @@ _tmp_89_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22239,7 +22407,7 @@ _tmp_89_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -22248,9 +22416,9 @@ _tmp_89_rule(Parser *p) return _res; } -// _loop0_91: ',' star_expression +// _loop0_94: ',' star_expression static asdl_seq * -_loop0_91_rule(Parser *p) +_loop0_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22274,7 +22442,7 @@ _loop0_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -22305,7 +22473,7 @@ _loop0_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22318,14 +22486,14 @@ _loop0_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); D(p->level--); return _seq; } -// _gather_90: star_expression _loop0_91 +// _gather_93: star_expression _loop0_94 static asdl_seq * -_gather_90_rule(Parser *p) +_gather_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22334,27 +22502,27 @@ _gather_90_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_91 + { // star_expression _loop0_94 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_91")); + D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_94")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_91_rule(p)) // _loop0_91 + (seq = _loop0_94_rule(p)) // _loop0_94 ) { - D(fprintf(stderr, "%*c+ _gather_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_91")); + D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_94")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_90[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_91")); + D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_94")); } _res = NULL; done: @@ -22362,9 +22530,9 @@ _gather_90_rule(Parser *p) return _res; } -// _loop1_92: (',' star_expression) +// _loop1_95: (',' star_expression) static asdl_seq * -_loop1_92_rule(Parser *p) +_loop1_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22388,13 +22556,13 @@ _loop1_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_164_var; + D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_171_var; while ( - (_tmp_164_var = _tmp_164_rule(p)) // ',' star_expression + (_tmp_171_var = _tmp_171_rule(p)) // ',' star_expression ) { - _res = _tmp_164_var; + _res = _tmp_171_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22410,7 +22578,7 @@ _loop1_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -22428,14 +22596,14 @@ _loop1_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); D(p->level--); return _seq; } -// _loop0_94: ',' star_named_expression +// _loop0_97: ',' star_named_expression static asdl_seq * -_loop0_94_rule(Parser *p) +_loop0_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22459,7 +22627,7 @@ _loop0_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -22490,7 +22658,7 @@ _loop0_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22503,14 +22671,14 @@ _loop0_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); D(p->level--); return _seq; } -// _gather_93: star_named_expression _loop0_94 +// _gather_96: star_named_expression _loop0_97 static asdl_seq * -_gather_93_rule(Parser *p) +_gather_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22519,27 +22687,27 @@ _gather_93_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_94 + { // star_named_expression _loop0_97 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_94")); + D(fprintf(stderr, "%*c> _gather_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_97")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_94_rule(p)) // _loop0_94 + (seq = _loop0_97_rule(p)) // _loop0_97 ) { - D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_94")); + D(fprintf(stderr, "%*c+ _gather_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_97")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_94")); + D(fprintf(stderr, "%*c%s _gather_96[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_97")); } _res = NULL; done: @@ -22547,9 +22715,9 @@ _gather_93_rule(Parser *p) return _res; } -// _loop1_95: (',' expression) +// _loop1_98: (',' expression) static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22573,13 +22741,13 @@ _loop1_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_165_var; + D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_172_var; while ( - (_tmp_165_var = _tmp_165_rule(p)) // ',' expression + (_tmp_172_var = _tmp_172_rule(p)) // ',' expression ) { - _res = _tmp_165_var; + _res = _tmp_172_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22595,7 +22763,7 @@ _loop1_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -22613,14 +22781,14 @@ _loop1_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); D(p->level--); return _seq; } -// _loop0_96: lambda_param_no_default +// _loop0_99: lambda_param_no_default static asdl_seq * -_loop0_96_rule(Parser *p) +_loop0_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22644,7 +22812,7 @@ _loop0_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22666,7 +22834,7 @@ _loop0_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22679,14 +22847,14 @@ _loop0_96_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_99_type, _seq); D(p->level--); return _seq; } -// _loop0_97: lambda_param_with_default +// _loop0_100: lambda_param_with_default static asdl_seq * -_loop0_97_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22710,7 +22878,7 @@ _loop0_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22732,7 +22900,7 @@ _loop0_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22745,14 +22913,14 @@ _loop0_97_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop0_98: lambda_param_with_default +// _loop0_101: lambda_param_with_default static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22776,7 +22944,7 @@ _loop0_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22798,7 +22966,7 @@ _loop0_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22811,14 +22979,14 @@ _loop0_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); D(p->level--); return _seq; } -// _loop1_99: lambda_param_no_default +// _loop1_102: lambda_param_no_default static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22842,7 +23010,7 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22864,7 +23032,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22882,14 +23050,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_with_default +// _loop0_103: lambda_param_with_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22913,7 +23081,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22935,7 +23103,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22948,14 +23116,14 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); D(p->level--); return _seq; } -// _loop1_101: lambda_param_with_default +// _loop1_104: lambda_param_with_default static asdl_seq * -_loop1_101_rule(Parser *p) +_loop1_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22979,7 +23147,7 @@ _loop1_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23001,7 +23169,7 @@ _loop1_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23019,14 +23187,14 @@ _loop1_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); D(p->level--); return _seq; } -// _loop1_102: lambda_param_no_default +// _loop1_105: lambda_param_no_default static asdl_seq * -_loop1_102_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23050,7 +23218,7 @@ _loop1_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23072,7 +23240,7 @@ _loop1_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23090,14 +23258,14 @@ _loop1_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop1_103: lambda_param_no_default +// _loop1_106: lambda_param_no_default static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23121,7 +23289,7 @@ _loop1_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23143,7 +23311,7 @@ _loop1_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23161,14 +23329,14 @@ _loop1_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_no_default +// _loop0_107: lambda_param_no_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23192,7 +23360,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23214,7 +23382,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23227,14 +23395,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_with_default +// _loop1_108: lambda_param_with_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23258,7 +23426,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23280,7 +23448,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23298,14 +23466,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); D(p->level--); return _seq; } -// _loop0_106: lambda_param_no_default +// _loop0_109: lambda_param_no_default static asdl_seq * -_loop0_106_rule(Parser *p) +_loop0_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23329,7 +23497,7 @@ _loop0_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23351,7 +23519,7 @@ _loop0_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23364,14 +23532,14 @@ _loop0_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); D(p->level--); return _seq; } -// _loop1_107: lambda_param_with_default +// _loop1_110: lambda_param_with_default static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23395,7 +23563,7 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23417,7 +23585,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23435,14 +23603,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq); D(p->level--); return _seq; } -// _loop0_108: lambda_param_maybe_default +// _loop0_111: lambda_param_maybe_default static asdl_seq * -_loop0_108_rule(Parser *p) +_loop0_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23466,7 +23634,7 @@ _loop0_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23488,7 +23656,7 @@ _loop0_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23501,14 +23669,14 @@ _loop0_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); D(p->level--); return _seq; } -// _loop1_109: lambda_param_maybe_default +// _loop1_112: lambda_param_maybe_default static asdl_seq * -_loop1_109_rule(Parser *p) +_loop1_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23532,7 +23700,7 @@ _loop1_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23554,7 +23722,7 @@ _loop1_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -23572,14 +23740,14 @@ _loop1_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); D(p->level--); return _seq; } -// _loop1_110: ('or' conjunction) +// _loop1_113: ('or' conjunction) static asdl_seq * -_loop1_110_rule(Parser *p) +_loop1_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23603,13 +23771,13 @@ _loop1_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_166_var; + D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_173_var; while ( - (_tmp_166_var = _tmp_166_rule(p)) // 'or' conjunction + (_tmp_173_var = _tmp_173_rule(p)) // 'or' conjunction ) { - _res = _tmp_166_var; + _res = _tmp_173_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23625,7 +23793,7 @@ _loop1_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -23643,14 +23811,14 @@ _loop1_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); D(p->level--); return _seq; } -// _loop1_111: ('and' inversion) +// _loop1_114: ('and' inversion) static asdl_seq * -_loop1_111_rule(Parser *p) +_loop1_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23674,13 +23842,13 @@ _loop1_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_167_var; + D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_174_var; while ( - (_tmp_167_var = _tmp_167_rule(p)) // 'and' inversion + (_tmp_174_var = _tmp_174_rule(p)) // 'and' inversion ) { - _res = _tmp_167_var; + _res = _tmp_174_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23696,7 +23864,7 @@ _loop1_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -23714,14 +23882,14 @@ _loop1_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); D(p->level--); return _seq; } -// _loop1_112: compare_op_bitwise_or_pair +// _loop1_115: compare_op_bitwise_or_pair static asdl_seq * -_loop1_112_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23745,7 +23913,7 @@ _loop1_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -23767,7 +23935,7 @@ _loop1_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -23785,14 +23953,14 @@ _loop1_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _tmp_113: '!=' +// _tmp_116: '!=' static void * -_tmp_113_rule(Parser *p) +_tmp_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23806,13 +23974,13 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23822,7 +23990,7 @@ _tmp_113_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -23831,9 +23999,9 @@ _tmp_113_rule(Parser *p) return _res; } -// _loop0_115: ',' slice +// _loop0_118: ',' slice static asdl_seq * -_loop0_115_rule(Parser *p) +_loop0_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23857,7 +24025,7 @@ _loop0_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -23888,7 +24056,7 @@ _loop0_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23901,14 +24069,14 @@ _loop0_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq); D(p->level--); return _seq; } -// _gather_114: slice _loop0_115 +// _gather_117: slice _loop0_118 static asdl_seq * -_gather_114_rule(Parser *p) +_gather_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23917,27 +24085,27 @@ _gather_114_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_115 + { // slice _loop0_118 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_115")); + D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_118")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_115_rule(p)) // _loop0_115 + (seq = _loop0_118_rule(p)) // _loop0_118 ) { - D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_115")); + D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_118")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_115")); + D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_118")); } _res = NULL; done: @@ -23945,9 +24113,9 @@ _gather_114_rule(Parser *p) return _res; } -// _tmp_116: ':' expression? +// _tmp_119: ':' expression? static void * -_tmp_116_rule(Parser *p) +_tmp_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23961,7 +24129,7 @@ _tmp_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -23970,7 +24138,7 @@ _tmp_116_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23980,7 +24148,7 @@ _tmp_116_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -23989,9 +24157,9 @@ _tmp_116_rule(Parser *p) return _res; } -// _tmp_117: tuple | group | genexp +// _tmp_120: tuple | group | genexp static void * -_tmp_117_rule(Parser *p) +_tmp_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24005,18 +24173,18 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -24024,18 +24192,18 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -24043,18 +24211,18 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -24063,9 +24231,9 @@ _tmp_117_rule(Parser *p) return _res; } -// _tmp_118: list | listcomp +// _tmp_121: list | listcomp static void * -_tmp_118_rule(Parser *p) +_tmp_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24079,18 +24247,18 @@ _tmp_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -24098,18 +24266,18 @@ _tmp_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -24118,9 +24286,9 @@ _tmp_118_rule(Parser *p) return _res; } -// _tmp_119: dict | set | dictcomp | setcomp +// _tmp_122: dict | set | dictcomp | setcomp static void * -_tmp_119_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24134,18 +24302,18 @@ _tmp_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -24153,18 +24321,18 @@ _tmp_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -24172,18 +24340,18 @@ _tmp_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -24191,18 +24359,18 @@ _tmp_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -24211,9 +24379,9 @@ _tmp_119_rule(Parser *p) return _res; } -// _loop1_120: STRING +// _loop1_123: STRING static asdl_seq * -_loop1_120_rule(Parser *p) +_loop1_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24237,7 +24405,7 @@ _loop1_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -24259,7 +24427,7 @@ _loop1_120_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -24277,14 +24445,14 @@ _loop1_120_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_123_type, _seq); D(p->level--); return _seq; } -// _tmp_121: star_named_expression ',' star_named_expressions? +// _tmp_124: star_named_expression ',' star_named_expressions? static void * -_tmp_121_rule(Parser *p) +_tmp_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24298,7 +24466,7 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -24310,7 +24478,7 @@ _tmp_121_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24320,7 +24488,7 @@ _tmp_121_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -24329,9 +24497,9 @@ _tmp_121_rule(Parser *p) return _res; } -// _tmp_122: yield_expr | named_expression +// _tmp_125: yield_expr | named_expression static void * -_tmp_122_rule(Parser *p) +_tmp_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24345,18 +24513,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -24364,18 +24532,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -24384,9 +24552,9 @@ _tmp_122_rule(Parser *p) return _res; } -// _loop0_124: ',' double_starred_kvpair +// _loop0_127: ',' double_starred_kvpair static asdl_seq * -_loop0_124_rule(Parser *p) +_loop0_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24410,7 +24578,7 @@ _loop0_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -24441,7 +24609,7 @@ _loop0_124_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24454,14 +24622,14 @@ _loop0_124_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); D(p->level--); return _seq; } -// _gather_123: double_starred_kvpair _loop0_124 +// _gather_126: double_starred_kvpair _loop0_127 static asdl_seq * -_gather_123_rule(Parser *p) +_gather_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24470,27 +24638,27 @@ _gather_123_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_124 + { // double_starred_kvpair _loop0_127 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_124")); + D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_127")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_124_rule(p)) // _loop0_124 + (seq = _loop0_127_rule(p)) // _loop0_127 ) { - D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_124")); + D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_127")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_124")); + D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_127")); } _res = NULL; done: @@ -24498,9 +24666,9 @@ _gather_123_rule(Parser *p) return _res; } -// _loop1_125: for_if_clause +// _loop1_128: for_if_clause static asdl_seq * -_loop1_125_rule(Parser *p) +_loop1_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24524,7 +24692,7 @@ _loop1_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -24546,7 +24714,7 @@ _loop1_125_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -24564,14 +24732,14 @@ _loop1_125_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_125_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_128_type, _seq); D(p->level--); return _seq; } -// _loop0_126: ('if' disjunction) +// _loop0_129: ('if' disjunction) static asdl_seq * -_loop0_126_rule(Parser *p) +_loop0_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24595,13 +24763,13 @@ _loop0_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_168_var; + D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_175_var; while ( - (_tmp_168_var = _tmp_168_rule(p)) // 'if' disjunction + (_tmp_175_var = _tmp_175_rule(p)) // 'if' disjunction ) { - _res = _tmp_168_var; + _res = _tmp_175_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24617,7 +24785,7 @@ _loop0_126_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24630,14 +24798,14 @@ _loop0_126_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq); D(p->level--); return _seq; } -// _loop0_127: ('if' disjunction) +// _loop0_130: ('if' disjunction) static asdl_seq * -_loop0_127_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24661,13 +24829,13 @@ _loop0_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_169_var; + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_176_var; while ( - (_tmp_169_var = _tmp_169_rule(p)) // 'if' disjunction + (_tmp_176_var = _tmp_176_rule(p)) // 'if' disjunction ) { - _res = _tmp_169_var; + _res = _tmp_176_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24683,7 +24851,7 @@ _loop0_127_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24696,14 +24864,14 @@ _loop0_127_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _tmp_128: ',' args +// _tmp_131: ',' args static void * -_tmp_128_rule(Parser *p) +_tmp_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24717,7 +24885,7 @@ _tmp_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24726,7 +24894,7 @@ _tmp_128_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24736,7 +24904,7 @@ _tmp_128_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24745,9 +24913,9 @@ _tmp_128_rule(Parser *p) return _res; } -// _tmp_129: ',' args +// _tmp_132: ',' args static void * -_tmp_129_rule(Parser *p) +_tmp_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24761,7 +24929,7 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24770,7 +24938,7 @@ _tmp_129_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24780,7 +24948,7 @@ _tmp_129_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -24789,9 +24957,9 @@ _tmp_129_rule(Parser *p) return _res; } -// _loop0_131: ',' kwarg_or_starred +// _loop0_134: ',' kwarg_or_starred static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24815,7 +24983,7 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24846,7 +25014,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24859,14 +25027,14 @@ _loop0_131_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); D(p->level--); return _seq; } -// _gather_130: kwarg_or_starred _loop0_131 +// _gather_133: kwarg_or_starred _loop0_134 static asdl_seq * -_gather_130_rule(Parser *p) +_gather_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24875,27 +25043,27 @@ _gather_130_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_131 + { // kwarg_or_starred _loop0_134 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131")); + D(fprintf(stderr, "%*c> _gather_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_134")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_131_rule(p)) // _loop0_131 + (seq = _loop0_134_rule(p)) // _loop0_134 ) { - D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131")); + D(fprintf(stderr, "%*c+ _gather_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_134")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_131")); + D(fprintf(stderr, "%*c%s _gather_133[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_134")); } _res = NULL; done: @@ -24903,9 +25071,9 @@ _gather_130_rule(Parser *p) return _res; } -// _loop0_133: ',' kwarg_or_double_starred +// _loop0_136: ',' kwarg_or_double_starred static asdl_seq * -_loop0_133_rule(Parser *p) +_loop0_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24929,7 +25097,7 @@ _loop0_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -24960,7 +25128,7 @@ _loop0_133_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24973,14 +25141,14 @@ _loop0_133_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_136_type, _seq); D(p->level--); return _seq; } -// _gather_132: kwarg_or_double_starred _loop0_133 +// _gather_135: kwarg_or_double_starred _loop0_136 static asdl_seq * -_gather_132_rule(Parser *p) +_gather_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24989,27 +25157,27 @@ _gather_132_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_133 + { // kwarg_or_double_starred _loop0_136 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133")); + D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_136")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_133_rule(p)) // _loop0_133 + (seq = _loop0_136_rule(p)) // _loop0_136 ) { - D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133")); + D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_136")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_133")); + D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_136")); } _res = NULL; done: @@ -25017,9 +25185,9 @@ _gather_132_rule(Parser *p) return _res; } -// _loop0_135: ',' kwarg_or_starred +// _loop0_138: ',' kwarg_or_starred static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25043,7 +25211,7 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25074,7 +25242,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25087,14 +25255,14 @@ _loop0_135_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); D(p->level--); return _seq; } -// _gather_134: kwarg_or_starred _loop0_135 +// _gather_137: kwarg_or_starred _loop0_138 static asdl_seq * -_gather_134_rule(Parser *p) +_gather_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25103,27 +25271,27 @@ _gather_134_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_135 + { // kwarg_or_starred _loop0_138 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_135_rule(p)) // _loop0_135 + (seq = _loop0_138_rule(p)) // _loop0_138 ) { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_138")); } _res = NULL; done: @@ -25131,9 +25299,9 @@ _gather_134_rule(Parser *p) return _res; } -// _loop0_137: ',' kwarg_or_double_starred +// _loop0_140: ',' kwarg_or_double_starred static asdl_seq * -_loop0_137_rule(Parser *p) +_loop0_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25157,7 +25325,7 @@ _loop0_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25188,7 +25356,7 @@ _loop0_137_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25201,14 +25369,14 @@ _loop0_137_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); D(p->level--); return _seq; } -// _gather_136: kwarg_or_double_starred _loop0_137 +// _gather_139: kwarg_or_double_starred _loop0_140 static asdl_seq * -_gather_136_rule(Parser *p) +_gather_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25217,27 +25385,27 @@ _gather_136_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_137 + { // kwarg_or_double_starred _loop0_140 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_137_rule(p)) // _loop0_137 + (seq = _loop0_140_rule(p)) // _loop0_140 ) { - D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_140")); } _res = NULL; done: @@ -25245,9 +25413,9 @@ _gather_136_rule(Parser *p) return _res; } -// _loop0_138: (',' star_target) +// _loop0_141: (',' star_target) static asdl_seq * -_loop0_138_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25271,13 +25439,13 @@ _loop0_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_170_var; + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_177_var; while ( - (_tmp_170_var = _tmp_170_rule(p)) // ',' star_target + (_tmp_177_var = _tmp_177_rule(p)) // ',' star_target ) { - _res = _tmp_170_var; + _res = _tmp_177_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25293,7 +25461,7 @@ _loop0_138_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25306,14 +25474,14 @@ _loop0_138_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _loop0_140: ',' star_target +// _loop0_143: ',' star_target static asdl_seq * -_loop0_140_rule(Parser *p) +_loop0_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25337,7 +25505,7 @@ _loop0_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -25368,7 +25536,7 @@ _loop0_140_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25381,14 +25549,14 @@ _loop0_140_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); D(p->level--); return _seq; } -// _gather_139: star_target _loop0_140 +// _gather_142: star_target _loop0_143 static asdl_seq * -_gather_139_rule(Parser *p) +_gather_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25397,27 +25565,27 @@ _gather_139_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_140 + { // star_target _loop0_143 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_140")); + D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_143")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_140_rule(p)) // _loop0_140 + (seq = _loop0_143_rule(p)) // _loop0_143 ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_140")); + D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_143")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_140")); + D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_143")); } _res = NULL; done: @@ -25425,9 +25593,9 @@ _gather_139_rule(Parser *p) return _res; } -// _tmp_141: !'*' star_target +// _tmp_144: !'*' star_target static void * -_tmp_141_rule(Parser *p) +_tmp_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25441,7 +25609,7 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -25449,12 +25617,12 @@ _tmp_141_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -25463,9 +25631,9 @@ _tmp_141_rule(Parser *p) return _res; } -// _loop0_143: ',' del_target +// _loop0_146: ',' del_target static asdl_seq * -_loop0_143_rule(Parser *p) +_loop0_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25489,7 +25657,7 @@ _loop0_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -25520,7 +25688,7 @@ _loop0_143_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25533,14 +25701,14 @@ _loop0_143_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); D(p->level--); return _seq; } -// _gather_142: del_target _loop0_143 +// _gather_145: del_target _loop0_146 static asdl_seq * -_gather_142_rule(Parser *p) +_gather_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25549,27 +25717,27 @@ _gather_142_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_143 + { // del_target _loop0_146 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_143")); + D(fprintf(stderr, "%*c> _gather_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_146")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_143_rule(p)) // _loop0_143 + (seq = _loop0_146_rule(p)) // _loop0_146 ) { - D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_143")); + D(fprintf(stderr, "%*c+ _gather_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_146")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_143")); + D(fprintf(stderr, "%*c%s _gather_145[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_146")); } _res = NULL; done: @@ -25577,9 +25745,9 @@ _gather_142_rule(Parser *p) return _res; } -// _loop0_145: ',' target +// _loop0_148: ',' target static asdl_seq * -_loop0_145_rule(Parser *p) +_loop0_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25603,7 +25771,7 @@ _loop0_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -25634,7 +25802,7 @@ _loop0_145_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25647,14 +25815,14 @@ _loop0_145_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_148_type, _seq); D(p->level--); return _seq; } -// _gather_144: target _loop0_145 +// _gather_147: target _loop0_148 static asdl_seq * -_gather_144_rule(Parser *p) +_gather_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25663,27 +25831,27 @@ _gather_144_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_145 + { // target _loop0_148 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_145")); + D(fprintf(stderr, "%*c> _gather_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_148")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_145_rule(p)) // _loop0_145 + (seq = _loop0_148_rule(p)) // _loop0_148 ) { - D(fprintf(stderr, "%*c+ _gather_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_145")); + D(fprintf(stderr, "%*c+ _gather_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_148")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_144[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_145")); + D(fprintf(stderr, "%*c%s _gather_147[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_148")); } _res = NULL; done: @@ -25691,9 +25859,9 @@ _gather_144_rule(Parser *p) return _res; } -// _tmp_146: args | expression for_if_clauses +// _tmp_149: args | expression for_if_clauses static void * -_tmp_146_rule(Parser *p) +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25707,18 +25875,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -25726,7 +25894,7 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -25735,12 +25903,12 @@ _tmp_146_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -25749,9 +25917,9 @@ _tmp_146_rule(Parser *p) return _res; } -// _loop0_147: star_named_expressions +// _loop0_150: star_named_expressions static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25775,7 +25943,7 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -25797,7 +25965,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25810,14 +25978,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq); D(p->level--); return _seq; } -// _tmp_148: '=' annotated_rhs +// _tmp_151: '=' annotated_rhs static void * -_tmp_148_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25831,7 +25999,7 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -25840,12 +26008,12 @@ _tmp_148_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -25854,9 +26022,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _tmp_149: yield_expr | star_expressions +// _tmp_152: yield_expr | star_expressions static void * -_tmp_149_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25870,18 +26038,18 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25889,18 +26057,18 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25909,9 +26077,9 @@ _tmp_149_rule(Parser *p) return _res; } -// _tmp_150: yield_expr | star_expressions +// _tmp_153: yield_expr | star_expressions static void * -_tmp_150_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25925,18 +26093,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -25944,18 +26112,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -25964,9 +26132,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _tmp_151: '[' | '(' | '{' +// _tmp_154: '[' | '(' | '{' static void * -_tmp_151_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25980,18 +26148,18 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -25999,18 +26167,18 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -26018,18 +26186,18 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -26038,9 +26206,9 @@ _tmp_151_rule(Parser *p) return _res; } -// _loop0_152: param_no_default +// _loop0_155: param_no_default static asdl_seq * -_loop0_152_rule(Parser *p) +_loop0_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26064,7 +26232,7 @@ _loop0_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -26086,7 +26254,7 @@ _loop0_152_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26099,14 +26267,14 @@ _loop0_152_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); D(p->level--); return _seq; } -// _tmp_153: slash_with_default | param_with_default+ +// _tmp_156: slash_with_default | param_with_default+ static void * -_tmp_153_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26120,18 +26288,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -26139,18 +26307,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_171_var; + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_178_var; if ( - (_loop1_171_var = _loop1_171_rule(p)) // param_with_default+ + (_loop1_178_var = _loop1_178_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_171_var; + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_178_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -26159,9 +26327,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: ')' | ',' (')' | '**') +// _tmp_157: ')' | ',' (')' | '**') static void * -_tmp_154_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26175,18 +26343,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -26194,21 +26362,21 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_172_var; + void *_tmp_179_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_172_var = _tmp_172_rule(p)) // ')' | '**' + (_tmp_179_var = _tmp_179_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_172_var); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_179_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -26217,9 +26385,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: ':' | ',' (':' | '**') +// _tmp_158: ':' | ',' (':' | '**') static void * -_tmp_155_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26233,18 +26401,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -26252,21 +26420,21 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_173_var; + void *_tmp_180_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_173_var = _tmp_173_rule(p)) // ':' | '**' + (_tmp_180_var = _tmp_180_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_173_var); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_180_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -26275,9 +26443,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _tmp_156: star_targets '=' +// _tmp_159: star_targets '=' static void * -_tmp_156_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26291,7 +26459,7 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -26300,7 +26468,7 @@ _tmp_156_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26310,7 +26478,7 @@ _tmp_156_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -26319,9 +26487,9 @@ _tmp_156_rule(Parser *p) return _res; } -// _tmp_157: '.' | '...' +// _tmp_160: '.' | '...' static void * -_tmp_157_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26335,18 +26503,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26354,18 +26522,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26374,9 +26542,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: '.' | '...' +// _tmp_161: '.' | '...' static void * -_tmp_158_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26390,18 +26558,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26409,18 +26577,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26429,9 +26597,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _loop0_160: ',' arg_pattern +// _loop0_163: ',' pattern static asdl_seq * -_loop0_160_rule(Parser *p) +_loop0_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26450,18 +26618,18 @@ _loop0_160_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' arg_pattern + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' arg_pattern")); + D(fprintf(stderr, "%*c> _loop0_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -26486,8 +26654,8 @@ _loop0_160_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_160[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' arg_pattern")); + D(fprintf(stderr, "%*c%s _loop0_163[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -26499,14 +26667,14 @@ _loop0_160_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_160_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_163_type, _seq); D(p->level--); return _seq; } -// _gather_159: arg_pattern _loop0_160 +// _gather_162: pattern _loop0_163 static asdl_seq * -_gather_159_rule(Parser *p) +_gather_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26515,27 +26683,141 @@ _gather_159_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // arg_pattern _loop0_160 + { // pattern _loop0_163 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_160")); + D(fprintf(stderr, "%*c> _gather_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_163")); expr_ty elem; asdl_seq * seq; if ( - (elem = arg_pattern_rule(p)) // arg_pattern + (elem = pattern_rule(p)) // pattern + && + (seq = _loop0_163_rule(p)) // _loop0_163 + ) + { + D(fprintf(stderr, "%*c+ _gather_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_163")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_162[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_163")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_165: ',' (pattern | keyword_pattern) +static asdl_seq * +_loop0_165_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' (pattern | keyword_pattern) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern)")); + Token * _literal; + void *elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = _tmp_181_rule(p)) // pattern | keyword_pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_165[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern)")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_165_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_164: (pattern | keyword_pattern) _loop0_165 +static asdl_seq * +_gather_164_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // (pattern | keyword_pattern) _loop0_165 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); + void *elem; + asdl_seq * seq; + if ( + (elem = _tmp_181_rule(p)) // pattern | keyword_pattern && - (seq = _loop0_160_rule(p)) // _loop0_160 + (seq = _loop0_165_rule(p)) // _loop0_165 ) { - D(fprintf(stderr, "%*c+ _gather_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern _loop0_160")); + D(fprintf(stderr, "%*c+ _gather_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_159[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern _loop0_160")); + D(fprintf(stderr, "%*c%s _gather_164[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); } _res = NULL; done: @@ -26543,9 +26825,9 @@ _gather_159_rule(Parser *p) return _res; } -// _loop0_162: ',' (arg_pattern | keyword_pattern) +// _loop0_167: ',' (pattern | keyword_pattern) static asdl_seq * -_loop0_162_rule(Parser *p) +_loop0_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26564,18 +26846,18 @@ _loop0_162_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (arg_pattern | keyword_pattern) + { // ',' (pattern | keyword_pattern) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (arg_pattern | keyword_pattern)")); + D(fprintf(stderr, "%*c> _loop0_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_174_rule(p)) // arg_pattern | keyword_pattern + (elem = _tmp_182_rule(p)) // pattern | keyword_pattern ) { _res = elem; @@ -26600,8 +26882,8 @@ _loop0_162_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_162[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (arg_pattern | keyword_pattern)")); + D(fprintf(stderr, "%*c%s _loop0_167[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -26613,14 +26895,14 @@ _loop0_162_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_162_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_167_type, _seq); D(p->level--); return _seq; } -// _gather_161: (arg_pattern | keyword_pattern) _loop0_162 +// _gather_166: (pattern | keyword_pattern) _loop0_167 static asdl_seq * -_gather_161_rule(Parser *p) +_gather_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26629,27 +26911,27 @@ _gather_161_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (arg_pattern | keyword_pattern) _loop0_162 + { // (pattern | keyword_pattern) _loop0_167 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + D(fprintf(stderr, "%*c> _gather_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_174_rule(p)) // arg_pattern | keyword_pattern + (elem = _tmp_182_rule(p)) // pattern | keyword_pattern && - (seq = _loop0_162_rule(p)) // _loop0_162 + (seq = _loop0_167_rule(p)) // _loop0_167 ) { - D(fprintf(stderr, "%*c+ _gather_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + D(fprintf(stderr, "%*c+ _gather_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_161[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(arg_pattern | keyword_pattern) _loop0_162")); + D(fprintf(stderr, "%*c%s _gather_166[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); } _res = NULL; done: @@ -26657,9 +26939,123 @@ _gather_161_rule(Parser *p) return _res; } -// _tmp_163: '@' named_expression NEWLINE +// _loop0_169: ',' (pattern | keyword_pattern | error_star) +static asdl_seq * +_loop0_169_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' (pattern | keyword_pattern | error_star) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern | error_star)")); + Token * _literal; + void *elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = _tmp_183_rule(p)) // pattern | keyword_pattern | error_star + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_169[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern | error_star)")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_169_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_168: (pattern | keyword_pattern | error_star) _loop0_169 +static asdl_seq * +_gather_168_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // (pattern | keyword_pattern | error_star) _loop0_169 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + void *elem; + asdl_seq * seq; + if ( + (elem = _tmp_183_rule(p)) // pattern | keyword_pattern | error_star + && + (seq = _loop0_169_rule(p)) // _loop0_169 + ) + { + D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_168[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_170: '@' named_expression NEWLINE static void * -_tmp_163_rule(Parser *p) +_tmp_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26673,7 +27069,7 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -26685,7 +27081,7 @@ _tmp_163_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26695,7 +27091,7 @@ _tmp_163_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -26704,9 +27100,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: ',' star_expression +// _tmp_171: ',' star_expression static void * -_tmp_164_rule(Parser *p) +_tmp_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26720,7 +27116,7 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -26729,7 +27125,7 @@ _tmp_164_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26739,7 +27135,7 @@ _tmp_164_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -26748,9 +27144,9 @@ _tmp_164_rule(Parser *p) return _res; } -// _tmp_165: ',' expression +// _tmp_172: ',' expression static void * -_tmp_165_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26764,7 +27160,7 @@ _tmp_165_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -26773,7 +27169,7 @@ _tmp_165_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26783,7 +27179,7 @@ _tmp_165_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -26792,9 +27188,9 @@ _tmp_165_rule(Parser *p) return _res; } -// _tmp_166: 'or' conjunction +// _tmp_173: 'or' conjunction static void * -_tmp_166_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26808,7 +27204,7 @@ _tmp_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -26817,7 +27213,7 @@ _tmp_166_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26827,7 +27223,7 @@ _tmp_166_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -26836,9 +27232,9 @@ _tmp_166_rule(Parser *p) return _res; } -// _tmp_167: 'and' inversion +// _tmp_174: 'and' inversion static void * -_tmp_167_rule(Parser *p) +_tmp_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26852,7 +27248,7 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -26861,7 +27257,7 @@ _tmp_167_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26871,7 +27267,7 @@ _tmp_167_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -26880,9 +27276,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _tmp_168: 'if' disjunction +// _tmp_175: 'if' disjunction static void * -_tmp_168_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26896,7 +27292,7 @@ _tmp_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26905,7 +27301,7 @@ _tmp_168_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26915,7 +27311,7 @@ _tmp_168_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26924,9 +27320,9 @@ _tmp_168_rule(Parser *p) return _res; } -// _tmp_169: 'if' disjunction +// _tmp_176: 'if' disjunction static void * -_tmp_169_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26940,7 +27336,7 @@ _tmp_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -26949,7 +27345,7 @@ _tmp_169_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26959,7 +27355,7 @@ _tmp_169_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -26968,9 +27364,9 @@ _tmp_169_rule(Parser *p) return _res; } -// _tmp_170: ',' star_target +// _tmp_177: ',' star_target static void * -_tmp_170_rule(Parser *p) +_tmp_177_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26984,7 +27380,7 @@ _tmp_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -26993,7 +27389,7 @@ _tmp_170_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27003,7 +27399,7 @@ _tmp_170_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -27012,9 +27408,9 @@ _tmp_170_rule(Parser *p) return _res; } -// _loop1_171: param_with_default +// _loop1_178: param_with_default static asdl_seq * -_loop1_171_rule(Parser *p) +_loop1_178_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27038,7 +27434,7 @@ _loop1_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -27060,7 +27456,7 @@ _loop1_171_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_178[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -27078,14 +27474,14 @@ _loop1_171_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_171_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_178_type, _seq); D(p->level--); return _seq; } -// _tmp_172: ')' | '**' +// _tmp_179: ')' | '**' static void * -_tmp_172_rule(Parser *p) +_tmp_179_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27099,18 +27495,18 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -27118,18 +27514,18 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27138,9 +27534,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: ':' | '**' +// _tmp_180: ':' | '**' static void * -_tmp_173_rule(Parser *p) +_tmp_180_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27154,18 +27550,18 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -27173,18 +27569,18 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27193,9 +27589,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: arg_pattern | keyword_pattern +// _tmp_181: pattern | keyword_pattern static void * -_tmp_174_rule(Parser *p) +_tmp_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27204,42 +27600,42 @@ _tmp_174_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // arg_pattern + { // pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "arg_pattern")); - expr_ty arg_pattern_var; + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + expr_ty pattern_var; if ( - (arg_pattern_var = arg_pattern_rule(p)) // arg_pattern + (pattern_var = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "arg_pattern")); - _res = arg_pattern_var; + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "arg_pattern")); + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); } { // keyword_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); void *keyword_pattern_var; if ( (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); _res = keyword_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); } _res = NULL; @@ -27248,6 +27644,135 @@ _tmp_174_rule(Parser *p) return _res; } +// _tmp_182: pattern | keyword_pattern +static void * +_tmp_182_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + expr_ty pattern_var; + if ( + (pattern_var = pattern_rule(p)) // pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); + } + { // keyword_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + void *keyword_pattern_var; + if ( + (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + _res = keyword_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_183: pattern | keyword_pattern | error_star +static void * +_tmp_183_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + expr_ty pattern_var; + if ( + (pattern_var = pattern_rule(p)) // pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); + } + { // keyword_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + void *keyword_pattern_var; + if ( + (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + _res = keyword_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + } + { // error_star + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); + expr_ty error_star_var; + if ( + (error_star_var = error_star_rule(p)) // error_star + ) + { + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); + _res = error_star_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + void * _PyPegen_parse(Parser *p) { From 89974f09d937a7d305a807bff25e545877757418 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 15:55:33 -0700 Subject: [PATCH 050/218] Convert AST tests to native syntax --- Grammar/python.gram | 2 +- Lib/ast.py | 12 +- Lib/test/test_patma.py | 895 ++++++++++++++++++++++++++++++++++---- Parser/pegen/parse.c | 956 +++++++++++++++++++---------------------- Python/compile.c | 2 +- 5 files changed, 1253 insertions(+), 614 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 099fe6a324d635..be11bf2900cffc 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -286,7 +286,7 @@ value_pattern: _Py_Starred(value, Store, EXTRA) } | pattern key_value_pattern: - | key=(literal_pattern | constant_pattern) ':' value=closed_pattern { + | key=(literal_pattern | constant_pattern) ':' value=or_pattern { _PyPegen_key_value_pair(p, key, value) } | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } diff --git a/Lib/ast.py b/Lib/ast.py index 658323bf194483..0a63a08a18bf5c 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1330,16 +1330,14 @@ def visit_Compare(self, node): self.write(" " + self.cmpops[o.__class__.__name__] + " ") self.traverse(e) - boolops = {"And": "and", "Or": "or"} - boolop_precedence = {"and": _Precedence.AND, "or": _Precedence.OR} + boolops = {("And", False): "and", ("Or", False): "or", ("Or", True): "|"} + boolop_precedence = { + "and": _Precedence.AND, "or": _Precedence.OR, "|": _Precedence.OR, + } def visit_BoolOp(self, node): - if self.in_pattern(): - self.interleave(lambda: self.write(" | "), self.traverse, node.values) - return - - operator = self.boolops[node.op.__class__.__name__] + operator = self.boolops[node.op.__class__.__name__, self.in_pattern()] operator_precedence = self.boolop_precedence[operator] def increasing_level_traverse(node): diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 806a19abb50445..ec651f755ec57a 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -56,109 +56,109 @@ def execute_match( exec(cls.compile_match(pre, target, match_cases, post), None, namespace) return namespace - def test_steroid_switch_00(self) -> None: + def test_patma_ast_00(self) -> None: match_cases = [MatchCase("0", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_01(self) -> None: + def test_patma_ast_01(self) -> None: match_cases = [MatchCase("False", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_02(self) -> None: + def test_patma_ast_02(self) -> None: match_cases = [MatchCase("1", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_03(self) -> None: + def test_patma_ast_03(self) -> None: match_cases = [MatchCase("None", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_04(self) -> None: + def test_patma_ast_04(self) -> None: match_cases = [MatchCase("0", "y = 0"), MatchCase("0", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_05(self) -> None: + def test_patma_ast_05(self) -> None: match_cases = [MatchCase("1", "y = 0"), MatchCase("1", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_06(self) -> None: + def test_patma_ast_06(self) -> None: match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_07(self) -> None: + def test_patma_ast_07(self) -> None: match_cases = [MatchCase("'y'", "y = 0"), MatchCase("'x'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_08(self) -> None: + def test_patma_ast_08(self) -> None: match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_09(self) -> None: + def test_patma_ast_09(self) -> None: match_cases = [MatchCase("b'y'", "y = 0"), MatchCase("b'x'", "y = 1")] namespace = self.execute_match("x = b'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), b"x") self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_guard_00(self) -> None: + def test_patma_ast_10(self) -> None: match_cases = [MatchCase("0", "y = 0", "False"), MatchCase("0", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 1) - def test_steroid_switch_guard_01(self) -> None: + def test_patma_ast_11(self) -> None: match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) - def test_steroid_switch_guard_02(self) -> None: + def test_patma_ast_12(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_guard_03(self) -> None: + def test_patma_ast_13(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_steroid_switch_guard_04(self) -> None: + def test_patma_ast_14(self) -> None: match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 2) - def test_steroid_switch_guard_05(self) -> None: + def test_patma_ast_15(self) -> None: match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "1")] namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 2) - def test_steroid_switch_guard_06(self) -> None: + def test_patma_ast_16(self) -> None: match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("1", "y = 1")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertNotIn("y", namespace) - def test_walrus_00(self) -> None: + def test_patma_ast_17(self) -> None: match_cases = [ MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("(z := 0)", "y = 1"), @@ -168,7 +168,7 @@ def test_walrus_00(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) - def test_walrus_01(self) -> None: + def test_patma_ast_18(self) -> None: match_cases = [ MatchCase("(z := 1)", "y = 0", "not (x := 1)"), MatchCase("0", "y = 1"), @@ -178,21 +178,21 @@ def test_walrus_01(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertNotIn("z", namespace) - def test_walrus_02(self) -> None: + def test_patma_ast_19(self) -> None: match_cases = [MatchCase("(z := 0)", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_walrus_03(self) -> None: + def test_patma_ast_20(self) -> None: match_cases = [MatchCase("(z := 1)", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_walrus_04(self) -> None: + def test_patma_ast_21(self) -> None: match_cases = [MatchCase("(z := 0)", "y = 0", "(w := 0)")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("w"), 0) @@ -200,7 +200,7 @@ def test_walrus_04(self) -> None: self.assertNotIn("y", namespace) self.assertEqual(namespace.get("z"), 0) - def test_walrus_05(self) -> None: + def test_patma_ast_22(self) -> None: match_cases = [MatchCase("(z := (w := 0))", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("w"), 0) @@ -208,31 +208,31 @@ def test_walrus_05(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_pipe_00(self) -> None: + def test_patma_ast_23(self) -> None: match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 0", "x", match_cases, "") self.assertEqual(namespace.get("x"), 0) self.assertEqual(namespace.get("y"), 0) - def test_pipe_01(self) -> None: + def test_patma_ast_24(self) -> None: match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 1", "x", match_cases, "") self.assertEqual(namespace.get("x"), 1) self.assertEqual(namespace.get("y"), 0) - def test_pipe_02(self) -> None: + def test_patma_ast_25(self) -> None: match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 2", "x", match_cases, "") self.assertEqual(namespace.get("x"), 2) self.assertEqual(namespace.get("y"), 0) - def test_pipe_03(self) -> None: + def test_patma_ast_26(self) -> None: match_cases = [MatchCase("0 or 1 or 2", "y = 0")] namespace = self.execute_match("x = 3", "x", match_cases, "") self.assertEqual(namespace.get("x"), 3) self.assertNotIn("y", namespace) - def test_pipe_04(self) -> None: + def test_patma_ast_27(self) -> None: match_cases = [ MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] @@ -241,7 +241,7 @@ def test_pipe_04(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_pipe_05(self) -> None: + def test_patma_ast_28(self) -> None: match_cases = [ MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] @@ -250,7 +250,7 @@ def test_pipe_05(self) -> None: self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 1) - def test_pipe_06(self) -> None: + def test_patma_ast_29(self) -> None: match_cases = [ MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] @@ -259,7 +259,7 @@ def test_pipe_06(self) -> None: self.assertNotIn("y", namespace) self.assertEqual(namespace.get("z"), 2) - def test_pipe_07(self) -> None: + def test_patma_ast_30(self) -> None: match_cases = [ MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") ] @@ -268,49 +268,49 @@ def test_pipe_07(self) -> None: self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_sequence_00(self) -> None: + def test_patma_ast_31(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_sequence_01(self) -> None: + def test_patma_ast_32(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = ()", "x", match_cases, "") self.assertEqual(namespace.get("x"), ()) self.assertEqual(namespace.get("y"), 0) - def test_sequence_02(self) -> None: + def test_patma_ast_33(self) -> None: match_cases = [MatchCase("[0]", "y = 0")] namespace = self.execute_match("x = (0,)", "x", match_cases, "") self.assertEqual(namespace.get("x"), (0,)) self.assertEqual(namespace.get("y"), 0) - def test_sequence_03(self) -> None: + def test_patma_ast_34(self) -> None: match_cases = [MatchCase("[[]]", "y = 0")] namespace = self.execute_match("x = ((),)", "x", match_cases, "") self.assertEqual(namespace.get("x"), ((),)) self.assertEqual(namespace.get("y"), 0) - def test_sequence_04(self) -> None: + def test_patma_ast_35(self) -> None: match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 1]) self.assertEqual(namespace.get("y"), 0) - def test_sequence_05(self) -> None: + def test_patma_ast_36(self) -> None: match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [1, 0]) self.assertEqual(namespace.get("y"), 0) - def test_sequence_06(self) -> None: + def test_patma_ast_37(self) -> None: match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") self.assertEqual(namespace.get("x"), [0, 0]) self.assertNotIn("y", namespace) - def test_sequence_07(self) -> None: + def test_patma_ast_38(self) -> None: match_cases = [ MatchCase("[w := 0,]", "y = 0"), MatchCase("[] or [1, z := (0 or 1)] or []", "y = 1"), @@ -321,7 +321,7 @@ def test_sequence_07(self) -> None: self.assertEqual(namespace.get("y"), 1) self.assertEqual(namespace.get("z"), 0) - def test_sequence_08(self) -> None: + def test_patma_ast_39(self) -> None: match_cases = [ MatchCase("[0,]", "y = 0"), MatchCase("[1, 0]", "y = 1", "(x := x[:0])"), @@ -331,43 +331,43 @@ def test_sequence_08(self) -> None: self.assertEqual(namespace.get("x"), []) self.assertEqual(namespace.get("y"), 2) - def test_sequence_09(self) -> None: + def test_patma_ast_40(self) -> None: match_cases = [MatchCase("[0]", "y = 0")] namespace = self.execute_match("x = {0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0}) self.assertNotIn("y", namespace) - def test_sequence_10(self) -> None: + def test_patma_ast_41(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = set()", "x", match_cases, "") self.assertEqual(namespace.get("x"), set()) self.assertNotIn("y", namespace) - def test_sequence_11(self) -> None: + def test_patma_ast_42(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = iter([1,2,3])", "x", match_cases, "") self.assertEqual(list(namespace.get("x")), [1, 2, 3]) self.assertNotIn("y", namespace) - def test_sequence_12(self) -> None: + def test_patma_ast_43(self) -> None: match_cases = [MatchCase("[]", "y = 0")] namespace = self.execute_match("x = {}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {}) self.assertNotIn("y", namespace) - def test_sequence_13(self) -> None: + def test_patma_ast_44(self) -> None: match_cases = [MatchCase("[0, 1]", "y = 0")] namespace = self.execute_match("x = {0: False, 1: True}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: False, 1: True}) self.assertNotIn("y", namespace) - def test_string_00(self) -> None: + def test_patma_ast_45(self) -> None: match_cases = [MatchCase("['x']", "y = 0"), MatchCase("'x'", "y = 1")] namespace = self.execute_match("x = 'x'", "x", match_cases, "") self.assertEqual(namespace.get("x"), "x") self.assertEqual(namespace.get("y"), 1) - def test_string_01(self) -> None: + def test_patma_ast_46(self) -> None: match_cases = [ MatchCase("[b'x']", "y = 0"), MatchCase("['x']", "y = 1"), @@ -378,13 +378,13 @@ def test_string_01(self) -> None: self.assertEqual(namespace.get("x"), b"x") self.assertEqual(namespace.get("y"), 4) - def test_string_02(self) -> None: + def test_patma_ast_47(self) -> None: match_cases = [MatchCase("[120]", "y = 0"), MatchCase("120", "y = 1")] namespace = self.execute_match("x = bytearray(b'x')", "x", match_cases, "") self.assertEqual(namespace.get("x"), b"x") self.assertNotIn("y", namespace) - def test_string_03(self) -> None: + def test_patma_ast_48(self) -> None: match_cases = [ MatchCase("[]", "y = 0"), MatchCase("['']", "y = 1"), @@ -394,7 +394,7 @@ def test_string_03(self) -> None: self.assertEqual(namespace.get("x"), "") self.assertEqual(namespace.get("y"), 2) - def test_string_04(self) -> None: + def test_patma_ast_49(self) -> None: match_cases = [ MatchCase("['x', 'x', 'x']", "y = 0"), MatchCase("['xxx']", "y = 1"), @@ -404,7 +404,7 @@ def test_string_04(self) -> None: self.assertEqual(namespace.get("x"), "xxx") self.assertEqual(namespace.get("y"), 2) - def test_string_05(self) -> None: + def test_patma_ast_50(self) -> None: match_cases = [ MatchCase("[120, 120, 120]", "y = 0"), MatchCase("[b'xxx']", "y = 1"), @@ -414,53 +414,53 @@ def test_string_05(self) -> None: self.assertEqual(namespace.get("x"), b"xxx") self.assertEqual(namespace.get("y"), 2) - def test_mapping_00(self) -> None: + def test_patma_ast_51(self) -> None: match_cases = [MatchCase("{}", "y = 0")] namespace = self.execute_match("x = {}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {}) self.assertEqual(namespace.get("y"), 0) - def test_mapping_01(self) -> None: + def test_patma_ast_52(self) -> None: match_cases = [MatchCase("{}", "y = 0")] namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 0}) self.assertEqual(namespace.get("y"), 0) - def test_mapping_02(self) -> None: + def test_patma_ast_53(self) -> None: match_cases = [MatchCase("{0: 0}", "y = 0")] namespace = self.execute_match("x = {}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {}) self.assertNotIn("y", namespace) - def test_mapping_03(self) -> None: + def test_patma_ast_54(self) -> None: match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 0}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 0) - def test_mapping_04(self) -> None: + def test_patma_ast_55(self) -> None: match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 1}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 1}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 1) - def test_mapping_05(self) -> None: + def test_patma_ast_56(self) -> None: match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 2}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 2}) self.assertEqual(namespace.get("y"), 0) self.assertEqual(namespace.get("z"), 2) - def test_mapping_06(self) -> None: + def test_patma_ast_57(self) -> None: match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] namespace = self.execute_match("x = {0: 3}", "x", match_cases, "") self.assertEqual(namespace.get("x"), {0: 3}) self.assertNotIn("y", namespace) self.assertNotIn("z", namespace) - def test_mapping_07(self) -> None: + def test_patma_ast_58(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), @@ -470,7 +470,7 @@ def test_mapping_07(self) -> None: self.assertEqual(namespace.get("x"), {}) self.assertNotIn("y", namespace) - def test_mapping_08(self) -> None: + def test_patma_ast_59(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), @@ -482,7 +482,7 @@ def test_mapping_08(self) -> None: self.assertEqual(namespace.get("x"), {False: (True, 2.0, {})}) self.assertEqual(namespace.get("y"), 0) - def test_mapping_09(self) -> None: + def test_patma_ast_60(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), @@ -494,7 +494,7 @@ def test_mapping_09(self) -> None: self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) self.assertEqual(namespace.get("y"), 0) - def test_mapping_10(self) -> None: + def test_patma_ast_61(self) -> None: match_cases = [ MatchCase("{0: [1, 2]}", "y = 0"), MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), @@ -506,7 +506,7 @@ def test_mapping_10(self) -> None: self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) self.assertEqual(namespace.get("y"), 1) - def test_mapping_11(self) -> None: + def test_patma_ast_62(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), @@ -516,7 +516,7 @@ def test_mapping_11(self) -> None: self.assertEqual(namespace.get("x"), []) self.assertEqual(namespace.get("y"), 2) - def test_mapping_12(self) -> None: + def test_patma_ast_63(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( @@ -529,7 +529,7 @@ def test_mapping_12(self) -> None: self.assertEqual(namespace.get("x"), {0: 0}) self.assertEqual(namespace.get("y"), 1) - def test_mapping_13(self) -> None: + def test_patma_ast_64(self) -> None: match_cases = [ MatchCase("{0: [1, 2, {}]}", "y = 0"), MatchCase( @@ -545,13 +545,13 @@ def test_mapping_13(self) -> None: class TestMatch(unittest.TestCase): - def test_grammar_00(self) -> None: + def test_patma_000(self) -> None: match 0: case 0: x = True self.assertEqual(x, True) - def test_grammar_01(self) -> None: + def test_patma_001(self) -> None: match 0: case 0 if False: x = False @@ -559,7 +559,7 @@ def test_grammar_01(self) -> None: x = True self.assertEqual(x, True) - def test_grammar_02(self) -> None: + def test_patma_002(self) -> None: match 0: case 0: x = True @@ -567,53 +567,53 @@ def test_grammar_02(self) -> None: x = False self.assertEqual(x, True) - def test_grammar_03(self) -> None: + def test_patma_003(self) -> None: x = False match 0: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_grammar_04(self) -> None: + def test_patma_004(self) -> None: x = False match 1: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_grammar_05(self) -> None: + def test_patma_005(self) -> None: x = False match 2: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_grammar_06(self) -> None: + def test_patma_006(self) -> None: x = False match 3: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_grammar_07(self) -> None: + def test_patma_007(self) -> None: x = False match 4: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, False) - def test_grammar_08(self) -> None: + def test_patma_008(self) -> None: x = 0 y = 1 + z = None match x: case z := .y: pass self.assertEqual(x, 0) self.assertEqual(y, 1) - with self.assertRaises(NameError): - z + self.assertEqual(z, None) - def test_grammar_09(self) -> None: + def test_patma_009(self) -> None: class A: B = 0 match 0: @@ -628,89 +628,806 @@ class A: self.assertEqual(y, 0) self.assertEqual(z, 2) - def test_grammar_10(self) -> None: + def test_patma_010(self) -> None: match (): case []: x = 0 self.assertEqual(x, 0) - def test_grammar_11(self) -> None: + def test_patma_011(self) -> None: match (0, 1, 2): case [*x]: y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) - def test_grammar_12(self) -> None: + def test_patma_012(self) -> None: match (0, 1, 2): case [0, *x]: y = 0 self.assertEqual(x, [1, 2]) self.assertEqual(y, 0) - def test_grammar_13(self) -> None: + def test_patma_013(self) -> None: match (0, 1, 2): case [0, 1, *x,]: y = 0 self.assertEqual(x, [2]) self.assertEqual(y, 0) - def test_grammar_14(self) -> None: + def test_patma_014(self) -> None: match (0, 1, 2): case [0, 1, 2, *x]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_grammar_15(self) -> None: + def test_patma_015(self) -> None: match (0, 1, 2): case [*x, 2,]: y = 0 self.assertEqual(x, [0, 1]) self.assertEqual(y, 0) - def test_grammar_16(self) -> None: + def test_patma_016(self) -> None: match (0, 1, 2): case [*x, 1, 2]: y = 0 self.assertEqual(x, [0]) self.assertEqual(y, 0) - def test_grammar_17(self) -> None: + def test_patma_017(self) -> None: match (0, 1, 2): case [*x, 0, 1, 2,]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_grammar_18(self) -> None: + def test_patma_018(self) -> None: match (0, 1, 2): case [0, *x, 2]: y = 0 self.assertEqual(x, [1]) self.assertEqual(y, 0) - def test_grammar_19(self) -> None: + def test_patma_019(self) -> None: match (0, 1, 2): case [0, 1, *x, 2,]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_grammar_20(self) -> None: + def test_patma_020(self) -> None: match (0, 1, 2): case [0, *x, 1, 2]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_grammar_21(self) -> None: + def test_patma_021(self) -> None: match (0, 1, 2): case [*x,]: y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) + def test_patma_022(self) -> None: + x = {} + match x: + case {}: + y = 0 + self.assertEqual(x, {}) + self.assertEqual(y, 0) + + def test_patma_023(self) -> None: + x = {0: 0} + match x: + case {}: + y = 0 + self.assertEqual(x, {0: 0}) + self.assertEqual(y, 0) + + def test_patma_024(self) -> None: + x = {} + y = None + match x: + case {0: 0}: + y = 0 + self.assertEqual(x, {}) + self.assertEqual(y, None) + + def test_patma_025(self) -> None: + x = {0: 0} + match x: + case {0: (z := 0 | 1 | 2)}: + y = 0 + self.assertEqual(x, {0: 0}) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + + def test_patma_026(self) -> None: + x = {0: 1} + match x: + case {0: (z := 0 | 1 | 2)}: + y = 0 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 0) + self.assertEqual(z, 1) + + def test_patma_027(self) -> None: + x = {0: 2} + match x: + case {0: (z := 0 | 1 | 2)}: + y = 0 + self.assertEqual(x, {0: 2}) + self.assertEqual(y, 0) + self.assertEqual(z, 2) + + def test_patma_028(self) -> None: + x = {0: 3} + y = None + z = None + match x: + case {0: (z := 0 | 1 | 2)}: + y = 0 + self.assertEqual(x, {0: 3}) + self.assertEqual(y, None) + self.assertEqual(z, None) + + def test_patma_029(self) -> None: + x = {} + y = None + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: [1, 2, {}], 1: [[]]}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {}) + self.assertEqual(y, None) + + def test_patma_030(self) -> None: + x = {False: (True, 2.0, {})} + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: [1, 2, {}], 1: [[]]}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {False: (True, 2.0, {})}) + self.assertEqual(y, 0) + + def test_patma_031(self) -> None: + x = {False: (True, 2.0, {}), 1: [[]], 2: 0} + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: [1, 2, {}], 1: [[]]}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0}) + self.assertEqual(y, 0) + + def test_patma_032(self) -> None: + x = {False: (True, 2.0, {}), 1: [[]], 2: 0} + match x: + case {0: [1, 2]}: + y = 0 + case {0: [1, 2, {}], 1: [[]]}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0}) + self.assertEqual(y, 1) + + def test_patma_033(self) -> None: + x = [] + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: [1, 2, {}], 1: [[]]}: + y = 1 + case []: + y = 2 + self.assertEqual(x, []) + self.assertEqual(y, 2) + + def test_patma_034(self) -> None: + x = {0: 0} + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: ([1, 2, {}] | False)} | {1: [[]]} | {0: [1, 2, {}]} | [] | 'X' | {}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {0: 0}) + self.assertEqual(y, 1) + + def test_patma_035(self) -> None: + x = {0: 0} + match x: + case {0: [1, 2, {}]}: + y = 0 + case {0: [1, 2, {}] | True} | {1: [[]]} | {0: [1, 2, {}]} | [] | 'X' | {}: + y = 1 + case []: + y = 2 + self.assertEqual(x, {0: 0}) + self.assertEqual(y, 1) + + def test_patma_036(self) -> None: + x = 0 + match x: + case 0 | 1 | 2: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_037(self) -> None: + x = 1 + match x: + case 0 | 1 | 2: + y = 0 + self.assertEqual(x, 1) + self.assertEqual(y, 0) + + def test_patma_038(self) -> None: + x = 2 + match x: + case 0 | 1 | 2: + y = 0 + self.assertEqual(x, 2) + self.assertEqual(y, 0) + + def test_patma_039(self) -> None: + x = 3 + y = None + match x: + case 0 | 1 | 2: + y = 0 + self.assertEqual(x, 3) + self.assertEqual(y, None) + + def test_patma_040(self) -> None: + x = 0 + match x: + case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + + def test_patma_041(self) -> None: + x = 1 + match x: + case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + y = 0 + self.assertEqual(x, 1) + self.assertEqual(y, 0) + self.assertEqual(z, 1) + + def test_patma_042(self) -> None: + x = 2 + y = None + match x: + case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + y = 0 + self.assertEqual(x, 2) + self.assertEqual(y, None) + self.assertEqual(z, 2) + + def test_patma_043(self) -> None: + x = 3 + y = None + z = None + match x: + case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + y = 0 + self.assertEqual(x, 3) + self.assertEqual(y, None) + self.assertEqual(z, None) + + def test_patma_044(self) -> None: + x = () + match x: + case []: + y = 0 + self.assertEqual(x, ()) + self.assertEqual(y, 0) + + def test_patma_045(self) -> None: + x = () + match x: + case []: + y = 0 + self.assertEqual(x, ()) + self.assertEqual(y, 0) + + def test_patma_046(self) -> None: + x = (0,) + match x: + case [0]: + y = 0 + self.assertEqual(x, (0,)) + self.assertEqual(y, 0) + + def test_patma_047(self) -> None: + x = ((),) + match x: + case [[]]: + y = 0 + self.assertEqual(x, ((),)) + self.assertEqual(y, 0) + + def test_patma_048(self) -> None: + x = [0, 1] + match x: + case [0, 1] | [1, 0]: + y = 0 + self.assertEqual(x, [0, 1]) + self.assertEqual(y, 0) + + def test_patma_049(self) -> None: + x = [1, 0] + match x: + case [0, 1] | [1, 0]: + y = 0 + self.assertEqual(x, [1, 0]) + self.assertEqual(y, 0) + + def test_patma_050(self) -> None: + x = [0, 0] + y = None + match x: + case [0, 1] | [1, 0]: + y = 0 + self.assertEqual(x, [0, 0]) + self.assertEqual(y, None) + + def test_patma_051(self) -> None: + w = None + x = [1, 0] + match x: + case [(w := 0)]: + y = 0 + case [] | [1, (z := 0 | 1)] | []: + y = 1 + self.assertEqual(w, None) + self.assertEqual(x, [1, 0]) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + + def test_patma_052(self) -> None: + x = [1, 0] + match x: + case [0]: + y = 0 + case [1, 0] if (x := x[:0]): + y = 1 + case [1, 0]: + y = 2 + self.assertEqual(x, []) + self.assertEqual(y, 2) + + def test_patma_053(self) -> None: + x = {0} + y = None + match x: + case [0]: + y = 0 + self.assertEqual(x, {0}) + self.assertEqual(y, None) + + def test_patma_054(self) -> None: + x = set() + y = None + match x: + case []: + y = 0 + self.assertEqual(x, set()) + self.assertEqual(y, None) + + def test_patma_055(self) -> None: + x = iter([1, 2, 3]) + y = None + match x: + case []: + y = 0 + self.assertEqual([*x], [1, 2, 3]) + self.assertEqual(y, None) + + def test_patma_056(self) -> None: + x = {} + y = None + match x: + case []: + y = 0 + self.assertEqual(x, {}) + self.assertEqual(y, None) + + def test_patma_057(self) -> None: + x = {0: False, 1: True} + y = None + match x: + case [0, 1]: + y = 0 + self.assertEqual(x, {0: False, 1: True}) + self.assertEqual(y, None) + + def test_patma_058(self) -> None: + x = 0 + match x: + case 0: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_059(self) -> None: + x = 0 + match x: + case False: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_060(self) -> None: + x = 0 + y = None + match x: + case 1: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, None) + + def test_patma_061(self) -> None: + x = 0 + y = None + match x: + case None: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, None) + + def test_patma_062(self) -> None: + x = 0 + match x: + case 0: + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_063(self) -> None: + x = 0 + y = None + match x: + case 1: + y = 0 + case 1: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, None) + + def test_patma_064(self) -> None: + x = 'x' + match x: + case 'x': + y = 0 + case 'y': + y = 1 + self.assertEqual(x, 'x') + self.assertEqual(y, 0) + + def test_patma_065(self) -> None: + x = 'x' + match x: + case 'y': + y = 0 + case 'x': + y = 1 + self.assertEqual(x, 'x') + self.assertEqual(y, 1) + + def test_patma_066(self) -> None: + x = 'x' + match x: + case 'x': + y = 0 + case 'y': + y = 1 + self.assertEqual(x, 'x') + self.assertEqual(y, 0) + + def test_patma_067(self) -> None: + x = b'x' + match x: + case b'y': + y = 0 + case b'x': + y = 1 + self.assertEqual(x, b'x') + self.assertEqual(y, 1) + + def test_patma_068(self) -> None: + x = 0 + match x: + case 0 if False: + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 1) + + def test_patma_069(self) -> None: + x = 0 + y = None + match x: + case 0 if 0: + y = 0 + case 0 if 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, None) + + def test_patma_070(self) -> None: + x = 0 + match x: + case 0 if True: + y = 0 + case 0 if True: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_071(self) -> None: + x = 0 + match x: + case 0 if True: + y = 0 + case 0 if True: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_072(self) -> None: + x = 0 + match x: + case 0 if True: + y = 0 + case 0 if True: + y = 1 + y = 2 + self.assertEqual(x, 0) + self.assertEqual(y, 2) + + def test_patma_073(self) -> None: + x = 0 + match x: + case 0 if 0: + y = 0 + case 0 if 1: + y = 1 + y = 2 + self.assertEqual(x, 0) + self.assertEqual(y, 2) + + def test_patma_074(self) -> None: + x = 0 + y = None + match x: + case 0 if not (x := 1): + y = 0 + case 1: + y = 1 + self.assertEqual(x, 1) + self.assertEqual(y, None) + + def test_patma_075(self) -> None: + x = 'x' + match x: + case ['x']: + y = 0 + case 'x': + y = 1 + self.assertEqual(x, 'x') + self.assertEqual(y, 1) + + def test_patma_076(self) -> None: + x = b'x' + match x: + case [b'x']: + y = 0 + case ['x']: + y = 1 + case [120]: + y = 2 + case b'x': + y = 4 + self.assertEqual(x, b'x') + self.assertEqual(y, 4) + + def test_patma_077(self) -> None: + x = bytearray(b'x') + y = None + match x: + case [120]: + y = 0 + case 120: + y = 1 + self.assertEqual(x, b'x') + self.assertEqual(y, None) + + def test_patma_078(self) -> None: + x = '' + match x: + case []: + y = 0 + case ['']: + y = 1 + case '': + y = 2 + self.assertEqual(x, '') + self.assertEqual(y, 2) + + def test_patma_079(self) -> None: + x = 'xxx' + match x: + case ['x', 'x', 'x']: + y = 0 + case ['xxx']: + y = 1 + case 'xxx': + y = 2 + self.assertEqual(x, 'xxx') + self.assertEqual(y, 2) + + def test_patma_080(self) -> None: + x = b'xxx' + match x: + case [120, 120, 120]: + y = 0 + case [b'xxx']: + y = 1 + case b'xxx': + y = 2 + self.assertEqual(x, b'xxx') + self.assertEqual(y, 2) + + def test_patma_081(self) -> None: + x = 0 + match x: + case 0 if not (x := 1): + y = 0 + case (z := 0): + y = 1 + self.assertEqual(x, 1) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + + def test_patma_082(self) -> None: + x = 0 + z = None + match x: + case (z := 1) if not (x := 1): + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, None) + + def test_patma_083(self) -> None: + x = 0 + match x: + case (z := 0): + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + + def test_patma_084(self) -> None: + x = 0 + y = None + z = None + match x: + case (z := 1): + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, None) + self.assertEqual(z, None) + + def test_patma_085(self) -> None: + x = 0 + y = None + match x: + case (z := 0) if (w := 0): + y = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertEqual(y, None) + self.assertEqual(z, 0) + + def test_patma_086(self) -> None: + x = 0 + match x: + case (z := (w := 0)): + y = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + + def test_patma_087(self) -> None: + x = 0 + match x: + case (0 | 1) | 2: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_088(self) -> None: + x = 1 + match x: + case (0 | 1) | 2: + y = 0 + self.assertEqual(x, 1) + self.assertEqual(y, 0) + + def test_patma_089(self) -> None: + x = 2 + match x: + case (0 | 1) | 2: + y = 0 + self.assertEqual(x, 2) + self.assertEqual(y, 0) + + def test_patma_090(self) -> None: + x = 3 + y = None + match x: + case (0 | 1) | 2: + y = 0 + self.assertEqual(x, 3) + self.assertEqual(y, None) + + def test_patma_091(self) -> None: + x = 0 + match x: + case 0 | (1 | 2): + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_092(self) -> None: + x = 1 + match x: + case 0 | (1 | 2): + y = 0 + self.assertEqual(x, 1) + self.assertEqual(y, 0) + + def test_patma_093(self) -> None: + x = 2 + match x: + case 0 | (1 | 2): + y = 0 + self.assertEqual(x, 2) + self.assertEqual(y, 0) + + def test_patma_094(self) -> None: + x = 3 + y = None + match x: + case 0 | (1 | 2): + y = 0 + self.assertEqual(x, 3) + self.assertEqual(y, None) + if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 697fe1fdfe79a5..6bccd0013c99df 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -130,310 +130,309 @@ static KeywordToken *reserved_keywords[] = { #define values_pattern_type 1052 #define items_pattern_type 1053 #define keyword_pattern_type 1054 -#define error_star_type 1055 -#define value_pattern_type 1056 -#define key_value_pattern_type 1057 -#define return_stmt_type 1058 -#define raise_stmt_type 1059 -#define function_def_type 1060 -#define function_def_raw_type 1061 -#define func_type_comment_type 1062 -#define params_type 1063 -#define parameters_type 1064 -#define slash_no_default_type 1065 -#define slash_with_default_type 1066 -#define star_etc_type 1067 -#define kwds_type 1068 -#define param_no_default_type 1069 -#define param_with_default_type 1070 -#define param_maybe_default_type 1071 -#define param_type 1072 -#define annotation_type 1073 -#define default_type 1074 -#define decorators_type 1075 -#define class_def_type 1076 -#define class_def_raw_type 1077 -#define block_type 1078 -#define expressions_list_type 1079 -#define star_expressions_type 1080 -#define star_expression_type 1081 -#define star_named_expressions_type 1082 -#define star_named_expression_type 1083 -#define named_expression_type 1084 -#define annotated_rhs_type 1085 -#define expressions_type 1086 -#define expression_type 1087 -#define lambdef_type 1088 -#define lambda_parameters_type 1089 -#define lambda_slash_no_default_type 1090 -#define lambda_slash_with_default_type 1091 -#define lambda_star_etc_type 1092 -#define lambda_kwds_type 1093 -#define lambda_param_no_default_type 1094 -#define lambda_param_with_default_type 1095 -#define lambda_param_maybe_default_type 1096 -#define lambda_param_type 1097 -#define disjunction_type 1098 -#define conjunction_type 1099 -#define inversion_type 1100 -#define comparison_type 1101 -#define compare_op_bitwise_or_pair_type 1102 -#define eq_bitwise_or_type 1103 -#define noteq_bitwise_or_type 1104 -#define lte_bitwise_or_type 1105 -#define lt_bitwise_or_type 1106 -#define gte_bitwise_or_type 1107 -#define gt_bitwise_or_type 1108 -#define notin_bitwise_or_type 1109 -#define in_bitwise_or_type 1110 -#define isnot_bitwise_or_type 1111 -#define is_bitwise_or_type 1112 -#define bitwise_or_type 1113 // Left-recursive -#define bitwise_xor_type 1114 // Left-recursive -#define bitwise_and_type 1115 // Left-recursive -#define shift_expr_type 1116 // Left-recursive -#define sum_type 1117 // Left-recursive -#define term_type 1118 // Left-recursive -#define factor_type 1119 -#define power_type 1120 -#define await_primary_type 1121 -#define primary_type 1122 // Left-recursive -#define slices_type 1123 -#define slice_type 1124 -#define atom_type 1125 -#define strings_type 1126 -#define list_type 1127 -#define listcomp_type 1128 -#define tuple_type 1129 -#define group_type 1130 -#define genexp_type 1131 -#define set_type 1132 -#define setcomp_type 1133 -#define dict_type 1134 -#define dictcomp_type 1135 -#define double_starred_kvpairs_type 1136 -#define double_starred_kvpair_type 1137 -#define kvpair_type 1138 -#define for_if_clauses_type 1139 -#define for_if_clause_type 1140 -#define yield_expr_type 1141 -#define arguments_type 1142 -#define args_type 1143 -#define kwargs_type 1144 -#define starred_expression_type 1145 -#define kwarg_or_starred_type 1146 -#define kwarg_or_double_starred_type 1147 -#define star_targets_type 1148 -#define star_targets_seq_type 1149 -#define star_target_type 1150 -#define star_atom_type 1151 -#define single_target_type 1152 -#define single_subscript_attribute_target_type 1153 -#define del_targets_type 1154 -#define del_target_type 1155 -#define del_t_atom_type 1156 -#define del_target_end_type 1157 -#define targets_type 1158 -#define target_type 1159 -#define t_primary_type 1160 // Left-recursive -#define t_lookahead_type 1161 -#define t_atom_type 1162 -#define incorrect_arguments_type 1163 -#define invalid_kwarg_type 1164 -#define invalid_named_expression_type 1165 -#define invalid_assignment_type 1166 -#define invalid_block_type 1167 -#define invalid_comprehension_type 1168 -#define invalid_dict_comprehension_type 1169 -#define invalid_parameters_type 1170 -#define invalid_star_etc_type 1171 -#define invalid_lambda_star_etc_type 1172 -#define invalid_double_type_comments_type 1173 -#define invalid_del_target_type 1174 -#define invalid_import_from_targets_type 1175 -#define _loop0_1_type 1176 -#define _loop0_2_type 1177 -#define _loop0_4_type 1178 -#define _gather_3_type 1179 -#define _loop0_6_type 1180 -#define _gather_5_type 1181 -#define _loop0_8_type 1182 -#define _gather_7_type 1183 -#define _loop0_10_type 1184 -#define _gather_9_type 1185 -#define _loop1_11_type 1186 -#define _loop0_13_type 1187 -#define _gather_12_type 1188 -#define _tmp_14_type 1189 -#define _tmp_15_type 1190 -#define _tmp_16_type 1191 -#define _tmp_17_type 1192 -#define _tmp_18_type 1193 -#define _tmp_19_type 1194 -#define _tmp_20_type 1195 -#define _tmp_21_type 1196 -#define _loop1_22_type 1197 -#define _tmp_23_type 1198 -#define _tmp_24_type 1199 -#define _loop0_26_type 1200 -#define _gather_25_type 1201 -#define _loop0_28_type 1202 -#define _gather_27_type 1203 -#define _tmp_29_type 1204 -#define _loop0_30_type 1205 -#define _loop1_31_type 1206 -#define _loop0_33_type 1207 -#define _gather_32_type 1208 -#define _tmp_34_type 1209 -#define _loop0_36_type 1210 -#define _gather_35_type 1211 -#define _tmp_37_type 1212 -#define _loop0_39_type 1213 -#define _gather_38_type 1214 -#define _loop0_41_type 1215 -#define _gather_40_type 1216 -#define _loop0_43_type 1217 -#define _gather_42_type 1218 -#define _loop0_45_type 1219 -#define _gather_44_type 1220 -#define _tmp_46_type 1221 -#define _loop1_47_type 1222 -#define _tmp_48_type 1223 -#define _loop1_49_type 1224 -#define _loop0_51_type 1225 -#define _gather_50_type 1226 -#define _tmp_52_type 1227 -#define _loop0_54_type 1228 -#define _gather_53_type 1229 -#define _loop0_56_type 1230 -#define _gather_55_type 1231 -#define _loop0_58_type 1232 -#define _gather_57_type 1233 -#define _loop0_60_type 1234 -#define _gather_59_type 1235 -#define _tmp_61_type 1236 -#define _loop0_63_type 1237 -#define _gather_62_type 1238 -#define _tmp_64_type 1239 -#define _tmp_65_type 1240 -#define _tmp_66_type 1241 -#define _loop0_68_type 1242 -#define _gather_67_type 1243 -#define _loop0_70_type 1244 -#define _gather_69_type 1245 -#define _tmp_71_type 1246 -#define _tmp_72_type 1247 -#define _tmp_73_type 1248 -#define _tmp_74_type 1249 -#define _tmp_75_type 1250 -#define _tmp_76_type 1251 -#define _loop0_77_type 1252 -#define _loop0_78_type 1253 -#define _loop0_79_type 1254 -#define _loop1_80_type 1255 -#define _loop0_81_type 1256 -#define _loop1_82_type 1257 -#define _loop1_83_type 1258 -#define _loop1_84_type 1259 -#define _loop0_85_type 1260 -#define _loop1_86_type 1261 -#define _loop0_87_type 1262 -#define _loop1_88_type 1263 -#define _loop0_89_type 1264 -#define _loop1_90_type 1265 -#define _loop1_91_type 1266 -#define _tmp_92_type 1267 -#define _loop0_94_type 1268 -#define _gather_93_type 1269 -#define _loop1_95_type 1270 -#define _loop0_97_type 1271 -#define _gather_96_type 1272 -#define _loop1_98_type 1273 -#define _loop0_99_type 1274 -#define _loop0_100_type 1275 -#define _loop0_101_type 1276 -#define _loop1_102_type 1277 -#define _loop0_103_type 1278 -#define _loop1_104_type 1279 -#define _loop1_105_type 1280 -#define _loop1_106_type 1281 -#define _loop0_107_type 1282 -#define _loop1_108_type 1283 -#define _loop0_109_type 1284 -#define _loop1_110_type 1285 -#define _loop0_111_type 1286 -#define _loop1_112_type 1287 -#define _loop1_113_type 1288 -#define _loop1_114_type 1289 -#define _loop1_115_type 1290 -#define _tmp_116_type 1291 -#define _loop0_118_type 1292 -#define _gather_117_type 1293 -#define _tmp_119_type 1294 -#define _tmp_120_type 1295 -#define _tmp_121_type 1296 -#define _tmp_122_type 1297 -#define _loop1_123_type 1298 -#define _tmp_124_type 1299 -#define _tmp_125_type 1300 -#define _loop0_127_type 1301 -#define _gather_126_type 1302 -#define _loop1_128_type 1303 -#define _loop0_129_type 1304 -#define _loop0_130_type 1305 -#define _tmp_131_type 1306 -#define _tmp_132_type 1307 -#define _loop0_134_type 1308 -#define _gather_133_type 1309 -#define _loop0_136_type 1310 -#define _gather_135_type 1311 -#define _loop0_138_type 1312 -#define _gather_137_type 1313 -#define _loop0_140_type 1314 -#define _gather_139_type 1315 -#define _loop0_141_type 1316 -#define _loop0_143_type 1317 -#define _gather_142_type 1318 -#define _tmp_144_type 1319 -#define _loop0_146_type 1320 -#define _gather_145_type 1321 -#define _loop0_148_type 1322 -#define _gather_147_type 1323 -#define _tmp_149_type 1324 -#define _loop0_150_type 1325 -#define _tmp_151_type 1326 -#define _tmp_152_type 1327 -#define _tmp_153_type 1328 -#define _tmp_154_type 1329 -#define _loop0_155_type 1330 -#define _tmp_156_type 1331 -#define _tmp_157_type 1332 -#define _tmp_158_type 1333 -#define _tmp_159_type 1334 -#define _tmp_160_type 1335 -#define _tmp_161_type 1336 -#define _loop0_163_type 1337 -#define _gather_162_type 1338 -#define _loop0_165_type 1339 -#define _gather_164_type 1340 -#define _loop0_167_type 1341 -#define _gather_166_type 1342 -#define _loop0_169_type 1343 -#define _gather_168_type 1344 -#define _tmp_170_type 1345 -#define _tmp_171_type 1346 -#define _tmp_172_type 1347 -#define _tmp_173_type 1348 -#define _tmp_174_type 1349 -#define _tmp_175_type 1350 -#define _tmp_176_type 1351 -#define _tmp_177_type 1352 -#define _loop1_178_type 1353 -#define _tmp_179_type 1354 -#define _tmp_180_type 1355 -#define _tmp_181_type 1356 -#define _tmp_182_type 1357 -#define _tmp_183_type 1358 +#define argument_pattern_type 1055 +#define error_star_type 1056 +#define value_pattern_type 1057 +#define key_value_pattern_type 1058 +#define return_stmt_type 1059 +#define raise_stmt_type 1060 +#define function_def_type 1061 +#define function_def_raw_type 1062 +#define func_type_comment_type 1063 +#define params_type 1064 +#define parameters_type 1065 +#define slash_no_default_type 1066 +#define slash_with_default_type 1067 +#define star_etc_type 1068 +#define kwds_type 1069 +#define param_no_default_type 1070 +#define param_with_default_type 1071 +#define param_maybe_default_type 1072 +#define param_type 1073 +#define annotation_type 1074 +#define default_type 1075 +#define decorators_type 1076 +#define class_def_type 1077 +#define class_def_raw_type 1078 +#define block_type 1079 +#define expressions_list_type 1080 +#define star_expressions_type 1081 +#define star_expression_type 1082 +#define star_named_expressions_type 1083 +#define star_named_expression_type 1084 +#define named_expression_type 1085 +#define annotated_rhs_type 1086 +#define expressions_type 1087 +#define expression_type 1088 +#define lambdef_type 1089 +#define lambda_parameters_type 1090 +#define lambda_slash_no_default_type 1091 +#define lambda_slash_with_default_type 1092 +#define lambda_star_etc_type 1093 +#define lambda_kwds_type 1094 +#define lambda_param_no_default_type 1095 +#define lambda_param_with_default_type 1096 +#define lambda_param_maybe_default_type 1097 +#define lambda_param_type 1098 +#define disjunction_type 1099 +#define conjunction_type 1100 +#define inversion_type 1101 +#define comparison_type 1102 +#define compare_op_bitwise_or_pair_type 1103 +#define eq_bitwise_or_type 1104 +#define noteq_bitwise_or_type 1105 +#define lte_bitwise_or_type 1106 +#define lt_bitwise_or_type 1107 +#define gte_bitwise_or_type 1108 +#define gt_bitwise_or_type 1109 +#define notin_bitwise_or_type 1110 +#define in_bitwise_or_type 1111 +#define isnot_bitwise_or_type 1112 +#define is_bitwise_or_type 1113 +#define bitwise_or_type 1114 // Left-recursive +#define bitwise_xor_type 1115 // Left-recursive +#define bitwise_and_type 1116 // Left-recursive +#define shift_expr_type 1117 // Left-recursive +#define sum_type 1118 // Left-recursive +#define term_type 1119 // Left-recursive +#define factor_type 1120 +#define power_type 1121 +#define await_primary_type 1122 +#define primary_type 1123 // Left-recursive +#define slices_type 1124 +#define slice_type 1125 +#define atom_type 1126 +#define strings_type 1127 +#define list_type 1128 +#define listcomp_type 1129 +#define tuple_type 1130 +#define group_type 1131 +#define genexp_type 1132 +#define set_type 1133 +#define setcomp_type 1134 +#define dict_type 1135 +#define dictcomp_type 1136 +#define double_starred_kvpairs_type 1137 +#define double_starred_kvpair_type 1138 +#define kvpair_type 1139 +#define for_if_clauses_type 1140 +#define for_if_clause_type 1141 +#define yield_expr_type 1142 +#define arguments_type 1143 +#define args_type 1144 +#define kwargs_type 1145 +#define starred_expression_type 1146 +#define kwarg_or_starred_type 1147 +#define kwarg_or_double_starred_type 1148 +#define star_targets_type 1149 +#define star_targets_seq_type 1150 +#define star_target_type 1151 +#define star_atom_type 1152 +#define single_target_type 1153 +#define single_subscript_attribute_target_type 1154 +#define del_targets_type 1155 +#define del_target_type 1156 +#define del_t_atom_type 1157 +#define del_target_end_type 1158 +#define targets_type 1159 +#define target_type 1160 +#define t_primary_type 1161 // Left-recursive +#define t_lookahead_type 1162 +#define t_atom_type 1163 +#define incorrect_arguments_type 1164 +#define invalid_kwarg_type 1165 +#define invalid_named_expression_type 1166 +#define invalid_assignment_type 1167 +#define invalid_block_type 1168 +#define invalid_comprehension_type 1169 +#define invalid_dict_comprehension_type 1170 +#define invalid_parameters_type 1171 +#define invalid_star_etc_type 1172 +#define invalid_lambda_star_etc_type 1173 +#define invalid_double_type_comments_type 1174 +#define invalid_del_target_type 1175 +#define invalid_import_from_targets_type 1176 +#define _loop0_1_type 1177 +#define _loop0_2_type 1178 +#define _loop0_4_type 1179 +#define _gather_3_type 1180 +#define _loop0_6_type 1181 +#define _gather_5_type 1182 +#define _loop0_8_type 1183 +#define _gather_7_type 1184 +#define _loop0_10_type 1185 +#define _gather_9_type 1186 +#define _loop1_11_type 1187 +#define _loop0_13_type 1188 +#define _gather_12_type 1189 +#define _tmp_14_type 1190 +#define _tmp_15_type 1191 +#define _tmp_16_type 1192 +#define _tmp_17_type 1193 +#define _tmp_18_type 1194 +#define _tmp_19_type 1195 +#define _tmp_20_type 1196 +#define _tmp_21_type 1197 +#define _loop1_22_type 1198 +#define _tmp_23_type 1199 +#define _tmp_24_type 1200 +#define _loop0_26_type 1201 +#define _gather_25_type 1202 +#define _loop0_28_type 1203 +#define _gather_27_type 1204 +#define _tmp_29_type 1205 +#define _loop0_30_type 1206 +#define _loop1_31_type 1207 +#define _loop0_33_type 1208 +#define _gather_32_type 1209 +#define _tmp_34_type 1210 +#define _loop0_36_type 1211 +#define _gather_35_type 1212 +#define _tmp_37_type 1213 +#define _loop0_39_type 1214 +#define _gather_38_type 1215 +#define _loop0_41_type 1216 +#define _gather_40_type 1217 +#define _loop0_43_type 1218 +#define _gather_42_type 1219 +#define _loop0_45_type 1220 +#define _gather_44_type 1221 +#define _tmp_46_type 1222 +#define _loop1_47_type 1223 +#define _tmp_48_type 1224 +#define _loop1_49_type 1225 +#define _loop0_51_type 1226 +#define _gather_50_type 1227 +#define _tmp_52_type 1228 +#define _loop0_54_type 1229 +#define _gather_53_type 1230 +#define _loop0_56_type 1231 +#define _gather_55_type 1232 +#define _loop0_58_type 1233 +#define _gather_57_type 1234 +#define _loop0_60_type 1235 +#define _gather_59_type 1236 +#define _tmp_61_type 1237 +#define _loop0_63_type 1238 +#define _gather_62_type 1239 +#define _tmp_64_type 1240 +#define _tmp_65_type 1241 +#define _tmp_66_type 1242 +#define _loop0_68_type 1243 +#define _gather_67_type 1244 +#define _loop0_70_type 1245 +#define _gather_69_type 1246 +#define _tmp_71_type 1247 +#define _tmp_72_type 1248 +#define _tmp_73_type 1249 +#define _tmp_74_type 1250 +#define _tmp_75_type 1251 +#define _tmp_76_type 1252 +#define _loop0_77_type 1253 +#define _loop0_78_type 1254 +#define _loop0_79_type 1255 +#define _loop1_80_type 1256 +#define _loop0_81_type 1257 +#define _loop1_82_type 1258 +#define _loop1_83_type 1259 +#define _loop1_84_type 1260 +#define _loop0_85_type 1261 +#define _loop1_86_type 1262 +#define _loop0_87_type 1263 +#define _loop1_88_type 1264 +#define _loop0_89_type 1265 +#define _loop1_90_type 1266 +#define _loop1_91_type 1267 +#define _tmp_92_type 1268 +#define _loop0_94_type 1269 +#define _gather_93_type 1270 +#define _loop1_95_type 1271 +#define _loop0_97_type 1272 +#define _gather_96_type 1273 +#define _loop1_98_type 1274 +#define _loop0_99_type 1275 +#define _loop0_100_type 1276 +#define _loop0_101_type 1277 +#define _loop1_102_type 1278 +#define _loop0_103_type 1279 +#define _loop1_104_type 1280 +#define _loop1_105_type 1281 +#define _loop1_106_type 1282 +#define _loop0_107_type 1283 +#define _loop1_108_type 1284 +#define _loop0_109_type 1285 +#define _loop1_110_type 1286 +#define _loop0_111_type 1287 +#define _loop1_112_type 1288 +#define _loop1_113_type 1289 +#define _loop1_114_type 1290 +#define _loop1_115_type 1291 +#define _tmp_116_type 1292 +#define _loop0_118_type 1293 +#define _gather_117_type 1294 +#define _tmp_119_type 1295 +#define _tmp_120_type 1296 +#define _tmp_121_type 1297 +#define _tmp_122_type 1298 +#define _loop1_123_type 1299 +#define _tmp_124_type 1300 +#define _tmp_125_type 1301 +#define _loop0_127_type 1302 +#define _gather_126_type 1303 +#define _loop1_128_type 1304 +#define _loop0_129_type 1305 +#define _loop0_130_type 1306 +#define _tmp_131_type 1307 +#define _tmp_132_type 1308 +#define _loop0_134_type 1309 +#define _gather_133_type 1310 +#define _loop0_136_type 1311 +#define _gather_135_type 1312 +#define _loop0_138_type 1313 +#define _gather_137_type 1314 +#define _loop0_140_type 1315 +#define _gather_139_type 1316 +#define _loop0_141_type 1317 +#define _loop0_143_type 1318 +#define _gather_142_type 1319 +#define _tmp_144_type 1320 +#define _loop0_146_type 1321 +#define _gather_145_type 1322 +#define _loop0_148_type 1323 +#define _gather_147_type 1324 +#define _tmp_149_type 1325 +#define _loop0_150_type 1326 +#define _tmp_151_type 1327 +#define _tmp_152_type 1328 +#define _tmp_153_type 1329 +#define _tmp_154_type 1330 +#define _loop0_155_type 1331 +#define _tmp_156_type 1332 +#define _tmp_157_type 1333 +#define _tmp_158_type 1334 +#define _tmp_159_type 1335 +#define _tmp_160_type 1336 +#define _tmp_161_type 1337 +#define _loop0_163_type 1338 +#define _gather_162_type 1339 +#define _loop0_165_type 1340 +#define _gather_164_type 1341 +#define _loop0_167_type 1342 +#define _gather_166_type 1343 +#define _loop0_169_type 1344 +#define _gather_168_type 1345 +#define _tmp_170_type 1346 +#define _tmp_171_type 1347 +#define _tmp_172_type 1348 +#define _tmp_173_type 1349 +#define _tmp_174_type 1350 +#define _tmp_175_type 1351 +#define _tmp_176_type 1352 +#define _tmp_177_type 1353 +#define _loop1_178_type 1354 +#define _tmp_179_type 1355 +#define _tmp_180_type 1356 +#define _tmp_181_type 1357 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -490,6 +489,7 @@ static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); static void *keyword_pattern_rule(Parser *p); +static void *argument_pattern_rule(Parser *p); static expr_ty error_star_rule(Parser *p); static void *value_pattern_rule(Parser *p); static void *key_value_pattern_rule(Parser *p); @@ -792,8 +792,6 @@ static asdl_seq *_loop1_178_rule(Parser *p); static void *_tmp_179_rule(Parser *p); static void *_tmp_180_rule(Parser *p); static void *_tmp_181_rule(Parser *p); -static void *_tmp_182_rule(Parser *p); -static void *_tmp_183_rule(Parser *p); // file: statements? $ @@ -5629,8 +5627,8 @@ mapping_pattern_rule(Parser *p) // | name_or_attr '(' ','.pattern+ ','? ')' // | name_or_attr '(' ','.keyword_pattern+ ','? ')' // | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')' -// | name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')' +// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')' +// | name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')' static void * class_pattern_rule(Parser *p) { @@ -5833,12 +5831,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); } - { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')' + { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); asdl_seq * _gather_62_var; Token * _literal; Token * _literal_1; @@ -5864,14 +5862,14 @@ class_pattern_rule(Parser *p) && (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.(pattern | keyword_pattern)+] + (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.argument_pattern+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "positional pattern follows keyword pattern" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5882,14 +5880,14 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.(pattern | keyword_pattern)+] ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); } - { // name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')' + { // name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -5905,18 +5903,18 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_65_rule(p), 1) // [','.(pattern | keyword_pattern)+ ','] + (_opt_var = _tmp_65_rule(p), 1) // [','.argument_pattern+ ','] && (error = error_star_rule(p)) // error_star && - (_opt_var_1 = _tmp_66_rule(p), 1) // [',' ','.(pattern | keyword_pattern | error_star)+] + (_opt_var_1 = _tmp_66_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5927,7 +5925,7 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.(pattern | keyword_pattern)+ ','] error_star [',' ','.(pattern | keyword_pattern | error_star)+] ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); } _res = NULL; done: @@ -6204,6 +6202,61 @@ keyword_pattern_rule(Parser *p) return _res; } +// argument_pattern: pattern | keyword_pattern +static void * +argument_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + expr_ty pattern_var; + if ( + (pattern_var = pattern_rule(p)) // pattern + ) + { + D(fprintf(stderr, "%*c+ argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); + } + { // keyword_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + void *keyword_pattern_var; + if ( + (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern + ) + { + D(fprintf(stderr, "%*c+ argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + _res = keyword_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // error_star: ('*' | '**') NAME static expr_ty error_star_rule(Parser *p) @@ -6330,7 +6383,7 @@ value_pattern_rule(Parser *p) } // key_value_pattern: -// | (literal_pattern | constant_pattern) ':' closed_pattern +// | (literal_pattern | constant_pattern) ':' or_pattern // | '**' name_pattern static void * key_value_pattern_rule(Parser *p) @@ -6342,12 +6395,12 @@ key_value_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // (literal_pattern | constant_pattern) ':' closed_pattern + { // (literal_pattern | constant_pattern) ':' or_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); Token * _literal; void *key; void *value; @@ -6356,10 +6409,10 @@ key_value_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && - (value = closed_pattern_rule(p)) // closed_pattern + (value = or_pattern_rule(p)) // or_pattern ) { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); _res = _PyPegen_key_value_pair ( p , key , value ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6370,7 +6423,7 @@ key_value_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' closed_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); } { // '**' name_pattern if (p->error_indicator) { @@ -20713,7 +20766,7 @@ _gather_62_rule(Parser *p) return _res; } -// _tmp_64: ',' ','.(pattern | keyword_pattern)+ +// _tmp_64: ',' ','.argument_pattern+ static void * _tmp_64_rule(Parser *p) { @@ -20724,27 +20777,27 @@ _tmp_64_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.(pattern | keyword_pattern)+ + { // ',' ','.argument_pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); asdl_seq * _gather_164_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_164_var = _gather_164_rule(p)) // ','.(pattern | keyword_pattern)+ + (_gather_164_var = _gather_164_rule(p)) // ','.argument_pattern+ ) { - D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); _res = _PyPegen_dummy_name(p, _literal, _gather_164_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(pattern | keyword_pattern)+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.argument_pattern+")); } _res = NULL; done: @@ -20752,7 +20805,7 @@ _tmp_64_rule(Parser *p) return _res; } -// _tmp_65: ','.(pattern | keyword_pattern)+ ',' +// _tmp_65: ','.argument_pattern+ ',' static void * _tmp_65_rule(Parser *p) { @@ -20763,27 +20816,27 @@ _tmp_65_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ','.(pattern | keyword_pattern)+ ',' + { // ','.argument_pattern+ ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); asdl_seq * _gather_166_var; Token * _literal; if ( - (_gather_166_var = _gather_166_rule(p)) // ','.(pattern | keyword_pattern)+ + (_gather_166_var = _gather_166_rule(p)) // ','.argument_pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); _res = _PyPegen_dummy_name(p, _gather_166_var, _literal); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(pattern | keyword_pattern)+ ','")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.argument_pattern+ ','")); } _res = NULL; done: @@ -20791,7 +20844,7 @@ _tmp_65_rule(Parser *p) return _res; } -// _tmp_66: ',' ','.(pattern | keyword_pattern | error_star)+ +// _tmp_66: ',' ','.(argument_pattern | error_star)+ static void * _tmp_66_rule(Parser *p) { @@ -20802,27 +20855,27 @@ _tmp_66_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.(pattern | keyword_pattern | error_star)+ + { // ',' ','.(argument_pattern | error_star)+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); asdl_seq * _gather_168_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_168_var = _gather_168_rule(p)) // ','.(pattern | keyword_pattern | error_star)+ + (_gather_168_var = _gather_168_rule(p)) // ','.(argument_pattern | error_star)+ ) { - D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); + D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); _res = _PyPegen_dummy_name(p, _literal, _gather_168_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(pattern | keyword_pattern | error_star)+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); } _res = NULL; done: @@ -26711,7 +26764,7 @@ _gather_162_rule(Parser *p) return _res; } -// _loop0_165: ',' (pattern | keyword_pattern) +// _loop0_165: ',' argument_pattern static asdl_seq * _loop0_165_rule(Parser *p) { @@ -26732,18 +26785,18 @@ _loop0_165_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (pattern | keyword_pattern) + { // ',' argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern)")); + D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_181_rule(p)) // pattern | keyword_pattern + (elem = argument_pattern_rule(p)) // argument_pattern ) { _res = elem; @@ -26769,7 +26822,7 @@ _loop0_165_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -26786,7 +26839,7 @@ _loop0_165_rule(Parser *p) return _seq; } -// _gather_164: (pattern | keyword_pattern) _loop0_165 +// _gather_164: argument_pattern _loop0_165 static asdl_seq * _gather_164_rule(Parser *p) { @@ -26797,27 +26850,27 @@ _gather_164_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (pattern | keyword_pattern) _loop0_165 + { // argument_pattern _loop0_165 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); + D(fprintf(stderr, "%*c> _gather_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_165")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_181_rule(p)) // pattern | keyword_pattern + (elem = argument_pattern_rule(p)) // argument_pattern && (seq = _loop0_165_rule(p)) // _loop0_165 ) { - D(fprintf(stderr, "%*c+ _gather_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); + D(fprintf(stderr, "%*c+ _gather_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_165")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_164[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern) _loop0_165")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_165")); } _res = NULL; done: @@ -26825,7 +26878,7 @@ _gather_164_rule(Parser *p) return _res; } -// _loop0_167: ',' (pattern | keyword_pattern) +// _loop0_167: ',' argument_pattern static asdl_seq * _loop0_167_rule(Parser *p) { @@ -26846,18 +26899,18 @@ _loop0_167_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (pattern | keyword_pattern) + { // ',' argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern)")); + D(fprintf(stderr, "%*c> _loop0_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_182_rule(p)) // pattern | keyword_pattern + (elem = argument_pattern_rule(p)) // argument_pattern ) { _res = elem; @@ -26883,7 +26936,7 @@ _loop0_167_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_167[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -26900,7 +26953,7 @@ _loop0_167_rule(Parser *p) return _seq; } -// _gather_166: (pattern | keyword_pattern) _loop0_167 +// _gather_166: argument_pattern _loop0_167 static asdl_seq * _gather_166_rule(Parser *p) { @@ -26911,27 +26964,27 @@ _gather_166_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (pattern | keyword_pattern) _loop0_167 + { // argument_pattern _loop0_167 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); + D(fprintf(stderr, "%*c> _gather_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_167")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_182_rule(p)) // pattern | keyword_pattern + (elem = argument_pattern_rule(p)) // argument_pattern && (seq = _loop0_167_rule(p)) // _loop0_167 ) { - D(fprintf(stderr, "%*c+ _gather_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); + D(fprintf(stderr, "%*c+ _gather_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_167")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_166[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern) _loop0_167")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_167")); } _res = NULL; done: @@ -26939,7 +26992,7 @@ _gather_166_rule(Parser *p) return _res; } -// _loop0_169: ',' (pattern | keyword_pattern | error_star) +// _loop0_169: ',' (argument_pattern | error_star) static asdl_seq * _loop0_169_rule(Parser *p) { @@ -26960,18 +27013,18 @@ _loop0_169_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (pattern | keyword_pattern | error_star) + { // ',' (argument_pattern | error_star) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (pattern | keyword_pattern | error_star)")); + D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_183_rule(p)) // pattern | keyword_pattern | error_star + (elem = _tmp_181_rule(p)) // argument_pattern | error_star ) { _res = elem; @@ -26997,7 +27050,7 @@ _loop0_169_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_169[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (pattern | keyword_pattern | error_star)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (argument_pattern | error_star)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -27014,7 +27067,7 @@ _loop0_169_rule(Parser *p) return _seq; } -// _gather_168: (pattern | keyword_pattern | error_star) _loop0_169 +// _gather_168: (argument_pattern | error_star) _loop0_169 static asdl_seq * _gather_168_rule(Parser *p) { @@ -27025,27 +27078,27 @@ _gather_168_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (pattern | keyword_pattern | error_star) _loop0_169 + { // (argument_pattern | error_star) _loop0_169 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_183_rule(p)) // pattern | keyword_pattern | error_star + (elem = _tmp_181_rule(p)) // argument_pattern | error_star && (seq = _loop0_169_rule(p)) // _loop0_169 ) { - D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_168[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pattern | keyword_pattern | error_star) _loop0_169")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); } _res = NULL; done: @@ -27589,7 +27642,7 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: pattern | keyword_pattern +// _tmp_181: argument_pattern | error_star static void * _tmp_181_rule(Parser *p) { @@ -27600,171 +27653,42 @@ _tmp_181_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // pattern + { // argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - expr_ty pattern_var; + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + void *argument_pattern_var; if ( - (pattern_var = pattern_rule(p)) // pattern + (argument_pattern_var = argument_pattern_rule(p)) // argument_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); - _res = pattern_var; + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + _res = argument_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); - } - { // keyword_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - void *keyword_pattern_var; - if ( - (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - _res = keyword_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_182: pattern | keyword_pattern -static void * -_tmp_182_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - expr_ty pattern_var; - if ( - (pattern_var = pattern_rule(p)) // pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); - _res = pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); - } - { // keyword_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - void *keyword_pattern_var; - if ( - (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - _res = keyword_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_183: pattern | keyword_pattern | error_star -static void * -_tmp_183_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - expr_ty pattern_var; - if ( - (pattern_var = pattern_rule(p)) // pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); - _res = pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); - } - { // keyword_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - void *keyword_pattern_var; - if ( - (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - _res = keyword_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern")); } { // error_star if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); expr_ty error_star_var; if ( (error_star_var = error_star_rule(p)) // error_star ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); _res = error_star_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); } _res = NULL; diff --git a/Python/compile.c b/Python/compile.c index 62debc301b894d..3c405f4c18e5f5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2777,7 +2777,7 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok) { assert(p->v.Name.ctx == Store); if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { if (!anon_ok) { - return compiler_error(c, "can't assign to '_' here; consider removing?"); + return compiler_error(c, "can't assign to '_' here; consider removing or renaming?"); } ADDOP(c, POP_TOP); return 1; From ac87fcb2dd0d6b91f41360d47f9817d2056e0129 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 22:58:20 -0700 Subject: [PATCH 051/218] Allow literal negative numbers --- Grammar/python.gram | 6 ++-- Lib/test/test_patma.py | 65 ++++++++++++++++++++++++++++++++++++++++++ Parser/pegen/parse.c | 44 +++++++++++++++++++++++++--- Python/ast.c | 2 ++ Python/ast_opt.c | 36 +++++++++++++++++++++-- 5 files changed, 145 insertions(+), 8 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index be11bf2900cffc..077270ffa47c98 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -222,10 +222,12 @@ closed_pattern: | class_pattern name_pattern: - | a=NAME !('.' | '(' | '=') { - _PyPegen_set_expr_context(p, a, Store) } + | name=NAME !('.' | '(' | '=') { + _PyPegen_set_expr_context(p, name, Store) } literal_pattern: | NUMBER + | '-' number=NUMBER { + _Py_UnaryOp(USub, number, EXTRA) } | strings | 'None' { _Py_Constant(Py_None, NULL, EXTRA) } diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index ec651f755ec57a..ba09678f1f58be 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1428,6 +1428,71 @@ def test_patma_094(self) -> None: self.assertEqual(x, 3) self.assertEqual(y, None) + def test_patma_095(self) -> None: + x = 0 + match x: + case -0: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_096(self) -> None: + x = 0 + match x: + case -0.0: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_097(self) -> None: + x = 0 + match x: + case -0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_098(self) -> None: + x = 0 + match x: + case -0.0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_099(self) -> None: + x = -1 + match x: + case -1: + y = 0 + self.assertEqual(x, -1) + self.assertEqual(y, 0) + + def test_patma_100(self) -> None: + x = -1.5 + match x: + case -1.5: + y = 0 + self.assertEqual(x, -1.5) + self.assertEqual(y, 0) + + def test_patma_101(self) -> None: + x = -1j + match x: + case -1j: + y = 0 + self.assertEqual(x, -1j) + self.assertEqual(y, 0) + + def test_patma_102(self) -> None: + x = -1.5j + match x: + case -1.5j: + y = 0 + self.assertEqual(x, -1.5j) + self.assertEqual(y, 0) + + if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 6bccd0013c99df..45397c3ab68004 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -5162,15 +5162,15 @@ name_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> name_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); - expr_ty a; + expr_ty name; if ( - (a = _PyPegen_name_token(p)) // NAME + (name = _PyPegen_name_token(p)) // NAME && _PyPegen_lookahead(0, _tmp_52_rule, p) ) { D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); - _res = _PyPegen_set_expr_context ( p , a , Store ); + _res = _PyPegen_set_expr_context ( p , name , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5188,7 +5188,7 @@ name_pattern_rule(Parser *p) return _res; } -// literal_pattern: NUMBER | strings | 'None' | 'True' | 'False' +// literal_pattern: NUMBER | '-' NUMBER | strings | 'None' | 'True' | 'False' static void * literal_pattern_rule(Parser *p) { @@ -5227,6 +5227,42 @@ literal_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); } + { // '-' NUMBER + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token * _literal; + expr_ty number; + if ( + (_literal = _PyPegen_expect_token(p, 15)) // token='-' + && + (number = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_UnaryOp ( USub , number , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); + } { // strings if (p->error_indicator) { D(p->level--); diff --git a/Python/ast.c b/Python/ast.c index d498acb9eae74e..f91ea0019ebca8 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -386,6 +386,8 @@ validate_pattern(expr_ty p) case NamedExpr_kind: return (validate_pattern(p->v.NamedExpr.value) && validate_expr(p->v.NamedExpr.target, Store)); + case UnaryOp_kind: + return 1; default: PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); return 0; diff --git a/Python/ast_opt.c b/Python/ast_opt.c index d44d9fa641c928..52d3372db8e068 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -716,6 +716,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) CALL(astfold_expr, expr_ty, node_->v.Match.target); CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); // TODO: Mark unreachable cases for removal? Maybe pattern == NULL? + // TODO: We can even optimize patterns across cases... break; default: break; @@ -745,12 +746,43 @@ astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) return 1; } +static int +astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) +{ + // Don't blindly optimize the pattern as an expr; it plays by its own rules! + // TODO: Build out this pattern optimizer. + switch (node_->kind) { + case Attribute_kind: + case Constant_kind: + case BoolOp_kind: + // TODO: Quite a bit of potential here. + case Dict_kind: + case List_kind: + case Name_kind: + case NamedExpr_kind: + return 1; + case UnaryOp_kind: + assert(node_->kind == UnaryOp_kind); + assert(node_->v.UnaryOp.op == USub); + assert(node_->v.UnaryOp.operand->kind == Constant_kind); + PyObject *value = node_->v.UnaryOp.operand->v.Constant.value; + assert(PyComplex_CheckExact(value) || PyFloat_CheckExact(value) || PyLong_CheckExact(value)); + PyObject *negated = PyNumber_Negative(value); + if (!negated) { + return 0; + } + return make_const(node_, negated, ctx_); + default: + Py_UNREACHABLE(); + } + return 1; +} + static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { + CALL_OPT(astfold_pattern, expr_ty, node_->pattern); CALL_OPT(astfold_expr, expr_ty, node_->guard); - // TODO: Create pattern optimizer. - // Don't blindly optimize the pattern as an expr; it plays by its own rules! CALL_SEQ(astfold_stmt, stmt_ty, node_->body); return 1; } From e3d07aba6937318cdf3694a361e556625311950c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 22:58:41 -0700 Subject: [PATCH 052/218] Add checks for name bindings --- Lib/test/test_patma.py | 4 +- Python/ast.c | 18 +++++++++ Python/compile.c | 89 ++++++++++++++++++++++++++++++------------ 3 files changed, 85 insertions(+), 26 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index ba09678f1f58be..e4789bf711f0dd 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -313,7 +313,7 @@ def test_patma_ast_37(self) -> None: def test_patma_ast_38(self) -> None: match_cases = [ MatchCase("[w := 0,]", "y = 0"), - MatchCase("[] or [1, z := (0 or 1)] or []", "y = 1"), + MatchCase("[z := 0] or [1, z := (0 or 1)] or [z := 0]", "y = 1"), ] namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") self.assertNotIn("w", namespace) @@ -994,7 +994,7 @@ def test_patma_051(self) -> None: match x: case [(w := 0)]: y = 0 - case [] | [1, (z := 0 | 1)] | []: + case [z] | [1, (z := 0 | 1)] | [z]: y = 1 self.assertEqual(w, None) self.assertEqual(x, [1, 0]) diff --git a/Python/ast.c b/Python/ast.c index f91ea0019ebca8..08903d60eb010c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -358,6 +358,17 @@ validate_pattern(expr_ty p) } return validate_expr(key, Load); } + else { + if (i != size - 1) { + // TODO + } + if (key->kind != Name_kind) { + // TODO + } + if (key->v.Name.ctx != Store) { + // TODO + } + } if (!validate_pattern(asdl_seq_GET(values, i))) { return 0; } @@ -370,6 +381,12 @@ validate_pattern(expr_ty p) value = asdl_seq_GET(values, i); if (value->kind == Starred_kind) { value = value->v.Starred.value; + if (value->kind != Name_kind) { + // TODO + } + if (value->v.Name.ctx != Store) { + // TODO + } } if (!validate_pattern(value)) { return 0; @@ -387,6 +404,7 @@ validate_pattern(expr_ty p) return (validate_pattern(p->v.NamedExpr.value) && validate_expr(p->v.NamedExpr.target, Store)); case UnaryOp_kind: + // TODO return 1; default: PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); diff --git a/Python/compile.c b/Python/compile.c index 3c405f4c18e5f5..3aeb317e0db16d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -222,7 +222,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_pattern(struct compiler *, expr_ty, basicblock *); +static int compiler_pattern(struct compiler *, expr_ty, basicblock *, PyObject *); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -2772,7 +2772,7 @@ compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok) { +compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok, PyObject* names) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { @@ -2782,31 +2782,35 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok) { ADDOP(c, POP_TOP); return 1; } + if (PySet_Contains(names, p->v.Name.id)) { + // TODO: Format this error message with the name. + return compiler_error(c, "multiple assignments to name in pattern"); + } VISIT(c, expr, p); - return 1; + return !PySet_Add(names, p->v.Name.id); } static int -compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Load || p->v.Name.ctx == Store); if (p->v.Name.ctx == Load) { return compiler_pattern_load(c, p, fail); } - return compiler_pattern_store(c, p, 1); + return compiler_pattern_store(c, p, 1, names); } static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { assert(p->kind == NamedExpr_kind); basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, block)); - CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, 0)); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, block, names)); + CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, 0, names)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); @@ -2816,7 +2820,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { basicblock *block, *end; CHECK(block = compiler_new_block(c)); @@ -2837,13 +2841,13 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) assert(key->kind != Name_kind || key->v.Name.ctx == Load); VISIT(c, expr, key); ADDOP_JREL(c, MATCH_KEY, block); - CHECK(compiler_pattern(c, value, block)); + CHECK(compiler_pattern(c, value, block, names)); } if (!star) { ADDOP(c, POP_TOP); } else { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0)); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0, names)); } ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); @@ -2854,21 +2858,52 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { assert(p->kind == BoolOp_kind); - assert(p->v.BoolOp.op== Or); + assert(p->v.BoolOp.op == Or); basicblock *block, *end; + PyObject *control = NULL; CHECK(end = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); + assert(size > 1); for (Py_ssize_t i = 0; i < size; i++) { + PyObject *names_copy = PySet_New(names); + if (!names_copy) { + return 0; + } CHECK(block = compiler_new_block(c)); ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), block)); + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), block, names_copy)); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); + if (!i) { + control = names_copy; + } + else if (PySet_GET_SIZE(control) || PySet_GET_SIZE(names_copy)) { + PyObject *diff = PyNumber_InPlaceXor(names_copy, control); + if (!diff) { + Py_DECREF(control); + return 0; + } + Py_DECREF(names_copy); + if (PySet_GET_SIZE(diff)) { + // TODO: Format this error message with a name. + // PyObject *extra = PySet_Pop(diff); + Py_DECREF(control); + PyObject_Print(PySet_Pop(diff), stderr, Py_PRINT_RAW); + Py_DECREF(diff); + return compiler_error(c, "pattern binds different names based on target"); + } + Py_DECREF(diff); + } + else { + Py_DECREF(names_copy); + } } + assert(control); + Py_DECREF(control); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, fail); compiler_use_next_block(c, end); @@ -2876,7 +2911,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { assert(p->kind == List_kind); asdl_seq *values = p->v.List.elts; @@ -2906,7 +2941,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) assert(value->kind == Starred_kind); Py_ssize_t remaining = size - i - 1; ADDOP_I(c, UNPACK_EX, remaining << 8); - CHECK(compiler_pattern_store(c, value->v.Starred.value, 1)); + CHECK(compiler_pattern_store(c, value->v.Starred.value, 1, names)); if (remaining) { ADDOP_I(c, BUILD_TUPLE, remaining); if (remaining > 1) { @@ -2923,7 +2958,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) } else { ADDOP_JREL(c, FOR_ITER, fail); - CHECK(compiler_pattern(c, value, block)); + CHECK(compiler_pattern(c, value, block, names)); } } ADDOP_JREL(c, FOR_ITER, end); @@ -2936,22 +2971,22 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail) } static int -compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { switch (p->kind) { case Attribute_kind: case Constant_kind: return compiler_pattern_load(c, p, fail); case BoolOp_kind: - return compiler_pattern_or(c, p, fail); + return compiler_pattern_or(c, p, fail, names); case Dict_kind: - return compiler_pattern_mapping(c, p, fail); + return compiler_pattern_mapping(c, p, fail, names); case List_kind: - return compiler_pattern_sequence(c, p, fail); + return compiler_pattern_sequence(c, p, fail, names); case Name_kind: - return compiler_pattern_name(c, p, fail); + return compiler_pattern_name(c, p, fail, names); case NamedExpr_kind: - return compiler_pattern_namedexpr(c, p, fail); + return compiler_pattern_namedexpr(c, p, fail, names); default: Py_UNREACHABLE(); } @@ -2968,7 +3003,13 @@ compiler_match(struct compiler *c, stmt_ty s) match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); CHECK(next = compiler_new_block(c)); ADDOP(c, DUP_TOP); - compiler_pattern(c, m->pattern, next); + PyObject* names = PySet_New(NULL); + if (!names) { + return 0; + } + int result = compiler_pattern(c, m->pattern, next, names); + Py_DECREF(names); + CHECK(result); if (m->guard) { CHECK(compiler_jump_if(c, m->guard, next, 0)); } From 9da2729b67a7665b9618c6dda0cf208354df1db6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 1 Jun 2020 23:05:14 -0700 Subject: [PATCH 053/218] Cleanup --- Python/ast.c | 21 --------------------- Python/compile.c | 1 - 2 files changed, 22 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 08903d60eb010c..8cdee5bf672f76 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -358,17 +358,6 @@ validate_pattern(expr_ty p) } return validate_expr(key, Load); } - else { - if (i != size - 1) { - // TODO - } - if (key->kind != Name_kind) { - // TODO - } - if (key->v.Name.ctx != Store) { - // TODO - } - } if (!validate_pattern(asdl_seq_GET(values, i))) { return 0; } @@ -379,15 +368,6 @@ validate_pattern(expr_ty p) size = asdl_seq_LEN(values); for (i = 0; i < size; i++) { value = asdl_seq_GET(values, i); - if (value->kind == Starred_kind) { - value = value->v.Starred.value; - if (value->kind != Name_kind) { - // TODO - } - if (value->v.Name.ctx != Store) { - // TODO - } - } if (!validate_pattern(value)) { return 0; } @@ -404,7 +384,6 @@ validate_pattern(expr_ty p) return (validate_pattern(p->v.NamedExpr.value) && validate_expr(p->v.NamedExpr.target, Store)); case UnaryOp_kind: - // TODO return 1; default: PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); diff --git a/Python/compile.c b/Python/compile.c index 3aeb317e0db16d..b541ae59d540a2 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2892,7 +2892,6 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* n // TODO: Format this error message with a name. // PyObject *extra = PySet_Pop(diff); Py_DECREF(control); - PyObject_Print(PySet_Pop(diff), stderr, Py_PRINT_RAW); Py_DECREF(diff); return compiler_error(c, "pattern binds different names based on target"); } From 546b6c484f0d9df279da3a36fb473bd53e7b99a6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 2 Jun 2020 07:53:18 -0700 Subject: [PATCH 054/218] Add support for complex literals --- Grammar/python.gram | 12 +- Lib/test/test_patma.py | 63 + Parser/pegen/parse.c | 2893 +++++++++++++++++++++------------------- Python/ast_opt.c | 57 +- 4 files changed, 1661 insertions(+), 1364 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 077270ffa47c98..02ba1f15b44899 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -225,9 +225,11 @@ name_pattern: | name=NAME !('.' | '(' | '=') { _PyPegen_set_expr_context(p, name, Store) } literal_pattern: - | NUMBER - | '-' number=NUMBER { - _Py_UnaryOp(USub, number, EXTRA) } + | signed_number !('+' | '-') + | real=signed_number '+' imag=NUMBER { + _Py_BinOp(real, Add, imag, EXTRA) } + | real=signed_number '-' imag=NUMBER { + _Py_BinOp(real, Sub, imag, EXTRA) } | strings | 'None' { _Py_Constant(Py_None, NULL, EXTRA) } @@ -263,6 +265,10 @@ class_pattern: | func=name_or_attr '(' [','.argument_pattern+ ','] error=error_star [',' ','.(argument_pattern | error_star)+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } +signed_number: + | NUMBER + | '-' number=NUMBER { + _Py_UnaryOp(USub, number, EXTRA) } name_or_attr: | NAME | value=name_or_attr '.' attr=NAME { diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index e4789bf711f0dd..41980f475688a1 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1492,6 +1492,69 @@ def test_patma_102(self) -> None: self.assertEqual(x, -1.5j) self.assertEqual(y, 0) + def test_patma_103(self) -> None: + x = 0 + match x: + case 0 + 0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_104(self) -> None: + x = 0 + match x: + case 0 - 0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_105(self) -> None: + x = 0 + match x: + case -0 + 0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_106(self) -> None: + x = 0 + match x: + case -0 - 0j: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_107(self) -> None: + x = 0.25 + 1.75j + match x: + case 0.25 + 1.75j: + y = 0 + self.assertEqual(x, 0.25 + 1.75j) + self.assertEqual(y, 0) + + def test_patma_108(self) -> None: + x = 0.25 - 1.75j + match x: + case 0.25 - 1.75j: + y = 0 + self.assertEqual(x, 0.25 - 1.75j) + self.assertEqual(y, 0) + + def test_patma_109(self) -> None: + x = -0.25 + 1.75j + match x: + case -0.25 + 1.75j: + y = 0 + self.assertEqual(x, -0.25 + 1.75j) + self.assertEqual(y, 0) + + def test_patma_110(self) -> None: + x = -0.25 - 1.75j + match x: + case -0.25 - 1.75j: + y = 0 + self.assertEqual(x, -0.25 - 1.75j) + self.assertEqual(y, 0) if __name__ == "__main__": # XXX: For quick test debugging... diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 45397c3ab68004..25632984bbf7b8 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -126,313 +126,315 @@ static KeywordToken *reserved_keywords[] = { #define sequence_pattern_type 1048 #define mapping_pattern_type 1049 #define class_pattern_type 1050 -#define name_or_attr_type 1051 // Left-recursive -#define values_pattern_type 1052 -#define items_pattern_type 1053 -#define keyword_pattern_type 1054 -#define argument_pattern_type 1055 -#define error_star_type 1056 -#define value_pattern_type 1057 -#define key_value_pattern_type 1058 -#define return_stmt_type 1059 -#define raise_stmt_type 1060 -#define function_def_type 1061 -#define function_def_raw_type 1062 -#define func_type_comment_type 1063 -#define params_type 1064 -#define parameters_type 1065 -#define slash_no_default_type 1066 -#define slash_with_default_type 1067 -#define star_etc_type 1068 -#define kwds_type 1069 -#define param_no_default_type 1070 -#define param_with_default_type 1071 -#define param_maybe_default_type 1072 -#define param_type 1073 -#define annotation_type 1074 -#define default_type 1075 -#define decorators_type 1076 -#define class_def_type 1077 -#define class_def_raw_type 1078 -#define block_type 1079 -#define expressions_list_type 1080 -#define star_expressions_type 1081 -#define star_expression_type 1082 -#define star_named_expressions_type 1083 -#define star_named_expression_type 1084 -#define named_expression_type 1085 -#define annotated_rhs_type 1086 -#define expressions_type 1087 -#define expression_type 1088 -#define lambdef_type 1089 -#define lambda_parameters_type 1090 -#define lambda_slash_no_default_type 1091 -#define lambda_slash_with_default_type 1092 -#define lambda_star_etc_type 1093 -#define lambda_kwds_type 1094 -#define lambda_param_no_default_type 1095 -#define lambda_param_with_default_type 1096 -#define lambda_param_maybe_default_type 1097 -#define lambda_param_type 1098 -#define disjunction_type 1099 -#define conjunction_type 1100 -#define inversion_type 1101 -#define comparison_type 1102 -#define compare_op_bitwise_or_pair_type 1103 -#define eq_bitwise_or_type 1104 -#define noteq_bitwise_or_type 1105 -#define lte_bitwise_or_type 1106 -#define lt_bitwise_or_type 1107 -#define gte_bitwise_or_type 1108 -#define gt_bitwise_or_type 1109 -#define notin_bitwise_or_type 1110 -#define in_bitwise_or_type 1111 -#define isnot_bitwise_or_type 1112 -#define is_bitwise_or_type 1113 -#define bitwise_or_type 1114 // Left-recursive -#define bitwise_xor_type 1115 // Left-recursive -#define bitwise_and_type 1116 // Left-recursive -#define shift_expr_type 1117 // Left-recursive -#define sum_type 1118 // Left-recursive -#define term_type 1119 // Left-recursive -#define factor_type 1120 -#define power_type 1121 -#define await_primary_type 1122 -#define primary_type 1123 // Left-recursive -#define slices_type 1124 -#define slice_type 1125 -#define atom_type 1126 -#define strings_type 1127 -#define list_type 1128 -#define listcomp_type 1129 -#define tuple_type 1130 -#define group_type 1131 -#define genexp_type 1132 -#define set_type 1133 -#define setcomp_type 1134 -#define dict_type 1135 -#define dictcomp_type 1136 -#define double_starred_kvpairs_type 1137 -#define double_starred_kvpair_type 1138 -#define kvpair_type 1139 -#define for_if_clauses_type 1140 -#define for_if_clause_type 1141 -#define yield_expr_type 1142 -#define arguments_type 1143 -#define args_type 1144 -#define kwargs_type 1145 -#define starred_expression_type 1146 -#define kwarg_or_starred_type 1147 -#define kwarg_or_double_starred_type 1148 -#define star_targets_type 1149 -#define star_targets_seq_type 1150 -#define star_target_type 1151 -#define star_atom_type 1152 -#define single_target_type 1153 -#define single_subscript_attribute_target_type 1154 -#define del_targets_type 1155 -#define del_target_type 1156 -#define del_t_atom_type 1157 -#define del_target_end_type 1158 -#define targets_type 1159 -#define target_type 1160 -#define t_primary_type 1161 // Left-recursive -#define t_lookahead_type 1162 -#define t_atom_type 1163 -#define incorrect_arguments_type 1164 -#define invalid_kwarg_type 1165 -#define invalid_named_expression_type 1166 -#define invalid_assignment_type 1167 -#define invalid_block_type 1168 -#define invalid_comprehension_type 1169 -#define invalid_dict_comprehension_type 1170 -#define invalid_parameters_type 1171 -#define invalid_star_etc_type 1172 -#define invalid_lambda_star_etc_type 1173 -#define invalid_double_type_comments_type 1174 -#define invalid_del_target_type 1175 -#define invalid_import_from_targets_type 1176 -#define _loop0_1_type 1177 -#define _loop0_2_type 1178 -#define _loop0_4_type 1179 -#define _gather_3_type 1180 -#define _loop0_6_type 1181 -#define _gather_5_type 1182 -#define _loop0_8_type 1183 -#define _gather_7_type 1184 -#define _loop0_10_type 1185 -#define _gather_9_type 1186 -#define _loop1_11_type 1187 -#define _loop0_13_type 1188 -#define _gather_12_type 1189 -#define _tmp_14_type 1190 -#define _tmp_15_type 1191 -#define _tmp_16_type 1192 -#define _tmp_17_type 1193 -#define _tmp_18_type 1194 -#define _tmp_19_type 1195 -#define _tmp_20_type 1196 -#define _tmp_21_type 1197 -#define _loop1_22_type 1198 -#define _tmp_23_type 1199 -#define _tmp_24_type 1200 -#define _loop0_26_type 1201 -#define _gather_25_type 1202 -#define _loop0_28_type 1203 -#define _gather_27_type 1204 -#define _tmp_29_type 1205 -#define _loop0_30_type 1206 -#define _loop1_31_type 1207 -#define _loop0_33_type 1208 -#define _gather_32_type 1209 -#define _tmp_34_type 1210 -#define _loop0_36_type 1211 -#define _gather_35_type 1212 -#define _tmp_37_type 1213 -#define _loop0_39_type 1214 -#define _gather_38_type 1215 -#define _loop0_41_type 1216 -#define _gather_40_type 1217 -#define _loop0_43_type 1218 -#define _gather_42_type 1219 -#define _loop0_45_type 1220 -#define _gather_44_type 1221 -#define _tmp_46_type 1222 -#define _loop1_47_type 1223 -#define _tmp_48_type 1224 -#define _loop1_49_type 1225 -#define _loop0_51_type 1226 -#define _gather_50_type 1227 -#define _tmp_52_type 1228 -#define _loop0_54_type 1229 -#define _gather_53_type 1230 -#define _loop0_56_type 1231 -#define _gather_55_type 1232 -#define _loop0_58_type 1233 -#define _gather_57_type 1234 -#define _loop0_60_type 1235 -#define _gather_59_type 1236 -#define _tmp_61_type 1237 -#define _loop0_63_type 1238 -#define _gather_62_type 1239 -#define _tmp_64_type 1240 -#define _tmp_65_type 1241 -#define _tmp_66_type 1242 -#define _loop0_68_type 1243 -#define _gather_67_type 1244 -#define _loop0_70_type 1245 -#define _gather_69_type 1246 -#define _tmp_71_type 1247 -#define _tmp_72_type 1248 -#define _tmp_73_type 1249 -#define _tmp_74_type 1250 -#define _tmp_75_type 1251 -#define _tmp_76_type 1252 -#define _loop0_77_type 1253 -#define _loop0_78_type 1254 -#define _loop0_79_type 1255 -#define _loop1_80_type 1256 -#define _loop0_81_type 1257 -#define _loop1_82_type 1258 -#define _loop1_83_type 1259 -#define _loop1_84_type 1260 -#define _loop0_85_type 1261 -#define _loop1_86_type 1262 -#define _loop0_87_type 1263 -#define _loop1_88_type 1264 -#define _loop0_89_type 1265 -#define _loop1_90_type 1266 -#define _loop1_91_type 1267 -#define _tmp_92_type 1268 -#define _loop0_94_type 1269 -#define _gather_93_type 1270 -#define _loop1_95_type 1271 -#define _loop0_97_type 1272 -#define _gather_96_type 1273 -#define _loop1_98_type 1274 -#define _loop0_99_type 1275 -#define _loop0_100_type 1276 -#define _loop0_101_type 1277 -#define _loop1_102_type 1278 -#define _loop0_103_type 1279 -#define _loop1_104_type 1280 -#define _loop1_105_type 1281 -#define _loop1_106_type 1282 -#define _loop0_107_type 1283 -#define _loop1_108_type 1284 -#define _loop0_109_type 1285 -#define _loop1_110_type 1286 -#define _loop0_111_type 1287 -#define _loop1_112_type 1288 -#define _loop1_113_type 1289 -#define _loop1_114_type 1290 -#define _loop1_115_type 1291 -#define _tmp_116_type 1292 -#define _loop0_118_type 1293 -#define _gather_117_type 1294 -#define _tmp_119_type 1295 -#define _tmp_120_type 1296 -#define _tmp_121_type 1297 -#define _tmp_122_type 1298 -#define _loop1_123_type 1299 -#define _tmp_124_type 1300 -#define _tmp_125_type 1301 -#define _loop0_127_type 1302 -#define _gather_126_type 1303 -#define _loop1_128_type 1304 -#define _loop0_129_type 1305 -#define _loop0_130_type 1306 -#define _tmp_131_type 1307 -#define _tmp_132_type 1308 -#define _loop0_134_type 1309 -#define _gather_133_type 1310 -#define _loop0_136_type 1311 -#define _gather_135_type 1312 -#define _loop0_138_type 1313 -#define _gather_137_type 1314 -#define _loop0_140_type 1315 -#define _gather_139_type 1316 +#define signed_number_type 1051 +#define name_or_attr_type 1052 // Left-recursive +#define values_pattern_type 1053 +#define items_pattern_type 1054 +#define keyword_pattern_type 1055 +#define argument_pattern_type 1056 +#define error_star_type 1057 +#define value_pattern_type 1058 +#define key_value_pattern_type 1059 +#define return_stmt_type 1060 +#define raise_stmt_type 1061 +#define function_def_type 1062 +#define function_def_raw_type 1063 +#define func_type_comment_type 1064 +#define params_type 1065 +#define parameters_type 1066 +#define slash_no_default_type 1067 +#define slash_with_default_type 1068 +#define star_etc_type 1069 +#define kwds_type 1070 +#define param_no_default_type 1071 +#define param_with_default_type 1072 +#define param_maybe_default_type 1073 +#define param_type 1074 +#define annotation_type 1075 +#define default_type 1076 +#define decorators_type 1077 +#define class_def_type 1078 +#define class_def_raw_type 1079 +#define block_type 1080 +#define expressions_list_type 1081 +#define star_expressions_type 1082 +#define star_expression_type 1083 +#define star_named_expressions_type 1084 +#define star_named_expression_type 1085 +#define named_expression_type 1086 +#define annotated_rhs_type 1087 +#define expressions_type 1088 +#define expression_type 1089 +#define lambdef_type 1090 +#define lambda_parameters_type 1091 +#define lambda_slash_no_default_type 1092 +#define lambda_slash_with_default_type 1093 +#define lambda_star_etc_type 1094 +#define lambda_kwds_type 1095 +#define lambda_param_no_default_type 1096 +#define lambda_param_with_default_type 1097 +#define lambda_param_maybe_default_type 1098 +#define lambda_param_type 1099 +#define disjunction_type 1100 +#define conjunction_type 1101 +#define inversion_type 1102 +#define comparison_type 1103 +#define compare_op_bitwise_or_pair_type 1104 +#define eq_bitwise_or_type 1105 +#define noteq_bitwise_or_type 1106 +#define lte_bitwise_or_type 1107 +#define lt_bitwise_or_type 1108 +#define gte_bitwise_or_type 1109 +#define gt_bitwise_or_type 1110 +#define notin_bitwise_or_type 1111 +#define in_bitwise_or_type 1112 +#define isnot_bitwise_or_type 1113 +#define is_bitwise_or_type 1114 +#define bitwise_or_type 1115 // Left-recursive +#define bitwise_xor_type 1116 // Left-recursive +#define bitwise_and_type 1117 // Left-recursive +#define shift_expr_type 1118 // Left-recursive +#define sum_type 1119 // Left-recursive +#define term_type 1120 // Left-recursive +#define factor_type 1121 +#define power_type 1122 +#define await_primary_type 1123 +#define primary_type 1124 // Left-recursive +#define slices_type 1125 +#define slice_type 1126 +#define atom_type 1127 +#define strings_type 1128 +#define list_type 1129 +#define listcomp_type 1130 +#define tuple_type 1131 +#define group_type 1132 +#define genexp_type 1133 +#define set_type 1134 +#define setcomp_type 1135 +#define dict_type 1136 +#define dictcomp_type 1137 +#define double_starred_kvpairs_type 1138 +#define double_starred_kvpair_type 1139 +#define kvpair_type 1140 +#define for_if_clauses_type 1141 +#define for_if_clause_type 1142 +#define yield_expr_type 1143 +#define arguments_type 1144 +#define args_type 1145 +#define kwargs_type 1146 +#define starred_expression_type 1147 +#define kwarg_or_starred_type 1148 +#define kwarg_or_double_starred_type 1149 +#define star_targets_type 1150 +#define star_targets_seq_type 1151 +#define star_target_type 1152 +#define star_atom_type 1153 +#define single_target_type 1154 +#define single_subscript_attribute_target_type 1155 +#define del_targets_type 1156 +#define del_target_type 1157 +#define del_t_atom_type 1158 +#define del_target_end_type 1159 +#define targets_type 1160 +#define target_type 1161 +#define t_primary_type 1162 // Left-recursive +#define t_lookahead_type 1163 +#define t_atom_type 1164 +#define incorrect_arguments_type 1165 +#define invalid_kwarg_type 1166 +#define invalid_named_expression_type 1167 +#define invalid_assignment_type 1168 +#define invalid_block_type 1169 +#define invalid_comprehension_type 1170 +#define invalid_dict_comprehension_type 1171 +#define invalid_parameters_type 1172 +#define invalid_star_etc_type 1173 +#define invalid_lambda_star_etc_type 1174 +#define invalid_double_type_comments_type 1175 +#define invalid_del_target_type 1176 +#define invalid_import_from_targets_type 1177 +#define _loop0_1_type 1178 +#define _loop0_2_type 1179 +#define _loop0_4_type 1180 +#define _gather_3_type 1181 +#define _loop0_6_type 1182 +#define _gather_5_type 1183 +#define _loop0_8_type 1184 +#define _gather_7_type 1185 +#define _loop0_10_type 1186 +#define _gather_9_type 1187 +#define _loop1_11_type 1188 +#define _loop0_13_type 1189 +#define _gather_12_type 1190 +#define _tmp_14_type 1191 +#define _tmp_15_type 1192 +#define _tmp_16_type 1193 +#define _tmp_17_type 1194 +#define _tmp_18_type 1195 +#define _tmp_19_type 1196 +#define _tmp_20_type 1197 +#define _tmp_21_type 1198 +#define _loop1_22_type 1199 +#define _tmp_23_type 1200 +#define _tmp_24_type 1201 +#define _loop0_26_type 1202 +#define _gather_25_type 1203 +#define _loop0_28_type 1204 +#define _gather_27_type 1205 +#define _tmp_29_type 1206 +#define _loop0_30_type 1207 +#define _loop1_31_type 1208 +#define _loop0_33_type 1209 +#define _gather_32_type 1210 +#define _tmp_34_type 1211 +#define _loop0_36_type 1212 +#define _gather_35_type 1213 +#define _tmp_37_type 1214 +#define _loop0_39_type 1215 +#define _gather_38_type 1216 +#define _loop0_41_type 1217 +#define _gather_40_type 1218 +#define _loop0_43_type 1219 +#define _gather_42_type 1220 +#define _loop0_45_type 1221 +#define _gather_44_type 1222 +#define _tmp_46_type 1223 +#define _loop1_47_type 1224 +#define _tmp_48_type 1225 +#define _loop1_49_type 1226 +#define _loop0_51_type 1227 +#define _gather_50_type 1228 +#define _tmp_52_type 1229 +#define _tmp_53_type 1230 +#define _loop0_55_type 1231 +#define _gather_54_type 1232 +#define _loop0_57_type 1233 +#define _gather_56_type 1234 +#define _loop0_59_type 1235 +#define _gather_58_type 1236 +#define _loop0_61_type 1237 +#define _gather_60_type 1238 +#define _tmp_62_type 1239 +#define _loop0_64_type 1240 +#define _gather_63_type 1241 +#define _tmp_65_type 1242 +#define _tmp_66_type 1243 +#define _tmp_67_type 1244 +#define _loop0_69_type 1245 +#define _gather_68_type 1246 +#define _loop0_71_type 1247 +#define _gather_70_type 1248 +#define _tmp_72_type 1249 +#define _tmp_73_type 1250 +#define _tmp_74_type 1251 +#define _tmp_75_type 1252 +#define _tmp_76_type 1253 +#define _tmp_77_type 1254 +#define _loop0_78_type 1255 +#define _loop0_79_type 1256 +#define _loop0_80_type 1257 +#define _loop1_81_type 1258 +#define _loop0_82_type 1259 +#define _loop1_83_type 1260 +#define _loop1_84_type 1261 +#define _loop1_85_type 1262 +#define _loop0_86_type 1263 +#define _loop1_87_type 1264 +#define _loop0_88_type 1265 +#define _loop1_89_type 1266 +#define _loop0_90_type 1267 +#define _loop1_91_type 1268 +#define _loop1_92_type 1269 +#define _tmp_93_type 1270 +#define _loop0_95_type 1271 +#define _gather_94_type 1272 +#define _loop1_96_type 1273 +#define _loop0_98_type 1274 +#define _gather_97_type 1275 +#define _loop1_99_type 1276 +#define _loop0_100_type 1277 +#define _loop0_101_type 1278 +#define _loop0_102_type 1279 +#define _loop1_103_type 1280 +#define _loop0_104_type 1281 +#define _loop1_105_type 1282 +#define _loop1_106_type 1283 +#define _loop1_107_type 1284 +#define _loop0_108_type 1285 +#define _loop1_109_type 1286 +#define _loop0_110_type 1287 +#define _loop1_111_type 1288 +#define _loop0_112_type 1289 +#define _loop1_113_type 1290 +#define _loop1_114_type 1291 +#define _loop1_115_type 1292 +#define _loop1_116_type 1293 +#define _tmp_117_type 1294 +#define _loop0_119_type 1295 +#define _gather_118_type 1296 +#define _tmp_120_type 1297 +#define _tmp_121_type 1298 +#define _tmp_122_type 1299 +#define _tmp_123_type 1300 +#define _loop1_124_type 1301 +#define _tmp_125_type 1302 +#define _tmp_126_type 1303 +#define _loop0_128_type 1304 +#define _gather_127_type 1305 +#define _loop1_129_type 1306 +#define _loop0_130_type 1307 +#define _loop0_131_type 1308 +#define _tmp_132_type 1309 +#define _tmp_133_type 1310 +#define _loop0_135_type 1311 +#define _gather_134_type 1312 +#define _loop0_137_type 1313 +#define _gather_136_type 1314 +#define _loop0_139_type 1315 +#define _gather_138_type 1316 #define _loop0_141_type 1317 -#define _loop0_143_type 1318 -#define _gather_142_type 1319 -#define _tmp_144_type 1320 -#define _loop0_146_type 1321 -#define _gather_145_type 1322 -#define _loop0_148_type 1323 -#define _gather_147_type 1324 -#define _tmp_149_type 1325 -#define _loop0_150_type 1326 -#define _tmp_151_type 1327 -#define _tmp_152_type 1328 -#define _tmp_153_type 1329 -#define _tmp_154_type 1330 -#define _loop0_155_type 1331 -#define _tmp_156_type 1332 -#define _tmp_157_type 1333 -#define _tmp_158_type 1334 -#define _tmp_159_type 1335 -#define _tmp_160_type 1336 -#define _tmp_161_type 1337 -#define _loop0_163_type 1338 -#define _gather_162_type 1339 -#define _loop0_165_type 1340 -#define _gather_164_type 1341 -#define _loop0_167_type 1342 -#define _gather_166_type 1343 -#define _loop0_169_type 1344 -#define _gather_168_type 1345 -#define _tmp_170_type 1346 -#define _tmp_171_type 1347 -#define _tmp_172_type 1348 -#define _tmp_173_type 1349 -#define _tmp_174_type 1350 -#define _tmp_175_type 1351 -#define _tmp_176_type 1352 -#define _tmp_177_type 1353 -#define _loop1_178_type 1354 -#define _tmp_179_type 1355 -#define _tmp_180_type 1356 -#define _tmp_181_type 1357 +#define _gather_140_type 1318 +#define _loop0_142_type 1319 +#define _loop0_144_type 1320 +#define _gather_143_type 1321 +#define _tmp_145_type 1322 +#define _loop0_147_type 1323 +#define _gather_146_type 1324 +#define _loop0_149_type 1325 +#define _gather_148_type 1326 +#define _tmp_150_type 1327 +#define _loop0_151_type 1328 +#define _tmp_152_type 1329 +#define _tmp_153_type 1330 +#define _tmp_154_type 1331 +#define _tmp_155_type 1332 +#define _loop0_156_type 1333 +#define _tmp_157_type 1334 +#define _tmp_158_type 1335 +#define _tmp_159_type 1336 +#define _tmp_160_type 1337 +#define _tmp_161_type 1338 +#define _tmp_162_type 1339 +#define _loop0_164_type 1340 +#define _gather_163_type 1341 +#define _loop0_166_type 1342 +#define _gather_165_type 1343 +#define _loop0_168_type 1344 +#define _gather_167_type 1345 +#define _loop0_170_type 1346 +#define _gather_169_type 1347 +#define _tmp_171_type 1348 +#define _tmp_172_type 1349 +#define _tmp_173_type 1350 +#define _tmp_174_type 1351 +#define _tmp_175_type 1352 +#define _tmp_176_type 1353 +#define _tmp_177_type 1354 +#define _tmp_178_type 1355 +#define _loop1_179_type 1356 +#define _tmp_180_type 1357 +#define _tmp_181_type 1358 +#define _tmp_182_type 1359 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -485,6 +487,7 @@ static void *group_pattern_rule(Parser *p); static void *sequence_pattern_rule(Parser *p); static void *mapping_pattern_rule(Parser *p); static void *class_pattern_rule(Parser *p); +static void *signed_number_rule(Parser *p); static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); @@ -663,124 +666,124 @@ static asdl_seq *_loop1_49_rule(Parser *p); static asdl_seq *_loop0_51_rule(Parser *p); static asdl_seq *_gather_50_rule(Parser *p); static void *_tmp_52_rule(Parser *p); -static asdl_seq *_loop0_54_rule(Parser *p); -static asdl_seq *_gather_53_rule(Parser *p); -static asdl_seq *_loop0_56_rule(Parser *p); -static asdl_seq *_gather_55_rule(Parser *p); -static asdl_seq *_loop0_58_rule(Parser *p); -static asdl_seq *_gather_57_rule(Parser *p); -static asdl_seq *_loop0_60_rule(Parser *p); -static asdl_seq *_gather_59_rule(Parser *p); -static void *_tmp_61_rule(Parser *p); -static asdl_seq *_loop0_63_rule(Parser *p); -static asdl_seq *_gather_62_rule(Parser *p); -static void *_tmp_64_rule(Parser *p); +static void *_tmp_53_rule(Parser *p); +static asdl_seq *_loop0_55_rule(Parser *p); +static asdl_seq *_gather_54_rule(Parser *p); +static asdl_seq *_loop0_57_rule(Parser *p); +static asdl_seq *_gather_56_rule(Parser *p); +static asdl_seq *_loop0_59_rule(Parser *p); +static asdl_seq *_gather_58_rule(Parser *p); +static asdl_seq *_loop0_61_rule(Parser *p); +static asdl_seq *_gather_60_rule(Parser *p); +static void *_tmp_62_rule(Parser *p); +static asdl_seq *_loop0_64_rule(Parser *p); +static asdl_seq *_gather_63_rule(Parser *p); static void *_tmp_65_rule(Parser *p); static void *_tmp_66_rule(Parser *p); -static asdl_seq *_loop0_68_rule(Parser *p); -static asdl_seq *_gather_67_rule(Parser *p); -static asdl_seq *_loop0_70_rule(Parser *p); -static asdl_seq *_gather_69_rule(Parser *p); -static void *_tmp_71_rule(Parser *p); +static void *_tmp_67_rule(Parser *p); +static asdl_seq *_loop0_69_rule(Parser *p); +static asdl_seq *_gather_68_rule(Parser *p); +static asdl_seq *_loop0_71_rule(Parser *p); +static asdl_seq *_gather_70_rule(Parser *p); static void *_tmp_72_rule(Parser *p); static void *_tmp_73_rule(Parser *p); static void *_tmp_74_rule(Parser *p); static void *_tmp_75_rule(Parser *p); static void *_tmp_76_rule(Parser *p); -static asdl_seq *_loop0_77_rule(Parser *p); +static void *_tmp_77_rule(Parser *p); static asdl_seq *_loop0_78_rule(Parser *p); static asdl_seq *_loop0_79_rule(Parser *p); -static asdl_seq *_loop1_80_rule(Parser *p); -static asdl_seq *_loop0_81_rule(Parser *p); -static asdl_seq *_loop1_82_rule(Parser *p); +static asdl_seq *_loop0_80_rule(Parser *p); +static asdl_seq *_loop1_81_rule(Parser *p); +static asdl_seq *_loop0_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); static asdl_seq *_loop1_84_rule(Parser *p); -static asdl_seq *_loop0_85_rule(Parser *p); -static asdl_seq *_loop1_86_rule(Parser *p); -static asdl_seq *_loop0_87_rule(Parser *p); -static asdl_seq *_loop1_88_rule(Parser *p); -static asdl_seq *_loop0_89_rule(Parser *p); -static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop1_85_rule(Parser *p); +static asdl_seq *_loop0_86_rule(Parser *p); +static asdl_seq *_loop1_87_rule(Parser *p); +static asdl_seq *_loop0_88_rule(Parser *p); +static asdl_seq *_loop1_89_rule(Parser *p); +static asdl_seq *_loop0_90_rule(Parser *p); static asdl_seq *_loop1_91_rule(Parser *p); -static void *_tmp_92_rule(Parser *p); -static asdl_seq *_loop0_94_rule(Parser *p); -static asdl_seq *_gather_93_rule(Parser *p); -static asdl_seq *_loop1_95_rule(Parser *p); -static asdl_seq *_loop0_97_rule(Parser *p); -static asdl_seq *_gather_96_rule(Parser *p); -static asdl_seq *_loop1_98_rule(Parser *p); -static asdl_seq *_loop0_99_rule(Parser *p); +static asdl_seq *_loop1_92_rule(Parser *p); +static void *_tmp_93_rule(Parser *p); +static asdl_seq *_loop0_95_rule(Parser *p); +static asdl_seq *_gather_94_rule(Parser *p); +static asdl_seq *_loop1_96_rule(Parser *p); +static asdl_seq *_loop0_98_rule(Parser *p); +static asdl_seq *_gather_97_rule(Parser *p); +static asdl_seq *_loop1_99_rule(Parser *p); static asdl_seq *_loop0_100_rule(Parser *p); static asdl_seq *_loop0_101_rule(Parser *p); -static asdl_seq *_loop1_102_rule(Parser *p); -static asdl_seq *_loop0_103_rule(Parser *p); -static asdl_seq *_loop1_104_rule(Parser *p); +static asdl_seq *_loop0_102_rule(Parser *p); +static asdl_seq *_loop1_103_rule(Parser *p); +static asdl_seq *_loop0_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); static asdl_seq *_loop1_106_rule(Parser *p); -static asdl_seq *_loop0_107_rule(Parser *p); -static asdl_seq *_loop1_108_rule(Parser *p); -static asdl_seq *_loop0_109_rule(Parser *p); -static asdl_seq *_loop1_110_rule(Parser *p); -static asdl_seq *_loop0_111_rule(Parser *p); -static asdl_seq *_loop1_112_rule(Parser *p); +static asdl_seq *_loop1_107_rule(Parser *p); +static asdl_seq *_loop0_108_rule(Parser *p); +static asdl_seq *_loop1_109_rule(Parser *p); +static asdl_seq *_loop0_110_rule(Parser *p); +static asdl_seq *_loop1_111_rule(Parser *p); +static asdl_seq *_loop0_112_rule(Parser *p); static asdl_seq *_loop1_113_rule(Parser *p); static asdl_seq *_loop1_114_rule(Parser *p); static asdl_seq *_loop1_115_rule(Parser *p); -static void *_tmp_116_rule(Parser *p); -static asdl_seq *_loop0_118_rule(Parser *p); -static asdl_seq *_gather_117_rule(Parser *p); -static void *_tmp_119_rule(Parser *p); +static asdl_seq *_loop1_116_rule(Parser *p); +static void *_tmp_117_rule(Parser *p); +static asdl_seq *_loop0_119_rule(Parser *p); +static asdl_seq *_gather_118_rule(Parser *p); static void *_tmp_120_rule(Parser *p); static void *_tmp_121_rule(Parser *p); static void *_tmp_122_rule(Parser *p); -static asdl_seq *_loop1_123_rule(Parser *p); -static void *_tmp_124_rule(Parser *p); +static void *_tmp_123_rule(Parser *p); +static asdl_seq *_loop1_124_rule(Parser *p); static void *_tmp_125_rule(Parser *p); -static asdl_seq *_loop0_127_rule(Parser *p); -static asdl_seq *_gather_126_rule(Parser *p); -static asdl_seq *_loop1_128_rule(Parser *p); -static asdl_seq *_loop0_129_rule(Parser *p); +static void *_tmp_126_rule(Parser *p); +static asdl_seq *_loop0_128_rule(Parser *p); +static asdl_seq *_gather_127_rule(Parser *p); +static asdl_seq *_loop1_129_rule(Parser *p); static asdl_seq *_loop0_130_rule(Parser *p); -static void *_tmp_131_rule(Parser *p); +static asdl_seq *_loop0_131_rule(Parser *p); static void *_tmp_132_rule(Parser *p); -static asdl_seq *_loop0_134_rule(Parser *p); -static asdl_seq *_gather_133_rule(Parser *p); -static asdl_seq *_loop0_136_rule(Parser *p); -static asdl_seq *_gather_135_rule(Parser *p); -static asdl_seq *_loop0_138_rule(Parser *p); -static asdl_seq *_gather_137_rule(Parser *p); -static asdl_seq *_loop0_140_rule(Parser *p); -static asdl_seq *_gather_139_rule(Parser *p); +static void *_tmp_133_rule(Parser *p); +static asdl_seq *_loop0_135_rule(Parser *p); +static asdl_seq *_gather_134_rule(Parser *p); +static asdl_seq *_loop0_137_rule(Parser *p); +static asdl_seq *_gather_136_rule(Parser *p); +static asdl_seq *_loop0_139_rule(Parser *p); +static asdl_seq *_gather_138_rule(Parser *p); static asdl_seq *_loop0_141_rule(Parser *p); -static asdl_seq *_loop0_143_rule(Parser *p); -static asdl_seq *_gather_142_rule(Parser *p); -static void *_tmp_144_rule(Parser *p); -static asdl_seq *_loop0_146_rule(Parser *p); -static asdl_seq *_gather_145_rule(Parser *p); -static asdl_seq *_loop0_148_rule(Parser *p); -static asdl_seq *_gather_147_rule(Parser *p); -static void *_tmp_149_rule(Parser *p); -static asdl_seq *_loop0_150_rule(Parser *p); -static void *_tmp_151_rule(Parser *p); +static asdl_seq *_gather_140_rule(Parser *p); +static asdl_seq *_loop0_142_rule(Parser *p); +static asdl_seq *_loop0_144_rule(Parser *p); +static asdl_seq *_gather_143_rule(Parser *p); +static void *_tmp_145_rule(Parser *p); +static asdl_seq *_loop0_147_rule(Parser *p); +static asdl_seq *_gather_146_rule(Parser *p); +static asdl_seq *_loop0_149_rule(Parser *p); +static asdl_seq *_gather_148_rule(Parser *p); +static void *_tmp_150_rule(Parser *p); +static asdl_seq *_loop0_151_rule(Parser *p); static void *_tmp_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); -static asdl_seq *_loop0_155_rule(Parser *p); -static void *_tmp_156_rule(Parser *p); +static void *_tmp_155_rule(Parser *p); +static asdl_seq *_loop0_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); static void *_tmp_159_rule(Parser *p); static void *_tmp_160_rule(Parser *p); static void *_tmp_161_rule(Parser *p); -static asdl_seq *_loop0_163_rule(Parser *p); -static asdl_seq *_gather_162_rule(Parser *p); -static asdl_seq *_loop0_165_rule(Parser *p); -static asdl_seq *_gather_164_rule(Parser *p); -static asdl_seq *_loop0_167_rule(Parser *p); -static asdl_seq *_gather_166_rule(Parser *p); -static asdl_seq *_loop0_169_rule(Parser *p); -static asdl_seq *_gather_168_rule(Parser *p); -static void *_tmp_170_rule(Parser *p); +static void *_tmp_162_rule(Parser *p); +static asdl_seq *_loop0_164_rule(Parser *p); +static asdl_seq *_gather_163_rule(Parser *p); +static asdl_seq *_loop0_166_rule(Parser *p); +static asdl_seq *_gather_165_rule(Parser *p); +static asdl_seq *_loop0_168_rule(Parser *p); +static asdl_seq *_gather_167_rule(Parser *p); +static asdl_seq *_loop0_170_rule(Parser *p); +static asdl_seq *_gather_169_rule(Parser *p); static void *_tmp_171_rule(Parser *p); static void *_tmp_172_rule(Parser *p); static void *_tmp_173_rule(Parser *p); @@ -788,10 +791,11 @@ static void *_tmp_174_rule(Parser *p); static void *_tmp_175_rule(Parser *p); static void *_tmp_176_rule(Parser *p); static void *_tmp_177_rule(Parser *p); -static asdl_seq *_loop1_178_rule(Parser *p); -static void *_tmp_179_rule(Parser *p); +static void *_tmp_178_rule(Parser *p); +static asdl_seq *_loop1_179_rule(Parser *p); static void *_tmp_180_rule(Parser *p); static void *_tmp_181_rule(Parser *p); +static void *_tmp_182_rule(Parser *p); // file: statements? $ @@ -5188,7 +5192,14 @@ name_pattern_rule(Parser *p) return _res; } -// literal_pattern: NUMBER | '-' NUMBER | strings | 'None' | 'True' | 'False' +// literal_pattern: +// | signed_number !('+' | '-') +// | signed_number '+' NUMBER +// | signed_number '-' NUMBER +// | strings +// | 'None' +// | 'True' +// | 'False' static void * literal_pattern_rule(Parser *p) { @@ -5208,40 +5219,84 @@ literal_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NUMBER + { // signed_number !('+' | '-') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); - expr_ty number_var; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); + void *signed_number_var; if ( - (number_var = _PyPegen_number_token(p)) // NUMBER + (signed_number_var = signed_number_rule(p)) // signed_number + && + _PyPegen_lookahead(0, _tmp_53_rule, p) ) { - D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); - _res = number_var; + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); + _res = signed_number_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')")); } - { // '-' NUMBER + { // signed_number '+' NUMBER if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); Token * _literal; - expr_ty number; + expr_ty imag; + void *real; + if ( + (real = signed_number_rule(p)) // signed_number + && + (_literal = _PyPegen_expect_token(p, 14)) // token='+' + && + (imag = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_BinOp ( real , Add , imag , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '+' NUMBER")); + } + { // signed_number '-' NUMBER + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); + Token * _literal; + expr_ty imag; + void *real; if ( + (real = signed_number_rule(p)) // signed_number + && (_literal = _PyPegen_expect_token(p, 15)) // token='-' && - (number = _PyPegen_number_token(p)) // NUMBER + (imag = _PyPegen_number_token(p)) // NUMBER ) { - D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5251,7 +5306,7 @@ literal_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( USub , number , EXTRA ); + _res = _Py_BinOp ( real , Sub , imag , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5261,7 +5316,7 @@ literal_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number '-' NUMBER")); } { // strings if (p->error_indicator) { @@ -5740,7 +5795,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_53_rule(p)) // ','.pattern+ + (args = _gather_54_rule(p)) // ','.pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5786,7 +5841,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (keywords = _gather_55_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_56_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5834,11 +5889,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_57_rule(p)) // ','.pattern+ + (args = _gather_58_rule(p)) // ','.pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (keywords = _gather_59_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_60_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5873,7 +5928,7 @@ class_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); - asdl_seq * _gather_62_var; + asdl_seq * _gather_63_var; Token * _literal; Token * _literal_1; Token * _literal_2; @@ -5890,15 +5945,15 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_61_rule(p), 1) // [','.pattern+ ','] + (_opt_var = _tmp_62_rule(p), 1) // [','.pattern+ ','] && - (_gather_62_var = _gather_62_rule(p)) // ','.keyword_pattern+ + (_gather_63_var = _gather_63_rule(p)) // ','.keyword_pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_64_rule(p), 1) // [',' ','.argument_pattern+] + (_opt_var_1 = _tmp_65_rule(p), 1) // [',' ','.argument_pattern+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5939,11 +5994,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_65_rule(p), 1) // [','.argument_pattern+ ','] + (_opt_var = _tmp_66_rule(p), 1) // [','.argument_pattern+ ','] && (error = error_star_rule(p)) // error_star && - (_opt_var_1 = _tmp_66_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] + (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5969,6 +6024,87 @@ class_pattern_rule(Parser *p) return _res; } +// signed_number: NUMBER | '-' NUMBER +static void * +signed_number_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NUMBER + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); + expr_ty number_var; + if ( + (number_var = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); + _res = number_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); + } + { // '-' NUMBER + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token * _literal; + expr_ty number; + if ( + (_literal = _PyPegen_expect_token(p, 15)) // token='-' + && + (number = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_UnaryOp ( USub , number , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // Left-recursive // name_or_attr: NAME | name_or_attr '.' NAME static void * name_or_attr_raw(Parser *); @@ -6104,7 +6240,7 @@ values_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * values; if ( - (values = _gather_67_rule(p)) // ','.value_pattern+ + (values = _gather_68_rule(p)) // ','.value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6149,7 +6285,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_69_rule(p)) // ','.key_value_pattern+ + (items = _gather_70_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6310,10 +6446,10 @@ error_star_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> error_star[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); - void *_tmp_71_var; + void *_tmp_72_var; expr_ty error; if ( - (_tmp_71_var = _tmp_71_rule(p)) // '*' | '**' + (_tmp_72_var = _tmp_72_rule(p)) // '*' | '**' && (error = _PyPegen_name_token(p)) // NAME ) @@ -6441,7 +6577,7 @@ key_value_pattern_rule(Parser *p) void *key; void *value; if ( - (key = _tmp_72_rule(p)) // literal_pattern | constant_pattern + (key = _tmp_73_rule(p)) // literal_pattern | constant_pattern && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6590,7 +6726,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_73_rule(p), 1) // ['from' expression] + (b = _tmp_74_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -6765,7 +6901,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_74_rule(p), 1) // ['->' expression] + (a = _tmp_75_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6825,7 +6961,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_75_rule(p), 1) // ['->' expression] + (a = _tmp_76_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6889,7 +7025,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_76_rule, p) + _PyPegen_lookahead(1, _tmp_77_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -7033,9 +7169,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_77_rule(p)) // param_no_default* + (b = _loop0_78_rule(p)) // param_no_default* && - (c = _loop0_78_rule(p)) // param_with_default* + (c = _loop0_79_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -7065,7 +7201,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_79_rule(p)) // param_with_default* + (b = _loop0_80_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7093,9 +7229,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_80_rule(p)) // param_no_default+ + (a = _loop1_81_rule(p)) // param_no_default+ && - (b = _loop0_81_rule(p)) // param_with_default* + (b = _loop0_82_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7122,7 +7258,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_82_rule(p)) // param_with_default+ + (a = _loop1_83_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -7191,7 +7327,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_83_rule(p)) // param_no_default+ + (a = _loop1_84_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7220,7 +7356,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_84_rule(p)) // param_no_default+ + (a = _loop1_85_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7270,9 +7406,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_85_rule(p)) // param_no_default* + (a = _loop0_86_rule(p)) // param_no_default* && - (b = _loop1_86_rule(p)) // param_with_default+ + (b = _loop1_87_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7302,9 +7438,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_87_rule(p)) // param_no_default* + (a = _loop0_88_rule(p)) // param_no_default* && - (b = _loop1_88_rule(p)) // param_with_default+ + (b = _loop1_89_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7360,7 +7496,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_89_rule(p)) // param_maybe_default* + (b = _loop0_90_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7393,7 +7529,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_90_rule(p)) // param_maybe_default+ + (b = _loop1_91_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -7915,7 +8051,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_91_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_92_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -8036,7 +8172,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_92_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_93_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -8185,7 +8321,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_93_rule(p)) // ','.star_expression+ + (a = _gather_94_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8245,7 +8381,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_95_rule(p)) // ((',' star_expression))+ + (b = _loop1_96_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8440,7 +8576,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_96_rule(p)) // ','.star_named_expression+ + (a = _gather_97_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8738,7 +8874,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_98_rule(p)) // ((',' expression))+ + (b = _loop1_99_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9037,9 +9173,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_99_rule(p)) // lambda_param_no_default* + (b = _loop0_100_rule(p)) // lambda_param_no_default* && - (c = _loop0_100_rule(p)) // lambda_param_with_default* + (c = _loop0_101_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9069,7 +9205,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_101_rule(p)) // lambda_param_with_default* + (b = _loop0_102_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9097,9 +9233,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_102_rule(p)) // lambda_param_no_default+ + (a = _loop1_103_rule(p)) // lambda_param_no_default+ && - (b = _loop0_103_rule(p)) // lambda_param_with_default* + (b = _loop0_104_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9126,7 +9262,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_104_rule(p)) // lambda_param_with_default+ + (a = _loop1_105_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9197,7 +9333,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_105_rule(p)) // lambda_param_no_default+ + (a = _loop1_106_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9226,7 +9362,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_106_rule(p)) // lambda_param_no_default+ + (a = _loop1_107_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9276,9 +9412,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_107_rule(p)) // lambda_param_no_default* + (a = _loop0_108_rule(p)) // lambda_param_no_default* && - (b = _loop1_108_rule(p)) // lambda_param_with_default+ + (b = _loop1_109_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9308,9 +9444,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_109_rule(p)) // lambda_param_no_default* + (a = _loop0_110_rule(p)) // lambda_param_no_default* && - (b = _loop1_110_rule(p)) // lambda_param_with_default+ + (b = _loop1_111_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9366,7 +9502,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_111_rule(p)) // lambda_param_maybe_default* + (b = _loop0_112_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9399,7 +9535,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_112_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_113_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9826,7 +9962,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_113_rule(p)) // (('or' conjunction))+ + (b = _loop1_114_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -9912,7 +10048,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_114_rule(p)) // (('and' inversion))+ + (b = _loop1_115_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10080,7 +10216,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_115_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_116_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10408,10 +10544,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_116_var; + void *_tmp_117_var; expr_ty a; if ( - (_tmp_116_var = _tmp_116_rule(p)) // '!=' + (_tmp_117_var = _tmp_117_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12340,7 +12476,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_117_rule(p)) // ','.slice+ + (a = _gather_118_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12410,7 +12546,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_119_rule(p), 1) // [':' expression?] + (c = _tmp_120_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -12684,15 +12820,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_120_var; + void *_tmp_121_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_120_var = _tmp_120_rule(p)) // tuple | group | genexp + (_tmp_121_var = _tmp_121_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_120_var; + _res = _tmp_121_var; goto done; } p->mark = _mark; @@ -12705,15 +12841,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_121_var; + void *_tmp_122_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_121_var = _tmp_121_rule(p)) // list | listcomp + (_tmp_122_var = _tmp_122_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_121_var; + _res = _tmp_122_var; goto done; } p->mark = _mark; @@ -12726,15 +12862,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_122_var; + void *_tmp_123_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_122_var = _tmp_122_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_123_var = _tmp_123_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_122_var; + _res = _tmp_123_var; goto done; } p->mark = _mark; @@ -12803,7 +12939,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_123_rule(p)) // STRING+ + (a = _loop1_124_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -13010,7 +13146,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_124_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_125_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13066,7 +13202,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_125_rule(p)) // yield_expr | named_expression + (a = _tmp_126_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13502,7 +13638,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_126_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_127_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13653,13 +13789,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_128_var; + asdl_seq * _loop1_129_var; if ( - (_loop1_128_var = _loop1_128_rule(p)) // for_if_clause+ + (_loop1_129_var = _loop1_129_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_128_var; + _res = _loop1_129_var; goto done; } p->mark = _mark; @@ -13708,7 +13844,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_129_rule(p)) // (('if' disjunction))* + (c = _loop0_130_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13744,7 +13880,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_130_rule(p)) // (('if' disjunction))* + (c = _loop0_131_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13969,7 +14105,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_131_rule(p), 1) // [',' args] + (b = _tmp_132_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -14038,7 +14174,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_132_rule(p), 1) // [',' args] + (b = _tmp_133_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -14093,11 +14229,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_133_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_134_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_135_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14119,13 +14255,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_137_var; + asdl_seq * _gather_138_var; if ( - (_gather_137_var = _gather_137_rule(p)) // ','.kwarg_or_starred+ + (_gather_138_var = _gather_138_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_137_var; + _res = _gather_138_var; goto done; } p->mark = _mark; @@ -14138,13 +14274,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_139_var; + asdl_seq * _gather_140_var; if ( - (_gather_139_var = _gather_139_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_139_var; + _res = _gather_140_var; goto done; } p->mark = _mark; @@ -14506,7 +14642,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_141_rule(p)) // ((',' star_target))* + (b = _loop0_142_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14560,7 +14696,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_142_rule(p)) // ','.star_target+ + (a = _gather_143_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14623,7 +14759,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_144_rule(p)) // !'*' star_target + (a = _tmp_145_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15145,7 +15281,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_145_rule(p)) // ','.del_target+ + (a = _gather_146_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15624,7 +15760,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_147_rule(p)) // ','.target+ + (a = _gather_148_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16336,7 +16472,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_149_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_150_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -16618,14 +16754,14 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_150_var; + asdl_seq * _loop0_151_var; expr_ty a; if ( (a = star_named_expression_rule(p)) // star_named_expression && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_150_var = _loop0_150_rule(p)) // star_named_expressions* + (_loop0_151_var = _loop0_151_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -16661,7 +16797,7 @@ invalid_assignment_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_151_rule(p), 1) // ['=' annotated_rhs] + (_opt_var = _tmp_152_rule(p), 1) // ['=' annotated_rhs] ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); @@ -16684,14 +16820,14 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); Token * _literal; - void *_tmp_152_var; + void *_tmp_153_var; expr_ty a; if ( (a = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_tmp_152_var = _tmp_152_rule(p)) // yield_expr | star_expressions + (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); @@ -16713,7 +16849,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_153_var; + void *_tmp_154_var; expr_ty a; AugOperator* augassign_var; if ( @@ -16721,7 +16857,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions + (_tmp_154_var = _tmp_154_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -16803,11 +16939,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_154_var; + void *_tmp_155_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_154_var = _tmp_154_rule(p)) // '[' | '(' | '{' + (_tmp_155_var = _tmp_155_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -16904,13 +17040,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_155_var; - void *_tmp_156_var; + asdl_seq * _loop0_156_var; + void *_tmp_157_var; arg_ty param_no_default_var; if ( - (_loop0_155_var = _loop0_155_rule(p)) // param_no_default* + (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* && - (_tmp_156_var = _tmp_156_rule(p)) // slash_with_default | param_with_default+ + (_tmp_157_var = _tmp_157_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -16952,11 +17088,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_157_var; + void *_tmp_158_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_157_var = _tmp_157_rule(p)) // ')' | ',' (')' | '**') + (_tmp_158_var = _tmp_158_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -17026,11 +17162,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_158_var; + void *_tmp_159_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_158_var = _tmp_158_rule(p)) // ':' | ',' (':' | '**') + (_tmp_159_var = _tmp_159_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18440,12 +18576,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_159_var; + void *_tmp_160_var; while ( - (_tmp_159_var = _tmp_159_rule(p)) // star_targets '=' + (_tmp_160_var = _tmp_160_rule(p)) // star_targets '=' ) { - _res = _tmp_159_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18893,12 +19029,12 @@ _loop0_30_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_160_var; + void *_tmp_161_var; while ( - (_tmp_160_var = _tmp_160_rule(p)) // '.' | '...' + (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' ) { - _res = _tmp_160_var; + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -18959,12 +19095,12 @@ _loop1_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_161_var; + void *_tmp_162_var; while ( - (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' + (_tmp_162_var = _tmp_162_rule(p)) // '.' | '...' ) { - _res = _tmp_161_var; + _res = _tmp_162_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20193,9 +20329,64 @@ _tmp_52_rule(Parser *p) return _res; } -// _loop0_54: ',' pattern +// _tmp_53: '+' | '-' +static void * +_tmp_53_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '+' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 14)) // token='+' + ) + { + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); + } + { // '-' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 15)) // token='-' + ) + { + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_55: ',' pattern static asdl_seq * -_loop0_54_rule(Parser *p) +_loop0_55_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20219,7 +20410,7 @@ _loop0_54_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -20250,7 +20441,7 @@ _loop0_54_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20263,14 +20454,14 @@ _loop0_54_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); D(p->level--); return _seq; } -// _gather_53: pattern _loop0_54 +// _gather_54: pattern _loop0_55 static asdl_seq * -_gather_53_rule(Parser *p) +_gather_54_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20279,27 +20470,27 @@ _gather_53_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_54 + { // pattern _loop0_55 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); + D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_55")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_54_rule(p)) // _loop0_54 + (seq = _loop0_55_rule(p)) // _loop0_55 ) { - D(fprintf(stderr, "%*c+ _gather_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_54")); + D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_55")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_54")); + D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_55")); } _res = NULL; done: @@ -20307,9 +20498,9 @@ _gather_53_rule(Parser *p) return _res; } -// _loop0_56: ',' keyword_pattern +// _loop0_57: ',' keyword_pattern static asdl_seq * -_loop0_56_rule(Parser *p) +_loop0_57_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20333,7 +20524,7 @@ _loop0_56_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( @@ -20364,7 +20555,7 @@ _loop0_56_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20377,14 +20568,14 @@ _loop0_56_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); D(p->level--); return _seq; } -// _gather_55: keyword_pattern _loop0_56 +// _gather_56: keyword_pattern _loop0_57 static asdl_seq * -_gather_55_rule(Parser *p) +_gather_56_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20393,27 +20584,27 @@ _gather_55_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_56 + { // keyword_pattern _loop0_57 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_56")); + D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_57")); void *elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_56_rule(p)) // _loop0_56 + (seq = _loop0_57_rule(p)) // _loop0_57 ) { - D(fprintf(stderr, "%*c+ _gather_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_56")); + D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_57")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_55[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_56")); + D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_57")); } _res = NULL; done: @@ -20421,9 +20612,9 @@ _gather_55_rule(Parser *p) return _res; } -// _loop0_58: ',' pattern +// _loop0_59: ',' pattern static asdl_seq * -_loop0_58_rule(Parser *p) +_loop0_59_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20447,7 +20638,7 @@ _loop0_58_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -20478,7 +20669,7 @@ _loop0_58_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20491,14 +20682,14 @@ _loop0_58_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_59_type, _seq); D(p->level--); return _seq; } -// _gather_57: pattern _loop0_58 +// _gather_58: pattern _loop0_59 static asdl_seq * -_gather_57_rule(Parser *p) +_gather_58_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20507,27 +20698,27 @@ _gather_57_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_58 + { // pattern _loop0_59 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_58_rule(p)) // _loop0_58 + (seq = _loop0_59_rule(p)) // _loop0_59 ) { - D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_59")); } _res = NULL; done: @@ -20535,9 +20726,9 @@ _gather_57_rule(Parser *p) return _res; } -// _loop0_60: ',' keyword_pattern +// _loop0_61: ',' keyword_pattern static asdl_seq * -_loop0_60_rule(Parser *p) +_loop0_61_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20561,7 +20752,7 @@ _loop0_60_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( @@ -20592,7 +20783,7 @@ _loop0_60_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20605,14 +20796,14 @@ _loop0_60_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); D(p->level--); return _seq; } -// _gather_59: keyword_pattern _loop0_60 +// _gather_60: keyword_pattern _loop0_61 static asdl_seq * -_gather_59_rule(Parser *p) +_gather_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20621,27 +20812,27 @@ _gather_59_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_60 + { // keyword_pattern _loop0_61 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_61")); void *elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_60_rule(p)) // _loop0_60 + (seq = _loop0_61_rule(p)) // _loop0_61 ) { - D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_61")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_61")); } _res = NULL; done: @@ -20649,9 +20840,9 @@ _gather_59_rule(Parser *p) return _res; } -// _tmp_61: ','.pattern+ ',' +// _tmp_62: ','.pattern+ ',' static void * -_tmp_61_rule(Parser *p) +_tmp_62_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20665,21 +20856,21 @@ _tmp_61_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - asdl_seq * _gather_162_var; + D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + asdl_seq * _gather_163_var; Token * _literal; if ( - (_gather_162_var = _gather_162_rule(p)) // ','.pattern+ + (_gather_163_var = _gather_163_rule(p)) // ','.pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_162_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_163_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_62[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ','")); } _res = NULL; @@ -20688,9 +20879,9 @@ _tmp_61_rule(Parser *p) return _res; } -// _loop0_63: ',' keyword_pattern +// _loop0_64: ',' keyword_pattern static asdl_seq * -_loop0_63_rule(Parser *p) +_loop0_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20714,7 +20905,7 @@ _loop0_63_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( @@ -20745,7 +20936,7 @@ _loop0_63_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20758,14 +20949,14 @@ _loop0_63_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq); D(p->level--); return _seq; } -// _gather_62: keyword_pattern _loop0_63 +// _gather_63: keyword_pattern _loop0_64 static asdl_seq * -_gather_62_rule(Parser *p) +_gather_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20774,27 +20965,27 @@ _gather_62_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_63 + { // keyword_pattern _loop0_64 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); + D(fprintf(stderr, "%*c> _gather_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); void *elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_63_rule(p)) // _loop0_63 + (seq = _loop0_64_rule(p)) // _loop0_64 ) { - D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); + D(fprintf(stderr, "%*c+ _gather_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_63")); + D(fprintf(stderr, "%*c%s _gather_63[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_64")); } _res = NULL; done: @@ -20802,9 +20993,9 @@ _gather_62_rule(Parser *p) return _res; } -// _tmp_64: ',' ','.argument_pattern+ +// _tmp_65: ',' ','.argument_pattern+ static void * -_tmp_64_rule(Parser *p) +_tmp_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20818,21 +21009,21 @@ _tmp_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); - asdl_seq * _gather_164_var; + D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + asdl_seq * _gather_165_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_164_var = _gather_164_rule(p)) // ','.argument_pattern+ + (_gather_165_var = _gather_165_rule(p)) // ','.argument_pattern+ ) { - D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_164_var); + D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_165_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.argument_pattern+")); } _res = NULL; @@ -20841,9 +21032,9 @@ _tmp_64_rule(Parser *p) return _res; } -// _tmp_65: ','.argument_pattern+ ',' +// _tmp_66: ','.argument_pattern+ ',' static void * -_tmp_65_rule(Parser *p) +_tmp_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20857,21 +21048,21 @@ _tmp_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); - asdl_seq * _gather_166_var; + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + asdl_seq * _gather_167_var; Token * _literal; if ( - (_gather_166_var = _gather_166_rule(p)) // ','.argument_pattern+ + (_gather_167_var = _gather_167_rule(p)) // ','.argument_pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_166_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_167_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.argument_pattern+ ','")); } _res = NULL; @@ -20880,9 +21071,9 @@ _tmp_65_rule(Parser *p) return _res; } -// _tmp_66: ',' ','.(argument_pattern | error_star)+ +// _tmp_67: ',' ','.(argument_pattern | error_star)+ static void * -_tmp_66_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20896,21 +21087,21 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); - asdl_seq * _gather_168_var; + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + asdl_seq * _gather_169_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_168_var = _gather_168_rule(p)) // ','.(argument_pattern | error_star)+ + (_gather_169_var = _gather_169_rule(p)) // ','.(argument_pattern | error_star)+ ) { - D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_168_var); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_169_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); } _res = NULL; @@ -20919,9 +21110,9 @@ _tmp_66_rule(Parser *p) return _res; } -// _loop0_68: ',' value_pattern +// _loop0_69: ',' value_pattern static asdl_seq * -_loop0_68_rule(Parser *p) +_loop0_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20945,7 +21136,7 @@ _loop0_68_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; void *elem; while ( @@ -20976,7 +21167,7 @@ _loop0_68_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_68[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20989,14 +21180,14 @@ _loop0_68_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_68_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); D(p->level--); return _seq; } -// _gather_67: value_pattern _loop0_68 +// _gather_68: value_pattern _loop0_69 static asdl_seq * -_gather_67_rule(Parser *p) +_gather_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21005,27 +21196,27 @@ _gather_67_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // value_pattern _loop0_68 + { // value_pattern _loop0_69 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_68")); + D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_69")); void *elem; asdl_seq * seq; if ( (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_68_rule(p)) // _loop0_68 + (seq = _loop0_69_rule(p)) // _loop0_69 ) { - D(fprintf(stderr, "%*c+ _gather_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_68")); + D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_69")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_67[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_68")); + D(fprintf(stderr, "%*c%s _gather_68[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_69")); } _res = NULL; done: @@ -21033,9 +21224,9 @@ _gather_67_rule(Parser *p) return _res; } -// _loop0_70: ',' key_value_pattern +// _loop0_71: ',' key_value_pattern static asdl_seq * -_loop0_70_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21059,7 +21250,7 @@ _loop0_70_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; void *elem; while ( @@ -21090,7 +21281,7 @@ _loop0_70_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21103,14 +21294,14 @@ _loop0_70_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _gather_69: key_value_pattern _loop0_70 +// _gather_70: key_value_pattern _loop0_71 static asdl_seq * -_gather_69_rule(Parser *p) +_gather_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21119,27 +21310,27 @@ _gather_69_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_70 + { // key_value_pattern _loop0_71 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_70")); + D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); void *elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_70_rule(p)) // _loop0_70 + (seq = _loop0_71_rule(p)) // _loop0_71 ) { - D(fprintf(stderr, "%*c+ _gather_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_70")); + D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_70")); + D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_71")); } _res = NULL; done: @@ -21147,9 +21338,9 @@ _gather_69_rule(Parser *p) return _res; } -// _tmp_71: '*' | '**' +// _tmp_72: '*' | '**' static void * -_tmp_71_rule(Parser *p) +_tmp_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21163,18 +21354,18 @@ _tmp_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' ) { - D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); } { // '**' @@ -21182,18 +21373,18 @@ _tmp_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -21202,9 +21393,9 @@ _tmp_71_rule(Parser *p) return _res; } -// _tmp_72: literal_pattern | constant_pattern +// _tmp_73: literal_pattern | constant_pattern static void * -_tmp_72_rule(Parser *p) +_tmp_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21218,18 +21409,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); void *literal_pattern_var; if ( (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); _res = literal_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } { // constant_pattern @@ -21237,18 +21428,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); void *constant_pattern_var; if ( (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); _res = constant_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); } _res = NULL; @@ -21257,9 +21448,9 @@ _tmp_72_rule(Parser *p) return _res; } -// _tmp_73: 'from' expression +// _tmp_74: 'from' expression static void * -_tmp_73_rule(Parser *p) +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21273,7 +21464,7 @@ _tmp_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); Token * _keyword; expr_ty z; if ( @@ -21282,7 +21473,7 @@ _tmp_73_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21292,7 +21483,7 @@ _tmp_73_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -21301,9 +21492,9 @@ _tmp_73_rule(Parser *p) return _res; } -// _tmp_74: '->' expression +// _tmp_75: '->' expression static void * -_tmp_74_rule(Parser *p) +_tmp_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21317,7 +21508,7 @@ _tmp_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21326,7 +21517,7 @@ _tmp_74_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21336,7 +21527,7 @@ _tmp_74_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21345,9 +21536,9 @@ _tmp_74_rule(Parser *p) return _res; } -// _tmp_75: '->' expression +// _tmp_76: '->' expression static void * -_tmp_75_rule(Parser *p) +_tmp_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21361,7 +21552,7 @@ _tmp_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21370,7 +21561,7 @@ _tmp_75_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21380,7 +21571,7 @@ _tmp_75_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21389,9 +21580,9 @@ _tmp_75_rule(Parser *p) return _res; } -// _tmp_76: NEWLINE INDENT +// _tmp_77: NEWLINE INDENT static void * -_tmp_76_rule(Parser *p) +_tmp_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21405,7 +21596,7 @@ _tmp_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -21414,12 +21605,12 @@ _tmp_76_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -21428,9 +21619,9 @@ _tmp_76_rule(Parser *p) return _res; } -// _loop0_77: param_no_default +// _loop0_78: param_no_default static asdl_seq * -_loop0_77_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21454,7 +21645,7 @@ _loop0_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21476,7 +21667,7 @@ _loop0_77_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21489,14 +21680,14 @@ _loop0_77_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _loop0_78: param_with_default +// _loop0_79: param_with_default static asdl_seq * -_loop0_78_rule(Parser *p) +_loop0_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21520,7 +21711,7 @@ _loop0_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21542,7 +21733,7 @@ _loop0_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21555,14 +21746,14 @@ _loop0_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); D(p->level--); return _seq; } -// _loop0_79: param_with_default +// _loop0_80: param_with_default static asdl_seq * -_loop0_79_rule(Parser *p) +_loop0_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21586,7 +21777,7 @@ _loop0_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21608,7 +21799,7 @@ _loop0_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21621,14 +21812,14 @@ _loop0_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); D(p->level--); return _seq; } -// _loop1_80: param_no_default +// _loop1_81: param_no_default static asdl_seq * -_loop1_80_rule(Parser *p) +_loop1_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21652,7 +21843,7 @@ _loop1_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21674,7 +21865,7 @@ _loop1_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21692,14 +21883,14 @@ _loop1_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); D(p->level--); return _seq; } -// _loop0_81: param_with_default +// _loop0_82: param_with_default static asdl_seq * -_loop0_81_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21723,7 +21914,7 @@ _loop0_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21745,7 +21936,7 @@ _loop0_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21758,14 +21949,14 @@ _loop0_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_82: param_with_default +// _loop1_83: param_with_default static asdl_seq * -_loop1_82_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21789,7 +21980,7 @@ _loop1_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21811,7 +22002,7 @@ _loop1_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -21829,14 +22020,14 @@ _loop1_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop1_83: param_no_default +// _loop1_84: param_no_default static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21860,7 +22051,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21882,7 +22073,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21900,14 +22091,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); D(p->level--); return _seq; } -// _loop1_84: param_no_default +// _loop1_85: param_no_default static asdl_seq * -_loop1_84_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21931,7 +22122,7 @@ _loop1_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21953,7 +22144,7 @@ _loop1_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21971,14 +22162,14 @@ _loop1_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); D(p->level--); return _seq; } -// _loop0_85: param_no_default +// _loop0_86: param_no_default static asdl_seq * -_loop0_85_rule(Parser *p) +_loop0_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22002,7 +22193,7 @@ _loop0_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22024,7 +22215,7 @@ _loop0_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22037,14 +22228,14 @@ _loop0_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); D(p->level--); return _seq; } -// _loop1_86: param_with_default +// _loop1_87: param_with_default static asdl_seq * -_loop1_86_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22068,7 +22259,7 @@ _loop1_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22090,7 +22281,7 @@ _loop1_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22108,14 +22299,14 @@ _loop1_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop0_87: param_no_default +// _loop0_88: param_no_default static asdl_seq * -_loop0_87_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22139,7 +22330,7 @@ _loop0_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22161,7 +22352,7 @@ _loop0_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22174,14 +22365,14 @@ _loop0_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _loop1_88: param_with_default +// _loop1_89: param_with_default static asdl_seq * -_loop1_88_rule(Parser *p) +_loop1_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22205,7 +22396,7 @@ _loop1_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22227,7 +22418,7 @@ _loop1_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22245,14 +22436,14 @@ _loop1_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); D(p->level--); return _seq; } -// _loop0_89: param_maybe_default +// _loop0_90: param_maybe_default static asdl_seq * -_loop0_89_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22276,7 +22467,7 @@ _loop0_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22298,7 +22489,7 @@ _loop0_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22311,14 +22502,14 @@ _loop0_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _loop1_90: param_maybe_default +// _loop1_91: param_maybe_default static asdl_seq * -_loop1_90_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22342,7 +22533,7 @@ _loop1_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22364,7 +22555,7 @@ _loop1_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -22382,14 +22573,14 @@ _loop1_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _loop1_91: ('@' named_expression NEWLINE) +// _loop1_92: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_91_rule(Parser *p) +_loop1_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22413,13 +22604,13 @@ _loop1_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_170_var; + D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_171_var; while ( - (_tmp_170_var = _tmp_170_rule(p)) // '@' named_expression NEWLINE + (_tmp_171_var = _tmp_171_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_170_var; + _res = _tmp_171_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22435,7 +22626,7 @@ _loop1_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -22453,14 +22644,14 @@ _loop1_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); D(p->level--); return _seq; } -// _tmp_92: '(' arguments? ')' +// _tmp_93: '(' arguments? ')' static void * -_tmp_92_rule(Parser *p) +_tmp_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22474,7 +22665,7 @@ _tmp_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -22486,7 +22677,7 @@ _tmp_92_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22496,7 +22687,7 @@ _tmp_92_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -22505,9 +22696,9 @@ _tmp_92_rule(Parser *p) return _res; } -// _loop0_94: ',' star_expression +// _loop0_95: ',' star_expression static asdl_seq * -_loop0_94_rule(Parser *p) +_loop0_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22531,7 +22722,7 @@ _loop0_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -22562,7 +22753,7 @@ _loop0_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22575,14 +22766,14 @@ _loop0_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); D(p->level--); return _seq; } -// _gather_93: star_expression _loop0_94 +// _gather_94: star_expression _loop0_95 static asdl_seq * -_gather_93_rule(Parser *p) +_gather_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22591,27 +22782,27 @@ _gather_93_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_94 + { // star_expression _loop0_95 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_94")); + D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_94_rule(p)) // _loop0_94 + (seq = _loop0_95_rule(p)) // _loop0_95 ) { - D(fprintf(stderr, "%*c+ _gather_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_94")); + D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_94")); + D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_95")); } _res = NULL; done: @@ -22619,9 +22810,9 @@ _gather_93_rule(Parser *p) return _res; } -// _loop1_95: (',' star_expression) +// _loop1_96: (',' star_expression) static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22645,13 +22836,13 @@ _loop1_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_171_var; + D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_172_var; while ( - (_tmp_171_var = _tmp_171_rule(p)) // ',' star_expression + (_tmp_172_var = _tmp_172_rule(p)) // ',' star_expression ) { - _res = _tmp_171_var; + _res = _tmp_172_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22667,7 +22858,7 @@ _loop1_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -22685,14 +22876,14 @@ _loop1_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); D(p->level--); return _seq; } -// _loop0_97: ',' star_named_expression +// _loop0_98: ',' star_named_expression static asdl_seq * -_loop0_97_rule(Parser *p) +_loop0_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22716,7 +22907,7 @@ _loop0_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -22747,7 +22938,7 @@ _loop0_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22760,14 +22951,14 @@ _loop0_97_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); D(p->level--); return _seq; } -// _gather_96: star_named_expression _loop0_97 +// _gather_97: star_named_expression _loop0_98 static asdl_seq * -_gather_96_rule(Parser *p) +_gather_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22776,27 +22967,27 @@ _gather_96_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_97 + { // star_named_expression _loop0_98 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_97")); + D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_97_rule(p)) // _loop0_97 + (seq = _loop0_98_rule(p)) // _loop0_98 ) { - D(fprintf(stderr, "%*c+ _gather_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_97")); + D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_96[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_97")); + D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_98")); } _res = NULL; done: @@ -22804,9 +22995,9 @@ _gather_96_rule(Parser *p) return _res; } -// _loop1_98: (',' expression) +// _loop1_99: (',' expression) static asdl_seq * -_loop1_98_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22830,13 +23021,13 @@ _loop1_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_172_var; + D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_173_var; while ( - (_tmp_172_var = _tmp_172_rule(p)) // ',' expression + (_tmp_173_var = _tmp_173_rule(p)) // ',' expression ) { - _res = _tmp_172_var; + _res = _tmp_173_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22852,7 +23043,7 @@ _loop1_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -22870,14 +23061,14 @@ _loop1_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop0_99: lambda_param_no_default +// _loop0_100: lambda_param_no_default static asdl_seq * -_loop0_99_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22901,7 +23092,7 @@ _loop0_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -22923,7 +23114,7 @@ _loop0_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22936,14 +23127,14 @@ _loop0_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_with_default +// _loop0_101: lambda_param_with_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22967,7 +23158,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -22989,7 +23180,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23002,14 +23193,14 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); D(p->level--); return _seq; } -// _loop0_101: lambda_param_with_default +// _loop0_102: lambda_param_with_default static asdl_seq * -_loop0_101_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23033,7 +23224,7 @@ _loop0_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23055,7 +23246,7 @@ _loop0_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23068,14 +23259,14 @@ _loop0_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop1_102: lambda_param_no_default +// _loop1_103: lambda_param_no_default static asdl_seq * -_loop1_102_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23099,7 +23290,7 @@ _loop1_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23121,7 +23312,7 @@ _loop1_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23139,14 +23330,14 @@ _loop1_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop0_103: lambda_param_with_default +// _loop0_104: lambda_param_with_default static asdl_seq * -_loop0_103_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23170,7 +23361,7 @@ _loop0_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23192,7 +23383,7 @@ _loop0_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23205,14 +23396,14 @@ _loop0_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_104: lambda_param_with_default +// _loop1_105: lambda_param_with_default static asdl_seq * -_loop1_104_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23236,7 +23427,7 @@ _loop1_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23258,7 +23449,7 @@ _loop1_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23276,14 +23467,14 @@ _loop1_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_no_default +// _loop1_106: lambda_param_no_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23307,7 +23498,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23329,7 +23520,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23347,14 +23538,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _loop1_106: lambda_param_no_default +// _loop1_107: lambda_param_no_default static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23378,7 +23569,7 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23400,7 +23591,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23418,14 +23609,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop0_107: lambda_param_no_default +// _loop0_108: lambda_param_no_default static asdl_seq * -_loop0_107_rule(Parser *p) +_loop0_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23449,7 +23640,7 @@ _loop0_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23471,7 +23662,7 @@ _loop0_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23484,14 +23675,14 @@ _loop0_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); D(p->level--); return _seq; } -// _loop1_108: lambda_param_with_default +// _loop1_109: lambda_param_with_default static asdl_seq * -_loop1_108_rule(Parser *p) +_loop1_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23515,7 +23706,7 @@ _loop1_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23537,7 +23728,7 @@ _loop1_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23555,14 +23746,14 @@ _loop1_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); D(p->level--); return _seq; } -// _loop0_109: lambda_param_no_default +// _loop0_110: lambda_param_no_default static asdl_seq * -_loop0_109_rule(Parser *p) +_loop0_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23586,7 +23777,7 @@ _loop0_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23608,7 +23799,7 @@ _loop0_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23621,14 +23812,14 @@ _loop0_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); D(p->level--); return _seq; } -// _loop1_110: lambda_param_with_default +// _loop1_111: lambda_param_with_default static asdl_seq * -_loop1_110_rule(Parser *p) +_loop1_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23652,7 +23843,7 @@ _loop1_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23674,7 +23865,7 @@ _loop1_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23692,14 +23883,14 @@ _loop1_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); D(p->level--); return _seq; } -// _loop0_111: lambda_param_maybe_default +// _loop0_112: lambda_param_maybe_default static asdl_seq * -_loop0_111_rule(Parser *p) +_loop0_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23723,7 +23914,7 @@ _loop0_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23745,7 +23936,7 @@ _loop0_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23758,14 +23949,14 @@ _loop0_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); D(p->level--); return _seq; } -// _loop1_112: lambda_param_maybe_default +// _loop1_113: lambda_param_maybe_default static asdl_seq * -_loop1_112_rule(Parser *p) +_loop1_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23789,7 +23980,7 @@ _loop1_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23811,7 +24002,7 @@ _loop1_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -23829,14 +24020,14 @@ _loop1_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); D(p->level--); return _seq; } -// _loop1_113: ('or' conjunction) +// _loop1_114: ('or' conjunction) static asdl_seq * -_loop1_113_rule(Parser *p) +_loop1_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23860,13 +24051,13 @@ _loop1_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_173_var; + D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_174_var; while ( - (_tmp_173_var = _tmp_173_rule(p)) // 'or' conjunction + (_tmp_174_var = _tmp_174_rule(p)) // 'or' conjunction ) { - _res = _tmp_173_var; + _res = _tmp_174_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23882,7 +24073,7 @@ _loop1_113_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -23900,14 +24091,14 @@ _loop1_113_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); D(p->level--); return _seq; } -// _loop1_114: ('and' inversion) +// _loop1_115: ('and' inversion) static asdl_seq * -_loop1_114_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23931,13 +24122,13 @@ _loop1_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_174_var; + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_175_var; while ( - (_tmp_174_var = _tmp_174_rule(p)) // 'and' inversion + (_tmp_175_var = _tmp_175_rule(p)) // 'and' inversion ) { - _res = _tmp_174_var; + _res = _tmp_175_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23953,7 +24144,7 @@ _loop1_114_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -23971,14 +24162,14 @@ _loop1_114_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _loop1_115: compare_op_bitwise_or_pair +// _loop1_116: compare_op_bitwise_or_pair static asdl_seq * -_loop1_115_rule(Parser *p) +_loop1_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24002,7 +24193,7 @@ _loop1_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -24024,7 +24215,7 @@ _loop1_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -24042,14 +24233,14 @@ _loop1_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); D(p->level--); return _seq; } -// _tmp_116: '!=' +// _tmp_117: '!=' static void * -_tmp_116_rule(Parser *p) +_tmp_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24063,13 +24254,13 @@ _tmp_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24079,7 +24270,7 @@ _tmp_116_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -24088,9 +24279,9 @@ _tmp_116_rule(Parser *p) return _res; } -// _loop0_118: ',' slice +// _loop0_119: ',' slice static asdl_seq * -_loop0_118_rule(Parser *p) +_loop0_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24114,7 +24305,7 @@ _loop0_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -24145,7 +24336,7 @@ _loop0_118_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24158,14 +24349,14 @@ _loop0_118_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); D(p->level--); return _seq; } -// _gather_117: slice _loop0_118 +// _gather_118: slice _loop0_119 static asdl_seq * -_gather_117_rule(Parser *p) +_gather_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24174,27 +24365,27 @@ _gather_117_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_118 + { // slice _loop0_119 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_118")); + D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_118_rule(p)) // _loop0_118 + (seq = _loop0_119_rule(p)) // _loop0_119 ) { - D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_118")); + D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_118")); + D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_119")); } _res = NULL; done: @@ -24202,9 +24393,9 @@ _gather_117_rule(Parser *p) return _res; } -// _tmp_119: ':' expression? +// _tmp_120: ':' expression? static void * -_tmp_119_rule(Parser *p) +_tmp_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24218,7 +24409,7 @@ _tmp_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -24227,7 +24418,7 @@ _tmp_119_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24237,7 +24428,7 @@ _tmp_119_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -24246,9 +24437,9 @@ _tmp_119_rule(Parser *p) return _res; } -// _tmp_120: tuple | group | genexp +// _tmp_121: tuple | group | genexp static void * -_tmp_120_rule(Parser *p) +_tmp_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24262,18 +24453,18 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -24281,18 +24472,18 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -24300,18 +24491,18 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -24320,9 +24511,9 @@ _tmp_120_rule(Parser *p) return _res; } -// _tmp_121: list | listcomp +// _tmp_122: list | listcomp static void * -_tmp_121_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24336,18 +24527,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -24355,18 +24546,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -24375,9 +24566,9 @@ _tmp_121_rule(Parser *p) return _res; } -// _tmp_122: dict | set | dictcomp | setcomp +// _tmp_123: dict | set | dictcomp | setcomp static void * -_tmp_122_rule(Parser *p) +_tmp_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24391,18 +24582,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -24410,18 +24601,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -24429,18 +24620,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -24448,18 +24639,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -24468,9 +24659,9 @@ _tmp_122_rule(Parser *p) return _res; } -// _loop1_123: STRING +// _loop1_124: STRING static asdl_seq * -_loop1_123_rule(Parser *p) +_loop1_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24494,7 +24685,7 @@ _loop1_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -24516,7 +24707,7 @@ _loop1_123_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -24534,14 +24725,14 @@ _loop1_123_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_123_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_124_type, _seq); D(p->level--); return _seq; } -// _tmp_124: star_named_expression ',' star_named_expressions? +// _tmp_125: star_named_expression ',' star_named_expressions? static void * -_tmp_124_rule(Parser *p) +_tmp_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24555,7 +24746,7 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -24567,7 +24758,7 @@ _tmp_124_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24577,7 +24768,7 @@ _tmp_124_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -24586,9 +24777,9 @@ _tmp_124_rule(Parser *p) return _res; } -// _tmp_125: yield_expr | named_expression +// _tmp_126: yield_expr | named_expression static void * -_tmp_125_rule(Parser *p) +_tmp_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24602,18 +24793,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -24621,18 +24812,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -24641,9 +24832,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _loop0_127: ',' double_starred_kvpair +// _loop0_128: ',' double_starred_kvpair static asdl_seq * -_loop0_127_rule(Parser *p) +_loop0_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24667,7 +24858,7 @@ _loop0_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -24698,7 +24889,7 @@ _loop0_127_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24711,14 +24902,14 @@ _loop0_127_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); D(p->level--); return _seq; } -// _gather_126: double_starred_kvpair _loop0_127 +// _gather_127: double_starred_kvpair _loop0_128 static asdl_seq * -_gather_126_rule(Parser *p) +_gather_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24727,27 +24918,27 @@ _gather_126_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_127 + { // double_starred_kvpair _loop0_128 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_127")); + D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_127_rule(p)) // _loop0_127 + (seq = _loop0_128_rule(p)) // _loop0_128 ) { - D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_127")); + D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_127")); + D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_128")); } _res = NULL; done: @@ -24755,9 +24946,9 @@ _gather_126_rule(Parser *p) return _res; } -// _loop1_128: for_if_clause +// _loop1_129: for_if_clause static asdl_seq * -_loop1_128_rule(Parser *p) +_loop1_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24781,7 +24972,7 @@ _loop1_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -24803,7 +24994,7 @@ _loop1_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_129[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -24821,14 +25012,14 @@ _loop1_128_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_129_type, _seq); D(p->level--); return _seq; } -// _loop0_129: ('if' disjunction) +// _loop0_130: ('if' disjunction) static asdl_seq * -_loop0_129_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24852,13 +25043,13 @@ _loop0_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_175_var; + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_176_var; while ( - (_tmp_175_var = _tmp_175_rule(p)) // 'if' disjunction + (_tmp_176_var = _tmp_176_rule(p)) // 'if' disjunction ) { - _res = _tmp_175_var; + _res = _tmp_176_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24874,7 +25065,7 @@ _loop0_129_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24887,14 +25078,14 @@ _loop0_129_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _loop0_130: ('if' disjunction) +// _loop0_131: ('if' disjunction) static asdl_seq * -_loop0_130_rule(Parser *p) +_loop0_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24918,13 +25109,13 @@ _loop0_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_176_var; + D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_177_var; while ( - (_tmp_176_var = _tmp_176_rule(p)) // 'if' disjunction + (_tmp_177_var = _tmp_177_rule(p)) // 'if' disjunction ) { - _res = _tmp_176_var; + _res = _tmp_177_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24940,7 +25131,7 @@ _loop0_130_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24953,14 +25144,14 @@ _loop0_130_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); D(p->level--); return _seq; } -// _tmp_131: ',' args +// _tmp_132: ',' args static void * -_tmp_131_rule(Parser *p) +_tmp_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24974,7 +25165,7 @@ _tmp_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -24983,7 +25174,7 @@ _tmp_131_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24993,7 +25184,7 @@ _tmp_131_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -25002,9 +25193,9 @@ _tmp_131_rule(Parser *p) return _res; } -// _tmp_132: ',' args +// _tmp_133: ',' args static void * -_tmp_132_rule(Parser *p) +_tmp_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25018,7 +25209,7 @@ _tmp_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -25027,7 +25218,7 @@ _tmp_132_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25037,7 +25228,7 @@ _tmp_132_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -25046,9 +25237,9 @@ _tmp_132_rule(Parser *p) return _res; } -// _loop0_134: ',' kwarg_or_starred +// _loop0_135: ',' kwarg_or_starred static asdl_seq * -_loop0_134_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25072,7 +25263,7 @@ _loop0_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25103,7 +25294,7 @@ _loop0_134_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25116,14 +25307,14 @@ _loop0_134_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_133: kwarg_or_starred _loop0_134 +// _gather_134: kwarg_or_starred _loop0_135 static asdl_seq * -_gather_133_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25132,27 +25323,27 @@ _gather_133_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_134 + { // kwarg_or_starred _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_134")); + D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_134_rule(p)) // _loop0_134 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_134")); + D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_133[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_134")); + D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); } _res = NULL; done: @@ -25160,9 +25351,9 @@ _gather_133_rule(Parser *p) return _res; } -// _loop0_136: ',' kwarg_or_double_starred +// _loop0_137: ',' kwarg_or_double_starred static asdl_seq * -_loop0_136_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25186,7 +25377,7 @@ _loop0_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25217,7 +25408,7 @@ _loop0_136_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25230,14 +25421,14 @@ _loop0_136_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_136_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_135: kwarg_or_double_starred _loop0_136 +// _gather_136: kwarg_or_double_starred _loop0_137 static asdl_seq * -_gather_135_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25246,27 +25437,27 @@ _gather_135_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_136 + { // kwarg_or_double_starred _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_136")); + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_136_rule(p)) // _loop0_136 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_136")); + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_136")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); } _res = NULL; done: @@ -25274,9 +25465,9 @@ _gather_135_rule(Parser *p) return _res; } -// _loop0_138: ',' kwarg_or_starred +// _loop0_139: ',' kwarg_or_starred static asdl_seq * -_loop0_138_rule(Parser *p) +_loop0_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25300,7 +25491,7 @@ _loop0_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25331,7 +25522,7 @@ _loop0_138_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25344,14 +25535,14 @@ _loop0_138_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); D(p->level--); return _seq; } -// _gather_137: kwarg_or_starred _loop0_138 +// _gather_138: kwarg_or_starred _loop0_139 static asdl_seq * -_gather_137_rule(Parser *p) +_gather_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25360,27 +25551,27 @@ _gather_137_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_138 + { // kwarg_or_starred _loop0_139 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_138_rule(p)) // _loop0_138 + (seq = _loop0_139_rule(p)) // _loop0_139 ) { - D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_139")); } _res = NULL; done: @@ -25388,9 +25579,9 @@ _gather_137_rule(Parser *p) return _res; } -// _loop0_140: ',' kwarg_or_double_starred +// _loop0_141: ',' kwarg_or_double_starred static asdl_seq * -_loop0_140_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25414,7 +25605,7 @@ _loop0_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25445,7 +25636,7 @@ _loop0_140_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25458,14 +25649,14 @@ _loop0_140_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _gather_139: kwarg_or_double_starred _loop0_140 +// _gather_140: kwarg_or_double_starred _loop0_141 static asdl_seq * -_gather_139_rule(Parser *p) +_gather_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25474,27 +25665,27 @@ _gather_139_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_140 + { // kwarg_or_double_starred _loop0_141 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_140_rule(p)) // _loop0_140 + (seq = _loop0_141_rule(p)) // _loop0_141 ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_141")); } _res = NULL; done: @@ -25502,9 +25693,9 @@ _gather_139_rule(Parser *p) return _res; } -// _loop0_141: (',' star_target) +// _loop0_142: (',' star_target) static asdl_seq * -_loop0_141_rule(Parser *p) +_loop0_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25528,13 +25719,13 @@ _loop0_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_177_var; + D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_178_var; while ( - (_tmp_177_var = _tmp_177_rule(p)) // ',' star_target + (_tmp_178_var = _tmp_178_rule(p)) // ',' star_target ) { - _res = _tmp_177_var; + _res = _tmp_178_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25550,7 +25741,7 @@ _loop0_141_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25563,14 +25754,14 @@ _loop0_141_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); D(p->level--); return _seq; } -// _loop0_143: ',' star_target +// _loop0_144: ',' star_target static asdl_seq * -_loop0_143_rule(Parser *p) +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25594,7 +25785,7 @@ _loop0_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -25625,7 +25816,7 @@ _loop0_143_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25638,14 +25829,14 @@ _loop0_143_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); D(p->level--); return _seq; } -// _gather_142: star_target _loop0_143 +// _gather_143: star_target _loop0_144 static asdl_seq * -_gather_142_rule(Parser *p) +_gather_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25654,27 +25845,27 @@ _gather_142_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_143 + { // star_target _loop0_144 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_143")); + D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_143_rule(p)) // _loop0_143 + (seq = _loop0_144_rule(p)) // _loop0_144 ) { - D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_143")); + D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_143")); + D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_144")); } _res = NULL; done: @@ -25682,9 +25873,9 @@ _gather_142_rule(Parser *p) return _res; } -// _tmp_144: !'*' star_target +// _tmp_145: !'*' star_target static void * -_tmp_144_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25698,7 +25889,7 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -25706,12 +25897,12 @@ _tmp_144_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -25720,9 +25911,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _loop0_146: ',' del_target +// _loop0_147: ',' del_target static asdl_seq * -_loop0_146_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25746,7 +25937,7 @@ _loop0_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -25777,7 +25968,7 @@ _loop0_146_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25790,14 +25981,14 @@ _loop0_146_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _gather_145: del_target _loop0_146 +// _gather_146: del_target _loop0_147 static asdl_seq * -_gather_145_rule(Parser *p) +_gather_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25806,27 +25997,27 @@ _gather_145_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_146 + { // del_target _loop0_147 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_146")); + D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_146_rule(p)) // _loop0_146 + (seq = _loop0_147_rule(p)) // _loop0_147 ) { - D(fprintf(stderr, "%*c+ _gather_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_146")); + D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_145[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_146")); + D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_147")); } _res = NULL; done: @@ -25834,9 +26025,9 @@ _gather_145_rule(Parser *p) return _res; } -// _loop0_148: ',' target +// _loop0_149: ',' target static asdl_seq * -_loop0_148_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25860,7 +26051,7 @@ _loop0_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -25891,7 +26082,7 @@ _loop0_148_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25904,14 +26095,14 @@ _loop0_148_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_148_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _gather_147: target _loop0_148 +// _gather_148: target _loop0_149 static asdl_seq * -_gather_147_rule(Parser *p) +_gather_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25920,27 +26111,27 @@ _gather_147_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_148 + { // target _loop0_149 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_148")); + D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_148_rule(p)) // _loop0_148 + (seq = _loop0_149_rule(p)) // _loop0_149 ) { - D(fprintf(stderr, "%*c+ _gather_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_148")); + D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_147[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_148")); + D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_149")); } _res = NULL; done: @@ -25948,9 +26139,9 @@ _gather_147_rule(Parser *p) return _res; } -// _tmp_149: args | expression for_if_clauses +// _tmp_150: args | expression for_if_clauses static void * -_tmp_149_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25964,18 +26155,18 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -25983,7 +26174,7 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -25992,12 +26183,12 @@ _tmp_149_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -26006,9 +26197,9 @@ _tmp_149_rule(Parser *p) return _res; } -// _loop0_150: star_named_expressions +// _loop0_151: star_named_expressions static asdl_seq * -_loop0_150_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26032,7 +26223,7 @@ _loop0_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -26054,7 +26245,7 @@ _loop0_150_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26067,14 +26258,14 @@ _loop0_150_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); D(p->level--); return _seq; } -// _tmp_151: '=' annotated_rhs +// _tmp_152: '=' annotated_rhs static void * -_tmp_151_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26088,7 +26279,7 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -26097,12 +26288,12 @@ _tmp_151_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -26111,9 +26302,9 @@ _tmp_151_rule(Parser *p) return _res; } -// _tmp_152: yield_expr | star_expressions +// _tmp_153: yield_expr | star_expressions static void * -_tmp_152_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26127,18 +26318,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -26146,18 +26337,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -26166,9 +26357,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: yield_expr | star_expressions +// _tmp_154: yield_expr | star_expressions static void * -_tmp_153_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26182,18 +26373,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -26201,18 +26392,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -26221,9 +26412,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: '[' | '(' | '{' +// _tmp_155: '[' | '(' | '{' static void * -_tmp_154_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26237,18 +26428,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -26256,18 +26447,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -26275,18 +26466,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -26295,9 +26486,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _loop0_155: param_no_default +// _loop0_156: param_no_default static asdl_seq * -_loop0_155_rule(Parser *p) +_loop0_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26321,7 +26512,7 @@ _loop0_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -26343,7 +26534,7 @@ _loop0_155_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26356,14 +26547,14 @@ _loop0_155_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); D(p->level--); return _seq; } -// _tmp_156: slash_with_default | param_with_default+ +// _tmp_157: slash_with_default | param_with_default+ static void * -_tmp_156_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26377,18 +26568,18 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -26396,18 +26587,18 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_178_var; + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_179_var; if ( - (_loop1_178_var = _loop1_178_rule(p)) // param_with_default+ + (_loop1_179_var = _loop1_179_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_178_var; + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_179_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -26416,9 +26607,9 @@ _tmp_156_rule(Parser *p) return _res; } -// _tmp_157: ')' | ',' (')' | '**') +// _tmp_158: ')' | ',' (')' | '**') static void * -_tmp_157_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26432,18 +26623,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -26451,21 +26642,21 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_179_var; + void *_tmp_180_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_179_var = _tmp_179_rule(p)) // ')' | '**' + (_tmp_180_var = _tmp_180_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_179_var); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_180_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -26474,9 +26665,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: ':' | ',' (':' | '**') +// _tmp_159: ':' | ',' (':' | '**') static void * -_tmp_158_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26490,18 +26681,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -26509,21 +26700,21 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_180_var; + void *_tmp_181_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_180_var = _tmp_180_rule(p)) // ':' | '**' + (_tmp_181_var = _tmp_181_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_180_var); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_181_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -26532,9 +26723,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: star_targets '=' +// _tmp_160: star_targets '=' static void * -_tmp_159_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26548,7 +26739,7 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -26557,7 +26748,7 @@ _tmp_159_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26567,7 +26758,7 @@ _tmp_159_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -26576,9 +26767,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: '.' | '...' +// _tmp_161: '.' | '...' static void * -_tmp_160_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26592,18 +26783,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26611,18 +26802,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26631,9 +26822,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: '.' | '...' +// _tmp_162: '.' | '...' static void * -_tmp_161_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26647,18 +26838,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26666,18 +26857,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26686,9 +26877,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _loop0_163: ',' pattern +// _loop0_164: ',' pattern static asdl_seq * -_loop0_163_rule(Parser *p) +_loop0_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26712,7 +26903,7 @@ _loop0_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -26743,7 +26934,7 @@ _loop0_163_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26756,14 +26947,14 @@ _loop0_163_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_163_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_164_type, _seq); D(p->level--); return _seq; } -// _gather_162: pattern _loop0_163 +// _gather_163: pattern _loop0_164 static asdl_seq * -_gather_162_rule(Parser *p) +_gather_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26772,27 +26963,27 @@ _gather_162_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_163 + { // pattern _loop0_164 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_163")); + D(fprintf(stderr, "%*c> _gather_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_164")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_163_rule(p)) // _loop0_163 + (seq = _loop0_164_rule(p)) // _loop0_164 ) { - D(fprintf(stderr, "%*c+ _gather_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_163")); + D(fprintf(stderr, "%*c+ _gather_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_164")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_162[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_163")); + D(fprintf(stderr, "%*c%s _gather_163[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_164")); } _res = NULL; done: @@ -26800,9 +26991,9 @@ _gather_162_rule(Parser *p) return _res; } -// _loop0_165: ',' argument_pattern +// _loop0_166: ',' argument_pattern static asdl_seq * -_loop0_165_rule(Parser *p) +_loop0_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26826,7 +27017,7 @@ _loop0_165_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( @@ -26857,7 +27048,7 @@ _loop0_165_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_165[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26870,14 +27061,14 @@ _loop0_165_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_165_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); D(p->level--); return _seq; } -// _gather_164: argument_pattern _loop0_165 +// _gather_165: argument_pattern _loop0_166 static asdl_seq * -_gather_164_rule(Parser *p) +_gather_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26886,27 +27077,27 @@ _gather_164_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_165 + { // argument_pattern _loop0_166 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_165")); + D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_166")); void *elem; asdl_seq * seq; if ( (elem = argument_pattern_rule(p)) // argument_pattern && - (seq = _loop0_165_rule(p)) // _loop0_165 + (seq = _loop0_166_rule(p)) // _loop0_166 ) { - D(fprintf(stderr, "%*c+ _gather_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_165")); + D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_166")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_164[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_165")); + D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_166")); } _res = NULL; done: @@ -26914,9 +27105,9 @@ _gather_164_rule(Parser *p) return _res; } -// _loop0_167: ',' argument_pattern +// _loop0_168: ',' argument_pattern static asdl_seq * -_loop0_167_rule(Parser *p) +_loop0_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26940,7 +27131,7 @@ _loop0_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( @@ -26971,7 +27162,7 @@ _loop0_167_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26984,14 +27175,14 @@ _loop0_167_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_167_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); D(p->level--); return _seq; } -// _gather_166: argument_pattern _loop0_167 +// _gather_167: argument_pattern _loop0_168 static asdl_seq * -_gather_166_rule(Parser *p) +_gather_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27000,27 +27191,27 @@ _gather_166_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_167 + { // argument_pattern _loop0_168 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_167")); + D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); void *elem; asdl_seq * seq; if ( (elem = argument_pattern_rule(p)) // argument_pattern && - (seq = _loop0_167_rule(p)) // _loop0_167 + (seq = _loop0_168_rule(p)) // _loop0_168 ) { - D(fprintf(stderr, "%*c+ _gather_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_167")); + D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_166[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_167")); + D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_168")); } _res = NULL; done: @@ -27028,9 +27219,9 @@ _gather_166_rule(Parser *p) return _res; } -// _loop0_169: ',' (argument_pattern | error_star) +// _loop0_170: ',' (argument_pattern | error_star) static asdl_seq * -_loop0_169_rule(Parser *p) +_loop0_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27054,13 +27245,13 @@ _loop0_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); + D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_181_rule(p)) // argument_pattern | error_star + (elem = _tmp_182_rule(p)) // argument_pattern | error_star ) { _res = elem; @@ -27085,7 +27276,7 @@ _loop0_169_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (argument_pattern | error_star)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27098,14 +27289,14 @@ _loop0_169_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_169_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); D(p->level--); return _seq; } -// _gather_168: (argument_pattern | error_star) _loop0_169 +// _gather_169: (argument_pattern | error_star) _loop0_170 static asdl_seq * -_gather_168_rule(Parser *p) +_gather_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27114,27 +27305,27 @@ _gather_168_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (argument_pattern | error_star) _loop0_169 + { // (argument_pattern | error_star) _loop0_170 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); + D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_181_rule(p)) // argument_pattern | error_star + (elem = _tmp_182_rule(p)) // argument_pattern | error_star && - (seq = _loop0_169_rule(p)) // _loop0_169 + (seq = _loop0_170_rule(p)) // _loop0_170 ) { - D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); + D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_168[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_169")); + D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); } _res = NULL; done: @@ -27142,9 +27333,9 @@ _gather_168_rule(Parser *p) return _res; } -// _tmp_170: '@' named_expression NEWLINE +// _tmp_171: '@' named_expression NEWLINE static void * -_tmp_170_rule(Parser *p) +_tmp_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27158,7 +27349,7 @@ _tmp_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -27170,7 +27361,7 @@ _tmp_170_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27180,7 +27371,7 @@ _tmp_170_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -27189,9 +27380,9 @@ _tmp_170_rule(Parser *p) return _res; } -// _tmp_171: ',' star_expression +// _tmp_172: ',' star_expression static void * -_tmp_171_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27205,7 +27396,7 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -27214,7 +27405,7 @@ _tmp_171_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27224,7 +27415,7 @@ _tmp_171_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -27233,9 +27424,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: ',' expression +// _tmp_173: ',' expression static void * -_tmp_172_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27249,7 +27440,7 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -27258,7 +27449,7 @@ _tmp_172_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27268,7 +27459,7 @@ _tmp_172_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -27277,9 +27468,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: 'or' conjunction +// _tmp_174: 'or' conjunction static void * -_tmp_173_rule(Parser *p) +_tmp_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27293,7 +27484,7 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -27302,7 +27493,7 @@ _tmp_173_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27312,7 +27503,7 @@ _tmp_173_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -27321,9 +27512,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: 'and' inversion +// _tmp_175: 'and' inversion static void * -_tmp_174_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27337,7 +27528,7 @@ _tmp_174_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -27346,7 +27537,7 @@ _tmp_174_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27356,7 +27547,7 @@ _tmp_174_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -27365,9 +27556,9 @@ _tmp_174_rule(Parser *p) return _res; } -// _tmp_175: 'if' disjunction +// _tmp_176: 'if' disjunction static void * -_tmp_175_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27381,7 +27572,7 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27390,7 +27581,7 @@ _tmp_175_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27400,7 +27591,7 @@ _tmp_175_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27409,9 +27600,9 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: 'if' disjunction +// _tmp_177: 'if' disjunction static void * -_tmp_176_rule(Parser *p) +_tmp_177_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27425,7 +27616,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27434,7 +27625,7 @@ _tmp_176_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27444,7 +27635,7 @@ _tmp_176_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27453,9 +27644,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: ',' star_target +// _tmp_178: ',' star_target static void * -_tmp_177_rule(Parser *p) +_tmp_178_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27469,7 +27660,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -27478,7 +27669,7 @@ _tmp_177_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27488,7 +27679,7 @@ _tmp_177_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -27497,9 +27688,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _loop1_178: param_with_default +// _loop1_179: param_with_default static asdl_seq * -_loop1_178_rule(Parser *p) +_loop1_179_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27523,7 +27714,7 @@ _loop1_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -27545,7 +27736,7 @@ _loop1_178_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -27563,14 +27754,14 @@ _loop1_178_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_178_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_179_type, _seq); D(p->level--); return _seq; } -// _tmp_179: ')' | '**' +// _tmp_180: ')' | '**' static void * -_tmp_179_rule(Parser *p) +_tmp_180_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27584,18 +27775,18 @@ _tmp_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -27603,18 +27794,18 @@ _tmp_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27623,9 +27814,9 @@ _tmp_179_rule(Parser *p) return _res; } -// _tmp_180: ':' | '**' +// _tmp_181: ':' | '**' static void * -_tmp_180_rule(Parser *p) +_tmp_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27639,18 +27830,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -27658,18 +27849,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27678,9 +27869,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: argument_pattern | error_star +// _tmp_182: argument_pattern | error_star static void * -_tmp_181_rule(Parser *p) +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27694,18 +27885,18 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); void *argument_pattern_var; if ( (argument_pattern_var = argument_pattern_rule(p)) // argument_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); _res = argument_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern")); } { // error_star @@ -27713,18 +27904,18 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); expr_ty error_star_var; if ( (error_star_var = error_star_rule(p)) // error_star ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); _res = error_star_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); } _res = NULL; diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 52d3372db8e068..0ff36860df3c31 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -746,6 +746,47 @@ astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) return 1; } +static int +astfold_pattern_negative(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) +{ + assert(node_->kind == UnaryOp_kind); + assert(node_->v.UnaryOp.op == USub); + assert(node_->v.UnaryOp.operand->kind == Constant_kind); + PyObject *value = node_->v.UnaryOp.operand->v.Constant.value; + assert(PyComplex_CheckExact(value) || PyFloat_CheckExact(value) || PyLong_CheckExact(value)); + PyObject *negated = PyNumber_Negative(value); + if (!negated) { + return 0; + } + return make_const(node_, negated, ctx_); +} + +static int +astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) +{ + expr_ty left = node_->v.BinOp.left; + if (left->kind == UnaryOp_kind) { + CALL(astfold_pattern_negative, expr_ty, left); + } + expr_ty right = node_->v.BinOp.right; + assert(node_->v.BinOp.op == Add || node_->v.BinOp.op == Sub); + assert(node_->v.BinOp.left->kind = Constant_kind); + assert(node_->v.BinOp.right->kind = Constant_kind); + assert(PyFloat_CheckExact(left->v.Constant.value) || PyLong_CheckExact(left->v.Constant.value)); + assert(PyComplex_CheckExact(right->v.Constant.value)); + PyObject *new; + if (node_->v.BinOp.op == Add) { + new = PyNumber_Add(left->v.Constant.value, right->v.Constant.value); + } + else { + new = PyNumber_Subtract(left->v.Constant.value, right->v.Constant.value); + } + if (!new) { + return 0; + } + return make_const(node_, new, ctx_); +} + static int astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { @@ -754,6 +795,10 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) switch (node_->kind) { case Attribute_kind: case Constant_kind: + return 1; + case BinOp_kind: + CALL(astfold_pattern_complex, expr_ty, node_); + return 1; case BoolOp_kind: // TODO: Quite a bit of potential here. case Dict_kind: @@ -762,16 +807,8 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case NamedExpr_kind: return 1; case UnaryOp_kind: - assert(node_->kind == UnaryOp_kind); - assert(node_->v.UnaryOp.op == USub); - assert(node_->v.UnaryOp.operand->kind == Constant_kind); - PyObject *value = node_->v.UnaryOp.operand->v.Constant.value; - assert(PyComplex_CheckExact(value) || PyFloat_CheckExact(value) || PyLong_CheckExact(value)); - PyObject *negated = PyNumber_Negative(value); - if (!negated) { - return 0; - } - return make_const(node_, negated, ctx_); + CALL(astfold_pattern_negative, expr_ty, node_); + return 1; default: Py_UNREACHABLE(); } From 1eddf273efd3493065b693400816434bbeecd3cd Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 2 Jun 2020 07:55:05 -0700 Subject: [PATCH 055/218] Fix AST validation --- Python/ast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/ast.c b/Python/ast.c index 8cdee5bf672f76..b149e07a1c8bd7 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -311,6 +311,8 @@ validate_pattern(expr_ty p) switch (p->kind) { case Attribute_kind: return validate_expr(p, Load); + case BinOp_kind: + return 1; case BoolOp_kind: if (p->v.BoolOp.op != Or) { PyErr_SetString(PyExc_ValueError, From 04bad8e5ad470b64d0a03ec598d89eaf112916fc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 2 Jun 2020 08:41:30 -0700 Subject: [PATCH 056/218] MATCH_TYPE -> DESTRUCTURE --- Doc/library/dis.rst | 13 ++++++++----- Include/opcode.h | 2 +- Lib/importlib/_bootstrap_external.py | 4 ++-- Lib/opcode.py | 2 +- Python/ceval.c | 2 +- Python/compile.c | 4 ++-- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index ce12b7a2fdb2d1..c2d79e9dd6f774 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1019,11 +1019,14 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_TYPE (delta) - - Pop TOS and TOS1. If TOS is an instance of :class:`type` and has a - ``__match__`` method, call it on TOS1 and push the result onto the stack if - it is not ``None``. Otherwise, increment the bytecode counter by ``delta``. +.. opcode:: DESTRUCTURE (argcount) + + Pop TOS, TOS1, and TOS2. If TOS1 is an instance of :class:`type` and has a + ``__match__`` method, call it on TOS2. If the result is not ``None``, + destrucuture it into ``argcount`` components (using any keyword names from + the :class:`tuple` at TOS), collect these into a tuple, and push that onto + the stack, followed by ``True``. Otherwise, push ``None``, followed by + ``False``. .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index 00e68040f2ae4e..07b1d80dd8986a 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -130,7 +130,7 @@ extern "C" { #define MATCH_KEY 166 #define MATCH_MAP 167 #define MATCH_SEQ 168 -#define MATCH_TYPE 169 +#define DESTRUCTURE 169 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 635e62ddaeb01b..47ccd046ee0b84 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3439 (add MATCH_KEY, MATCH_MAP, MATCH_SEQ, MATCH_TYPE) +# Python 3.10a0 3439 (add DESTRUCTURE, MATCH_KEY, MATCH_MAP, MATCH_SEQ) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3439).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3440).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 37a6ed4be6776b..24315fd55a9315 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -216,6 +216,6 @@ def jabs_op(name, op): jrel_op('MATCH_KEY', 166) jrel_op('MATCH_MAP', 167) jrel_op('MATCH_SEQ', 168) -jrel_op('MATCH_TYPE', 169) +jrel_op('DESTRUCTURE', 169) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index 0fdd68e2422cd8..08480844459053 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3410,7 +3410,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_TYPE): { + case TARGET(DESTRUCTURE): { PyObject *type = TOP(); PyObject *target = SECOND(); if (!PyType_Check(type)) { diff --git a/Python/compile.c b/Python/compile.c index b541ae59d540a2..8c4ec1b3742d36 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -986,8 +986,8 @@ stack_effect(int opcode, int oparg, int jump) case MATCH_MAP: case MATCH_SEQ: return jump > 0 ? -1 : 0; - case MATCH_TYPE: - return jump > 0 ? -2 : 0; + case DESTRUCTURE: + return -1; case STORE_ATTR: return -2; diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 120adff2d1d04e..b0a3575fd29166 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,111,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,112,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 785515709378b6..b0c7e0fe5f6226 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -168,7 +168,7 @@ static void *opcode_targets[256] = { &&TARGET_MATCH_KEY, &&TARGET_MATCH_MAP, &&TARGET_MATCH_SEQ, - &&TARGET_MATCH_TYPE, + &&TARGET_DESTRUCTURE, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From e4be1872dc48c6298dec40608f581324bd529be4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 2 Jun 2020 11:47:25 -0700 Subject: [PATCH 057/218] Fix attribute parsing --- Grammar/python.gram | 12 +- Lib/test/test_patma.py | 61 + Parser/pegen/parse.c | 3093 +++++++++++++++++++++------------------- 3 files changed, 1701 insertions(+), 1465 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 02ba1f15b44899..f25e710c335f22 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -238,10 +238,10 @@ literal_pattern: | 'False' { _Py_Constant(Py_False, NULL, EXTRA) } constant_pattern: - | '.' name=NAME { + | '.' name=NAME !('.' | '(' | '=') { name } - | value=name_or_attr '.' attr=NAME !'(' { - _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } + | '.'? attr=attr !('.' | '(' | '=') { + attr } group_pattern: | '(' pattern=pattern ')' { pattern } @@ -269,10 +269,12 @@ signed_number: | NUMBER | '-' number=NUMBER { _Py_UnaryOp(USub, number, EXTRA) } -name_or_attr: - | NAME +attr: | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } +name_or_attr: + | attr + | NAME values_pattern: | values=','.value_pattern+ ','? { values } diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 41980f475688a1..2524dd7ec7b28a 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1556,6 +1556,67 @@ def test_patma_110(self) -> None: self.assertEqual(x, -0.25 - 1.75j) self.assertEqual(y, 0) + def test_patma_111(self) -> None: + class A: + B = 0 + x = 0 + match x: + case .A.B: + y = 0 + self.assertEqual(A.B, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_112(self) -> None: + class A: + class B: + C = 0 + x = 0 + match x: + case A.B.C: + y = 0 + self.assertEqual(A.B.C, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_113(self) -> None: + class A: + class B: + C = 0 + x = 0 + match x: + case .A.B.C: + y = 0 + self.assertEqual(A.B.C, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_114(self) -> None: + class A: + class B: + class C: + D = 0 + x = 0 + match x: + case .A.B.C.D: + y = 0 + self.assertEqual(A.B.C.D, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_115(self) -> None: + class A: + class B: + class C: + D = 0 + x = 0 + match x: + case .A.B.C.D: + y = 0 + self.assertEqual(A.B.C.D, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 25632984bbf7b8..123d6c3ede8542 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -127,314 +127,317 @@ static KeywordToken *reserved_keywords[] = { #define mapping_pattern_type 1049 #define class_pattern_type 1050 #define signed_number_type 1051 -#define name_or_attr_type 1052 // Left-recursive -#define values_pattern_type 1053 -#define items_pattern_type 1054 -#define keyword_pattern_type 1055 -#define argument_pattern_type 1056 -#define error_star_type 1057 -#define value_pattern_type 1058 -#define key_value_pattern_type 1059 -#define return_stmt_type 1060 -#define raise_stmt_type 1061 -#define function_def_type 1062 -#define function_def_raw_type 1063 -#define func_type_comment_type 1064 -#define params_type 1065 -#define parameters_type 1066 -#define slash_no_default_type 1067 -#define slash_with_default_type 1068 -#define star_etc_type 1069 -#define kwds_type 1070 -#define param_no_default_type 1071 -#define param_with_default_type 1072 -#define param_maybe_default_type 1073 -#define param_type 1074 -#define annotation_type 1075 -#define default_type 1076 -#define decorators_type 1077 -#define class_def_type 1078 -#define class_def_raw_type 1079 -#define block_type 1080 -#define expressions_list_type 1081 -#define star_expressions_type 1082 -#define star_expression_type 1083 -#define star_named_expressions_type 1084 -#define star_named_expression_type 1085 -#define named_expression_type 1086 -#define annotated_rhs_type 1087 -#define expressions_type 1088 -#define expression_type 1089 -#define lambdef_type 1090 -#define lambda_parameters_type 1091 -#define lambda_slash_no_default_type 1092 -#define lambda_slash_with_default_type 1093 -#define lambda_star_etc_type 1094 -#define lambda_kwds_type 1095 -#define lambda_param_no_default_type 1096 -#define lambda_param_with_default_type 1097 -#define lambda_param_maybe_default_type 1098 -#define lambda_param_type 1099 -#define disjunction_type 1100 -#define conjunction_type 1101 -#define inversion_type 1102 -#define comparison_type 1103 -#define compare_op_bitwise_or_pair_type 1104 -#define eq_bitwise_or_type 1105 -#define noteq_bitwise_or_type 1106 -#define lte_bitwise_or_type 1107 -#define lt_bitwise_or_type 1108 -#define gte_bitwise_or_type 1109 -#define gt_bitwise_or_type 1110 -#define notin_bitwise_or_type 1111 -#define in_bitwise_or_type 1112 -#define isnot_bitwise_or_type 1113 -#define is_bitwise_or_type 1114 -#define bitwise_or_type 1115 // Left-recursive -#define bitwise_xor_type 1116 // Left-recursive -#define bitwise_and_type 1117 // Left-recursive -#define shift_expr_type 1118 // Left-recursive -#define sum_type 1119 // Left-recursive -#define term_type 1120 // Left-recursive -#define factor_type 1121 -#define power_type 1122 -#define await_primary_type 1123 -#define primary_type 1124 // Left-recursive -#define slices_type 1125 -#define slice_type 1126 -#define atom_type 1127 -#define strings_type 1128 -#define list_type 1129 -#define listcomp_type 1130 -#define tuple_type 1131 -#define group_type 1132 -#define genexp_type 1133 -#define set_type 1134 -#define setcomp_type 1135 -#define dict_type 1136 -#define dictcomp_type 1137 -#define double_starred_kvpairs_type 1138 -#define double_starred_kvpair_type 1139 -#define kvpair_type 1140 -#define for_if_clauses_type 1141 -#define for_if_clause_type 1142 -#define yield_expr_type 1143 -#define arguments_type 1144 -#define args_type 1145 -#define kwargs_type 1146 -#define starred_expression_type 1147 -#define kwarg_or_starred_type 1148 -#define kwarg_or_double_starred_type 1149 -#define star_targets_type 1150 -#define star_targets_seq_type 1151 -#define star_target_type 1152 -#define star_atom_type 1153 -#define single_target_type 1154 -#define single_subscript_attribute_target_type 1155 -#define del_targets_type 1156 -#define del_target_type 1157 -#define del_t_atom_type 1158 -#define del_target_end_type 1159 -#define targets_type 1160 -#define target_type 1161 -#define t_primary_type 1162 // Left-recursive -#define t_lookahead_type 1163 -#define t_atom_type 1164 -#define incorrect_arguments_type 1165 -#define invalid_kwarg_type 1166 -#define invalid_named_expression_type 1167 -#define invalid_assignment_type 1168 -#define invalid_block_type 1169 -#define invalid_comprehension_type 1170 -#define invalid_dict_comprehension_type 1171 -#define invalid_parameters_type 1172 -#define invalid_star_etc_type 1173 -#define invalid_lambda_star_etc_type 1174 -#define invalid_double_type_comments_type 1175 -#define invalid_del_target_type 1176 -#define invalid_import_from_targets_type 1177 -#define _loop0_1_type 1178 -#define _loop0_2_type 1179 -#define _loop0_4_type 1180 -#define _gather_3_type 1181 -#define _loop0_6_type 1182 -#define _gather_5_type 1183 -#define _loop0_8_type 1184 -#define _gather_7_type 1185 -#define _loop0_10_type 1186 -#define _gather_9_type 1187 -#define _loop1_11_type 1188 -#define _loop0_13_type 1189 -#define _gather_12_type 1190 -#define _tmp_14_type 1191 -#define _tmp_15_type 1192 -#define _tmp_16_type 1193 -#define _tmp_17_type 1194 -#define _tmp_18_type 1195 -#define _tmp_19_type 1196 -#define _tmp_20_type 1197 -#define _tmp_21_type 1198 -#define _loop1_22_type 1199 -#define _tmp_23_type 1200 -#define _tmp_24_type 1201 -#define _loop0_26_type 1202 -#define _gather_25_type 1203 -#define _loop0_28_type 1204 -#define _gather_27_type 1205 -#define _tmp_29_type 1206 -#define _loop0_30_type 1207 -#define _loop1_31_type 1208 -#define _loop0_33_type 1209 -#define _gather_32_type 1210 -#define _tmp_34_type 1211 -#define _loop0_36_type 1212 -#define _gather_35_type 1213 -#define _tmp_37_type 1214 -#define _loop0_39_type 1215 -#define _gather_38_type 1216 -#define _loop0_41_type 1217 -#define _gather_40_type 1218 -#define _loop0_43_type 1219 -#define _gather_42_type 1220 -#define _loop0_45_type 1221 -#define _gather_44_type 1222 -#define _tmp_46_type 1223 -#define _loop1_47_type 1224 -#define _tmp_48_type 1225 -#define _loop1_49_type 1226 -#define _loop0_51_type 1227 -#define _gather_50_type 1228 -#define _tmp_52_type 1229 -#define _tmp_53_type 1230 -#define _loop0_55_type 1231 -#define _gather_54_type 1232 -#define _loop0_57_type 1233 -#define _gather_56_type 1234 -#define _loop0_59_type 1235 -#define _gather_58_type 1236 -#define _loop0_61_type 1237 -#define _gather_60_type 1238 -#define _tmp_62_type 1239 -#define _loop0_64_type 1240 -#define _gather_63_type 1241 -#define _tmp_65_type 1242 -#define _tmp_66_type 1243 -#define _tmp_67_type 1244 -#define _loop0_69_type 1245 -#define _gather_68_type 1246 -#define _loop0_71_type 1247 -#define _gather_70_type 1248 -#define _tmp_72_type 1249 -#define _tmp_73_type 1250 -#define _tmp_74_type 1251 -#define _tmp_75_type 1252 -#define _tmp_76_type 1253 -#define _tmp_77_type 1254 -#define _loop0_78_type 1255 -#define _loop0_79_type 1256 -#define _loop0_80_type 1257 -#define _loop1_81_type 1258 -#define _loop0_82_type 1259 -#define _loop1_83_type 1260 -#define _loop1_84_type 1261 -#define _loop1_85_type 1262 -#define _loop0_86_type 1263 -#define _loop1_87_type 1264 -#define _loop0_88_type 1265 -#define _loop1_89_type 1266 -#define _loop0_90_type 1267 -#define _loop1_91_type 1268 -#define _loop1_92_type 1269 -#define _tmp_93_type 1270 -#define _loop0_95_type 1271 -#define _gather_94_type 1272 -#define _loop1_96_type 1273 -#define _loop0_98_type 1274 -#define _gather_97_type 1275 -#define _loop1_99_type 1276 +#define attr_type 1052 // Left-recursive +#define name_or_attr_type 1053 // Left-recursive +#define values_pattern_type 1054 +#define items_pattern_type 1055 +#define keyword_pattern_type 1056 +#define argument_pattern_type 1057 +#define error_star_type 1058 +#define value_pattern_type 1059 +#define key_value_pattern_type 1060 +#define return_stmt_type 1061 +#define raise_stmt_type 1062 +#define function_def_type 1063 +#define function_def_raw_type 1064 +#define func_type_comment_type 1065 +#define params_type 1066 +#define parameters_type 1067 +#define slash_no_default_type 1068 +#define slash_with_default_type 1069 +#define star_etc_type 1070 +#define kwds_type 1071 +#define param_no_default_type 1072 +#define param_with_default_type 1073 +#define param_maybe_default_type 1074 +#define param_type 1075 +#define annotation_type 1076 +#define default_type 1077 +#define decorators_type 1078 +#define class_def_type 1079 +#define class_def_raw_type 1080 +#define block_type 1081 +#define expressions_list_type 1082 +#define star_expressions_type 1083 +#define star_expression_type 1084 +#define star_named_expressions_type 1085 +#define star_named_expression_type 1086 +#define named_expression_type 1087 +#define annotated_rhs_type 1088 +#define expressions_type 1089 +#define expression_type 1090 +#define lambdef_type 1091 +#define lambda_parameters_type 1092 +#define lambda_slash_no_default_type 1093 +#define lambda_slash_with_default_type 1094 +#define lambda_star_etc_type 1095 +#define lambda_kwds_type 1096 +#define lambda_param_no_default_type 1097 +#define lambda_param_with_default_type 1098 +#define lambda_param_maybe_default_type 1099 +#define lambda_param_type 1100 +#define disjunction_type 1101 +#define conjunction_type 1102 +#define inversion_type 1103 +#define comparison_type 1104 +#define compare_op_bitwise_or_pair_type 1105 +#define eq_bitwise_or_type 1106 +#define noteq_bitwise_or_type 1107 +#define lte_bitwise_or_type 1108 +#define lt_bitwise_or_type 1109 +#define gte_bitwise_or_type 1110 +#define gt_bitwise_or_type 1111 +#define notin_bitwise_or_type 1112 +#define in_bitwise_or_type 1113 +#define isnot_bitwise_or_type 1114 +#define is_bitwise_or_type 1115 +#define bitwise_or_type 1116 // Left-recursive +#define bitwise_xor_type 1117 // Left-recursive +#define bitwise_and_type 1118 // Left-recursive +#define shift_expr_type 1119 // Left-recursive +#define sum_type 1120 // Left-recursive +#define term_type 1121 // Left-recursive +#define factor_type 1122 +#define power_type 1123 +#define await_primary_type 1124 +#define primary_type 1125 // Left-recursive +#define slices_type 1126 +#define slice_type 1127 +#define atom_type 1128 +#define strings_type 1129 +#define list_type 1130 +#define listcomp_type 1131 +#define tuple_type 1132 +#define group_type 1133 +#define genexp_type 1134 +#define set_type 1135 +#define setcomp_type 1136 +#define dict_type 1137 +#define dictcomp_type 1138 +#define double_starred_kvpairs_type 1139 +#define double_starred_kvpair_type 1140 +#define kvpair_type 1141 +#define for_if_clauses_type 1142 +#define for_if_clause_type 1143 +#define yield_expr_type 1144 +#define arguments_type 1145 +#define args_type 1146 +#define kwargs_type 1147 +#define starred_expression_type 1148 +#define kwarg_or_starred_type 1149 +#define kwarg_or_double_starred_type 1150 +#define star_targets_type 1151 +#define star_targets_seq_type 1152 +#define star_target_type 1153 +#define star_atom_type 1154 +#define single_target_type 1155 +#define single_subscript_attribute_target_type 1156 +#define del_targets_type 1157 +#define del_target_type 1158 +#define del_t_atom_type 1159 +#define del_target_end_type 1160 +#define targets_type 1161 +#define target_type 1162 +#define t_primary_type 1163 // Left-recursive +#define t_lookahead_type 1164 +#define t_atom_type 1165 +#define incorrect_arguments_type 1166 +#define invalid_kwarg_type 1167 +#define invalid_named_expression_type 1168 +#define invalid_assignment_type 1169 +#define invalid_block_type 1170 +#define invalid_comprehension_type 1171 +#define invalid_dict_comprehension_type 1172 +#define invalid_parameters_type 1173 +#define invalid_star_etc_type 1174 +#define invalid_lambda_star_etc_type 1175 +#define invalid_double_type_comments_type 1176 +#define invalid_del_target_type 1177 +#define invalid_import_from_targets_type 1178 +#define _loop0_1_type 1179 +#define _loop0_2_type 1180 +#define _loop0_4_type 1181 +#define _gather_3_type 1182 +#define _loop0_6_type 1183 +#define _gather_5_type 1184 +#define _loop0_8_type 1185 +#define _gather_7_type 1186 +#define _loop0_10_type 1187 +#define _gather_9_type 1188 +#define _loop1_11_type 1189 +#define _loop0_13_type 1190 +#define _gather_12_type 1191 +#define _tmp_14_type 1192 +#define _tmp_15_type 1193 +#define _tmp_16_type 1194 +#define _tmp_17_type 1195 +#define _tmp_18_type 1196 +#define _tmp_19_type 1197 +#define _tmp_20_type 1198 +#define _tmp_21_type 1199 +#define _loop1_22_type 1200 +#define _tmp_23_type 1201 +#define _tmp_24_type 1202 +#define _loop0_26_type 1203 +#define _gather_25_type 1204 +#define _loop0_28_type 1205 +#define _gather_27_type 1206 +#define _tmp_29_type 1207 +#define _loop0_30_type 1208 +#define _loop1_31_type 1209 +#define _loop0_33_type 1210 +#define _gather_32_type 1211 +#define _tmp_34_type 1212 +#define _loop0_36_type 1213 +#define _gather_35_type 1214 +#define _tmp_37_type 1215 +#define _loop0_39_type 1216 +#define _gather_38_type 1217 +#define _loop0_41_type 1218 +#define _gather_40_type 1219 +#define _loop0_43_type 1220 +#define _gather_42_type 1221 +#define _loop0_45_type 1222 +#define _gather_44_type 1223 +#define _tmp_46_type 1224 +#define _loop1_47_type 1225 +#define _tmp_48_type 1226 +#define _loop1_49_type 1227 +#define _loop0_51_type 1228 +#define _gather_50_type 1229 +#define _tmp_52_type 1230 +#define _tmp_53_type 1231 +#define _tmp_54_type 1232 +#define _tmp_55_type 1233 +#define _loop0_57_type 1234 +#define _gather_56_type 1235 +#define _loop0_59_type 1236 +#define _gather_58_type 1237 +#define _loop0_61_type 1238 +#define _gather_60_type 1239 +#define _loop0_63_type 1240 +#define _gather_62_type 1241 +#define _tmp_64_type 1242 +#define _loop0_66_type 1243 +#define _gather_65_type 1244 +#define _tmp_67_type 1245 +#define _tmp_68_type 1246 +#define _tmp_69_type 1247 +#define _loop0_71_type 1248 +#define _gather_70_type 1249 +#define _loop0_73_type 1250 +#define _gather_72_type 1251 +#define _tmp_74_type 1252 +#define _tmp_75_type 1253 +#define _tmp_76_type 1254 +#define _tmp_77_type 1255 +#define _tmp_78_type 1256 +#define _tmp_79_type 1257 +#define _loop0_80_type 1258 +#define _loop0_81_type 1259 +#define _loop0_82_type 1260 +#define _loop1_83_type 1261 +#define _loop0_84_type 1262 +#define _loop1_85_type 1263 +#define _loop1_86_type 1264 +#define _loop1_87_type 1265 +#define _loop0_88_type 1266 +#define _loop1_89_type 1267 +#define _loop0_90_type 1268 +#define _loop1_91_type 1269 +#define _loop0_92_type 1270 +#define _loop1_93_type 1271 +#define _loop1_94_type 1272 +#define _tmp_95_type 1273 +#define _loop0_97_type 1274 +#define _gather_96_type 1275 +#define _loop1_98_type 1276 #define _loop0_100_type 1277 -#define _loop0_101_type 1278 -#define _loop0_102_type 1279 -#define _loop1_103_type 1280 -#define _loop0_104_type 1281 -#define _loop1_105_type 1282 -#define _loop1_106_type 1283 -#define _loop1_107_type 1284 -#define _loop0_108_type 1285 -#define _loop1_109_type 1286 -#define _loop0_110_type 1287 -#define _loop1_111_type 1288 -#define _loop0_112_type 1289 -#define _loop1_113_type 1290 -#define _loop1_114_type 1291 -#define _loop1_115_type 1292 -#define _loop1_116_type 1293 -#define _tmp_117_type 1294 -#define _loop0_119_type 1295 -#define _gather_118_type 1296 -#define _tmp_120_type 1297 -#define _tmp_121_type 1298 -#define _tmp_122_type 1299 -#define _tmp_123_type 1300 -#define _loop1_124_type 1301 -#define _tmp_125_type 1302 -#define _tmp_126_type 1303 -#define _loop0_128_type 1304 -#define _gather_127_type 1305 -#define _loop1_129_type 1306 +#define _gather_99_type 1278 +#define _loop1_101_type 1279 +#define _loop0_102_type 1280 +#define _loop0_103_type 1281 +#define _loop0_104_type 1282 +#define _loop1_105_type 1283 +#define _loop0_106_type 1284 +#define _loop1_107_type 1285 +#define _loop1_108_type 1286 +#define _loop1_109_type 1287 +#define _loop0_110_type 1288 +#define _loop1_111_type 1289 +#define _loop0_112_type 1290 +#define _loop1_113_type 1291 +#define _loop0_114_type 1292 +#define _loop1_115_type 1293 +#define _loop1_116_type 1294 +#define _loop1_117_type 1295 +#define _loop1_118_type 1296 +#define _tmp_119_type 1297 +#define _loop0_121_type 1298 +#define _gather_120_type 1299 +#define _tmp_122_type 1300 +#define _tmp_123_type 1301 +#define _tmp_124_type 1302 +#define _tmp_125_type 1303 +#define _loop1_126_type 1304 +#define _tmp_127_type 1305 +#define _tmp_128_type 1306 #define _loop0_130_type 1307 -#define _loop0_131_type 1308 -#define _tmp_132_type 1309 -#define _tmp_133_type 1310 -#define _loop0_135_type 1311 -#define _gather_134_type 1312 -#define _loop0_137_type 1313 -#define _gather_136_type 1314 -#define _loop0_139_type 1315 -#define _gather_138_type 1316 -#define _loop0_141_type 1317 -#define _gather_140_type 1318 -#define _loop0_142_type 1319 -#define _loop0_144_type 1320 -#define _gather_143_type 1321 -#define _tmp_145_type 1322 -#define _loop0_147_type 1323 -#define _gather_146_type 1324 -#define _loop0_149_type 1325 -#define _gather_148_type 1326 -#define _tmp_150_type 1327 +#define _gather_129_type 1308 +#define _loop1_131_type 1309 +#define _loop0_132_type 1310 +#define _loop0_133_type 1311 +#define _tmp_134_type 1312 +#define _tmp_135_type 1313 +#define _loop0_137_type 1314 +#define _gather_136_type 1315 +#define _loop0_139_type 1316 +#define _gather_138_type 1317 +#define _loop0_141_type 1318 +#define _gather_140_type 1319 +#define _loop0_143_type 1320 +#define _gather_142_type 1321 +#define _loop0_144_type 1322 +#define _loop0_146_type 1323 +#define _gather_145_type 1324 +#define _tmp_147_type 1325 +#define _loop0_149_type 1326 +#define _gather_148_type 1327 #define _loop0_151_type 1328 -#define _tmp_152_type 1329 -#define _tmp_153_type 1330 -#define _tmp_154_type 1331 -#define _tmp_155_type 1332 -#define _loop0_156_type 1333 -#define _tmp_157_type 1334 -#define _tmp_158_type 1335 -#define _tmp_159_type 1336 -#define _tmp_160_type 1337 -#define _tmp_161_type 1338 -#define _tmp_162_type 1339 -#define _loop0_164_type 1340 -#define _gather_163_type 1341 -#define _loop0_166_type 1342 -#define _gather_165_type 1343 -#define _loop0_168_type 1344 -#define _gather_167_type 1345 -#define _loop0_170_type 1346 -#define _gather_169_type 1347 -#define _tmp_171_type 1348 -#define _tmp_172_type 1349 -#define _tmp_173_type 1350 -#define _tmp_174_type 1351 -#define _tmp_175_type 1352 -#define _tmp_176_type 1353 -#define _tmp_177_type 1354 -#define _tmp_178_type 1355 -#define _loop1_179_type 1356 -#define _tmp_180_type 1357 -#define _tmp_181_type 1358 -#define _tmp_182_type 1359 +#define _gather_150_type 1329 +#define _tmp_152_type 1330 +#define _loop0_153_type 1331 +#define _tmp_154_type 1332 +#define _tmp_155_type 1333 +#define _tmp_156_type 1334 +#define _tmp_157_type 1335 +#define _loop0_158_type 1336 +#define _tmp_159_type 1337 +#define _tmp_160_type 1338 +#define _tmp_161_type 1339 +#define _tmp_162_type 1340 +#define _tmp_163_type 1341 +#define _tmp_164_type 1342 +#define _loop0_166_type 1343 +#define _gather_165_type 1344 +#define _loop0_168_type 1345 +#define _gather_167_type 1346 +#define _loop0_170_type 1347 +#define _gather_169_type 1348 +#define _loop0_172_type 1349 +#define _gather_171_type 1350 +#define _tmp_173_type 1351 +#define _tmp_174_type 1352 +#define _tmp_175_type 1353 +#define _tmp_176_type 1354 +#define _tmp_177_type 1355 +#define _tmp_178_type 1356 +#define _tmp_179_type 1357 +#define _tmp_180_type 1358 +#define _loop1_181_type 1359 +#define _tmp_182_type 1360 +#define _tmp_183_type 1361 +#define _tmp_184_type 1362 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -488,6 +491,7 @@ static void *sequence_pattern_rule(Parser *p); static void *mapping_pattern_rule(Parser *p); static void *class_pattern_rule(Parser *p); static void *signed_number_rule(Parser *p); +static void *attr_rule(Parser *p); static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); @@ -667,135 +671,137 @@ static asdl_seq *_loop0_51_rule(Parser *p); static asdl_seq *_gather_50_rule(Parser *p); static void *_tmp_52_rule(Parser *p); static void *_tmp_53_rule(Parser *p); -static asdl_seq *_loop0_55_rule(Parser *p); -static asdl_seq *_gather_54_rule(Parser *p); +static void *_tmp_54_rule(Parser *p); +static void *_tmp_55_rule(Parser *p); static asdl_seq *_loop0_57_rule(Parser *p); static asdl_seq *_gather_56_rule(Parser *p); static asdl_seq *_loop0_59_rule(Parser *p); static asdl_seq *_gather_58_rule(Parser *p); static asdl_seq *_loop0_61_rule(Parser *p); static asdl_seq *_gather_60_rule(Parser *p); -static void *_tmp_62_rule(Parser *p); -static asdl_seq *_loop0_64_rule(Parser *p); -static asdl_seq *_gather_63_rule(Parser *p); -static void *_tmp_65_rule(Parser *p); -static void *_tmp_66_rule(Parser *p); +static asdl_seq *_loop0_63_rule(Parser *p); +static asdl_seq *_gather_62_rule(Parser *p); +static void *_tmp_64_rule(Parser *p); +static asdl_seq *_loop0_66_rule(Parser *p); +static asdl_seq *_gather_65_rule(Parser *p); static void *_tmp_67_rule(Parser *p); -static asdl_seq *_loop0_69_rule(Parser *p); -static asdl_seq *_gather_68_rule(Parser *p); +static void *_tmp_68_rule(Parser *p); +static void *_tmp_69_rule(Parser *p); static asdl_seq *_loop0_71_rule(Parser *p); static asdl_seq *_gather_70_rule(Parser *p); -static void *_tmp_72_rule(Parser *p); -static void *_tmp_73_rule(Parser *p); +static asdl_seq *_loop0_73_rule(Parser *p); +static asdl_seq *_gather_72_rule(Parser *p); static void *_tmp_74_rule(Parser *p); static void *_tmp_75_rule(Parser *p); static void *_tmp_76_rule(Parser *p); static void *_tmp_77_rule(Parser *p); -static asdl_seq *_loop0_78_rule(Parser *p); -static asdl_seq *_loop0_79_rule(Parser *p); +static void *_tmp_78_rule(Parser *p); +static void *_tmp_79_rule(Parser *p); static asdl_seq *_loop0_80_rule(Parser *p); -static asdl_seq *_loop1_81_rule(Parser *p); +static asdl_seq *_loop0_81_rule(Parser *p); static asdl_seq *_loop0_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static asdl_seq *_loop1_84_rule(Parser *p); +static asdl_seq *_loop0_84_rule(Parser *p); static asdl_seq *_loop1_85_rule(Parser *p); -static asdl_seq *_loop0_86_rule(Parser *p); +static asdl_seq *_loop1_86_rule(Parser *p); static asdl_seq *_loop1_87_rule(Parser *p); static asdl_seq *_loop0_88_rule(Parser *p); static asdl_seq *_loop1_89_rule(Parser *p); static asdl_seq *_loop0_90_rule(Parser *p); static asdl_seq *_loop1_91_rule(Parser *p); -static asdl_seq *_loop1_92_rule(Parser *p); -static void *_tmp_93_rule(Parser *p); -static asdl_seq *_loop0_95_rule(Parser *p); -static asdl_seq *_gather_94_rule(Parser *p); -static asdl_seq *_loop1_96_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_gather_97_rule(Parser *p); -static asdl_seq *_loop1_99_rule(Parser *p); +static asdl_seq *_loop0_92_rule(Parser *p); +static asdl_seq *_loop1_93_rule(Parser *p); +static asdl_seq *_loop1_94_rule(Parser *p); +static void *_tmp_95_rule(Parser *p); +static asdl_seq *_loop0_97_rule(Parser *p); +static asdl_seq *_gather_96_rule(Parser *p); +static asdl_seq *_loop1_98_rule(Parser *p); static asdl_seq *_loop0_100_rule(Parser *p); -static asdl_seq *_loop0_101_rule(Parser *p); +static asdl_seq *_gather_99_rule(Parser *p); +static asdl_seq *_loop1_101_rule(Parser *p); static asdl_seq *_loop0_102_rule(Parser *p); -static asdl_seq *_loop1_103_rule(Parser *p); +static asdl_seq *_loop0_103_rule(Parser *p); static asdl_seq *_loop0_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); -static asdl_seq *_loop1_106_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); static asdl_seq *_loop1_107_rule(Parser *p); -static asdl_seq *_loop0_108_rule(Parser *p); +static asdl_seq *_loop1_108_rule(Parser *p); static asdl_seq *_loop1_109_rule(Parser *p); static asdl_seq *_loop0_110_rule(Parser *p); static asdl_seq *_loop1_111_rule(Parser *p); static asdl_seq *_loop0_112_rule(Parser *p); static asdl_seq *_loop1_113_rule(Parser *p); -static asdl_seq *_loop1_114_rule(Parser *p); +static asdl_seq *_loop0_114_rule(Parser *p); static asdl_seq *_loop1_115_rule(Parser *p); static asdl_seq *_loop1_116_rule(Parser *p); -static void *_tmp_117_rule(Parser *p); -static asdl_seq *_loop0_119_rule(Parser *p); -static asdl_seq *_gather_118_rule(Parser *p); -static void *_tmp_120_rule(Parser *p); -static void *_tmp_121_rule(Parser *p); +static asdl_seq *_loop1_117_rule(Parser *p); +static asdl_seq *_loop1_118_rule(Parser *p); +static void *_tmp_119_rule(Parser *p); +static asdl_seq *_loop0_121_rule(Parser *p); +static asdl_seq *_gather_120_rule(Parser *p); static void *_tmp_122_rule(Parser *p); static void *_tmp_123_rule(Parser *p); -static asdl_seq *_loop1_124_rule(Parser *p); +static void *_tmp_124_rule(Parser *p); static void *_tmp_125_rule(Parser *p); -static void *_tmp_126_rule(Parser *p); -static asdl_seq *_loop0_128_rule(Parser *p); -static asdl_seq *_gather_127_rule(Parser *p); -static asdl_seq *_loop1_129_rule(Parser *p); +static asdl_seq *_loop1_126_rule(Parser *p); +static void *_tmp_127_rule(Parser *p); +static void *_tmp_128_rule(Parser *p); static asdl_seq *_loop0_130_rule(Parser *p); -static asdl_seq *_loop0_131_rule(Parser *p); -static void *_tmp_132_rule(Parser *p); -static void *_tmp_133_rule(Parser *p); -static asdl_seq *_loop0_135_rule(Parser *p); -static asdl_seq *_gather_134_rule(Parser *p); +static asdl_seq *_gather_129_rule(Parser *p); +static asdl_seq *_loop1_131_rule(Parser *p); +static asdl_seq *_loop0_132_rule(Parser *p); +static asdl_seq *_loop0_133_rule(Parser *p); +static void *_tmp_134_rule(Parser *p); +static void *_tmp_135_rule(Parser *p); static asdl_seq *_loop0_137_rule(Parser *p); static asdl_seq *_gather_136_rule(Parser *p); static asdl_seq *_loop0_139_rule(Parser *p); static asdl_seq *_gather_138_rule(Parser *p); static asdl_seq *_loop0_141_rule(Parser *p); static asdl_seq *_gather_140_rule(Parser *p); -static asdl_seq *_loop0_142_rule(Parser *p); +static asdl_seq *_loop0_143_rule(Parser *p); +static asdl_seq *_gather_142_rule(Parser *p); static asdl_seq *_loop0_144_rule(Parser *p); -static asdl_seq *_gather_143_rule(Parser *p); -static void *_tmp_145_rule(Parser *p); -static asdl_seq *_loop0_147_rule(Parser *p); -static asdl_seq *_gather_146_rule(Parser *p); +static asdl_seq *_loop0_146_rule(Parser *p); +static asdl_seq *_gather_145_rule(Parser *p); +static void *_tmp_147_rule(Parser *p); static asdl_seq *_loop0_149_rule(Parser *p); static asdl_seq *_gather_148_rule(Parser *p); -static void *_tmp_150_rule(Parser *p); static asdl_seq *_loop0_151_rule(Parser *p); +static asdl_seq *_gather_150_rule(Parser *p); static void *_tmp_152_rule(Parser *p); -static void *_tmp_153_rule(Parser *p); +static asdl_seq *_loop0_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); static void *_tmp_155_rule(Parser *p); -static asdl_seq *_loop0_156_rule(Parser *p); +static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); -static void *_tmp_158_rule(Parser *p); +static asdl_seq *_loop0_158_rule(Parser *p); static void *_tmp_159_rule(Parser *p); static void *_tmp_160_rule(Parser *p); static void *_tmp_161_rule(Parser *p); static void *_tmp_162_rule(Parser *p); -static asdl_seq *_loop0_164_rule(Parser *p); -static asdl_seq *_gather_163_rule(Parser *p); +static void *_tmp_163_rule(Parser *p); +static void *_tmp_164_rule(Parser *p); static asdl_seq *_loop0_166_rule(Parser *p); static asdl_seq *_gather_165_rule(Parser *p); static asdl_seq *_loop0_168_rule(Parser *p); static asdl_seq *_gather_167_rule(Parser *p); static asdl_seq *_loop0_170_rule(Parser *p); static asdl_seq *_gather_169_rule(Parser *p); -static void *_tmp_171_rule(Parser *p); -static void *_tmp_172_rule(Parser *p); +static asdl_seq *_loop0_172_rule(Parser *p); +static asdl_seq *_gather_171_rule(Parser *p); static void *_tmp_173_rule(Parser *p); static void *_tmp_174_rule(Parser *p); static void *_tmp_175_rule(Parser *p); static void *_tmp_176_rule(Parser *p); static void *_tmp_177_rule(Parser *p); static void *_tmp_178_rule(Parser *p); -static asdl_seq *_loop1_179_rule(Parser *p); +static void *_tmp_179_rule(Parser *p); static void *_tmp_180_rule(Parser *p); -static void *_tmp_181_rule(Parser *p); +static asdl_seq *_loop1_181_rule(Parser *p); static void *_tmp_182_rule(Parser *p); +static void *_tmp_183_rule(Parser *p); +static void *_tmp_184_rule(Parser *p); // file: statements? $ @@ -5442,7 +5448,7 @@ literal_pattern_rule(Parser *p) return _res; } -// constant_pattern: '.' NAME | name_or_attr '.' NAME !'(' +// constant_pattern: '.' NAME !('.' | '(' | '=') | '.'? attr !('.' | '(' | '=') static void * constant_pattern_rule(Parser *p) { @@ -5453,30 +5459,23 @@ constant_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '.' NAME + { // '.' NAME !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); Token * _literal; expr_ty name; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' && (name = _PyPegen_name_token(p)) // NAME + && + _PyPegen_lookahead(0, _tmp_54_rule, p) ) { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.' NAME")); + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); _res = name; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5487,38 +5486,27 @@ constant_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); } - { // name_or_attr '.' NAME !'(' + { // '.'? attr !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME !'('")); - Token * _literal; - expr_ty attr; - void *value; + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + void *attr; if ( - (value = name_or_attr_rule(p)) // name_or_attr + (_opt_var = _PyPegen_expect_token(p, 23), 1) // '.'? && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - && - (attr = _PyPegen_name_token(p)) // NAME + (attr = attr_rule(p)) // attr && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='(' + _PyPegen_lookahead(0, _tmp_55_rule, p) ) { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME !'('")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); + _res = attr; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5528,7 +5516,7 @@ constant_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME !'('")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); } _res = NULL; done: @@ -5795,7 +5783,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_54_rule(p)) // ','.pattern+ + (args = _gather_56_rule(p)) // ','.pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5841,7 +5829,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (keywords = _gather_56_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_58_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5889,11 +5877,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_58_rule(p)) // ','.pattern+ + (args = _gather_60_rule(p)) // ','.pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (keywords = _gather_60_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_62_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5928,7 +5916,7 @@ class_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); - asdl_seq * _gather_63_var; + asdl_seq * _gather_65_var; Token * _literal; Token * _literal_1; Token * _literal_2; @@ -5945,15 +5933,15 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_62_rule(p), 1) // [','.pattern+ ','] + (_opt_var = _tmp_64_rule(p), 1) // [','.pattern+ ','] && - (_gather_63_var = _gather_63_rule(p)) // ','.keyword_pattern+ + (_gather_65_var = _gather_65_rule(p)) // ','.keyword_pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_65_rule(p), 1) // [',' ','.argument_pattern+] + (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.argument_pattern+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -5994,11 +5982,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_66_rule(p), 1) // [','.argument_pattern+ ','] + (_opt_var = _tmp_68_rule(p), 1) // [','.argument_pattern+ ','] && (error = error_star_rule(p)) // error_star && - (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] + (_opt_var_1 = _tmp_69_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6106,27 +6094,27 @@ signed_number_rule(Parser *p) } // Left-recursive -// name_or_attr: NAME | name_or_attr '.' NAME -static void * name_or_attr_raw(Parser *); +// attr: name_or_attr '.' NAME +static void * attr_raw(Parser *); static void * -name_or_attr_rule(Parser *p) +attr_rule(Parser *p) { D(p->level++); void * _res = NULL; - if (_PyPegen_is_memoized(p, name_or_attr_type, &_res)) { + if (_PyPegen_is_memoized(p, attr_type, &_res)) { D(p->level--); return _res; } int _mark = p->mark; int _resmark = p->mark; while (1) { - int tmpvar_1 = _PyPegen_update_memo(p, _mark, name_or_attr_type, _res); + int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); if (tmpvar_1) { D(p->level--); return _res; } p->mark = _mark; - void *_raw = name_or_attr_raw(p); + void *_raw = attr_raw(p); if (_raw == NULL || p->mark <= _resmark) break; _resmark = p->mark; @@ -6137,7 +6125,7 @@ name_or_attr_rule(Parser *p) return _res; } static void * -name_or_attr_raw(Parser *p) +attr_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6155,31 +6143,12 @@ name_or_attr_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); - expr_ty name_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = name_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); - } { // name_or_attr '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); + D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token * _literal; expr_ty attr; void *value; @@ -6191,7 +6160,7 @@ name_or_attr_raw(Parser *p) (attr = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); + D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6210,7 +6179,7 @@ name_or_attr_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); } _res = NULL; @@ -6219,6 +6188,62 @@ name_or_attr_raw(Parser *p) return _res; } +// Left-recursive +// name_or_attr: attr | NAME +static void * +name_or_attr_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // attr + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); + void *attr_var; + if ( + (attr_var = attr_rule(p)) // attr + ) + { + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); + _res = attr_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); + } + { // NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty name_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = name_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // values_pattern: ','.value_pattern+ ','? static void * values_pattern_rule(Parser *p) @@ -6240,7 +6265,7 @@ values_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * values; if ( - (values = _gather_68_rule(p)) // ','.value_pattern+ + (values = _gather_70_rule(p)) // ','.value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6285,7 +6310,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_70_rule(p)) // ','.key_value_pattern+ + (items = _gather_72_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6446,10 +6471,10 @@ error_star_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> error_star[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); - void *_tmp_72_var; + void *_tmp_74_var; expr_ty error; if ( - (_tmp_72_var = _tmp_72_rule(p)) // '*' | '**' + (_tmp_74_var = _tmp_74_rule(p)) // '*' | '**' && (error = _PyPegen_name_token(p)) // NAME ) @@ -6577,7 +6602,7 @@ key_value_pattern_rule(Parser *p) void *key; void *value; if ( - (key = _tmp_73_rule(p)) // literal_pattern | constant_pattern + (key = _tmp_75_rule(p)) // literal_pattern | constant_pattern && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6726,7 +6751,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_74_rule(p), 1) // ['from' expression] + (b = _tmp_76_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -6901,7 +6926,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_75_rule(p), 1) // ['->' expression] + (a = _tmp_77_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6961,7 +6986,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_76_rule(p), 1) // ['->' expression] + (a = _tmp_78_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7025,7 +7050,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_77_rule, p) + _PyPegen_lookahead(1, _tmp_79_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -7169,9 +7194,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_78_rule(p)) // param_no_default* + (b = _loop0_80_rule(p)) // param_no_default* && - (c = _loop0_79_rule(p)) // param_with_default* + (c = _loop0_81_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -7201,7 +7226,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_80_rule(p)) // param_with_default* + (b = _loop0_82_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7229,9 +7254,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_81_rule(p)) // param_no_default+ + (a = _loop1_83_rule(p)) // param_no_default+ && - (b = _loop0_82_rule(p)) // param_with_default* + (b = _loop0_84_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7258,7 +7283,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_83_rule(p)) // param_with_default+ + (a = _loop1_85_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -7327,7 +7352,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_84_rule(p)) // param_no_default+ + (a = _loop1_86_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7356,7 +7381,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_85_rule(p)) // param_no_default+ + (a = _loop1_87_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7406,9 +7431,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_86_rule(p)) // param_no_default* + (a = _loop0_88_rule(p)) // param_no_default* && - (b = _loop1_87_rule(p)) // param_with_default+ + (b = _loop1_89_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7438,9 +7463,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_88_rule(p)) // param_no_default* + (a = _loop0_90_rule(p)) // param_no_default* && - (b = _loop1_89_rule(p)) // param_with_default+ + (b = _loop1_91_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7496,7 +7521,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_90_rule(p)) // param_maybe_default* + (b = _loop0_92_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7529,7 +7554,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_91_rule(p)) // param_maybe_default+ + (b = _loop1_93_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -8051,7 +8076,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_92_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_94_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -8172,7 +8197,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_93_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_95_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -8321,7 +8346,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_94_rule(p)) // ','.star_expression+ + (a = _gather_96_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8381,7 +8406,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_96_rule(p)) // ((',' star_expression))+ + (b = _loop1_98_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8576,7 +8601,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_97_rule(p)) // ','.star_named_expression+ + (a = _gather_99_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8874,7 +8899,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_99_rule(p)) // ((',' expression))+ + (b = _loop1_101_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9173,9 +9198,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_100_rule(p)) // lambda_param_no_default* + (b = _loop0_102_rule(p)) // lambda_param_no_default* && - (c = _loop0_101_rule(p)) // lambda_param_with_default* + (c = _loop0_103_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9205,7 +9230,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_102_rule(p)) // lambda_param_with_default* + (b = _loop0_104_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9233,9 +9258,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_103_rule(p)) // lambda_param_no_default+ + (a = _loop1_105_rule(p)) // lambda_param_no_default+ && - (b = _loop0_104_rule(p)) // lambda_param_with_default* + (b = _loop0_106_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9262,7 +9287,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_105_rule(p)) // lambda_param_with_default+ + (a = _loop1_107_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9333,7 +9358,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_106_rule(p)) // lambda_param_no_default+ + (a = _loop1_108_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9362,7 +9387,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_107_rule(p)) // lambda_param_no_default+ + (a = _loop1_109_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9412,9 +9437,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_108_rule(p)) // lambda_param_no_default* + (a = _loop0_110_rule(p)) // lambda_param_no_default* && - (b = _loop1_109_rule(p)) // lambda_param_with_default+ + (b = _loop1_111_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9444,9 +9469,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_110_rule(p)) // lambda_param_no_default* + (a = _loop0_112_rule(p)) // lambda_param_no_default* && - (b = _loop1_111_rule(p)) // lambda_param_with_default+ + (b = _loop1_113_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9502,7 +9527,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_112_rule(p)) // lambda_param_maybe_default* + (b = _loop0_114_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9535,7 +9560,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_113_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_115_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9962,7 +9987,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_114_rule(p)) // (('or' conjunction))+ + (b = _loop1_116_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -10048,7 +10073,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_115_rule(p)) // (('and' inversion))+ + (b = _loop1_117_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10216,7 +10241,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_116_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_118_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10544,10 +10569,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_117_var; + void *_tmp_119_var; expr_ty a; if ( - (_tmp_117_var = _tmp_117_rule(p)) // '!=' + (_tmp_119_var = _tmp_119_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12476,7 +12501,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_118_rule(p)) // ','.slice+ + (a = _gather_120_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12546,7 +12571,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_120_rule(p), 1) // [':' expression?] + (c = _tmp_122_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -12820,15 +12845,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_121_var; + void *_tmp_123_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_121_var = _tmp_121_rule(p)) // tuple | group | genexp + (_tmp_123_var = _tmp_123_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_121_var; + _res = _tmp_123_var; goto done; } p->mark = _mark; @@ -12841,15 +12866,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_122_var; + void *_tmp_124_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_122_var = _tmp_122_rule(p)) // list | listcomp + (_tmp_124_var = _tmp_124_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_122_var; + _res = _tmp_124_var; goto done; } p->mark = _mark; @@ -12862,15 +12887,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_123_var; + void *_tmp_125_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_123_var = _tmp_123_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_125_var = _tmp_125_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_123_var; + _res = _tmp_125_var; goto done; } p->mark = _mark; @@ -12939,7 +12964,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_124_rule(p)) // STRING+ + (a = _loop1_126_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -13146,7 +13171,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_125_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_127_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13202,7 +13227,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_126_rule(p)) // yield_expr | named_expression + (a = _tmp_128_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13638,7 +13663,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_127_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_129_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13789,13 +13814,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_129_var; + asdl_seq * _loop1_131_var; if ( - (_loop1_129_var = _loop1_129_rule(p)) // for_if_clause+ + (_loop1_131_var = _loop1_131_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_129_var; + _res = _loop1_131_var; goto done; } p->mark = _mark; @@ -13844,7 +13869,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_130_rule(p)) // (('if' disjunction))* + (c = _loop0_132_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -13880,7 +13905,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_131_rule(p)) // (('if' disjunction))* + (c = _loop0_133_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' disjunction (('if' disjunction))*")); @@ -14105,7 +14130,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_132_rule(p), 1) // [',' args] + (b = _tmp_134_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -14174,7 +14199,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_133_rule(p), 1) // [',' args] + (b = _tmp_135_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -14229,11 +14254,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_134_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_136_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_136_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_138_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14255,13 +14280,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_138_var; + asdl_seq * _gather_140_var; if ( - (_gather_138_var = _gather_138_rule(p)) // ','.kwarg_or_starred+ + (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_138_var; + _res = _gather_140_var; goto done; } p->mark = _mark; @@ -14274,13 +14299,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_140_var; + asdl_seq * _gather_142_var; if ( - (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_142_var = _gather_142_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_140_var; + _res = _gather_142_var; goto done; } p->mark = _mark; @@ -14642,7 +14667,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_142_rule(p)) // ((',' star_target))* + (b = _loop0_144_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14696,7 +14721,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_143_rule(p)) // ','.star_target+ + (a = _gather_145_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14759,7 +14784,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_145_rule(p)) // !'*' star_target + (a = _tmp_147_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15281,7 +15306,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_146_rule(p)) // ','.del_target+ + (a = _gather_148_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15760,7 +15785,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_148_rule(p)) // ','.target+ + (a = _gather_150_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16472,7 +16497,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_150_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_152_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -16754,14 +16779,14 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':'")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_151_var; + asdl_seq * _loop0_153_var; expr_ty a; if ( (a = star_named_expression_rule(p)) // star_named_expression && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_151_var = _loop0_151_rule(p)) // star_named_expressions* + (_loop0_153_var = _loop0_153_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -16797,7 +16822,7 @@ invalid_assignment_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_152_rule(p), 1) // ['=' annotated_rhs] + (_opt_var = _tmp_154_rule(p), 1) // ['=' annotated_rhs] ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); @@ -16820,14 +16845,14 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); Token * _literal; - void *_tmp_153_var; + void *_tmp_155_var; expr_ty a; if ( (a = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (_tmp_153_var = _tmp_153_rule(p)) // yield_expr | star_expressions + (_tmp_155_var = _tmp_155_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions '=' (yield_expr | star_expressions)")); @@ -16849,7 +16874,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_154_var; + void *_tmp_156_var; expr_ty a; AugOperator* augassign_var; if ( @@ -16857,7 +16882,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_154_var = _tmp_154_rule(p)) // yield_expr | star_expressions + (_tmp_156_var = _tmp_156_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -16939,11 +16964,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_155_var; + void *_tmp_157_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_155_var = _tmp_155_rule(p)) // '[' | '(' | '{' + (_tmp_157_var = _tmp_157_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -17040,13 +17065,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_156_var; - void *_tmp_157_var; + asdl_seq * _loop0_158_var; + void *_tmp_159_var; arg_ty param_no_default_var; if ( - (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* + (_loop0_158_var = _loop0_158_rule(p)) // param_no_default* && - (_tmp_157_var = _tmp_157_rule(p)) // slash_with_default | param_with_default+ + (_tmp_159_var = _tmp_159_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -17088,11 +17113,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_158_var; + void *_tmp_160_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_158_var = _tmp_158_rule(p)) // ')' | ',' (')' | '**') + (_tmp_160_var = _tmp_160_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -17162,11 +17187,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_159_var; + void *_tmp_161_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_159_var = _tmp_159_rule(p)) // ':' | ',' (':' | '**') + (_tmp_161_var = _tmp_161_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18576,12 +18601,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_160_var; + void *_tmp_162_var; while ( - (_tmp_160_var = _tmp_160_rule(p)) // star_targets '=' + (_tmp_162_var = _tmp_162_rule(p)) // star_targets '=' ) { - _res = _tmp_160_var; + _res = _tmp_162_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19029,12 +19054,12 @@ _loop0_30_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_161_var; + void *_tmp_163_var; while ( - (_tmp_161_var = _tmp_161_rule(p)) // '.' | '...' + (_tmp_163_var = _tmp_163_rule(p)) // '.' | '...' ) { - _res = _tmp_161_var; + _res = _tmp_163_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19095,12 +19120,12 @@ _loop1_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_162_var; + void *_tmp_164_var; while ( - (_tmp_162_var = _tmp_162_rule(p)) // '.' | '...' + (_tmp_164_var = _tmp_164_rule(p)) // '.' | '...' ) { - _res = _tmp_162_var; + _res = _tmp_164_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20384,113 +20409,73 @@ _tmp_53_rule(Parser *p) return _res; } -// _loop0_55: ',' pattern -static asdl_seq * -_loop0_55_rule(Parser *p) +// _tmp_54: '.' | '(' | '=' +static void * +_tmp_54_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' pattern + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = pattern_rule(p)) // pattern + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); - } - asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } - for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_54: pattern _loop0_55 -static asdl_seq * -_gather_54_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + { // '(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + ) + { + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // pattern _loop0_55 + { // '=' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_55")); - expr_ty elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + Token * _literal; if ( - (elem = pattern_rule(p)) // pattern - && - (seq = _loop0_55_rule(p)) // _loop0_55 + (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_55")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_55")); + D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } _res = NULL; done: @@ -20498,47 +20483,121 @@ _gather_54_rule(Parser *p) return _res; } -// _loop0_57: ',' keyword_pattern -static asdl_seq * -_loop0_57_rule(Parser *p) +// _tmp_55: '.' | '(' | '=' +static void * +_tmp_55_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' keyword_pattern + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; - void *elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = keyword_pattern_rule(p)) // keyword_pattern + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '(' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + ) + { + D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + } + { // '=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + ) + { + D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_57: ',' pattern +static asdl_seq * +_loop0_57_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + Token * _literal; + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = pattern_rule(p)) // pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; } if (_n == _children_capacity) { _children_capacity *= 2; @@ -20556,7 +20615,7 @@ _loop0_57_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20573,7 +20632,7 @@ _loop0_57_rule(Parser *p) return _seq; } -// _gather_56: keyword_pattern _loop0_57 +// _gather_56: pattern _loop0_57 static asdl_seq * _gather_56_rule(Parser *p) { @@ -20584,27 +20643,27 @@ _gather_56_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_57 + { // pattern _loop0_57 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_57")); - void *elem; + D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); + expr_ty elem; asdl_seq * seq; if ( - (elem = keyword_pattern_rule(p)) // keyword_pattern + (elem = pattern_rule(p)) // pattern && (seq = _loop0_57_rule(p)) // _loop0_57 ) { - D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_57")); + D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_57")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_57")); } _res = NULL; done: @@ -20612,7 +20671,7 @@ _gather_56_rule(Parser *p) return _res; } -// _loop0_59: ',' pattern +// _loop0_59: ',' keyword_pattern static asdl_seq * _loop0_59_rule(Parser *p) { @@ -20633,18 +20692,18 @@ _loop0_59_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' keyword_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; - expr_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern ) { _res = elem; @@ -20670,7 +20729,7 @@ _loop0_59_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -20687,7 +20746,7 @@ _loop0_59_rule(Parser *p) return _seq; } -// _gather_58: pattern _loop0_59 +// _gather_58: keyword_pattern _loop0_59 static asdl_seq * _gather_58_rule(Parser *p) { @@ -20698,27 +20757,27 @@ _gather_58_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_59 + { // keyword_pattern _loop0_59 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); + void *elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = keyword_pattern_rule(p)) // keyword_pattern && (seq = _loop0_59_rule(p)) // _loop0_59 ) { - D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_59")); + D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_59")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_59")); } _res = NULL; done: @@ -20726,9 +20785,123 @@ _gather_58_rule(Parser *p) return _res; } -// _loop0_61: ',' keyword_pattern +// _loop0_61: ',' pattern static asdl_seq * _loop0_61_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + Token * _literal; + expr_ty elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = pattern_rule(p)) // pattern + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_60: pattern _loop0_61 +static asdl_seq * +_gather_60_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // pattern _loop0_61 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = pattern_rule(p)) // pattern + && + (seq = _loop0_61_rule(p)) // _loop0_61 + ) + { + D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_61")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_63: ',' keyword_pattern +static asdl_seq * +_loop0_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20752,7 +20925,7 @@ _loop0_61_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( @@ -20783,7 +20956,7 @@ _loop0_61_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20796,14 +20969,14 @@ _loop0_61_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); D(p->level--); return _seq; } -// _gather_60: keyword_pattern _loop0_61 +// _gather_62: keyword_pattern _loop0_63 static asdl_seq * -_gather_60_rule(Parser *p) +_gather_62_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20812,27 +20985,27 @@ _gather_60_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_61 + { // keyword_pattern _loop0_63 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_61")); + D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); void *elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_61_rule(p)) // _loop0_61 + (seq = _loop0_63_rule(p)) // _loop0_63 ) { - D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_61")); + D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_61")); + D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_63")); } _res = NULL; done: @@ -20840,9 +21013,9 @@ _gather_60_rule(Parser *p) return _res; } -// _tmp_62: ','.pattern+ ',' +// _tmp_64: ','.pattern+ ',' static void * -_tmp_62_rule(Parser *p) +_tmp_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20856,21 +21029,21 @@ _tmp_62_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - asdl_seq * _gather_163_var; + D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + asdl_seq * _gather_165_var; Token * _literal; if ( - (_gather_163_var = _gather_163_rule(p)) // ','.pattern+ + (_gather_165_var = _gather_165_rule(p)) // ','.pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_163_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_165_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_62[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ','")); } _res = NULL; @@ -20879,9 +21052,9 @@ _tmp_62_rule(Parser *p) return _res; } -// _loop0_64: ',' keyword_pattern +// _loop0_66: ',' keyword_pattern static asdl_seq * -_loop0_64_rule(Parser *p) +_loop0_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20905,7 +21078,7 @@ _loop0_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; void *elem; while ( @@ -20936,7 +21109,7 @@ _loop0_64_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -20949,14 +21122,14 @@ _loop0_64_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq); D(p->level--); return _seq; } -// _gather_63: keyword_pattern _loop0_64 +// _gather_65: keyword_pattern _loop0_66 static asdl_seq * -_gather_63_rule(Parser *p) +_gather_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20965,27 +21138,27 @@ _gather_63_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_64 + { // keyword_pattern _loop0_66 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); void *elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_64_rule(p)) // _loop0_64 + (seq = _loop0_66_rule(p)) // _loop0_66 ) { - D(fprintf(stderr, "%*c+ _gather_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_63[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_66")); } _res = NULL; done: @@ -20993,9 +21166,9 @@ _gather_63_rule(Parser *p) return _res; } -// _tmp_65: ',' ','.argument_pattern+ +// _tmp_67: ',' ','.argument_pattern+ static void * -_tmp_65_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21009,21 +21182,21 @@ _tmp_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); - asdl_seq * _gather_165_var; + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + asdl_seq * _gather_167_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_165_var = _gather_165_rule(p)) // ','.argument_pattern+ + (_gather_167_var = _gather_167_rule(p)) // ','.argument_pattern+ ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_165_var); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_167_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.argument_pattern+")); } _res = NULL; @@ -21032,9 +21205,9 @@ _tmp_65_rule(Parser *p) return _res; } -// _tmp_66: ','.argument_pattern+ ',' +// _tmp_68: ','.argument_pattern+ ',' static void * -_tmp_66_rule(Parser *p) +_tmp_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21048,21 +21221,21 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); - asdl_seq * _gather_167_var; + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + asdl_seq * _gather_169_var; Token * _literal; if ( - (_gather_167_var = _gather_167_rule(p)) // ','.argument_pattern+ + (_gather_169_var = _gather_169_rule(p)) // ','.argument_pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_167_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_169_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.argument_pattern+ ','")); } _res = NULL; @@ -21071,9 +21244,9 @@ _tmp_66_rule(Parser *p) return _res; } -// _tmp_67: ',' ','.(argument_pattern | error_star)+ +// _tmp_69: ',' ','.(argument_pattern | error_star)+ static void * -_tmp_67_rule(Parser *p) +_tmp_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21087,21 +21260,21 @@ _tmp_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); - asdl_seq * _gather_169_var; + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + asdl_seq * _gather_171_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_169_var = _gather_169_rule(p)) // ','.(argument_pattern | error_star)+ + (_gather_171_var = _gather_171_rule(p)) // ','.(argument_pattern | error_star)+ ) { - D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_169_var); + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_171_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); } _res = NULL; @@ -21110,9 +21283,9 @@ _tmp_67_rule(Parser *p) return _res; } -// _loop0_69: ',' value_pattern +// _loop0_71: ',' value_pattern static asdl_seq * -_loop0_69_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21136,7 +21309,7 @@ _loop0_69_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; void *elem; while ( @@ -21167,7 +21340,7 @@ _loop0_69_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21180,14 +21353,14 @@ _loop0_69_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _gather_68: value_pattern _loop0_69 +// _gather_70: value_pattern _loop0_71 static asdl_seq * -_gather_68_rule(Parser *p) +_gather_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21196,27 +21369,27 @@ _gather_68_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // value_pattern _loop0_69 + { // value_pattern _loop0_71 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_69")); + D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); void *elem; asdl_seq * seq; if ( (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_69_rule(p)) // _loop0_69 + (seq = _loop0_71_rule(p)) // _loop0_71 ) { - D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_69")); + D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_68[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_69")); + D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_71")); } _res = NULL; done: @@ -21224,9 +21397,9 @@ _gather_68_rule(Parser *p) return _res; } -// _loop0_71: ',' key_value_pattern +// _loop0_73: ',' key_value_pattern static asdl_seq * -_loop0_71_rule(Parser *p) +_loop0_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21250,7 +21423,7 @@ _loop0_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; void *elem; while ( @@ -21281,7 +21454,7 @@ _loop0_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21294,14 +21467,14 @@ _loop0_71_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); D(p->level--); return _seq; } -// _gather_70: key_value_pattern _loop0_71 +// _gather_72: key_value_pattern _loop0_73 static asdl_seq * -_gather_70_rule(Parser *p) +_gather_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21310,27 +21483,27 @@ _gather_70_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_71 + { // key_value_pattern _loop0_73 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); + D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); void *elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_71_rule(p)) // _loop0_71 + (seq = _loop0_73_rule(p)) // _loop0_73 ) { - D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); + D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_71")); + D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_73")); } _res = NULL; done: @@ -21338,9 +21511,9 @@ _gather_70_rule(Parser *p) return _res; } -// _tmp_72: '*' | '**' +// _tmp_74: '*' | '**' static void * -_tmp_72_rule(Parser *p) +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21354,18 +21527,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' ) { - D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); } { // '**' @@ -21373,18 +21546,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -21393,9 +21566,9 @@ _tmp_72_rule(Parser *p) return _res; } -// _tmp_73: literal_pattern | constant_pattern +// _tmp_75: literal_pattern | constant_pattern static void * -_tmp_73_rule(Parser *p) +_tmp_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21409,18 +21582,18 @@ _tmp_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); void *literal_pattern_var; if ( (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); _res = literal_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } { // constant_pattern @@ -21428,18 +21601,18 @@ _tmp_73_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); void *constant_pattern_var; if ( (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); _res = constant_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_73[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); } _res = NULL; @@ -21448,9 +21621,9 @@ _tmp_73_rule(Parser *p) return _res; } -// _tmp_74: 'from' expression +// _tmp_76: 'from' expression static void * -_tmp_74_rule(Parser *p) +_tmp_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21464,7 +21637,7 @@ _tmp_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); Token * _keyword; expr_ty z; if ( @@ -21473,7 +21646,7 @@ _tmp_74_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21483,7 +21656,7 @@ _tmp_74_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -21492,9 +21665,9 @@ _tmp_74_rule(Parser *p) return _res; } -// _tmp_75: '->' expression +// _tmp_77: '->' expression static void * -_tmp_75_rule(Parser *p) +_tmp_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21508,7 +21681,7 @@ _tmp_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21517,7 +21690,7 @@ _tmp_75_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21527,7 +21700,7 @@ _tmp_75_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21536,9 +21709,9 @@ _tmp_75_rule(Parser *p) return _res; } -// _tmp_76: '->' expression +// _tmp_78: '->' expression static void * -_tmp_76_rule(Parser *p) +_tmp_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21552,7 +21725,7 @@ _tmp_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -21561,7 +21734,7 @@ _tmp_76_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_78[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -21571,7 +21744,7 @@ _tmp_76_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -21580,9 +21753,9 @@ _tmp_76_rule(Parser *p) return _res; } -// _tmp_77: NEWLINE INDENT +// _tmp_79: NEWLINE INDENT static void * -_tmp_77_rule(Parser *p) +_tmp_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21596,7 +21769,7 @@ _tmp_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -21605,12 +21778,12 @@ _tmp_77_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -21619,9 +21792,9 @@ _tmp_77_rule(Parser *p) return _res; } -// _loop0_78: param_no_default +// _loop0_80: param_no_default static asdl_seq * -_loop0_78_rule(Parser *p) +_loop0_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21645,7 +21818,7 @@ _loop0_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21667,7 +21840,7 @@ _loop0_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21680,14 +21853,14 @@ _loop0_78_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); D(p->level--); return _seq; } -// _loop0_79: param_with_default +// _loop0_81: param_with_default static asdl_seq * -_loop0_79_rule(Parser *p) +_loop0_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21711,7 +21884,7 @@ _loop0_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21733,7 +21906,7 @@ _loop0_79_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21746,14 +21919,14 @@ _loop0_79_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); D(p->level--); return _seq; } -// _loop0_80: param_with_default +// _loop0_82: param_with_default static asdl_seq * -_loop0_80_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21777,7 +21950,7 @@ _loop0_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21799,7 +21972,7 @@ _loop0_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21812,14 +21985,14 @@ _loop0_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_81: param_no_default +// _loop1_83: param_no_default static asdl_seq * -_loop1_81_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21843,7 +22016,7 @@ _loop1_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -21865,7 +22038,7 @@ _loop1_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -21883,14 +22056,14 @@ _loop1_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop0_82: param_with_default +// _loop0_84: param_with_default static asdl_seq * -_loop0_82_rule(Parser *p) +_loop0_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21914,7 +22087,7 @@ _loop0_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -21936,7 +22109,7 @@ _loop0_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21949,14 +22122,14 @@ _loop0_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq); D(p->level--); return _seq; } -// _loop1_83: param_with_default +// _loop1_85: param_with_default static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21980,7 +22153,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22002,7 +22175,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22020,14 +22193,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); D(p->level--); return _seq; } -// _loop1_84: param_no_default +// _loop1_86: param_no_default static asdl_seq * -_loop1_84_rule(Parser *p) +_loop1_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22051,7 +22224,7 @@ _loop1_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22073,7 +22246,7 @@ _loop1_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22091,14 +22264,14 @@ _loop1_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); D(p->level--); return _seq; } -// _loop1_85: param_no_default +// _loop1_87: param_no_default static asdl_seq * -_loop1_85_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22122,7 +22295,7 @@ _loop1_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22144,7 +22317,7 @@ _loop1_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22162,14 +22335,14 @@ _loop1_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop0_86: param_no_default +// _loop0_88: param_no_default static asdl_seq * -_loop0_86_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22193,7 +22366,7 @@ _loop0_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22215,7 +22388,7 @@ _loop0_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22228,14 +22401,14 @@ _loop0_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _loop1_87: param_with_default +// _loop1_89: param_with_default static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22259,7 +22432,7 @@ _loop1_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22281,7 +22454,7 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22299,14 +22472,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); D(p->level--); return _seq; } -// _loop0_88: param_no_default +// _loop0_90: param_no_default static asdl_seq * -_loop0_88_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22330,7 +22503,7 @@ _loop0_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22352,7 +22525,7 @@ _loop0_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22365,14 +22538,14 @@ _loop0_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _loop1_89: param_with_default +// _loop1_91: param_with_default static asdl_seq * -_loop1_89_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22396,7 +22569,7 @@ _loop1_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22418,7 +22591,7 @@ _loop1_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22436,14 +22609,14 @@ _loop1_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _loop0_90: param_maybe_default +// _loop0_92: param_maybe_default static asdl_seq * -_loop0_90_rule(Parser *p) +_loop0_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22467,7 +22640,7 @@ _loop0_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22489,7 +22662,7 @@ _loop0_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22502,14 +22675,14 @@ _loop0_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); D(p->level--); return _seq; } -// _loop1_91: param_maybe_default +// _loop1_93: param_maybe_default static asdl_seq * -_loop1_91_rule(Parser *p) +_loop1_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22533,7 +22706,7 @@ _loop1_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -22555,7 +22728,7 @@ _loop1_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -22573,14 +22746,14 @@ _loop1_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); D(p->level--); return _seq; } -// _loop1_92: ('@' named_expression NEWLINE) +// _loop1_94: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_92_rule(Parser *p) +_loop1_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22604,13 +22777,13 @@ _loop1_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_171_var; + D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_173_var; while ( - (_tmp_171_var = _tmp_171_rule(p)) // '@' named_expression NEWLINE + (_tmp_173_var = _tmp_173_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_171_var; + _res = _tmp_173_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22626,7 +22799,7 @@ _loop1_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -22644,14 +22817,14 @@ _loop1_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); D(p->level--); return _seq; } -// _tmp_93: '(' arguments? ')' +// _tmp_95: '(' arguments? ')' static void * -_tmp_93_rule(Parser *p) +_tmp_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22665,7 +22838,7 @@ _tmp_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -22677,7 +22850,7 @@ _tmp_93_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22687,7 +22860,7 @@ _tmp_93_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -22696,9 +22869,9 @@ _tmp_93_rule(Parser *p) return _res; } -// _loop0_95: ',' star_expression +// _loop0_97: ',' star_expression static asdl_seq * -_loop0_95_rule(Parser *p) +_loop0_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22722,7 +22895,7 @@ _loop0_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -22753,7 +22926,7 @@ _loop0_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22766,14 +22939,14 @@ _loop0_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); D(p->level--); return _seq; } -// _gather_94: star_expression _loop0_95 +// _gather_96: star_expression _loop0_97 static asdl_seq * -_gather_94_rule(Parser *p) +_gather_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22782,27 +22955,27 @@ _gather_94_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_95 + { // star_expression _loop0_97 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c> _gather_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_95_rule(p)) // _loop0_95 + (seq = _loop0_97_rule(p)) // _loop0_97 ) { - D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c+ _gather_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_95")); + D(fprintf(stderr, "%*c%s _gather_96[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_97")); } _res = NULL; done: @@ -22810,9 +22983,9 @@ _gather_94_rule(Parser *p) return _res; } -// _loop1_96: (',' star_expression) +// _loop1_98: (',' star_expression) static asdl_seq * -_loop1_96_rule(Parser *p) +_loop1_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22836,13 +23009,13 @@ _loop1_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_172_var; + D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_174_var; while ( - (_tmp_172_var = _tmp_172_rule(p)) // ',' star_expression + (_tmp_174_var = _tmp_174_rule(p)) // ',' star_expression ) { - _res = _tmp_172_var; + _res = _tmp_174_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22858,7 +23031,7 @@ _loop1_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -22876,14 +23049,14 @@ _loop1_96_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); D(p->level--); return _seq; } -// _loop0_98: ',' star_named_expression +// _loop0_100: ',' star_named_expression static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22907,7 +23080,7 @@ _loop0_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -22938,7 +23111,7 @@ _loop0_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22951,14 +23124,14 @@ _loop0_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _gather_97: star_named_expression _loop0_98 +// _gather_99: star_named_expression _loop0_100 static asdl_seq * -_gather_97_rule(Parser *p) +_gather_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22967,27 +23140,27 @@ _gather_97_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_98 + { // star_named_expression _loop0_100 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c> _gather_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_98_rule(p)) // _loop0_98 + (seq = _loop0_100_rule(p)) // _loop0_100 ) { - D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c+ _gather_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_98")); + D(fprintf(stderr, "%*c%s _gather_99[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_100")); } _res = NULL; done: @@ -22995,9 +23168,9 @@ _gather_97_rule(Parser *p) return _res; } -// _loop1_99: (',' expression) +// _loop1_101: (',' expression) static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23021,13 +23194,13 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_173_var; + D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_175_var; while ( - (_tmp_173_var = _tmp_173_rule(p)) // ',' expression + (_tmp_175_var = _tmp_175_rule(p)) // ',' expression ) { - _res = _tmp_173_var; + _res = _tmp_175_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23043,7 +23216,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -23061,14 +23234,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_no_default +// _loop0_102: lambda_param_no_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23092,7 +23265,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23114,7 +23287,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23127,14 +23300,14 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop0_101: lambda_param_with_default +// _loop0_103: lambda_param_with_default static asdl_seq * -_loop0_101_rule(Parser *p) +_loop0_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23158,7 +23331,7 @@ _loop0_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23180,7 +23353,7 @@ _loop0_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23193,14 +23366,14 @@ _loop0_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); D(p->level--); return _seq; } -// _loop0_102: lambda_param_with_default +// _loop0_104: lambda_param_with_default static asdl_seq * -_loop0_102_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23224,7 +23397,7 @@ _loop0_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23246,7 +23419,7 @@ _loop0_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23259,14 +23432,14 @@ _loop0_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_103: lambda_param_no_default +// _loop1_105: lambda_param_no_default static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23290,7 +23463,7 @@ _loop1_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23312,7 +23485,7 @@ _loop1_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23330,14 +23503,14 @@ _loop1_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_with_default +// _loop0_106: lambda_param_with_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23361,7 +23534,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23383,7 +23556,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23396,14 +23569,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_with_default +// _loop1_107: lambda_param_with_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23427,7 +23600,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23449,7 +23622,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23467,14 +23640,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop1_106: lambda_param_no_default +// _loop1_108: lambda_param_no_default static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23498,7 +23671,7 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23520,7 +23693,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23538,14 +23711,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); D(p->level--); return _seq; } -// _loop1_107: lambda_param_no_default +// _loop1_109: lambda_param_no_default static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23569,7 +23742,7 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23591,7 +23764,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23609,14 +23782,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); D(p->level--); return _seq; } -// _loop0_108: lambda_param_no_default +// _loop0_110: lambda_param_no_default static asdl_seq * -_loop0_108_rule(Parser *p) +_loop0_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23640,7 +23813,7 @@ _loop0_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23662,7 +23835,7 @@ _loop0_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23675,14 +23848,14 @@ _loop0_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); D(p->level--); return _seq; } -// _loop1_109: lambda_param_with_default +// _loop1_111: lambda_param_with_default static asdl_seq * -_loop1_109_rule(Parser *p) +_loop1_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23706,7 +23879,7 @@ _loop1_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23728,7 +23901,7 @@ _loop1_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23746,14 +23919,14 @@ _loop1_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); D(p->level--); return _seq; } -// _loop0_110: lambda_param_no_default +// _loop0_112: lambda_param_no_default static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23777,7 +23950,7 @@ _loop0_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23799,7 +23972,7 @@ _loop0_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23812,14 +23985,14 @@ _loop0_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); D(p->level--); return _seq; } -// _loop1_111: lambda_param_with_default +// _loop1_113: lambda_param_with_default static asdl_seq * -_loop1_111_rule(Parser *p) +_loop1_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23843,7 +24016,7 @@ _loop1_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23865,7 +24038,7 @@ _loop1_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23883,14 +24056,14 @@ _loop1_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); D(p->level--); return _seq; } -// _loop0_112: lambda_param_maybe_default +// _loop0_114: lambda_param_maybe_default static asdl_seq * -_loop0_112_rule(Parser *p) +_loop0_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23914,7 +24087,7 @@ _loop0_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -23936,7 +24109,7 @@ _loop0_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23949,14 +24122,14 @@ _loop0_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); D(p->level--); return _seq; } -// _loop1_113: lambda_param_maybe_default +// _loop1_115: lambda_param_maybe_default static asdl_seq * -_loop1_113_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23980,7 +24153,7 @@ _loop1_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -24002,7 +24175,7 @@ _loop1_113_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -24020,14 +24193,14 @@ _loop1_113_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _loop1_114: ('or' conjunction) +// _loop1_116: ('or' conjunction) static asdl_seq * -_loop1_114_rule(Parser *p) +_loop1_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24051,13 +24224,13 @@ _loop1_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_174_var; + D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_176_var; while ( - (_tmp_174_var = _tmp_174_rule(p)) // 'or' conjunction + (_tmp_176_var = _tmp_176_rule(p)) // 'or' conjunction ) { - _res = _tmp_174_var; + _res = _tmp_176_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24073,7 +24246,7 @@ _loop1_114_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -24091,14 +24264,14 @@ _loop1_114_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); D(p->level--); return _seq; } -// _loop1_115: ('and' inversion) +// _loop1_117: ('and' inversion) static asdl_seq * -_loop1_115_rule(Parser *p) +_loop1_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24122,13 +24295,13 @@ _loop1_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_175_var; + D(fprintf(stderr, "%*c> _loop1_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_177_var; while ( - (_tmp_175_var = _tmp_175_rule(p)) // 'and' inversion + (_tmp_177_var = _tmp_177_rule(p)) // 'and' inversion ) { - _res = _tmp_175_var; + _res = _tmp_177_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24144,7 +24317,7 @@ _loop1_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -24162,14 +24335,14 @@ _loop1_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_117_type, _seq); D(p->level--); return _seq; } -// _loop1_116: compare_op_bitwise_or_pair +// _loop1_118: compare_op_bitwise_or_pair static asdl_seq * -_loop1_116_rule(Parser *p) +_loop1_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24193,7 +24366,7 @@ _loop1_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -24215,7 +24388,7 @@ _loop1_116_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -24233,14 +24406,14 @@ _loop1_116_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_118_type, _seq); D(p->level--); return _seq; } -// _tmp_117: '!=' +// _tmp_119: '!=' static void * -_tmp_117_rule(Parser *p) +_tmp_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24254,13 +24427,13 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24270,7 +24443,7 @@ _tmp_117_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -24279,9 +24452,9 @@ _tmp_117_rule(Parser *p) return _res; } -// _loop0_119: ',' slice +// _loop0_121: ',' slice static asdl_seq * -_loop0_119_rule(Parser *p) +_loop0_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24305,7 +24478,7 @@ _loop0_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -24336,7 +24509,7 @@ _loop0_119_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24349,14 +24522,14 @@ _loop0_119_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); D(p->level--); return _seq; } -// _gather_118: slice _loop0_119 +// _gather_120: slice _loop0_121 static asdl_seq * -_gather_118_rule(Parser *p) +_gather_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24365,27 +24538,27 @@ _gather_118_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_119 + { // slice _loop0_121 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c> _gather_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_119_rule(p)) // _loop0_119 + (seq = _loop0_121_rule(p)) // _loop0_121 ) { - D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c+ _gather_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_119")); + D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_121")); } _res = NULL; done: @@ -24393,9 +24566,9 @@ _gather_118_rule(Parser *p) return _res; } -// _tmp_120: ':' expression? +// _tmp_122: ':' expression? static void * -_tmp_120_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24409,7 +24582,7 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -24418,7 +24591,7 @@ _tmp_120_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24428,7 +24601,7 @@ _tmp_120_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -24437,9 +24610,9 @@ _tmp_120_rule(Parser *p) return _res; } -// _tmp_121: tuple | group | genexp +// _tmp_123: tuple | group | genexp static void * -_tmp_121_rule(Parser *p) +_tmp_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24453,18 +24626,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -24472,18 +24645,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -24491,18 +24664,18 @@ _tmp_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -24511,9 +24684,9 @@ _tmp_121_rule(Parser *p) return _res; } -// _tmp_122: list | listcomp +// _tmp_124: list | listcomp static void * -_tmp_122_rule(Parser *p) +_tmp_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24527,18 +24700,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -24546,18 +24719,18 @@ _tmp_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -24566,9 +24739,9 @@ _tmp_122_rule(Parser *p) return _res; } -// _tmp_123: dict | set | dictcomp | setcomp +// _tmp_125: dict | set | dictcomp | setcomp static void * -_tmp_123_rule(Parser *p) +_tmp_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24582,18 +24755,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -24601,18 +24774,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -24620,18 +24793,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -24639,18 +24812,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -24659,9 +24832,9 @@ _tmp_123_rule(Parser *p) return _res; } -// _loop1_124: STRING +// _loop1_126: STRING static asdl_seq * -_loop1_124_rule(Parser *p) +_loop1_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24685,7 +24858,7 @@ _loop1_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -24707,7 +24880,7 @@ _loop1_124_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -24725,14 +24898,14 @@ _loop1_124_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_124_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_126_type, _seq); D(p->level--); return _seq; } -// _tmp_125: star_named_expression ',' star_named_expressions? +// _tmp_127: star_named_expression ',' star_named_expressions? static void * -_tmp_125_rule(Parser *p) +_tmp_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24746,7 +24919,7 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -24758,7 +24931,7 @@ _tmp_125_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24768,7 +24941,7 @@ _tmp_125_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -24777,9 +24950,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _tmp_126: yield_expr | named_expression +// _tmp_128: yield_expr | named_expression static void * -_tmp_126_rule(Parser *p) +_tmp_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24793,18 +24966,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -24812,18 +24985,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -24832,9 +25005,9 @@ _tmp_126_rule(Parser *p) return _res; } -// _loop0_128: ',' double_starred_kvpair +// _loop0_130: ',' double_starred_kvpair static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24858,7 +25031,7 @@ _loop0_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -24889,7 +25062,7 @@ _loop0_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24902,14 +25075,14 @@ _loop0_128_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _gather_127: double_starred_kvpair _loop0_128 +// _gather_129: double_starred_kvpair _loop0_130 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24918,27 +25091,27 @@ _gather_127_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_128 + { // double_starred_kvpair _loop0_130 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_128_rule(p)) // _loop0_128 + (seq = _loop0_130_rule(p)) // _loop0_130 ) { - D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_128")); + D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_130")); } _res = NULL; done: @@ -24946,9 +25119,9 @@ _gather_127_rule(Parser *p) return _res; } -// _loop1_129: for_if_clause +// _loop1_131: for_if_clause static asdl_seq * -_loop1_129_rule(Parser *p) +_loop1_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24972,7 +25145,7 @@ _loop1_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -24994,7 +25167,7 @@ _loop1_129_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -25012,14 +25185,14 @@ _loop1_129_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_129_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_131_type, _seq); D(p->level--); return _seq; } -// _loop0_130: ('if' disjunction) +// _loop0_132: ('if' disjunction) static asdl_seq * -_loop0_130_rule(Parser *p) +_loop0_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25043,13 +25216,13 @@ _loop0_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_176_var; + D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_178_var; while ( - (_tmp_176_var = _tmp_176_rule(p)) // 'if' disjunction + (_tmp_178_var = _tmp_178_rule(p)) // 'if' disjunction ) { - _res = _tmp_176_var; + _res = _tmp_178_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25065,7 +25238,7 @@ _loop0_130_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25078,14 +25251,14 @@ _loop0_130_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); D(p->level--); return _seq; } -// _loop0_131: ('if' disjunction) +// _loop0_133: ('if' disjunction) static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25109,13 +25282,13 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_177_var; + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_179_var; while ( - (_tmp_177_var = _tmp_177_rule(p)) // 'if' disjunction + (_tmp_179_var = _tmp_179_rule(p)) // 'if' disjunction ) { - _res = _tmp_177_var; + _res = _tmp_179_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25131,7 +25304,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25144,14 +25317,14 @@ _loop0_131_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _tmp_132: ',' args +// _tmp_134: ',' args static void * -_tmp_132_rule(Parser *p) +_tmp_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25165,7 +25338,7 @@ _tmp_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -25174,7 +25347,7 @@ _tmp_132_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25184,7 +25357,7 @@ _tmp_132_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -25193,9 +25366,9 @@ _tmp_132_rule(Parser *p) return _res; } -// _tmp_133: ',' args +// _tmp_135: ',' args static void * -_tmp_133_rule(Parser *p) +_tmp_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25209,7 +25382,7 @@ _tmp_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -25218,7 +25391,7 @@ _tmp_133_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25228,7 +25401,7 @@ _tmp_133_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -25237,9 +25410,9 @@ _tmp_133_rule(Parser *p) return _res; } -// _loop0_135: ',' kwarg_or_starred +// _loop0_137: ',' kwarg_or_starred static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25263,7 +25436,7 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25294,7 +25467,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25307,14 +25480,14 @@ _loop0_135_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_134: kwarg_or_starred _loop0_135 +// _gather_136: kwarg_or_starred _loop0_137 static asdl_seq * -_gather_134_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25323,27 +25496,27 @@ _gather_134_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_135 + { // kwarg_or_starred _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_137")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_135_rule(p)) // _loop0_135 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_137")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_135")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_137")); } _res = NULL; done: @@ -25351,9 +25524,9 @@ _gather_134_rule(Parser *p) return _res; } -// _loop0_137: ',' kwarg_or_double_starred +// _loop0_139: ',' kwarg_or_double_starred static asdl_seq * -_loop0_137_rule(Parser *p) +_loop0_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25377,7 +25550,7 @@ _loop0_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25408,7 +25581,7 @@ _loop0_137_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25421,14 +25594,14 @@ _loop0_137_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); D(p->level--); return _seq; } -// _gather_136: kwarg_or_double_starred _loop0_137 +// _gather_138: kwarg_or_double_starred _loop0_139 static asdl_seq * -_gather_136_rule(Parser *p) +_gather_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25437,27 +25610,27 @@ _gather_136_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_137 + { // kwarg_or_double_starred _loop0_139 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_139")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_137_rule(p)) // _loop0_137 + (seq = _loop0_139_rule(p)) // _loop0_139 ) { - D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_139")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_137")); + D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_139")); } _res = NULL; done: @@ -25465,9 +25638,9 @@ _gather_136_rule(Parser *p) return _res; } -// _loop0_139: ',' kwarg_or_starred +// _loop0_141: ',' kwarg_or_starred static asdl_seq * -_loop0_139_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25491,7 +25664,7 @@ _loop0_139_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25522,7 +25695,7 @@ _loop0_139_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25535,14 +25708,14 @@ _loop0_139_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _gather_138: kwarg_or_starred _loop0_139 +// _gather_140: kwarg_or_starred _loop0_141 static asdl_seq * -_gather_138_rule(Parser *p) +_gather_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25551,27 +25724,27 @@ _gather_138_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_139 + { // kwarg_or_starred _loop0_141 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_141")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_139_rule(p)) // _loop0_139 + (seq = _loop0_141_rule(p)) // _loop0_141 ) { - D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_141")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_139")); + D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_141")); } _res = NULL; done: @@ -25579,9 +25752,9 @@ _gather_138_rule(Parser *p) return _res; } -// _loop0_141: ',' kwarg_or_double_starred +// _loop0_143: ',' kwarg_or_double_starred static asdl_seq * -_loop0_141_rule(Parser *p) +_loop0_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25605,7 +25778,7 @@ _loop0_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25636,7 +25809,7 @@ _loop0_141_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25649,14 +25822,14 @@ _loop0_141_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); D(p->level--); return _seq; } -// _gather_140: kwarg_or_double_starred _loop0_141 +// _gather_142: kwarg_or_double_starred _loop0_143 static asdl_seq * -_gather_140_rule(Parser *p) +_gather_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25665,27 +25838,27 @@ _gather_140_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_141 + { // kwarg_or_double_starred _loop0_143 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_143")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_141_rule(p)) // _loop0_141 + (seq = _loop0_143_rule(p)) // _loop0_143 ) { - D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_143")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_141")); + D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_143")); } _res = NULL; done: @@ -25693,9 +25866,9 @@ _gather_140_rule(Parser *p) return _res; } -// _loop0_142: (',' star_target) +// _loop0_144: (',' star_target) static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25719,13 +25892,13 @@ _loop0_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_178_var; + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_180_var; while ( - (_tmp_178_var = _tmp_178_rule(p)) // ',' star_target + (_tmp_180_var = _tmp_180_rule(p)) // ',' star_target ) { - _res = _tmp_178_var; + _res = _tmp_180_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25741,7 +25914,7 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25754,14 +25927,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); D(p->level--); return _seq; } -// _loop0_144: ',' star_target +// _loop0_146: ',' star_target static asdl_seq * -_loop0_144_rule(Parser *p) +_loop0_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25785,7 +25958,7 @@ _loop0_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -25816,7 +25989,7 @@ _loop0_144_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25829,14 +26002,14 @@ _loop0_144_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); D(p->level--); return _seq; } -// _gather_143: star_target _loop0_144 +// _gather_145: star_target _loop0_146 static asdl_seq * -_gather_143_rule(Parser *p) +_gather_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25845,27 +26018,27 @@ _gather_143_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_144 + { // star_target _loop0_146 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c> _gather_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_146")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_144_rule(p)) // _loop0_144 + (seq = _loop0_146_rule(p)) // _loop0_146 ) { - D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c+ _gather_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_146")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_144")); + D(fprintf(stderr, "%*c%s _gather_145[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_146")); } _res = NULL; done: @@ -25873,9 +26046,9 @@ _gather_143_rule(Parser *p) return _res; } -// _tmp_145: !'*' star_target +// _tmp_147: !'*' star_target static void * -_tmp_145_rule(Parser *p) +_tmp_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25889,7 +26062,7 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -25897,12 +26070,12 @@ _tmp_145_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -25911,9 +26084,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _loop0_147: ',' del_target +// _loop0_149: ',' del_target static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25937,7 +26110,7 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -25968,7 +26141,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25981,14 +26154,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _gather_146: del_target _loop0_147 +// _gather_148: del_target _loop0_149 static asdl_seq * -_gather_146_rule(Parser *p) +_gather_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25997,27 +26170,27 @@ _gather_146_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_147 + { // del_target _loop0_149 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_149")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_147_rule(p)) // _loop0_147 + (seq = _loop0_149_rule(p)) // _loop0_149 ) { - D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_149")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_147")); + D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_149")); } _res = NULL; done: @@ -26025,9 +26198,9 @@ _gather_146_rule(Parser *p) return _res; } -// _loop0_149: ',' target +// _loop0_151: ',' target static asdl_seq * -_loop0_149_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26051,7 +26224,7 @@ _loop0_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -26082,7 +26255,7 @@ _loop0_149_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26095,14 +26268,14 @@ _loop0_149_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); D(p->level--); return _seq; } -// _gather_148: target _loop0_149 +// _gather_150: target _loop0_151 static asdl_seq * -_gather_148_rule(Parser *p) +_gather_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26111,27 +26284,27 @@ _gather_148_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_149 + { // target _loop0_151 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c> _gather_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_151")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_149_rule(p)) // _loop0_149 + (seq = _loop0_151_rule(p)) // _loop0_151 ) { - D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c+ _gather_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_151")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_149")); + D(fprintf(stderr, "%*c%s _gather_150[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_151")); } _res = NULL; done: @@ -26139,9 +26312,9 @@ _gather_148_rule(Parser *p) return _res; } -// _tmp_150: args | expression for_if_clauses +// _tmp_152: args | expression for_if_clauses static void * -_tmp_150_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26155,18 +26328,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -26174,7 +26347,7 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -26183,12 +26356,12 @@ _tmp_150_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -26197,9 +26370,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _loop0_151: star_named_expressions +// _loop0_153: star_named_expressions static asdl_seq * -_loop0_151_rule(Parser *p) +_loop0_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26223,7 +26396,7 @@ _loop0_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -26245,7 +26418,7 @@ _loop0_151_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26258,14 +26431,14 @@ _loop0_151_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_153_type, _seq); D(p->level--); return _seq; } -// _tmp_152: '=' annotated_rhs +// _tmp_154: '=' annotated_rhs static void * -_tmp_152_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26279,7 +26452,7 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); Token * _literal; expr_ty annotated_rhs_var; if ( @@ -26288,12 +26461,12 @@ _tmp_152_rule(Parser *p) (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); } _res = NULL; @@ -26302,9 +26475,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: yield_expr | star_expressions +// _tmp_155: yield_expr | star_expressions static void * -_tmp_153_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26318,18 +26491,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -26337,18 +26510,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -26357,9 +26530,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: yield_expr | star_expressions +// _tmp_156: yield_expr | star_expressions static void * -_tmp_154_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26373,18 +26546,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -26392,18 +26565,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -26412,9 +26585,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: '[' | '(' | '{' +// _tmp_157: '[' | '(' | '{' static void * -_tmp_155_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26428,18 +26601,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -26447,18 +26620,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -26466,18 +26639,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -26486,9 +26659,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _loop0_156: param_no_default +// _loop0_158: param_no_default static asdl_seq * -_loop0_156_rule(Parser *p) +_loop0_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26512,7 +26685,7 @@ _loop0_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -26534,7 +26707,7 @@ _loop0_156_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26547,14 +26720,14 @@ _loop0_156_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_158_type, _seq); D(p->level--); return _seq; } -// _tmp_157: slash_with_default | param_with_default+ +// _tmp_159: slash_with_default | param_with_default+ static void * -_tmp_157_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26568,18 +26741,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -26587,18 +26760,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_179_var; + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_181_var; if ( - (_loop1_179_var = _loop1_179_rule(p)) // param_with_default+ + (_loop1_181_var = _loop1_181_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_179_var; + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_181_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -26607,9 +26780,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: ')' | ',' (')' | '**') +// _tmp_160: ')' | ',' (')' | '**') static void * -_tmp_158_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26623,18 +26796,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -26642,21 +26815,21 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_180_var; + void *_tmp_182_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_180_var = _tmp_180_rule(p)) // ')' | '**' + (_tmp_182_var = _tmp_182_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_180_var); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_182_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -26665,9 +26838,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: ':' | ',' (':' | '**') +// _tmp_161: ':' | ',' (':' | '**') static void * -_tmp_159_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26681,18 +26854,18 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -26700,21 +26873,21 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_181_var; + void *_tmp_183_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_181_var = _tmp_181_rule(p)) // ':' | '**' + (_tmp_183_var = _tmp_183_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_181_var); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_183_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -26723,9 +26896,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: star_targets '=' +// _tmp_162: star_targets '=' static void * -_tmp_160_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26739,7 +26912,7 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -26748,7 +26921,7 @@ _tmp_160_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26758,7 +26931,7 @@ _tmp_160_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -26767,9 +26940,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: '.' | '...' +// _tmp_163: '.' | '...' static void * -_tmp_161_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26783,18 +26956,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26802,18 +26975,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26822,9 +26995,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _tmp_162: '.' | '...' +// _tmp_164: '.' | '...' static void * -_tmp_162_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26838,18 +27011,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -26857,18 +27030,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -26877,9 +27050,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _loop0_164: ',' pattern +// _loop0_166: ',' pattern static asdl_seq * -_loop0_164_rule(Parser *p) +_loop0_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26903,7 +27076,7 @@ _loop0_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -26934,7 +27107,7 @@ _loop0_164_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26947,14 +27120,14 @@ _loop0_164_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_164_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); D(p->level--); return _seq; } -// _gather_163: pattern _loop0_164 +// _gather_165: pattern _loop0_166 static asdl_seq * -_gather_163_rule(Parser *p) +_gather_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26963,27 +27136,27 @@ _gather_163_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_164 + { // pattern _loop0_166 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_164")); + D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_166")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_164_rule(p)) // _loop0_164 + (seq = _loop0_166_rule(p)) // _loop0_166 ) { - D(fprintf(stderr, "%*c+ _gather_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_164")); + D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_166")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_163[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_164")); + D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_166")); } _res = NULL; done: @@ -26991,9 +27164,9 @@ _gather_163_rule(Parser *p) return _res; } -// _loop0_166: ',' argument_pattern +// _loop0_168: ',' argument_pattern static asdl_seq * -_loop0_166_rule(Parser *p) +_loop0_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27017,7 +27190,7 @@ _loop0_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( @@ -27048,7 +27221,7 @@ _loop0_166_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27061,14 +27234,14 @@ _loop0_166_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); D(p->level--); return _seq; } -// _gather_165: argument_pattern _loop0_166 +// _gather_167: argument_pattern _loop0_168 static asdl_seq * -_gather_165_rule(Parser *p) +_gather_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27077,27 +27250,27 @@ _gather_165_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_166 + { // argument_pattern _loop0_168 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_166")); + D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); void *elem; asdl_seq * seq; if ( (elem = argument_pattern_rule(p)) // argument_pattern && - (seq = _loop0_166_rule(p)) // _loop0_166 + (seq = _loop0_168_rule(p)) // _loop0_168 ) { - D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_166")); + D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_166")); + D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_168")); } _res = NULL; done: @@ -27105,9 +27278,9 @@ _gather_165_rule(Parser *p) return _res; } -// _loop0_168: ',' argument_pattern +// _loop0_170: ',' argument_pattern static asdl_seq * -_loop0_168_rule(Parser *p) +_loop0_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27131,7 +27304,7 @@ _loop0_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); Token * _literal; void *elem; while ( @@ -27162,7 +27335,7 @@ _loop0_168_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27175,14 +27348,14 @@ _loop0_168_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); D(p->level--); return _seq; } -// _gather_167: argument_pattern _loop0_168 +// _gather_169: argument_pattern _loop0_170 static asdl_seq * -_gather_167_rule(Parser *p) +_gather_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27191,27 +27364,27 @@ _gather_167_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_168 + { // argument_pattern _loop0_170 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); + D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_170")); void *elem; asdl_seq * seq; if ( (elem = argument_pattern_rule(p)) // argument_pattern && - (seq = _loop0_168_rule(p)) // _loop0_168 + (seq = _loop0_170_rule(p)) // _loop0_170 ) { - D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_168")); + D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_170")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_168")); + D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_170")); } _res = NULL; done: @@ -27219,9 +27392,9 @@ _gather_167_rule(Parser *p) return _res; } -// _loop0_170: ',' (argument_pattern | error_star) +// _loop0_172: ',' (argument_pattern | error_star) static asdl_seq * -_loop0_170_rule(Parser *p) +_loop0_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27245,13 +27418,13 @@ _loop0_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); + D(fprintf(stderr, "%*c> _loop0_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_182_rule(p)) // argument_pattern | error_star + (elem = _tmp_184_rule(p)) // argument_pattern | error_star ) { _res = elem; @@ -27276,7 +27449,7 @@ _loop0_170_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (argument_pattern | error_star)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27289,14 +27462,14 @@ _loop0_170_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_172_type, _seq); D(p->level--); return _seq; } -// _gather_169: (argument_pattern | error_star) _loop0_170 +// _gather_171: (argument_pattern | error_star) _loop0_172 static asdl_seq * -_gather_169_rule(Parser *p) +_gather_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27305,27 +27478,27 @@ _gather_169_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (argument_pattern | error_star) _loop0_170 + { // (argument_pattern | error_star) _loop0_172 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); + D(fprintf(stderr, "%*c> _gather_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_172")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_182_rule(p)) // argument_pattern | error_star + (elem = _tmp_184_rule(p)) // argument_pattern | error_star && - (seq = _loop0_170_rule(p)) // _loop0_170 + (seq = _loop0_172_rule(p)) // _loop0_172 ) { - D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); + D(fprintf(stderr, "%*c+ _gather_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_172")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_170")); + D(fprintf(stderr, "%*c%s _gather_171[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_172")); } _res = NULL; done: @@ -27333,9 +27506,9 @@ _gather_169_rule(Parser *p) return _res; } -// _tmp_171: '@' named_expression NEWLINE +// _tmp_173: '@' named_expression NEWLINE static void * -_tmp_171_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27349,7 +27522,7 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -27361,7 +27534,7 @@ _tmp_171_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27371,7 +27544,7 @@ _tmp_171_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -27380,9 +27553,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: ',' star_expression +// _tmp_174: ',' star_expression static void * -_tmp_172_rule(Parser *p) +_tmp_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27396,7 +27569,7 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -27405,7 +27578,7 @@ _tmp_172_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27415,7 +27588,7 @@ _tmp_172_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -27424,9 +27597,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: ',' expression +// _tmp_175: ',' expression static void * -_tmp_173_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27440,7 +27613,7 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -27449,7 +27622,7 @@ _tmp_173_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27459,7 +27632,7 @@ _tmp_173_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -27468,9 +27641,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: 'or' conjunction +// _tmp_176: 'or' conjunction static void * -_tmp_174_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27484,7 +27657,7 @@ _tmp_174_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -27493,7 +27666,7 @@ _tmp_174_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27503,7 +27676,7 @@ _tmp_174_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -27512,9 +27685,9 @@ _tmp_174_rule(Parser *p) return _res; } -// _tmp_175: 'and' inversion +// _tmp_177: 'and' inversion static void * -_tmp_175_rule(Parser *p) +_tmp_177_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27528,7 +27701,7 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -27537,7 +27710,7 @@ _tmp_175_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27547,7 +27720,7 @@ _tmp_175_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -27556,9 +27729,9 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: 'if' disjunction +// _tmp_178: 'if' disjunction static void * -_tmp_176_rule(Parser *p) +_tmp_178_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27572,7 +27745,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27581,7 +27754,7 @@ _tmp_176_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27591,7 +27764,7 @@ _tmp_176_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27600,9 +27773,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: 'if' disjunction +// _tmp_179: 'if' disjunction static void * -_tmp_177_rule(Parser *p) +_tmp_179_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27616,7 +27789,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27625,7 +27798,7 @@ _tmp_177_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27635,7 +27808,7 @@ _tmp_177_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27644,9 +27817,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _tmp_178: ',' star_target +// _tmp_180: ',' star_target static void * -_tmp_178_rule(Parser *p) +_tmp_180_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27660,7 +27833,7 @@ _tmp_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -27669,7 +27842,7 @@ _tmp_178_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27679,7 +27852,7 @@ _tmp_178_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -27688,9 +27861,9 @@ _tmp_178_rule(Parser *p) return _res; } -// _loop1_179: param_with_default +// _loop1_181: param_with_default static asdl_seq * -_loop1_179_rule(Parser *p) +_loop1_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27714,7 +27887,7 @@ _loop1_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -27736,7 +27909,7 @@ _loop1_179_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -27754,14 +27927,14 @@ _loop1_179_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_179_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_181_type, _seq); D(p->level--); return _seq; } -// _tmp_180: ')' | '**' +// _tmp_182: ')' | '**' static void * -_tmp_180_rule(Parser *p) +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27775,18 +27948,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -27794,18 +27967,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27814,9 +27987,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: ':' | '**' +// _tmp_183: ':' | '**' static void * -_tmp_181_rule(Parser *p) +_tmp_183_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27830,18 +28003,18 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -27849,18 +28022,18 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -27869,9 +28042,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: argument_pattern | error_star +// _tmp_184: argument_pattern | error_star static void * -_tmp_182_rule(Parser *p) +_tmp_184_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27885,18 +28058,18 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); void *argument_pattern_var; if ( (argument_pattern_var = argument_pattern_rule(p)) // argument_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); _res = argument_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern")); } { // error_star @@ -27904,18 +28077,18 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); expr_ty error_star_var; if ( (error_star_var = error_star_rule(p)) // error_star ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); _res = error_star_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); } _res = NULL; From 9a06fe331662338bf52c311714dbb87b721bc44d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 2 Jun 2020 22:23:29 -0700 Subject: [PATCH 058/218] Clean up and add tests --- Lib/ast.py | 15 +++++++------ Lib/test/test_patma.py | 51 ++++++++++++++++++++++++++++++++++++++++++ Python/ast_opt.c | 2 +- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index 0a63a08a18bf5c..82f127d60f329c 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1330,15 +1330,16 @@ def visit_Compare(self, node): self.write(" " + self.cmpops[o.__class__.__name__] + " ") self.traverse(e) - boolops = {("And", False): "and", ("Or", False): "or", ("Or", True): "|"} - boolop_precedence = { - "and": _Precedence.AND, "or": _Precedence.OR, "|": _Precedence.OR, - } + boolops = {"And": "and", "Or": "or"} + boolop_precedence = {"and": _Precedence.AND, "or": _Precedence.OR} def visit_BoolOp(self, node): - - operator = self.boolops[node.op.__class__.__name__, self.in_pattern()] - operator_precedence = self.boolop_precedence[operator] + if self.in_pattern(): + operator = "|" + operator_precedence = _Precedence.OR + else: + operator = self.boolops[node.op.__class__.__name__] + operator_precedence = self.boolop_precedence[operator] def increasing_level_traverse(node): nonlocal operator_precedence diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2524dd7ec7b28a..2c51cd4187933b 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1617,6 +1617,57 @@ class C: self.assertEqual(x, 0) self.assertEqual(y, 0) + def test_patma_116(self) -> None: + match = case = 0 + match match: + case case: + x = 0 + self.assertEqual(match, 0) + self.assertEqual(case, 0) + self.assertEqual(x, 0) + + def test_patma_117(self) -> None: + match = case = 0 + match case: + case match: + x = 0 + self.assertEqual(match, 0) + self.assertEqual(case, 0) + self.assertEqual(x, 0) + + def test_patma_118(self) -> None: + x = [] + match x: + case [*_, _]: + y = 0 + case []: + y = 1 + self.assertEqual(x, []) + self.assertEqual(y, 1) + + def test_patma_119(self) -> None: + from collections import defaultdict + x = defaultdict(int) + match x: + case {0: 0}: + y = 0 + case {}: + y = 1 + self.assertEqual(x, []) + self.assertEqual(y, 1) + + def test_patma_120(self) -> None: + from collections import defaultdict + x = defaultdict(int) + match x: + case {0: 0}: + y = 0 + case {**z}: + y = 1 + self.assertEqual(x, []) + self.assertEqual(y, 1) + self.assertEqual(z, {}) + if __name__ == "__main__": # XXX: For quick test debugging... import dis diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 0ff36860df3c31..217cd6f43aacd4 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -818,7 +818,7 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { - CALL_OPT(astfold_pattern, expr_ty, node_->pattern); + CALL(astfold_pattern, expr_ty, node_->pattern); CALL_OPT(astfold_expr, expr_ty, node_->guard); CALL_SEQ(astfold_stmt, stmt_ty, node_->body); return 1; From bb0ed117411570fb44334a3f27ffcea7f691c414 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 3 Jun 2020 17:03:21 -0700 Subject: [PATCH 059/218] Support destructuring type matches --- Doc/library/dis.rst | 106 ++++--- Include/opcode.h | 8 +- Lib/ast.py | 2 +- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 8 +- Lib/test/test_patma.py | 4 +- Python/ast.c | 24 ++ Python/ast_opt.c | 1 + Python/ceval.c | 413 +++++++++++++++++++++++---- Python/compile.c | 190 +++++++----- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 8 +- 12 files changed, 583 insertions(+), 187 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index c2d79e9dd6f774..6700d3c645590b 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -737,6 +737,14 @@ iterations of the loop. by :opcode:`CALL_FUNCTION` to construct a class. +.. opcode:: LIST_POP + + TOS is a :class:`list`. Pop the last item from it, and push it onto the + stack. + + .. versionadded:: 3.10 + + .. opcode:: SETUP_WITH (delta) This opcode performs several operations before a with block starts. First, @@ -990,47 +998,6 @@ All of the following opcodes use their arguments. code counter is incremented by *delta*. -.. opcode:: MATCH_KEY (delta) - - Pop TOS. If it is a key in the :class:`dict` at TOS1, remove it and push the - associated value onto the stack. Otherwise, increment the bytecode counter - by ``delta``. - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_MAP (delta) - - Pop TOS. If it is an instance of :class:`collections.abc.Mapping`, copy it - into a :class:`dict` and push that onto the stack. Otherwise, increment the - bytecode counter by ``delta``. - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_SEQ (delta) - - Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not - an :term:`iterator`, and is not an instance of - :class:`str`/:class:`bytes`/:class:`bytearray`, get an iterator from it and - push that onto the stack. Otherwise, increment the bytecode counter by - ``delta``. - - .. versionadded:: 3.10 - - -.. opcode:: DESTRUCTURE (argcount) - - Pop TOS, TOS1, and TOS2. If TOS1 is an instance of :class:`type` and has a - ``__match__`` method, call it on TOS2. If the result is not ``None``, - destrucuture it into ``argcount`` components (using any keyword names from - the :class:`tuple` at TOS), collect these into a tuple, and push that onto - the stack, followed by ``True``. Otherwise, push ``None``, followed by - ``False``. - - .. versionadded:: 3.10 - - .. opcode:: LOAD_GLOBAL (namei) Loads the global named ``co_names[namei]`` onto the stack. @@ -1230,6 +1197,63 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 +.. opcode:: MATCH (delta) + + Pop TOS, TOS1, TOS2, and TOS3. If TOS2 is an instance of :class:`type` and + has a ``__match__`` method, call that method on TOS3. The returned "proxy" + should be non-``None``. + + TOS is an integer argument count, and TOS1 is a :class:`tuple` of attribute + names. Using these together with the ``__match_args__`` and + ``__match_args_required__`` attributes (if present) on the "proxy", discover + and validate the total collection of attribute names required for a + successful match. If it has all of those attributes, push a reversed + :class:`list` of their corresponsing values onto the stack. + + If any part of the above process is unsuccessful, increment the bytecode + counter by ``delta``. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_MAP (delta) + + Pop TOS and TOS1. TOS is a tuple of keys. If TOS1 is an instance of + :class:`collections.abc.Mapping`, push a reversed list of values mapped from + those keys onto the stack. Otherwise, increment the bytecode counter by + ``delta``. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_MAP_STAR (delta) + + Perform the same steps as :opcode:`MATCH_MAP`, but prepend a :class:`dict` of + the remaining items to the list of values. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ (delta) + + Pop TOS and TOS1. TOS is an :class:`int` length. If TOS1 is an instance of + :class:`collections.abc.Sequence`, is not an :term:`iterator`, is not an + instance of :class:`str`/:class:`bytes`/:class:`bytearray`, and has that + length, collect it into a reversed list and push that onto the stack. + Otherwise, increment the bytecode counter by ``delta``. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ_STAR (delta) + + Pop TOS, TOS1, and TOS2. TOS and TOS1 are int lengths. Perform the same + steps as :opcode:`MATCH_SEQ` on TOS2, but fold the middle items of the result + list between TOS1 and -TOS2 into another, nested list. + + .. versionadded:: 3.10 + + .. opcode:: HAVE_ARGUMENT This is not really an opcode. It identifies the dividing line between diff --git a/Include/opcode.h b/Include/opcode.h index 07b1d80dd8986a..13bb9019dc6b1c 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -13,6 +13,7 @@ extern "C" { #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define ROT_FOUR 6 +#define LIST_POP 7 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 @@ -127,10 +128,11 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 -#define MATCH_KEY 166 +#define MATCH 166 #define MATCH_MAP 167 -#define MATCH_SEQ 168 -#define DESTRUCTURE 169 +#define MATCH_MAP_STAR 168 +#define MATCH_SEQ 169 +#define MATCH_SEQ_STAR 170 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/ast.py b/Lib/ast.py index 82f127d60f329c..d10852b45d06c4 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1339,7 +1339,7 @@ def visit_BoolOp(self, node): operator_precedence = _Precedence.OR else: operator = self.boolops[node.op.__class__.__name__] - operator_precedence = self.boolop_precedence[operator] + operator_precedence = self.boolop_precedence[operator] def increasing_level_traverse(node): nonlocal operator_precedence diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 47ccd046ee0b84..49ec198d53e165 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3439 (add DESTRUCTURE, MATCH_KEY, MATCH_MAP, MATCH_SEQ) +# Python 3.10a0 3442 (add LIST_POP, MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3440).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3442).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 24315fd55a9315..98bd21b2380c56 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -60,6 +60,7 @@ def jabs_op(name, op): def_op('DUP_TOP', 4) def_op('DUP_TOP_TWO', 5) def_op('ROT_FOUR', 6) +def_op('LIST_POP', 7) def_op('NOP', 9) def_op('UNARY_POSITIVE', 10) @@ -213,9 +214,10 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -jrel_op('MATCH_KEY', 166) +jrel_op('MATCH', 166) jrel_op('MATCH_MAP', 167) -jrel_op('MATCH_SEQ', 168) -jrel_op('DESTRUCTURE', 169) +jrel_op('MATCH_MAP_STAR', 168) +jrel_op('MATCH_SEQ', 169) +jrel_op('MATCH_SEQ_STAR', 170) del def_op, name_op, jrel_op, jabs_op diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2c51cd4187933b..78d9a9867e1aaf 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1653,7 +1653,7 @@ def test_patma_119(self) -> None: y = 0 case {}: y = 1 - self.assertEqual(x, []) + self.assertEqual(x, {}) self.assertEqual(y, 1) def test_patma_120(self) -> None: @@ -1664,7 +1664,7 @@ def test_patma_120(self) -> None: y = 0 case {**z}: y = 1 - self.assertEqual(x, []) + self.assertEqual(x, {}) self.assertEqual(y, 1) self.assertEqual(z, {}) diff --git a/Python/ast.c b/Python/ast.c index b149e07a1c8bd7..7740c40df02510 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -312,6 +312,7 @@ validate_pattern(expr_ty p) case Attribute_kind: return validate_expr(p, Load); case BinOp_kind: + // TODO return 1; case BoolOp_kind: if (p->v.BoolOp.op != Or) { @@ -332,6 +333,9 @@ validate_pattern(expr_ty p) } } return 1; + case Call_kind: + // TODO + return 1; case Constant_kind: return validate_expr(p, Load); case Dict_kind: @@ -360,6 +364,17 @@ validate_pattern(expr_ty p) } return validate_expr(key, Load); } + else { + if (i != size - 1) { + // TODO + } + if (key->kind != Name_kind) { + // TODO + } + if (key->v.Name.ctx != Store) { + // TODO + } + } if (!validate_pattern(asdl_seq_GET(values, i))) { return 0; } @@ -370,6 +385,15 @@ validate_pattern(expr_ty p) size = asdl_seq_LEN(values); for (i = 0; i < size; i++) { value = asdl_seq_GET(values, i); + if (value->kind == Starred_kind) { + value = value->v.Starred.value; + if (value->kind != Name_kind) { + // TODO + } + if (value->v.Name.ctx != Store) { + // TODO + } + } if (!validate_pattern(value)) { return 0; } diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 217cd6f43aacd4..270192210af362 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -801,6 +801,7 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) return 1; case BoolOp_kind: // TODO: Quite a bit of potential here. + case Call_kind: case Dict_kind: case List_kind: case Name_kind: diff --git a/Python/ceval.c b/Python/ceval.c index 08480844459053..b78d14e3a0ddea 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -898,6 +898,226 @@ match_seq_type(PyObject *target) ); } +static PyObject* +match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) +{ + assert(PyDict_CheckExact(map)); + assert(PyTuple_CheckExact(keys)); + Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); + PyObject *seen = NULL; + PyObject *values = NULL; + if (PyDict_GET_SIZE(map) < nkeys) { + goto fail; + } + seen = PySet_New(NULL); + if (!seen) { + goto fail; + } + values = PyList_New(nkeys); + if (!values) { + goto fail; + } + for (Py_ssize_t i = 0; i < nkeys; i++) { + PyObject *key = PyTuple_GET_ITEM(keys, i); + int dupe = PySet_Contains(seen, key); + if (dupe || PySet_Add(seen, key)) { + if (!_PyErr_Occurred(tstate)) { + _PyErr_Format(tstate, PyExc_ValueError, + "mapping pattern checks duplicate key (%R)", key); + } + goto fail; + } + PyObject *value = PyDict_GetItemWithError(map, key); + if (!value) { + goto fail; + } + Py_INCREF(value); + PyList_SET_ITEM(values, nkeys - 1 - i, value); + if (PyDict_DelItem(map, key)) { + goto fail; + } + } + Py_DECREF(seen); + return values; +fail: + Py_XDECREF(seen); + Py_XDECREF(values); + return NULL; +} + +static Py_ssize_t +get_match_args_required(PyThreadState *tstate, PyObject *proxy) +{ + if (!PyObject_HasAttrString(proxy, "__match_args_required__")) { + return 0; + } + PyObject *mar = PyObject_GetAttrString(proxy, "__match_args_required__"); + if (!mar) { + return -1; + } + if (!PyLong_CheckExact(mar)) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args_required__ must be an int (got %s)", + Py_TYPE(mar)->tp_name); + Py_DECREF(mar); + return -1; + } + Py_ssize_t required = PyLong_AsSsize_t(mar); + Py_DECREF(mar); + if (required < 0) { + if (!_PyErr_Occurred(tstate)) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args_required__ must be nonnegative (got %d)", + required); + } + return -1; + } + return required; +} + +static PyObject * +get_match_args(PyThreadState *tstate, PyObject *proxy) +{ + if (!PyObject_HasAttrString(proxy, "__match_args__")) { + return PyTuple_New(0); + } + PyObject *ma = PyObject_GetAttrString(proxy, "__match_args__"); + if (!ma) { + return NULL; + } + if (!PyList_CheckExact(ma)) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args__ must be a list (got %s)", + Py_TYPE(ma)->tp_name); + Py_DECREF(ma); + return NULL; + } + return PyList_AsTuple(ma); +} + +static PyObject * +do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *type, PyObject *target) +{ + assert(PyLong_CheckExact(count)); + assert(PyTuple_CheckExact(kwargs)); + if (!PyType_Check(type)) { + _PyErr_Format(tstate, PyExc_TypeError, + "called match pattern must be a type; did you mean '%s'?", + Py_TYPE(type)->tp_name); + return NULL; + } + PyObject *method = PyObject_GetAttrString(type, "__match__"); + if (!method) { + return NULL; + } + if (method == Py_None) { + Py_DECREF(method); + _PyErr_Format(tstate, PyExc_TypeError, + "type %s cannot be matched", + Py_TYPE(type)->tp_name); + return NULL; + } + PyObject *proxy = PyObject_CallOneArg(method, target); + Py_DECREF(method); + if (!proxy) { + return NULL; + } + if (proxy == Py_None) { + Py_DECREF(proxy); + return NULL; + } + Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); + Py_ssize_t nargs = PyLong_AsSsize_t(count); + if (nargs < 0) { + Py_DECREF(proxy); + return NULL; + } + nargs -= nkwargs; + PyObject *args; + if (nargs) { + PyObject *_args = get_match_args(tstate, proxy); + if (!_args) { + Py_DECREF(proxy); + return NULL; + } + if (PyTuple_GET_SIZE(_args) < nargs) { + Py_DECREF(_args); + Py_DECREF(proxy); + // TODO: Add expected and actual counts: + _PyErr_SetString(tstate, PyExc_TypeError, + "too many positional matches in pattern"); + return NULL; + } + args = PyTuple_GetSlice(_args, 0, nargs); + Py_DECREF(_args); + } + else { + args = PyTuple_New(0); + } + if (!args) { + Py_DECREF(proxy); + return NULL; + } + assert(PyTuple_CheckExact(args)); + PyObject *attrs = PyList_New(nargs + nkwargs); + if (!attrs) { + Py_DECREF(proxy); + Py_DECREF(args); + return NULL; + } + PyObject *seen = PySet_New(NULL); + if (!seen) { + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(attrs); + return NULL; + } + PyObject *name; + for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { + if (i < nargs) { + name = PyTuple_GET_ITEM(args, i); + } + else { + name = PyTuple_GET_ITEM(kwargs, i - nargs); + } + int dupe = PySet_Contains(seen, name); + if (dupe || PySet_Add(seen, name)) { + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(attrs); + Py_DECREF(seen); + if (!_PyErr_Occurred(tstate)) { + _PyErr_Format(tstate, PyExc_TypeError, + "multiple patterns bound to attribute %R", name); + } + return NULL; + } + if (!PyObject_HasAttr(proxy, name)) { + // TODO: typo checking using __match_args__? + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(attrs); + Py_DECREF(seen); + return NULL; + } + PyObject *attr = PyObject_GetAttr(proxy, name); + if (!attr) { + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(attrs); + Py_DECREF(seen); + return NULL; + } + PyList_SET_ITEM(attrs, nargs + nkwargs - i - 1, attr); + } + // TODO: check __match_args_required__. + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(seen); + return attrs; +} + + static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **); @@ -1577,6 +1797,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(POP_TOP): { + PREDICTED(POP_TOP); PyObject *value = POP(); Py_DECREF(value); FAST_DISPATCH(); @@ -3334,38 +3555,59 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(MATCH_KEY): { - PyObject *key = TOP(); - PyObject *map = SECOND(); - assert(PyDict_CheckExact(map)); - PyObject *value = PyDict_GetItemWithError(map, key); - if (!value) { + case TARGET(LIST_POP): { + PREDICTED(LIST_POP); + PyObject *list = TOP(); + assert(PyList_CheckExact(list)); + Py_ssize_t size = PyList_GET_SIZE(list); + assert(size > 0); + PyObject *popped = PyList_GET_ITEM(list, size - 1); + Py_INCREF(popped); + PUSH(popped); + if (PyList_SetSlice(list, size - 1, size, NULL)) { + goto error; + } + DISPATCH(); + } + + case TARGET(MATCH): { + PyObject *count = TOP(); + PyObject *names = SECOND(); + PyObject *type = THIRD(); + PyObject *target = FOURTH(); + PyObject *attrs = do_match(tstate, count, names, type, target); + Py_DECREF(count); + Py_DECREF(names); + Py_DECREF(type); + Py_DECREF(target); + if (!attrs) { + STACK_SHRINK(4); if (_PyErr_Occurred(tstate)) { goto error; } - STACK_SHRINK(1); - Py_DECREF(key); JUMPBY(oparg); DISPATCH(); } - Py_INCREF(value); - if (PyDict_DelItem(map, key)) { - Py_DECREF(value); - goto error; - } - Py_DECREF(key); - SET_TOP(value); + STACK_SHRINK(3); + SET_TOP(attrs); + PREDICT(LIST_POP); + PREDICT(POP_TOP); DISPATCH(); } - case TARGET(MATCH_MAP): { - PyObject *target = TOP(); + case TARGET(MATCH_MAP): + case TARGET(MATCH_MAP_STAR): { + // TODO: JUST PREPEND THE STAR MAP TO THE LIST! + int star = opcode == MATCH_MAP_STAR; + PyObject *keys = TOP(); + PyObject *target = SECOND(); int match = match_map_type(target); if (match < 0) { goto error; } if (!match) { - STACK_SHRINK(1); + STACK_SHRINK(2); + Py_DECREF(keys); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); @@ -3384,71 +3626,130 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } } - Py_DECREF(target); - SET_TOP(copy); - DISPATCH(); - } - - case TARGET(MATCH_SEQ): { - PyObject *target = TOP(); - int match = match_seq_type(target); - if (match < 0) { - goto error; - } - if (!match) { - STACK_SHRINK(1); + PyObject *values = match_map_items(tstate, copy, keys); + if (!values) { + Py_DECREF(copy); + if (_PyErr_Occurred(tstate)) { + goto error; + } + STACK_SHRINK(2); + Py_DECREF(keys); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); } - PyObject *iter = PyObject_GetIter(target); - if (!iter) { + // TODO: This is inefficient: + if (star && PyList_Insert(values, 0, copy)) { + Py_DECREF(copy); goto error; } + Py_DECREF(copy); + STACK_SHRINK(1); + SET_TOP(values); + Py_DECREF(keys); Py_DECREF(target); - SET_TOP(iter); + PREDICT(LIST_POP); + PREDICT(POP_TOP); DISPATCH(); } - case TARGET(DESTRUCTURE): { - PyObject *type = TOP(); - PyObject *target = SECOND(); - if (!PyType_Check(type)) { - _PyErr_Format(tstate, PyExc_TypeError, - "called match pattern must be a type; " - "did you mean '%s'?", Py_TYPE(type)->tp_name); + case TARGET(MATCH_SEQ): + case TARGET(MATCH_SEQ_STAR): { + int star = opcode == MATCH_SEQ_STAR; + Py_ssize_t size_pre = -1; + if (star) { + PyObject *_size_pre = POP(); + assert(PyLong_CheckExact(_size_pre)); + size_pre = PyLong_AsSsize_t(_size_pre); + Py_DECREF(_size_pre); + if (size_pre < 0) { + goto error; + } + } + PyObject *_size = TOP(); + assert(PyLong_CheckExact(_size)); + Py_ssize_t size = PyLong_AsSsize_t(_size); + if (size < 0) { goto error; } - PyObject *method = PyObject_GetAttrString(type, "__match__"); - if (method == Py_None) { - Py_DECREF(method); - _PyErr_Format(tstate, PyExc_TypeError, - "type '%s' cannot be matched", - Py_TYPE(type)->tp_name); + PyObject *target = SECOND(); + int match = match_seq_type(target); + if (match < 0) { goto error; } - PyObject *match = PyObject_CallOneArg(method, target); - Py_DECREF(method); if (!match) { + STACK_SHRINK(2); + Py_DECREF(_size); + Py_DECREF(target); + JUMPBY(oparg); + DISPATCH(); + } + // TODO: Break this out: + PyObject *list = PySequence_List(target); + if (!list) { goto error; } - if (match == Py_None) { - Py_DECREF(match); + if (!star) { + assert(size_pre < 0); + if (PyList_GET_SIZE(list) != size) { + Py_DECREF(list); + STACK_SHRINK(2); + Py_DECREF(_size); + Py_DECREF(target); + JUMPBY(oparg); + DISPATCH(); + } + if (PyList_Reverse(list)) { + Py_DECREF(list); + goto error; + } + STACK_SHRINK(1); + SET_TOP(list); + Py_DECREF(_size); + Py_DECREF(target); + DISPATCH(); + } + assert(size_pre >= 0); + Py_ssize_t actual = PyList_GET_SIZE(list); + if (actual < size_pre + size) { + Py_DECREF(list); STACK_SHRINK(2); - Py_DECREF(type); + Py_DECREF(_size); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); } + PyObject *middle = PyList_GetSlice(list, size_pre, actual - size); + if (!middle) { + Py_DECREF(list); + goto error; + } + PyObject *nested = PyTuple_Pack(1, middle); + Py_DECREF(middle); + if (!nested) { + Py_DECREF(list); + goto error; + } + if (PyList_SetSlice(list, size_pre, actual - size, nested)) { + Py_DECREF(nested); + Py_DECREF(list); + goto error; + } + Py_DECREF(nested); + if (PyList_Reverse(list)) { + Py_DECREF(list); + goto error; + } + assert(PyList_GET_SIZE(list) == size_pre + 1 + size); STACK_SHRINK(1); - Py_DECREF(type); + SET_TOP(list); + Py_DECREF(_size); Py_DECREF(target); - SET_TOP(match); + PREDICT(LIST_POP); + PREDICT(POP_TOP); DISPATCH(); } - - case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index 8c4ec1b3742d36..c584e5faeccc6a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -982,12 +982,6 @@ stack_effect(int opcode, int oparg, int jump) case FOR_ITER: /* -1 at end of iterator, 1 if continue iterating. */ return jump > 0 ? -1 : 1; - case MATCH_KEY: - case MATCH_MAP: - case MATCH_SEQ: - return jump > 0 ? -1 : 0; - case DESTRUCTURE: - return -1; case STORE_ATTR: return -2; @@ -1124,6 +1118,16 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; + case LIST_POP: + return 1; + case MATCH: + return jump > 0 ? -4 : -3; + case MATCH_MAP: + case MATCH_MAP_STAR: + case MATCH_SEQ: + return jump > 0 ? -2 : -1; + case MATCH_SEQ_STAR: + return jump > 0 ? -3 : -2; default: return PY_INVALID_STACK_EFFECT; } @@ -2771,6 +2775,53 @@ compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) return 1; } +static int +compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { + asdl_seq *args = p->v.Call.args; + asdl_seq *kwargs = p->v.Call.keywords; + Py_ssize_t nargs = asdl_seq_LEN(args); + Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + expr_ty func = p->v.Call.func; + assert(func->kind == Attribute_kind || func->kind == Name_kind); + assert(func->kind != Attribute_kind || func->v.Attribute.ctx == Load); + assert(func->kind != Name_kind || func->v.Name.ctx == Load); + VISIT(c, expr, func); + PyObject *kwnames; + CHECK(kwnames = PyTuple_New(nkwargs)); + // TODO: Catch colliding keywords. + Py_ssize_t i; + for (i = 0; i < nkwargs; i++) { + PyObject *name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; + Py_INCREF(name); + PyTuple_SET_ITEM(kwnames, i, name); + } + ADDOP_LOAD_CONST_NEW(c, kwnames); + PyObject *count; + CHECK(count = PyLong_FromSsize_t(nargs + nkwargs)); + ADDOP_LOAD_CONST_NEW(c, count); + ADDOP_JREL(c, MATCH, fail); + for (i = 0; i < nargs; i++) { + expr_ty arg = asdl_seq_GET(args, i); + ADDOP(c, LIST_POP); + CHECK(compiler_pattern(c, arg, block, names)); + } + for (i = 0; i < nkwargs; i++) { + keyword_ty kwarg = asdl_seq_GET(kwargs, i); + ADDOP(c, LIST_POP); + CHECK(compiler_pattern(c, kwarg->value, block, names)); + } + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); + return 1; +} + static int compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok, PyObject* names) { assert(p->kind == Name_kind); @@ -2790,6 +2841,44 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok, PyObject* nam return !PySet_Add(names, p->v.Name.id); } +static int +compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +{ + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + asdl_seq *keys = p->v.Dict.keys; + asdl_seq *values = p->v.Dict.values; + Py_ssize_t size = asdl_seq_LEN(values); + int star = size ? !asdl_seq_GET(keys, size - 1) : 0; + Py_ssize_t i; + for (i = 0; i < size - star; i++) { + expr_ty key = asdl_seq_GET(keys, i); + if (!key) { + return compiler_error(c, "can't use starred pattern here; consider moving to end?"); + } + assert(key->kind == Attribute_kind || key->kind == Constant_kind || key->kind == Name_kind); + assert(key->kind != Attribute_kind || key->v.Attribute.ctx == Load); + assert(key->kind != Name_kind || key->v.Name.ctx == Load); + VISIT(c, expr, asdl_seq_GET(keys, i)); + } + ADDOP_I(c, BUILD_TUPLE, size - star); + // TODO: Just drop MATCH_MAP_STAR? + ADDOP_JREL(c, star ? MATCH_MAP_STAR : MATCH_MAP, fail); + for (i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + ADDOP(c, LIST_POP); + CHECK(compiler_pattern(c, value, block, names)); + } + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, fail); + compiler_use_next_block(c, end); + return 1; +} + static int compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { @@ -2819,44 +2908,6 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail, PyOb return 1; } -static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) -{ - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); - asdl_seq *keys = p->v.Dict.keys; - asdl_seq *values = p->v.Dict.values; - Py_ssize_t size = asdl_seq_LEN(values); - int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP_JREL(c, MATCH_MAP, fail); - for (Py_ssize_t i = 0; i < size - star; i++) { - expr_ty key = asdl_seq_GET(keys, i); - expr_ty value = asdl_seq_GET(values, i); - if (!key) { - return compiler_error(c, "can't use starred pattern here; consider moving to end?"); - } - assert(key->kind == Attribute_kind || key->kind == Constant_kind || key->kind == Name_kind); - assert(key->kind != Attribute_kind || key->v.Attribute.ctx == Load); - assert(key->kind != Name_kind || key->v.Name.ctx == Load); - VISIT(c, expr, key); - ADDOP_JREL(c, MATCH_KEY, block); - CHECK(compiler_pattern(c, value, block, names)); - } - if (!star) { - ADDOP(c, POP_TOP); - } - else { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0, names)); - } - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); - compiler_use_next_block(c, end); - return 1; -} - static int compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { @@ -2867,17 +2918,16 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* n CHECK(end = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); assert(size > 1); + PyObject *names_copy; for (Py_ssize_t i = 0; i < size; i++) { - PyObject *names_copy = PySet_New(names); - if (!names_copy) { - return 0; - } + CHECK(names_copy = PySet_New(names)); CHECK(block = compiler_new_block(c)); ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), block, names_copy)); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); + // TODO: Reuse names_copy without actually building a new copy each loop? if (!i) { control = names_copy; } @@ -2924,44 +2974,33 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj if (star >= 0) { return compiler_error(c, "multiple starred names in pattern"); } - // TODO: Test this math: - if ((size - i - 1) << 8 >= INT_MAX) { - return compiler_error(c, "too many sub-patterns follow starred name"); - } star = i; } basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP_JREL(c, MATCH_SEQ, fail); + if (star >= 0) { + // TODO: ERROR CHECKING FOR THESE: + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star - 1)) + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(star)) + ADDOP_JREL(c, MATCH_SEQ_STAR, fail); + } + else { + // TODO: ERROR CHECKING FOR THESE: + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)) + ADDOP_JREL(c, MATCH_SEQ, fail); + } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (i == star) { assert(value->kind == Starred_kind); - Py_ssize_t remaining = size - i - 1; - ADDOP_I(c, UNPACK_EX, remaining << 8); - CHECK(compiler_pattern_store(c, value->v.Starred.value, 1, names)); - if (remaining) { - ADDOP_I(c, BUILD_TUPLE, remaining); - if (remaining > 1) { - // Argh, our tuple is backwards! - // Unpacking and repacking is the easiest way to reverse it: - ADDOP_I(c, UNPACK_SEQUENCE, remaining); - ADDOP_I(c, BUILD_TUPLE, remaining); - } - ADDOP(c, GET_ITER); - } - else { - ADDOP_JREL(c, JUMP_FORWARD, end); - } - } - else { - ADDOP_JREL(c, FOR_ITER, fail); - CHECK(compiler_pattern(c, value, block, names)); + value = value->v.Starred.value; } + ADDOP(c, LIST_POP); + CHECK(compiler_pattern(c, value, block, names)); } - ADDOP_JREL(c, FOR_ITER, end); ADDOP(c, POP_TOP); + ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, fail); @@ -2974,6 +3013,9 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name { switch (p->kind) { case Attribute_kind: + return compiler_pattern_load(c, p, fail); + case Call_kind: + return compiler_pattern_call(c, p, fail, names); case Constant_kind: return compiler_pattern_load(c, p, fail); case BoolOp_kind: diff --git a/Python/importlib_external.h b/Python/importlib_external.h index b0a3575fd29166..068165d1c53af2 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,112,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,114,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index b0c7e0fe5f6226..4309e5360ca0cc 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -6,7 +6,7 @@ static void *opcode_targets[256] = { &&TARGET_DUP_TOP, &&TARGET_DUP_TOP_TWO, &&TARGET_ROT_FOUR, - &&_unknown_opcode, + &&TARGET_LIST_POP, &&_unknown_opcode, &&TARGET_NOP, &&TARGET_UNARY_POSITIVE, @@ -165,11 +165,11 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&TARGET_MATCH_KEY, + &&TARGET_MATCH, &&TARGET_MATCH_MAP, + &&TARGET_MATCH_MAP_STAR, &&TARGET_MATCH_SEQ, - &&TARGET_DESTRUCTURE, - &&_unknown_opcode, + &&TARGET_MATCH_SEQ_STAR, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 03212eab43f11b83ed3185588f41c14f1dae6f31 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 3 Jun 2020 18:27:50 -0700 Subject: [PATCH 060/218] Simplify final (or only) case --- Python/compile.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index c584e5faeccc6a..d8d422ab0106ac 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3040,10 +3040,13 @@ compiler_match(struct compiler *c, stmt_ty s) basicblock *next, *end; CHECK(end = compiler_new_block(c)); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); + assert(cases); for (Py_ssize_t i = 0; i < cases; i++) { match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); CHECK(next = compiler_new_block(c)); - ADDOP(c, DUP_TOP); + if (i != cases - 1) { + ADDOP(c, DUP_TOP); + } PyObject* names = PySet_New(NULL); if (!names) { return 0; @@ -3054,12 +3057,15 @@ compiler_match(struct compiler *c, stmt_ty s) if (m->guard) { CHECK(compiler_jump_if(c, m->guard, next, 0)); } - ADDOP(c, POP_TOP); + if (i != cases - 1) { + ADDOP(c, POP_TOP); + } VISIT_SEQ(c, stmt, m->body); - ADDOP_JREL(c, JUMP_FORWARD, end); + if (i != cases - 1) { + ADDOP_JREL(c, JUMP_FORWARD, end); + } compiler_use_next_block(c, next); } - ADDOP(c, POP_TOP); compiler_use_next_block(c, end); return 1; } From ccf83741f8deaff99f8c8f429f130a30cd7997dd Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 5 Jun 2020 07:14:03 -0700 Subject: [PATCH 061/218] Tell the peepholer about all of the jumping we do --- Python/peephole.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Python/peephole.c b/Python/peephole.c index 84de1abc175476..7bc5865bab1fa0 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -199,6 +199,11 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: + case MATCH: + case MATCH_MAP: + case MATCH_MAP_STAR: + case MATCH_SEQ: + case MATCH_SEQ_STAR: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -503,6 +508,11 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: + case MATCH: + case MATCH_MAP: + case MATCH_MAP_STAR: + case MATCH_SEQ: + case MATCH_SEQ_STAR: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From c7f121b987ee8e728468a24c1aaf47e413172889 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 5 Jun 2020 08:23:14 -0700 Subject: [PATCH 062/218] Reject f-strings, addition, and subtraction --- Python/ast_opt.c | 12 ++++++++++-- Python/compile.c | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 270192210af362..5079a59547d3af 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -772,8 +772,14 @@ astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state assert(node_->v.BinOp.op == Add || node_->v.BinOp.op == Sub); assert(node_->v.BinOp.left->kind = Constant_kind); assert(node_->v.BinOp.right->kind = Constant_kind); - assert(PyFloat_CheckExact(left->v.Constant.value) || PyLong_CheckExact(left->v.Constant.value)); - assert(PyComplex_CheckExact(right->v.Constant.value)); + if (!PyFloat_CheckExact(left->v.Constant.value) && !PyLong_CheckExact(left->v.Constant.value)) { + // Not actually valid, but it's the complier's job to complain: + return 1; + } + if (!PyComplex_CheckExact(right->v.Constant.value)) { + // Ditto: + return 1; + } PyObject *new; if (node_->v.BinOp.op == Add) { new = PyNumber_Add(left->v.Constant.value, right->v.Constant.value); @@ -803,6 +809,8 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) // TODO: Quite a bit of potential here. case Call_kind: case Dict_kind: + // Not actually valid, but it's the complier's job to complain: + case JoinedStr_kind: case List_kind: case Name_kind: case NamedExpr_kind: diff --git a/Python/compile.c b/Python/compile.c index d8d422ab0106ac..9d804193fae348 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3014,6 +3014,9 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name switch (p->kind) { case Attribute_kind: return compiler_pattern_load(c, p, fail); + case BinOp_kind: + // Because we allow "2+2j", things like "2+2" make it this far. + return compiler_error(c, "patterns cannot include operators"); case Call_kind: return compiler_pattern_call(c, p, fail, names); case Constant_kind: @@ -3028,6 +3031,9 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name return compiler_pattern_name(c, p, fail, names); case NamedExpr_kind: return compiler_pattern_namedexpr(c, p, fail, names); + case JoinedStr_kind: + // Because we allow strings, f-strings make it this far. + return compiler_error(c, "patterns cannot include f-strings"); default: Py_UNREACHABLE(); } From 8d61da21a3ca773c41a30d98fb38e9da65e20851 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 5 Jun 2020 11:05:49 -0700 Subject: [PATCH 063/218] __match_args__ must contain strings --- Python/ceval.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index b78d14e3a0ddea..4cfbe90b4cfbb8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1076,6 +1076,17 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { if (i < nargs) { name = PyTuple_GET_ITEM(args, i); + if (!PyUnicode_CheckExact(name)) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args__ elements must be str (got %s)", + Py_TYPE(name)->tp_name); + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(attrs); + Py_DECREF(seen); + Py_DECREF(name); + return NULL; + } } else { name = PyTuple_GET_ITEM(kwargs, i - nargs); From 0c15e70318e7a9b414d8a4cc0709eabd36cff6e0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 5 Jun 2020 12:41:45 -0700 Subject: [PATCH 064/218] Better error messages for tuples --- Grammar/python.gram | 13 +- Parser/pegen/parse.c | 775 ++++++++++++++++++++++++------------------- 2 files changed, 448 insertions(+), 340 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index f25e710c335f22..2c35a6f27e734f 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -196,13 +196,22 @@ match_stmt: | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block: - | "case" pattern=pattern guard=guard? ':' body=block { + | "case" pattern=pattern_no_comma guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } +pattern_no_comma: + | pattern=pattern !',' { + pattern } + | pattern error=',' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[...]'?") } + pattern[expr_ty]: | target=NAME ':=' value=or_pattern { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } + | error='(' ')' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[]'?") } | or_pattern + guard: | 'if' guard=named_expression { guard } @@ -243,7 +252,7 @@ constant_pattern: | '.'? attr=attr !('.' | '(' | '=') { attr } group_pattern: - | '(' pattern=pattern ')' { + | '(' pattern=pattern_no_comma ')' { pattern } sequence_pattern: | '[' values=values_pattern? ']' { diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 123d6c3ede8542..82859de4751dbc 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -115,329 +115,330 @@ static KeywordToken *reserved_keywords[] = { #define finally_block_type 1037 #define match_stmt_type 1038 #define case_block_type 1039 -#define pattern_type 1040 -#define guard_type 1041 -#define or_pattern_type 1042 -#define closed_pattern_type 1043 -#define name_pattern_type 1044 -#define literal_pattern_type 1045 -#define constant_pattern_type 1046 -#define group_pattern_type 1047 -#define sequence_pattern_type 1048 -#define mapping_pattern_type 1049 -#define class_pattern_type 1050 -#define signed_number_type 1051 -#define attr_type 1052 // Left-recursive -#define name_or_attr_type 1053 // Left-recursive -#define values_pattern_type 1054 -#define items_pattern_type 1055 -#define keyword_pattern_type 1056 -#define argument_pattern_type 1057 -#define error_star_type 1058 -#define value_pattern_type 1059 -#define key_value_pattern_type 1060 -#define return_stmt_type 1061 -#define raise_stmt_type 1062 -#define function_def_type 1063 -#define function_def_raw_type 1064 -#define func_type_comment_type 1065 -#define params_type 1066 -#define parameters_type 1067 -#define slash_no_default_type 1068 -#define slash_with_default_type 1069 -#define star_etc_type 1070 -#define kwds_type 1071 -#define param_no_default_type 1072 -#define param_with_default_type 1073 -#define param_maybe_default_type 1074 -#define param_type 1075 -#define annotation_type 1076 -#define default_type 1077 -#define decorators_type 1078 -#define class_def_type 1079 -#define class_def_raw_type 1080 -#define block_type 1081 -#define expressions_list_type 1082 -#define star_expressions_type 1083 -#define star_expression_type 1084 -#define star_named_expressions_type 1085 -#define star_named_expression_type 1086 -#define named_expression_type 1087 -#define annotated_rhs_type 1088 -#define expressions_type 1089 -#define expression_type 1090 -#define lambdef_type 1091 -#define lambda_parameters_type 1092 -#define lambda_slash_no_default_type 1093 -#define lambda_slash_with_default_type 1094 -#define lambda_star_etc_type 1095 -#define lambda_kwds_type 1096 -#define lambda_param_no_default_type 1097 -#define lambda_param_with_default_type 1098 -#define lambda_param_maybe_default_type 1099 -#define lambda_param_type 1100 -#define disjunction_type 1101 -#define conjunction_type 1102 -#define inversion_type 1103 -#define comparison_type 1104 -#define compare_op_bitwise_or_pair_type 1105 -#define eq_bitwise_or_type 1106 -#define noteq_bitwise_or_type 1107 -#define lte_bitwise_or_type 1108 -#define lt_bitwise_or_type 1109 -#define gte_bitwise_or_type 1110 -#define gt_bitwise_or_type 1111 -#define notin_bitwise_or_type 1112 -#define in_bitwise_or_type 1113 -#define isnot_bitwise_or_type 1114 -#define is_bitwise_or_type 1115 -#define bitwise_or_type 1116 // Left-recursive -#define bitwise_xor_type 1117 // Left-recursive -#define bitwise_and_type 1118 // Left-recursive -#define shift_expr_type 1119 // Left-recursive -#define sum_type 1120 // Left-recursive -#define term_type 1121 // Left-recursive -#define factor_type 1122 -#define power_type 1123 -#define await_primary_type 1124 -#define primary_type 1125 // Left-recursive -#define slices_type 1126 -#define slice_type 1127 -#define atom_type 1128 -#define strings_type 1129 -#define list_type 1130 -#define listcomp_type 1131 -#define tuple_type 1132 -#define group_type 1133 -#define genexp_type 1134 -#define set_type 1135 -#define setcomp_type 1136 -#define dict_type 1137 -#define dictcomp_type 1138 -#define double_starred_kvpairs_type 1139 -#define double_starred_kvpair_type 1140 -#define kvpair_type 1141 -#define for_if_clauses_type 1142 -#define for_if_clause_type 1143 -#define yield_expr_type 1144 -#define arguments_type 1145 -#define args_type 1146 -#define kwargs_type 1147 -#define starred_expression_type 1148 -#define kwarg_or_starred_type 1149 -#define kwarg_or_double_starred_type 1150 -#define star_targets_type 1151 -#define star_targets_seq_type 1152 -#define star_target_type 1153 -#define star_atom_type 1154 -#define single_target_type 1155 -#define single_subscript_attribute_target_type 1156 -#define del_targets_type 1157 -#define del_target_type 1158 -#define del_t_atom_type 1159 -#define del_target_end_type 1160 -#define targets_type 1161 -#define target_type 1162 -#define t_primary_type 1163 // Left-recursive -#define t_lookahead_type 1164 -#define t_atom_type 1165 -#define incorrect_arguments_type 1166 -#define invalid_kwarg_type 1167 -#define invalid_named_expression_type 1168 -#define invalid_assignment_type 1169 -#define invalid_block_type 1170 -#define invalid_comprehension_type 1171 -#define invalid_dict_comprehension_type 1172 -#define invalid_parameters_type 1173 -#define invalid_star_etc_type 1174 -#define invalid_lambda_star_etc_type 1175 -#define invalid_double_type_comments_type 1176 -#define invalid_del_target_type 1177 -#define invalid_import_from_targets_type 1178 -#define _loop0_1_type 1179 -#define _loop0_2_type 1180 -#define _loop0_4_type 1181 -#define _gather_3_type 1182 -#define _loop0_6_type 1183 -#define _gather_5_type 1184 -#define _loop0_8_type 1185 -#define _gather_7_type 1186 -#define _loop0_10_type 1187 -#define _gather_9_type 1188 -#define _loop1_11_type 1189 -#define _loop0_13_type 1190 -#define _gather_12_type 1191 -#define _tmp_14_type 1192 -#define _tmp_15_type 1193 -#define _tmp_16_type 1194 -#define _tmp_17_type 1195 -#define _tmp_18_type 1196 -#define _tmp_19_type 1197 -#define _tmp_20_type 1198 -#define _tmp_21_type 1199 -#define _loop1_22_type 1200 -#define _tmp_23_type 1201 -#define _tmp_24_type 1202 -#define _loop0_26_type 1203 -#define _gather_25_type 1204 -#define _loop0_28_type 1205 -#define _gather_27_type 1206 -#define _tmp_29_type 1207 -#define _loop0_30_type 1208 -#define _loop1_31_type 1209 -#define _loop0_33_type 1210 -#define _gather_32_type 1211 -#define _tmp_34_type 1212 -#define _loop0_36_type 1213 -#define _gather_35_type 1214 -#define _tmp_37_type 1215 -#define _loop0_39_type 1216 -#define _gather_38_type 1217 -#define _loop0_41_type 1218 -#define _gather_40_type 1219 -#define _loop0_43_type 1220 -#define _gather_42_type 1221 -#define _loop0_45_type 1222 -#define _gather_44_type 1223 -#define _tmp_46_type 1224 -#define _loop1_47_type 1225 -#define _tmp_48_type 1226 -#define _loop1_49_type 1227 -#define _loop0_51_type 1228 -#define _gather_50_type 1229 -#define _tmp_52_type 1230 -#define _tmp_53_type 1231 -#define _tmp_54_type 1232 -#define _tmp_55_type 1233 -#define _loop0_57_type 1234 -#define _gather_56_type 1235 -#define _loop0_59_type 1236 -#define _gather_58_type 1237 -#define _loop0_61_type 1238 -#define _gather_60_type 1239 -#define _loop0_63_type 1240 -#define _gather_62_type 1241 -#define _tmp_64_type 1242 -#define _loop0_66_type 1243 -#define _gather_65_type 1244 -#define _tmp_67_type 1245 -#define _tmp_68_type 1246 -#define _tmp_69_type 1247 -#define _loop0_71_type 1248 -#define _gather_70_type 1249 -#define _loop0_73_type 1250 -#define _gather_72_type 1251 -#define _tmp_74_type 1252 -#define _tmp_75_type 1253 -#define _tmp_76_type 1254 -#define _tmp_77_type 1255 -#define _tmp_78_type 1256 -#define _tmp_79_type 1257 -#define _loop0_80_type 1258 -#define _loop0_81_type 1259 -#define _loop0_82_type 1260 -#define _loop1_83_type 1261 -#define _loop0_84_type 1262 -#define _loop1_85_type 1263 -#define _loop1_86_type 1264 -#define _loop1_87_type 1265 -#define _loop0_88_type 1266 -#define _loop1_89_type 1267 -#define _loop0_90_type 1268 -#define _loop1_91_type 1269 -#define _loop0_92_type 1270 -#define _loop1_93_type 1271 -#define _loop1_94_type 1272 -#define _tmp_95_type 1273 -#define _loop0_97_type 1274 -#define _gather_96_type 1275 -#define _loop1_98_type 1276 -#define _loop0_100_type 1277 -#define _gather_99_type 1278 -#define _loop1_101_type 1279 -#define _loop0_102_type 1280 -#define _loop0_103_type 1281 -#define _loop0_104_type 1282 -#define _loop1_105_type 1283 -#define _loop0_106_type 1284 -#define _loop1_107_type 1285 -#define _loop1_108_type 1286 -#define _loop1_109_type 1287 -#define _loop0_110_type 1288 -#define _loop1_111_type 1289 -#define _loop0_112_type 1290 -#define _loop1_113_type 1291 -#define _loop0_114_type 1292 -#define _loop1_115_type 1293 -#define _loop1_116_type 1294 -#define _loop1_117_type 1295 -#define _loop1_118_type 1296 -#define _tmp_119_type 1297 -#define _loop0_121_type 1298 -#define _gather_120_type 1299 -#define _tmp_122_type 1300 -#define _tmp_123_type 1301 -#define _tmp_124_type 1302 -#define _tmp_125_type 1303 -#define _loop1_126_type 1304 -#define _tmp_127_type 1305 -#define _tmp_128_type 1306 -#define _loop0_130_type 1307 -#define _gather_129_type 1308 -#define _loop1_131_type 1309 -#define _loop0_132_type 1310 -#define _loop0_133_type 1311 -#define _tmp_134_type 1312 -#define _tmp_135_type 1313 -#define _loop0_137_type 1314 -#define _gather_136_type 1315 -#define _loop0_139_type 1316 -#define _gather_138_type 1317 -#define _loop0_141_type 1318 -#define _gather_140_type 1319 -#define _loop0_143_type 1320 -#define _gather_142_type 1321 -#define _loop0_144_type 1322 -#define _loop0_146_type 1323 -#define _gather_145_type 1324 -#define _tmp_147_type 1325 -#define _loop0_149_type 1326 -#define _gather_148_type 1327 -#define _loop0_151_type 1328 -#define _gather_150_type 1329 -#define _tmp_152_type 1330 -#define _loop0_153_type 1331 -#define _tmp_154_type 1332 -#define _tmp_155_type 1333 -#define _tmp_156_type 1334 -#define _tmp_157_type 1335 -#define _loop0_158_type 1336 -#define _tmp_159_type 1337 -#define _tmp_160_type 1338 -#define _tmp_161_type 1339 -#define _tmp_162_type 1340 -#define _tmp_163_type 1341 -#define _tmp_164_type 1342 -#define _loop0_166_type 1343 -#define _gather_165_type 1344 -#define _loop0_168_type 1345 -#define _gather_167_type 1346 -#define _loop0_170_type 1347 -#define _gather_169_type 1348 -#define _loop0_172_type 1349 -#define _gather_171_type 1350 -#define _tmp_173_type 1351 -#define _tmp_174_type 1352 -#define _tmp_175_type 1353 -#define _tmp_176_type 1354 -#define _tmp_177_type 1355 -#define _tmp_178_type 1356 -#define _tmp_179_type 1357 -#define _tmp_180_type 1358 -#define _loop1_181_type 1359 -#define _tmp_182_type 1360 -#define _tmp_183_type 1361 -#define _tmp_184_type 1362 +#define pattern_no_comma_type 1040 +#define pattern_type 1041 +#define guard_type 1042 +#define or_pattern_type 1043 +#define closed_pattern_type 1044 +#define name_pattern_type 1045 +#define literal_pattern_type 1046 +#define constant_pattern_type 1047 +#define group_pattern_type 1048 +#define sequence_pattern_type 1049 +#define mapping_pattern_type 1050 +#define class_pattern_type 1051 +#define signed_number_type 1052 +#define attr_type 1053 // Left-recursive +#define name_or_attr_type 1054 // Left-recursive +#define values_pattern_type 1055 +#define items_pattern_type 1056 +#define keyword_pattern_type 1057 +#define argument_pattern_type 1058 +#define error_star_type 1059 +#define value_pattern_type 1060 +#define key_value_pattern_type 1061 +#define return_stmt_type 1062 +#define raise_stmt_type 1063 +#define function_def_type 1064 +#define function_def_raw_type 1065 +#define func_type_comment_type 1066 +#define params_type 1067 +#define parameters_type 1068 +#define slash_no_default_type 1069 +#define slash_with_default_type 1070 +#define star_etc_type 1071 +#define kwds_type 1072 +#define param_no_default_type 1073 +#define param_with_default_type 1074 +#define param_maybe_default_type 1075 +#define param_type 1076 +#define annotation_type 1077 +#define default_type 1078 +#define decorators_type 1079 +#define class_def_type 1080 +#define class_def_raw_type 1081 +#define block_type 1082 +#define expressions_list_type 1083 +#define star_expressions_type 1084 +#define star_expression_type 1085 +#define star_named_expressions_type 1086 +#define star_named_expression_type 1087 +#define named_expression_type 1088 +#define annotated_rhs_type 1089 +#define expressions_type 1090 +#define expression_type 1091 +#define lambdef_type 1092 +#define lambda_parameters_type 1093 +#define lambda_slash_no_default_type 1094 +#define lambda_slash_with_default_type 1095 +#define lambda_star_etc_type 1096 +#define lambda_kwds_type 1097 +#define lambda_param_no_default_type 1098 +#define lambda_param_with_default_type 1099 +#define lambda_param_maybe_default_type 1100 +#define lambda_param_type 1101 +#define disjunction_type 1102 +#define conjunction_type 1103 +#define inversion_type 1104 +#define comparison_type 1105 +#define compare_op_bitwise_or_pair_type 1106 +#define eq_bitwise_or_type 1107 +#define noteq_bitwise_or_type 1108 +#define lte_bitwise_or_type 1109 +#define lt_bitwise_or_type 1110 +#define gte_bitwise_or_type 1111 +#define gt_bitwise_or_type 1112 +#define notin_bitwise_or_type 1113 +#define in_bitwise_or_type 1114 +#define isnot_bitwise_or_type 1115 +#define is_bitwise_or_type 1116 +#define bitwise_or_type 1117 // Left-recursive +#define bitwise_xor_type 1118 // Left-recursive +#define bitwise_and_type 1119 // Left-recursive +#define shift_expr_type 1120 // Left-recursive +#define sum_type 1121 // Left-recursive +#define term_type 1122 // Left-recursive +#define factor_type 1123 +#define power_type 1124 +#define await_primary_type 1125 +#define primary_type 1126 // Left-recursive +#define slices_type 1127 +#define slice_type 1128 +#define atom_type 1129 +#define strings_type 1130 +#define list_type 1131 +#define listcomp_type 1132 +#define tuple_type 1133 +#define group_type 1134 +#define genexp_type 1135 +#define set_type 1136 +#define setcomp_type 1137 +#define dict_type 1138 +#define dictcomp_type 1139 +#define double_starred_kvpairs_type 1140 +#define double_starred_kvpair_type 1141 +#define kvpair_type 1142 +#define for_if_clauses_type 1143 +#define for_if_clause_type 1144 +#define yield_expr_type 1145 +#define arguments_type 1146 +#define args_type 1147 +#define kwargs_type 1148 +#define starred_expression_type 1149 +#define kwarg_or_starred_type 1150 +#define kwarg_or_double_starred_type 1151 +#define star_targets_type 1152 +#define star_targets_seq_type 1153 +#define star_target_type 1154 +#define star_atom_type 1155 +#define single_target_type 1156 +#define single_subscript_attribute_target_type 1157 +#define del_targets_type 1158 +#define del_target_type 1159 +#define del_t_atom_type 1160 +#define del_target_end_type 1161 +#define targets_type 1162 +#define target_type 1163 +#define t_primary_type 1164 // Left-recursive +#define t_lookahead_type 1165 +#define t_atom_type 1166 +#define incorrect_arguments_type 1167 +#define invalid_kwarg_type 1168 +#define invalid_named_expression_type 1169 +#define invalid_assignment_type 1170 +#define invalid_block_type 1171 +#define invalid_comprehension_type 1172 +#define invalid_dict_comprehension_type 1173 +#define invalid_parameters_type 1174 +#define invalid_star_etc_type 1175 +#define invalid_lambda_star_etc_type 1176 +#define invalid_double_type_comments_type 1177 +#define invalid_del_target_type 1178 +#define invalid_import_from_targets_type 1179 +#define _loop0_1_type 1180 +#define _loop0_2_type 1181 +#define _loop0_4_type 1182 +#define _gather_3_type 1183 +#define _loop0_6_type 1184 +#define _gather_5_type 1185 +#define _loop0_8_type 1186 +#define _gather_7_type 1187 +#define _loop0_10_type 1188 +#define _gather_9_type 1189 +#define _loop1_11_type 1190 +#define _loop0_13_type 1191 +#define _gather_12_type 1192 +#define _tmp_14_type 1193 +#define _tmp_15_type 1194 +#define _tmp_16_type 1195 +#define _tmp_17_type 1196 +#define _tmp_18_type 1197 +#define _tmp_19_type 1198 +#define _tmp_20_type 1199 +#define _tmp_21_type 1200 +#define _loop1_22_type 1201 +#define _tmp_23_type 1202 +#define _tmp_24_type 1203 +#define _loop0_26_type 1204 +#define _gather_25_type 1205 +#define _loop0_28_type 1206 +#define _gather_27_type 1207 +#define _tmp_29_type 1208 +#define _loop0_30_type 1209 +#define _loop1_31_type 1210 +#define _loop0_33_type 1211 +#define _gather_32_type 1212 +#define _tmp_34_type 1213 +#define _loop0_36_type 1214 +#define _gather_35_type 1215 +#define _tmp_37_type 1216 +#define _loop0_39_type 1217 +#define _gather_38_type 1218 +#define _loop0_41_type 1219 +#define _gather_40_type 1220 +#define _loop0_43_type 1221 +#define _gather_42_type 1222 +#define _loop0_45_type 1223 +#define _gather_44_type 1224 +#define _tmp_46_type 1225 +#define _loop1_47_type 1226 +#define _tmp_48_type 1227 +#define _loop1_49_type 1228 +#define _loop0_51_type 1229 +#define _gather_50_type 1230 +#define _tmp_52_type 1231 +#define _tmp_53_type 1232 +#define _tmp_54_type 1233 +#define _tmp_55_type 1234 +#define _loop0_57_type 1235 +#define _gather_56_type 1236 +#define _loop0_59_type 1237 +#define _gather_58_type 1238 +#define _loop0_61_type 1239 +#define _gather_60_type 1240 +#define _loop0_63_type 1241 +#define _gather_62_type 1242 +#define _tmp_64_type 1243 +#define _loop0_66_type 1244 +#define _gather_65_type 1245 +#define _tmp_67_type 1246 +#define _tmp_68_type 1247 +#define _tmp_69_type 1248 +#define _loop0_71_type 1249 +#define _gather_70_type 1250 +#define _loop0_73_type 1251 +#define _gather_72_type 1252 +#define _tmp_74_type 1253 +#define _tmp_75_type 1254 +#define _tmp_76_type 1255 +#define _tmp_77_type 1256 +#define _tmp_78_type 1257 +#define _tmp_79_type 1258 +#define _loop0_80_type 1259 +#define _loop0_81_type 1260 +#define _loop0_82_type 1261 +#define _loop1_83_type 1262 +#define _loop0_84_type 1263 +#define _loop1_85_type 1264 +#define _loop1_86_type 1265 +#define _loop1_87_type 1266 +#define _loop0_88_type 1267 +#define _loop1_89_type 1268 +#define _loop0_90_type 1269 +#define _loop1_91_type 1270 +#define _loop0_92_type 1271 +#define _loop1_93_type 1272 +#define _loop1_94_type 1273 +#define _tmp_95_type 1274 +#define _loop0_97_type 1275 +#define _gather_96_type 1276 +#define _loop1_98_type 1277 +#define _loop0_100_type 1278 +#define _gather_99_type 1279 +#define _loop1_101_type 1280 +#define _loop0_102_type 1281 +#define _loop0_103_type 1282 +#define _loop0_104_type 1283 +#define _loop1_105_type 1284 +#define _loop0_106_type 1285 +#define _loop1_107_type 1286 +#define _loop1_108_type 1287 +#define _loop1_109_type 1288 +#define _loop0_110_type 1289 +#define _loop1_111_type 1290 +#define _loop0_112_type 1291 +#define _loop1_113_type 1292 +#define _loop0_114_type 1293 +#define _loop1_115_type 1294 +#define _loop1_116_type 1295 +#define _loop1_117_type 1296 +#define _loop1_118_type 1297 +#define _tmp_119_type 1298 +#define _loop0_121_type 1299 +#define _gather_120_type 1300 +#define _tmp_122_type 1301 +#define _tmp_123_type 1302 +#define _tmp_124_type 1303 +#define _tmp_125_type 1304 +#define _loop1_126_type 1305 +#define _tmp_127_type 1306 +#define _tmp_128_type 1307 +#define _loop0_130_type 1308 +#define _gather_129_type 1309 +#define _loop1_131_type 1310 +#define _loop0_132_type 1311 +#define _loop0_133_type 1312 +#define _tmp_134_type 1313 +#define _tmp_135_type 1314 +#define _loop0_137_type 1315 +#define _gather_136_type 1316 +#define _loop0_139_type 1317 +#define _gather_138_type 1318 +#define _loop0_141_type 1319 +#define _gather_140_type 1320 +#define _loop0_143_type 1321 +#define _gather_142_type 1322 +#define _loop0_144_type 1323 +#define _loop0_146_type 1324 +#define _gather_145_type 1325 +#define _tmp_147_type 1326 +#define _loop0_149_type 1327 +#define _gather_148_type 1328 +#define _loop0_151_type 1329 +#define _gather_150_type 1330 +#define _tmp_152_type 1331 +#define _loop0_153_type 1332 +#define _tmp_154_type 1333 +#define _tmp_155_type 1334 +#define _tmp_156_type 1335 +#define _tmp_157_type 1336 +#define _loop0_158_type 1337 +#define _tmp_159_type 1338 +#define _tmp_160_type 1339 +#define _tmp_161_type 1340 +#define _tmp_162_type 1341 +#define _tmp_163_type 1342 +#define _tmp_164_type 1343 +#define _loop0_166_type 1344 +#define _gather_165_type 1345 +#define _loop0_168_type 1346 +#define _gather_167_type 1347 +#define _loop0_170_type 1348 +#define _gather_169_type 1349 +#define _loop0_172_type 1350 +#define _gather_171_type 1351 +#define _tmp_173_type 1352 +#define _tmp_174_type 1353 +#define _tmp_175_type 1354 +#define _tmp_176_type 1355 +#define _tmp_177_type 1356 +#define _tmp_178_type 1357 +#define _tmp_179_type 1358 +#define _tmp_180_type 1359 +#define _loop1_181_type 1360 +#define _tmp_182_type 1361 +#define _tmp_183_type 1362 +#define _tmp_184_type 1363 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -479,6 +480,7 @@ static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); static void *match_stmt_rule(Parser *p); static void *case_block_rule(Parser *p); +static void *pattern_no_comma_rule(Parser *p); static expr_ty pattern_rule(Parser *p); static void *guard_rule(Parser *p); static void *or_pattern_rule(Parser *p); @@ -4733,7 +4735,7 @@ match_stmt_rule(Parser *p) return _res; } -// case_block: "case" pattern guard? ':' block +// case_block: "case" pattern_no_comma guard? ':' block static void * case_block_rule(Parser *p) { @@ -4744,21 +4746,21 @@ case_block_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // "case" pattern guard? ':' block + { // "case" pattern_no_comma guard? ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern guard? ':' block")); + D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); expr_ty _keyword; Token * _literal; asdl_seq* body; void *guard; - expr_ty pattern; + void *pattern; if ( (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' && - (pattern = pattern_rule(p)) // pattern + (pattern = pattern_no_comma_rule(p)) // pattern_no_comma && (guard = guard_rule(p), 1) // guard? && @@ -4767,7 +4769,7 @@ case_block_rule(Parser *p) (body = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern guard? ':' block")); + D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); _res = _Py_match_case ( pattern , guard , body , p -> arena ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -4778,7 +4780,7 @@ case_block_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern guard? ':' block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); } _res = NULL; done: @@ -4786,7 +4788,77 @@ case_block_rule(Parser *p) return _res; } -// pattern: NAME ':=' or_pattern | or_pattern +// pattern_no_comma: pattern !',' | pattern ',' +static void * +pattern_no_comma_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // pattern !',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> pattern_no_comma[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern !','")); + expr_ty pattern; + if ( + (pattern = pattern_rule(p)) // pattern + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' + ) + { + D(fprintf(stderr, "%*c+ pattern_no_comma[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern !','")); + _res = pattern; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s pattern_no_comma[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern !','")); + } + { // pattern ',' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> pattern_no_comma[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern ','")); + Token * error; + expr_ty pattern_var; + if ( + (pattern_var = pattern_rule(p)) // pattern + && + (error = _PyPegen_expect_token(p, 12)) // token=',' + ) + { + D(fprintf(stderr, "%*c+ pattern_no_comma[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern ','")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[...]'?" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s pattern_no_comma[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern ','")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// pattern: NAME ':=' or_pattern | '(' ')' | or_pattern static expr_ty pattern_rule(Parser *p) { @@ -4845,6 +4917,33 @@ pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' or_pattern")); } + { // '(' ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + Token * _literal; + Token * error; + if ( + (error = _PyPegen_expect_token(p, 7)) // token='(' + && + (_literal = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[]'?" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); + } { // or_pattern if (p->error_indicator) { D(p->level--); @@ -5524,7 +5623,7 @@ constant_pattern_rule(Parser *p) return _res; } -// group_pattern: '(' pattern ')' +// group_pattern: '(' pattern_no_comma ')' static void * group_pattern_rule(Parser *p) { @@ -5535,24 +5634,24 @@ group_pattern_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '(' pattern ')' + { // '(' pattern_no_comma ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); + D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern_no_comma ')'")); Token * _literal; Token * _literal_1; - expr_ty pattern; + void *pattern; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (pattern = pattern_rule(p)) // pattern + (pattern = pattern_no_comma_rule(p)) // pattern_no_comma && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); + D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern_no_comma ')'")); _res = pattern; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5563,7 +5662,7 @@ group_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern_no_comma ')'")); } _res = NULL; done: From 28bf07be4c0b644433d022aa99fc4a60fc17086f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 7 Jun 2020 08:35:29 -0700 Subject: [PATCH 065/218] Add length-checking opcodes --- Doc/library/dis.rst | 24 ++++++++++--- Include/opcode.h | 2 ++ Lib/importlib/_bootstrap_external.py | 4 +-- Lib/opcode.py | 2 ++ Python/ceval.c | 52 ++++++++++++++++------------ Python/compile.c | 18 ++++++++-- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 4 +-- 8 files changed, 72 insertions(+), 36 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 6700d3c645590b..7b18b2c0eec603 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1236,11 +1236,11 @@ All of the following opcodes use their arguments. .. opcode:: MATCH_SEQ (delta) - Pop TOS and TOS1. TOS is an :class:`int` length. If TOS1 is an instance of - :class:`collections.abc.Sequence`, is not an :term:`iterator`, is not an - instance of :class:`str`/:class:`bytes`/:class:`bytearray`, and has that - length, collect it into a reversed list and push that onto the stack. - Otherwise, increment the bytecode counter by ``delta``. + Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not an + :term:`iterator`, and is not an instance of + :class:`str`/:class:`bytes`/:class:`bytearray`, collect it into a reversed + list and push that onto the stack. Otherwise, increment the bytecode counter + by ``delta``. .. versionadded:: 3.10 @@ -1254,6 +1254,20 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 +.. opcode:: MATCH_LEN_EQ (size) + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_LEN_GE (size) + + TODO + + .. versionadded:: 3.10 + + .. opcode:: HAVE_ARGUMENT This is not really an opcode. It identifies the dividing line between diff --git a/Include/opcode.h b/Include/opcode.h index 13bb9019dc6b1c..3d1a3a181e1c6d 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -133,6 +133,8 @@ extern "C" { #define MATCH_MAP_STAR 168 #define MATCH_SEQ 169 #define MATCH_SEQ_STAR 170 +#define MATCH_LEN_EQ 171 +#define MATCH_LEN_GE 172 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 49ec198d53e165..cf8c50554af3a0 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3442 (add LIST_POP, MATCH*) +# Python 3.10a0 3444 (add LIST_POP, MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3442).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3444).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 98bd21b2380c56..3c8e0f3c8e6534 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -219,5 +219,7 @@ def jabs_op(name, op): jrel_op('MATCH_MAP_STAR', 168) jrel_op('MATCH_SEQ', 169) jrel_op('MATCH_SEQ_STAR', 170) +def_op('MATCH_LEN_EQ', 171) +def_op('MATCH_LEN_GE', 172) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index 4cfbe90b4cfbb8..6554dc995b01cc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3668,6 +3668,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_SEQ_STAR): { int star = opcode == MATCH_SEQ_STAR; Py_ssize_t size_pre = -1; + Py_ssize_t size = -1; if (star) { PyObject *_size_pre = POP(); assert(PyLong_CheckExact(_size_pre)); @@ -3676,21 +3677,21 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (size_pre < 0) { goto error; } + PyObject *_size = POP(); + assert(PyLong_CheckExact(_size)); + size = PyLong_AsSsize_t(_size); + Py_DECREF(_size); + if (size < 0) { + goto error; + } } - PyObject *_size = TOP(); - assert(PyLong_CheckExact(_size)); - Py_ssize_t size = PyLong_AsSsize_t(_size); - if (size < 0) { - goto error; - } - PyObject *target = SECOND(); + PyObject *target = TOP(); int match = match_seq_type(target); if (match < 0) { goto error; } if (!match) { - STACK_SHRINK(2); - Py_DECREF(_size); + STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); @@ -3702,30 +3703,21 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } if (!star) { assert(size_pre < 0); - if (PyList_GET_SIZE(list) != size) { - Py_DECREF(list); - STACK_SHRINK(2); - Py_DECREF(_size); - Py_DECREF(target); - JUMPBY(oparg); - DISPATCH(); - } + assert(size < 0); if (PyList_Reverse(list)) { Py_DECREF(list); goto error; } - STACK_SHRINK(1); SET_TOP(list); - Py_DECREF(_size); Py_DECREF(target); DISPATCH(); } assert(size_pre >= 0); + assert(size >= 0); Py_ssize_t actual = PyList_GET_SIZE(list); if (actual < size_pre + size) { Py_DECREF(list); - STACK_SHRINK(2); - Py_DECREF(_size); + STACK_SHRINK(1); Py_DECREF(target); JUMPBY(oparg); DISPATCH(); @@ -3752,15 +3744,29 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } assert(PyList_GET_SIZE(list) == size_pre + 1 + size); - STACK_SHRINK(1); SET_TOP(list); - Py_DECREF(_size); Py_DECREF(target); PREDICT(LIST_POP); PREDICT(POP_TOP); DISPATCH(); } + case TARGET(MATCH_LEN_EQ): + case TARGET(MATCH_LEN_GE): { + Py_ssize_t len = PyObject_Length(TOP()); + if (len < 0) { + goto error; + } + if (opcode == MATCH_LEN_EQ ? len == oparg : len >= oparg) { + PUSH(Py_True); + } + else { + PUSH(Py_False); + } + Py_INCREF(TOP()); + DISPATCH(); + } + case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index 9d804193fae348..d3b3e5fb7b4c3a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1124,10 +1124,14 @@ stack_effect(int opcode, int oparg, int jump) return jump > 0 ? -4 : -3; case MATCH_MAP: case MATCH_MAP_STAR: - case MATCH_SEQ: return jump > 0 ? -2 : -1; + case MATCH_SEQ: + return jump > 0 ? -1 : 0; case MATCH_SEQ_STAR: return jump > 0 ? -3 : -2; + case MATCH_LEN_EQ: + case MATCH_LEN_GE: + return 1; default: return PY_INVALID_STACK_EFFECT; } @@ -2865,6 +2869,10 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_I(c, BUILD_TUPLE, size - star); // TODO: Just drop MATCH_MAP_STAR? ADDOP_JREL(c, star ? MATCH_MAP_STAR : MATCH_MAP, fail); + if (size - star) { + ADDOP_I(c, MATCH_LEN_GE, size - star); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + } for (i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); ADDOP(c, LIST_POP); @@ -2984,11 +2992,15 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star - 1)) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(star)) ADDOP_JREL(c, MATCH_SEQ_STAR, fail); + if (size) { + ADDOP_I(c, MATCH_LEN_GE, size - 1); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + } } else { - // TODO: ERROR CHECKING FOR THESE: - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)) ADDOP_JREL(c, MATCH_SEQ, fail); + ADDOP_I(c, MATCH_LEN_EQ, size); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 068165d1c53af2..142d343cca504e 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,114,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,116,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 4309e5360ca0cc..a0ed60263a024e 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -170,8 +170,8 @@ static void *opcode_targets[256] = { &&TARGET_MATCH_MAP_STAR, &&TARGET_MATCH_SEQ, &&TARGET_MATCH_SEQ_STAR, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_LEN_EQ, + &&TARGET_MATCH_LEN_GE, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 009ca7ebd8ab2bb2187e6cef797491d3b227e928 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 7 Jun 2020 11:39:43 -0700 Subject: [PATCH 066/218] Start phasing in new opcodes --- Include/opcode.h | 10 ++-- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 12 +++-- Python/ceval.c | 72 ++++++++++++++-------------- Python/compile.c | 36 ++++++++------ Python/importlib_external.h | 2 +- Python/opcode_targets.h | 12 ++--- Python/peephole.c | 16 +++---- 8 files changed, 89 insertions(+), 75 deletions(-) diff --git a/Include/opcode.h b/Include/opcode.h index 3d1a3a181e1c6d..989720f5303c29 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -31,6 +31,8 @@ extern "C" { #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 +#define MATCH_SEQ 30 +#define MATCH_MAP 31 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -129,10 +131,10 @@ extern "C" { #define DICT_MERGE 164 #define DICT_UPDATE 165 #define MATCH 166 -#define MATCH_MAP 167 -#define MATCH_MAP_STAR 168 -#define MATCH_SEQ 169 -#define MATCH_SEQ_STAR 170 +#define OLD_MATCH_MAP 167 +#define OLD_MATCH_MAP_STAR 168 +#define OLD_MATCH_SEQ 169 +#define OLD_MATCH_SEQ_STAR 170 #define MATCH_LEN_EQ 171 #define MATCH_LEN_GE 172 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index cf8c50554af3a0..e11bf149a82bd5 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3444 (add LIST_POP, MATCH*) +# Python 3.10a0 3445 (add MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3444).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3445).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 3c8e0f3c8e6534..71dbd7428013c5 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -84,6 +84,9 @@ def jabs_op(name, op): def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) +def_op('MATCH_SEQ', 30) +def_op('MATCH_MAP', 31) + def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) def_op('GET_AITER', 50) @@ -214,11 +217,12 @@ def jabs_op(name, op): def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) + jrel_op('MATCH', 166) -jrel_op('MATCH_MAP', 167) -jrel_op('MATCH_MAP_STAR', 168) -jrel_op('MATCH_SEQ', 169) -jrel_op('MATCH_SEQ_STAR', 170) +jrel_op('OLD_MATCH_MAP', 167) +jrel_op('OLD_MATCH_MAP_STAR', 168) +jrel_op('OLD_MATCH_SEQ', 169) +jrel_op('OLD_MATCH_SEQ_STAR', 170) def_op('MATCH_LEN_EQ', 171) def_op('MATCH_LEN_GE', 172) diff --git a/Python/ceval.c b/Python/ceval.c index 6554dc995b01cc..f41fd58bbe5494 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -851,7 +851,7 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: static int -match_map_type(PyObject *target) +match_map(PyObject *target) { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { @@ -872,7 +872,7 @@ match_map_type(PyObject *target) } static int -match_seq_type(PyObject *target) +match_seq(PyObject *target) { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { @@ -3606,23 +3606,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_MAP): - case TARGET(MATCH_MAP_STAR): { - // TODO: JUST PREPEND THE STAR MAP TO THE LIST! - int star = opcode == MATCH_MAP_STAR; + case TARGET(OLD_MATCH_MAP): + case TARGET(OLD_MATCH_MAP_STAR): { + int star = opcode == OLD_MATCH_MAP_STAR; PyObject *keys = TOP(); PyObject *target = SECOND(); - int match = match_map_type(target); - if (match < 0) { - goto error; - } - if (!match) { - STACK_SHRINK(2); - Py_DECREF(keys); - Py_DECREF(target); - JUMPBY(oparg); - DISPATCH(); - } PyObject *copy; if (PyDict_CheckExact(target)) { copy = PyDict_Copy(target); @@ -3664,9 +3652,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_SEQ): - case TARGET(MATCH_SEQ_STAR): { - int star = opcode == MATCH_SEQ_STAR; + case TARGET(OLD_MATCH_SEQ): + case TARGET(OLD_MATCH_SEQ_STAR): { + int star = opcode == OLD_MATCH_SEQ_STAR; Py_ssize_t size_pre = -1; Py_ssize_t size = -1; if (star) { @@ -3686,16 +3674,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } } PyObject *target = TOP(); - int match = match_seq_type(target); - if (match < 0) { - goto error; - } - if (!match) { - STACK_SHRINK(1); - Py_DECREF(target); - JUMPBY(oparg); - DISPATCH(); - } // TODO: Break this out: PyObject *list = PySequence_List(target); if (!list) { @@ -3751,18 +3729,42 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_LEN_EQ): + case TARGET(MATCH_LEN_EQ): { + Py_ssize_t len = PyObject_Length(TOP()); + if (len < 0) { + goto error; + } + PUSH(len == oparg ? Py_True : Py_False); + Py_INCREF(TOP()); + DISPATCH(); + } + case TARGET(MATCH_LEN_GE): { Py_ssize_t len = PyObject_Length(TOP()); if (len < 0) { goto error; } - if (opcode == MATCH_LEN_EQ ? len == oparg : len >= oparg) { - PUSH(Py_True); + PUSH(len >= oparg ? Py_True : Py_False); + Py_INCREF(TOP()); + DISPATCH(); + } + + case TARGET(MATCH_MAP): { + int match = match_map(TOP()); + if (match < 0) { + goto error; } - else { - PUSH(Py_False); + PUSH(match ? Py_True : Py_False); + Py_INCREF(TOP()); + DISPATCH(); + } + + case TARGET(MATCH_SEQ): { + int match = match_seq(TOP()); + if (match < 0) { + goto error; } + PUSH(match ? Py_True : Py_False); Py_INCREF(TOP()); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index d3b3e5fb7b4c3a..e00609885bc0e3 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1122,15 +1122,17 @@ stack_effect(int opcode, int oparg, int jump) return 1; case MATCH: return jump > 0 ? -4 : -3; - case MATCH_MAP: - case MATCH_MAP_STAR: + case OLD_MATCH_MAP: + case OLD_MATCH_MAP_STAR: return jump > 0 ? -2 : -1; - case MATCH_SEQ: + case OLD_MATCH_SEQ: return jump > 0 ? -1 : 0; - case MATCH_SEQ_STAR: + case OLD_MATCH_SEQ_STAR: return jump > 0 ? -3 : -2; case MATCH_LEN_EQ: case MATCH_LEN_GE: + case MATCH_MAP: + case MATCH_SEQ: return 1; default: return PY_INVALID_STACK_EFFECT; @@ -2855,6 +2857,12 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; + ADDOP(c, MATCH_MAP); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + if (size - star) { + ADDOP_I(c, MATCH_LEN_GE, size - star); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + } Py_ssize_t i; for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); @@ -2867,12 +2875,8 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje VISIT(c, expr, asdl_seq_GET(keys, i)); } ADDOP_I(c, BUILD_TUPLE, size - star); - // TODO: Just drop MATCH_MAP_STAR? - ADDOP_JREL(c, star ? MATCH_MAP_STAR : MATCH_MAP, fail); - if (size - star) { - ADDOP_I(c, MATCH_LEN_GE, size - star); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); - } + // TODO: Just drop OLD_MATCH_MAP_STAR? + ADDOP_JREL(c, star ? OLD_MATCH_MAP_STAR : OLD_MATCH_MAP, fail); for (i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); ADDOP(c, LIST_POP); @@ -2987,20 +2991,22 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); + ADDOP(c, MATCH_SEQ); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (star >= 0) { - // TODO: ERROR CHECKING FOR THESE: - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star - 1)) - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(star)) - ADDOP_JREL(c, MATCH_SEQ_STAR, fail); if (size) { ADDOP_I(c, MATCH_LEN_GE, size - 1); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } + // TODO: ERROR CHECKING FOR THESE: + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star - 1)) + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(star)) + ADDOP_JREL(c, OLD_MATCH_SEQ_STAR, fail); } else { - ADDOP_JREL(c, MATCH_SEQ, fail); ADDOP_I(c, MATCH_LEN_EQ, size); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JREL(c, OLD_MATCH_SEQ, fail); } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 142d343cca504e..a1eb0f10fdd9fb 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,116,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,117,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index a0ed60263a024e..b89698e80274ab 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -29,8 +29,8 @@ static void *opcode_targets[256] = { &&TARGET_BINARY_TRUE_DIVIDE, &&TARGET_INPLACE_FLOOR_DIVIDE, &&TARGET_INPLACE_TRUE_DIVIDE, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_SEQ, + &&TARGET_MATCH_MAP, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -166,10 +166,10 @@ static void *opcode_targets[256] = { &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, &&TARGET_MATCH, - &&TARGET_MATCH_MAP, - &&TARGET_MATCH_MAP_STAR, - &&TARGET_MATCH_SEQ, - &&TARGET_MATCH_SEQ_STAR, + &&TARGET_OLD_MATCH_MAP, + &&TARGET_OLD_MATCH_MAP_STAR, + &&TARGET_OLD_MATCH_SEQ, + &&TARGET_OLD_MATCH_SEQ_STAR, &&TARGET_MATCH_LEN_EQ, &&TARGET_MATCH_LEN_GE, &&_unknown_opcode, diff --git a/Python/peephole.c b/Python/peephole.c index 7bc5865bab1fa0..ee1665c4fc8122 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -200,10 +200,10 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_WITH: case SETUP_ASYNC_WITH: case MATCH: - case MATCH_MAP: - case MATCH_MAP_STAR: - case MATCH_SEQ: - case MATCH_SEQ_STAR: + case OLD_MATCH_MAP: + case OLD_MATCH_MAP_STAR: + case OLD_MATCH_SEQ: + case OLD_MATCH_SEQ_STAR: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -509,10 +509,10 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_WITH: case SETUP_ASYNC_WITH: case MATCH: - case MATCH_MAP: - case MATCH_MAP_STAR: - case MATCH_SEQ: - case MATCH_SEQ_STAR: + case OLD_MATCH_MAP: + case OLD_MATCH_MAP_STAR: + case OLD_MATCH_SEQ: + case OLD_MATCH_SEQ_STAR: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From 32b396fb00fac83dc17c1c219190cb06919e28ae Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 7 Jun 2020 22:57:53 -0700 Subject: [PATCH 067/218] Refactor sequence-matching opcodes --- Include/opcode.h | 5 +- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 5 +- Python/ceval.c | 177 +++++++++++++-------------- Python/compile.c | 23 ++-- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 10 +- Python/peephole.c | 4 - 8 files changed, 109 insertions(+), 121 deletions(-) diff --git a/Include/opcode.h b/Include/opcode.h index 989720f5303c29..3660f3b2788c3a 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -133,10 +133,11 @@ extern "C" { #define MATCH 166 #define OLD_MATCH_MAP 167 #define OLD_MATCH_MAP_STAR 168 -#define OLD_MATCH_SEQ 169 -#define OLD_MATCH_SEQ_STAR 170 #define MATCH_LEN_EQ 171 #define MATCH_LEN_GE 172 +#define MATCH_SEQ_SLICE 173 +#define MATCH_SEQ_ITEM 174 +#define MATCH_SEQ_ITEM_END 175 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index e11bf149a82bd5..ccc0b32befb69c 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3445 (add MATCH*) +# Python 3.10a0 3451 (add MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3445).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3451).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 71dbd7428013c5..0e5a0d1ad013dc 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -221,9 +221,10 @@ def jabs_op(name, op): jrel_op('MATCH', 166) jrel_op('OLD_MATCH_MAP', 167) jrel_op('OLD_MATCH_MAP_STAR', 168) -jrel_op('OLD_MATCH_SEQ', 169) -jrel_op('OLD_MATCH_SEQ_STAR', 170) def_op('MATCH_LEN_EQ', 171) def_op('MATCH_LEN_GE', 172) +def_op('MATCH_SEQ_SLICE', 173) +def_op('MATCH_SEQ_ITEM', 174) +def_op('MATCH_SEQ_ITEM_END', 175) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index f41fd58bbe5494..cd43dc0452c8b8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3611,23 +3611,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) int star = opcode == OLD_MATCH_MAP_STAR; PyObject *keys = TOP(); PyObject *target = SECOND(); - PyObject *copy; - if (PyDict_CheckExact(target)) { - copy = PyDict_Copy(target); - if (!copy) { - goto error; - } - } - else { - copy = PyDict_New(); - if (!copy || PyDict_Update(copy, target)) { - Py_XDECREF(copy); - goto error; - } - } - PyObject *values = match_map_items(tstate, copy, keys); + PyObject *values = match_map_items(tstate, target, keys); if (!values) { - Py_DECREF(copy); if (_PyErr_Occurred(tstate)) { goto error; } @@ -3638,11 +3623,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } // TODO: This is inefficient: - if (star && PyList_Insert(values, 0, copy)) { - Py_DECREF(copy); + if (star && PyList_Insert(values, 0, target)) { goto error; } - Py_DECREF(copy); STACK_SHRINK(1); SET_TOP(values); Py_DECREF(keys); @@ -3652,87 +3635,60 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(OLD_MATCH_SEQ): - case TARGET(OLD_MATCH_SEQ_STAR): { - int star = opcode == OLD_MATCH_SEQ_STAR; - Py_ssize_t size_pre = -1; - Py_ssize_t size = -1; - if (star) { - PyObject *_size_pre = POP(); - assert(PyLong_CheckExact(_size_pre)); - size_pre = PyLong_AsSsize_t(_size_pre); - Py_DECREF(_size_pre); - if (size_pre < 0) { - goto error; - } - PyObject *_size = POP(); - assert(PyLong_CheckExact(_size)); - size = PyLong_AsSsize_t(_size); - Py_DECREF(_size); - if (size < 0) { - goto error; - } - } + case TARGET(MATCH_SEQ_ITEM): { PyObject *target = TOP(); - // TODO: Break this out: - PyObject *list = PySequence_List(target); - if (!list) { - goto error; + assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); + PyObject *item = PySequence_Fast_GET_ITEM(target, oparg); + Py_INCREF(item); + PUSH(item); + DISPATCH(); + } + + case TARGET(MATCH_SEQ_ITEM_END): { + PyObject *target = TOP(); + assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); + Py_ssize_t i = PySequence_Fast_GET_SIZE(target) - 1 - oparg; + PyObject *item = PySequence_Fast_GET_ITEM(target, i); + Py_INCREF(item); + PUSH(item); + DISPATCH(); + } + + case TARGET(MATCH_SEQ_SLICE): { + PyObject *target = TOP(); + assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); + Py_ssize_t pre = oparg >> 16; + Py_ssize_t post = oparg & 0xFF; + PyObject *slice; + if (PyList_CheckExact(target)) { + post = PyList_GET_SIZE(target) - post; + slice = PyList_GetSlice(target, pre, post); } - if (!star) { - assert(size_pre < 0); - assert(size < 0); - if (PyList_Reverse(list)) { - Py_DECREF(list); + else { + post = PyTuple_GET_SIZE(target) - post; + PyObject *tslice = PyTuple_GetSlice(target, pre, post); + if (!tslice) { goto error; } - SET_TOP(list); - Py_DECREF(target); - DISPATCH(); - } - assert(size_pre >= 0); - assert(size >= 0); - Py_ssize_t actual = PyList_GET_SIZE(list); - if (actual < size_pre + size) { - Py_DECREF(list); - STACK_SHRINK(1); - Py_DECREF(target); - JUMPBY(oparg); - DISPATCH(); - } - PyObject *middle = PyList_GetSlice(list, size_pre, actual - size); - if (!middle) { - Py_DECREF(list); - goto error; + slice = PySequence_List(tslice); + Py_DECREF(tslice); } - PyObject *nested = PyTuple_Pack(1, middle); - Py_DECREF(middle); - if (!nested) { - Py_DECREF(list); + if (!slice) { goto error; } - if (PyList_SetSlice(list, size_pre, actual - size, nested)) { - Py_DECREF(nested); - Py_DECREF(list); - goto error; - } - Py_DECREF(nested); - if (PyList_Reverse(list)) { - Py_DECREF(list); - goto error; - } - assert(PyList_GET_SIZE(list) == size_pre + 1 + size); - SET_TOP(list); - Py_DECREF(target); - PREDICT(LIST_POP); - PREDICT(POP_TOP); + PUSH(slice); DISPATCH(); } case TARGET(MATCH_LEN_EQ): { - Py_ssize_t len = PyObject_Length(TOP()); - if (len < 0) { - goto error; + PyObject *target = TOP(); + Py_ssize_t len; + if (PyDict_CheckExact(target)) { + len = PyDict_GET_SIZE(target); + } + else { + assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); + len = PySequence_Fast_GET_SIZE(target); } PUSH(len == oparg ? Py_True : Py_False); Py_INCREF(TOP()); @@ -3740,9 +3696,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_LEN_GE): { - Py_ssize_t len = PyObject_Length(TOP()); - if (len < 0) { - goto error; + PyObject *target = TOP(); + Py_ssize_t len; + if (PyDict_CheckExact(target)) { + len = PyDict_GET_SIZE(target); + } + else { + assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); + len = PySequence_Fast_GET_SIZE(target); } PUSH(len >= oparg ? Py_True : Py_False); Py_INCREF(TOP()); @@ -3750,20 +3711,48 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_MAP): { - int match = match_map(TOP()); + PyObject *target = TOP(); + int match = match_map(target); if (match < 0) { goto error; } + if (match) { + PyObject *map; + if (PyDict_CheckExact(target)) { + map = PyDict_Copy(target); + if (!map) { + goto error; + } + } + else { + map = PyDict_New(); + if (!map || PyDict_Update(map, target)) { + Py_XDECREF(map); + goto error; + } + } + SET_TOP(map); + Py_DECREF(target); + } PUSH(match ? Py_True : Py_False); Py_INCREF(TOP()); DISPATCH(); } case TARGET(MATCH_SEQ): { - int match = match_seq(TOP()); + PyObject *target = TOP(); + int match = match_seq(target); if (match < 0) { goto error; } + if (match) { + PyObject *seq = PySequence_Fast(target, "TODO"); // TODO + if (!seq) { + goto error; + } + SET_TOP(seq); + Py_DECREF(target); + } PUSH(match ? Py_True : Py_False); Py_INCREF(TOP()); DISPATCH(); diff --git a/Python/compile.c b/Python/compile.c index e00609885bc0e3..d8d8cfa39d3755 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1125,14 +1125,13 @@ stack_effect(int opcode, int oparg, int jump) case OLD_MATCH_MAP: case OLD_MATCH_MAP_STAR: return jump > 0 ? -2 : -1; - case OLD_MATCH_SEQ: - return jump > 0 ? -1 : 0; - case OLD_MATCH_SEQ_STAR: - return jump > 0 ? -3 : -2; case MATCH_LEN_EQ: case MATCH_LEN_GE: case MATCH_MAP: case MATCH_SEQ: + case MATCH_SEQ_ITEM: + case MATCH_SEQ_ITEM_END: + case MATCH_SEQ_SLICE: return 1; default: return PY_INVALID_STACK_EFFECT; @@ -2998,23 +2997,25 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj ADDOP_I(c, MATCH_LEN_GE, size - 1); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } - // TODO: ERROR CHECKING FOR THESE: - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star - 1)) - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(star)) - ADDOP_JREL(c, OLD_MATCH_SEQ_STAR, fail); } else { ADDOP_I(c, MATCH_LEN_EQ, size); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); - ADDOP_JREL(c, OLD_MATCH_SEQ, fail); } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); - if (i == star) { + if (star < 0 || i < star) { + ADDOP_I(c, MATCH_SEQ_ITEM, i); + } + else if (i == star) { assert(value->kind == Starred_kind); value = value->v.Starred.value; + // TODO: ERROR CHECKING FOR THESE: + ADDOP_I(c, MATCH_SEQ_SLICE, (i << 16) + (size - 1 - i)); + } + else { + ADDOP_I(c, MATCH_SEQ_ITEM_END, size - 1 - i); } - ADDOP(c, LIST_POP); CHECK(compiler_pattern(c, value, block, names)); } ADDOP(c, POP_TOP); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index a1eb0f10fdd9fb..0843140e349fbd 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,117,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,123,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index b89698e80274ab..339ce9aca0c292 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -168,13 +168,13 @@ static void *opcode_targets[256] = { &&TARGET_MATCH, &&TARGET_OLD_MATCH_MAP, &&TARGET_OLD_MATCH_MAP_STAR, - &&TARGET_OLD_MATCH_SEQ, - &&TARGET_OLD_MATCH_SEQ_STAR, - &&TARGET_MATCH_LEN_EQ, - &&TARGET_MATCH_LEN_GE, - &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, + &&TARGET_MATCH_LEN_EQ, + &&TARGET_MATCH_LEN_GE, + &&TARGET_MATCH_SEQ_SLICE, + &&TARGET_MATCH_SEQ_ITEM, + &&TARGET_MATCH_SEQ_ITEM_END, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, diff --git a/Python/peephole.c b/Python/peephole.c index ee1665c4fc8122..491c8b2b1b04f5 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -202,8 +202,6 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case MATCH: case OLD_MATCH_MAP: case OLD_MATCH_MAP_STAR: - case OLD_MATCH_SEQ: - case OLD_MATCH_SEQ_STAR: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -511,8 +509,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case MATCH: case OLD_MATCH_MAP: case OLD_MATCH_MAP_STAR: - case OLD_MATCH_SEQ: - case OLD_MATCH_SEQ_STAR: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From a7e04884a23f15bbaf0329831b87fad69ae648bb Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 09:33:14 -0700 Subject: [PATCH 068/218] OLD_MATCH_MAP_STAR -> OLD_MATCH_MAP --- Include/opcode.h | 1 - Lib/importlib/_bootstrap_external.py | 4 ++-- Lib/opcode.py | 2 +- Python/ceval.c | 9 ++------- Python/compile.c | 19 +++++++++++++------ Python/importlib_external.h | 2 +- Python/opcode_targets.h | 2 +- Python/peephole.c | 2 -- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Include/opcode.h b/Include/opcode.h index 3660f3b2788c3a..23730c6a3c2447 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -132,7 +132,6 @@ extern "C" { #define DICT_UPDATE 165 #define MATCH 166 #define OLD_MATCH_MAP 167 -#define OLD_MATCH_MAP_STAR 168 #define MATCH_LEN_EQ 171 #define MATCH_LEN_GE 172 #define MATCH_SEQ_SLICE 173 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index ccc0b32befb69c..d1815399a58dc3 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3451 (add MATCH*) +# Python 3.10a0 3453 (add MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3451).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3453).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 0e5a0d1ad013dc..2c4f98fab8d42d 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -220,7 +220,7 @@ def jabs_op(name, op): jrel_op('MATCH', 166) jrel_op('OLD_MATCH_MAP', 167) -jrel_op('OLD_MATCH_MAP_STAR', 168) + def_op('MATCH_LEN_EQ', 171) def_op('MATCH_LEN_GE', 172) def_op('MATCH_SEQ_SLICE', 173) diff --git a/Python/ceval.c b/Python/ceval.c index cd43dc0452c8b8..b8b5e9b3fa3b9d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1040,6 +1040,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(proxy); return NULL; } + assert(PyTuple_CheckExact(_args)); if (PyTuple_GET_SIZE(_args) < nargs) { Py_DECREF(_args); Py_DECREF(proxy); @@ -3606,9 +3607,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(OLD_MATCH_MAP): - case TARGET(OLD_MATCH_MAP_STAR): { - int star = opcode == OLD_MATCH_MAP_STAR; + case TARGET(OLD_MATCH_MAP): { PyObject *keys = TOP(); PyObject *target = SECOND(); PyObject *values = match_map_items(tstate, target, keys); @@ -3622,10 +3621,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) JUMPBY(oparg); DISPATCH(); } - // TODO: This is inefficient: - if (star && PyList_Insert(values, 0, target)) { - goto error; - } STACK_SHRINK(1); SET_TOP(values); Py_DECREF(keys); diff --git a/Python/compile.c b/Python/compile.c index d8d8cfa39d3755..18573c3f242d82 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1123,7 +1123,6 @@ stack_effect(int opcode, int oparg, int jump) case MATCH: return jump > 0 ? -4 : -3; case OLD_MATCH_MAP: - case OLD_MATCH_MAP_STAR: return jump > 0 ? -2 : -1; case MATCH_LEN_EQ: case MATCH_LEN_GE: @@ -2849,7 +2848,8 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok, PyObject* nam static int compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { - basicblock *block, *end; + basicblock *block, *block_star, *end; + CHECK(block_star = compiler_new_block(c)); CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); asdl_seq *keys = p->v.Dict.keys; @@ -2862,6 +2862,9 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_I(c, MATCH_LEN_GE, size - star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } + if (star) { + ADDOP(c, DUP_TOP); + } Py_ssize_t i; for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); @@ -2874,15 +2877,19 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje VISIT(c, expr, asdl_seq_GET(keys, i)); } ADDOP_I(c, BUILD_TUPLE, size - star); - // TODO: Just drop OLD_MATCH_MAP_STAR? - ADDOP_JREL(c, star ? OLD_MATCH_MAP_STAR : OLD_MATCH_MAP, fail); - for (i = 0; i < size; i++) { + ADDOP_JREL(c, OLD_MATCH_MAP, star ? block : fail); + for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); ADDOP(c, LIST_POP); - CHECK(compiler_pattern(c, value, block, names)); + CHECK(compiler_pattern(c, value, star ? block_star : block, names)); } ADDOP(c, POP_TOP); + if (star) { + CHECK(compiler_pattern(c, asdl_seq_GET(values, size - 1), block, names)); + } ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block_star); + ADDOP(c, POP_TOP); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, fail); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 0843140e349fbd..50e8a2db757bff 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,123,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,125,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 339ce9aca0c292..c7fd9fa5283a39 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -167,7 +167,7 @@ static void *opcode_targets[256] = { &&TARGET_DICT_UPDATE, &&TARGET_MATCH, &&TARGET_OLD_MATCH_MAP, - &&TARGET_OLD_MATCH_MAP_STAR, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&TARGET_MATCH_LEN_EQ, diff --git a/Python/peephole.c b/Python/peephole.c index 491c8b2b1b04f5..284b3f2dc176e7 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -201,7 +201,6 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_ASYNC_WITH: case MATCH: case OLD_MATCH_MAP: - case OLD_MATCH_MAP_STAR: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -508,7 +507,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_ASYNC_WITH: case MATCH: case OLD_MATCH_MAP: - case OLD_MATCH_MAP_STAR: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From eb0fe262e1b10196d58c0fa8a2a1a0f55a567a54 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 10:22:25 -0700 Subject: [PATCH 069/218] Support None/missing __match_args__ --- Python/ceval.c | 58 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index b8b5e9b3fa3b9d..f006f77a342b45 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -979,20 +979,23 @@ static PyObject * get_match_args(PyThreadState *tstate, PyObject *proxy) { if (!PyObject_HasAttrString(proxy, "__match_args__")) { - return PyTuple_New(0); + Py_RETURN_NONE; } PyObject *ma = PyObject_GetAttrString(proxy, "__match_args__"); if (!ma) { return NULL; } - if (!PyList_CheckExact(ma)) { - _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ must be a list (got %s)", - Py_TYPE(ma)->tp_name); - Py_DECREF(ma); - return NULL; + if (PyList_CheckExact(ma)) { + return PyList_AsTuple(ma); + } + if (ma == Py_None) { + return ma; } - return PyList_AsTuple(ma); + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args__ must be a list or None (got %s)", + Py_TYPE(ma)->tp_name); + Py_DECREF(ma); + return NULL; } static PyObject * @@ -1040,17 +1043,30 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(proxy); return NULL; } - assert(PyTuple_CheckExact(_args)); - if (PyTuple_GET_SIZE(_args) < nargs) { + if (_args == Py_None) { + if (nargs > 1) { + Py_DECREF(_args); + Py_DECREF(proxy); + // TODO: Add expected and actual counts: + _PyErr_SetString(tstate, PyExc_TypeError, + "too many positional matches in pattern"); + return NULL; + } + args = _args; + } + else { + assert(PyTuple_CheckExact(_args)); + if (PyTuple_GET_SIZE(_args) < nargs) { + Py_DECREF(_args); + Py_DECREF(proxy); + // TODO: Add expected and actual counts: + _PyErr_SetString(tstate, PyExc_TypeError, + "too many positional matches in pattern"); + return NULL; + } + args = PyTuple_GetSlice(_args, 0, nargs); Py_DECREF(_args); - Py_DECREF(proxy); - // TODO: Add expected and actual counts: - _PyErr_SetString(tstate, PyExc_TypeError, - "too many positional matches in pattern"); - return NULL; } - args = PyTuple_GetSlice(_args, 0, nargs); - Py_DECREF(_args); } else { args = PyTuple_New(0); @@ -1059,7 +1075,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(proxy); return NULL; } - assert(PyTuple_CheckExact(args)); + assert(PyTuple_CheckExact(args) || args == Py_None); PyObject *attrs = PyList_New(nargs + nkwargs); if (!attrs) { Py_DECREF(proxy); @@ -1076,6 +1092,12 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ PyObject *name; for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { if (i < nargs) { + if (args == Py_None) { + assert(!i); + Py_INCREF(proxy); + PyList_SET_ITEM(attrs, nargs + nkwargs - 1, proxy); + continue; + } name = PyTuple_GET_ITEM(args, i); if (!PyUnicode_CheckExact(name)) { _PyErr_Format(tstate, PyExc_TypeError, From 90422e4ae0962e28c20d3091e476f7278a026a2d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 15:38:01 -0700 Subject: [PATCH 070/218] Clean up map matches --- Doc/library/dis.rst | 50 +++++++++++++--------------- Include/opcode.h | 2 +- Lib/importlib/_bootstrap_external.py | 4 +-- Lib/opcode.py | 2 +- Python/ceval.c | 21 +++++------- Python/compile.c | 18 +++++----- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 4 +-- Python/peephole.c | 2 -- 9 files changed, 48 insertions(+), 57 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 7b18b2c0eec603..88e8a565577222 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -737,14 +737,6 @@ iterations of the loop. by :opcode:`CALL_FUNCTION` to construct a class. -.. opcode:: LIST_POP - - TOS is a :class:`list`. Pop the last item from it, and push it onto the - stack. - - .. versionadded:: 3.10 - - .. opcode:: SETUP_WITH (delta) This opcode performs several operations before a with block starts. First, @@ -1199,6 +1191,8 @@ All of the following opcodes use their arguments. .. opcode:: MATCH (delta) + TODO + Pop TOS, TOS1, TOS2, and TOS3. If TOS2 is an instance of :class:`type` and has a ``__match__`` method, call that method on TOS3. The returned "proxy" should be non-``None``. @@ -1216,40 +1210,44 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_MAP (delta) +.. opcode:: MATCH_MAP - Pop TOS and TOS1. TOS is a tuple of keys. If TOS1 is an instance of - :class:`collections.abc.Mapping`, push a reversed list of values mapped from - those keys onto the stack. Otherwise, increment the bytecode counter by - ``delta``. + TODO .. versionadded:: 3.10 -.. opcode:: MATCH_MAP_STAR (delta) +.. opcode:: MATCH_MAP_KEYS - Perform the same steps as :opcode:`MATCH_MAP`, but prepend a :class:`dict` of - the remaining items to the list of values. + TODO .. versionadded:: 3.10 -.. opcode:: MATCH_SEQ (delta) +.. opcode:: MATCH_SEQ - Pop TOS. If it is an instance of :class:`collections.abc.Sequence`, is not an - :term:`iterator`, and is not an instance of - :class:`str`/:class:`bytes`/:class:`bytearray`, collect it into a reversed - list and push that onto the stack. Otherwise, increment the bytecode counter - by ``delta``. + TODO .. versionadded:: 3.10 -.. opcode:: MATCH_SEQ_STAR (delta) +.. opcode:: MATCH_SEQ_ITEM (i) + + TODO - Pop TOS, TOS1, and TOS2. TOS and TOS1 are int lengths. Perform the same - steps as :opcode:`MATCH_SEQ` on TOS2, but fold the middle items of the result - list between TOS1 and -TOS2 into another, nested list. + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ_ITEM_END (i) + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ_ITEM_SLICE (ij) + + TODO .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index 23730c6a3c2447..f2d25a86e2485d 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -33,6 +33,7 @@ extern "C" { #define INPLACE_TRUE_DIVIDE 29 #define MATCH_SEQ 30 #define MATCH_MAP 31 +#define MATCH_MAP_KEYS 32 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -131,7 +132,6 @@ extern "C" { #define DICT_MERGE 164 #define DICT_UPDATE 165 #define MATCH 166 -#define OLD_MATCH_MAP 167 #define MATCH_LEN_EQ 171 #define MATCH_LEN_GE 172 #define MATCH_SEQ_SLICE 173 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 42ef38ec690985..a689784075eb0b 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3453 (add MATCH*) +# Python 3.10a0 3454 (add MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3453).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3454).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 2c4f98fab8d42d..2ba8631aa2b313 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -86,6 +86,7 @@ def jabs_op(name, op): def_op('MATCH_SEQ', 30) def_op('MATCH_MAP', 31) +def_op('MATCH_MAP_KEYS', 32) def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) @@ -219,7 +220,6 @@ def jabs_op(name, op): def_op('DICT_UPDATE', 165) jrel_op('MATCH', 166) -jrel_op('OLD_MATCH_MAP', 167) def_op('MATCH_LEN_EQ', 171) def_op('MATCH_LEN_GE', 172) diff --git a/Python/ceval.c b/Python/ceval.c index 8f5cf940f022e2..f5d4e4b94fa1cc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -929,7 +929,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) goto fail; } Py_INCREF(value); - PyList_SET_ITEM(values, nkeys - 1 - i, value); + PyList_SET_ITEM(values, i, value); if (PyDict_DelItem(map, key)) { goto fail; } @@ -1828,7 +1828,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(POP_TOP): { - PREDICTED(POP_TOP); PyObject *value = POP(); Py_DECREF(value); FAST_DISPATCH(); @@ -3587,7 +3586,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(LIST_POP): { - PREDICTED(LIST_POP); PyObject *list = TOP(); assert(PyList_CheckExact(list)); Py_ssize_t size = PyList_GET_SIZE(list); @@ -3621,12 +3619,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } STACK_SHRINK(3); SET_TOP(attrs); - PREDICT(LIST_POP); - PREDICT(POP_TOP); DISPATCH(); } - case TARGET(OLD_MATCH_MAP): { + case TARGET(MATCH_MAP_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); PyObject *values = match_map_items(tstate, target, keys); @@ -3634,18 +3630,17 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (_PyErr_Occurred(tstate)) { goto error; } - STACK_SHRINK(2); + Py_INCREF(Py_None); + SET_TOP(Py_None); Py_DECREF(keys); - Py_DECREF(target); - JUMPBY(oparg); + Py_INCREF(Py_False); + PUSH(Py_False); DISPATCH(); } - STACK_SHRINK(1); SET_TOP(values); Py_DECREF(keys); - Py_DECREF(target); - PREDICT(LIST_POP); - PREDICT(POP_TOP); + Py_INCREF(Py_True); + PUSH(Py_True); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index ce74bb4e10605a..a60175e2250ce2 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1122,8 +1122,7 @@ stack_effect(int opcode, int oparg, int jump) return 1; case MATCH: return jump > 0 ? -4 : -3; - case OLD_MATCH_MAP: - return jump > 0 ? -2 : -1; + case MATCH_MAP_KEYS: case MATCH_LEN_EQ: case MATCH_LEN_GE: case MATCH_MAP: @@ -2862,9 +2861,6 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_I(c, MATCH_LEN_GE, size - star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } - if (star) { - ADDOP(c, DUP_TOP); - } Py_ssize_t i; for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); @@ -2877,15 +2873,19 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje VISIT(c, expr, asdl_seq_GET(keys, i)); } ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_JREL(c, OLD_MATCH_MAP, star ? block : fail); + ADDOP(c, MATCH_MAP_KEYS); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); - ADDOP(c, LIST_POP); - CHECK(compiler_pattern(c, value, star ? block_star : block, names)); + ADDOP_I(c, MATCH_SEQ_ITEM, i); + CHECK(compiler_pattern(c, value, block_star, names)); } ADDOP(c, POP_TOP); if (star) { - CHECK(compiler_pattern(c, asdl_seq_GET(values, size - 1), block, names)); + CHECK(compiler_pattern(c, asdl_seq_GET(values, size - 1), fail, names)); + } + else { + ADDOP(c, POP_TOP); } ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block_star); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 0c7ef05112283f..421fa16dd2ecac 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,125,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,126,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index c7fd9fa5283a39..901c4a6d191f3d 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -31,7 +31,7 @@ static void *opcode_targets[256] = { &&TARGET_INPLACE_TRUE_DIVIDE, &&TARGET_MATCH_SEQ, &&TARGET_MATCH_MAP, - &&_unknown_opcode, + &&TARGET_MATCH_MAP_KEYS, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -166,7 +166,7 @@ static void *opcode_targets[256] = { &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, &&TARGET_MATCH, - &&TARGET_OLD_MATCH_MAP, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, diff --git a/Python/peephole.c b/Python/peephole.c index 284b3f2dc176e7..61cc6a11aa752b 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -200,7 +200,6 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_WITH: case SETUP_ASYNC_WITH: case MATCH: - case OLD_MATCH_MAP: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -506,7 +505,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_WITH: case SETUP_ASYNC_WITH: case MATCH: - case OLD_MATCH_MAP: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From 73d4a2bf9dd1739405b2aac62bb79fa4e01f039a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 15:53:52 -0700 Subject: [PATCH 071/218] Get rid of LIST_POP --- Include/opcode.h | 1 - Lib/importlib/_bootstrap_external.py | 4 ++-- Lib/opcode.py | 1 - Python/ceval.c | 18 ++---------------- Python/compile.c | 6 ++---- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 2 +- 7 files changed, 8 insertions(+), 26 deletions(-) diff --git a/Include/opcode.h b/Include/opcode.h index f2d25a86e2485d..956602d29ecdce 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -13,7 +13,6 @@ extern "C" { #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define ROT_FOUR 6 -#define LIST_POP 7 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index a689784075eb0b..26e57ba3993e1d 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3454 (add MATCH*) +# Python 3.10a0 3455 (add MATCH*) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3454).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3455).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 2ba8631aa2b313..59a31b61099102 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -60,7 +60,6 @@ def jabs_op(name, op): def_op('DUP_TOP', 4) def_op('DUP_TOP_TWO', 5) def_op('ROT_FOUR', 6) -def_op('LIST_POP', 7) def_op('NOP', 9) def_op('UNARY_POSITIVE', 10) diff --git a/Python/ceval.c b/Python/ceval.c index f5d4e4b94fa1cc..e5e5d5920846a9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1092,7 +1092,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ if (args == Py_None) { assert(!i); Py_INCREF(proxy); - PyList_SET_ITEM(attrs, nargs + nkwargs - 1, proxy); + PyList_SET_ITEM(attrs, 0, proxy); continue; } name = PyTuple_GET_ITEM(args, i); @@ -1139,7 +1139,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(seen); return NULL; } - PyList_SET_ITEM(attrs, nargs + nkwargs - i - 1, attr); + PyList_SET_ITEM(attrs, i, attr); } // TODO: check __match_args_required__. Py_DECREF(proxy); @@ -3585,20 +3585,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(LIST_POP): { - PyObject *list = TOP(); - assert(PyList_CheckExact(list)); - Py_ssize_t size = PyList_GET_SIZE(list); - assert(size > 0); - PyObject *popped = PyList_GET_ITEM(list, size - 1); - Py_INCREF(popped); - PUSH(popped); - if (PyList_SetSlice(list, size - 1, size, NULL)) { - goto error; - } - DISPATCH(); - } - case TARGET(MATCH): { PyObject *count = TOP(); PyObject *names = SECOND(); diff --git a/Python/compile.c b/Python/compile.c index a60175e2250ce2..abcfc89ccee976 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1118,8 +1118,6 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; - case LIST_POP: - return 1; case MATCH: return jump > 0 ? -4 : -3; case MATCH_MAP_KEYS: @@ -2808,12 +2806,12 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* ADDOP_JREL(c, MATCH, fail); for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); - ADDOP(c, LIST_POP); + ADDOP_I(c, MATCH_SEQ_ITEM, i); CHECK(compiler_pattern(c, arg, block, names)); } for (i = 0; i < nkwargs; i++) { keyword_ty kwarg = asdl_seq_GET(kwargs, i); - ADDOP(c, LIST_POP); + ADDOP_I(c, MATCH_SEQ_ITEM, nargs + i); CHECK(compiler_pattern(c, kwarg->value, block, names)); } ADDOP(c, POP_TOP); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 421fa16dd2ecac..ecdd6258ac5510 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,126,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,127,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 901c4a6d191f3d..b13933d5377b25 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -6,7 +6,7 @@ static void *opcode_targets[256] = { &&TARGET_DUP_TOP, &&TARGET_DUP_TOP_TWO, &&TARGET_ROT_FOUR, - &&TARGET_LIST_POP, + &&_unknown_opcode, &&_unknown_opcode, &&TARGET_NOP, &&TARGET_UNARY_POSITIVE, From 2c5226aaceb31cb7f395c102c035bcf93198da33 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 17:31:06 -0700 Subject: [PATCH 072/218] Validate missing attributes with __match_args__ --- Python/ceval.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index e5e5d5920846a9..3c51d055de8c45 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -998,11 +998,12 @@ get_match_args(PyThreadState *tstate, PyObject *proxy) static PyObject * do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *type, PyObject *target) { + // TODO: Break this up: assert(PyLong_CheckExact(count)); assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, - "called match pattern must be a type; did you mean '%s'?", + "called match pattern must be a type; did you mean '%s(...)'?", Py_TYPE(type)->tp_name); return NULL; } @@ -1123,16 +1124,19 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ } return NULL; } - if (!PyObject_HasAttr(proxy, name)) { - // TODO: typo checking using __match_args__? - Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(attrs); - Py_DECREF(seen); - return NULL; - } PyObject *attr = PyObject_GetAttr(proxy, name); if (!attr) { + _PyErr_Clear(tstate); + PyObject *_args = get_match_args(tstate, proxy); + if (_args) { + // TODO: iterate manually (and check for strings) + if (_args == Py_None || !PySequence_Contains(_args, name)) { + _PyErr_Format(tstate, PyExc_TypeError, + "match proxy %R has no attribute %R", + proxy, name); + } + Py_DECREF(_args); + } Py_DECREF(proxy); Py_DECREF(args); Py_DECREF(attrs); From f4644aabab95dea732a3e7a32b3c8f86d0e6fe83 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Jun 2020 22:55:08 -0700 Subject: [PATCH 073/218] Incomplete __match_args_required__ support --- Python/ceval.c | 98 +++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 3c51d055de8c45..abd8433bf50103 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -998,7 +998,7 @@ get_match_args(PyThreadState *tstate, PyObject *proxy) static PyObject * do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *type, PyObject *target) { - // TODO: Break this up: + // TODO: Break this up, and better error handling ("goto error;"): assert(PyLong_CheckExact(count)); assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { @@ -1008,11 +1008,9 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ return NULL; } PyObject *method = PyObject_GetAttrString(type, "__match__"); - if (!method) { - return NULL; - } - if (method == Py_None) { - Py_DECREF(method); + if (!method || method == Py_None) { + Py_XDECREF(method); + _PyErr_Clear(tstate); _PyErr_Format(tstate, PyExc_TypeError, "type %s cannot be matched", Py_TYPE(type)->tp_name); @@ -1035,58 +1033,79 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ } nargs -= nkwargs; PyObject *args; + PyObject *match_args = get_match_args(tstate, proxy); + if (!match_args) { + Py_DECREF(proxy); + return NULL; + } + assert(PyTuple_CheckExact(match_args) || match_args == Py_None); if (nargs) { - PyObject *_args = get_match_args(tstate, proxy); - if (!_args) { - Py_DECREF(proxy); - return NULL; - } - if (_args == Py_None) { + if (match_args == Py_None) { if (nargs > 1) { - Py_DECREF(_args); + Py_DECREF(match_args); Py_DECREF(proxy); // TODO: Add expected and actual counts: _PyErr_SetString(tstate, PyExc_TypeError, "too many positional matches in pattern"); return NULL; } - args = _args; + args = match_args; } else { - assert(PyTuple_CheckExact(_args)); - if (PyTuple_GET_SIZE(_args) < nargs) { - Py_DECREF(_args); + if (PyTuple_GET_SIZE(match_args) < nargs) { + // TODO: Combine with above: + Py_DECREF(match_args); Py_DECREF(proxy); // TODO: Add expected and actual counts: _PyErr_SetString(tstate, PyExc_TypeError, "too many positional matches in pattern"); return NULL; } - args = PyTuple_GetSlice(_args, 0, nargs); - Py_DECREF(_args); + args = PyTuple_GetSlice(match_args, 0, nargs); } } else { args = PyTuple_New(0); } if (!args) { + Py_DECREF(match_args); Py_DECREF(proxy); return NULL; } assert(PyTuple_CheckExact(args) || args == Py_None); PyObject *attrs = PyList_New(nargs + nkwargs); if (!attrs) { + Py_DECREF(match_args); Py_DECREF(proxy); Py_DECREF(args); return NULL; } PyObject *seen = PySet_New(NULL); if (!seen) { + Py_DECREF(match_args); Py_DECREF(proxy); Py_DECREF(args); Py_DECREF(attrs); return NULL; } + Py_ssize_t required = get_match_args_required(tstate, proxy); + if (required < 0) { + goto error; + } + if ((match_args == Py_None ? 1 : PyTuple_GET_SIZE(match_args)) < required) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args_required__ is larger than __match_args__", + proxy); + goto error; + } + if (required > nargs + nkwargs) { + _PyErr_Format(tstate, PyExc_TypeError, + "not enough match arguments provided"); + goto error; + } + if (required > nargs) { + // TODO: loop over names and validate (and check for strings) + } PyObject *name; for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { if (i < nargs) { @@ -1101,12 +1120,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ _PyErr_Format(tstate, PyExc_TypeError, "__match_args__ elements must be str (got %s)", Py_TYPE(name)->tp_name); - Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(attrs); - Py_DECREF(seen); - Py_DECREF(name); - return NULL; + goto error; } } else { @@ -1114,42 +1128,36 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ } int dupe = PySet_Contains(seen, name); if (dupe || PySet_Add(seen, name)) { - Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(attrs); - Py_DECREF(seen); if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_TypeError, "multiple patterns bound to attribute %R", name); } - return NULL; + goto error; } PyObject *attr = PyObject_GetAttr(proxy, name); if (!attr) { _PyErr_Clear(tstate); - PyObject *_args = get_match_args(tstate, proxy); - if (_args) { - // TODO: iterate manually (and check for strings) - if (_args == Py_None || !PySequence_Contains(_args, name)) { - _PyErr_Format(tstate, PyExc_TypeError, - "match proxy %R has no attribute %R", - proxy, name); - } - Py_DECREF(_args); + // TODO: iterate manually (and check for strings) + if (match_args == Py_None || !PySequence_Contains(match_args, name)) { + _PyErr_Format(tstate, PyExc_TypeError, + "match proxy %R has no attribute %R", + proxy, name); } - Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(attrs); - Py_DECREF(seen); - return NULL; } PyList_SET_ITEM(attrs, i, attr); } - // TODO: check __match_args_required__. + Py_DECREF(match_args); Py_DECREF(proxy); Py_DECREF(args); Py_DECREF(seen); return attrs; +error: + Py_DECREF(match_args); + Py_DECREF(proxy); + Py_DECREF(args); + Py_DECREF(seen); + Py_DECREF(attrs); + return NULL; } From ce7b0214b97853a9c6ad6b9f803e301d37841065 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 10 Jun 2020 10:06:06 -0700 Subject: [PATCH 074/218] Finish __match_args_required__ support --- Python/ceval.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index abd8433bf50103..119d682afaff60 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -982,6 +982,9 @@ get_match_args(PyThreadState *tstate, PyObject *proxy) if (!ma) { return NULL; } + // TODO: PySequence_FAST + // TODO We should probably just check for string items here + // TODO: Allow duplicate items? Hm... if (PyList_CheckExact(ma)) { return PyList_AsTuple(ma); } @@ -1046,7 +1049,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(proxy); // TODO: Add expected and actual counts: _PyErr_SetString(tstate, PyExc_TypeError, - "too many positional matches in pattern"); + "too many positional matches in pattern"); return NULL; } args = match_args; @@ -1058,7 +1061,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ Py_DECREF(proxy); // TODO: Add expected and actual counts: _PyErr_SetString(tstate, PyExc_TypeError, - "too many positional matches in pattern"); + "too many positional matches in pattern"); return NULL; } args = PyTuple_GetSlice(match_args, 0, nargs); @@ -1099,12 +1102,34 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ goto error; } if (required > nargs + nkwargs) { + // TODO: combine with below? Use name? _PyErr_Format(tstate, PyExc_TypeError, "not enough match arguments provided"); goto error; } if (required > nargs) { - // TODO: loop over names and validate (and check for strings) + if (match_args == Py_None) { + assert(required == 1); + assert(!nargs); + // TODO: combine with above? Use name? + _PyErr_Format(tstate, PyExc_TypeError, + "not enough match arguments provided"); + goto error; + } + assert(PyTuple_CheckExact(match_args)); + for (Py_ssize_t i = nargs; i < required; i++) { + PyObject *name = PyTuple_GET_ITEM(match_args, i); + int ok = PySequence_Contains(kwargs, name); + if (ok < 0) { + goto error; + } + if (!ok) { + // TODO: Combine with above? Use name? + _PyErr_Format(tstate, PyExc_TypeError, + "not enough match arguments provided"); + goto error; + } + } } PyObject *name; for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { From 6cc41286eec59cdb12f58a85fa6e1050b5659296 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 10 Jun 2020 16:52:33 -0700 Subject: [PATCH 075/218] Trivial grammar clean-ups --- Grammar/python.gram | 74 ++++------ Parser/pegen/parse.c | 318 +++++++++++++++++++++---------------------- 2 files changed, 186 insertions(+), 206 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index d4a185f617a42d..347e63eda605e3 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -198,24 +198,19 @@ match_stmt: case_block: | "case" pattern=pattern_no_comma guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } +guard: + | 'if' guard=named_expression { guard } pattern_no_comma: - | pattern=pattern !',' { - pattern } + | pattern=pattern !',' { pattern } | pattern error=',' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[...]'?") } pattern[expr_ty]: | target=NAME ':=' value=or_pattern { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } - | error='(' ')' { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[]'?") } | or_pattern -guard: - | 'if' guard=named_expression { - guard } - or_pattern: | value=closed_pattern '|' values='|'.closed_pattern+ { _Py_BoolOp(Or, CHECK(_PyPegen_seq_insert_in_front(p, value, values)), EXTRA) } @@ -231,84 +226,69 @@ closed_pattern: | class_pattern name_pattern: - | name=NAME !('.' | '(' | '=') { - _PyPegen_set_expr_context(p, name, Store) } + | name=NAME !('.' | '(' | '=') { _PyPegen_set_expr_context(p, name, Store) } literal_pattern: | signed_number !('+' | '-') - | real=signed_number '+' imag=NUMBER { - _Py_BinOp(real, Add, imag, EXTRA) } - | real=signed_number '-' imag=NUMBER { - _Py_BinOp(real, Sub, imag, EXTRA) } + | real=signed_number '+' imag=NUMBER { _Py_BinOp(real, Add, imag, EXTRA) } + | real=signed_number '-' imag=NUMBER { _Py_BinOp(real, Sub, imag, EXTRA) } | strings - | 'None' { - _Py_Constant(Py_None, NULL, EXTRA) } - | 'True' { - _Py_Constant(Py_True, NULL, EXTRA) } - | 'False' { - _Py_Constant(Py_False, NULL, EXTRA) } + | 'None' { _Py_Constant(Py_None, NULL, EXTRA) } + | 'True' { _Py_Constant(Py_True, NULL, EXTRA) } + | 'False' { _Py_Constant(Py_False, NULL, EXTRA) } constant_pattern: - | '.' name=NAME !('.' | '(' | '=') { - name } - | '.'? attr=attr !('.' | '(' | '=') { - attr } + | '.' name=NAME !('.' | '(' | '=') { name } + | '.'? attr=attr !('.' | '(' | '=') { attr } group_pattern: - | '(' pattern=pattern_no_comma ')' { - pattern } + | '(' pattern=pattern_no_comma ')' { pattern } + | error='(' ')' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[]'?") } sequence_pattern: - | '[' values=values_pattern? ']' { - _Py_List(values, Load, EXTRA) } + | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } mapping_pattern: | '{' items=items_pattern? '}' { _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } class_pattern: - | func=name_or_attr '(' ')' { - _Py_Call(func, NULL, NULL, EXTRA) } + | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } | func=name_or_attr '(' args=','.pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } | func=name_or_attr '(' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, NULL, keywords, EXTRA) } | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { _Py_Call(func, args, keywords, EXTRA) } - | func=name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' error=pattern [',' ','.argument_pattern+] ','? ')' { + | func=name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' error=pattern [',' ','.error_argument_pattern+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "positional pattern follows keyword pattern") } - | func=name_or_attr '(' [','.argument_pattern+ ','] error=error_star [',' ','.(argument_pattern | error_star)+] ','? ')' { + | func=name_or_attr '(' [','.error_argument_pattern+ ','] error=error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } signed_number: | NUMBER - | '-' number=NUMBER { - _Py_UnaryOp(USub, number, EXTRA) } + | '-' number=NUMBER { _Py_UnaryOp(USub, number, EXTRA) } attr: | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } name_or_attr: | attr | NAME + values_pattern: - | values=','.value_pattern+ ','? { - values } + | values=','.value_pattern+ ','? { values } items_pattern: - | items=','.key_value_pattern+ ','? { - items } + | items=','.key_value_pattern+ ','? { items } keyword_pattern: - | arg=NAME '=' value=or_pattern { - _Py_keyword(arg->v.Name.id, value, EXTRA) } -argument_pattern: + | arg=NAME '=' value=or_pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } +error_argument_pattern: | pattern | keyword_pattern error_star[expr_ty]: - | ('*' | '**') error=NAME { - error } + | ('*' | '**') error=NAME { error } value_pattern: - | '*' value=name_pattern { - _Py_Starred(value, Store, EXTRA) } + | '*' value=name_pattern { _Py_Starred(value, Store, EXTRA) } | pattern key_value_pattern: | key=(literal_pattern | constant_pattern) ':' value=or_pattern { _PyPegen_key_value_pair(p, key, value) } - | '**' value=name_pattern { - _PyPegen_key_value_pair(p, NULL, value) } + | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } return_stmt[stmt_ty]: | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 96f2631c89d878..fa150bd470fcb6 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -115,9 +115,9 @@ static KeywordToken *reserved_keywords[] = { #define finally_block_type 1037 #define match_stmt_type 1038 #define case_block_type 1039 -#define pattern_no_comma_type 1040 -#define pattern_type 1041 -#define guard_type 1042 +#define guard_type 1040 +#define pattern_no_comma_type 1041 +#define pattern_type 1042 #define or_pattern_type 1043 #define closed_pattern_type 1044 #define name_pattern_type 1045 @@ -133,7 +133,7 @@ static KeywordToken *reserved_keywords[] = { #define values_pattern_type 1055 #define items_pattern_type 1056 #define keyword_pattern_type 1057 -#define argument_pattern_type 1058 +#define error_argument_pattern_type 1058 #define error_star_type 1059 #define value_pattern_type 1060 #define key_value_pattern_type 1061 @@ -488,9 +488,9 @@ static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); static void *match_stmt_rule(Parser *p); static void *case_block_rule(Parser *p); +static void *guard_rule(Parser *p); static void *pattern_no_comma_rule(Parser *p); static expr_ty pattern_rule(Parser *p); -static void *guard_rule(Parser *p); static void *or_pattern_rule(Parser *p); static void *closed_pattern_rule(Parser *p); static void *name_pattern_rule(Parser *p); @@ -506,7 +506,7 @@ static void *name_or_attr_rule(Parser *p); static void *values_pattern_rule(Parser *p); static void *items_pattern_rule(Parser *p); static void *keyword_pattern_rule(Parser *p); -static void *argument_pattern_rule(Parser *p); +static void *error_argument_pattern_rule(Parser *p); static expr_ty error_star_rule(Parser *p); static void *value_pattern_rule(Parser *p); static void *key_value_pattern_rule(Parser *p); @@ -4806,6 +4806,50 @@ case_block_rule(Parser *p) return _res; } +// guard: 'if' named_expression +static void * +guard_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'if' named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + Token * _keyword; + expr_ty guard; + if ( + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + && + (guard = named_expression_rule(p)) // named_expression + ) + { + D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); + _res = guard; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // pattern_no_comma: pattern !',' | pattern ',' static void * pattern_no_comma_rule(Parser *p) @@ -4876,7 +4920,7 @@ pattern_no_comma_rule(Parser *p) return _res; } -// pattern: NAME ':=' or_pattern | '(' ')' | or_pattern +// pattern: NAME ':=' or_pattern | or_pattern static expr_ty pattern_rule(Parser *p) { @@ -4935,33 +4979,6 @@ pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' or_pattern")); } - { // '(' ')' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - Token * _literal; - Token * error; - if ( - (error = _PyPegen_expect_token(p, 7)) // token='(' - && - (_literal = _PyPegen_expect_token(p, 8)) // token=')' - ) - { - D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[]'?" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); - } { // or_pattern if (p->error_indicator) { D(p->level--); @@ -4987,50 +5004,6 @@ pattern_rule(Parser *p) return _res; } -// guard: 'if' named_expression -static void * -guard_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'if' named_expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); - Token * _keyword; - expr_ty guard; - if ( - (_keyword = _PyPegen_expect_token(p, 510)) // token='if' - && - (guard = named_expression_rule(p)) // named_expression - ) - { - D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); - _res = guard; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - // or_pattern: closed_pattern '|' '|'.closed_pattern+ | closed_pattern static void * or_pattern_rule(Parser *p) @@ -5641,7 +5614,7 @@ constant_pattern_rule(Parser *p) return _res; } -// group_pattern: '(' pattern_no_comma ')' +// group_pattern: '(' pattern_no_comma ')' | '(' ')' static void * group_pattern_rule(Parser *p) { @@ -5682,6 +5655,33 @@ group_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern_no_comma ')'")); } + { // '(' ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + Token * _literal; + Token * error; + if ( + (error = _PyPegen_expect_token(p, 7)) // token='(' + && + (_literal = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[]'?" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); + } _res = NULL; done: D(p->level--); @@ -5823,8 +5823,8 @@ mapping_pattern_rule(Parser *p) // | name_or_attr '(' ','.pattern+ ','? ')' // | name_or_attr '(' ','.keyword_pattern+ ','? ')' // | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')' -// | name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')' +// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')' +// | name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' static void * class_pattern_rule(Parser *p) { @@ -6027,12 +6027,12 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); } - { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')' + { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); asdl_seq * _gather_65_var; Token * _literal; Token * _literal_1; @@ -6058,14 +6058,14 @@ class_pattern_rule(Parser *p) && (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.argument_pattern+] + (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.error_argument_pattern+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "positional pattern follows keyword pattern" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6076,14 +6076,14 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.argument_pattern+] ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); } - { // name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')' + { // name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -6099,18 +6099,18 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_68_rule(p), 1) // [','.argument_pattern+ ','] + (_opt_var = _tmp_68_rule(p), 1) // [','.error_argument_pattern+ ','] && (error = error_star_rule(p)) // error_star && - (_opt_var_1 = _tmp_69_rule(p), 1) // [',' ','.(argument_pattern | error_star)+] + (_opt_var_1 = _tmp_69_rule(p), 1) // [',' ','.(error_argument_pattern | error_star)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6121,7 +6121,7 @@ class_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.argument_pattern+ ','] error_star [',' ','.(argument_pattern | error_star)+] ','? ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); } _res = NULL; done: @@ -6516,9 +6516,9 @@ keyword_pattern_rule(Parser *p) return _res; } -// argument_pattern: pattern | keyword_pattern +// error_argument_pattern: pattern | keyword_pattern static void * -argument_pattern_rule(Parser *p) +error_argument_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6532,18 +6532,18 @@ argument_pattern_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + D(fprintf(stderr, "%*c> error_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); expr_ty pattern_var; if ( (pattern_var = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + D(fprintf(stderr, "%*c+ error_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); _res = pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s error_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); } { // keyword_pattern @@ -6551,18 +6551,18 @@ argument_pattern_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + D(fprintf(stderr, "%*c> error_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); void *keyword_pattern_var; if ( (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern ) { - D(fprintf(stderr, "%*c+ argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); + D(fprintf(stderr, "%*c+ error_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); _res = keyword_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s error_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); } _res = NULL; @@ -21417,7 +21417,7 @@ _gather_65_rule(Parser *p) return _res; } -// _tmp_67: ',' ','.argument_pattern+ +// _tmp_67: ',' ','.error_argument_pattern+ static void * _tmp_67_rule(Parser *p) { @@ -21428,27 +21428,27 @@ _tmp_67_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.argument_pattern+ + { // ',' ','.error_argument_pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); asdl_seq * _gather_170_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_170_var = _gather_170_rule(p)) // ','.argument_pattern+ + (_gather_170_var = _gather_170_rule(p)) // ','.error_argument_pattern+ ) { - D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.argument_pattern+")); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); _res = _PyPegen_dummy_name(p, _literal, _gather_170_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.argument_pattern+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.error_argument_pattern+")); } _res = NULL; done: @@ -21456,7 +21456,7 @@ _tmp_67_rule(Parser *p) return _res; } -// _tmp_68: ','.argument_pattern+ ',' +// _tmp_68: ','.error_argument_pattern+ ',' static void * _tmp_68_rule(Parser *p) { @@ -21467,27 +21467,27 @@ _tmp_68_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ','.argument_pattern+ ',' + { // ','.error_argument_pattern+ ',' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); asdl_seq * _gather_172_var; Token * _literal; if ( - (_gather_172_var = _gather_172_rule(p)) // ','.argument_pattern+ + (_gather_172_var = _gather_172_rule(p)) // ','.error_argument_pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.argument_pattern+ ','")); + D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); _res = _PyPegen_dummy_name(p, _gather_172_var, _literal); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.argument_pattern+ ','")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.error_argument_pattern+ ','")); } _res = NULL; done: @@ -21495,7 +21495,7 @@ _tmp_68_rule(Parser *p) return _res; } -// _tmp_69: ',' ','.(argument_pattern | error_star)+ +// _tmp_69: ',' ','.(error_argument_pattern | error_star)+ static void * _tmp_69_rule(Parser *p) { @@ -21506,27 +21506,27 @@ _tmp_69_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.(argument_pattern | error_star)+ + { // ',' ','.(error_argument_pattern | error_star)+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); asdl_seq * _gather_174_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_174_var = _gather_174_rule(p)) // ','.(argument_pattern | error_star)+ + (_gather_174_var = _gather_174_rule(p)) // ','.(error_argument_pattern | error_star)+ ) { - D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); _res = _PyPegen_dummy_name(p, _literal, _gather_174_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(argument_pattern | error_star)+")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); } _res = NULL; done: @@ -27613,7 +27613,7 @@ _gather_168_rule(Parser *p) return _res; } -// _loop0_171: ',' argument_pattern +// _loop0_171: ',' error_argument_pattern static asdl_seq * _loop0_171_rule(Parser *p) { @@ -27634,18 +27634,18 @@ _loop0_171_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' argument_pattern + { // ',' error_argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = argument_pattern_rule(p)) // argument_pattern + (elem = error_argument_pattern_rule(p)) // error_argument_pattern ) { _res = elem; @@ -27671,7 +27671,7 @@ _loop0_171_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_171[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -27688,7 +27688,7 @@ _loop0_171_rule(Parser *p) return _seq; } -// _gather_170: argument_pattern _loop0_171 +// _gather_170: error_argument_pattern _loop0_171 static asdl_seq * _gather_170_rule(Parser *p) { @@ -27699,27 +27699,27 @@ _gather_170_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_171 + { // error_argument_pattern _loop0_171 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c> _gather_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); void *elem; asdl_seq * seq; if ( - (elem = argument_pattern_rule(p)) // argument_pattern + (elem = error_argument_pattern_rule(p)) // error_argument_pattern && (seq = _loop0_171_rule(p)) // _loop0_171 ) { - D(fprintf(stderr, "%*c+ _gather_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c+ _gather_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_170[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_171")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_171")); } _res = NULL; done: @@ -27727,7 +27727,7 @@ _gather_170_rule(Parser *p) return _res; } -// _loop0_173: ',' argument_pattern +// _loop0_173: ',' error_argument_pattern static asdl_seq * _loop0_173_rule(Parser *p) { @@ -27748,18 +27748,18 @@ _loop0_173_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' argument_pattern + { // ',' error_argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = argument_pattern_rule(p)) // argument_pattern + (elem = error_argument_pattern_rule(p)) // error_argument_pattern ) { _res = elem; @@ -27785,7 +27785,7 @@ _loop0_173_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_173[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' argument_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -27802,7 +27802,7 @@ _loop0_173_rule(Parser *p) return _seq; } -// _gather_172: argument_pattern _loop0_173 +// _gather_172: error_argument_pattern _loop0_173 static asdl_seq * _gather_172_rule(Parser *p) { @@ -27813,27 +27813,27 @@ _gather_172_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // argument_pattern _loop0_173 + { // error_argument_pattern _loop0_173 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c> _gather_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); void *elem; asdl_seq * seq; if ( - (elem = argument_pattern_rule(p)) // argument_pattern + (elem = error_argument_pattern_rule(p)) // error_argument_pattern && (seq = _loop0_173_rule(p)) // _loop0_173 ) { - D(fprintf(stderr, "%*c+ _gather_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c+ _gather_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_172[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern _loop0_173")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_173")); } _res = NULL; done: @@ -27841,7 +27841,7 @@ _gather_172_rule(Parser *p) return _res; } -// _loop0_175: ',' (argument_pattern | error_star) +// _loop0_175: ',' (error_argument_pattern | error_star) static asdl_seq * _loop0_175_rule(Parser *p) { @@ -27862,18 +27862,18 @@ _loop0_175_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' (argument_pattern | error_star) + { // ',' (error_argument_pattern | error_star) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (argument_pattern | error_star)")); + D(fprintf(stderr, "%*c> _loop0_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (error_argument_pattern | error_star)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_190_rule(p)) // argument_pattern | error_star + (elem = _tmp_190_rule(p)) // error_argument_pattern | error_star ) { _res = elem; @@ -27899,7 +27899,7 @@ _loop0_175_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_175[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (argument_pattern | error_star)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (error_argument_pattern | error_star)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); if (!_seq) { @@ -27916,7 +27916,7 @@ _loop0_175_rule(Parser *p) return _seq; } -// _gather_174: (argument_pattern | error_star) _loop0_175 +// _gather_174: (error_argument_pattern | error_star) _loop0_175 static asdl_seq * _gather_174_rule(Parser *p) { @@ -27927,27 +27927,27 @@ _gather_174_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (argument_pattern | error_star) _loop0_175 + { // (error_argument_pattern | error_star) _loop0_175 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c> _gather_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_190_rule(p)) // argument_pattern | error_star + (elem = _tmp_190_rule(p)) // error_argument_pattern | error_star && (seq = _loop0_175_rule(p)) // _loop0_175 ) { - D(fprintf(stderr, "%*c+ _gather_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c+ _gather_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_174[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(argument_pattern | error_star) _loop0_175")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); } _res = NULL; done: @@ -28640,7 +28640,7 @@ _tmp_189_rule(Parser *p) return _res; } -// _tmp_190: argument_pattern | error_star +// _tmp_190: error_argument_pattern | error_star static void * _tmp_190_rule(Parser *p) { @@ -28651,24 +28651,24 @@ _tmp_190_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // argument_pattern + { // error_argument_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "argument_pattern")); - void *argument_pattern_var; + D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); + void *error_argument_pattern_var; if ( - (argument_pattern_var = argument_pattern_rule(p)) // argument_pattern + (error_argument_pattern_var = error_argument_pattern_rule(p)) // error_argument_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "argument_pattern")); - _res = argument_pattern_var; + D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); + _res = error_argument_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "argument_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern")); } { // error_star if (p->error_indicator) { From 4973548d6f798b50e74c07ddf4a90a11d72dcf83 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 10 Jun 2020 17:05:45 -0700 Subject: [PATCH 076/218] Add back type annotations. --- Grammar/python.gram | 42 ++++---- Parser/pegen/parse.c | 224 +++++++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 347e63eda605e3..8e43227f46fa90 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -192,16 +192,16 @@ except_block[excepthandler_ty]: | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } finally_block[asdl_seq*]: 'finally' ':' a=block { a } -match_stmt: +match_stmt[stmt_ty]: | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } -case_block: +case_block[match_case_ty]: | "case" pattern=pattern_no_comma guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } -guard: +guard[expr_ty]: | 'if' guard=named_expression { guard } -pattern_no_comma: +pattern_no_comma[expr_ty]: | pattern=pattern !',' { pattern } | pattern error=',' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[...]'?") } @@ -211,12 +211,12 @@ pattern[expr_ty]: _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } | or_pattern -or_pattern: +or_pattern[expr_ty]: | value=closed_pattern '|' values='|'.closed_pattern+ { _Py_BoolOp(Or, CHECK(_PyPegen_seq_insert_in_front(p, value, values)), EXTRA) } | closed_pattern -closed_pattern: +closed_pattern[expr_ty]: | name_pattern | literal_pattern | constant_pattern @@ -225,9 +225,9 @@ closed_pattern: | mapping_pattern | class_pattern -name_pattern: +name_pattern[expr_ty]: | name=NAME !('.' | '(' | '=') { _PyPegen_set_expr_context(p, name, Store) } -literal_pattern: +literal_pattern[expr_ty]: | signed_number !('+' | '-') | real=signed_number '+' imag=NUMBER { _Py_BinOp(real, Add, imag, EXTRA) } | real=signed_number '-' imag=NUMBER { _Py_BinOp(real, Sub, imag, EXTRA) } @@ -235,19 +235,19 @@ literal_pattern: | 'None' { _Py_Constant(Py_None, NULL, EXTRA) } | 'True' { _Py_Constant(Py_True, NULL, EXTRA) } | 'False' { _Py_Constant(Py_False, NULL, EXTRA) } -constant_pattern: +constant_pattern[expr_ty]: | '.' name=NAME !('.' | '(' | '=') { name } | '.'? attr=attr !('.' | '(' | '=') { attr } -group_pattern: +group_pattern[expr_ty]: | '(' pattern=pattern_no_comma ')' { pattern } | error='(' ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[]'?") } -sequence_pattern: +sequence_pattern[expr_ty]: | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } -mapping_pattern: +mapping_pattern[expr_ty]: | '{' items=items_pattern? '}' { _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } -class_pattern: +class_pattern[expr_ty]: | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } | func=name_or_attr '(' args=','.pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } @@ -260,21 +260,21 @@ class_pattern: | func=name_or_attr '(' [','.error_argument_pattern+ ','] error=error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } -signed_number: +signed_number[expr_ty]: | NUMBER | '-' number=NUMBER { _Py_UnaryOp(USub, number, EXTRA) } -attr: +attr[expr_ty]: | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } -name_or_attr: +name_or_attr[expr_ty]: | attr | NAME -values_pattern: +values_pattern[asdl_seq*]: | values=','.value_pattern+ ','? { values } -items_pattern: +items_pattern[asdl_seq*]: | items=','.key_value_pattern+ ','? { items } -keyword_pattern: +keyword_pattern[keyword_ty]: | arg=NAME '=' value=or_pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } error_argument_pattern: | pattern @@ -282,10 +282,10 @@ error_argument_pattern: error_star[expr_ty]: | ('*' | '**') error=NAME { error } -value_pattern: +value_pattern[expr_ty]: | '*' value=name_pattern { _Py_Starred(value, Store, EXTRA) } | pattern -key_value_pattern: +key_value_pattern[KeyValuePair*]: | key=(literal_pattern | constant_pattern) ':' value=or_pattern { _PyPegen_key_value_pair(p, key, value) } | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index fa150bd470fcb6..409b9cba4728c4 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -486,30 +486,30 @@ static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); -static void *match_stmt_rule(Parser *p); -static void *case_block_rule(Parser *p); -static void *guard_rule(Parser *p); -static void *pattern_no_comma_rule(Parser *p); +static stmt_ty match_stmt_rule(Parser *p); +static match_case_ty case_block_rule(Parser *p); +static expr_ty guard_rule(Parser *p); +static expr_ty pattern_no_comma_rule(Parser *p); static expr_ty pattern_rule(Parser *p); -static void *or_pattern_rule(Parser *p); -static void *closed_pattern_rule(Parser *p); -static void *name_pattern_rule(Parser *p); -static void *literal_pattern_rule(Parser *p); -static void *constant_pattern_rule(Parser *p); -static void *group_pattern_rule(Parser *p); -static void *sequence_pattern_rule(Parser *p); -static void *mapping_pattern_rule(Parser *p); -static void *class_pattern_rule(Parser *p); -static void *signed_number_rule(Parser *p); -static void *attr_rule(Parser *p); -static void *name_or_attr_rule(Parser *p); -static void *values_pattern_rule(Parser *p); -static void *items_pattern_rule(Parser *p); -static void *keyword_pattern_rule(Parser *p); +static expr_ty or_pattern_rule(Parser *p); +static expr_ty closed_pattern_rule(Parser *p); +static expr_ty name_pattern_rule(Parser *p); +static expr_ty literal_pattern_rule(Parser *p); +static expr_ty constant_pattern_rule(Parser *p); +static expr_ty group_pattern_rule(Parser *p); +static expr_ty sequence_pattern_rule(Parser *p); +static expr_ty mapping_pattern_rule(Parser *p); +static expr_ty class_pattern_rule(Parser *p); +static expr_ty signed_number_rule(Parser *p); +static expr_ty attr_rule(Parser *p); +static expr_ty name_or_attr_rule(Parser *p); +static asdl_seq* values_pattern_rule(Parser *p); +static asdl_seq* items_pattern_rule(Parser *p); +static keyword_ty keyword_pattern_rule(Parser *p); static void *error_argument_pattern_rule(Parser *p); static expr_ty error_star_rule(Parser *p); -static void *value_pattern_rule(Parser *p); -static void *key_value_pattern_rule(Parser *p); +static expr_ty value_pattern_rule(Parser *p); +static KeyValuePair* key_value_pattern_rule(Parser *p); static stmt_ty return_stmt_rule(Parser *p); static stmt_ty raise_stmt_rule(Parser *p); static stmt_ty function_def_rule(Parser *p); @@ -2132,7 +2132,7 @@ compound_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); - void *match_stmt_var; + stmt_ty match_stmt_var; if ( (match_stmt_var = match_stmt_rule(p)) // match_stmt ) @@ -4677,7 +4677,7 @@ finally_block_rule(Parser *p) } // match_stmt: "match" expression ':' NEWLINE INDENT case_block+ DEDENT -static void * +static stmt_ty match_stmt_rule(Parser *p) { D(p->level++); @@ -4685,7 +4685,7 @@ match_stmt_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -4754,7 +4754,7 @@ match_stmt_rule(Parser *p) } // case_block: "case" pattern_no_comma guard? ':' block -static void * +static match_case_ty case_block_rule(Parser *p) { D(p->level++); @@ -4762,7 +4762,7 @@ case_block_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + match_case_ty _res = NULL; int _mark = p->mark; { // "case" pattern_no_comma guard? ':' block if (p->error_indicator) { @@ -4774,7 +4774,7 @@ case_block_rule(Parser *p) Token * _literal; asdl_seq* body; void *guard; - void *pattern; + expr_ty pattern; if ( (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' && @@ -4807,7 +4807,7 @@ case_block_rule(Parser *p) } // guard: 'if' named_expression -static void * +static expr_ty guard_rule(Parser *p) { D(p->level++); @@ -4815,7 +4815,7 @@ guard_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // 'if' named_expression if (p->error_indicator) { @@ -4851,7 +4851,7 @@ guard_rule(Parser *p) } // pattern_no_comma: pattern !',' | pattern ',' -static void * +static expr_ty pattern_no_comma_rule(Parser *p) { D(p->level++); @@ -4859,7 +4859,7 @@ pattern_no_comma_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // pattern !',' if (p->error_indicator) { @@ -4948,7 +4948,7 @@ pattern_rule(Parser *p) D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); Token * _literal; expr_ty target; - void *value; + expr_ty value; if ( (target = _PyPegen_name_token(p)) // NAME && @@ -4985,7 +4985,7 @@ pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); - void *or_pattern_var; + expr_ty or_pattern_var; if ( (or_pattern_var = or_pattern_rule(p)) // or_pattern ) @@ -5005,7 +5005,7 @@ pattern_rule(Parser *p) } // or_pattern: closed_pattern '|' '|'.closed_pattern+ | closed_pattern -static void * +static expr_ty or_pattern_rule(Parser *p) { D(p->level++); @@ -5013,7 +5013,7 @@ or_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5031,7 +5031,7 @@ or_pattern_rule(Parser *p) } D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); Token * _literal; - void *value; + expr_ty value; asdl_seq * values; if ( (value = closed_pattern_rule(p)) // closed_pattern @@ -5069,7 +5069,7 @@ or_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern")); - void *closed_pattern_var; + expr_ty closed_pattern_var; if ( (closed_pattern_var = closed_pattern_rule(p)) // closed_pattern ) @@ -5096,7 +5096,7 @@ or_pattern_rule(Parser *p) // | sequence_pattern // | mapping_pattern // | class_pattern -static void * +static expr_ty closed_pattern_rule(Parser *p) { D(p->level++); @@ -5104,7 +5104,7 @@ closed_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // name_pattern if (p->error_indicator) { @@ -5112,7 +5112,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_pattern")); - void *name_pattern_var; + expr_ty name_pattern_var; if ( (name_pattern_var = name_pattern_rule(p)) // name_pattern ) @@ -5131,7 +5131,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - void *literal_pattern_var; + expr_ty literal_pattern_var; if ( (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) @@ -5150,7 +5150,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - void *constant_pattern_var; + expr_ty constant_pattern_var; if ( (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) @@ -5169,7 +5169,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern")); - void *group_pattern_var; + expr_ty group_pattern_var; if ( (group_pattern_var = group_pattern_rule(p)) // group_pattern ) @@ -5188,7 +5188,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); - void *sequence_pattern_var; + expr_ty sequence_pattern_var; if ( (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern ) @@ -5207,7 +5207,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); - void *mapping_pattern_var; + expr_ty mapping_pattern_var; if ( (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern ) @@ -5226,7 +5226,7 @@ closed_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern")); - void *class_pattern_var; + expr_ty class_pattern_var; if ( (class_pattern_var = class_pattern_rule(p)) // class_pattern ) @@ -5246,7 +5246,7 @@ closed_pattern_rule(Parser *p) } // name_pattern: NAME !('.' | '(' | '=') -static void * +static expr_ty name_pattern_rule(Parser *p) { D(p->level++); @@ -5254,7 +5254,7 @@ name_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // NAME !('.' | '(' | '=') if (p->error_indicator) { @@ -5296,7 +5296,7 @@ name_pattern_rule(Parser *p) // | 'None' // | 'True' // | 'False' -static void * +static expr_ty literal_pattern_rule(Parser *p) { D(p->level++); @@ -5304,7 +5304,7 @@ literal_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5321,7 +5321,7 @@ literal_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); - void *signed_number_var; + expr_ty signed_number_var; if ( (signed_number_var = signed_number_rule(p)) // signed_number && @@ -5344,7 +5344,7 @@ literal_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '+' NUMBER")); Token * _literal; expr_ty imag; - void *real; + expr_ty real; if ( (real = signed_number_rule(p)) // signed_number && @@ -5383,7 +5383,7 @@ literal_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number '-' NUMBER")); Token * _literal; expr_ty imag; - void *real; + expr_ty real; if ( (real = signed_number_rule(p)) // signed_number && @@ -5539,7 +5539,7 @@ literal_pattern_rule(Parser *p) } // constant_pattern: '.' NAME !('.' | '(' | '=') | '.'? attr !('.' | '(' | '=') -static void * +static expr_ty constant_pattern_rule(Parser *p) { D(p->level++); @@ -5547,7 +5547,7 @@ constant_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // '.' NAME !('.' | '(' | '=') if (p->error_indicator) { @@ -5586,7 +5586,7 @@ constant_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - void *attr; + expr_ty attr; if ( (_opt_var = _PyPegen_expect_token(p, 23), 1) // '.'? && @@ -5615,7 +5615,7 @@ constant_pattern_rule(Parser *p) } // group_pattern: '(' pattern_no_comma ')' | '(' ')' -static void * +static expr_ty group_pattern_rule(Parser *p) { D(p->level++); @@ -5623,7 +5623,7 @@ group_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // '(' pattern_no_comma ')' if (p->error_indicator) { @@ -5633,7 +5633,7 @@ group_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern_no_comma ')'")); Token * _literal; Token * _literal_1; - void *pattern; + expr_ty pattern; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && @@ -5689,7 +5689,7 @@ group_pattern_rule(Parser *p) } // sequence_pattern: '[' values_pattern? ']' -static void * +static expr_ty sequence_pattern_rule(Parser *p) { D(p->level++); @@ -5697,7 +5697,7 @@ sequence_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5754,7 +5754,7 @@ sequence_pattern_rule(Parser *p) } // mapping_pattern: '{' items_pattern? '}' -static void * +static expr_ty mapping_pattern_rule(Parser *p) { D(p->level++); @@ -5762,7 +5762,7 @@ mapping_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5825,7 +5825,7 @@ mapping_pattern_rule(Parser *p) // | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' // | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')' // | name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' -static void * +static expr_ty class_pattern_rule(Parser *p) { D(p->level++); @@ -5833,7 +5833,7 @@ class_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -5852,7 +5852,7 @@ class_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); Token * _literal; Token * _literal_1; - void *func; + expr_ty func; if ( (func = name_or_attr_rule(p)) // name_or_attr && @@ -5894,7 +5894,7 @@ class_pattern_rule(Parser *p) void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings asdl_seq * args; - void *func; + expr_ty func; if ( (func = name_or_attr_rule(p)) // name_or_attr && @@ -5939,7 +5939,7 @@ class_pattern_rule(Parser *p) Token * _literal_1; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - void *func; + expr_ty func; asdl_seq * keywords; if ( (func = name_or_attr_rule(p)) // name_or_attr @@ -5987,7 +5987,7 @@ class_pattern_rule(Parser *p) void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings asdl_seq * args; - void *func; + expr_ty func; asdl_seq * keywords; if ( (func = name_or_attr_rule(p)) // name_or_attr @@ -6044,7 +6044,7 @@ class_pattern_rule(Parser *p) void *_opt_var_2; UNUSED(_opt_var_2); // Silence compiler warnings expr_ty error; - void *func; + expr_ty func; if ( (func = name_or_attr_rule(p)) // name_or_attr && @@ -6093,7 +6093,7 @@ class_pattern_rule(Parser *p) void *_opt_var_2; UNUSED(_opt_var_2); // Silence compiler warnings expr_ty error; - void *func; + expr_ty func; if ( (func = name_or_attr_rule(p)) // name_or_attr && @@ -6130,7 +6130,7 @@ class_pattern_rule(Parser *p) } // signed_number: NUMBER | '-' NUMBER -static void * +static expr_ty signed_number_rule(Parser *p) { D(p->level++); @@ -6138,7 +6138,7 @@ signed_number_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -6212,12 +6212,12 @@ signed_number_rule(Parser *p) // Left-recursive // attr: name_or_attr '.' NAME -static void * attr_raw(Parser *); -static void * +static expr_ty attr_raw(Parser *); +static expr_ty attr_rule(Parser *p) { D(p->level++); - void * _res = NULL; + expr_ty _res = NULL; if (_PyPegen_is_memoized(p, attr_type, &_res)) { D(p->level--); return _res; @@ -6241,7 +6241,7 @@ attr_rule(Parser *p) D(p->level--); return _res; } -static void * +static expr_ty attr_raw(Parser *p) { D(p->level++); @@ -6249,7 +6249,7 @@ attr_raw(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -6268,7 +6268,7 @@ attr_raw(Parser *p) D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token * _literal; expr_ty attr; - void *value; + expr_ty value; if ( (value = name_or_attr_rule(p)) // name_or_attr && @@ -6307,7 +6307,7 @@ attr_raw(Parser *p) // Left-recursive // name_or_attr: attr | NAME -static void * +static expr_ty name_or_attr_rule(Parser *p) { D(p->level++); @@ -6315,7 +6315,7 @@ name_or_attr_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; { // attr if (p->error_indicator) { @@ -6323,7 +6323,7 @@ name_or_attr_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); - void *attr_var; + expr_ty attr_var; if ( (attr_var = attr_rule(p)) // attr ) @@ -6362,7 +6362,7 @@ name_or_attr_rule(Parser *p) } // values_pattern: ','.value_pattern+ ','? -static void * +static asdl_seq* values_pattern_rule(Parser *p) { D(p->level++); @@ -6370,7 +6370,7 @@ values_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; { // ','.value_pattern+ ','? if (p->error_indicator) { @@ -6407,7 +6407,7 @@ values_pattern_rule(Parser *p) } // items_pattern: ','.key_value_pattern+ ','? -static void * +static asdl_seq* items_pattern_rule(Parser *p) { D(p->level++); @@ -6415,7 +6415,7 @@ items_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; { // ','.key_value_pattern+ ','? if (p->error_indicator) { @@ -6452,7 +6452,7 @@ items_pattern_rule(Parser *p) } // keyword_pattern: NAME '=' or_pattern -static void * +static keyword_ty keyword_pattern_rule(Parser *p) { D(p->level++); @@ -6460,7 +6460,7 @@ keyword_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + keyword_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -6479,7 +6479,7 @@ keyword_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); Token * _literal; expr_ty arg; - void *value; + expr_ty value; if ( (arg = _PyPegen_name_token(p)) // NAME && @@ -6552,7 +6552,7 @@ error_argument_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> error_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - void *keyword_pattern_var; + keyword_ty keyword_pattern_var; if ( (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern ) @@ -6616,7 +6616,7 @@ error_star_rule(Parser *p) } // value_pattern: '*' name_pattern | pattern -static void * +static expr_ty value_pattern_rule(Parser *p) { D(p->level++); @@ -6624,7 +6624,7 @@ value_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -6642,7 +6642,7 @@ value_pattern_rule(Parser *p) } D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' name_pattern")); Token * _literal; - void *value; + expr_ty value; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && @@ -6699,7 +6699,7 @@ value_pattern_rule(Parser *p) // key_value_pattern: // | (literal_pattern | constant_pattern) ':' or_pattern // | '**' name_pattern -static void * +static KeyValuePair* key_value_pattern_rule(Parser *p) { D(p->level++); @@ -6707,7 +6707,7 @@ key_value_pattern_rule(Parser *p) D(p->level--); return NULL; } - void * _res = NULL; + KeyValuePair* _res = NULL; int _mark = p->mark; { // (literal_pattern | constant_pattern) ':' or_pattern if (p->error_indicator) { @@ -6717,7 +6717,7 @@ key_value_pattern_rule(Parser *p) D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); Token * _literal; void *key; - void *value; + expr_ty value; if ( (key = _tmp_75_rule(p)) // literal_pattern | constant_pattern && @@ -6746,7 +6746,7 @@ key_value_pattern_rule(Parser *p) } D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' name_pattern")); Token * _literal; - void *value; + expr_ty value; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' && @@ -20373,7 +20373,7 @@ _loop1_49_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); - void *case_block_var; + match_case_ty case_block_var; while ( (case_block_var = case_block_rule(p)) // case_block ) @@ -20445,7 +20445,7 @@ _loop0_51_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); Token * _literal; - void *elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 18)) // token='|' && @@ -20509,7 +20509,7 @@ _gather_50_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_51")); - void *elem; + expr_ty elem; asdl_seq * seq; if ( (elem = closed_pattern_rule(p)) // closed_pattern @@ -20950,7 +20950,7 @@ _loop0_59_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; - void *elem; + keyword_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21014,7 +21014,7 @@ _gather_58_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); - void *elem; + keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern @@ -21178,7 +21178,7 @@ _loop0_63_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; - void *elem; + keyword_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21242,7 +21242,7 @@ _gather_62_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); - void *elem; + keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern @@ -21331,7 +21331,7 @@ _loop0_66_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; - void *elem; + keyword_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21395,7 +21395,7 @@ _gather_65_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); - void *elem; + keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern @@ -21562,7 +21562,7 @@ _loop0_71_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; - void *elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21626,7 +21626,7 @@ _gather_70_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); - void *elem; + expr_ty elem; asdl_seq * seq; if ( (elem = value_pattern_rule(p)) // value_pattern @@ -21676,7 +21676,7 @@ _loop0_73_rule(Parser *p) } D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; - void *elem; + KeyValuePair* elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21740,7 +21740,7 @@ _gather_72_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); - void *elem; + KeyValuePair* elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern @@ -21834,7 +21834,7 @@ _tmp_75_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - void *literal_pattern_var; + expr_ty literal_pattern_var; if ( (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) @@ -21853,7 +21853,7 @@ _tmp_75_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - void *constant_pattern_var; + expr_ty constant_pattern_var; if ( (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) From b50e40375683d2a539e9f53fc299559b15c5d6d6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 10 Jun 2020 21:24:33 -0700 Subject: [PATCH 077/218] Simplify or-pattern parsing --- Grammar/python.gram | 5 ++--- Parser/pegen/parse.c | 37 ++++++------------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 8e43227f46fa90..86a6e37cc0b600 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -212,9 +212,8 @@ pattern[expr_ty]: | or_pattern or_pattern[expr_ty]: - | value=closed_pattern '|' values='|'.closed_pattern+ { - _Py_BoolOp(Or, CHECK(_PyPegen_seq_insert_in_front(p, value, values)), EXTRA) } - | closed_pattern + | values='|'.closed_pattern+ { + asdl_seq_LEN(values) == 1 ? asdl_seq_GET(values, 0) : _Py_BoolOp(Or, values, EXTRA) } closed_pattern[expr_ty]: | name_pattern diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 409b9cba4728c4..940cda557c7741 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -5004,7 +5004,7 @@ pattern_rule(Parser *p) return _res; } -// or_pattern: closed_pattern '|' '|'.closed_pattern+ | closed_pattern +// or_pattern: '|'.closed_pattern+ static expr_ty or_pattern_rule(Parser *p) { @@ -5024,24 +5024,18 @@ or_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // closed_pattern '|' '|'.closed_pattern+ + { // '|'.closed_pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); - Token * _literal; - expr_ty value; + D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); asdl_seq * values; if ( - (value = closed_pattern_rule(p)) // closed_pattern - && - (_literal = _PyPegen_expect_token(p, 18)) // token='|' - && (values = _gather_50_rule(p)) // '|'.closed_pattern+ ) { - D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); + D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5051,7 +5045,7 @@ or_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , EXTRA ); + _res = asdl_seq_LEN ( values ) == 1 ? asdl_seq_GET ( values , 0 ) : _Py_BoolOp ( Or , values , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5061,26 +5055,7 @@ or_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern '|' '|'.closed_pattern+")); - } - { // closed_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern")); - expr_ty closed_pattern_var; - if ( - (closed_pattern_var = closed_pattern_rule(p)) // closed_pattern - ) - { - D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern")); - _res = closed_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); } _res = NULL; done: From 1e0e35a003880e7cbcb43519eec88c164f193a75 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 11 Jun 2020 09:11:13 -0700 Subject: [PATCH 078/218] Refactor MATCH opcode. --- Doc/library/dis.rst | 16 +------ Lib/importlib/_bootstrap_external.py | 4 +- Python/ceval.c | 66 ++++++++++------------------ Python/compile.c | 8 ++-- Python/importlib_external.h | 2 +- Python/peephole.c | 2 - 6 files changed, 31 insertions(+), 67 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 88e8a565577222..7e69c8ea699e6a 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1189,24 +1189,10 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: MATCH (delta) +.. opcode:: MATCH (count) TODO - Pop TOS, TOS1, TOS2, and TOS3. If TOS2 is an instance of :class:`type` and - has a ``__match__`` method, call that method on TOS3. The returned "proxy" - should be non-``None``. - - TOS is an integer argument count, and TOS1 is a :class:`tuple` of attribute - names. Using these together with the ``__match_args__`` and - ``__match_args_required__`` attributes (if present) on the "proxy", discover - and validate the total collection of attribute names required for a - successful match. If it has all of those attributes, push a reversed - :class:`list` of their corresponsing values onto the stack. - - If any part of the above process is unsuccessful, increment the bytecode - counter by ``delta``. - .. versionadded:: 3.10 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 26e57ba3993e1d..852c05eb14dd71 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3455 (add MATCH*) +# Python 3.10a0 3456 (add MATCH* opcodes) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3455).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3456).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/ceval.c b/Python/ceval.c index 119d682afaff60..a883a69a1db395 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -999,10 +999,9 @@ get_match_args(PyThreadState *tstate, PyObject *proxy) } static PyObject * -do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *type, PyObject *target) +do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *type, PyObject *target) { // TODO: Break this up, and better error handling ("goto error;"): - assert(PyLong_CheckExact(count)); assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, @@ -1025,16 +1024,10 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ return NULL; } if (proxy == Py_None) { - Py_DECREF(proxy); - return NULL; + return proxy; } Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); - Py_ssize_t nargs = PyLong_AsSsize_t(count); - if (nargs < 0) { - Py_DECREF(proxy); - return NULL; - } - nargs -= nkwargs; + Py_ssize_t nargs = count - nkwargs; PyObject *args; PyObject *match_args = get_match_args(tstate, proxy); if (!match_args) { @@ -1076,7 +1069,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ return NULL; } assert(PyTuple_CheckExact(args) || args == Py_None); - PyObject *attrs = PyList_New(nargs + nkwargs); + PyObject *attrs = PyList_New(count); if (!attrs) { Py_DECREF(match_args); Py_DECREF(proxy); @@ -1101,7 +1094,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ proxy); goto error; } - if (required > nargs + nkwargs) { + if (required > count) { // TODO: combine with below? Use name? _PyErr_Format(tstate, PyExc_TypeError, "not enough match arguments provided"); @@ -1132,7 +1125,7 @@ do_match(PyThreadState *tstate, PyObject *count, PyObject *kwargs, PyObject *typ } } PyObject *name; - for (Py_ssize_t i = 0; i < nargs + nkwargs; i++) { + for (Py_ssize_t i = 0; i < count; i++) { if (i < nargs) { if (args == Py_None) { assert(!i); @@ -3623,25 +3616,18 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH): { - PyObject *count = TOP(); - PyObject *names = SECOND(); - PyObject *type = THIRD(); - PyObject *target = FOURTH(); - PyObject *attrs = do_match(tstate, count, names, type, target); - Py_DECREF(count); + PyObject *names = POP(); + PyObject *type = TOP(); + PyObject *target = SECOND(); + PyObject *attrs = do_match(tstate, oparg, names, type, target); Py_DECREF(names); - Py_DECREF(type); - Py_DECREF(target); if (!attrs) { - STACK_SHRINK(4); - if (_PyErr_Occurred(tstate)) { - goto error; - } - JUMPBY(oparg); - DISPATCH(); + goto error; } - STACK_SHRINK(3); - SET_TOP(attrs); + Py_DECREF(type); + Py_DECREF(target); + SET_SECOND(attrs); + SET_TOP(PyBool_FromLong(attrs != Py_None)); DISPATCH(); } @@ -3673,7 +3659,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PyObject *item = PySequence_Fast_GET_ITEM(target, oparg); Py_INCREF(item); PUSH(item); - DISPATCH(); + FAST_DISPATCH(); } case TARGET(MATCH_SEQ_ITEM_END): { @@ -3683,7 +3669,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PyObject *item = PySequence_Fast_GET_ITEM(target, i); Py_INCREF(item); PUSH(item); - DISPATCH(); + FAST_DISPATCH(); } case TARGET(MATCH_SEQ_SLICE): { @@ -3709,7 +3695,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } PUSH(slice); - DISPATCH(); + FAST_DISPATCH(); } case TARGET(MATCH_LEN_EQ): { @@ -3722,9 +3708,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); len = PySequence_Fast_GET_SIZE(target); } - PUSH(len == oparg ? Py_True : Py_False); - Py_INCREF(TOP()); - DISPATCH(); + PUSH(PyBool_FromLong(len == oparg)); + FAST_DISPATCH(); } case TARGET(MATCH_LEN_GE): { @@ -3737,9 +3722,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); len = PySequence_Fast_GET_SIZE(target); } - PUSH(len >= oparg ? Py_True : Py_False); - Py_INCREF(TOP()); - DISPATCH(); + PUSH(PyBool_FromLong(len >= oparg)); + FAST_DISPATCH(); } case TARGET(MATCH_MAP): { @@ -3766,8 +3750,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) SET_TOP(map); Py_DECREF(target); } - PUSH(match ? Py_True : Py_False); - Py_INCREF(TOP()); + PUSH(PyBool_FromLong(match)); DISPATCH(); } @@ -3785,8 +3768,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) SET_TOP(seq); Py_DECREF(target); } - PUSH(match ? Py_True : Py_False); - Py_INCREF(TOP()); + PUSH(PyBool_FromLong(match)); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index abcfc89ccee976..06a55233c99049 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1119,7 +1119,7 @@ stack_effect(int opcode, int oparg, int jump) case DICT_UPDATE: return -1; case MATCH: - return jump > 0 ? -4 : -3; + return -1; case MATCH_MAP_KEYS: case MATCH_LEN_EQ: case MATCH_LEN_GE: @@ -2800,10 +2800,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* PyTuple_SET_ITEM(kwnames, i, name); } ADDOP_LOAD_CONST_NEW(c, kwnames); - PyObject *count; - CHECK(count = PyLong_FromSsize_t(nargs + nkwargs)); - ADDOP_LOAD_CONST_NEW(c, count); - ADDOP_JREL(c, MATCH, fail); + ADDOP_I(c, MATCH, nargs + nkwargs); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); ADDOP_I(c, MATCH_SEQ_ITEM, i); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index ecdd6258ac5510..c6f280a81cf625 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,127,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,128,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/peephole.c b/Python/peephole.c index 61cc6a11aa752b..84de1abc175476 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -199,7 +199,6 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case MATCH: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -504,7 +503,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case MATCH: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From 31301142219270ece0a5c4ff2987a2561b1ed243 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 11 Jun 2020 14:35:40 -0700 Subject: [PATCH 079/218] Tuples! --- Grammar/python.gram | 15 ++--- Parser/pegen/parse.c | 157 +++++++++++++++++++++++++------------------ Python/ast_opt.c | 3 +- Python/compile.c | 16 +++-- 4 files changed, 108 insertions(+), 83 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 5c0e764ae62a4a..e8b433658fb7f2 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -196,15 +196,15 @@ match_stmt[stmt_ty]: | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block[match_case_ty]: - | "case" pattern=pattern_no_comma guard=guard? ':' body=block { + | "case" pattern=patterns guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } guard[expr_ty]: | 'if' guard=named_expression { guard } -pattern_no_comma[expr_ty]: - | pattern=pattern !',' { pattern } - | pattern error=',' { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[...]'?") } +patterns[expr_ty]: + | value=value_pattern ',' values=values_pattern? { + _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } + | pattern pattern[expr_ty]: | target=NAME ':=' value=or_pattern { @@ -238,11 +238,10 @@ constant_pattern[expr_ty]: | '.' name=NAME !('.' | '(' | '=') { name } | '.'? attr=attr !('.' | '(' | '=') { attr } group_pattern[expr_ty]: - | '(' pattern=pattern_no_comma ')' { pattern } - | error='(' ')' { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "tuple displays cannot be used as patterns; did you mean '[]'?") } + | '(' pattern=patterns ')' { pattern } sequence_pattern[expr_ty]: | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } + | '(' ')' { _Py_Tuple(NULL, Load, EXTRA) } mapping_pattern[expr_ty]: | '{' items=items_pattern? '}' { _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 1f632d3b531d8c..9cba3526a22d24 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -107,7 +107,7 @@ static KeywordToken *reserved_keywords[] = { #define match_stmt_type 1038 #define case_block_type 1039 #define guard_type 1040 -#define pattern_no_comma_type 1041 +#define patterns_type 1041 #define pattern_type 1042 #define or_pattern_type 1043 #define closed_pattern_type 1044 @@ -480,7 +480,7 @@ static asdl_seq* finally_block_rule(Parser *p); static stmt_ty match_stmt_rule(Parser *p); static match_case_ty case_block_rule(Parser *p); static expr_ty guard_rule(Parser *p); -static expr_ty pattern_no_comma_rule(Parser *p); +static expr_ty patterns_rule(Parser *p); static expr_ty pattern_rule(Parser *p); static expr_ty or_pattern_rule(Parser *p); static expr_ty closed_pattern_rule(Parser *p); @@ -4744,7 +4744,7 @@ match_stmt_rule(Parser *p) return _res; } -// case_block: "case" pattern_no_comma guard? ':' block +// case_block: "case" patterns guard? ':' block static match_case_ty case_block_rule(Parser *p) { @@ -4755,12 +4755,12 @@ case_block_rule(Parser *p) } match_case_ty _res = NULL; int _mark = p->mark; - { // "case" pattern_no_comma guard? ':' block + { // "case" patterns guard? ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); + D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); expr_ty _keyword; Token * _literal; asdl_seq* body; @@ -4769,7 +4769,7 @@ case_block_rule(Parser *p) if ( (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' && - (pattern = pattern_no_comma_rule(p)) // pattern_no_comma + (pattern = patterns_rule(p)) // patterns && (guard = guard_rule(p), 1) // guard? && @@ -4778,7 +4778,7 @@ case_block_rule(Parser *p) (body = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); + D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); _res = _Py_match_case ( pattern , guard , body , p -> arena ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -4789,7 +4789,7 @@ case_block_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" pattern_no_comma guard? ':' block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block")); } _res = NULL; done: @@ -4841,9 +4841,9 @@ guard_rule(Parser *p) return _res; } -// pattern_no_comma: pattern !',' | pattern ',' +// patterns: value_pattern ',' values_pattern? | pattern static expr_ty -pattern_no_comma_rule(Parser *p) +patterns_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -4852,21 +4852,43 @@ pattern_no_comma_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // pattern !',' + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // value_pattern ',' values_pattern? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern_no_comma[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern !','")); - expr_ty pattern; + D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern ',' values_pattern?")); + Token * _literal; + expr_ty value; + void *values; if ( - (pattern = pattern_rule(p)) // pattern + (value = value_pattern_rule(p)) // value_pattern && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (values = values_pattern_rule(p), 1) // values_pattern? ) { - D(fprintf(stderr, "%*c+ pattern_no_comma[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern !','")); - _res = pattern; + D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern ',' values_pattern?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4875,35 +4897,27 @@ pattern_no_comma_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern_no_comma[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern !','")); + D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern ',' values_pattern?")); } - { // pattern ',' + { // pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern_no_comma[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern ','")); - Token * error; + D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); expr_ty pattern_var; if ( (pattern_var = pattern_rule(p)) // pattern - && - (error = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ pattern_no_comma[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern ','")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[...]'?" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern_no_comma[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern ','")); + D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); } _res = NULL; done: @@ -5580,7 +5594,7 @@ constant_pattern_rule(Parser *p) return _res; } -// group_pattern: '(' pattern_no_comma ')' | '(' ')' +// group_pattern: '(' patterns ')' static expr_ty group_pattern_rule(Parser *p) { @@ -5591,24 +5605,24 @@ group_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // '(' pattern_no_comma ')' + { // '(' patterns ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern_no_comma ')'")); + D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' patterns ')'")); Token * _literal; Token * _literal_1; expr_ty pattern; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (pattern = pattern_no_comma_rule(p)) // pattern_no_comma + (pattern = patterns_rule(p)) // patterns && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern_no_comma ')'")); + D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' patterns ')'")); _res = pattern; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5619,34 +5633,7 @@ group_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern_no_comma ')'")); - } - { // '(' ')' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - Token * _literal; - Token * error; - if ( - (error = _PyPegen_expect_token(p, 7)) // token='(' - && - (_literal = _PyPegen_expect_token(p, 8)) // token=')' - ) - { - D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "tuple displays cannot be used as patterns; did you mean '[]'?" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' patterns ')'")); } _res = NULL; done: @@ -5654,7 +5641,7 @@ group_pattern_rule(Parser *p) return _res; } -// sequence_pattern: '[' values_pattern? ']' +// sequence_pattern: '[' values_pattern? ']' | '(' ')' static expr_ty sequence_pattern_rule(Parser *p) { @@ -5713,6 +5700,42 @@ sequence_pattern_rule(Parser *p) D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' values_pattern? ']'")); } + { // '(' ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + Token * _literal; + Token * _literal_1; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( NULL , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); + } _res = NULL; done: D(p->level--); diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 5079a59547d3af..bee3dc3919b4c1 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -800,7 +800,6 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) // TODO: Build out this pattern optimizer. switch (node_->kind) { case Attribute_kind: - case Constant_kind: return 1; case BinOp_kind: CALL(astfold_pattern_complex, expr_ty, node_); @@ -808,12 +807,14 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case BoolOp_kind: // TODO: Quite a bit of potential here. case Call_kind: + case Constant_kind: case Dict_kind: // Not actually valid, but it's the complier's job to complain: case JoinedStr_kind: case List_kind: case Name_kind: case NamedExpr_kind: + case Tuple_kind: return 1; case UnaryOp_kind: CALL(astfold_pattern_negative, expr_ty, node_); diff --git a/Python/compile.c b/Python/compile.c index 06a55233c99049..2a5ad8a2418aec 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2976,8 +2976,8 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* n static int compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { - assert(p->kind == List_kind); - asdl_seq *values = p->v.List.elts; + assert(p->kind == List_kind || p->kind == Tuple_kind); + asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; for (Py_ssize_t i = 0; i < size; i++) { @@ -3039,23 +3039,25 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name case BinOp_kind: // Because we allow "2+2j", things like "2+2" make it this far. return compiler_error(c, "patterns cannot include operators"); + case BoolOp_kind: + return compiler_pattern_or(c, p, fail, names); case Call_kind: return compiler_pattern_call(c, p, fail, names); case Constant_kind: return compiler_pattern_load(c, p, fail); - case BoolOp_kind: - return compiler_pattern_or(c, p, fail, names); case Dict_kind: return compiler_pattern_mapping(c, p, fail, names); + case JoinedStr_kind: + // Because we allow strings, f-strings make it this far. + return compiler_error(c, "patterns cannot include f-strings"); case List_kind: return compiler_pattern_sequence(c, p, fail, names); case Name_kind: return compiler_pattern_name(c, p, fail, names); case NamedExpr_kind: return compiler_pattern_namedexpr(c, p, fail, names); - case JoinedStr_kind: - // Because we allow strings, f-strings make it this far. - return compiler_error(c, "patterns cannot include f-strings"); + case Tuple_kind: + return compiler_pattern_sequence(c, p, fail, names); default: Py_UNREACHABLE(); } From de78bc5befd5d1f81893ce1186208629aefe9b0d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 11 Jun 2020 14:50:31 -0700 Subject: [PATCH 080/218] Fix line numbers --- Python/compile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/compile.c b/Python/compile.c index 2a5ad8a2418aec..ba5e73185ddc74 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3033,6 +3033,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj static int compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { + SET_LOC(c, p); switch (p->kind) { case Attribute_kind: return compiler_pattern_load(c, p, fail); @@ -3073,6 +3074,7 @@ compiler_match(struct compiler *c, stmt_ty s) assert(cases); for (Py_ssize_t i = 0; i < cases; i++) { match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); + SET_LOC(c, m->pattern); CHECK(next = compiler_new_block(c)); if (i != cases - 1) { ADDOP(c, DUP_TOP); From 07b147454feb1f755ba5e6719c79011243ec3652 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 08:12:51 -0700 Subject: [PATCH 081/218] Improve compilation of wildcards. --- Python/compile.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 63aae0f5f0217e..26459620c1ba96 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2749,12 +2749,18 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } +// TODO: Remove Store part of check if disallowing all usage of _: +#define WILDCARD_CHECK(N) \ + ((N)->kind == Name_kind && (N)->v.Name.ctx == Store \ + && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + static int compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) { assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); assert(p->kind != Name_kind || p->v.Name.ctx == Load); + // TODO: Guard against wildcards here? VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, fail); @@ -2789,11 +2795,17 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); + if (WILDCARD_CHECK(arg)) { + continue; + } ADDOP_I(c, MATCH_SEQ_ITEM, i); CHECK(compiler_pattern(c, arg, block, names)); } for (i = 0; i < nkwargs; i++) { keyword_ty kwarg = asdl_seq_GET(kwargs, i); + if (WILDCARD_CHECK(kwarg->value)) { + continue; + } ADDOP_I(c, MATCH_SEQ_ITEM, nargs + i); CHECK(compiler_pattern(c, kwarg->value, block, names)); } @@ -2807,11 +2819,11 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* } static int -compiler_pattern_store(struct compiler *c, expr_ty p, int anon_ok, PyObject* names) { +compiler_pattern_store(struct compiler *c, expr_ty p, int wildcard_ok, PyObject* names) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); - if (_PyUnicode_EqualToASCIIString(p->v.Name.id, "_")) { - if (!anon_ok) { + if (WILDCARD_CHECK(p)) { + if (!wildcard_ok) { return compiler_error(c, "can't assign to '_' here; consider removing or renaming?"); } ADDOP(c, POP_TOP); @@ -2858,12 +2870,15 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; + } ADDOP_I(c, MATCH_SEQ_ITEM, i); CHECK(compiler_pattern(c, value, block_star, names)); } ADDOP(c, POP_TOP); if (star) { - CHECK(compiler_pattern(c, asdl_seq_GET(values, size - 1), fail, names)); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0, names)); } else { ADDOP(c, POP_TOP); @@ -2992,12 +3007,18 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; + } if (star < 0 || i < star) { ADDOP_I(c, MATCH_SEQ_ITEM, i); } else if (i == star) { assert(value->kind == Starred_kind); value = value->v.Starred.value; + if (WILDCARD_CHECK(value)) { + continue; + } // TODO: ERROR CHECKING FOR THESE: ADDOP_I(c, MATCH_SEQ_SLICE, (i << 16) + (size - 1 - i)); } @@ -3023,7 +3044,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name case Attribute_kind: return compiler_pattern_load(c, p, fail); case BinOp_kind: - // Because we allow "2+2j", things like "2+2" make it this far. + // Because we allow "2+2j", things like "2+2" make it this far: return compiler_error(c, "patterns cannot include operators"); case BoolOp_kind: return compiler_pattern_or(c, p, fail, names); @@ -3034,7 +3055,7 @@ compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* name case Dict_kind: return compiler_pattern_mapping(c, p, fail, names); case JoinedStr_kind: - // Because we allow strings, f-strings make it this far. + // Because we allow strings, f-strings make it this far: return compiler_error(c, "patterns cannot include f-strings"); case List_kind: return compiler_pattern_sequence(c, p, fail, names); From 18ef5771b8cbdff3d3b5aea11679c294140a11f6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 08:13:08 -0700 Subject: [PATCH 082/218] Better error message for bad types. --- Python/ceval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 64852e0e3ba211..441d14d20fedb4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1005,8 +1005,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, - "called match pattern must be a type; did you mean '%s(...)'?", - Py_TYPE(type)->tp_name); + "called match pattern must be a type"); return NULL; } PyObject *method = PyObject_GetAttrString(type, "__match__"); From 4106b66cab4de957d1577dfee5dde9329113f7b3 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 08:37:59 -0700 Subject: [PATCH 083/218] Fix duplicate test --- Lib/test/test_patma.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 78d9a9867e1aaf..ce6a318172d0f0 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1187,9 +1187,9 @@ def test_patma_070(self) -> None: def test_patma_071(self) -> None: x = 0 match x: - case 0 if True: + case 0 if 1: y = 0 - case 0 if True: + case 0 if 1: y = 1 self.assertEqual(x, 0) self.assertEqual(y, 0) From 5ef4df0e3258472e2e463a94c6be2120330c0928 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 13:00:44 -0700 Subject: [PATCH 084/218] Progress on performance improvements --- Python/ceval.c | 53 ++++++++++++++++++++++++++++++++++-------------- Python/compile.c | 3 +-- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 441d14d20fedb4..6e12296ed55eeb 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -910,7 +910,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) if (!seen) { goto fail; } - values = PyList_New(nkeys); + values = PyTuple_New(nkeys); if (!values) { goto fail; } @@ -929,7 +929,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) goto fail; } Py_INCREF(value); - PyList_SET_ITEM(values, i, value); + PyTuple_SET_ITEM(values, i, value); if (PyDict_DelItem(map, key)) { goto fail; } @@ -1068,7 +1068,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty return NULL; } assert(PyTuple_CheckExact(args) || args == Py_None); - PyObject *attrs = PyList_New(count); + PyObject *attrs = PyTuple_New(count); if (!attrs) { Py_DECREF(match_args); Py_DECREF(proxy); @@ -1129,7 +1129,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (args == Py_None) { assert(!i); Py_INCREF(proxy); - PyList_SET_ITEM(attrs, 0, proxy); + PyTuple_SET_ITEM(attrs, 0, proxy); continue; } name = PyTuple_GET_ITEM(args, i); @@ -1161,7 +1161,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty proxy, name); } } - PyList_SET_ITEM(attrs, i, attr); + PyTuple_SET_ITEM(attrs, i, attr); } Py_DECREF(match_args); Py_DECREF(proxy); @@ -3653,21 +3653,44 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_SEQ_ITEM): { PyObject *target = TOP(); - assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); - PyObject *item = PySequence_Fast_GET_ITEM(target, oparg); + PyObject *item; + if (PyTuple_CheckExact(target)) { + assert(oparg < PyTuple_GET_SIZE(target)); + item = PyTuple_GET_ITEM(target, oparg); + } + else if (PyList_CheckExact(target)) { + assert(oparg < PyList_GET_SIZE(target)); + item = PyList_GET_ITEM(target, oparg); + } + else { + // TODO + Py_UNREACHABLE(); + } Py_INCREF(item); PUSH(item); - FAST_DISPATCH(); + DISPATCH(); } case TARGET(MATCH_SEQ_ITEM_END): { PyObject *target = TOP(); - assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); - Py_ssize_t i = PySequence_Fast_GET_SIZE(target) - 1 - oparg; - PyObject *item = PySequence_Fast_GET_ITEM(target, i); + PyObject *item; + if (PyTuple_CheckExact(target)) { + Py_ssize_t i = PyTuple_GET_SIZE(target) - 1 - oparg; + assert(i >= 0); + item = PyTuple_GET_ITEM(target, i); + } + else if (PyList_CheckExact(target)) { + Py_ssize_t i = PyList_GET_SIZE(target) - 1 - oparg; + assert(i >= 0); + item = PyList_GET_ITEM(target, i); + } + else { + // TODO + Py_UNREACHABLE(); + } Py_INCREF(item); PUSH(item); - FAST_DISPATCH(); + DISPATCH(); } case TARGET(MATCH_SEQ_SLICE): { @@ -3693,7 +3716,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } PUSH(slice); - FAST_DISPATCH(); + DISPATCH(); } case TARGET(MATCH_LEN_EQ): { @@ -3707,7 +3730,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) len = PySequence_Fast_GET_SIZE(target); } PUSH(PyBool_FromLong(len == oparg)); - FAST_DISPATCH(); + DISPATCH(); } case TARGET(MATCH_LEN_GE): { @@ -3721,7 +3744,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) len = PySequence_Fast_GET_SIZE(target); } PUSH(PyBool_FromLong(len >= oparg)); - FAST_DISPATCH(); + DISPATCH(); } case TARGET(MATCH_MAP): { diff --git a/Python/compile.c b/Python/compile.c index 26459620c1ba96..b315ff232ea2e0 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2751,8 +2751,7 @@ compiler_if(struct compiler *c, stmt_ty s) // TODO: Remove Store part of check if disallowing all usage of _: #define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && (N)->v.Name.ctx == Store \ - && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + ((N)->kind == Name_kind && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) From ff0c9023bacf93bbd73ed812d6ff4d312f61455a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 13:43:47 -0700 Subject: [PATCH 085/218] Fix segfault on missing attribute --- Python/ceval.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index 6e12296ed55eeb..0cd2389556e9a7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1159,7 +1159,12 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty _PyErr_Format(tstate, PyExc_TypeError, "match proxy %R has no attribute %R", proxy, name); + goto error; } + Py_DECREF(attrs); + attrs = Py_None; + Py_INCREF(attrs); + break; } PyTuple_SET_ITEM(attrs, i, attr); } @@ -3652,13 +3657,16 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQ_ITEM): { + printf("AAA\n"); PyObject *target = TOP(); PyObject *item; if (PyTuple_CheckExact(target)) { + printf("BBB\n"); assert(oparg < PyTuple_GET_SIZE(target)); item = PyTuple_GET_ITEM(target, oparg); } else if (PyList_CheckExact(target)) { + printf("CCC\n"); assert(oparg < PyList_GET_SIZE(target)); item = PyList_GET_ITEM(target, oparg); } @@ -3668,6 +3676,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } Py_INCREF(item); PUSH(item); + printf("DDD\n"); DISPATCH(); } From 38000fa995ba8543142bacf6355aaee98156daf6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Jun 2020 13:47:48 -0700 Subject: [PATCH 086/218] Cleanup --- Python/ceval.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 0cd2389556e9a7..57c7f0ba2d9312 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3657,16 +3657,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQ_ITEM): { - printf("AAA\n"); PyObject *target = TOP(); PyObject *item; if (PyTuple_CheckExact(target)) { - printf("BBB\n"); assert(oparg < PyTuple_GET_SIZE(target)); item = PyTuple_GET_ITEM(target, oparg); } else if (PyList_CheckExact(target)) { - printf("CCC\n"); assert(oparg < PyList_GET_SIZE(target)); item = PyList_GET_ITEM(target, oparg); } @@ -3676,7 +3673,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } Py_INCREF(item); PUSH(item); - printf("DDD\n"); DISPATCH(); } From 15e8824568747cb18a3d62e9153ea187c67a651f Mon Sep 17 00:00:00 2001 From: Talin Date: Fri, 12 Jun 2020 18:49:05 -0700 Subject: [PATCH 087/218] Support for __match_args__ in dataclasses. --- Lib/dataclasses.py | 15 +++++++++++++++ Lib/test/test_dataclasses.py | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index fc69508354bbe8..765f0f7160a899 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -151,6 +151,16 @@ # # See _hash_action (below) for a coded version of this table. +# __match_args__ +# +# | no | yes | <--- class has __match_args__ in __dict__? +# +=======+=======+ +# | add | | <- the default +# +=======+=======+ +# __match_args__ is always added unless the class already defines it. +# __match_args__ contains the set of names of __init__ parameters. +# Non-init fields must be matched by name. + # Raised when an attempt is made to modify a frozen class. class FrozenInstanceError(AttributeError): pass @@ -992,6 +1002,11 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen): cls.__doc__ = (cls.__name__ + str(inspect.signature(cls)).replace(' -> None', '')) + match_args = cls.__dict__.get('__match_args__', MISSING) + if match_args is MISSING: + # Create a __match_args__ attribute. + _set_new_attribute(cls, '__match_args__', [f.name for f in flds if f.init]) + return cls diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index b20103bdce51cb..186f6aa3c21869 100644 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -3332,6 +3332,23 @@ class C: ## replace(c, x=5) +class TestMatchArgs(unittest.TestCase): + def test_match_args(self): + @dataclass + class B: + x: int + + o = B(4) + self.assertEqual(o.__match_args__, ['x']) + + def test_explicit_match_args(self): + @dataclass + class B: + x: int + __match_args__ = [] + + o = B(4) + self.assertEqual(o.__match_args__, []) if __name__ == '__main__': unittest.main() From 59c7a2f45625079b3ee1ff62675d7778fb3ed8e4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 14 Jun 2020 22:03:02 -0700 Subject: [PATCH 088/218] Performance tweaks and __match__ protocol updates --- Include/opcode.h | 16 ++-- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 20 ++-- Python/ceval.c | 131 +++++++++------------------ Python/compile.c | 8 +- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 16 ++-- 7 files changed, 78 insertions(+), 119 deletions(-) diff --git a/Include/opcode.h b/Include/opcode.h index 956602d29ecdce..7bfa59812e2b80 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -30,9 +30,6 @@ extern "C" { #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 -#define MATCH_SEQ 30 -#define MATCH_MAP 31 -#define MATCH_MAP_KEYS 32 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -131,11 +128,14 @@ extern "C" { #define DICT_MERGE 164 #define DICT_UPDATE 165 #define MATCH 166 -#define MATCH_LEN_EQ 171 -#define MATCH_LEN_GE 172 -#define MATCH_SEQ_SLICE 173 -#define MATCH_SEQ_ITEM 174 -#define MATCH_SEQ_ITEM_END 175 +#define MATCH_MAP 167 +#define MATCH_MAP_KEYS 168 +#define MATCH_LEN_EQ 169 +#define MATCH_LEN_GE 170 +#define MATCH_SEQ 171 +#define MATCH_SEQ_ITEM 172 +#define MATCH_SEQ_ITEM_END 173 +#define MATCH_SEQ_SLICE 174 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 852c05eb14dd71..0d44b785271806 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3456 (add MATCH* opcodes) +# Python 3.10a0 3458 (add MATCH* opcodes) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3456).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3458).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 59a31b61099102..d215002af4bec7 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -83,10 +83,6 @@ def jabs_op(name, op): def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) -def_op('MATCH_SEQ', 30) -def_op('MATCH_MAP', 31) -def_op('MATCH_MAP_KEYS', 32) - def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) def_op('GET_AITER', 50) @@ -218,12 +214,14 @@ def jabs_op(name, op): def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -jrel_op('MATCH', 166) - -def_op('MATCH_LEN_EQ', 171) -def_op('MATCH_LEN_GE', 172) -def_op('MATCH_SEQ_SLICE', 173) -def_op('MATCH_SEQ_ITEM', 174) -def_op('MATCH_SEQ_ITEM_END', 175) +def_op('MATCH', 166) +def_op('MATCH_MAP', 167) +def_op('MATCH_MAP_KEYS', 168) +def_op('MATCH_LEN_EQ', 169) +def_op('MATCH_LEN_GE', 170) +def_op('MATCH_SEQ', 171) +def_op('MATCH_SEQ_ITEM', 172) +def_op('MATCH_SEQ_ITEM_END', 173) +def_op('MATCH_SEQ_SLICE', 174) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index 57c7f0ba2d9312..80ea2c5fde0d0e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -896,14 +896,14 @@ match_seq(PyObject *target) } static PyObject* -match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) +match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) { - assert(PyDict_CheckExact(map)); + assert(pop ? PyDict_CheckExact(map) : 1); assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); PyObject *seen = NULL; PyObject *values = NULL; - if (PyDict_GET_SIZE(map) < nkeys) { + if (PyMapping_Length(map) < nkeys) { goto fail; } seen = PySet_New(NULL); @@ -924,13 +924,16 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) } goto fail; } - PyObject *value = PyDict_GetItemWithError(map, key); + if (!PyMapping_HasKey(map, key)) { + goto fail; + } + PyObject *value = PyObject_GetItem(map, key); if (!value) { goto fail; } Py_INCREF(value); PyTuple_SET_ITEM(values, i, value); - if (PyDict_DelItem(map, key)) { + if (pop && PyDict_DelItem(map, key)) { goto fail; } } @@ -943,12 +946,12 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) } static Py_ssize_t -get_match_args_required(PyThreadState *tstate, PyObject *proxy) +get_match_args_required(PyThreadState *tstate, PyObject *type) { - if (!PyObject_HasAttrString(proxy, "__match_args_required__")) { + if (!PyObject_HasAttrString(type, "__match_args_required__")) { return 0; } - PyObject *mar = PyObject_GetAttrString(proxy, "__match_args_required__"); + PyObject *mar = PyObject_GetAttrString(type, "__match_args_required__"); if (!mar) { return -1; } @@ -973,26 +976,28 @@ get_match_args_required(PyThreadState *tstate, PyObject *proxy) } static PyObject * -get_match_args(PyThreadState *tstate, PyObject *proxy) +get_match_args(PyThreadState *tstate, PyObject *type) { - if (!PyObject_HasAttrString(proxy, "__match_args__")) { + if (!PyObject_HasAttrString(type, "__match_args__")) { Py_RETURN_NONE; } - PyObject *ma = PyObject_GetAttrString(proxy, "__match_args__"); + PyObject *ma = PyObject_GetAttrString(type, "__match_args__"); if (!ma) { return NULL; } // TODO: PySequence_FAST // TODO We should probably just check for string items here // TODO: Allow duplicate items? Hm... - if (PyList_CheckExact(ma)) { - return PyList_AsTuple(ma); - } - if (ma == Py_None) { + if (PyTuple_CheckExact(ma) || ma == Py_None) { return ma; } + if (PyList_CheckExact(ma)) { + PyObject *tuple = PyList_AsTuple(ma); + Py_DECREF(ma); + return tuple; + } _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ must be a list or None (got %s)", + "__match_args__ must be a list, tuple, or None (got %s)", Py_TYPE(ma)->tp_name); Py_DECREF(ma); return NULL; @@ -1028,7 +1033,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); Py_ssize_t nargs = count - nkwargs; PyObject *args; - PyObject *match_args = get_match_args(tstate, proxy); + PyObject *match_args = get_match_args(tstate, type); if (!match_args) { Py_DECREF(proxy); return NULL; @@ -1083,7 +1088,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty Py_DECREF(attrs); return NULL; } - Py_ssize_t required = get_match_args_required(tstate, proxy); + Py_ssize_t required = get_match_args_required(tstate, type); if (required < 0) { goto error; } @@ -1135,7 +1140,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty name = PyTuple_GET_ITEM(args, i); if (!PyUnicode_CheckExact(name)) { _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ elements must be str (got %s)", + "__match_args__ elements must be strings (got %s)", Py_TYPE(name)->tp_name); goto error; } @@ -3637,7 +3642,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_MAP_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); - PyObject *values = match_map_items(tstate, target, keys); + PyObject *values = match_map_items(tstate, target, keys, oparg); if (!values) { if (_PyErr_Occurred(tstate)) { goto error; @@ -3657,66 +3662,29 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQ_ITEM): { - PyObject *target = TOP(); - PyObject *item; - if (PyTuple_CheckExact(target)) { - assert(oparg < PyTuple_GET_SIZE(target)); - item = PyTuple_GET_ITEM(target, oparg); - } - else if (PyList_CheckExact(target)) { - assert(oparg < PyList_GET_SIZE(target)); - item = PyList_GET_ITEM(target, oparg); - } - else { - // TODO - Py_UNREACHABLE(); + PyObject *item = PySequence_GetItem(TOP(), oparg); + if (!item) { + goto error; } - Py_INCREF(item); PUSH(item); DISPATCH(); } case TARGET(MATCH_SEQ_ITEM_END): { - PyObject *target = TOP(); - PyObject *item; - if (PyTuple_CheckExact(target)) { - Py_ssize_t i = PyTuple_GET_SIZE(target) - 1 - oparg; - assert(i >= 0); - item = PyTuple_GET_ITEM(target, i); - } - else if (PyList_CheckExact(target)) { - Py_ssize_t i = PyList_GET_SIZE(target) - 1 - oparg; - assert(i >= 0); - item = PyList_GET_ITEM(target, i); - } - else { - // TODO - Py_UNREACHABLE(); + PyObject *item = PySequence_GetItem(TOP(), -oparg - 1); + if (!item) { + goto error; } - Py_INCREF(item); PUSH(item); DISPATCH(); } case TARGET(MATCH_SEQ_SLICE): { PyObject *target = TOP(); - assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); - Py_ssize_t pre = oparg >> 16; - Py_ssize_t post = oparg & 0xFF; - PyObject *slice; - if (PyList_CheckExact(target)) { - post = PyList_GET_SIZE(target) - post; - slice = PyList_GetSlice(target, pre, post); - } - else { - post = PyTuple_GET_SIZE(target) - post; - PyObject *tslice = PyTuple_GetSlice(target, pre, post); - if (!tslice) { - goto error; - } - slice = PySequence_List(tslice); - Py_DECREF(tslice); - } + assert(PyList_CheckExact(target)); + Py_ssize_t start = oparg >> 16; + Py_ssize_t stop = PyList_GET_SIZE(target) - (oparg & 0xFF); + PyObject *slice = PyList_GetSlice(target, start, stop); if (!slice) { goto error; } @@ -3725,28 +3693,18 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_LEN_EQ): { - PyObject *target = TOP(); - Py_ssize_t len; - if (PyDict_CheckExact(target)) { - len = PyDict_GET_SIZE(target); - } - else { - assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); - len = PySequence_Fast_GET_SIZE(target); + Py_ssize_t len = PyObject_Length(TOP()); + if (len < 0) { + goto error; } PUSH(PyBool_FromLong(len == oparg)); DISPATCH(); } case TARGET(MATCH_LEN_GE): { - PyObject *target = TOP(); - Py_ssize_t len; - if (PyDict_CheckExact(target)) { - len = PyDict_GET_SIZE(target); - } - else { - assert(PyList_CheckExact(target) || PyTuple_CheckExact(target)); - len = PySequence_Fast_GET_SIZE(target); + Py_ssize_t len = PyObject_Length(TOP()); + if (len < 0) { + goto error; } PUSH(PyBool_FromLong(len >= oparg)); DISPATCH(); @@ -3758,7 +3716,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - if (match) { + if (match && oparg) { PyObject *map; if (PyDict_CheckExact(target)) { map = PyDict_Copy(target); @@ -3786,8 +3744,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - if (match) { - PyObject *seq = PySequence_Fast(target, "TODO"); // TODO + // TODO: Really needed? + if (match && oparg && !PyList_CheckExact(target)) { + PyObject *seq = PySequence_List(target); if (!seq) { goto error; } diff --git a/Python/compile.c b/Python/compile.c index b315ff232ea2e0..c402be9bd6428c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2847,7 +2847,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP(c, MATCH_MAP); + ADDOP_I(c, MATCH_MAP, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (size - star) { ADDOP_I(c, MATCH_LEN_GE, size - star); @@ -2865,7 +2865,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje VISIT(c, expr, asdl_seq_GET(keys, i)); } ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP(c, MATCH_MAP_KEYS); + ADDOP_I(c, MATCH_MAP_KEYS, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -2979,6 +2979,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; + int copy = 0; for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (value->kind != Starred_kind) { @@ -2988,11 +2989,12 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj return compiler_error(c, "multiple starred names in pattern"); } star = i; + copy = !WILDCARD_CHECK(value->v.Starred.value); } basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, MATCH_SEQ); + ADDOP_I(c, MATCH_SEQ, copy); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (star >= 0) { if (size) { diff --git a/Python/importlib_external.h b/Python/importlib_external.h index c6f280a81cf625..e6832dacfafacc 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,128,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,130,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index b13933d5377b25..7ae6c1f20d17bf 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -29,9 +29,9 @@ static void *opcode_targets[256] = { &&TARGET_BINARY_TRUE_DIVIDE, &&TARGET_INPLACE_FLOOR_DIVIDE, &&TARGET_INPLACE_TRUE_DIVIDE, - &&TARGET_MATCH_SEQ, - &&TARGET_MATCH_MAP, - &&TARGET_MATCH_MAP_KEYS, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -166,15 +166,15 @@ static void *opcode_targets[256] = { &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, &&TARGET_MATCH, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_MAP, + &&TARGET_MATCH_MAP_KEYS, &&TARGET_MATCH_LEN_EQ, &&TARGET_MATCH_LEN_GE, - &&TARGET_MATCH_SEQ_SLICE, + &&TARGET_MATCH_SEQ, &&TARGET_MATCH_SEQ_ITEM, &&TARGET_MATCH_SEQ_ITEM_END, + &&TARGET_MATCH_SEQ_SLICE, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From db054a6c33f56371a703fe6df0f958f4814f5830 Mon Sep 17 00:00:00 2001 From: Talin Date: Wed, 17 Jun 2020 20:55:50 -0700 Subject: [PATCH 089/218] Match support for namedtuple. --- Lib/collections/__init__.py | 1 + Lib/test/test_collections.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 42d0ec777c3f75..f692a4afbb1d15 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -489,6 +489,7 @@ def __getnewargs__(self): '__repr__': __repr__, '_asdict': _asdict, '__getnewargs__': __getnewargs__, + '__match_args__': field_names, } for index, name in enumerate(field_names): doc = _sys.intern(f'Alias for field number {index}') diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 7c7f8655b0fbdd..a1fc42ae1e8f53 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -665,6 +665,10 @@ class NewPoint(tuple): self.assertEqual(np.x, 1) self.assertEqual(np.y, 2) + def test_match_args(self): + Point = namedtuple('Point', 'x y') + self.assertEqual(Point.__match_args__, ('x', 'y')) # matches a real tuple + ################################################################################ ### Abstract Base Classes From db4a9b07cd070c66e0f1bae163b112faf8418d48 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Jun 2020 09:38:35 -0700 Subject: [PATCH 090/218] Lose __match_args_required__, speed up MATCH_SEQ --- Python/ceval.c | 76 ++------------------------------------------------ 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 80ea2c5fde0d0e..4cde34b3be9cac 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -887,11 +887,11 @@ match_seq(PyObject *target) } } return ( - PyObject_IsInstance(target, interp->seq_abc) + !PyType_FastSubclass(Py_TYPE(target), + Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS) && !PyIter_Check(target) - && !PyUnicode_Check(target) - && !PyBytes_Check(target) && !PyByteArray_Check(target) + && PyObject_IsInstance(target, interp->seq_abc) ); } @@ -945,36 +945,6 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) return NULL; } -static Py_ssize_t -get_match_args_required(PyThreadState *tstate, PyObject *type) -{ - if (!PyObject_HasAttrString(type, "__match_args_required__")) { - return 0; - } - PyObject *mar = PyObject_GetAttrString(type, "__match_args_required__"); - if (!mar) { - return -1; - } - if (!PyLong_CheckExact(mar)) { - _PyErr_Format(tstate, PyExc_TypeError, - "__match_args_required__ must be an int (got %s)", - Py_TYPE(mar)->tp_name); - Py_DECREF(mar); - return -1; - } - Py_ssize_t required = PyLong_AsSsize_t(mar); - Py_DECREF(mar); - if (required < 0) { - if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_TypeError, - "__match_args_required__ must be nonnegative (got %d)", - required); - } - return -1; - } - return required; -} - static PyObject * get_match_args(PyThreadState *tstate, PyObject *type) { @@ -1088,46 +1058,6 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty Py_DECREF(attrs); return NULL; } - Py_ssize_t required = get_match_args_required(tstate, type); - if (required < 0) { - goto error; - } - if ((match_args == Py_None ? 1 : PyTuple_GET_SIZE(match_args)) < required) { - _PyErr_Format(tstate, PyExc_TypeError, - "__match_args_required__ is larger than __match_args__", - proxy); - goto error; - } - if (required > count) { - // TODO: combine with below? Use name? - _PyErr_Format(tstate, PyExc_TypeError, - "not enough match arguments provided"); - goto error; - } - if (required > nargs) { - if (match_args == Py_None) { - assert(required == 1); - assert(!nargs); - // TODO: combine with above? Use name? - _PyErr_Format(tstate, PyExc_TypeError, - "not enough match arguments provided"); - goto error; - } - assert(PyTuple_CheckExact(match_args)); - for (Py_ssize_t i = nargs; i < required; i++) { - PyObject *name = PyTuple_GET_ITEM(match_args, i); - int ok = PySequence_Contains(kwargs, name); - if (ok < 0) { - goto error; - } - if (!ok) { - // TODO: Combine with above? Use name? - _PyErr_Format(tstate, PyExc_TypeError, - "not enough match arguments provided"); - goto error; - } - } - } PyObject *name; for (Py_ssize_t i = 0; i < count; i++) { if (i < nargs) { From 48f18ebdfc9b1d0adc2e86e110bfc605834eaf31 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Jun 2020 14:05:43 -0700 Subject: [PATCH 091/218] Remove a bunch of new opcodes --- Doc/library/dis.rst | 30 +------------- Include/opcode.h | 8 +--- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 8 +--- Python/ceval.c | 57 ++++--------------------- Python/compile.c | 62 ++++++++++++++++++++-------- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 12 +++--- 8 files changed, 65 insertions(+), 118 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 7e69c8ea699e6a..de0e91d42605bf 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1217,35 +1217,7 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_SEQ_ITEM (i) - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_SEQ_ITEM_END (i) - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_SEQ_ITEM_SLICE (ij) - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_LEN_EQ (size) - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_LEN_GE (size) +.. opcode:: GET_LEN TODO diff --git a/Include/opcode.h b/Include/opcode.h index 7bfa59812e2b80..20cc909cab98fe 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -13,6 +13,7 @@ extern "C" { #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define ROT_FOUR 6 +#define GET_LEN 7 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 @@ -130,12 +131,7 @@ extern "C" { #define MATCH 166 #define MATCH_MAP 167 #define MATCH_MAP_KEYS 168 -#define MATCH_LEN_EQ 169 -#define MATCH_LEN_GE 170 -#define MATCH_SEQ 171 -#define MATCH_SEQ_ITEM 172 -#define MATCH_SEQ_ITEM_END 173 -#define MATCH_SEQ_SLICE 174 +#define MATCH_SEQ 169 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 0d44b785271806..dd7465108bbd4d 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3458 (add MATCH* opcodes) +# Python 3.10a0 3460 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3458).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3461).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index d215002af4bec7..1f0b2283afdc44 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -60,6 +60,7 @@ def jabs_op(name, op): def_op('DUP_TOP', 4) def_op('DUP_TOP_TWO', 5) def_op('ROT_FOUR', 6) +def_op('GET_LEN', 7) def_op('NOP', 9) def_op('UNARY_POSITIVE', 10) @@ -217,11 +218,6 @@ def jabs_op(name, op): def_op('MATCH', 166) def_op('MATCH_MAP', 167) def_op('MATCH_MAP_KEYS', 168) -def_op('MATCH_LEN_EQ', 169) -def_op('MATCH_LEN_GE', 170) -def_op('MATCH_SEQ', 171) -def_op('MATCH_SEQ_ITEM', 172) -def_op('MATCH_SEQ_ITEM_END', 173) -def_op('MATCH_SEQ_SLICE', 174) +def_op('MATCH_SEQ', 169) del def_op, name_op, jrel_op, jabs_op diff --git a/Python/ceval.c b/Python/ceval.c index 4cde34b3be9cac..f32438561a396b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3591,52 +3591,17 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_SEQ_ITEM): { - PyObject *item = PySequence_GetItem(TOP(), oparg); - if (!item) { - goto error; - } - PUSH(item); - DISPATCH(); - } - - case TARGET(MATCH_SEQ_ITEM_END): { - PyObject *item = PySequence_GetItem(TOP(), -oparg - 1); - if (!item) { - goto error; - } - PUSH(item); - DISPATCH(); - } - - case TARGET(MATCH_SEQ_SLICE): { + case TARGET(GET_LEN): { PyObject *target = TOP(); - assert(PyList_CheckExact(target)); - Py_ssize_t start = oparg >> 16; - Py_ssize_t stop = PyList_GET_SIZE(target) - (oparg & 0xFF); - PyObject *slice = PyList_GetSlice(target, start, stop); - if (!slice) { - goto error; - } - PUSH(slice); - DISPATCH(); - } - - case TARGET(MATCH_LEN_EQ): { - Py_ssize_t len = PyObject_Length(TOP()); - if (len < 0) { + Py_ssize_t l = PyObject_Length(target); + if (l < 0) { goto error; } - PUSH(PyBool_FromLong(len == oparg)); - DISPATCH(); - } - - case TARGET(MATCH_LEN_GE): { - Py_ssize_t len = PyObject_Length(TOP()); - if (len < 0) { + PyObject *len = PyLong_FromSsize_t(l); + if (!len) { goto error; } - PUSH(PyBool_FromLong(len >= oparg)); + PUSH(len); DISPATCH(); } @@ -3646,6 +3611,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } + // TODO: Move to MATCH_MAP_ITEMS: if (match && oparg) { PyObject *map; if (PyDict_CheckExact(target)) { @@ -3674,15 +3640,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - // TODO: Really needed? - if (match && oparg && !PyList_CheckExact(target)) { - PyObject *seq = PySequence_List(target); - if (!seq) { - goto error; - } - SET_TOP(seq); - Py_DECREF(target); - } PUSH(PyBool_FromLong(match)); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index c402be9bd6428c..90a7bd35d74ea5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1106,13 +1106,9 @@ stack_effect(int opcode, int oparg, int jump) case MATCH: return -1; case MATCH_MAP_KEYS: - case MATCH_LEN_EQ: - case MATCH_LEN_GE: + case GET_LEN: case MATCH_MAP: case MATCH_SEQ: - case MATCH_SEQ_ITEM: - case MATCH_SEQ_ITEM_END: - case MATCH_SEQ_SLICE: return 1; default: return PY_INVALID_STACK_EFFECT; @@ -2797,7 +2793,9 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* if (WILDCARD_CHECK(arg)) { continue; } - ADDOP_I(c, MATCH_SEQ_ITEM, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, arg, block, names)); } for (i = 0; i < nkwargs; i++) { @@ -2805,7 +2803,9 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* if (WILDCARD_CHECK(kwarg->value)) { continue; } - ADDOP_I(c, MATCH_SEQ_ITEM, nargs + i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); + ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, kwarg->value, block, names)); } ADDOP(c, POP_TOP); @@ -2850,7 +2850,9 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_I(c, MATCH_MAP, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (size - star) { - ADDOP_I(c, MATCH_LEN_GE, size - star); + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); + ADDOP_COMPARE(c, GtE); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } Py_ssize_t i; @@ -2872,7 +2874,9 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje if (WILDCARD_CHECK(value)) { continue; } - ADDOP_I(c, MATCH_SEQ_ITEM, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, value, block_star, names)); } ADDOP(c, POP_TOP); @@ -2979,7 +2983,6 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; - int copy = 0; for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (value->kind != Starred_kind) { @@ -2989,21 +2992,24 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj return compiler_error(c, "multiple starred names in pattern"); } star = i; - copy = !WILDCARD_CHECK(value->v.Starred.value); } basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP_I(c, MATCH_SEQ, copy); + ADDOP_I(c, MATCH_SEQ, 0); // TODO: No arg ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (star >= 0) { if (size) { - ADDOP_I(c, MATCH_LEN_GE, size - 1); + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); + ADDOP_COMPARE(c, GtE); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } } else { - ADDOP_I(c, MATCH_LEN_EQ, size); + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); + ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } for (Py_ssize_t i = 0; i < size; i++) { @@ -3012,7 +3018,9 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj continue; } if (star < 0 || i < star) { - ADDOP_I(c, MATCH_SEQ_ITEM, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); } else if (i == star) { assert(value->kind == Starred_kind); @@ -3020,11 +3028,29 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj if (WILDCARD_CHECK(value)) { continue; } - // TODO: ERROR CHECKING FOR THESE: - ADDOP_I(c, MATCH_SEQ_SLICE, (i << 16) + (size - 1 - i)); + ADDOP(c, DUP_TOP); + ADDOP_I(c, BUILD_LIST, 0); + ADDOP(c, ROT_TWO); + if (i) { + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + } + else { + ADDOP_LOAD_CONST(c, Py_None); + } + if (i != size - 1) { + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - 1 - i))); + } + else { + ADDOP_LOAD_CONST(c, Py_None); + } + ADDOP_I(c, BUILD_SLICE, 2); + ADDOP(c, BINARY_SUBSCR); + ADDOP_I(c, LIST_EXTEND, 1); } else { - ADDOP_I(c, MATCH_SEQ_ITEM_END, size - 1 - i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - i))); + ADDOP(c, BINARY_SUBSCR); } CHECK(compiler_pattern(c, value, block, names)); } diff --git a/Python/importlib_external.h b/Python/importlib_external.h index e6832dacfafacc..9535776c479e66 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,130,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,133,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 7ae6c1f20d17bf..c662fe1f6b38de 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -6,7 +6,7 @@ static void *opcode_targets[256] = { &&TARGET_DUP_TOP, &&TARGET_DUP_TOP_TWO, &&TARGET_ROT_FOUR, - &&_unknown_opcode, + &&TARGET_GET_LEN, &&_unknown_opcode, &&TARGET_NOP, &&TARGET_UNARY_POSITIVE, @@ -168,12 +168,12 @@ static void *opcode_targets[256] = { &&TARGET_MATCH, &&TARGET_MATCH_MAP, &&TARGET_MATCH_MAP_KEYS, - &&TARGET_MATCH_LEN_EQ, - &&TARGET_MATCH_LEN_GE, &&TARGET_MATCH_SEQ, - &&TARGET_MATCH_SEQ_ITEM, - &&TARGET_MATCH_SEQ_ITEM_END, - &&TARGET_MATCH_SEQ_SLICE, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 0c8265502b6e2cfb118498f8496821d1d7530dba Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Jun 2020 15:56:34 -0700 Subject: [PATCH 092/218] Don't raise if no __match_args__ --- Python/ceval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index f32438561a396b..22bfd92667c9f5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1088,9 +1088,10 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } PyObject *attr = PyObject_GetAttr(proxy, name); if (!attr) { + // TODO: Only clear AttributeError? _PyErr_Clear(tstate); // TODO: iterate manually (and check for strings) - if (match_args == Py_None || !PySequence_Contains(match_args, name)) { + if (match_args != Py_None && !PySequence_Contains(match_args, name)) { _PyErr_Format(tstate, PyExc_TypeError, "match proxy %R has no attribute %R", proxy, name); From ef35201334c1158f42959acda96a0bd360e82953 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 23 Jun 2020 08:07:44 -0700 Subject: [PATCH 093/218] Add ImpossibleMatchError --- Doc/c-api/exceptions.rst | 3 +++ Doc/library/exceptions.rst | 8 ++++++++ Include/pyerrors.h | 1 + Lib/test/exception_hierarchy.txt | 1 + Objects/exceptions.c | 9 +++++++++ Python/ceval.c | 12 ++++++------ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index e7805ba143c584..59b363f2fbd2d8 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -796,6 +796,7 @@ the variables: single: PyExc_FloatingPointError single: PyExc_GeneratorExit single: PyExc_ImportError + single: PyExc_ImpossibleMatchError single: PyExc_IndentationError single: PyExc_IndexError single: PyExc_InterruptedError @@ -872,6 +873,8 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ImportError` | :exc:`ImportError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_ImpossibleMatchError` | :exc:`ImpossibleMatchError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_IndexError` | :exc:`IndexError` | | diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index df2cda9d67ad15..70c84a382204e0 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -179,6 +179,14 @@ The following exceptions are the exceptions that are usually raised. .. versionchanged:: 3.3 Added the :attr:`name` and :attr:`path` attributes. + +.. exception:: ImpossibleMatchError + + TODO + + .. versionadded:: 3.10 + + .. exception:: ModuleNotFoundError A subclass of :exc:`ImportError` which is raised by :keyword:`import` diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 979a26ba68a033..4a47d774a2c615 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -107,6 +107,7 @@ PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_TypeError; +PyAPI_DATA(PyObject *) PyExc_ImpossibleMatchError; PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt index 763a6c899b48eb..ac349aadea63fa 100644 --- a/Lib/test/exception_hierarchy.txt +++ b/Lib/test/exception_hierarchy.txt @@ -46,6 +46,7 @@ BaseException | +-- TabError +-- SystemError +-- TypeError + | +-- ImpossibleMatchError +-- ValueError | +-- UnicodeError | +-- UnicodeDecodeError diff --git a/Objects/exceptions.c b/Objects/exceptions.c index db5e3da12b00f3..4c2e2cc863c2ff 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -487,6 +487,13 @@ SimpleExtendsException(PyExc_Exception, TypeError, "Inappropriate argument type."); +/* + * ImpossibleMatchError extends TypeError + */ +SimpleExtendsException(PyExc_TypeError, ImpossibleMatchError, + "Incorrect use of a match-case statement."); + + /* * StopAsyncIteration extends Exception */ @@ -2529,6 +2536,7 @@ _PyExc_Init(void) PRE_INIT(BaseException); PRE_INIT(Exception); PRE_INIT(TypeError); + PRE_INIT(ImpossibleMatchError); PRE_INIT(StopAsyncIteration); PRE_INIT(StopIteration); PRE_INIT(GeneratorExit); @@ -2664,6 +2672,7 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod) POST_INIT(BaseException); POST_INIT(Exception); POST_INIT(TypeError); + POST_INIT(ImpossibleMatchError); POST_INIT(StopAsyncIteration); POST_INIT(StopIteration); POST_INIT(GeneratorExit); diff --git a/Python/ceval.c b/Python/ceval.c index 245f11905fefdc..397440eaf357b5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -919,7 +919,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) int dupe = PySet_Contains(seen, key); if (dupe || PySet_Add(seen, key)) { if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_ValueError, + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "mapping pattern checks duplicate key (%R)", key); } goto fail; @@ -987,7 +987,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (!method || method == Py_None) { Py_XDECREF(method); _PyErr_Clear(tstate); - _PyErr_Format(tstate, PyExc_TypeError, + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "type %s cannot be matched", Py_TYPE(type)->tp_name); return NULL; @@ -1015,7 +1015,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty Py_DECREF(match_args); Py_DECREF(proxy); // TODO: Add expected and actual counts: - _PyErr_SetString(tstate, PyExc_TypeError, + _PyErr_SetString(tstate, PyExc_ImpossibleMatchError, "too many positional matches in pattern"); return NULL; } @@ -1027,7 +1027,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty Py_DECREF(match_args); Py_DECREF(proxy); // TODO: Add expected and actual counts: - _PyErr_SetString(tstate, PyExc_TypeError, + _PyErr_SetString(tstate, PyExc_ImpossibleMatchError, "too many positional matches in pattern"); return NULL; } @@ -1081,7 +1081,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty int dupe = PySet_Contains(seen, name); if (dupe || PySet_Add(seen, name)) { if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_TypeError, + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "multiple patterns bound to attribute %R", name); } goto error; @@ -1092,7 +1092,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty _PyErr_Clear(tstate); // TODO: iterate manually (and check for strings) if (match_args != Py_None && !PySequence_Contains(match_args, name)) { - _PyErr_Format(tstate, PyExc_TypeError, + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "match proxy %R has no attribute %R", proxy, name); goto error; From 276c2b08270861f939f79b6ceec995effe83073f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 23 Jun 2020 09:28:55 -0700 Subject: [PATCH 094/218] Clean up opcodes and fix pickle tests --- Doc/library/dis.rst | 44 +++++++-------- Include/opcode.h | 10 ++-- Lib/_compat_pickle.py | 9 +++ Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 29 +++------- Lib/test/test_pickle.py | 8 +++ Python/ceval.c | 84 +++++++++++++++------------- Python/compile.c | 4 +- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 20 +++---- 10 files changed, 112 insertions(+), 102 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index de0e91d42605bf..dabfbab8fda89f 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -751,6 +751,27 @@ iterations of the loop. .. versionadded:: 3.2 +.. opcode:: GET_LEN + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_MAP + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ + + TODO + + .. versionadded:: 3.10 + + All of the following opcodes use their arguments. .. opcode:: STORE_NAME (namei) @@ -1196,28 +1217,7 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_MAP - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_MAP_KEYS - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_SEQ - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: GET_LEN +.. opcode:: MATCH_MAP_KEYS (copy) TODO diff --git a/Include/opcode.h b/Include/opcode.h index 20cc909cab98fe..2ed13d455ccc70 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -13,7 +13,6 @@ extern "C" { #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define ROT_FOUR 6 -#define GET_LEN 7 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 @@ -31,6 +30,9 @@ extern "C" { #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 +#define GET_LEN 30 +#define MATCH_MAP 31 +#define MATCH_SEQ 32 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -97,6 +99,8 @@ extern "C" { #define LOAD_GLOBAL 116 #define IS_OP 117 #define CONTAINS_OP 118 +#define MATCH 119 +#define MATCH_MAP_KEYS 120 #define JUMP_IF_NOT_EXC_MATCH 121 #define SETUP_FINALLY 122 #define LOAD_FAST 124 @@ -128,10 +132,6 @@ extern "C" { #define SET_UPDATE 163 #define DICT_MERGE 164 #define DICT_UPDATE 165 -#define MATCH 166 -#define MATCH_MAP 167 -#define MATCH_MAP_KEYS 168 -#define MATCH_SEQ 169 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/_compat_pickle.py b/Lib/_compat_pickle.py index f68496ae639f5f..44aa00b15333fe 100644 --- a/Lib/_compat_pickle.py +++ b/Lib/_compat_pickle.py @@ -249,3 +249,12 @@ for excname in PYTHON3_IMPORTERROR_EXCEPTIONS: REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'ImportError') + + + +PYTHON3_TYPEERROR_EXCEPTIONS = ( + 'ImpossibleMatchError', +) + +for excname in PYTHON3_TYPEERROR_EXCEPTIONS: + REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'TypeError') diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index dd7465108bbd4d..a4fe050512f5ca 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3460 (add structural pattern matching) +# Python 3.10a0 3462 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3461).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3462).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 1f0b2283afdc44..1922a4a24af61f 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -60,7 +60,6 @@ def jabs_op(name, op): def_op('DUP_TOP', 4) def_op('DUP_TOP_TWO', 5) def_op('ROT_FOUR', 6) -def_op('GET_LEN', 7) def_op('NOP', 9) def_op('UNARY_POSITIVE', 10) @@ -68,7 +67,6 @@ def jabs_op(name, op): def_op('UNARY_NOT', 12) def_op('UNARY_INVERT', 15) - def_op('BINARY_MATRIX_MULTIPLY', 16) def_op('INPLACE_MATRIX_MULTIPLY', 17) @@ -83,6 +81,9 @@ def jabs_op(name, op): def_op('BINARY_TRUE_DIVIDE', 27) def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) +def_op('GET_LEN', 30) +def_op('MATCH_MAP', 31) +def_op('MATCH_SEQ', 32) def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) @@ -106,7 +107,6 @@ def jabs_op(name, op): def_op('INPLACE_POWER', 67) def_op('GET_ITER', 68) def_op('GET_YIELD_FROM_ITER', 69) - def_op('PRINT_EXPR', 70) def_op('LOAD_BUILD_CLASS', 71) def_op('YIELD_FROM', 72) @@ -138,6 +138,7 @@ def jabs_op(name, op): name_op('DELETE_ATTR', 96) # "" name_op('STORE_GLOBAL', 97) # "" name_op('DELETE_GLOBAL', 98) # "" + def_op('LOAD_CONST', 100) # Index in const list hasconst.append(100) name_op('LOAD_NAME', 101) # Index in name list @@ -150,19 +151,17 @@ def jabs_op(name, op): hascompare.append(107) name_op('IMPORT_NAME', 108) # Index in name list name_op('IMPORT_FROM', 109) # Index in name list - jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code jabs_op('JUMP_IF_TRUE_OR_POP', 112) # "" jabs_op('JUMP_ABSOLUTE', 113) # "" jabs_op('POP_JUMP_IF_FALSE', 114) # "" jabs_op('POP_JUMP_IF_TRUE', 115) # "" - name_op('LOAD_GLOBAL', 116) # Index in name list - def_op('IS_OP', 117) def_op('CONTAINS_OP', 118) - +def_op('MATCH', 119) +def_op('MATCH_MAP_KEYS', 120) jabs_op('JUMP_IF_NOT_EXC_MATCH', 121) jrel_op('SETUP_FINALLY', 122) # Distance to target address @@ -177,6 +176,7 @@ def jabs_op(name, op): def_op('CALL_FUNCTION', 131) # #args def_op('MAKE_FUNCTION', 132) # Flags def_op('BUILD_SLICE', 133) # Number of items + def_op('LOAD_CLOSURE', 135) hasfree.append(135) def_op('LOAD_DEREF', 136) @@ -188,36 +188,25 @@ def jabs_op(name, op): def_op('CALL_FUNCTION_KW', 141) # #args + #kwargs def_op('CALL_FUNCTION_EX', 142) # Flags - jrel_op('SETUP_WITH', 143) - +def_op('EXTENDED_ARG', 144) +EXTENDED_ARG = 144 def_op('LIST_APPEND', 145) def_op('SET_ADD', 146) def_op('MAP_ADD', 147) - def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('EXTENDED_ARG', 144) -EXTENDED_ARG = 144 - jrel_op('SETUP_ASYNC_WITH', 154) - def_op('FORMAT_VALUE', 155) def_op('BUILD_CONST_KEY_MAP', 156) def_op('BUILD_STRING', 157) name_op('LOAD_METHOD', 160) def_op('CALL_METHOD', 161) - def_op('LIST_EXTEND', 162) def_op('SET_UPDATE', 163) def_op('DICT_MERGE', 164) def_op('DICT_UPDATE', 165) -def_op('MATCH', 166) -def_op('MATCH_MAP', 167) -def_op('MATCH_MAP_KEYS', 168) -def_op('MATCH_SEQ', 169) - del def_op, name_op, jrel_op, jabs_op diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 2307b133dbd0d5..15da43d45d5d39 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -421,6 +421,9 @@ def test_name_mapping(self): elif (module2, name2) == ('exceptions', 'ImportError'): attr = getattribute(module3, name3) self.assertTrue(issubclass(attr, ImportError)) + elif (module2, name2) == ('exceptions', 'TypeError'): + attr = getattribute(module3, name3) + self.assertTrue(issubclass(attr, TypeError)) else: module, name = mapping(module2, name2) if module3[:1] != '_': @@ -492,6 +495,11 @@ def test_exceptions(self): ('exceptions', 'ImportError')) self.assertEqual(mapping('exceptions', name), ('exceptions', name)) + elif exc is not TypeError and issubclass(exc, TypeError): + self.assertEqual(reverse_mapping('builtins', name), + ('exceptions', 'TypeError')) + self.assertEqual(mapping('exceptions', name), + ('exceptions', name)) else: self.assertEqual(reverse_mapping('builtins', name), ('exceptions', name)) diff --git a/Python/ceval.c b/Python/ceval.c index 397440eaf357b5..a76d2b0037345b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -898,7 +898,26 @@ match_seq(PyObject *target) static PyObject* match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) { - assert(pop ? PyDict_CheckExact(map) : 1); + if (pop) { + PyObject *copy; + if (PyDict_CheckExact(map)) { + copy = PyDict_Copy(map); + if (!copy) { + return NULL; + } + } + else { + copy = PyDict_New(); + if (!copy || PyDict_Update(copy, map)) { + Py_XDECREF(copy); + return NULL; + } + } + map = copy; + } + else { + Py_INCREF(map); + } assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); PyObject *seen = NULL; @@ -938,10 +957,12 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) } } Py_DECREF(seen); + Py_DECREF(map); return values; fail: Py_XDECREF(seen); Py_XDECREF(values); + Py_DECREF(map); return NULL; } @@ -3570,6 +3591,28 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } + case TARGET(MATCH_MAP): { + PyObject *target = TOP(); + // TODO: Just move the body of this function here: + int match = match_map(target); + if (match < 0) { + goto error; + } + PUSH(PyBool_FromLong(match)); + DISPATCH(); + } + + case TARGET(MATCH_SEQ): { + PyObject *target = TOP(); + // TODO: Just move the body of this function here: + int match = match_seq(target); + if (match < 0) { + goto error; + } + PUSH(PyBool_FromLong(match)); + DISPATCH(); + } + case TARGET(MATCH_MAP_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); @@ -3606,45 +3649,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_MAP): { - PyObject *target = TOP(); - int match = match_map(target); - if (match < 0) { - goto error; - } - // TODO: Move to MATCH_MAP_ITEMS: - if (match && oparg) { - PyObject *map; - if (PyDict_CheckExact(target)) { - map = PyDict_Copy(target); - if (!map) { - goto error; - } - } - else { - map = PyDict_New(); - if (!map || PyDict_Update(map, target)) { - Py_XDECREF(map); - goto error; - } - } - SET_TOP(map); - Py_DECREF(target); - } - PUSH(PyBool_FromLong(match)); - DISPATCH(); - } - - case TARGET(MATCH_SEQ): { - PyObject *target = TOP(); - int match = match_seq(target); - if (match < 0) { - goto error; - } - PUSH(PyBool_FromLong(match)); - DISPATCH(); - } - case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index 90a7bd35d74ea5..5c4649d17ad97c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2847,7 +2847,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP_I(c, MATCH_MAP, star); + ADDOP(c, MATCH_MAP); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (size - star) { ADDOP(c, GET_LEN); @@ -2996,7 +2996,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP_I(c, MATCH_SEQ, 0); // TODO: No arg + ADDOP(c, MATCH_SEQ); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); if (star >= 0) { if (size) { diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 9535776c479e66..8b838f587516b9 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,133,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,134,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index c662fe1f6b38de..ca2af205f3f261 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -6,7 +6,7 @@ static void *opcode_targets[256] = { &&TARGET_DUP_TOP, &&TARGET_DUP_TOP_TWO, &&TARGET_ROT_FOUR, - &&TARGET_GET_LEN, + &&_unknown_opcode, &&_unknown_opcode, &&TARGET_NOP, &&TARGET_UNARY_POSITIVE, @@ -29,9 +29,9 @@ static void *opcode_targets[256] = { &&TARGET_BINARY_TRUE_DIVIDE, &&TARGET_INPLACE_FLOOR_DIVIDE, &&TARGET_INPLACE_TRUE_DIVIDE, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_GET_LEN, + &&TARGET_MATCH_MAP, + &&TARGET_MATCH_SEQ, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -118,8 +118,8 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_GLOBAL, &&TARGET_IS_OP, &&TARGET_CONTAINS_OP, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH, + &&TARGET_MATCH_MAP_KEYS, &&TARGET_JUMP_IF_NOT_EXC_MATCH, &&TARGET_SETUP_FINALLY, &&_unknown_opcode, @@ -165,10 +165,10 @@ static void *opcode_targets[256] = { &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&TARGET_MATCH, - &&TARGET_MATCH_MAP, - &&TARGET_MATCH_MAP_KEYS, - &&TARGET_MATCH_SEQ, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, From 14be5cf8c752dcf4e79bcd952b45c3ffba7704bd Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 24 Jun 2020 15:07:22 -0700 Subject: [PATCH 095/218] Clean up ceval --- Lib/_compat_pickle.py | 2 - Python/ceval.c | 113 ++++++++++++++++++------------------------ 2 files changed, 49 insertions(+), 66 deletions(-) diff --git a/Lib/_compat_pickle.py b/Lib/_compat_pickle.py index 44aa00b15333fe..9038eea46c08c3 100644 --- a/Lib/_compat_pickle.py +++ b/Lib/_compat_pickle.py @@ -250,8 +250,6 @@ for excname in PYTHON3_IMPORTERROR_EXCEPTIONS: REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'ImportError') - - PYTHON3_TYPEERROR_EXCEPTIONS = ( 'ImpossibleMatchError', ) diff --git a/Python/ceval.c b/Python/ceval.c index a76d2b0037345b..767e96e2b29486 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -847,59 +847,11 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: -static int -match_map(PyObject *target) -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - return -1; - } - if (!interp->map_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return -1; - } - interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); - Py_DECREF(abc); - if (!interp->map_abc) { - return -1; - } - } - return PyObject_IsInstance(target, interp->map_abc); -} - -static int -match_seq(PyObject *target) -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - return -1; - } - if (!interp->seq_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return -1; - } - interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - Py_DECREF(abc); - if (!interp->seq_abc) { - return -1; - } - } - return ( - !PyType_FastSubclass(Py_TYPE(target), - Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS) - && !PyIter_Check(target) - && !PyByteArray_Check(target) - && PyObject_IsInstance(target, interp->seq_abc) - ); -} - static PyObject* match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) { + PyObject *copy = NULL; if (pop) { - PyObject *copy; if (PyDict_CheckExact(map)) { copy = PyDict_Copy(map); if (!copy) { @@ -913,10 +865,6 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) return NULL; } } - map = copy; - } - else { - Py_INCREF(map); } assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); @@ -943,7 +891,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) } goto fail; } - if (!PyMapping_HasKey(map, key)) { + if (!PySequence_Contains(map, key)) { goto fail; } PyObject *value = PyObject_GetItem(map, key); @@ -953,16 +901,19 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) Py_INCREF(value); PyTuple_SET_ITEM(values, i, value); if (pop && PyDict_DelItem(map, key)) { - goto fail; + if (!PyErr_ExceptionMatches(PyExc_KeyError)) { + goto fail; + } + PyErr_Clear(); } } + Py_XDECREF(copy); Py_DECREF(seen); - Py_DECREF(map); return values; fail: + Py_XDECREF(copy); Py_XDECREF(seen); Py_XDECREF(values); - Py_DECREF(map); return NULL; } @@ -977,8 +928,6 @@ get_match_args(PyThreadState *tstate, PyObject *type) return NULL; } // TODO: PySequence_FAST - // TODO We should probably just check for string items here - // TODO: Allow duplicate items? Hm... if (PyTuple_CheckExact(ma) || ma == Py_None) { return ma; } @@ -3592,9 +3541,22 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_MAP): { - PyObject *target = TOP(); - // TODO: Just move the body of this function here: - int match = match_map(target); + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + goto error; + } + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); + Py_DECREF(abc); + if (!interp->map_abc) { + goto error; + } + } + int match = PyObject_IsInstance(TOP(), interp->map_abc); if (match < 0) { goto error; } @@ -3604,8 +3566,31 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_SEQ): { PyObject *target = TOP(); - // TODO: Just move the body of this function here: - int match = match_seq(target); + if (PyType_FastSubclass(Py_TYPE(target), + Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS) + || PyIter_Check(target) + || PyByteArray_Check(target)) + { + Py_INCREF(Py_False); + PUSH(Py_False); + DISPATCH(); + } + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp) { + goto error; + } + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + Py_DECREF(abc); + if (!interp->seq_abc) { + goto error; + } + } + int match = PyObject_IsInstance(target, interp->seq_abc); if (match < 0) { goto error; } From 23dc88b426522feb1c59c9bf4fbb3ebef479179b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 24 Jun 2020 18:13:44 -0700 Subject: [PATCH 096/218] Add typing.sealed --- Lib/test/test_typing.py | 12 ++++++++++++ Lib/typing.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index f429e883b59538..de8ed578d7386b 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -23,6 +23,7 @@ from typing import IO, TextIO, BinaryIO from typing import Pattern, Match from typing import Annotated, ForwardRef +from typing import sealed import abc import typing import weakref @@ -2302,6 +2303,17 @@ def test_final_unmodified(self): def func(x): ... self.assertIs(func, final(func)) + def test_sealed_unmodified(self): + class C: ... + self.assertIs(C, sealed(C)) + + def test_sealed_type(self): + def f(): ... + with self.assertRaises(TypeError): + sealed(f) + with self.assertRaises(TypeError): + sealed(42) + class CastTests(BaseTestCase): diff --git a/Lib/typing.py b/Lib/typing.py index f94996daebd6ed..5bd9444c860a82 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -109,6 +109,7 @@ 'NoReturn', 'overload', 'runtime_checkable', + 'sealed', 'Text', 'TYPE_CHECKING', ] @@ -1562,6 +1563,42 @@ class Other(Leaf): # Error reported by type checker return f +def sealed(cls): + """A decorator to indicate sealed classes. + + Use this decorator to indicate to type checkers that all subclasses of this + class must be defined in the current module. The type checker can then treat + the sealed base class as a union of all its known subclasses, allowing for + static exhaustiveness checks. For example: + + @sealed + class Parent: + ... + + class Child(Parent): + ... + + class X(Child): + ... + + class Y(Child): + ... + + class Z(Parent): + ... + + With this definition: + + - Child can be treated as Union[X, Y] + - Parent can be treated as Union[X, Y, Z] + + There is no runtime-checking of this property. + """ + if not isinstance(cls, type): + raise TypeError("only classes can be @sealed") + return cls + + # Some unconstrained type variables. These are used by the container types. # (These are not for export.) T = TypeVar('T') # Any type. From 6fa3eb3462f4bbb708e3c1aff8791550d6dbd3ae Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 25 Jun 2020 08:24:00 -0700 Subject: [PATCH 097/218] Allow unparenthesized tuples as targets --- Grammar/python.gram | 2 +- Parser/parser.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index baa29d9bcd2aaa..120df193150d0f 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -197,7 +197,7 @@ except_block[excepthandler_ty]: finally_block[asdl_seq*]: 'finally' ':' a=block { a } match_stmt[stmt_ty]: - | "match" target=expression ':' NEWLINE INDENT cases=case_block+ DEDENT { + | "match" target=star_expressions ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { diff --git a/Parser/parser.c b/Parser/parser.c index 0985d1929c544e..424b3a736a24bf 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -4783,7 +4783,7 @@ finally_block_rule(Parser *p) return _res; } -// match_stmt: "match" expression ':' NEWLINE INDENT case_block+ DEDENT +// match_stmt: "match" star_expressions ':' NEWLINE INDENT case_block+ DEDENT static stmt_ty match_stmt_rule(Parser *p) { @@ -4803,12 +4803,12 @@ match_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // "match" expression ':' NEWLINE INDENT case_block+ DEDENT + { // "match" star_expressions ':' NEWLINE INDENT case_block+ DEDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); expr_ty _keyword; Token * _literal; asdl_seq * cases; @@ -4819,7 +4819,7 @@ match_stmt_rule(Parser *p) if ( (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' && - (target = expression_rule(p)) // expression + (target = star_expressions_rule(p)) // star_expressions && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -4832,7 +4832,7 @@ match_stmt_rule(Parser *p) (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) { - D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4852,7 +4852,7 @@ match_stmt_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" expression ':' NEWLINE INDENT case_block+ DEDENT")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); } _res = NULL; done: From 67146a38b34985b8a8ca8b603186ea34ca59cad6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 25 Jun 2020 08:24:30 -0700 Subject: [PATCH 098/218] Fix handling of copied mappings --- Python/ceval.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 767e96e2b29486..416ade0e33da49 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -848,24 +848,8 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: static PyObject* -match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) +match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject *copy) { - PyObject *copy = NULL; - if (pop) { - if (PyDict_CheckExact(map)) { - copy = PyDict_Copy(map); - if (!copy) { - return NULL; - } - } - else { - copy = PyDict_New(); - if (!copy || PyDict_Update(copy, map)) { - Py_XDECREF(copy); - return NULL; - } - } - } assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); PyObject *seen = NULL; @@ -900,18 +884,16 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, int pop) } Py_INCREF(value); PyTuple_SET_ITEM(values, i, value); - if (pop && PyDict_DelItem(map, key)) { + if (copy && PyDict_DelItem(copy, key)) { if (!PyErr_ExceptionMatches(PyExc_KeyError)) { goto fail; } PyErr_Clear(); } } - Py_XDECREF(copy); Py_DECREF(seen); return values; fail: - Py_XDECREF(copy); Py_XDECREF(seen); Py_XDECREF(values); return NULL; @@ -3601,11 +3583,28 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_MAP_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); - PyObject *values = match_map_items(tstate, target, keys, oparg); + PyObject *copy = NULL; + if (oparg) { + if (PyDict_CheckExact(target)) { + copy = PyDict_Copy(target); + if (!copy) { + return NULL; + } + } + else { + copy = PyDict_New(); + if (!copy || PyDict_Update(copy, target)) { + Py_XDECREF(copy); + return NULL; + } + } + } + PyObject *values = match_map_items(tstate, target, keys, copy); if (!values) { if (_PyErr_Occurred(tstate)) { goto error; } + Py_XDECREF(copy); Py_INCREF(Py_None); SET_TOP(Py_None); Py_DECREF(keys); @@ -3615,6 +3614,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } SET_TOP(values); Py_DECREF(keys); + if (oparg) { + SET_SECOND(copy); + Py_DECREF(target); + } Py_INCREF(Py_True); PUSH(Py_True); DISPATCH(); From d7bb7ee167beb9dc5c59983347f21ae00aab673b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 25 Jun 2020 08:24:39 -0700 Subject: [PATCH 099/218] Add tests --- Lib/test/test_patma.py | 128 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 124 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index ce6a318172d0f0..d1f57b17f2a8d5 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,4 +1,5 @@ import ast +import collections import types import typing import unittest @@ -1646,8 +1647,7 @@ def test_patma_118(self) -> None: self.assertEqual(y, 1) def test_patma_119(self) -> None: - from collections import defaultdict - x = defaultdict(int) + x = collections.defaultdict(int) match x: case {0: 0}: y = 0 @@ -1657,8 +1657,7 @@ def test_patma_119(self) -> None: self.assertEqual(y, 1) def test_patma_120(self) -> None: - from collections import defaultdict - x = defaultdict(int) + x = collections.defaultdict(int) match x: case {0: 0}: y = 0 @@ -1668,6 +1667,127 @@ def test_patma_120(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {}) + def test_patma_121(self) -> None: + match (): + case (): + x = 0 + self.assertEqual(x, 0) + + def test_patma_122(self) -> None: + match (0, 1, 2): + case (*x,): + y = 0 + self.assertEqual(x, [0, 1, 2]) + self.assertEqual(y, 0) + + def test_patma_123(self) -> None: + match (0, 1, 2): + case 0, *x: + y = 0 + self.assertEqual(x, [1, 2]) + self.assertEqual(y, 0) + + def test_patma_124(self) -> None: + match (0, 1, 2): + case (0, 1, *x,): + y = 0 + self.assertEqual(x, [2]) + self.assertEqual(y, 0) + + def test_patma_125(self) -> None: + match (0, 1, 2): + case 0, 1, 2, *x: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_patma_126(self) -> None: + match (0, 1, 2): + case *x, 2,: + y = 0 + self.assertEqual(x, [0, 1]) + self.assertEqual(y, 0) + + def test_patma_127(self) -> None: + match (0, 1, 2): + case (*x, 1, 2): + y = 0 + self.assertEqual(x, [0]) + self.assertEqual(y, 0) + + def test_patma_128(self) -> None: + match (0, 1, 2): + case *x, 0, 1, 2,: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_patma_129(self) -> None: + match (0, 1, 2): + case (0, *x, 2): + y = 0 + self.assertEqual(x, [1]) + self.assertEqual(y, 0) + + def test_patma_130(self) -> None: + match (0, 1, 2): + case 0, 1, *x, 2,: + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_patma_131(self) -> None: + match (0, 1, 2): + case (0, *x, 1, 2): + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + + def test_patma_132(self) -> None: + match (0, 1, 2): + case *x,: + y = 0 + self.assertEqual(x, [0, 1, 2]) + self.assertEqual(y, 0) + + def test_patma_133(self) -> None: + x = collections.defaultdict(int, {0: 1}) + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) + + def test_patma_134(self) -> None: + x = collections.defaultdict(int, {0: 1}) + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {**z}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) + self.assertEqual(z, {0: 1}) + + def test_patma_135(self) -> None: + x = collections.defaultdict(int, {0: 1}) + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {0: _, **z}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) + self.assertEqual(z, {}) + if __name__ == "__main__": # XXX: For quick test debugging... import dis From 574593c75994980ea23de4f8657f8aa4b567d94d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 25 Jun 2020 11:07:35 -0700 Subject: [PATCH 100/218] Fix match target parsing --- Grammar/python.gram | 7 +- Parser/parser.c | 772 ++++++++++++++++++++++++-------------------- 2 files changed, 435 insertions(+), 344 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 120df193150d0f..b6e7219147c5a2 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -196,8 +196,13 @@ except_block[excepthandler_ty]: | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } finally_block[asdl_seq*]: 'finally' ':' a=block { a } +match_expr[expr_ty]: + | value=star_named_expression ',' values=star_named_expressions? { + _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } + | named_expression + match_stmt[stmt_ty]: - | "match" target=star_expressions ':' NEWLINE INDENT cases=case_block+ DEDENT { + | "match" target=match_expr ':' NEWLINE INDENT cases=case_block+ DEDENT { _Py_Match(target, cases, EXTRA) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { diff --git a/Parser/parser.c b/Parser/parser.c index 424b3a736a24bf..08ac9e7fe4995e 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -104,343 +104,344 @@ static KeywordToken *reserved_keywords[] = { #define try_stmt_type 1035 #define except_block_type 1036 #define finally_block_type 1037 -#define match_stmt_type 1038 -#define case_block_type 1039 -#define guard_type 1040 -#define patterns_type 1041 -#define pattern_type 1042 -#define or_pattern_type 1043 -#define closed_pattern_type 1044 -#define name_pattern_type 1045 -#define literal_pattern_type 1046 -#define constant_pattern_type 1047 -#define group_pattern_type 1048 -#define sequence_pattern_type 1049 -#define mapping_pattern_type 1050 -#define class_pattern_type 1051 -#define signed_number_type 1052 -#define attr_type 1053 // Left-recursive -#define name_or_attr_type 1054 // Left-recursive -#define values_pattern_type 1055 -#define items_pattern_type 1056 -#define keyword_pattern_type 1057 -#define error_argument_pattern_type 1058 -#define error_star_type 1059 -#define value_pattern_type 1060 -#define key_value_pattern_type 1061 -#define return_stmt_type 1062 -#define raise_stmt_type 1063 -#define function_def_type 1064 -#define function_def_raw_type 1065 -#define func_type_comment_type 1066 -#define params_type 1067 -#define parameters_type 1068 -#define slash_no_default_type 1069 -#define slash_with_default_type 1070 -#define star_etc_type 1071 -#define kwds_type 1072 -#define param_no_default_type 1073 -#define param_with_default_type 1074 -#define param_maybe_default_type 1075 -#define param_type 1076 -#define annotation_type 1077 -#define default_type 1078 -#define decorators_type 1079 -#define class_def_type 1080 -#define class_def_raw_type 1081 -#define block_type 1082 -#define expressions_list_type 1083 -#define star_expressions_type 1084 -#define star_expression_type 1085 -#define star_named_expressions_type 1086 -#define star_named_expression_type 1087 -#define named_expression_type 1088 -#define annotated_rhs_type 1089 -#define expressions_type 1090 -#define expression_type 1091 -#define lambdef_type 1092 -#define lambda_params_type 1093 -#define lambda_parameters_type 1094 -#define lambda_slash_no_default_type 1095 -#define lambda_slash_with_default_type 1096 -#define lambda_star_etc_type 1097 -#define lambda_kwds_type 1098 -#define lambda_param_no_default_type 1099 -#define lambda_param_with_default_type 1100 -#define lambda_param_maybe_default_type 1101 -#define lambda_param_type 1102 -#define disjunction_type 1103 -#define conjunction_type 1104 -#define inversion_type 1105 -#define comparison_type 1106 -#define compare_op_bitwise_or_pair_type 1107 -#define eq_bitwise_or_type 1108 -#define noteq_bitwise_or_type 1109 -#define lte_bitwise_or_type 1110 -#define lt_bitwise_or_type 1111 -#define gte_bitwise_or_type 1112 -#define gt_bitwise_or_type 1113 -#define notin_bitwise_or_type 1114 -#define in_bitwise_or_type 1115 -#define isnot_bitwise_or_type 1116 -#define is_bitwise_or_type 1117 -#define bitwise_or_type 1118 // Left-recursive -#define bitwise_xor_type 1119 // Left-recursive -#define bitwise_and_type 1120 // Left-recursive -#define shift_expr_type 1121 // Left-recursive -#define sum_type 1122 // Left-recursive -#define term_type 1123 // Left-recursive -#define factor_type 1124 -#define power_type 1125 -#define await_primary_type 1126 -#define primary_type 1127 // Left-recursive -#define slices_type 1128 -#define slice_type 1129 -#define atom_type 1130 -#define strings_type 1131 -#define list_type 1132 -#define listcomp_type 1133 -#define tuple_type 1134 -#define group_type 1135 -#define genexp_type 1136 -#define set_type 1137 -#define setcomp_type 1138 -#define dict_type 1139 -#define dictcomp_type 1140 -#define double_starred_kvpairs_type 1141 -#define double_starred_kvpair_type 1142 -#define kvpair_type 1143 -#define for_if_clauses_type 1144 -#define for_if_clause_type 1145 -#define yield_expr_type 1146 -#define arguments_type 1147 -#define args_type 1148 -#define kwargs_type 1149 -#define starred_expression_type 1150 -#define kwarg_or_starred_type 1151 -#define kwarg_or_double_starred_type 1152 -#define star_targets_type 1153 -#define star_targets_seq_type 1154 -#define star_target_type 1155 -#define star_atom_type 1156 -#define single_target_type 1157 -#define single_subscript_attribute_target_type 1158 -#define del_targets_type 1159 -#define del_target_type 1160 -#define del_t_atom_type 1161 -#define targets_type 1162 -#define target_type 1163 -#define t_primary_type 1164 // Left-recursive -#define t_lookahead_type 1165 -#define t_atom_type 1166 -#define incorrect_arguments_type 1167 -#define invalid_kwarg_type 1168 -#define invalid_named_expression_type 1169 -#define invalid_assignment_type 1170 -#define invalid_del_stmt_type 1171 -#define invalid_block_type 1172 -#define invalid_comprehension_type 1173 -#define invalid_dict_comprehension_type 1174 -#define invalid_parameters_type 1175 -#define invalid_lambda_parameters_type 1176 -#define invalid_star_etc_type 1177 -#define invalid_lambda_star_etc_type 1178 -#define invalid_double_type_comments_type 1179 -#define invalid_with_item_type 1180 -#define invalid_for_target_type 1181 -#define invalid_group_type 1182 -#define invalid_import_from_targets_type 1183 -#define _loop0_1_type 1184 -#define _loop0_2_type 1185 -#define _loop0_4_type 1186 -#define _gather_3_type 1187 -#define _loop0_6_type 1188 -#define _gather_5_type 1189 -#define _loop0_8_type 1190 -#define _gather_7_type 1191 -#define _loop0_10_type 1192 -#define _gather_9_type 1193 -#define _loop1_11_type 1194 -#define _loop0_13_type 1195 -#define _gather_12_type 1196 -#define _tmp_14_type 1197 -#define _tmp_15_type 1198 -#define _tmp_16_type 1199 -#define _tmp_17_type 1200 -#define _tmp_18_type 1201 -#define _tmp_19_type 1202 -#define _tmp_20_type 1203 -#define _tmp_21_type 1204 -#define _loop1_22_type 1205 -#define _tmp_23_type 1206 -#define _tmp_24_type 1207 -#define _loop0_26_type 1208 -#define _gather_25_type 1209 -#define _loop0_28_type 1210 -#define _gather_27_type 1211 -#define _tmp_29_type 1212 -#define _tmp_30_type 1213 -#define _loop0_31_type 1214 -#define _loop1_32_type 1215 -#define _loop0_34_type 1216 -#define _gather_33_type 1217 -#define _tmp_35_type 1218 -#define _loop0_37_type 1219 -#define _gather_36_type 1220 -#define _tmp_38_type 1221 -#define _loop0_40_type 1222 -#define _gather_39_type 1223 -#define _loop0_42_type 1224 -#define _gather_41_type 1225 -#define _loop0_44_type 1226 -#define _gather_43_type 1227 -#define _loop0_46_type 1228 -#define _gather_45_type 1229 -#define _tmp_47_type 1230 -#define _loop1_48_type 1231 -#define _tmp_49_type 1232 -#define _loop1_50_type 1233 -#define _loop0_52_type 1234 -#define _gather_51_type 1235 -#define _tmp_53_type 1236 -#define _tmp_54_type 1237 -#define _tmp_55_type 1238 -#define _tmp_56_type 1239 -#define _loop0_58_type 1240 -#define _gather_57_type 1241 -#define _loop0_60_type 1242 -#define _gather_59_type 1243 -#define _loop0_62_type 1244 -#define _gather_61_type 1245 -#define _loop0_64_type 1246 -#define _gather_63_type 1247 -#define _tmp_65_type 1248 -#define _loop0_67_type 1249 -#define _gather_66_type 1250 -#define _tmp_68_type 1251 -#define _tmp_69_type 1252 -#define _tmp_70_type 1253 -#define _loop0_72_type 1254 -#define _gather_71_type 1255 -#define _loop0_74_type 1256 -#define _gather_73_type 1257 -#define _tmp_75_type 1258 -#define _tmp_76_type 1259 -#define _tmp_77_type 1260 -#define _tmp_78_type 1261 -#define _tmp_79_type 1262 -#define _tmp_80_type 1263 -#define _loop0_81_type 1264 -#define _loop0_82_type 1265 -#define _loop0_83_type 1266 -#define _loop1_84_type 1267 -#define _loop0_85_type 1268 -#define _loop1_86_type 1269 -#define _loop1_87_type 1270 -#define _loop1_88_type 1271 -#define _loop0_89_type 1272 -#define _loop1_90_type 1273 -#define _loop0_91_type 1274 -#define _loop1_92_type 1275 -#define _loop0_93_type 1276 -#define _loop1_94_type 1277 -#define _loop1_95_type 1278 -#define _tmp_96_type 1279 -#define _loop0_98_type 1280 -#define _gather_97_type 1281 -#define _loop1_99_type 1282 -#define _loop0_101_type 1283 -#define _gather_100_type 1284 -#define _loop1_102_type 1285 -#define _loop0_103_type 1286 -#define _loop0_104_type 1287 -#define _loop0_105_type 1288 -#define _loop1_106_type 1289 -#define _loop0_107_type 1290 -#define _loop1_108_type 1291 -#define _loop1_109_type 1292 -#define _loop1_110_type 1293 -#define _loop0_111_type 1294 -#define _loop1_112_type 1295 -#define _loop0_113_type 1296 -#define _loop1_114_type 1297 -#define _loop0_115_type 1298 -#define _loop1_116_type 1299 -#define _loop1_117_type 1300 -#define _loop1_118_type 1301 -#define _loop1_119_type 1302 -#define _tmp_120_type 1303 -#define _loop0_122_type 1304 -#define _gather_121_type 1305 -#define _tmp_123_type 1306 -#define _tmp_124_type 1307 -#define _tmp_125_type 1308 -#define _tmp_126_type 1309 -#define _loop1_127_type 1310 -#define _tmp_128_type 1311 -#define _tmp_129_type 1312 -#define _loop0_131_type 1313 -#define _gather_130_type 1314 -#define _loop1_132_type 1315 -#define _loop0_133_type 1316 -#define _loop0_134_type 1317 -#define _tmp_135_type 1318 -#define _tmp_136_type 1319 -#define _loop0_138_type 1320 -#define _gather_137_type 1321 -#define _loop0_140_type 1322 -#define _gather_139_type 1323 -#define _loop0_142_type 1324 -#define _gather_141_type 1325 -#define _loop0_144_type 1326 -#define _gather_143_type 1327 -#define _loop0_145_type 1328 -#define _loop0_147_type 1329 -#define _gather_146_type 1330 -#define _tmp_148_type 1331 -#define _loop0_150_type 1332 -#define _gather_149_type 1333 -#define _loop0_152_type 1334 -#define _gather_151_type 1335 -#define _tmp_153_type 1336 -#define _loop0_154_type 1337 -#define _tmp_155_type 1338 -#define _loop0_156_type 1339 -#define _loop0_157_type 1340 -#define _tmp_158_type 1341 -#define _tmp_159_type 1342 -#define _loop0_160_type 1343 -#define _tmp_161_type 1344 -#define _loop0_162_type 1345 -#define _tmp_163_type 1346 -#define _tmp_164_type 1347 -#define _tmp_165_type 1348 -#define _tmp_166_type 1349 -#define _tmp_167_type 1350 -#define _tmp_168_type 1351 -#define _loop0_170_type 1352 -#define _gather_169_type 1353 -#define _loop0_172_type 1354 -#define _gather_171_type 1355 -#define _loop0_174_type 1356 -#define _gather_173_type 1357 -#define _loop0_176_type 1358 -#define _gather_175_type 1359 -#define _tmp_177_type 1360 -#define _tmp_178_type 1361 -#define _tmp_179_type 1362 -#define _tmp_180_type 1363 -#define _tmp_181_type 1364 -#define _tmp_182_type 1365 -#define _tmp_183_type 1366 -#define _tmp_184_type 1367 -#define _tmp_185_type 1368 -#define _tmp_186_type 1369 -#define _loop1_187_type 1370 -#define _loop1_188_type 1371 -#define _tmp_189_type 1372 -#define _tmp_190_type 1373 -#define _tmp_191_type 1374 +#define match_expr_type 1038 +#define match_stmt_type 1039 +#define case_block_type 1040 +#define guard_type 1041 +#define patterns_type 1042 +#define pattern_type 1043 +#define or_pattern_type 1044 +#define closed_pattern_type 1045 +#define name_pattern_type 1046 +#define literal_pattern_type 1047 +#define constant_pattern_type 1048 +#define group_pattern_type 1049 +#define sequence_pattern_type 1050 +#define mapping_pattern_type 1051 +#define class_pattern_type 1052 +#define signed_number_type 1053 +#define attr_type 1054 // Left-recursive +#define name_or_attr_type 1055 // Left-recursive +#define values_pattern_type 1056 +#define items_pattern_type 1057 +#define keyword_pattern_type 1058 +#define error_argument_pattern_type 1059 +#define error_star_type 1060 +#define value_pattern_type 1061 +#define key_value_pattern_type 1062 +#define return_stmt_type 1063 +#define raise_stmt_type 1064 +#define function_def_type 1065 +#define function_def_raw_type 1066 +#define func_type_comment_type 1067 +#define params_type 1068 +#define parameters_type 1069 +#define slash_no_default_type 1070 +#define slash_with_default_type 1071 +#define star_etc_type 1072 +#define kwds_type 1073 +#define param_no_default_type 1074 +#define param_with_default_type 1075 +#define param_maybe_default_type 1076 +#define param_type 1077 +#define annotation_type 1078 +#define default_type 1079 +#define decorators_type 1080 +#define class_def_type 1081 +#define class_def_raw_type 1082 +#define block_type 1083 +#define expressions_list_type 1084 +#define star_expressions_type 1085 +#define star_expression_type 1086 +#define star_named_expressions_type 1087 +#define star_named_expression_type 1088 +#define named_expression_type 1089 +#define annotated_rhs_type 1090 +#define expressions_type 1091 +#define expression_type 1092 +#define lambdef_type 1093 +#define lambda_params_type 1094 +#define lambda_parameters_type 1095 +#define lambda_slash_no_default_type 1096 +#define lambda_slash_with_default_type 1097 +#define lambda_star_etc_type 1098 +#define lambda_kwds_type 1099 +#define lambda_param_no_default_type 1100 +#define lambda_param_with_default_type 1101 +#define lambda_param_maybe_default_type 1102 +#define lambda_param_type 1103 +#define disjunction_type 1104 +#define conjunction_type 1105 +#define inversion_type 1106 +#define comparison_type 1107 +#define compare_op_bitwise_or_pair_type 1108 +#define eq_bitwise_or_type 1109 +#define noteq_bitwise_or_type 1110 +#define lte_bitwise_or_type 1111 +#define lt_bitwise_or_type 1112 +#define gte_bitwise_or_type 1113 +#define gt_bitwise_or_type 1114 +#define notin_bitwise_or_type 1115 +#define in_bitwise_or_type 1116 +#define isnot_bitwise_or_type 1117 +#define is_bitwise_or_type 1118 +#define bitwise_or_type 1119 // Left-recursive +#define bitwise_xor_type 1120 // Left-recursive +#define bitwise_and_type 1121 // Left-recursive +#define shift_expr_type 1122 // Left-recursive +#define sum_type 1123 // Left-recursive +#define term_type 1124 // Left-recursive +#define factor_type 1125 +#define power_type 1126 +#define await_primary_type 1127 +#define primary_type 1128 // Left-recursive +#define slices_type 1129 +#define slice_type 1130 +#define atom_type 1131 +#define strings_type 1132 +#define list_type 1133 +#define listcomp_type 1134 +#define tuple_type 1135 +#define group_type 1136 +#define genexp_type 1137 +#define set_type 1138 +#define setcomp_type 1139 +#define dict_type 1140 +#define dictcomp_type 1141 +#define double_starred_kvpairs_type 1142 +#define double_starred_kvpair_type 1143 +#define kvpair_type 1144 +#define for_if_clauses_type 1145 +#define for_if_clause_type 1146 +#define yield_expr_type 1147 +#define arguments_type 1148 +#define args_type 1149 +#define kwargs_type 1150 +#define starred_expression_type 1151 +#define kwarg_or_starred_type 1152 +#define kwarg_or_double_starred_type 1153 +#define star_targets_type 1154 +#define star_targets_seq_type 1155 +#define star_target_type 1156 +#define star_atom_type 1157 +#define single_target_type 1158 +#define single_subscript_attribute_target_type 1159 +#define del_targets_type 1160 +#define del_target_type 1161 +#define del_t_atom_type 1162 +#define targets_type 1163 +#define target_type 1164 +#define t_primary_type 1165 // Left-recursive +#define t_lookahead_type 1166 +#define t_atom_type 1167 +#define incorrect_arguments_type 1168 +#define invalid_kwarg_type 1169 +#define invalid_named_expression_type 1170 +#define invalid_assignment_type 1171 +#define invalid_del_stmt_type 1172 +#define invalid_block_type 1173 +#define invalid_comprehension_type 1174 +#define invalid_dict_comprehension_type 1175 +#define invalid_parameters_type 1176 +#define invalid_lambda_parameters_type 1177 +#define invalid_star_etc_type 1178 +#define invalid_lambda_star_etc_type 1179 +#define invalid_double_type_comments_type 1180 +#define invalid_with_item_type 1181 +#define invalid_for_target_type 1182 +#define invalid_group_type 1183 +#define invalid_import_from_targets_type 1184 +#define _loop0_1_type 1185 +#define _loop0_2_type 1186 +#define _loop0_4_type 1187 +#define _gather_3_type 1188 +#define _loop0_6_type 1189 +#define _gather_5_type 1190 +#define _loop0_8_type 1191 +#define _gather_7_type 1192 +#define _loop0_10_type 1193 +#define _gather_9_type 1194 +#define _loop1_11_type 1195 +#define _loop0_13_type 1196 +#define _gather_12_type 1197 +#define _tmp_14_type 1198 +#define _tmp_15_type 1199 +#define _tmp_16_type 1200 +#define _tmp_17_type 1201 +#define _tmp_18_type 1202 +#define _tmp_19_type 1203 +#define _tmp_20_type 1204 +#define _tmp_21_type 1205 +#define _loop1_22_type 1206 +#define _tmp_23_type 1207 +#define _tmp_24_type 1208 +#define _loop0_26_type 1209 +#define _gather_25_type 1210 +#define _loop0_28_type 1211 +#define _gather_27_type 1212 +#define _tmp_29_type 1213 +#define _tmp_30_type 1214 +#define _loop0_31_type 1215 +#define _loop1_32_type 1216 +#define _loop0_34_type 1217 +#define _gather_33_type 1218 +#define _tmp_35_type 1219 +#define _loop0_37_type 1220 +#define _gather_36_type 1221 +#define _tmp_38_type 1222 +#define _loop0_40_type 1223 +#define _gather_39_type 1224 +#define _loop0_42_type 1225 +#define _gather_41_type 1226 +#define _loop0_44_type 1227 +#define _gather_43_type 1228 +#define _loop0_46_type 1229 +#define _gather_45_type 1230 +#define _tmp_47_type 1231 +#define _loop1_48_type 1232 +#define _tmp_49_type 1233 +#define _loop1_50_type 1234 +#define _loop0_52_type 1235 +#define _gather_51_type 1236 +#define _tmp_53_type 1237 +#define _tmp_54_type 1238 +#define _tmp_55_type 1239 +#define _tmp_56_type 1240 +#define _loop0_58_type 1241 +#define _gather_57_type 1242 +#define _loop0_60_type 1243 +#define _gather_59_type 1244 +#define _loop0_62_type 1245 +#define _gather_61_type 1246 +#define _loop0_64_type 1247 +#define _gather_63_type 1248 +#define _tmp_65_type 1249 +#define _loop0_67_type 1250 +#define _gather_66_type 1251 +#define _tmp_68_type 1252 +#define _tmp_69_type 1253 +#define _tmp_70_type 1254 +#define _loop0_72_type 1255 +#define _gather_71_type 1256 +#define _loop0_74_type 1257 +#define _gather_73_type 1258 +#define _tmp_75_type 1259 +#define _tmp_76_type 1260 +#define _tmp_77_type 1261 +#define _tmp_78_type 1262 +#define _tmp_79_type 1263 +#define _tmp_80_type 1264 +#define _loop0_81_type 1265 +#define _loop0_82_type 1266 +#define _loop0_83_type 1267 +#define _loop1_84_type 1268 +#define _loop0_85_type 1269 +#define _loop1_86_type 1270 +#define _loop1_87_type 1271 +#define _loop1_88_type 1272 +#define _loop0_89_type 1273 +#define _loop1_90_type 1274 +#define _loop0_91_type 1275 +#define _loop1_92_type 1276 +#define _loop0_93_type 1277 +#define _loop1_94_type 1278 +#define _loop1_95_type 1279 +#define _tmp_96_type 1280 +#define _loop0_98_type 1281 +#define _gather_97_type 1282 +#define _loop1_99_type 1283 +#define _loop0_101_type 1284 +#define _gather_100_type 1285 +#define _loop1_102_type 1286 +#define _loop0_103_type 1287 +#define _loop0_104_type 1288 +#define _loop0_105_type 1289 +#define _loop1_106_type 1290 +#define _loop0_107_type 1291 +#define _loop1_108_type 1292 +#define _loop1_109_type 1293 +#define _loop1_110_type 1294 +#define _loop0_111_type 1295 +#define _loop1_112_type 1296 +#define _loop0_113_type 1297 +#define _loop1_114_type 1298 +#define _loop0_115_type 1299 +#define _loop1_116_type 1300 +#define _loop1_117_type 1301 +#define _loop1_118_type 1302 +#define _loop1_119_type 1303 +#define _tmp_120_type 1304 +#define _loop0_122_type 1305 +#define _gather_121_type 1306 +#define _tmp_123_type 1307 +#define _tmp_124_type 1308 +#define _tmp_125_type 1309 +#define _tmp_126_type 1310 +#define _loop1_127_type 1311 +#define _tmp_128_type 1312 +#define _tmp_129_type 1313 +#define _loop0_131_type 1314 +#define _gather_130_type 1315 +#define _loop1_132_type 1316 +#define _loop0_133_type 1317 +#define _loop0_134_type 1318 +#define _tmp_135_type 1319 +#define _tmp_136_type 1320 +#define _loop0_138_type 1321 +#define _gather_137_type 1322 +#define _loop0_140_type 1323 +#define _gather_139_type 1324 +#define _loop0_142_type 1325 +#define _gather_141_type 1326 +#define _loop0_144_type 1327 +#define _gather_143_type 1328 +#define _loop0_145_type 1329 +#define _loop0_147_type 1330 +#define _gather_146_type 1331 +#define _tmp_148_type 1332 +#define _loop0_150_type 1333 +#define _gather_149_type 1334 +#define _loop0_152_type 1335 +#define _gather_151_type 1336 +#define _tmp_153_type 1337 +#define _loop0_154_type 1338 +#define _tmp_155_type 1339 +#define _loop0_156_type 1340 +#define _loop0_157_type 1341 +#define _tmp_158_type 1342 +#define _tmp_159_type 1343 +#define _loop0_160_type 1344 +#define _tmp_161_type 1345 +#define _loop0_162_type 1346 +#define _tmp_163_type 1347 +#define _tmp_164_type 1348 +#define _tmp_165_type 1349 +#define _tmp_166_type 1350 +#define _tmp_167_type 1351 +#define _tmp_168_type 1352 +#define _loop0_170_type 1353 +#define _gather_169_type 1354 +#define _loop0_172_type 1355 +#define _gather_171_type 1356 +#define _loop0_174_type 1357 +#define _gather_173_type 1358 +#define _loop0_176_type 1359 +#define _gather_175_type 1360 +#define _tmp_177_type 1361 +#define _tmp_178_type 1362 +#define _tmp_179_type 1363 +#define _tmp_180_type 1364 +#define _tmp_181_type 1365 +#define _tmp_182_type 1366 +#define _tmp_183_type 1367 +#define _tmp_184_type 1368 +#define _tmp_185_type 1369 +#define _tmp_186_type 1370 +#define _loop1_187_type 1371 +#define _loop1_188_type 1372 +#define _tmp_189_type 1373 +#define _tmp_190_type 1374 +#define _tmp_191_type 1375 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -480,6 +481,7 @@ static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); static asdl_seq* finally_block_rule(Parser *p); +static expr_ty match_expr_rule(Parser *p); static stmt_ty match_stmt_rule(Parser *p); static match_case_ty case_block_rule(Parser *p); static expr_ty guard_rule(Parser *p); @@ -4783,7 +4785,91 @@ finally_block_rule(Parser *p) return _res; } -// match_stmt: "match" star_expressions ':' NEWLINE INDENT case_block+ DEDENT +// match_expr: star_named_expression ',' star_named_expressions? | named_expression +static expr_ty +match_expr_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // star_named_expression ',' star_named_expressions? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> match_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + Token * _literal; + expr_ty value; + void *values; + if ( + (value = star_named_expression_rule(p)) // star_named_expression + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (values = star_named_expressions_rule(p), 1) // star_named_expressions? + ) + { + D(fprintf(stderr, "%*c+ match_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s match_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + } + { // named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> match_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + expr_ty named_expression_var; + if ( + (named_expression_var = named_expression_rule(p)) // named_expression + ) + { + D(fprintf(stderr, "%*c+ match_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + _res = named_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s match_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// match_stmt: "match" match_expr ':' NEWLINE INDENT case_block+ DEDENT static stmt_ty match_stmt_rule(Parser *p) { @@ -4803,12 +4889,12 @@ match_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // "match" star_expressions ':' NEWLINE INDENT case_block+ DEDENT + { // "match" match_expr ':' NEWLINE INDENT case_block+ DEDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); expr_ty _keyword; Token * _literal; asdl_seq * cases; @@ -4819,7 +4905,7 @@ match_stmt_rule(Parser *p) if ( (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' && - (target = star_expressions_rule(p)) // star_expressions + (target = match_expr_rule(p)) // match_expr && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -4832,7 +4918,7 @@ match_stmt_rule(Parser *p) (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) { - D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4852,7 +4938,7 @@ match_stmt_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" star_expressions ':' NEWLINE INDENT case_block+ DEDENT")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); } _res = NULL; done: From 340d66feb86d0f0ad40d6aba116e5a8206e3fd16 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 26 Jun 2020 09:08:45 -0700 Subject: [PATCH 101/218] Add more mapping tests and a performance utility --- Lib/test/test_patma.py | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index d1f57b17f2a8d5..f1374b1da9d297 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1788,11 +1788,53 @@ def test_patma_135(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {}) + def test_patma_136(self) -> None: + x = {0: 1} + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) -if __name__ == "__main__": # XXX: For quick test debugging... - import dis + def test_patma_137(self) -> None: + x = {0: 1} + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {**z}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) + self.assertEqual(z, {0: 1}) + + def test_patma_138(self) -> None: + x = {0: 1} + match x: + case {1: 0}: + y = 0 + case {0: 0}: + y = 0 + case {0: _, **z}: + y = 1 + self.assertEqual(x, {0: 1}) + self.assertEqual(y, 1) + self.assertEqual(z, {}) - match_cases = [ - MatchCase("([0, 1]) or {'XXX': (1 or (z := 2))} or (0, q, [[[{}]]])", "pass") - ] - dis.dis(TestAST.compile_match("", "x", match_cases, "")) + def run_perf(self): + # ./python -m pyperf timeit -s 'from test.test_patma import TestMatch; t = TestMatch()' 't.run_perf()' + attrs = vars(type(self)).items() + tests = [attr for name, attr in attrs if name.startswith("test_")] + assert_equal = self.assertEqual + try: + self.assertEqual = lambda *_: None + for _ in range(1 << 10): + for test in tests: + test(self) + finally: + self.assertEqual = assert_equal From ca58086a17a41ae94b1a9a8260fe385c8ad20714 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 27 Jun 2020 15:41:16 -0700 Subject: [PATCH 102/218] More cleanup --- Doc/library/dis.rst | 35 +++++++++++++++------------- Include/opcode.h | 8 +++---- Lib/importlib/_bootstrap_external.py | 4 ++-- Lib/opcode.py | 9 +++---- Python/ast_opt.c | 4 ---- Python/ceval.c | 13 +++++++---- Python/compile.c | 13 +++++------ Python/importlib_external.h | 2 +- Python/opcode_targets.h | 16 ++++++------- Python/peephole.c | 4 ++++ 10 files changed, 57 insertions(+), 51 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index dabfbab8fda89f..777ec49e142baf 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -753,21 +753,7 @@ iterations of the loop. .. opcode:: GET_LEN - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_MAP - - TODO - - .. versionadded:: 3.10 - - -.. opcode:: MATCH_SEQ - - TODO + Pushes ``len(TOS)`` onto the stack. .. versionadded:: 3.10 @@ -1210,13 +1196,30 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: MATCH (count) +.. opcode:: MATCH_CLS (count) TODO .. versionadded:: 3.10 +.. opcode:: MATCH_MAP (delta) + + If TOS is not a subclass of :class:`collections.abc.Mapping`, increment the + bytecode counter by *delta*. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQ (delta) + + If TOS is a subclass of :class:`string`/:class:`bytes`/:class:`bytearray`, is + an :term:`iterator`, or is not a subclass of + :class:`collections.abc.Sequence`, increment the bytecode counter by *delta*. + + .. versionadded:: 3.10 + + .. opcode:: MATCH_MAP_KEYS (copy) TODO diff --git a/Include/opcode.h b/Include/opcode.h index 2ed13d455ccc70..cd6158ea0e11a0 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -31,8 +31,6 @@ extern "C" { #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 #define GET_LEN 30 -#define MATCH_MAP 31 -#define MATCH_SEQ 32 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -99,8 +97,6 @@ extern "C" { #define LOAD_GLOBAL 116 #define IS_OP 117 #define CONTAINS_OP 118 -#define MATCH 119 -#define MATCH_MAP_KEYS 120 #define JUMP_IF_NOT_EXC_MATCH 121 #define SETUP_FINALLY 122 #define LOAD_FAST 124 @@ -122,6 +118,10 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 +#define MATCH_CLS 149 +#define MATCH_MAP_KEYS 150 +#define MATCH_MAP 151 +#define MATCH_SEQ 152 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index a4fe050512f5ca..3f01712bd665d8 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3462 (add structural pattern matching) +# Python 3.10a0 3463 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3462).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3463).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 1922a4a24af61f..b19be82e14b526 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -82,8 +82,6 @@ def jabs_op(name, op): def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) def_op('GET_LEN', 30) -def_op('MATCH_MAP', 31) -def_op('MATCH_SEQ', 32) def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) @@ -160,8 +158,7 @@ def jabs_op(name, op): name_op('LOAD_GLOBAL', 116) # Index in name list def_op('IS_OP', 117) def_op('CONTAINS_OP', 118) -def_op('MATCH', 119) -def_op('MATCH_MAP_KEYS', 120) + jabs_op('JUMP_IF_NOT_EXC_MATCH', 121) jrel_op('SETUP_FINALLY', 122) # Distance to target address @@ -196,6 +193,10 @@ def jabs_op(name, op): def_op('MAP_ADD', 147) def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) +def_op('MATCH_CLS', 149) +def_op('MATCH_MAP_KEYS', 150) +jrel_op('MATCH_MAP', 151) +jrel_op('MATCH_SEQ', 152) jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index bee3dc3919b4c1..265d80aca0f529 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -715,8 +715,6 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case Match_kind: CALL(astfold_expr, expr_ty, node_->v.Match.target); CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); - // TODO: Mark unreachable cases for removal? Maybe pattern == NULL? - // TODO: We can even optimize patterns across cases... break; default: break; @@ -797,7 +795,6 @@ static int astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { // Don't blindly optimize the pattern as an expr; it plays by its own rules! - // TODO: Build out this pattern optimizer. switch (node_->kind) { case Attribute_kind: return 1; @@ -805,7 +802,6 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) CALL(astfold_pattern_complex, expr_ty, node_); return 1; case BoolOp_kind: - // TODO: Quite a bit of potential here. case Call_kind: case Constant_kind: case Dict_kind: diff --git a/Python/ceval.c b/Python/ceval.c index 416ade0e33da49..74a572d5ea855d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3506,7 +3506,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(MATCH): { + case TARGET(MATCH_CLS): { PyObject *names = POP(); PyObject *type = TOP(); PyObject *target = SECOND(); @@ -3542,7 +3542,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - PUSH(PyBool_FromLong(match)); + if (!match) { + JUMPBY(oparg); + } DISPATCH(); } @@ -3553,8 +3555,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) || PyIter_Check(target) || PyByteArray_Check(target)) { - Py_INCREF(Py_False); - PUSH(Py_False); + JUMPBY(oparg); DISPATCH(); } PyInterpreterState *interp = PyInterpreterState_Get(); @@ -3576,7 +3577,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - PUSH(PyBool_FromLong(match)); + if (!match) { + JUMPBY(oparg); + } DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index 5c4649d17ad97c..333f9ab868bd21 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1103,13 +1103,14 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; - case MATCH: + case MATCH_CLS: return -1; case MATCH_MAP_KEYS: case GET_LEN: + return 1; case MATCH_MAP: case MATCH_SEQ: - return 1; + return 0; default: return PY_INVALID_STACK_EFFECT; } @@ -2786,7 +2787,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* PyTuple_SET_ITEM(kwnames, i, name); } ADDOP_LOAD_CONST_NEW(c, kwnames); - ADDOP_I(c, MATCH, nargs + nkwargs); + ADDOP_I(c, MATCH_CLS, nargs + nkwargs); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); @@ -2847,8 +2848,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP(c, MATCH_MAP); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JREL(c, MATCH_MAP, block); if (size - star) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); @@ -2996,8 +2996,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, MATCH_SEQ); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JREL(c, MATCH_SEQ, block); if (star >= 0) { if (size) { ADDOP(c, GET_LEN); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 8b838f587516b9..4b3fb946d4bb31 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,134,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,135,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index ca2af205f3f261..6c15c9d771f370 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -30,8 +30,8 @@ static void *opcode_targets[256] = { &&TARGET_INPLACE_FLOOR_DIVIDE, &&TARGET_INPLACE_TRUE_DIVIDE, &&TARGET_GET_LEN, - &&TARGET_MATCH_MAP, - &&TARGET_MATCH_SEQ, + &&_unknown_opcode, + &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -118,8 +118,8 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_GLOBAL, &&TARGET_IS_OP, &&TARGET_CONTAINS_OP, - &&TARGET_MATCH, - &&TARGET_MATCH_MAP_KEYS, + &&_unknown_opcode, + &&_unknown_opcode, &&TARGET_JUMP_IF_NOT_EXC_MATCH, &&TARGET_SETUP_FINALLY, &&_unknown_opcode, @@ -148,10 +148,10 @@ static void *opcode_targets[256] = { &&TARGET_SET_ADD, &&TARGET_MAP_ADD, &&TARGET_LOAD_CLASSDEREF, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_CLS, + &&TARGET_MATCH_MAP_KEYS, + &&TARGET_MATCH_MAP, + &&TARGET_MATCH_SEQ, &&_unknown_opcode, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, diff --git a/Python/peephole.c b/Python/peephole.c index fe67de42227b5b..8e95760c12a045 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -198,6 +198,8 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: + case MATCH_MAP: + case MATCH_SEQ: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -502,6 +504,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: + case MATCH_MAP: + case MATCH_SEQ: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From 3ec5802797df857a6a766fb48a647eb255c72d17 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 27 Jun 2020 23:36:39 -0700 Subject: [PATCH 103/218] Rough revision of __match__ protocol --- Include/object.h | 5 ++ Objects/bytearrayobject.c | 3 +- Objects/bytesobject.c | 3 +- Objects/dictobject.c | 3 +- Objects/floatobject.c | 3 +- Objects/listobject.c | 3 +- Objects/longobject.c | 3 +- Objects/setobject.c | 10 +-- Objects/tupleobject.c | 3 +- Objects/typeobject.c | 4 ++ Objects/unicodeobject.c | 3 +- Python/ceval.c | 136 ++++++++++++++++++-------------------- 12 files changed, 94 insertions(+), 85 deletions(-) diff --git a/Include/object.h b/Include/object.h index 537567040f9871..bf8df522af5e57 100644 --- a/Include/object.h +++ b/Include/object.h @@ -356,6 +356,11 @@ given type object has a specified feature. /* Type is abstract and cannot be instantiated */ #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20) +// This undocumented flag gives certain built-ins their unique pattern-matching +// behavior, which allows a single positional subpattern to match against the +// match proxy itself (rather than a mapped attribute on it): +#define _Py_TPFLAGS_SIMPLE_MATCH (1UL << 21) + /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) #define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25) diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 5a803be6277c88..82993dedf3e5c8 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2343,7 +2343,8 @@ PyTypeObject PyByteArray_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ &bytearray_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ bytearray_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index d39721428634fc..5d417f227b0cd0 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2908,7 +2908,8 @@ PyTypeObject PyBytes_Type = { 0, /* tp_setattro */ &bytes_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_BYTES_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_BYTES_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ bytes_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 55bf4aefbbeacf..a3471040198c15 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3439,7 +3439,8 @@ PyTypeObject PyDict_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ dictionary_doc, /* tp_doc */ dict_traverse, /* tp_traverse */ dict_tp_clear, /* tp_clear */ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 7ffd7eebe5a45c..e63f9d5e64a115 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1910,7 +1910,8 @@ PyTypeObject PyFloat_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ float_new__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/listobject.c b/Objects/listobject.c index 261a0fdfffae0d..d9d92a9b88184d 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -3046,7 +3046,8 @@ PyTypeObject PyList_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ list___init____doc__, /* tp_doc */ (traverseproc)list_traverse, /* tp_traverse */ (inquiry)_list_clear, /* tp_clear */ diff --git a/Objects/longobject.c b/Objects/longobject.c index d00a7a048ddce2..89194277da41e6 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5650,7 +5650,8 @@ PyTypeObject PyLong_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_LONG_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_LONG_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ long_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/setobject.c b/Objects/setobject.c index 76b1944db45588..549f09c87de0fd 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2109,8 +2109,10 @@ PyTypeObject PySet_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | + Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASETYPE | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ set_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_clear_internal, /* tp_clear */ @@ -2210,7 +2212,8 @@ PyTypeObject PyFrozenSet_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ frozenset_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_clear_internal, /* tp_clear */ @@ -2527,4 +2530,3 @@ static PyObject _dummy_struct = { _PyObject_EXTRA_INIT 2, &_PySetDummy_Type }; - diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 2ff4c48111fe0b..f96c64b41ee23a 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -878,7 +878,8 @@ PyTypeObject PyTuple_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ tuple_new__doc__, /* tp_doc */ (traverseproc)tupletraverse, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9fbca40daf5ddc..b13e9e82e53f95 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5180,6 +5180,10 @@ inherit_special(PyTypeObject *type, PyTypeObject *base) type->tp_flags |= Py_TPFLAGS_LIST_SUBCLASS; else if (PyType_IsSubtype(base, &PyDict_Type)) type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS; + + if (PyType_HasFeature(base, _Py_TPFLAGS_SIMPLE_MATCH)) { + type->tp_flags |= _Py_TPFLAGS_SIMPLE_MATCH; + } } static int diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 1433848c81f8e1..b646fdb81ffb7a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -15513,7 +15513,8 @@ PyTypeObject PyUnicode_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_UNICODE_SUBCLASS, /* tp_flags */ + Py_TPFLAGS_UNICODE_SUBCLASS | + _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Python/ceval.c b/Python/ceval.c index 74a572d5ea855d..1a97b12c2802ce 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -885,10 +885,10 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * Py_INCREF(value); PyTuple_SET_ITEM(values, i, value); if (copy && PyDict_DelItem(copy, key)) { - if (!PyErr_ExceptionMatches(PyExc_KeyError)) { + if (!_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { goto fail; } - PyErr_Clear(); + _PyErr_Clear(tstate); } } Py_DECREF(seen); @@ -902,33 +902,31 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * static PyObject * get_match_args(PyThreadState *tstate, PyObject *type) { - if (!PyObject_HasAttrString(type, "__match_args__")) { - Py_RETURN_NONE; - } - PyObject *ma = PyObject_GetAttrString(type, "__match_args__"); - if (!ma) { + PyObject *match_args = PyObject_GetAttrString(type, "__match_args__"); + if (!match_args) { + if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { + _PyErr_Clear(tstate); + } return NULL; } - // TODO: PySequence_FAST - if (PyTuple_CheckExact(ma) || ma == Py_None) { - return ma; - } - if (PyList_CheckExact(ma)) { - PyObject *tuple = PyList_AsTuple(ma); - Py_DECREF(ma); - return tuple; + if (PyList_CheckExact(match_args) || PyTuple_CheckExact(match_args)) { + return match_args; } _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ must be a list, tuple, or None (got %s)", - Py_TYPE(ma)->tp_name); - Py_DECREF(ma); + "__match_args__ must be a list or tuple (got %s)", + Py_TYPE(match_args)->tp_name); + Py_DECREF(match_args); return NULL; } static PyObject * do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *type, PyObject *target) { - // TODO: Break this up, and better error handling ("goto error;"): + // TODO: Break this up! + PyObject *match_args = NULL; + PyObject *args = NULL; + PyObject *attrs = NULL; + PyObject *seen = NULL; assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, @@ -954,66 +952,60 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); Py_ssize_t nargs = count - nkwargs; - PyObject *args; - PyObject *match_args = get_match_args(tstate, type); - if (!match_args) { - Py_DECREF(proxy); - return NULL; + match_args = get_match_args(tstate, type); + assert(!match_args || PyList_CheckExact(match_args) || PyTuple_CheckExact(match_args)); + if (!match_args && _PyErr_Occurred(tstate)) { + goto error; + } + if (!nargs) { + args = PyTuple_New(0); + if (!args) { + goto error; + } } - assert(PyTuple_CheckExact(match_args) || match_args == Py_None); - if (nargs) { - if (match_args == Py_None) { + else if (!match_args) { + if (PyType_HasFeature((PyTypeObject *)type, _Py_TPFLAGS_SIMPLE_MATCH)) { if (nargs > 1) { - Py_DECREF(match_args); - Py_DECREF(proxy); - // TODO: Add expected and actual counts: - _PyErr_SetString(tstate, PyExc_ImpossibleMatchError, - "too many positional matches in pattern"); - return NULL; + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + "too many positional matches in pattern (expected at most 1, got %d)", + nargs); + goto error; } - args = match_args; } else { - if (PyTuple_GET_SIZE(match_args) < nargs) { - // TODO: Combine with above: - Py_DECREF(match_args); - Py_DECREF(proxy); - // TODO: Add expected and actual counts: - _PyErr_SetString(tstate, PyExc_ImpossibleMatchError, - "too many positional matches in pattern"); - return NULL; - } - args = PyTuple_GetSlice(match_args, 0, nargs); + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + "too many positional matches in pattern (expected none, got %d)", + nargs); + goto error; } } else { - args = PyTuple_New(0); - } - if (!args) { - Py_DECREF(match_args); - Py_DECREF(proxy); - return NULL; + Py_ssize_t nmatch_args = PySequence_Fast_GET_SIZE(match_args); + if (nmatch_args < nargs) { + // TODO: Combine with above: + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + "too many positional matches in pattern (expected at most %d, got %d)", + nmatch_args, nargs); + return NULL; + } + args = PyList_CheckExact(match_args) ? PyList_GetSlice(match_args, 0, nargs) : PyTuple_GetSlice(match_args, 0, nargs); + if (!args) { + goto error; + } } - assert(PyTuple_CheckExact(args) || args == Py_None); - PyObject *attrs = PyTuple_New(count); + assert(!args || PyList_CheckExact(args) || PyTuple_CheckExact(args)); + attrs = PyTuple_New(count); if (!attrs) { - Py_DECREF(match_args); - Py_DECREF(proxy); - Py_DECREF(args); - return NULL; + goto error; } - PyObject *seen = PySet_New(NULL); + seen = PySet_New(NULL); if (!seen) { - Py_DECREF(match_args); - Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(attrs); - return NULL; + goto error; } PyObject *name; for (Py_ssize_t i = 0; i < count; i++) { if (i < nargs) { - if (args == Py_None) { + if (!args) { assert(!i); Py_INCREF(proxy); PyTuple_SET_ITEM(attrs, 0, proxy); @@ -1043,30 +1035,28 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty // TODO: Only clear AttributeError? _PyErr_Clear(tstate); // TODO: iterate manually (and check for strings) - if (match_args != Py_None && !PySequence_Contains(match_args, name)) { + if (match_args && !PySequence_Contains(match_args, name)) { _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "match proxy %R has no attribute %R", proxy, name); goto error; } - Py_DECREF(attrs); - attrs = Py_None; - Py_INCREF(attrs); + Py_SETREF(attrs, Py_None); break; } PyTuple_SET_ITEM(attrs, i, attr); } - Py_DECREF(match_args); Py_DECREF(proxy); - Py_DECREF(args); + Py_XDECREF(match_args); + Py_XDECREF(args); Py_DECREF(seen); return attrs; error: - Py_DECREF(match_args); Py_DECREF(proxy); - Py_DECREF(args); - Py_DECREF(seen); - Py_DECREF(attrs); + Py_XDECREF(match_args); + Py_XDECREF(args); + Py_XDECREF(seen); + Py_XDECREF(attrs); return NULL; } From 0d99af4e6ddc895f0ebb5b5c1b24e0482a399db0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 28 Jun 2020 12:19:49 -0700 Subject: [PATCH 104/218] Remove old AST tests and add "simple" match tests --- Lib/test/test_patma.py | 656 +++++++---------------------------------- 1 file changed, 111 insertions(+), 545 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index f1374b1da9d297..e998cede3b7370 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,549 +1,7 @@ -import ast import collections -import types -import typing import unittest -FILENAME = "" - - -class MatchCase(typing.NamedTuple): - pattern: str - body: str - guard: typing.Optional[str] = None - - -class TestAST(unittest.TestCase): - """Tests that predate parser support, and just execute ASTs instead. - - No tests for name loads/stores, since these need a patma parser to - disambiguate. - - Note that we use "or" for "|" here, since the parser gives us a BoolOp-Or, - not a BinOp-BitOr. - """ - - @staticmethod - def parse_stmts(stmts: str) -> typing.List[ast.stmt]: - return ast.parse(stmts, FILENAME, "exec").body - - @staticmethod - def parse_expr(expr: str) -> ast.expr: - return ast.parse(expr, FILENAME, "eval").body - - @classmethod - def parse_match_case(cls, match_case: MatchCase) -> ast.expr: - pattern = cls.parse_expr(match_case.pattern) - guard = None if match_case.guard is None else cls.parse_expr(match_case.guard) - body = cls.parse_stmts(match_case.body) - return ast.match_case(pattern=pattern, guard=guard, body=body) - - @classmethod - def compile_match( - cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str - ) -> types.CodeType: - cases = [cls.parse_match_case(case) for case in match_cases] - match = ast.Match(target=cls.parse_expr(target), cases=cases) - body = [*cls.parse_stmts(pre), match, *cls.parse_stmts(post)] - tree = ast.fix_missing_locations(ast.Module(body=body, type_ignores=[])) - return compile(tree, FILENAME, "exec") - - @classmethod - def execute_match( - cls, pre: str, target: str, match_cases: typing.Iterable[MatchCase], post: str - ) -> typing.Dict[str, typing.Any]: - namespace = {} - exec(cls.compile_match(pre, target, match_cases, post), None, namespace) - return namespace - - def test_patma_ast_00(self) -> None: - match_cases = [MatchCase("0", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_01(self) -> None: - match_cases = [MatchCase("False", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_02(self) -> None: - match_cases = [MatchCase("1", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - - def test_patma_ast_03(self) -> None: - match_cases = [MatchCase("None", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - - def test_patma_ast_04(self) -> None: - match_cases = [MatchCase("0", "y = 0"), MatchCase("0", "y = 1")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_05(self) -> None: - match_cases = [MatchCase("1", "y = 0"), MatchCase("1", "y = 1")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - - def test_patma_ast_06(self) -> None: - match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] - namespace = self.execute_match("x = 'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "x") - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_07(self) -> None: - match_cases = [MatchCase("'y'", "y = 0"), MatchCase("'x'", "y = 1")] - namespace = self.execute_match("x = 'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "x") - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_08(self) -> None: - match_cases = [MatchCase("'x'", "y = 0"), MatchCase("'y'", "y = 1")] - namespace = self.execute_match("x = 'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "x") - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_09(self) -> None: - match_cases = [MatchCase("b'y'", "y = 0"), MatchCase("b'x'", "y = 1")] - namespace = self.execute_match("x = b'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), b"x") - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_10(self) -> None: - match_cases = [MatchCase("0", "y = 0", "False"), MatchCase("0", "y = 1")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_11(self) -> None: - match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - - def test_patma_ast_12(self) -> None: - match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_13(self) -> None: - match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_14(self) -> None: - match_cases = [MatchCase("0", "y = 0", "True"), MatchCase("0", "y = 1", "True")] - namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_15(self) -> None: - match_cases = [MatchCase("0", "y = 0", "0"), MatchCase("0", "y = 1", "1")] - namespace = self.execute_match("x = 0", "x", match_cases, "y = 2") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_16(self) -> None: - match_cases = [MatchCase("0", "y = 0", "not (x := 1)"), MatchCase("1", "y = 1")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 1) - self.assertNotIn("y", namespace) - - def test_patma_ast_17(self) -> None: - match_cases = [ - MatchCase("0", "y = 0", "not (x := 1)"), - MatchCase("(z := 0)", "y = 1"), - ] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 1) - self.assertEqual(namespace.get("y"), 1) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_18(self) -> None: - match_cases = [ - MatchCase("(z := 1)", "y = 0", "not (x := 1)"), - MatchCase("0", "y = 1"), - ] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 1) - self.assertNotIn("z", namespace) - - def test_patma_ast_19(self) -> None: - match_cases = [MatchCase("(z := 0)", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_20(self) -> None: - match_cases = [MatchCase("(z := 1)", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - self.assertNotIn("z", namespace) - - def test_patma_ast_21(self) -> None: - match_cases = [MatchCase("(z := 0)", "y = 0", "(w := 0)")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("w"), 0) - self.assertEqual(namespace.get("x"), 0) - self.assertNotIn("y", namespace) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_22(self) -> None: - match_cases = [MatchCase("(z := (w := 0))", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("w"), 0) - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_23(self) -> None: - match_cases = [MatchCase("0 or 1 or 2", "y = 0")] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_24(self) -> None: - match_cases = [MatchCase("0 or 1 or 2", "y = 0")] - namespace = self.execute_match("x = 1", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 1) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_25(self) -> None: - match_cases = [MatchCase("0 or 1 or 2", "y = 0")] - namespace = self.execute_match("x = 2", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 2) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_26(self) -> None: - match_cases = [MatchCase("0 or 1 or 2", "y = 0")] - namespace = self.execute_match("x = 3", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 3) - self.assertNotIn("y", namespace) - - def test_patma_ast_27(self) -> None: - match_cases = [ - MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") - ] - namespace = self.execute_match("x = 0", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 0) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_28(self) -> None: - match_cases = [ - MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") - ] - namespace = self.execute_match("x = 1", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 1) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 1) - - def test_patma_ast_29(self) -> None: - match_cases = [ - MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") - ] - namespace = self.execute_match("x = 2", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 2) - self.assertNotIn("y", namespace) - self.assertEqual(namespace.get("z"), 2) - - def test_patma_ast_30(self) -> None: - match_cases = [ - MatchCase("(z := 0) or (z := 1) or (z := 2)", "y = 0", "z == x % 2") - ] - namespace = self.execute_match("x = 3", "x", match_cases, "") - self.assertEqual(namespace.get("x"), 3) - self.assertNotIn("y", namespace) - self.assertNotIn("z", namespace) - - def test_patma_ast_31(self) -> None: - match_cases = [MatchCase("[]", "y = 0")] - namespace = self.execute_match("x = ()", "x", match_cases, "") - self.assertEqual(namespace.get("x"), ()) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_32(self) -> None: - match_cases = [MatchCase("[]", "y = 0")] - namespace = self.execute_match("x = ()", "x", match_cases, "") - self.assertEqual(namespace.get("x"), ()) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_33(self) -> None: - match_cases = [MatchCase("[0]", "y = 0")] - namespace = self.execute_match("x = (0,)", "x", match_cases, "") - self.assertEqual(namespace.get("x"), (0,)) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_34(self) -> None: - match_cases = [MatchCase("[[]]", "y = 0")] - namespace = self.execute_match("x = ((),)", "x", match_cases, "") - self.assertEqual(namespace.get("x"), ((),)) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_35(self) -> None: - match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] - namespace = self.execute_match("x = [0, 1]", "x", match_cases, "") - self.assertEqual(namespace.get("x"), [0, 1]) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_36(self) -> None: - match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] - namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") - self.assertEqual(namespace.get("x"), [1, 0]) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_37(self) -> None: - match_cases = [MatchCase("[0, 1] or [1, 0]", "y = 0")] - namespace = self.execute_match("x = [0, 0]", "x", match_cases, "") - self.assertEqual(namespace.get("x"), [0, 0]) - self.assertNotIn("y", namespace) - - def test_patma_ast_38(self) -> None: - match_cases = [ - MatchCase("[w := 0,]", "y = 0"), - MatchCase("[z := 0] or [1, z := (0 or 1)] or [z := 0]", "y = 1"), - ] - namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") - self.assertNotIn("w", namespace) - self.assertEqual(namespace.get("x"), [1, 0]) - self.assertEqual(namespace.get("y"), 1) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_39(self) -> None: - match_cases = [ - MatchCase("[0,]", "y = 0"), - MatchCase("[1, 0]", "y = 1", "(x := x[:0])"), - MatchCase("[1, 0]", "y = 2"), - ] - namespace = self.execute_match("x = [1, 0]", "x", match_cases, "") - self.assertEqual(namespace.get("x"), []) - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_40(self) -> None: - match_cases = [MatchCase("[0]", "y = 0")] - namespace = self.execute_match("x = {0}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0}) - self.assertNotIn("y", namespace) - - def test_patma_ast_41(self) -> None: - match_cases = [MatchCase("[]", "y = 0")] - namespace = self.execute_match("x = set()", "x", match_cases, "") - self.assertEqual(namespace.get("x"), set()) - self.assertNotIn("y", namespace) - - def test_patma_ast_42(self) -> None: - match_cases = [MatchCase("[]", "y = 0")] - namespace = self.execute_match("x = iter([1,2,3])", "x", match_cases, "") - self.assertEqual(list(namespace.get("x")), [1, 2, 3]) - self.assertNotIn("y", namespace) - - def test_patma_ast_43(self) -> None: - match_cases = [MatchCase("[]", "y = 0")] - namespace = self.execute_match("x = {}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {}) - self.assertNotIn("y", namespace) - - def test_patma_ast_44(self) -> None: - match_cases = [MatchCase("[0, 1]", "y = 0")] - namespace = self.execute_match("x = {0: False, 1: True}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: False, 1: True}) - self.assertNotIn("y", namespace) - - def test_patma_ast_45(self) -> None: - match_cases = [MatchCase("['x']", "y = 0"), MatchCase("'x'", "y = 1")] - namespace = self.execute_match("x = 'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "x") - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_46(self) -> None: - match_cases = [ - MatchCase("[b'x']", "y = 0"), - MatchCase("['x']", "y = 1"), - MatchCase("[120]", "y = 2"), - MatchCase("b'x'", "y = 4"), - ] - namespace = self.execute_match("x = b'x'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), b"x") - self.assertEqual(namespace.get("y"), 4) - - def test_patma_ast_47(self) -> None: - match_cases = [MatchCase("[120]", "y = 0"), MatchCase("120", "y = 1")] - namespace = self.execute_match("x = bytearray(b'x')", "x", match_cases, "") - self.assertEqual(namespace.get("x"), b"x") - self.assertNotIn("y", namespace) - - def test_patma_ast_48(self) -> None: - match_cases = [ - MatchCase("[]", "y = 0"), - MatchCase("['']", "y = 1"), - MatchCase("''", "y = 2"), - ] - namespace = self.execute_match("x = ''", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "") - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_49(self) -> None: - match_cases = [ - MatchCase("['x', 'x', 'x']", "y = 0"), - MatchCase("['xxx']", "y = 1"), - MatchCase("'xxx'", "y = 2"), - ] - namespace = self.execute_match("x = 'xxx'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), "xxx") - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_50(self) -> None: - match_cases = [ - MatchCase("[120, 120, 120]", "y = 0"), - MatchCase("[b'xxx']", "y = 1"), - MatchCase("b'xxx'", "y = 2"), - ] - namespace = self.execute_match("x = b'xxx'", "x", match_cases, "") - self.assertEqual(namespace.get("x"), b"xxx") - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_51(self) -> None: - match_cases = [MatchCase("{}", "y = 0")] - namespace = self.execute_match("x = {}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {}) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_52(self) -> None: - match_cases = [MatchCase("{}", "y = 0")] - namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 0}) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_53(self) -> None: - match_cases = [MatchCase("{0: 0}", "y = 0")] - namespace = self.execute_match("x = {}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {}) - self.assertNotIn("y", namespace) - - def test_patma_ast_54(self) -> None: - match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] - namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 0}) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 0) - - def test_patma_ast_55(self) -> None: - match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] - namespace = self.execute_match("x = {0: 1}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 1}) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 1) - - def test_patma_ast_56(self) -> None: - match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] - namespace = self.execute_match("x = {0: 2}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 2}) - self.assertEqual(namespace.get("y"), 0) - self.assertEqual(namespace.get("z"), 2) - - def test_patma_ast_57(self) -> None: - match_cases = [MatchCase("{0: (z := (0 or 1 or 2))}", "y = 0")] - namespace = self.execute_match("x = {0: 3}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 3}) - self.assertNotIn("y", namespace) - self.assertNotIn("z", namespace) - - def test_patma_ast_58(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match("x = {}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {}) - self.assertNotIn("y", namespace) - - def test_patma_ast_59(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match( - "x = {False: (True, 2.0, {})}", "x", match_cases, "" - ) - self.assertEqual(namespace.get("x"), {False: (True, 2.0, {})}) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_60(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match( - "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" - ) - self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) - self.assertEqual(namespace.get("y"), 0) - - def test_patma_ast_61(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match( - "x = {False: (True, 2.0, {}), 1: [[]], 2: 0}", "x", match_cases, "" - ) - self.assertEqual(namespace.get("x"), {False: (True, 2.0, {}), 1: [[]], 2: 0}) - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_62(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase("{0: [1, 2, {}], 1: [[]]}", "y = 1"), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match("x = []", "x", match_cases, "") - self.assertEqual(namespace.get("x"), []) - self.assertEqual(namespace.get("y"), 2) - - def test_patma_ast_63(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase( - "{0: [1, 2, {}] or False} or {1: [[]]} or {0: [1, 2, {}]} or [] or 'X' or {}", - "y = 1", - ), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 0}) - self.assertEqual(namespace.get("y"), 1) - - def test_patma_ast_64(self) -> None: - match_cases = [ - MatchCase("{0: [1, 2, {}]}", "y = 0"), - MatchCase( - "{0: [1, 2, {}] or True} or {1: [[]]} or {0: [1, 2, {}]} or [] or 'X' or {}", - "y = 1", - ), - MatchCase("[]", "y = 2"), - ] - namespace = self.execute_match("x = {0: 0}", "x", match_cases, "") - self.assertEqual(namespace.get("x"), {0: 0}) - self.assertEqual(namespace.get("y"), 1) - - class TestMatch(unittest.TestCase): def test_patma_000(self) -> None: @@ -1826,15 +1284,123 @@ def test_patma_138(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {}) + def test_patma_139(self) -> None: + x = False + match x: + case bool(z): + y = 0 + self.assertIs(x, False) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_140(self) -> None: + x = True + match x: + case bool(z): + y = 0 + self.assertIs(x, True) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_141(self) -> None: + x = bytearray() + match x: + case bytearray(z): + y = 0 + self.assertEqual(x, bytearray()) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_142(self) -> None: + x = b"" + match x: + case bytes(z): + y = 0 + self.assertEqual(x, b"") + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_143(self) -> None: + x = {} + match x: + case dict(z): + y = 0 + self.assertEqual(x, {}) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_144(self) -> None: + x = 0.0 + match x: + case float(z): + y = 0 + self.assertEqual(x, 0.0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_145(self) -> None: + x = frozenset() + match x: + case frozenset(z): + y = 0 + self.assertEqual(x, frozenset()) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_146(self) -> None: + x = 0 + match x: + case int(z): + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_147(self) -> None: + x = [] + match x: + case list(z): + y = 0 + self.assertEqual(x, []) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_148(self) -> None: + x = set() + match x: + case set(z): + y = 0 + self.assertEqual(x, set()) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_149(self) -> None: + x = "" + match x: + case str(z): + y = 0 + self.assertEqual(x, "") + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_150(self) -> None: + x = () + match x: + case tuple(z): + y = 0 + self.assertEqual(x, ()) + self.assertEqual(y, 0) + self.assertIs(z, x) + def run_perf(self): # ./python -m pyperf timeit -s 'from test.test_patma import TestMatch; t = TestMatch()' 't.run_perf()' attrs = vars(type(self)).items() tests = [attr for name, attr in attrs if name.startswith("test_")] - assert_equal = self.assertEqual + assert_equal, assert_is = self.assertEqual, self.assertIs try: - self.assertEqual = lambda *_: None + self.assertEqual = self.assertIs = lambda *_: None for _ in range(1 << 10): for test in tests: test(self) finally: - self.assertEqual = assert_equal + self.assertEqual, self.assertIs = assert_equal, assert_is From 018e6ab26fe528371b5fda17c1deb978bce66921 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 28 Jun 2020 13:52:43 -0700 Subject: [PATCH 105/218] Cleanup --- Doc/library/dis.rst | 14 +++---- Include/opcode.h | 8 ++-- Lib/ast.py | 7 ++++ Lib/opcode.py | 8 ++-- Lib/test/test_patma.py | 86 ++++++++++++++++++++--------------------- Python/ast.c | 4 +- Python/ceval.c | 52 +++++++++++++------------ Python/compile.c | 16 ++++---- Python/opcode_targets.h | 8 ++-- Python/peephole.c | 8 ++-- 10 files changed, 112 insertions(+), 99 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 777ec49e142baf..86d999006f4e49 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1196,31 +1196,31 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: MATCH_CLS (count) +.. opcode:: MATCH_TYPE (count) TODO .. versionadded:: 3.10 -.. opcode:: MATCH_MAP (delta) +.. opcode:: JUMP_IF_NOT_MAP (delta) - If TOS is not a subclass of :class:`collections.abc.Mapping`, increment the + If TOS is not an instance of :class:`collections.abc.Mapping`, increment the bytecode counter by *delta*. .. versionadded:: 3.10 -.. opcode:: MATCH_SEQ (delta) +.. opcode:: JUMP_IF_NOT_SEQ (delta) - If TOS is a subclass of :class:`string`/:class:`bytes`/:class:`bytearray`, is - an :term:`iterator`, or is not a subclass of + If TOS is an instance of :class:`string`/:class:`bytes`/:class:`bytearray`, + is an :term:`iterator`, or is not an instance of :class:`collections.abc.Sequence`, increment the bytecode counter by *delta*. .. versionadded:: 3.10 -.. opcode:: MATCH_MAP_KEYS (copy) +.. opcode:: MATCH_KEYS (copy) TODO diff --git a/Include/opcode.h b/Include/opcode.h index cd6158ea0e11a0..af7fe4afc22201 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -118,10 +118,10 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 -#define MATCH_CLS 149 -#define MATCH_MAP_KEYS 150 -#define MATCH_MAP 151 -#define MATCH_SEQ 152 +#define MATCH_TYPE 149 +#define MATCH_KEYS 150 +#define JUMP_IF_NOT_MAP 151 +#define JUMP_IF_NOT_SEQ 152 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/ast.py b/Lib/ast.py index d10852b45d06c4..abb9ffc5cfdf41 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1367,7 +1367,14 @@ def visit_Attribute(self, node): def visit_Call(self, node): self.set_precedence(_Precedence.ATOM, node.func) + # We need to surround self.traverse(node.func) like this because + # ".xxx()" isn't legal in patterns (but visit_Name will try to include + # the leading dot if we're in a pattern). Temporary, as it's likely the + # pattern name load/store syntax will change... + _pattern = self.in_pattern() + self._pattern = False self.traverse(node.func) + self._pattern = _pattern with self.delimit("(", ")"): comma = False for e in node.args: diff --git a/Lib/opcode.py b/Lib/opcode.py index b19be82e14b526..751d56a4ca6f29 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -193,10 +193,10 @@ def jabs_op(name, op): def_op('MAP_ADD', 147) def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('MATCH_CLS', 149) -def_op('MATCH_MAP_KEYS', 150) -jrel_op('MATCH_MAP', 151) -jrel_op('MATCH_SEQ', 152) +def_op('MATCH_TYPE', 149) +def_op('MATCH_KEYS', 150) +jrel_op('JUMP_IF_NOT_MAP', 151) +jrel_op('JUMP_IF_NOT_SEQ', 152) jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index e998cede3b7370..7c25c06c25404d 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -299,7 +299,7 @@ def test_patma_034(self) -> None: match x: case {0: [1, 2, {}]}: y = 0 - case {0: ([1, 2, {}] | False)} | {1: [[]]} | {0: [1, 2, {}]} | [] | 'X' | {}: + case {0: ([1, 2, {}] | False)} | {1: [[]]} | {0: [1, 2, {}]} | [] | "X" | {}: y = 1 case []: y = 2 @@ -311,7 +311,7 @@ def test_patma_035(self) -> None: match x: case {0: [1, 2, {}]}: y = 0 - case {0: [1, 2, {}] | True} | {1: [[]]} | {0: [1, 2, {}]} | [] | 'X' | {}: + case {0: [1, 2, {}] | True} | {1: [[]]} | {0: [1, 2, {}]} | [] | "X" | {}: y = 1 case []: y = 2 @@ -573,43 +573,43 @@ def test_patma_063(self) -> None: self.assertEqual(y, None) def test_patma_064(self) -> None: - x = 'x' + x = "x" match x: - case 'x': + case "x": y = 0 - case 'y': + case "y": y = 1 - self.assertEqual(x, 'x') + self.assertEqual(x, "x") self.assertEqual(y, 0) def test_patma_065(self) -> None: - x = 'x' + x = "x" match x: - case 'y': + case "y": y = 0 - case 'x': + case "x": y = 1 - self.assertEqual(x, 'x') + self.assertEqual(x, "x") self.assertEqual(y, 1) def test_patma_066(self) -> None: - x = 'x' + x = "x" match x: - case 'x': + case "x": y = 0 - case 'y': + case "y": y = 1 - self.assertEqual(x, 'x') + self.assertEqual(x, "x") self.assertEqual(y, 0) def test_patma_067(self) -> None: - x = b'x' + x = b"x" match x: - case b'y': + case b"y": y = 0 - case b'x': + case b"x": y = 1 - self.assertEqual(x, b'x') + self.assertEqual(x, b"x") self.assertEqual(y, 1) def test_patma_068(self) -> None: @@ -687,74 +687,74 @@ def test_patma_074(self) -> None: self.assertEqual(y, None) def test_patma_075(self) -> None: - x = 'x' + x = "x" match x: - case ['x']: + case ["x"]: y = 0 - case 'x': + case "x": y = 1 - self.assertEqual(x, 'x') + self.assertEqual(x, "x") self.assertEqual(y, 1) def test_patma_076(self) -> None: - x = b'x' + x = b"x" match x: - case [b'x']: + case [b"x"]: y = 0 - case ['x']: + case ["x"]: y = 1 case [120]: y = 2 - case b'x': + case b"x": y = 4 - self.assertEqual(x, b'x') + self.assertEqual(x, b"x") self.assertEqual(y, 4) def test_patma_077(self) -> None: - x = bytearray(b'x') + x = bytearray(b"x") y = None match x: case [120]: y = 0 case 120: y = 1 - self.assertEqual(x, b'x') + self.assertEqual(x, b"x") self.assertEqual(y, None) def test_patma_078(self) -> None: - x = '' + x = "" match x: case []: y = 0 - case ['']: + case [""]: y = 1 - case '': + case "": y = 2 - self.assertEqual(x, '') + self.assertEqual(x, "") self.assertEqual(y, 2) def test_patma_079(self) -> None: - x = 'xxx' + x = "xxx" match x: - case ['x', 'x', 'x']: + case ["x", "x", "x"]: y = 0 - case ['xxx']: + case ["xxx"]: y = 1 - case 'xxx': + case "xxx": y = 2 - self.assertEqual(x, 'xxx') + self.assertEqual(x, "xxx") self.assertEqual(y, 2) def test_patma_080(self) -> None: - x = b'xxx' + x = b"xxx" match x: case [120, 120, 120]: y = 0 - case [b'xxx']: + case [b"xxx"]: y = 1 - case b'xxx': + case b"xxx": y = 2 - self.assertEqual(x, b'xxx') + self.assertEqual(x, b"xxx") self.assertEqual(y, 2) def test_patma_081(self) -> None: @@ -1393,7 +1393,7 @@ def test_patma_150(self) -> None: self.assertIs(z, x) def run_perf(self): - # ./python -m pyperf timeit -s 'from test.test_patma import TestMatch; t = TestMatch()' 't.run_perf()' + # ./python -m pyperf timeit -s "from test.test_patma import TestMatch; t = TestMatch()" "t.run_perf()" attrs = vars(type(self)).items() tests = [attr for name, attr in attrs if name.startswith("test_")] assert_equal, assert_is = self.assertEqual, self.assertIs diff --git a/Python/ast.c b/Python/ast.c index 22a90ff42007e3..90e6e9b4313605 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -402,7 +402,8 @@ validate_pattern(expr_ty p) } return 1; case List_kind: - values = p->v.List.elts; + case Tuple_kind: + values = p->kind == List_kind ? p->v.List.elts : p->v.Tuple.elts; size = asdl_seq_LEN(values); for (i = 0; i < size; i++) { value = asdl_seq_GET(values, i); @@ -431,6 +432,7 @@ validate_pattern(expr_ty p) return (validate_pattern(p->v.NamedExpr.value) && validate_expr(p->v.NamedExpr.target, Store)); case UnaryOp_kind: + // TODO return 1; default: PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); diff --git a/Python/ceval.c b/Python/ceval.c index 1a97b12c2802ce..8225f3bb91c8f2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -857,7 +857,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * if (PyMapping_Length(map) < nkeys) { goto fail; } - seen = PySet_New(NULL); + seen = PyList_New(0); if (!seen) { goto fail; } @@ -867,8 +867,8 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * } for (Py_ssize_t i = 0; i < nkeys; i++) { PyObject *key = PyTuple_GET_ITEM(keys, i); - int dupe = PySet_Contains(seen, key); - if (dupe || PySet_Add(seen, key)) { + int dupe = PySequence_Contains(seen, key); + if (dupe || PyList_Append(seen, key)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "mapping pattern checks duplicate key (%R)", key); @@ -913,8 +913,8 @@ get_match_args(PyThreadState *tstate, PyObject *type) return match_args; } _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ must be a list or tuple (got %s)", - Py_TYPE(match_args)->tp_name); + "%s.__match_args__ must be a list or tuple (got %s)", + ((PyTypeObject *)type)->tp_name, Py_TYPE(match_args)->tp_name); Py_DECREF(match_args); return NULL; } @@ -939,7 +939,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty _PyErr_Clear(tstate); _PyErr_Format(tstate, PyExc_ImpossibleMatchError, "type %s cannot be matched", - Py_TYPE(type)->tp_name); + ((PyTypeObject *)type)->tp_name); return NULL; } PyObject *proxy = PyObject_CallOneArg(method, target); @@ -957,6 +957,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (!match_args && _PyErr_Occurred(tstate)) { goto error; } + Py_ssize_t nmatch_args; if (!nargs) { args = PyTuple_New(0); if (!args) { @@ -964,28 +965,30 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } } else if (!match_args) { - if (PyType_HasFeature((PyTypeObject *)type, _Py_TPFLAGS_SIMPLE_MATCH)) { - if (nargs > 1) { - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "too many positional matches in pattern (expected at most 1, got %d)", - nargs); - goto error; - } + if (!PyType_HasFeature((PyTypeObject *)type, _Py_TPFLAGS_SIMPLE_MATCH)) { + nmatch_args = 0; + // TODO: Combine with below (and reword for 0): + _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + "%s() takes at most %d positional sub-patterns (%d given)", + ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); + goto error; } - else { + nmatch_args = 1; + if (nargs > 1) { + // TODO: Combine with above (and reword for 0): _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "too many positional matches in pattern (expected none, got %d)", - nargs); + "%s() takes at most %d positional sub-patterns (%d given)", + ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); goto error; } } else { Py_ssize_t nmatch_args = PySequence_Fast_GET_SIZE(match_args); if (nmatch_args < nargs) { - // TODO: Combine with above: + // TODO: Combine with above (and reword for 0): _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "too many positional matches in pattern (expected at most %d, got %d)", - nmatch_args, nargs); + "%s() takes at most %d positional sub-patterns (%d given)", + ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); return NULL; } args = PyList_CheckExact(match_args) ? PyList_GetSlice(match_args, 0, nargs) : PyTuple_GetSlice(match_args, 0, nargs); @@ -1026,7 +1029,8 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (dupe || PySet_Add(seen, name)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "multiple patterns bound to attribute %R", name); + "%s() got multiple sub-patterns for attribute %R", + ((PyTypeObject *)type)->tp_name, name); } goto error; } @@ -3496,7 +3500,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(MATCH_CLS): { + case TARGET(MATCH_TYPE): { PyObject *names = POP(); PyObject *type = TOP(); PyObject *target = SECOND(); @@ -3512,7 +3516,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_MAP): { + case TARGET(JUMP_IF_NOT_MAP): { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { goto error; @@ -3538,7 +3542,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_SEQ): { + case TARGET(JUMP_IF_NOT_SEQ): { PyObject *target = TOP(); if (PyType_FastSubclass(Py_TYPE(target), Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS) @@ -3573,7 +3577,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_MAP_KEYS): { + case TARGET(MATCH_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); PyObject *copy = NULL; diff --git a/Python/compile.c b/Python/compile.c index 333f9ab868bd21..f566a948105dac 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1103,13 +1103,13 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; - case MATCH_CLS: + case MATCH_TYPE: return -1; - case MATCH_MAP_KEYS: + case MATCH_KEYS: case GET_LEN: return 1; - case MATCH_MAP: - case MATCH_SEQ: + case JUMP_IF_NOT_MAP: + case JUMP_IF_NOT_SEQ: return 0; default: return PY_INVALID_STACK_EFFECT; @@ -2787,7 +2787,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* PyTuple_SET_ITEM(kwnames, i, name); } ADDOP_LOAD_CONST_NEW(c, kwnames); - ADDOP_I(c, MATCH_CLS, nargs + nkwargs); + ADDOP_I(c, MATCH_TYPE, nargs + nkwargs); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); @@ -2848,7 +2848,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP_JREL(c, MATCH_MAP, block); + ADDOP_JREL(c, JUMP_IF_NOT_MAP, block); if (size - star) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); @@ -2867,7 +2867,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje VISIT(c, expr, asdl_seq_GET(keys, i)); } ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_I(c, MATCH_MAP_KEYS, star); + ADDOP_I(c, MATCH_KEYS, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -2996,7 +2996,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP_JREL(c, MATCH_SEQ, block); + ADDOP_JREL(c, JUMP_IF_NOT_SEQ, block); if (star >= 0) { if (size) { ADDOP(c, GET_LEN); diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 6c15c9d771f370..4c6721c6d212a2 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -148,10 +148,10 @@ static void *opcode_targets[256] = { &&TARGET_SET_ADD, &&TARGET_MAP_ADD, &&TARGET_LOAD_CLASSDEREF, - &&TARGET_MATCH_CLS, - &&TARGET_MATCH_MAP_KEYS, - &&TARGET_MATCH_MAP, - &&TARGET_MATCH_SEQ, + &&TARGET_MATCH_TYPE, + &&TARGET_MATCH_KEYS, + &&TARGET_JUMP_IF_NOT_MAP, + &&TARGET_JUMP_IF_NOT_SEQ, &&_unknown_opcode, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, diff --git a/Python/peephole.c b/Python/peephole.c index 8e95760c12a045..a744b2087016c3 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -198,8 +198,8 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case MATCH_MAP: - case MATCH_SEQ: + case JUMP_IF_NOT_MAP: + case JUMP_IF_NOT_SEQ: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -504,8 +504,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case MATCH_MAP: - case MATCH_SEQ: + case JUMP_IF_NOT_MAP: + case JUMP_IF_NOT_SEQ: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From 7a6d897433d7ae14e8cca5c24d3f418991393294 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 28 Jun 2020 14:15:21 -0700 Subject: [PATCH 106/218] Add pattern_context --- Python/compile.c | 88 +++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index f566a948105dac..1259955b293f8f 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -177,6 +177,14 @@ struct compiler { PyArena *c_arena; /* pointer to memory allocation arena */ }; +typedef struct { + // Py_ssize_t map_len_ge; + // Py_ssize_t seq_len_ge; + // Py_ssize_t seq_len_eq; + // basicblock *success; + basicblock *failure; +} pattern_context; + static int compiler_enter_scope(struct compiler *, identifier, int, void *, int); static void compiler_free(struct compiler *); static basicblock *compiler_new_block(struct compiler *); @@ -222,7 +230,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_pattern(struct compiler *, expr_ty, basicblock *, PyObject *); +static int compiler_pattern(struct compiler *, expr_ty, pattern_context *, PyObject *); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -2746,25 +2754,23 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } -// TODO: Remove Store part of check if disallowing all usage of _: #define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + ((N)->kind == Name_kind && (N)->v.Name.ctx == Store && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int -compiler_pattern_load(struct compiler *c, expr_ty p, basicblock *fail) +compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); assert(p->kind != Name_kind || p->v.Name.ctx == Load); - // TODO: Guard against wildcards here? VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, fail); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, pc->failure); return 1; } static int -compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) { +compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { asdl_seq *args = p->v.Call.args; asdl_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); @@ -2789,6 +2795,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* ADDOP_LOAD_CONST_NEW(c, kwnames); ADDOP_I(c, MATCH_TYPE, nargs + nkwargs); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + pattern_context sub_pc = *pc; + sub_pc.failure = block; for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); if (WILDCARD_CHECK(arg)) { @@ -2797,7 +2805,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, arg, block, names)); + CHECK(compiler_pattern(c, arg, &sub_pc, names)); } for (i = 0; i < nkwargs; i++) { keyword_ty kwarg = asdl_seq_GET(kwargs, i); @@ -2807,13 +2815,13 @@ compiler_pattern_call(struct compiler *c, expr_ty p, basicblock *fail, PyObject* ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, kwarg->value, block, names)); + CHECK(compiler_pattern(c, kwarg->value, &sub_pc, names)); } ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); + ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } @@ -2838,7 +2846,7 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int wildcard_ok, PyObject* } static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { basicblock *block, *block_star, *end; CHECK(block_star = compiler_new_block(c)); @@ -2869,6 +2877,8 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) + pattern_context sub_pc = *pc; + sub_pc.failure = block_star; for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { @@ -2877,7 +2887,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, value, block_star, names)); + CHECK(compiler_pattern(c, value, &sub_pc, names)); } ADDOP(c, POP_TOP); if (star) { @@ -2891,42 +2901,44 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, basicblock *fail, PyObje ADDOP(c, POP_TOP); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); + ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } static int -compiler_pattern_name(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Load || p->v.Name.ctx == Store); if (p->v.Name.ctx == Load) { - return compiler_pattern_load(c, p, fail); + return compiler_pattern_load(c, p, pc); } return compiler_pattern_store(c, p, 1, names); } static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { assert(p->kind == NamedExpr_kind); basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, block, names)); + pattern_context sub_pc = *pc; + sub_pc.failure = block; + CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc, names)); CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, 0, names)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); + ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } static int -compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { assert(p->kind == BoolOp_kind); assert(p->v.BoolOp.op == Or); @@ -2940,7 +2952,9 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* n CHECK(names_copy = PySet_New(names)); CHECK(block = compiler_new_block(c)); ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), block, names_copy)); + pattern_context sub_pc = *pc; + sub_pc.failure = block; + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), &sub_pc, names_copy)); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); @@ -2971,13 +2985,13 @@ compiler_pattern_or(struct compiler *c, expr_ty p, basicblock *fail, PyObject* n assert(control); Py_DECREF(control); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); + ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } static int -compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { assert(p->kind == List_kind || p->kind == Tuple_kind); asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; @@ -3011,6 +3025,8 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } + pattern_context sub_pc = *pc; + sub_pc.failure = block; for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { @@ -3051,46 +3067,46 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, basicblock *fail, PyObj ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - i))); ADDOP(c, BINARY_SUBSCR); } - CHECK(compiler_pattern(c, value, block, names)); + CHECK(compiler_pattern(c, value, &sub_pc, names)); } ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, fail); + ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } static int -compiler_pattern(struct compiler *c, expr_ty p, basicblock *fail, PyObject* names) +compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { SET_LOC(c, p); switch (p->kind) { case Attribute_kind: - return compiler_pattern_load(c, p, fail); + return compiler_pattern_load(c, p, pc); case BinOp_kind: // Because we allow "2+2j", things like "2+2" make it this far: return compiler_error(c, "patterns cannot include operators"); case BoolOp_kind: - return compiler_pattern_or(c, p, fail, names); + return compiler_pattern_or(c, p, pc, names); case Call_kind: - return compiler_pattern_call(c, p, fail, names); + return compiler_pattern_call(c, p, pc, names); case Constant_kind: - return compiler_pattern_load(c, p, fail); + return compiler_pattern_load(c, p, pc); case Dict_kind: - return compiler_pattern_mapping(c, p, fail, names); + return compiler_pattern_mapping(c, p, pc, names); case JoinedStr_kind: // Because we allow strings, f-strings make it this far: return compiler_error(c, "patterns cannot include f-strings"); case List_kind: - return compiler_pattern_sequence(c, p, fail, names); + return compiler_pattern_sequence(c, p, pc, names); case Name_kind: - return compiler_pattern_name(c, p, fail, names); + return compiler_pattern_name(c, p, pc, names); case NamedExpr_kind: - return compiler_pattern_namedexpr(c, p, fail, names); + return compiler_pattern_namedexpr(c, p, pc, names); case Tuple_kind: - return compiler_pattern_sequence(c, p, fail, names); + return compiler_pattern_sequence(c, p, pc, names); default: Py_UNREACHABLE(); } @@ -3115,7 +3131,9 @@ compiler_match(struct compiler *c, stmt_ty s) if (!names) { return 0; } - int result = compiler_pattern(c, m->pattern, next, names); + pattern_context pc; + pc.failure = next; + int result = compiler_pattern(c, m->pattern, &pc, names); Py_DECREF(names); CHECK(result); if (m->guard) { From 7953dee7d579af52801bcb041cd3c0d2f28e6a23 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 28 Jun 2020 15:43:37 -0700 Subject: [PATCH 107/218] Keep bound names in pattern context --- Python/compile.c | 61 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 1259955b293f8f..c57c2e29a1db47 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -183,6 +183,7 @@ typedef struct { // Py_ssize_t seq_len_eq; // basicblock *success; basicblock *failure; + PyObject* stores; } pattern_context; static int compiler_enter_scope(struct compiler *, identifier, int, void *, int); @@ -230,7 +231,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_pattern(struct compiler *, expr_ty, pattern_context *, PyObject *); +static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -2770,7 +2771,7 @@ compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) { +compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { asdl_seq *args = p->v.Call.args; asdl_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); @@ -2805,7 +2806,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc, PyObje ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, arg, &sub_pc, names)); + CHECK(compiler_pattern(c, arg, &sub_pc)); } for (i = 0; i < nkwargs; i++) { keyword_ty kwarg = asdl_seq_GET(kwargs, i); @@ -2815,7 +2816,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc, PyObje ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, kwarg->value, &sub_pc, names)); + CHECK(compiler_pattern(c, kwarg->value, &sub_pc)); } ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); @@ -2827,7 +2828,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc, PyObje } static int -compiler_pattern_store(struct compiler *c, expr_ty p, int wildcard_ok, PyObject* names) { +compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc, int wildcard_ok) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { @@ -2837,16 +2838,16 @@ compiler_pattern_store(struct compiler *c, expr_ty p, int wildcard_ok, PyObject* ADDOP(c, POP_TOP); return 1; } - if (PySet_Contains(names, p->v.Name.id)) { + if (PySet_Contains(pc->stores, p->v.Name.id)) { // TODO: Format this error message with the name. return compiler_error(c, "multiple assignments to name in pattern"); } VISIT(c, expr, p); - return !PySet_Add(names, p->v.Name.id); + return !PySet_Add(pc->stores, p->v.Name.id); } static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) { basicblock *block, *block_star, *end; CHECK(block_star = compiler_new_block(c)); @@ -2887,11 +2888,11 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc, PyO ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, value, &sub_pc, names)); + CHECK(compiler_pattern(c, value, &sub_pc)); } ADDOP(c, POP_TOP); if (star) { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), 0, names)); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), pc, 0)); } else { ADDOP(c, POP_TOP); @@ -2907,18 +2908,18 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc, PyO } static int -compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Load || p->v.Name.ctx == Store); if (p->v.Name.ctx == Load) { return compiler_pattern_load(c, p, pc); } - return compiler_pattern_store(c, p, 1, names); + return compiler_pattern_store(c, p, pc, 1); } static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == NamedExpr_kind); basicblock *block, *end; @@ -2927,8 +2928,8 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc, P ADDOP(c, DUP_TOP); pattern_context sub_pc = *pc; sub_pc.failure = block; - CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc, names)); - CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, 0, names)); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc)); + CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc, 0)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); @@ -2938,7 +2939,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc, P } static int -compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == BoolOp_kind); assert(p->v.BoolOp.op == Or); @@ -2949,12 +2950,13 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc, PyObject assert(size > 1); PyObject *names_copy; for (Py_ssize_t i = 0; i < size; i++) { - CHECK(names_copy = PySet_New(names)); + CHECK(names_copy = PySet_New(pc->stores)); CHECK(block = compiler_new_block(c)); ADDOP(c, DUP_TOP); pattern_context sub_pc = *pc; sub_pc.failure = block; - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), &sub_pc, names_copy)); + sub_pc.stores = names_copy; + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), &sub_pc)); ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); @@ -2991,7 +2993,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc, PyObject } static int -compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; @@ -3067,7 +3069,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc, Py ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - i))); ADDOP(c, BINARY_SUBSCR); } - CHECK(compiler_pattern(c, value, &sub_pc, names)); + CHECK(compiler_pattern(c, value, &sub_pc)); } ADDOP(c, POP_TOP); ADDOP_JREL(c, JUMP_FORWARD, end); @@ -3079,7 +3081,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc, Py } static int -compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* names) +compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) { SET_LOC(c, p); switch (p->kind) { @@ -3089,24 +3091,24 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc, PyObject* n // Because we allow "2+2j", things like "2+2" make it this far: return compiler_error(c, "patterns cannot include operators"); case BoolOp_kind: - return compiler_pattern_or(c, p, pc, names); + return compiler_pattern_or(c, p, pc); case Call_kind: - return compiler_pattern_call(c, p, pc, names); + return compiler_pattern_call(c, p, pc); case Constant_kind: return compiler_pattern_load(c, p, pc); case Dict_kind: - return compiler_pattern_mapping(c, p, pc, names); + return compiler_pattern_mapping(c, p, pc); case JoinedStr_kind: // Because we allow strings, f-strings make it this far: return compiler_error(c, "patterns cannot include f-strings"); case List_kind: - return compiler_pattern_sequence(c, p, pc, names); + return compiler_pattern_sequence(c, p, pc); case Name_kind: - return compiler_pattern_name(c, p, pc, names); + return compiler_pattern_name(c, p, pc); case NamedExpr_kind: - return compiler_pattern_namedexpr(c, p, pc, names); + return compiler_pattern_namedexpr(c, p, pc); case Tuple_kind: - return compiler_pattern_sequence(c, p, pc, names); + return compiler_pattern_sequence(c, p, pc); default: Py_UNREACHABLE(); } @@ -3133,7 +3135,8 @@ compiler_match(struct compiler *c, stmt_ty s) } pattern_context pc; pc.failure = next; - int result = compiler_pattern(c, m->pattern, &pc, names); + pc.stores = names; + int result = compiler_pattern(c, m->pattern, &pc); Py_DECREF(names); CHECK(result); if (m->guard) { From 214101e3086199af213ce4c7475a5c52c2bc3ab8 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 29 Jun 2020 12:59:46 -0700 Subject: [PATCH 108/218] Address recent __match__ protocol changes --- Doc/c-api/exceptions.rst | 3 -- Doc/library/exceptions.rst | 7 ---- Include/pyerrors.h | 1 - Lib/_compat_pickle.py | 7 ---- Lib/test/exception_hierarchy.txt | 1 - Lib/test/test_pickle.py | 8 ---- Objects/exceptions.c | 9 ---- Python/ceval.c | 70 ++++++++++++-------------------- 8 files changed, 26 insertions(+), 80 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 59b363f2fbd2d8..e7805ba143c584 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -796,7 +796,6 @@ the variables: single: PyExc_FloatingPointError single: PyExc_GeneratorExit single: PyExc_ImportError - single: PyExc_ImpossibleMatchError single: PyExc_IndentationError single: PyExc_IndexError single: PyExc_InterruptedError @@ -873,8 +872,6 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ImportError` | :exc:`ImportError` | | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ImpossibleMatchError` | :exc:`ImpossibleMatchError` | | -+-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_IndexError` | :exc:`IndexError` | | diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 70c84a382204e0..d852ba7c688391 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -180,13 +180,6 @@ The following exceptions are the exceptions that are usually raised. Added the :attr:`name` and :attr:`path` attributes. -.. exception:: ImpossibleMatchError - - TODO - - .. versionadded:: 3.10 - - .. exception:: ModuleNotFoundError A subclass of :exc:`ImportError` which is raised by :keyword:`import` diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 4a47d774a2c615..979a26ba68a033 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -107,7 +107,6 @@ PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_TypeError; -PyAPI_DATA(PyObject *) PyExc_ImpossibleMatchError; PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; diff --git a/Lib/_compat_pickle.py b/Lib/_compat_pickle.py index 9038eea46c08c3..f68496ae639f5f 100644 --- a/Lib/_compat_pickle.py +++ b/Lib/_compat_pickle.py @@ -249,10 +249,3 @@ for excname in PYTHON3_IMPORTERROR_EXCEPTIONS: REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'ImportError') - -PYTHON3_TYPEERROR_EXCEPTIONS = ( - 'ImpossibleMatchError', -) - -for excname in PYTHON3_TYPEERROR_EXCEPTIONS: - REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'TypeError') diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt index ac349aadea63fa..763a6c899b48eb 100644 --- a/Lib/test/exception_hierarchy.txt +++ b/Lib/test/exception_hierarchy.txt @@ -46,7 +46,6 @@ BaseException | +-- TabError +-- SystemError +-- TypeError - | +-- ImpossibleMatchError +-- ValueError | +-- UnicodeError | +-- UnicodeDecodeError diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 15da43d45d5d39..2307b133dbd0d5 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -421,9 +421,6 @@ def test_name_mapping(self): elif (module2, name2) == ('exceptions', 'ImportError'): attr = getattribute(module3, name3) self.assertTrue(issubclass(attr, ImportError)) - elif (module2, name2) == ('exceptions', 'TypeError'): - attr = getattribute(module3, name3) - self.assertTrue(issubclass(attr, TypeError)) else: module, name = mapping(module2, name2) if module3[:1] != '_': @@ -495,11 +492,6 @@ def test_exceptions(self): ('exceptions', 'ImportError')) self.assertEqual(mapping('exceptions', name), ('exceptions', name)) - elif exc is not TypeError and issubclass(exc, TypeError): - self.assertEqual(reverse_mapping('builtins', name), - ('exceptions', 'TypeError')) - self.assertEqual(mapping('exceptions', name), - ('exceptions', name)) else: self.assertEqual(reverse_mapping('builtins', name), ('exceptions', name)) diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 4c2e2cc863c2ff..db5e3da12b00f3 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -487,13 +487,6 @@ SimpleExtendsException(PyExc_Exception, TypeError, "Inappropriate argument type."); -/* - * ImpossibleMatchError extends TypeError - */ -SimpleExtendsException(PyExc_TypeError, ImpossibleMatchError, - "Incorrect use of a match-case statement."); - - /* * StopAsyncIteration extends Exception */ @@ -2536,7 +2529,6 @@ _PyExc_Init(void) PRE_INIT(BaseException); PRE_INIT(Exception); PRE_INIT(TypeError); - PRE_INIT(ImpossibleMatchError); PRE_INIT(StopAsyncIteration); PRE_INIT(StopIteration); PRE_INIT(GeneratorExit); @@ -2672,7 +2664,6 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod) POST_INIT(BaseException); POST_INIT(Exception); POST_INIT(TypeError); - POST_INIT(ImpossibleMatchError); POST_INIT(StopAsyncIteration); POST_INIT(StopIteration); POST_INIT(GeneratorExit); diff --git a/Python/ceval.c b/Python/ceval.c index 8225f3bb91c8f2..b7fc613c6c2416 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -867,10 +867,9 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * } for (Py_ssize_t i = 0; i < nkeys; i++) { PyObject *key = PyTuple_GET_ITEM(keys, i); - int dupe = PySequence_Contains(seen, key); - if (dupe || PyList_Append(seen, key)) { + if (PySequence_Contains(seen, key) || PyList_Append(seen, key)) { if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + _PyErr_Format(tstate, PyExc_ValueError, "mapping pattern checks duplicate key (%R)", key); } goto fail; @@ -937,7 +936,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (!method || method == Py_None) { Py_XDECREF(method); _PyErr_Clear(tstate); - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + _PyErr_Format(tstate, PyExc_TypeError, "type %s cannot be matched", ((PyTypeObject *)type)->tp_name); return NULL; @@ -959,49 +958,38 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } Py_ssize_t nmatch_args; if (!nargs) { + nmatch_args = 0; args = PyTuple_New(0); if (!args) { goto error; } } else if (!match_args) { - if (!PyType_HasFeature((PyTypeObject *)type, _Py_TPFLAGS_SIMPLE_MATCH)) { - nmatch_args = 0; - // TODO: Combine with below (and reword for 0): - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "%s() takes at most %d positional sub-patterns (%d given)", - ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); - goto error; - } - nmatch_args = 1; - if (nargs > 1) { - // TODO: Combine with above (and reword for 0): - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "%s() takes at most %d positional sub-patterns (%d given)", - ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); - goto error; - } + nmatch_args = PyType_HasFeature((PyTypeObject *)type, + _Py_TPFLAGS_SIMPLE_MATCH); + args = NULL; } else { - Py_ssize_t nmatch_args = PySequence_Fast_GET_SIZE(match_args); - if (nmatch_args < nargs) { - // TODO: Combine with above (and reword for 0): - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "%s() takes at most %d positional sub-patterns (%d given)", - ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); - return NULL; - } - args = PyList_CheckExact(match_args) ? PyList_GetSlice(match_args, 0, nargs) : PyTuple_GetSlice(match_args, 0, nargs); + nmatch_args = PySequence_Fast_GET_SIZE(match_args); + args = PyList_CheckExact(match_args) + ? PyList_GetSlice(match_args, 0, nargs) + : PyTuple_GetSlice(match_args, 0, nargs); if (!args) { goto error; } } + if (nmatch_args < nargs) { + _PyErr_Format(tstate, PyExc_TypeError, + "%s() accepts %d positional sub-patterns (%d given)", + ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); + goto error; + } assert(!args || PyList_CheckExact(args) || PyTuple_CheckExact(args)); attrs = PyTuple_New(count); if (!attrs) { goto error; } - seen = PySet_New(NULL); + seen = PyList_New(0); if (!seen) { goto error; } @@ -1025,10 +1013,9 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty else { name = PyTuple_GET_ITEM(kwargs, i - nargs); } - int dupe = PySet_Contains(seen, name); - if (dupe || PySet_Add(seen, name)) { + if (PySequence_Contains(seen, name) || PyList_Append(seen, name)) { if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, + _PyErr_Format(tstate, PyExc_TypeError, "%s() got multiple sub-patterns for attribute %R", ((PyTypeObject *)type)->tp_name, name); } @@ -1036,17 +1023,12 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } PyObject *attr = PyObject_GetAttr(proxy, name); if (!attr) { - // TODO: Only clear AttributeError? - _PyErr_Clear(tstate); - // TODO: iterate manually (and check for strings) - if (match_args && !PySequence_Contains(match_args, name)) { - _PyErr_Format(tstate, PyExc_ImpossibleMatchError, - "match proxy %R has no attribute %R", - proxy, name); - goto error; + if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { + _PyErr_Clear(tstate); + Py_SETREF(attrs, Py_None); + break; } - Py_SETREF(attrs, Py_None); - break; + goto error; } PyTuple_SET_ITEM(attrs, i, attr); } @@ -3545,7 +3527,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(JUMP_IF_NOT_SEQ): { PyObject *target = TOP(); if (PyType_FastSubclass(Py_TYPE(target), - Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS) + Py_TPFLAGS_BYTES_SUBCLASS | Py_TPFLAGS_UNICODE_SUBCLASS) || PyIter_Check(target) || PyByteArray_Check(target)) { From 9e170bce9a9fcd0f71a3cbedd8fda4292209bc44 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 29 Jun 2020 18:49:15 -0700 Subject: [PATCH 109/218] Ditch __match__! --- Lib/test/test_descrtut.py | 1 - Lib/test/test_pydoc.py | 4 +-- Objects/clinic/typeobject.c.h | 11 +------- Objects/typeobject.c | 26 ------------------ Python/ceval.c | 51 ++++++++++++++--------------------- 5 files changed, 22 insertions(+), 71 deletions(-) diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index f4567880955315..8e25f58d7aa20e 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -188,7 +188,6 @@ def merge(self, other): '__le__', '__len__', '__lt__', - '__match__', '__mul__', '__ne__', '__new__', diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index e212eff5aed8f0..f0d7ffd562c9d9 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -773,11 +773,9 @@ def method_returning_true(self): del expected['__doc__'] del expected['__class__'] # inspect resolves descriptors on type into methods, but vars doesn't, - # so we need to update __subclasshook__, __init_subclass__, and - # __match__. + # so we need to update __subclasshook__ and __init_subclass__. expected['__subclasshook__'] = TestClass.__subclasshook__ expected['__init_subclass__'] = TestClass.__init_subclass__ - expected['__match__'] = TestClass.__match__ methods = pydoc.allmethods(TestClass) self.assertDictEqual(methods, expected) diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h index afaec9c809e5fb..8c70d76d916db3 100644 --- a/Objects/clinic/typeobject.c.h +++ b/Objects/clinic/typeobject.c.h @@ -243,13 +243,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored)) { return object___dir___impl(self); } - -PyDoc_STRVAR(object___match____doc__, -"__match__($type, target, /)\n" -"--\n" -"\n" -"Match all instances of this type, returning them for further destructuring."); - -#define OBJECT___MATCH___METHODDEF \ - {"__match__", (PyCFunction)object___match__, METH_O|METH_CLASS, object___match____doc__}, -/*[clinic end generated code: output=9fc91a27a50d735d input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b13e9e82e53f95..e614466bcca1b7 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4906,31 +4906,6 @@ object___dir___impl(PyObject *self) return result; } -/*[clinic input] -@classmethod -object.__match__ - - target: object - / - -Match all instances of this type, returning them for further destructuring. -[clinic start generated code]*/ - -static PyObject * -object___match__(PyTypeObject *type, PyObject *target) -/*[clinic end generated code: output=bcea50777819dfeb input=493f4963453b0072]*/ -{ - int match = PyObject_IsInstance(target, (PyObject *)type); - if (match < 0) { - return NULL; - } - if (match) { - Py_INCREF(target); - return target; - } - Py_RETURN_NONE; -} - static PyMethodDef object_methods[] = { OBJECT___REDUCE_EX___METHODDEF OBJECT___REDUCE___METHODDEF @@ -4941,7 +4916,6 @@ static PyMethodDef object_methods[] = { OBJECT___FORMAT___METHODDEF OBJECT___SIZEOF___METHODDEF OBJECT___DIR___METHODDEF - OBJECT___MATCH___METHODDEF {0} }; diff --git a/Python/ceval.c b/Python/ceval.c index b7fc613c6c2416..88ca5df779492b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -908,9 +908,14 @@ get_match_args(PyThreadState *tstate, PyObject *type) } return NULL; } - if (PyList_CheckExact(match_args) || PyTuple_CheckExact(match_args)) { + if (PyTuple_CheckExact(match_args)) { return match_args; } + if (PyList_CheckExact(match_args)) { + PyObject *tuple = PyList_AsTuple(match_args); + Py_DECREF(match_args); + return tuple; + } _PyErr_Format(tstate, PyExc_TypeError, "%s.__match_args__ must be a list or tuple (got %s)", ((PyTypeObject *)type)->tp_name, Py_TYPE(match_args)->tp_name); @@ -932,27 +937,13 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty "called match pattern must be a type"); return NULL; } - PyObject *method = PyObject_GetAttrString(type, "__match__"); - if (!method || method == Py_None) { - Py_XDECREF(method); - _PyErr_Clear(tstate); - _PyErr_Format(tstate, PyExc_TypeError, - "type %s cannot be matched", - ((PyTypeObject *)type)->tp_name); - return NULL; - } - PyObject *proxy = PyObject_CallOneArg(method, target); - Py_DECREF(method); - if (!proxy) { + if (PyObject_IsInstance(target, type) <= 0) { return NULL; } - if (proxy == Py_None) { - return proxy; - } Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); Py_ssize_t nargs = count - nkwargs; match_args = get_match_args(tstate, type); - assert(!match_args || PyList_CheckExact(match_args) || PyTuple_CheckExact(match_args)); + assert(!match_args || PyTuple_CheckExact(match_args)); if (!match_args && _PyErr_Occurred(tstate)) { goto error; } @@ -970,10 +961,8 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty args = NULL; } else { - nmatch_args = PySequence_Fast_GET_SIZE(match_args); - args = PyList_CheckExact(match_args) - ? PyList_GetSlice(match_args, 0, nargs) - : PyTuple_GetSlice(match_args, 0, nargs); + nmatch_args = PyTuple_GET_SIZE(match_args); + args = PyTuple_GetSlice(match_args, 0, nargs); if (!args) { goto error; } @@ -984,7 +973,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); goto error; } - assert(!args || PyList_CheckExact(args) || PyTuple_CheckExact(args)); + assert(!args || PyTuple_CheckExact(args)); attrs = PyTuple_New(count); if (!attrs) { goto error; @@ -998,8 +987,8 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (i < nargs) { if (!args) { assert(!i); - Py_INCREF(proxy); - PyTuple_SET_ITEM(attrs, 0, proxy); + Py_INCREF(target); + PyTuple_SET_ITEM(attrs, 0, target); continue; } name = PyTuple_GET_ITEM(args, i); @@ -1021,7 +1010,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } goto error; } - PyObject *attr = PyObject_GetAttr(proxy, name); + PyObject *attr = PyObject_GetAttr(target, name); if (!attr) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); @@ -1032,13 +1021,11 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } PyTuple_SET_ITEM(attrs, i, attr); } - Py_DECREF(proxy); Py_XDECREF(match_args); Py_XDECREF(args); Py_DECREF(seen); return attrs; error: - Py_DECREF(proxy); Py_XDECREF(match_args); Py_XDECREF(args); Py_XDECREF(seen); @@ -3488,13 +3475,15 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PyObject *target = SECOND(); PyObject *attrs = do_match(tstate, oparg, names, type, target); Py_DECREF(names); - if (!attrs) { + if (attrs) { + Py_DECREF(target); + SET_SECOND(attrs); + } + else if (_PyErr_Occurred(tstate)) { goto error; } + SET_TOP(PyBool_FromLong(!!attrs)); Py_DECREF(type); - Py_DECREF(target); - SET_SECOND(attrs); - SET_TOP(PyBool_FromLong(attrs != Py_None)); DISPATCH(); } From d696de7329afaa9b2420b15add34f6bc0c7b1bf9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 29 Jun 2020 18:57:47 -0700 Subject: [PATCH 110/218] Fix whitespace diff --- Doc/library/exceptions.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index d852ba7c688391..df2cda9d67ad15 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -179,7 +179,6 @@ The following exceptions are the exceptions that are usually raised. .. versionchanged:: 3.3 Added the :attr:`name` and :attr:`path` attributes. - .. exception:: ModuleNotFoundError A subclass of :exc:`ImportError` which is raised by :keyword:`import` From bb8fb1bf024836c84f4a1bf9a860667fabd61e47 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 30 Jun 2020 18:16:20 -0700 Subject: [PATCH 111/218] Clean up tests and fix refleak in mapping patterns --- Lib/test/test_patma.py | 18 +++++++++--------- Python/ceval.c | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 7c25c06c25404d..2937e00da5fa61 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1214,11 +1214,11 @@ def test_patma_133(self) -> None: case {1: 0}: y = 0 case {0: 0}: - y = 0 - case {}: y = 1 + case {}: + y = 2 self.assertEqual(x, {0: 1}) - self.assertEqual(y, 1) + self.assertEqual(y, 2) def test_patma_134(self) -> None: x = collections.defaultdict(int, {0: 1}) @@ -1226,11 +1226,11 @@ def test_patma_134(self) -> None: case {1: 0}: y = 0 case {0: 0}: - y = 0 - case {**z}: y = 1 + case {**z}: + y = 2 self.assertEqual(x, {0: 1}) - self.assertEqual(y, 1) + self.assertEqual(y, 2) self.assertEqual(z, {0: 1}) def test_patma_135(self) -> None: @@ -1239,11 +1239,11 @@ def test_patma_135(self) -> None: case {1: 0}: y = 0 case {0: 0}: - y = 0 - case {0: _, **z}: y = 1 + case {0: _, **z}: + y = 2 self.assertEqual(x, {0: 1}) - self.assertEqual(y, 1) + self.assertEqual(y, 2) self.assertEqual(z, {}) def test_patma_136(self) -> None: diff --git a/Python/ceval.c b/Python/ceval.c index 88ca5df779492b..e80287770b82e1 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -881,7 +881,6 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * if (!value) { goto fail; } - Py_INCREF(value); PyTuple_SET_ITEM(values, i, value); if (copy && PyDict_DelItem(copy, key)) { if (!_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { From 36398b13c06c92e24d17a5c7a7315689501ddae9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 30 Jun 2020 19:10:53 -0700 Subject: [PATCH 112/218] Minor improvements for class matches --- Python/ceval.c | 47 +++++++++++++++++++++++++---------------------- Python/compile.c | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index e80287770b82e1..d71217b8db08f5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -904,6 +904,7 @@ get_match_args(PyThreadState *tstate, PyObject *type) if (!match_args) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); + return PyTuple_New(0); } return NULL; } @@ -923,10 +924,9 @@ get_match_args(PyThreadState *tstate, PyObject *type) } static PyObject * -do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *type, PyObject *target) +do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *target) { // TODO: Break this up! - PyObject *match_args = NULL; PyObject *args = NULL; PyObject *attrs = NULL; PyObject *seen = NULL; @@ -940,13 +940,9 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty return NULL; } Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); - Py_ssize_t nargs = count - nkwargs; - match_args = get_match_args(tstate, type); - assert(!match_args || PyTuple_CheckExact(match_args)); - if (!match_args && _PyErr_Occurred(tstate)) { - goto error; - } + Py_ssize_t count = nargs + nkwargs; Py_ssize_t nmatch_args; + // TODO: Just build attrs in two passes (nargs and nkwargs) if (!nargs) { nmatch_args = 0; args = PyTuple_New(0); @@ -954,17 +950,26 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty goto error; } } - else if (!match_args) { - nmatch_args = PyType_HasFeature((PyTypeObject *)type, - _Py_TPFLAGS_SIMPLE_MATCH); - args = NULL; - } else { - nmatch_args = PyTuple_GET_SIZE(match_args); - args = PyTuple_GetSlice(match_args, 0, nargs); - if (!args) { + PyObject *match_args = get_match_args(tstate, type); + if (!match_args) { goto error; } + assert(PyTuple_CheckExact(match_args)); + nmatch_args = PyTuple_GET_SIZE(match_args); + if (!nmatch_args) { + Py_DECREF(match_args); + nmatch_args = PyType_HasFeature((PyTypeObject *)type, + _Py_TPFLAGS_SIMPLE_MATCH); + args = NULL; + } + else { + args = PyTuple_GetSlice(match_args, 0, nargs); + Py_DECREF(match_args); + if (!args) { + goto error; + } + } } if (nmatch_args < nargs) { _PyErr_Format(tstate, PyExc_TypeError, @@ -981,7 +986,7 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty if (!seen) { goto error; } - PyObject *name; + PyObject *name, *attr; for (Py_ssize_t i = 0; i < count; i++) { if (i < nargs) { if (!args) { @@ -1009,23 +1014,21 @@ do_match(PyThreadState *tstate, Py_ssize_t count, PyObject *kwargs, PyObject *ty } goto error; } - PyObject *attr = PyObject_GetAttr(target, name); + attr = PyObject_GetAttr(target, name); if (!attr) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); - Py_SETREF(attrs, Py_None); + Py_CLEAR(attrs); break; } goto error; } PyTuple_SET_ITEM(attrs, i, attr); } - Py_XDECREF(match_args); Py_XDECREF(args); Py_DECREF(seen); return attrs; error: - Py_XDECREF(match_args); Py_XDECREF(args); Py_XDECREF(seen); Py_XDECREF(attrs); @@ -3489,7 +3492,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(JUMP_IF_NOT_MAP): { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp) { - goto error; + goto error; } if (!interp->map_abc) { PyObject *abc = PyImport_ImportModule("_collections_abc"); diff --git a/Python/compile.c b/Python/compile.c index 5d2d4fc7726f49..855b2c4ff9c382 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2792,7 +2792,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { PyTuple_SET_ITEM(kwnames, i, name); } ADDOP_LOAD_CONST_NEW(c, kwnames); - ADDOP_I(c, MATCH_TYPE, nargs + nkwargs); + ADDOP_I(c, MATCH_TYPE, nargs); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); pattern_context sub_pc = *pc; sub_pc.failure = block; From 82055e2a492dfb4f956ab07f0324b04f2ca4e0e3 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 1 Jul 2020 08:10:44 -0700 Subject: [PATCH 113/218] Mapping destructuring improvements --- Python/ceval.c | 126 ++++++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 48 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index d71217b8db08f5..ad784d4a61f01a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -848,14 +848,24 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: static PyObject* -match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject *copy) +match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) { assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); - PyObject *seen = NULL; - PyObject *values = NULL; - if (PyMapping_Length(map) < nkeys) { - goto fail; + if (!nkeys) { + return PyTuple_New(0); + } + PyObject *get = NULL, *dummy = NULL, *seen = NULL, *values = NULL; + if (!PyDict_CheckExact(map)) { + _Py_IDENTIFIER(get); + get = _PyObject_GetAttrId(map, &PyId_get); + if (!get) { + return NULL; + } + dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); + if (!dummy) { + goto fail; + } } seen = PyList_New(0); if (!seen) { @@ -865,8 +875,9 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * if (!values) { goto fail; } + PyObject *key, *value; for (Py_ssize_t i = 0; i < nkeys; i++) { - PyObject *key = PyTuple_GET_ITEM(keys, i); + key = PyTuple_GET_ITEM(keys, i); if (PySequence_Contains(seen, key) || PyList_Append(seen, key)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_ValueError, @@ -874,29 +885,67 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys, PyObject * } goto fail; } - if (!PySequence_Contains(map, key)) { - goto fail; - } - PyObject *value = PyObject_GetItem(map, key); - if (!value) { - goto fail; + if (!get) { + assert(PyDict_CheckExact(map)); + value = PyDict_GetItemWithError(map, key); + if (!value) { + goto fail; + } + Py_INCREF(value); } - PyTuple_SET_ITEM(values, i, value); - if (copy && PyDict_DelItem(copy, key)) { - if (!_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { + else { + assert(dummy); + value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); + if (!value || value == dummy) { + Py_XDECREF(value); goto fail; } - _PyErr_Clear(tstate); } + PyTuple_SET_ITEM(values, i, value); } + Py_XDECREF(get); + Py_XDECREF(dummy); Py_DECREF(seen); return values; fail: + Py_XDECREF(get); + Py_XDECREF(dummy); Py_XDECREF(seen); Py_XDECREF(values); return NULL; } +static PyObject * +match_map_copy(PyThreadState *tstate, PyObject *map, PyObject *keys) +{ + PyObject *copy; + if (PyDict_CheckExact(map)) { + copy = PyDict_Copy(map); + if (!copy) { + return NULL; + } + } + else { + copy = PyDict_New(); + if (!copy || PyDict_Update(copy, map)) { + Py_XDECREF(copy); + return NULL; + } + } + Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); + for (Py_ssize_t i = 0; i < nkeys; i++) { + if (PyDict_DelItem(copy, PyTuple_GET_ITEM(keys, i))) { + if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { + _PyErr_Clear(tstate); + continue; + } + Py_DECREF(copy); + return NULL; + } + } + return copy; +} + static PyObject * get_match_args(PyThreadState *tstate, PyObject *type) { @@ -927,18 +976,18 @@ static PyObject * do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *target) { // TODO: Break this up! - PyObject *args = NULL; - PyObject *attrs = NULL; - PyObject *seen = NULL; - assert(PyTuple_CheckExact(kwargs)); if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, - "called match pattern must be a type"); + "called match pattern must be a type"); return NULL; } + assert(PyTuple_CheckExact(kwargs)); if (PyObject_IsInstance(target, type) <= 0) { return NULL; } + PyObject *args = NULL; + PyObject *attrs = NULL; + PyObject *seen = NULL; Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); Py_ssize_t count = nargs + nkwargs; Py_ssize_t nmatch_args; @@ -3491,9 +3540,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(JUMP_IF_NOT_MAP): { PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - goto error; - } if (!interp->map_abc) { PyObject *abc = PyImport_ImportModule("_collections_abc"); if (!abc) { @@ -3526,9 +3572,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp) { - goto error; - } if (!interp->seq_abc) { PyObject *abc = PyImport_ImportModule("_collections_abc"); if (!abc) { @@ -3553,28 +3596,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_KEYS): { PyObject *keys = TOP(); PyObject *target = SECOND(); - PyObject *copy = NULL; - if (oparg) { - if (PyDict_CheckExact(target)) { - copy = PyDict_Copy(target); - if (!copy) { - return NULL; - } - } - else { - copy = PyDict_New(); - if (!copy || PyDict_Update(copy, target)) { - Py_XDECREF(copy); - return NULL; - } - } - } - PyObject *values = match_map_items(tstate, target, keys, copy); + PyObject *values = match_map_items(tstate, target, keys); if (!values) { if (_PyErr_Occurred(tstate)) { goto error; } - Py_XDECREF(copy); Py_INCREF(Py_None); SET_TOP(Py_None); Py_DECREF(keys); @@ -3582,12 +3608,16 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PUSH(Py_False); DISPATCH(); } - SET_TOP(values); - Py_DECREF(keys); if (oparg) { - SET_SECOND(copy); + PyObject *rest = match_map_copy(tstate, target, keys); + if (!rest) { + goto error; + } + SET_SECOND(rest); Py_DECREF(target); } + SET_TOP(values); + Py_DECREF(keys); Py_INCREF(Py_True); PUSH(Py_True); DISPATCH(); From c9b3b4e0d7991e52b2e09b296c471cac3e0c2ecc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 2 Jul 2020 12:23:39 -0700 Subject: [PATCH 114/218] Use tuple for dataclass __match_args__ --- Lib/dataclasses.py | 2 +- Lib/test/test_dataclasses.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 51c5059392b145..730a6390d5424c 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -1005,7 +1005,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen): match_args = cls.__dict__.get('__match_args__', MISSING) if match_args is MISSING: # Create a __match_args__ attribute. - _set_new_attribute(cls, '__match_args__', [f.name for f in flds if f.init]) + _set_new_attribute(cls, '__match_args__', tuple(f.name for f in flds if f.init)) return cls diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index 186f6aa3c21869..81c3ec1e37814b 100644 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -3339,7 +3339,7 @@ class B: x: int o = B(4) - self.assertEqual(o.__match_args__, ['x']) + self.assertEqual(o.__match_args__, ('x',)) def test_explicit_match_args(self): @dataclass From 793add3911abed838c1d8cf3b0104dfe51d26e52 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 2 Jul 2020 12:24:21 -0700 Subject: [PATCH 115/218] Add tests for new match grammar --- Lib/test/test_patma.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2937e00da5fa61..8616b1e38ba46a 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1392,6 +1392,38 @@ def test_patma_150(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) + def test_patma_151(self) -> None: + x = 0 + match x,: + case y,: + z = 0 + self.assertEqual(x, 0) + self.assertIs(y, x) + self.assertIs(z, 0) + + def test_patma_152(self) -> None: + w = 0 + x = 0 + match w, x: + case y, z: + v = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertIs(y, w) + self.assertIs(z, x) + self.assertEqual(v, 0) + + def test_patma_152(self) -> None: + x = 0 + match w := x,: + case v := y,: + z = 0 + self.assertEqual(x, 0) + self.assertIs(y, x) + self.assertEqual(z, 0) + self.assertIs(w, x) + self.assertIs(v, y) + def run_perf(self): # ./python -m pyperf timeit -s "from test.test_patma import TestMatch; t = TestMatch()" "t.run_perf()" attrs = vars(type(self)).items() From 4efdb9a39152d4d24da8a6dcad18c2d381aa65e1 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 2 Jul 2020 12:24:54 -0700 Subject: [PATCH 116/218] Clean up compile.c and add SyntaxWarning --- Python/compile.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 855b2c4ff9c382..5042c23acad8e9 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -176,10 +176,6 @@ struct compiler { }; typedef struct { - // Py_ssize_t map_len_ge; - // Py_ssize_t seq_len_ge; - // Py_ssize_t seq_len_eq; - // basicblock *success; basicblock *failure; PyObject* stores; } pattern_context; @@ -2754,7 +2750,8 @@ compiler_if(struct compiler *c, stmt_ty s) } #define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && (N)->v.Name.ctx == Store && _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + ((N)->kind == Name_kind && (N)->v.Name.ctx == Store && \ + _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) @@ -2831,7 +2828,8 @@ compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc, int w assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { if (!wildcard_ok) { - return compiler_error(c, "can't assign to '_' here; consider removing or renaming?"); + return compiler_error(c, + "can't assign to '_' here; consider removing or renaming?"); } ADDOP(c, POP_TOP); return 1; @@ -3084,6 +3082,7 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) SET_LOC(c, p); switch (p->kind) { case Attribute_kind: + case Constant_kind: return compiler_pattern_load(c, p, pc); case BinOp_kind: // Because we allow "2+2j", things like "2+2" make it this far: @@ -3092,21 +3091,18 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_pattern_or(c, p, pc); case Call_kind: return compiler_pattern_call(c, p, pc); - case Constant_kind: - return compiler_pattern_load(c, p, pc); case Dict_kind: return compiler_pattern_mapping(c, p, pc); case JoinedStr_kind: // Because we allow strings, f-strings make it this far: return compiler_error(c, "patterns cannot include f-strings"); case List_kind: + case Tuple_kind: return compiler_pattern_sequence(c, p, pc); case Name_kind: return compiler_pattern_name(c, p, pc); case NamedExpr_kind: return compiler_pattern_namedexpr(c, p, pc); - case Tuple_kind: - return compiler_pattern_sequence(c, p, pc); default: Py_UNREACHABLE(); } @@ -3116,29 +3112,33 @@ static int compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.target); - basicblock *next, *end; + basicblock *end; CHECK(end = compiler_new_block(c)); + int warned = 0; Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); + pattern_context pc; + CHECK(pc.stores = PySet_New(NULL)); for (Py_ssize_t i = 0; i < cases; i++) { match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); - CHECK(next = compiler_new_block(c)); + CHECK(pc.failure = compiler_new_block(c)); if (i != cases - 1) { ADDOP(c, DUP_TOP); } - PyObject* names = PySet_New(NULL); - if (!names) { - return 0; + if (!warned && i != cases - 1 && !m->guard + && m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store) + { + warned = 1; + CHECK(compiler_warn(c, "unguarded name capture pattern makes " + "remaining cases unreachable; did you " + "forget a leading dot?")); } - pattern_context pc; - pc.failure = next; - pc.stores = names; int result = compiler_pattern(c, m->pattern, &pc); - Py_DECREF(names); + PySet_Clear(pc.stores); CHECK(result); if (m->guard) { - CHECK(compiler_jump_if(c, m->guard, next, 0)); + CHECK(compiler_jump_if(c, m->guard, pc.failure, 0)); } if (i != cases - 1) { ADDOP(c, POP_TOP); @@ -3147,8 +3147,9 @@ compiler_match(struct compiler *c, stmt_ty s) if (i != cases - 1) { ADDOP_JREL(c, JUMP_FORWARD, end); } - compiler_use_next_block(c, next); + compiler_use_next_block(c, pc.failure); } + Py_DECREF(pc.stores); compiler_use_next_block(c, end); return 1; } From 46f33506e562e39675605f8fdb01f1e0fe036194 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 2 Jul 2020 19:07:44 -0700 Subject: [PATCH 117/218] Clean up compiler --- Python/compile.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 5042c23acad8e9..0d326d3788e29b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2781,7 +2781,6 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { VISIT(c, expr, func); PyObject *kwnames; CHECK(kwnames = PyTuple_New(nkwargs)); - // TODO: Catch colliding keywords. Py_ssize_t i; for (i = 0; i < nkwargs; i++) { PyObject *name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; @@ -2823,16 +2822,12 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { } static int -compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc, int wildcard_ok) { +compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { - if (!wildcard_ok) { - return compiler_error(c, - "can't assign to '_' here; consider removing or renaming?"); - } - ADDOP(c, POP_TOP); - return 1; + return compiler_error(c, "can't assign to '_' here; " + "consider removing or renaming?"); } if (PySet_Contains(pc->stores, p->v.Name.id)) { // TODO: Format this error message with the name. @@ -2888,7 +2883,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP(c, POP_TOP); if (star) { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), pc, 0)); + CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), pc)); } else { ADDOP(c, POP_TOP); @@ -2911,7 +2906,11 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) if (p->v.Name.ctx == Load) { return compiler_pattern_load(c, p, pc); } - return compiler_pattern_store(c, p, pc, 1); + if (WILDCARD_CHECK(p)) { + ADDOP(c, POP_TOP); + return 1; + } + return compiler_pattern_store(c, p, pc); } static int @@ -2925,7 +2924,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) pattern_context sub_pc = *pc; sub_pc.failure = block; CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc)); - CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc, 0)); + CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); ADDOP(c, POP_TOP); @@ -3119,20 +3118,23 @@ compiler_match(struct compiler *c, stmt_ty s) assert(cases); pattern_context pc; CHECK(pc.stores = PySet_New(NULL)); + int last = 0; for (Py_ssize_t i = 0; i < cases; i++) { + if (i == cases - 1) { + last = 1; + } match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); CHECK(pc.failure = compiler_new_block(c)); - if (i != cases - 1) { + if (!last) { ADDOP(c, DUP_TOP); } - if (!warned && i != cases - 1 && !m->guard + if (!warned && !last && !m->guard && m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store) { warned = 1; CHECK(compiler_warn(c, "unguarded name capture pattern makes " - "remaining cases unreachable; did you " - "forget a leading dot?")); + "remaining cases unreachable")); } int result = compiler_pattern(c, m->pattern, &pc); PySet_Clear(pc.stores); @@ -3140,11 +3142,11 @@ compiler_match(struct compiler *c, stmt_ty s) if (m->guard) { CHECK(compiler_jump_if(c, m->guard, pc.failure, 0)); } - if (i != cases - 1) { + if (!last) { ADDOP(c, POP_TOP); } VISIT_SEQ(c, stmt, m->body); - if (i != cases - 1) { + if (!last) { ADDOP_JREL(c, JUMP_FORWARD, end); } compiler_use_next_block(c, pc.failure); From 9b343b73cb9b4406a90afdefa97e0d25d3094608 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 3 Jul 2020 13:51:38 -0700 Subject: [PATCH 118/218] Progress on reducing the number of blocks --- Python/compile.c | 64 +++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 0d326d3788e29b..c68001e646bd80 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2761,7 +2761,6 @@ compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind != Name_kind || p->v.Name.ctx == Load); VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, pc->failure); return 1; } @@ -2789,7 +2788,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { } ADDOP_LOAD_CONST_NEW(c, kwnames); ADDOP_I(c, MATCH_TYPE, nargs); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); pattern_context sub_pc = *pc; sub_pc.failure = block; for (i = 0; i < nargs; i++) { @@ -2801,6 +2800,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, arg, &sub_pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } for (i = 0; i < nkwargs; i++) { keyword_ty kwarg = asdl_seq_GET(kwargs, i); @@ -2811,13 +2811,12 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, kwarg->value, &sub_pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, pc->failure); + ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); return 1; } @@ -2833,13 +2832,16 @@ compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc) { // TODO: Format this error message with the name. return compiler_error(c, "multiple assignments to name in pattern"); } + CHECK(!PySet_Add(pc->stores, p->v.Name.id)); VISIT(c, expr, p); - return !PySet_Add(pc->stores, p->v.Name.id); + ADDOP_LOAD_CONST(c, Py_True); + return 1; } static int compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) { + // TODO: We shouldn't need 3 cleanup blocks. Make things more uniform basicblock *block, *block_star, *end; CHECK(block_star = compiler_new_block(c)); CHECK(block = compiler_new_block(c)); @@ -2848,7 +2850,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP_JREL(c, JUMP_IF_NOT_MAP, block); + ADDOP_JREL(c, JUMP_IF_NOT_MAP, block); // TODO: Refactor to ditch block. if (size - star) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); @@ -2868,7 +2870,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star) + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star); pattern_context sub_pc = *pc; sub_pc.failure = block_star; for (i = 0; i < size - star; i++) { @@ -2880,6 +2882,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); CHECK(compiler_pattern(c, value, &sub_pc)); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star); } ADDOP(c, POP_TOP); if (star) { @@ -2887,13 +2890,15 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } else { ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_True); } ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block_star); ADDOP(c, POP_TOP); compiler_use_next_block(c, block); + ADDOP_LOAD_CONST(c, Py_False); + ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } @@ -2908,6 +2913,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) } if (WILDCARD_CHECK(p)) { ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_True); return 1; } return compiler_pattern_store(c, p, pc); @@ -2920,15 +2926,16 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, DUP_TOP); pattern_context sub_pc = *pc; sub_pc.failure = block; + ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc)); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); + ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, pc->failure); compiler_use_next_block(c, end); return 1; } @@ -2938,7 +2945,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == BoolOp_kind); assert(p->v.BoolOp.op == Or); - basicblock *block, *end; + basicblock *end; PyObject *control = NULL; CHECK(end = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); @@ -2946,15 +2953,11 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) PyObject *names_copy; for (Py_ssize_t i = 0; i < size; i++) { CHECK(names_copy = PySet_New(pc->stores)); - CHECK(block = compiler_new_block(c)); ADDOP(c, DUP_TOP); pattern_context sub_pc = *pc; - sub_pc.failure = block; sub_pc.stores = names_copy; CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), &sub_pc)); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); + ADDOP_JABS(c, JUMP_IF_TRUE_OR_POP, end); // TODO: Reuse names_copy without actually building a new copy each loop? if (!i) { control = names_copy; @@ -2981,9 +2984,10 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) } assert(control); Py_DECREF(control); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, pc->failure); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); return 1; } @@ -3007,20 +3011,20 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP_JREL(c, JUMP_IF_NOT_SEQ, block); + ADDOP_JREL(c, JUMP_IF_NOT_SEQ, block); // TODO: Refactor to ditch block. if (star >= 0) { if (size) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } } else { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } pattern_context sub_pc = *pc; sub_pc.failure = block; @@ -3065,13 +3069,15 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, BINARY_SUBSCR); } CHECK(compiler_pattern(c, value, &sub_pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } - ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_True); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_JREL(c, JUMP_FORWARD, pc->failure); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); return 1; } @@ -3119,11 +3125,12 @@ compiler_match(struct compiler *c, stmt_ty s) pattern_context pc; CHECK(pc.stores = PySet_New(NULL)); int last = 0; + match_case_ty m; for (Py_ssize_t i = 0; i < cases; i++) { if (i == cases - 1) { last = 1; } - match_case_ty m = asdl_seq_GET(s->v.Match.cases, i); + m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); CHECK(pc.failure = compiler_new_block(c)); if (!last) { @@ -3139,6 +3146,7 @@ compiler_match(struct compiler *c, stmt_ty s) int result = compiler_pattern(c, m->pattern, &pc); PySet_Clear(pc.stores); CHECK(result); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, pc.failure); if (m->guard) { CHECK(compiler_jump_if(c, m->guard, pc.failure, 0)); } From a4fd8a32ff8e6935bed083f22db628bbbff27300 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 3 Jul 2020 16:25:40 -0700 Subject: [PATCH 119/218] Simplify emitted bytecode --- Doc/library/dis.rst | 38 ++++----- Include/opcode.h | 6 +- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 6 +- Python/ceval.c | 45 +++++----- Python/compile.c | 121 ++++++++++++--------------- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 10 +-- Python/peephole.c | 4 - 9 files changed, 107 insertions(+), 129 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 86d999006f4e49..361eec0a5696f9 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -753,7 +753,24 @@ iterations of the loop. .. opcode:: GET_LEN - Pushes ``len(TOS)`` onto the stack. + Push ``len(TOS)`` onto the stack. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_MAPPING + + If TOS is an instance of :class:`collections.abc.Mapping`, push ``True`` onto + the stack. Otherwise, push ``False``. + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_SEQUENCE + + If TOS is an instance of :class:`collections.abc.Sequence`, is not an + instance of :class:`string`/:class:`bytes`/:class:`bytearray`, and is not an + :term:`iterator`, push ``True`` onto the stack. Otherwise, push ``False``. .. versionadded:: 3.10 @@ -1196,30 +1213,13 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: MATCH_TYPE (count) +.. opcode:: MATCH_CLASS (count) TODO .. versionadded:: 3.10 -.. opcode:: JUMP_IF_NOT_MAP (delta) - - If TOS is not an instance of :class:`collections.abc.Mapping`, increment the - bytecode counter by *delta*. - - .. versionadded:: 3.10 - - -.. opcode:: JUMP_IF_NOT_SEQ (delta) - - If TOS is an instance of :class:`string`/:class:`bytes`/:class:`bytearray`, - is an :term:`iterator`, or is not an instance of - :class:`collections.abc.Sequence`, increment the bytecode counter by *delta*. - - .. versionadded:: 3.10 - - .. opcode:: MATCH_KEYS (copy) TODO diff --git a/Include/opcode.h b/Include/opcode.h index af7fe4afc22201..24a21dc86b590a 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -31,6 +31,8 @@ extern "C" { #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 #define GET_LEN 30 +#define MATCH_MAPPING 31 +#define MATCH_SEQUENCE 32 #define RERAISE 48 #define WITH_EXCEPT_START 49 #define GET_AITER 50 @@ -118,10 +120,8 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 -#define MATCH_TYPE 149 +#define MATCH_CLASS 149 #define MATCH_KEYS 150 -#define JUMP_IF_NOT_MAP 151 -#define JUMP_IF_NOT_SEQ 152 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 3f01712bd665d8..17de85a43e8b39 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3463 (add structural pattern matching) +# Python 3.10a0 3464 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3463).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3464).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 751d56a4ca6f29..e0ef77ea5e51f8 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -82,6 +82,8 @@ def jabs_op(name, op): def_op('INPLACE_FLOOR_DIVIDE', 28) def_op('INPLACE_TRUE_DIVIDE', 29) def_op('GET_LEN', 30) +def_op('MATCH_MAPPING', 31) +def_op('MATCH_SEQUENCE', 32) def_op('RERAISE', 48) def_op('WITH_EXCEPT_START', 49) @@ -193,10 +195,8 @@ def jabs_op(name, op): def_op('MAP_ADD', 147) def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('MATCH_TYPE', 149) +def_op('MATCH_CLASS', 149) def_op('MATCH_KEYS', 150) -jrel_op('JUMP_IF_NOT_MAP', 151) -jrel_op('JUMP_IF_NOT_SEQ', 152) jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) diff --git a/Python/ceval.c b/Python/ceval.c index ad784d4a61f01a..57c6f74b1f64ee 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3520,7 +3520,21 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) #endif } - case TARGET(MATCH_TYPE): { + case TARGET(GET_LEN): { + PyObject *target = TOP(); + Py_ssize_t l = PyObject_Length(target); + if (l < 0) { + goto error; + } + PyObject *len = PyLong_FromSsize_t(l); + if (!len) { + goto error; + } + PUSH(len); + DISPATCH(); + } + + case TARGET(MATCH_CLASS): { PyObject *names = POP(); PyObject *type = TOP(); PyObject *target = SECOND(); @@ -3538,7 +3552,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(JUMP_IF_NOT_MAP): { + case TARGET(MATCH_MAPPING): { PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp->map_abc) { PyObject *abc = PyImport_ImportModule("_collections_abc"); @@ -3555,20 +3569,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - if (!match) { - JUMPBY(oparg); - } + PUSH(PyBool_FromLong(match)); DISPATCH(); } - case TARGET(JUMP_IF_NOT_SEQ): { + case TARGET(MATCH_SEQUENCE): { PyObject *target = TOP(); if (PyType_FastSubclass(Py_TYPE(target), Py_TPFLAGS_BYTES_SUBCLASS | Py_TPFLAGS_UNICODE_SUBCLASS) || PyIter_Check(target) || PyByteArray_Check(target)) { - JUMPBY(oparg); + Py_INCREF(Py_False); + PUSH(Py_False); DISPATCH(); } PyInterpreterState *interp = PyInterpreterState_Get(); @@ -3587,9 +3600,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (match < 0) { goto error; } - if (!match) { - JUMPBY(oparg); - } + PUSH(PyBool_FromLong(match)); DISPATCH(); } @@ -3623,20 +3634,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(GET_LEN): { - PyObject *target = TOP(); - Py_ssize_t l = PyObject_Length(target); - if (l < 0) { - goto error; - } - PyObject *len = PyLong_FromSsize_t(l); - if (!len) { - goto error; - } - PUSH(len); - DISPATCH(); - } - case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index c68001e646bd80..b12037bfd97b3c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -176,7 +176,6 @@ struct compiler { }; typedef struct { - basicblock *failure; PyObject* stores; } pattern_context; @@ -225,7 +224,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); +static int compiler_pattern(struct compiler *, expr_ty, pattern_context); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -1106,14 +1105,14 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; - case MATCH_TYPE: + case GET_LEN: + return 1; + case MATCH_CLASS: return -1; case MATCH_KEYS: - case GET_LEN: + case MATCH_MAPPING: + case MATCH_SEQUENCE: return 1; - case JUMP_IF_NOT_MAP: - case JUMP_IF_NOT_SEQ: - return 0; default: return PY_INVALID_STACK_EFFECT; } @@ -2754,7 +2753,7 @@ compiler_if(struct compiler *c, stmt_ty s) _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int -compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); @@ -2765,7 +2764,7 @@ compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { +compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { asdl_seq *args = p->v.Call.args; asdl_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); @@ -2787,10 +2786,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { PyTuple_SET_ITEM(kwnames, i, name); } ADDOP_LOAD_CONST_NEW(c, kwnames); - ADDOP_I(c, MATCH_TYPE, nargs); + ADDOP_I(c, MATCH_CLASS, nargs); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); - pattern_context sub_pc = *pc; - sub_pc.failure = block; for (i = 0; i < nargs; i++) { expr_ty arg = asdl_seq_GET(args, i); if (WILDCARD_CHECK(arg)) { @@ -2799,7 +2796,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, arg, &sub_pc)); + CHECK(compiler_pattern(c, arg, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } for (i = 0; i < nkwargs; i++) { @@ -2810,7 +2807,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, kwarg->value, &sub_pc)); + CHECK(compiler_pattern(c, kwarg->value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } ADDOP_LOAD_CONST(c, Py_True); @@ -2821,41 +2818,40 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { } static int -compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context *pc) { +compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { return compiler_error(c, "can't assign to '_' here; " "consider removing or renaming?"); } - if (PySet_Contains(pc->stores, p->v.Name.id)) { + if (PySet_Contains(pc.stores, p->v.Name.id)) { // TODO: Format this error message with the name. return compiler_error(c, "multiple assignments to name in pattern"); } - CHECK(!PySet_Add(pc->stores, p->v.Name.id)); + CHECK(!PySet_Add(pc.stores, p->v.Name.id)); VISIT(c, expr, p); ADDOP_LOAD_CONST(c, Py_True); return 1; } static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context pc) { - // TODO: We shouldn't need 3 cleanup blocks. Make things more uniform - basicblock *block, *block_star, *end; - CHECK(block_star = compiler_new_block(c)); + basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); asdl_seq *keys = p->v.Dict.keys; asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP_JREL(c, JUMP_IF_NOT_MAP, block); // TODO: Refactor to ditch block. + ADDOP(c, MATCH_MAPPING); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); if (size - star) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } Py_ssize_t i; for (i = 0; i < size - star; i++) { @@ -2870,9 +2866,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star); - pattern_context sub_pc = *pc; - sub_pc.failure = block_star; + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { @@ -2881,8 +2875,8 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); - CHECK(compiler_pattern(c, value, &sub_pc)); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block_star); + CHECK(compiler_pattern(c, value, pc)); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } ADDOP(c, POP_TOP); if (star) { @@ -2893,24 +2887,22 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST(c, Py_True); } ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block_star); - ADDOP(c, POP_TOP); compiler_use_next_block(c, block); - ADDOP_LOAD_CONST(c, Py_False); - ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } static int -compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Load || p->v.Name.ctx == Store); if (p->v.Name.ctx == Load) { return compiler_pattern_load(c, p, pc); } + assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); @@ -2920,16 +2912,14 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == NamedExpr_kind); basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - pattern_context sub_pc = *pc; - sub_pc.failure = block; ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, &sub_pc)); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc)); ADDOP_JREL(c, JUMP_FORWARD, end); @@ -2941,7 +2931,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == BoolOp_kind); assert(p->v.BoolOp.op == Or); @@ -2952,11 +2942,12 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) assert(size > 1); PyObject *names_copy; for (Py_ssize_t i = 0; i < size; i++) { - CHECK(names_copy = PySet_New(pc->stores)); + CHECK(names_copy = PySet_New(pc.stores)); ADDOP(c, DUP_TOP); - pattern_context sub_pc = *pc; + // TODO: Just modify pc instead. + pattern_context sub_pc = pc; sub_pc.stores = names_copy; - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), &sub_pc)); + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), sub_pc)); ADDOP_JABS(c, JUMP_IF_TRUE_OR_POP, end); // TODO: Reuse names_copy without actually building a new copy each loop? if (!i) { @@ -2992,7 +2983,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; @@ -3008,26 +2999,22 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) } star = i; } - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); + basicblock *end; CHECK(end = compiler_new_block(c)); - ADDOP_JREL(c, JUMP_IF_NOT_SEQ, block); // TODO: Refactor to ditch block. - if (star >= 0) { - if (size) { - ADDOP(c, GET_LEN); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); - ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); - } - } - else { + ADDOP(c, MATCH_SEQUENCE); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + if (star < 0) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } - pattern_context sub_pc = *pc; - sub_pc.failure = block; + else if (size) { + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); + ADDOP_COMPARE(c, GtE); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + } for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { @@ -3068,13 +3055,10 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - i))); ADDOP(c, BINARY_SUBSCR); } - CHECK(compiler_pattern(c, value, &sub_pc)); + CHECK(compiler_pattern(c, value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } ADDOP_LOAD_CONST(c, Py_True); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); @@ -3082,7 +3066,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) } static int -compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern(struct compiler *c, expr_ty p, pattern_context pc) { SET_LOC(c, p); switch (p->kind) { @@ -3117,7 +3101,7 @@ static int compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.target); - basicblock *end; + basicblock *next, *end; CHECK(end = compiler_new_block(c)); int warned = 0; Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); @@ -3126,13 +3110,14 @@ compiler_match(struct compiler *c, stmt_ty s) CHECK(pc.stores = PySet_New(NULL)); int last = 0; match_case_ty m; + // TODO: Leaks pc.stores on failure. for (Py_ssize_t i = 0; i < cases; i++) { if (i == cases - 1) { last = 1; } m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); - CHECK(pc.failure = compiler_new_block(c)); + CHECK(next = compiler_new_block(c)); if (!last) { ADDOP(c, DUP_TOP); } @@ -3143,12 +3128,12 @@ compiler_match(struct compiler *c, stmt_ty s) CHECK(compiler_warn(c, "unguarded name capture pattern makes " "remaining cases unreachable")); } - int result = compiler_pattern(c, m->pattern, &pc); + int result = compiler_pattern(c, m->pattern, pc); PySet_Clear(pc.stores); CHECK(result); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, pc.failure); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); if (m->guard) { - CHECK(compiler_jump_if(c, m->guard, pc.failure, 0)); + CHECK(compiler_jump_if(c, m->guard, next, 0)); } if (!last) { ADDOP(c, POP_TOP); @@ -3157,7 +3142,7 @@ compiler_match(struct compiler *c, stmt_ty s) if (!last) { ADDOP_JREL(c, JUMP_FORWARD, end); } - compiler_use_next_block(c, pc.failure); + compiler_use_next_block(c, next); } Py_DECREF(pc.stores); compiler_use_next_block(c, end); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index d09ff89aa4022b..f96f2c5d782bc6 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,135,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,136,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 4c6721c6d212a2..d877d6b0697880 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -30,8 +30,8 @@ static void *opcode_targets[256] = { &&TARGET_INPLACE_FLOOR_DIVIDE, &&TARGET_INPLACE_TRUE_DIVIDE, &&TARGET_GET_LEN, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_MAPPING, + &&TARGET_MATCH_SEQUENCE, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -148,10 +148,10 @@ static void *opcode_targets[256] = { &&TARGET_SET_ADD, &&TARGET_MAP_ADD, &&TARGET_LOAD_CLASSDEREF, - &&TARGET_MATCH_TYPE, + &&TARGET_MATCH_CLASS, &&TARGET_MATCH_KEYS, - &&TARGET_JUMP_IF_NOT_MAP, - &&TARGET_JUMP_IF_NOT_SEQ, + &&_unknown_opcode, + &&_unknown_opcode, &&_unknown_opcode, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, diff --git a/Python/peephole.c b/Python/peephole.c index a744b2087016c3..fe67de42227b5b 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -198,8 +198,6 @@ markblocks(_Py_CODEUNIT *code, Py_ssize_t len) case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case JUMP_IF_NOT_MAP: - case JUMP_IF_NOT_SEQ: j = GETJUMPTGT(code, i); assert(j < len); blocks[j] = 1; @@ -504,8 +502,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_FINALLY: case SETUP_WITH: case SETUP_ASYNC_WITH: - case JUMP_IF_NOT_MAP: - case JUMP_IF_NOT_SEQ: j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1; j *= sizeof(_Py_CODEUNIT); break; From b642e083da2d1511145abb576c17998e36e5cef1 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sat, 4 Jul 2020 19:22:13 +0100 Subject: [PATCH 120/218] Implement __match_args__ for AST classes --- Lib/test/test_ast.py | 1 + Parser/asdl_c.py | 5 ++++- Python/Python-ast.c | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 78e4a5653d4efd..1d97195eea82fc 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -271,6 +271,7 @@ def _assertTrueorder(self, ast_node, parent_pos): self._assertTrueorder(child, first_pos) elif value is not None: self._assertTrueorder(value, parent_pos) + self.assertEqual(ast_node._fields, ast_node.__match_args__) def test_AST_objects(self): x = ast.AST() diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index b93906ba8d45d8..9e357ddd6b72d1 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -833,9 +833,10 @@ def visitModule(self, mod): } PyTuple_SET_ITEM(fnames, i, field); } - result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}", + result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}", type, base, state->_fields, fnames, + state->__match_args__, fnames, state->__module__, state->ast, state->__doc__, doc); @@ -966,6 +967,7 @@ def visitModule(self, mod): empty_tuple = PyTuple_New(0); if (!empty_tuple || PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 || + PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 || PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) { Py_XDECREF(empty_tuple); return -1; @@ -1351,6 +1353,7 @@ def generate_module_def(f, mod): state_strings = { "ast", "_fields", + "__match_args__", "__doc__", "__dict__", "__module__", diff --git a/Python/Python-ast.c b/Python/Python-ast.c index f852f1eb80e7fa..44bdd80ec9f8d9 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -134,6 +134,7 @@ typedef struct { PyObject *Yield_type; PyObject *__dict__; PyObject *__doc__; + PyObject *__match_args__; PyObject *__module__; PyObject *_attributes; PyObject *_fields; @@ -389,6 +390,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(state->Yield_type); Py_CLEAR(state->__dict__); Py_CLEAR(state->__doc__); + Py_CLEAR(state->__match_args__); Py_CLEAR(state->__module__); Py_CLEAR(state->_attributes); Py_CLEAR(state->_fields); @@ -614,6 +616,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(state->Yield_type); Py_VISIT(state->__dict__); Py_VISIT(state->__doc__); + Py_VISIT(state->__match_args__); Py_VISIT(state->__module__); Py_VISIT(state->_attributes); Py_VISIT(state->_fields); @@ -718,6 +721,7 @@ static int init_identifiers(astmodulestate *state) { if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return 0; if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return 0; + if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return 0; if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return 0; if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return 0; if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return 0; @@ -1313,9 +1317,10 @@ make_type(astmodulestate *state, const char *type, PyObject* base, } PyTuple_SET_ITEM(fnames, i, field); } - result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}", + result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}", type, base, state->_fields, fnames, + state->__match_args__, fnames, state->__module__, state->ast, state->__doc__, doc); @@ -1446,6 +1451,7 @@ static int add_ast_fields(astmodulestate *state) empty_tuple = PyTuple_New(0); if (!empty_tuple || PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 || + PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 || PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) { Py_XDECREF(empty_tuple); return -1; From e39b3e2cccd63716e944516bc2bd730907700886 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 4 Jul 2020 20:20:08 -0700 Subject: [PATCH 121/218] No more leading dots --- Grammar/python.gram | 3 +- Lib/test/test_patma.py | 17 +- Parser/parser.c | 2441 +++++++++++++++++++--------------------- Python/compile.c | 10 +- 4 files changed, 1179 insertions(+), 1292 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 5115c5ca0ae6f0..1b9e9fbbbfa3d7 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -244,8 +244,7 @@ literal_pattern[expr_ty]: | 'True' { _Py_Constant(Py_True, NULL, EXTRA) } | 'False' { _Py_Constant(Py_False, NULL, EXTRA) } constant_pattern[expr_ty]: - | '.' name=NAME !('.' | '(' | '=') { name } - | '.'? attr=attr !('.' | '(' | '=') { attr } + | attr=attr !('.' | '(' | '=') { attr } group_pattern[expr_ty]: | '(' pattern=patterns ')' { pattern } sequence_pattern[expr_ty]: diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 8616b1e38ba46a..75a93e8ea8ba10 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -63,13 +63,14 @@ def test_patma_007(self) -> None: def test_patma_008(self) -> None: x = 0 - y = 1 + class A: + y = 1 z = None match x: - case z := .y: + case z := A.y: pass self.assertEqual(x, 0) - self.assertEqual(y, 1) + self.assertEqual(A.y, 1) self.assertEqual(z, None) def test_patma_009(self) -> None: @@ -78,7 +79,7 @@ class A: match 0: case x if x: z = 0 - case y := .x if y: + case y := _ if y == x and y: z = 1 case A.B: z = 2 @@ -1020,7 +1021,7 @@ class A: B = 0 x = 0 match x: - case .A.B: + case A.B: y = 0 self.assertEqual(A.B, 0) self.assertEqual(x, 0) @@ -1044,7 +1045,7 @@ class B: C = 0 x = 0 match x: - case .A.B.C: + case A.B.C: y = 0 self.assertEqual(A.B.C, 0) self.assertEqual(x, 0) @@ -1057,7 +1058,7 @@ class C: D = 0 x = 0 match x: - case .A.B.C.D: + case A.B.C.D: y = 0 self.assertEqual(A.B.C.D, 0) self.assertEqual(x, 0) @@ -1070,7 +1071,7 @@ class C: D = 0 x = 0 match x: - case .A.B.C.D: + case A.B.C.D: y = 0 self.assertEqual(A.B.C.D, 0) self.assertEqual(x, 0) diff --git a/Parser/parser.c b/Parser/parser.c index af79e4f876bf9d..b71049e54ad61c 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -307,126 +307,126 @@ static KeywordToken *reserved_keywords[] = { #define _tmp_53_type 1238 #define _tmp_54_type 1239 #define _tmp_55_type 1240 -#define _tmp_56_type 1241 -#define _loop0_58_type 1242 -#define _gather_57_type 1243 -#define _loop0_60_type 1244 -#define _gather_59_type 1245 -#define _loop0_62_type 1246 -#define _gather_61_type 1247 -#define _loop0_64_type 1248 -#define _gather_63_type 1249 -#define _tmp_65_type 1250 -#define _loop0_67_type 1251 -#define _gather_66_type 1252 +#define _loop0_57_type 1241 +#define _gather_56_type 1242 +#define _loop0_59_type 1243 +#define _gather_58_type 1244 +#define _loop0_61_type 1245 +#define _gather_60_type 1246 +#define _loop0_63_type 1247 +#define _gather_62_type 1248 +#define _tmp_64_type 1249 +#define _loop0_66_type 1250 +#define _gather_65_type 1251 +#define _tmp_67_type 1252 #define _tmp_68_type 1253 #define _tmp_69_type 1254 -#define _tmp_70_type 1255 -#define _loop0_72_type 1256 -#define _gather_71_type 1257 -#define _loop0_74_type 1258 -#define _gather_73_type 1259 +#define _loop0_71_type 1255 +#define _gather_70_type 1256 +#define _loop0_73_type 1257 +#define _gather_72_type 1258 +#define _tmp_74_type 1259 #define _tmp_75_type 1260 #define _tmp_76_type 1261 #define _tmp_77_type 1262 #define _tmp_78_type 1263 #define _tmp_79_type 1264 -#define _tmp_80_type 1265 +#define _loop0_80_type 1265 #define _loop0_81_type 1266 #define _loop0_82_type 1267 -#define _loop0_83_type 1268 -#define _loop1_84_type 1269 -#define _loop0_85_type 1270 +#define _loop1_83_type 1268 +#define _loop0_84_type 1269 +#define _loop1_85_type 1270 #define _loop1_86_type 1271 #define _loop1_87_type 1272 -#define _loop1_88_type 1273 -#define _loop0_89_type 1274 -#define _loop1_90_type 1275 -#define _loop0_91_type 1276 -#define _loop1_92_type 1277 -#define _loop0_93_type 1278 +#define _loop0_88_type 1273 +#define _loop1_89_type 1274 +#define _loop0_90_type 1275 +#define _loop1_91_type 1276 +#define _loop0_92_type 1277 +#define _loop1_93_type 1278 #define _loop1_94_type 1279 -#define _loop1_95_type 1280 -#define _tmp_96_type 1281 -#define _loop0_98_type 1282 -#define _gather_97_type 1283 -#define _loop1_99_type 1284 -#define _loop0_101_type 1285 -#define _gather_100_type 1286 -#define _loop1_102_type 1287 +#define _tmp_95_type 1280 +#define _loop0_97_type 1281 +#define _gather_96_type 1282 +#define _loop1_98_type 1283 +#define _loop0_100_type 1284 +#define _gather_99_type 1285 +#define _loop1_101_type 1286 +#define _loop0_102_type 1287 #define _loop0_103_type 1288 #define _loop0_104_type 1289 -#define _loop0_105_type 1290 -#define _loop1_106_type 1291 -#define _loop0_107_type 1292 +#define _loop1_105_type 1290 +#define _loop0_106_type 1291 +#define _loop1_107_type 1292 #define _loop1_108_type 1293 #define _loop1_109_type 1294 -#define _loop1_110_type 1295 -#define _loop0_111_type 1296 -#define _loop1_112_type 1297 -#define _loop0_113_type 1298 -#define _loop1_114_type 1299 -#define _loop0_115_type 1300 +#define _loop0_110_type 1295 +#define _loop1_111_type 1296 +#define _loop0_112_type 1297 +#define _loop1_113_type 1298 +#define _loop0_114_type 1299 +#define _loop1_115_type 1300 #define _loop1_116_type 1301 #define _loop1_117_type 1302 #define _loop1_118_type 1303 -#define _loop1_119_type 1304 -#define _tmp_120_type 1305 -#define _loop0_122_type 1306 -#define _gather_121_type 1307 +#define _tmp_119_type 1304 +#define _loop0_121_type 1305 +#define _gather_120_type 1306 +#define _tmp_122_type 1307 #define _tmp_123_type 1308 #define _tmp_124_type 1309 #define _tmp_125_type 1310 -#define _tmp_126_type 1311 -#define _loop1_127_type 1312 +#define _loop1_126_type 1311 +#define _tmp_127_type 1312 #define _tmp_128_type 1313 -#define _tmp_129_type 1314 -#define _loop0_131_type 1315 -#define _gather_130_type 1316 -#define _loop1_132_type 1317 +#define _loop0_130_type 1314 +#define _gather_129_type 1315 +#define _loop1_131_type 1316 +#define _loop0_132_type 1317 #define _loop0_133_type 1318 -#define _loop0_134_type 1319 +#define _tmp_134_type 1319 #define _tmp_135_type 1320 -#define _tmp_136_type 1321 -#define _loop0_138_type 1322 -#define _gather_137_type 1323 -#define _loop0_140_type 1324 -#define _gather_139_type 1325 -#define _loop0_142_type 1326 -#define _gather_141_type 1327 -#define _loop0_144_type 1328 -#define _gather_143_type 1329 -#define _loop0_145_type 1330 -#define _loop0_147_type 1331 -#define _gather_146_type 1332 -#define _tmp_148_type 1333 -#define _loop0_150_type 1334 -#define _gather_149_type 1335 -#define _loop0_152_type 1336 -#define _gather_151_type 1337 -#define _tmp_153_type 1338 +#define _loop0_137_type 1321 +#define _gather_136_type 1322 +#define _loop0_139_type 1323 +#define _gather_138_type 1324 +#define _loop0_141_type 1325 +#define _gather_140_type 1326 +#define _loop0_143_type 1327 +#define _gather_142_type 1328 +#define _loop0_144_type 1329 +#define _loop0_146_type 1330 +#define _gather_145_type 1331 +#define _tmp_147_type 1332 +#define _loop0_149_type 1333 +#define _gather_148_type 1334 +#define _loop0_151_type 1335 +#define _gather_150_type 1336 +#define _tmp_152_type 1337 +#define _loop0_153_type 1338 #define _loop0_154_type 1339 #define _loop0_155_type 1340 -#define _loop0_156_type 1341 +#define _tmp_156_type 1341 #define _tmp_157_type 1342 -#define _tmp_158_type 1343 -#define _loop0_159_type 1344 -#define _tmp_160_type 1345 -#define _loop0_161_type 1346 +#define _loop0_158_type 1343 +#define _tmp_159_type 1344 +#define _loop0_160_type 1345 +#define _tmp_161_type 1346 #define _tmp_162_type 1347 #define _tmp_163_type 1348 #define _tmp_164_type 1349 #define _tmp_165_type 1350 #define _tmp_166_type 1351 -#define _tmp_167_type 1352 -#define _loop0_169_type 1353 -#define _gather_168_type 1354 -#define _loop0_171_type 1355 -#define _gather_170_type 1356 -#define _loop0_173_type 1357 -#define _gather_172_type 1358 -#define _loop0_175_type 1359 -#define _gather_174_type 1360 +#define _loop0_168_type 1352 +#define _gather_167_type 1353 +#define _loop0_170_type 1354 +#define _gather_169_type 1355 +#define _loop0_172_type 1356 +#define _gather_171_type 1357 +#define _loop0_174_type 1358 +#define _gather_173_type 1359 +#define _tmp_175_type 1360 #define _tmp_176_type 1361 #define _tmp_177_type 1362 #define _tmp_178_type 1363 @@ -436,12 +436,11 @@ static KeywordToken *reserved_keywords[] = { #define _tmp_182_type 1367 #define _tmp_183_type 1368 #define _tmp_184_type 1369 -#define _tmp_185_type 1370 +#define _loop1_185_type 1370 #define _loop1_186_type 1371 -#define _loop1_187_type 1372 +#define _tmp_187_type 1372 #define _tmp_188_type 1373 #define _tmp_189_type 1374 -#define _tmp_190_type 1375 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -684,126 +683,126 @@ static asdl_seq *_gather_51_rule(Parser *p); static void *_tmp_53_rule(Parser *p); static void *_tmp_54_rule(Parser *p); static void *_tmp_55_rule(Parser *p); -static void *_tmp_56_rule(Parser *p); -static asdl_seq *_loop0_58_rule(Parser *p); -static asdl_seq *_gather_57_rule(Parser *p); -static asdl_seq *_loop0_60_rule(Parser *p); -static asdl_seq *_gather_59_rule(Parser *p); -static asdl_seq *_loop0_62_rule(Parser *p); -static asdl_seq *_gather_61_rule(Parser *p); -static asdl_seq *_loop0_64_rule(Parser *p); -static asdl_seq *_gather_63_rule(Parser *p); -static void *_tmp_65_rule(Parser *p); -static asdl_seq *_loop0_67_rule(Parser *p); -static asdl_seq *_gather_66_rule(Parser *p); +static asdl_seq *_loop0_57_rule(Parser *p); +static asdl_seq *_gather_56_rule(Parser *p); +static asdl_seq *_loop0_59_rule(Parser *p); +static asdl_seq *_gather_58_rule(Parser *p); +static asdl_seq *_loop0_61_rule(Parser *p); +static asdl_seq *_gather_60_rule(Parser *p); +static asdl_seq *_loop0_63_rule(Parser *p); +static asdl_seq *_gather_62_rule(Parser *p); +static void *_tmp_64_rule(Parser *p); +static asdl_seq *_loop0_66_rule(Parser *p); +static asdl_seq *_gather_65_rule(Parser *p); +static void *_tmp_67_rule(Parser *p); static void *_tmp_68_rule(Parser *p); static void *_tmp_69_rule(Parser *p); -static void *_tmp_70_rule(Parser *p); -static asdl_seq *_loop0_72_rule(Parser *p); -static asdl_seq *_gather_71_rule(Parser *p); -static asdl_seq *_loop0_74_rule(Parser *p); -static asdl_seq *_gather_73_rule(Parser *p); +static asdl_seq *_loop0_71_rule(Parser *p); +static asdl_seq *_gather_70_rule(Parser *p); +static asdl_seq *_loop0_73_rule(Parser *p); +static asdl_seq *_gather_72_rule(Parser *p); +static void *_tmp_74_rule(Parser *p); static void *_tmp_75_rule(Parser *p); static void *_tmp_76_rule(Parser *p); static void *_tmp_77_rule(Parser *p); static void *_tmp_78_rule(Parser *p); static void *_tmp_79_rule(Parser *p); -static void *_tmp_80_rule(Parser *p); +static asdl_seq *_loop0_80_rule(Parser *p); static asdl_seq *_loop0_81_rule(Parser *p); static asdl_seq *_loop0_82_rule(Parser *p); -static asdl_seq *_loop0_83_rule(Parser *p); -static asdl_seq *_loop1_84_rule(Parser *p); -static asdl_seq *_loop0_85_rule(Parser *p); +static asdl_seq *_loop1_83_rule(Parser *p); +static asdl_seq *_loop0_84_rule(Parser *p); +static asdl_seq *_loop1_85_rule(Parser *p); static asdl_seq *_loop1_86_rule(Parser *p); static asdl_seq *_loop1_87_rule(Parser *p); -static asdl_seq *_loop1_88_rule(Parser *p); -static asdl_seq *_loop0_89_rule(Parser *p); -static asdl_seq *_loop1_90_rule(Parser *p); -static asdl_seq *_loop0_91_rule(Parser *p); -static asdl_seq *_loop1_92_rule(Parser *p); -static asdl_seq *_loop0_93_rule(Parser *p); +static asdl_seq *_loop0_88_rule(Parser *p); +static asdl_seq *_loop1_89_rule(Parser *p); +static asdl_seq *_loop0_90_rule(Parser *p); +static asdl_seq *_loop1_91_rule(Parser *p); +static asdl_seq *_loop0_92_rule(Parser *p); +static asdl_seq *_loop1_93_rule(Parser *p); static asdl_seq *_loop1_94_rule(Parser *p); -static asdl_seq *_loop1_95_rule(Parser *p); -static void *_tmp_96_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_gather_97_rule(Parser *p); -static asdl_seq *_loop1_99_rule(Parser *p); -static asdl_seq *_loop0_101_rule(Parser *p); -static asdl_seq *_gather_100_rule(Parser *p); -static asdl_seq *_loop1_102_rule(Parser *p); +static void *_tmp_95_rule(Parser *p); +static asdl_seq *_loop0_97_rule(Parser *p); +static asdl_seq *_gather_96_rule(Parser *p); +static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop0_100_rule(Parser *p); +static asdl_seq *_gather_99_rule(Parser *p); +static asdl_seq *_loop1_101_rule(Parser *p); +static asdl_seq *_loop0_102_rule(Parser *p); static asdl_seq *_loop0_103_rule(Parser *p); static asdl_seq *_loop0_104_rule(Parser *p); -static asdl_seq *_loop0_105_rule(Parser *p); -static asdl_seq *_loop1_106_rule(Parser *p); -static asdl_seq *_loop0_107_rule(Parser *p); +static asdl_seq *_loop1_105_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); +static asdl_seq *_loop1_107_rule(Parser *p); static asdl_seq *_loop1_108_rule(Parser *p); static asdl_seq *_loop1_109_rule(Parser *p); -static asdl_seq *_loop1_110_rule(Parser *p); -static asdl_seq *_loop0_111_rule(Parser *p); -static asdl_seq *_loop1_112_rule(Parser *p); -static asdl_seq *_loop0_113_rule(Parser *p); -static asdl_seq *_loop1_114_rule(Parser *p); -static asdl_seq *_loop0_115_rule(Parser *p); +static asdl_seq *_loop0_110_rule(Parser *p); +static asdl_seq *_loop1_111_rule(Parser *p); +static asdl_seq *_loop0_112_rule(Parser *p); +static asdl_seq *_loop1_113_rule(Parser *p); +static asdl_seq *_loop0_114_rule(Parser *p); +static asdl_seq *_loop1_115_rule(Parser *p); static asdl_seq *_loop1_116_rule(Parser *p); static asdl_seq *_loop1_117_rule(Parser *p); static asdl_seq *_loop1_118_rule(Parser *p); -static asdl_seq *_loop1_119_rule(Parser *p); -static void *_tmp_120_rule(Parser *p); -static asdl_seq *_loop0_122_rule(Parser *p); -static asdl_seq *_gather_121_rule(Parser *p); +static void *_tmp_119_rule(Parser *p); +static asdl_seq *_loop0_121_rule(Parser *p); +static asdl_seq *_gather_120_rule(Parser *p); +static void *_tmp_122_rule(Parser *p); static void *_tmp_123_rule(Parser *p); static void *_tmp_124_rule(Parser *p); static void *_tmp_125_rule(Parser *p); -static void *_tmp_126_rule(Parser *p); -static asdl_seq *_loop1_127_rule(Parser *p); +static asdl_seq *_loop1_126_rule(Parser *p); +static void *_tmp_127_rule(Parser *p); static void *_tmp_128_rule(Parser *p); -static void *_tmp_129_rule(Parser *p); -static asdl_seq *_loop0_131_rule(Parser *p); -static asdl_seq *_gather_130_rule(Parser *p); -static asdl_seq *_loop1_132_rule(Parser *p); +static asdl_seq *_loop0_130_rule(Parser *p); +static asdl_seq *_gather_129_rule(Parser *p); +static asdl_seq *_loop1_131_rule(Parser *p); +static asdl_seq *_loop0_132_rule(Parser *p); static asdl_seq *_loop0_133_rule(Parser *p); -static asdl_seq *_loop0_134_rule(Parser *p); +static void *_tmp_134_rule(Parser *p); static void *_tmp_135_rule(Parser *p); -static void *_tmp_136_rule(Parser *p); -static asdl_seq *_loop0_138_rule(Parser *p); -static asdl_seq *_gather_137_rule(Parser *p); -static asdl_seq *_loop0_140_rule(Parser *p); -static asdl_seq *_gather_139_rule(Parser *p); -static asdl_seq *_loop0_142_rule(Parser *p); -static asdl_seq *_gather_141_rule(Parser *p); +static asdl_seq *_loop0_137_rule(Parser *p); +static asdl_seq *_gather_136_rule(Parser *p); +static asdl_seq *_loop0_139_rule(Parser *p); +static asdl_seq *_gather_138_rule(Parser *p); +static asdl_seq *_loop0_141_rule(Parser *p); +static asdl_seq *_gather_140_rule(Parser *p); +static asdl_seq *_loop0_143_rule(Parser *p); +static asdl_seq *_gather_142_rule(Parser *p); static asdl_seq *_loop0_144_rule(Parser *p); -static asdl_seq *_gather_143_rule(Parser *p); -static asdl_seq *_loop0_145_rule(Parser *p); -static asdl_seq *_loop0_147_rule(Parser *p); -static asdl_seq *_gather_146_rule(Parser *p); -static void *_tmp_148_rule(Parser *p); -static asdl_seq *_loop0_150_rule(Parser *p); -static asdl_seq *_gather_149_rule(Parser *p); -static asdl_seq *_loop0_152_rule(Parser *p); -static asdl_seq *_gather_151_rule(Parser *p); -static void *_tmp_153_rule(Parser *p); +static asdl_seq *_loop0_146_rule(Parser *p); +static asdl_seq *_gather_145_rule(Parser *p); +static void *_tmp_147_rule(Parser *p); +static asdl_seq *_loop0_149_rule(Parser *p); +static asdl_seq *_gather_148_rule(Parser *p); +static asdl_seq *_loop0_151_rule(Parser *p); +static asdl_seq *_gather_150_rule(Parser *p); +static void *_tmp_152_rule(Parser *p); +static asdl_seq *_loop0_153_rule(Parser *p); static asdl_seq *_loop0_154_rule(Parser *p); static asdl_seq *_loop0_155_rule(Parser *p); -static asdl_seq *_loop0_156_rule(Parser *p); +static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); -static void *_tmp_158_rule(Parser *p); -static asdl_seq *_loop0_159_rule(Parser *p); -static void *_tmp_160_rule(Parser *p); -static asdl_seq *_loop0_161_rule(Parser *p); +static asdl_seq *_loop0_158_rule(Parser *p); +static void *_tmp_159_rule(Parser *p); +static asdl_seq *_loop0_160_rule(Parser *p); +static void *_tmp_161_rule(Parser *p); static void *_tmp_162_rule(Parser *p); static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); static void *_tmp_165_rule(Parser *p); static void *_tmp_166_rule(Parser *p); -static void *_tmp_167_rule(Parser *p); -static asdl_seq *_loop0_169_rule(Parser *p); -static asdl_seq *_gather_168_rule(Parser *p); -static asdl_seq *_loop0_171_rule(Parser *p); -static asdl_seq *_gather_170_rule(Parser *p); -static asdl_seq *_loop0_173_rule(Parser *p); -static asdl_seq *_gather_172_rule(Parser *p); -static asdl_seq *_loop0_175_rule(Parser *p); -static asdl_seq *_gather_174_rule(Parser *p); +static asdl_seq *_loop0_168_rule(Parser *p); +static asdl_seq *_gather_167_rule(Parser *p); +static asdl_seq *_loop0_170_rule(Parser *p); +static asdl_seq *_gather_169_rule(Parser *p); +static asdl_seq *_loop0_172_rule(Parser *p); +static asdl_seq *_gather_171_rule(Parser *p); +static asdl_seq *_loop0_174_rule(Parser *p); +static asdl_seq *_gather_173_rule(Parser *p); +static void *_tmp_175_rule(Parser *p); static void *_tmp_176_rule(Parser *p); static void *_tmp_177_rule(Parser *p); static void *_tmp_178_rule(Parser *p); @@ -813,12 +812,11 @@ static void *_tmp_181_rule(Parser *p); static void *_tmp_182_rule(Parser *p); static void *_tmp_183_rule(Parser *p); static void *_tmp_184_rule(Parser *p); -static void *_tmp_185_rule(Parser *p); +static asdl_seq *_loop1_185_rule(Parser *p); static asdl_seq *_loop1_186_rule(Parser *p); -static asdl_seq *_loop1_187_rule(Parser *p); +static void *_tmp_187_rule(Parser *p); static void *_tmp_188_rule(Parser *p); static void *_tmp_189_rule(Parser *p); -static void *_tmp_190_rule(Parser *p); // file: statements? $ @@ -5720,7 +5718,7 @@ literal_pattern_rule(Parser *p) return _res; } -// constant_pattern: '.' NAME !('.' | '(' | '=') | '.'? attr !('.' | '(' | '=') +// constant_pattern: attr !('.' | '(' | '=') static expr_ty constant_pattern_rule(Parser *p) { @@ -5731,53 +5729,20 @@ constant_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // '.' NAME !('.' | '(' | '=') + { // attr !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); - Token * _literal; - expr_ty name; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - && - (name = _PyPegen_name_token(p)) // NAME - && - _PyPegen_lookahead(0, _tmp_55_rule, p) - ) - { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); - _res = name; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.' NAME !('.' | '(' | '=')")); - } - { // '.'? attr !('.' | '(' | '=') - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings + D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); expr_ty attr; if ( - (_opt_var = _PyPegen_expect_token(p, 23), 1) // '.'? - && (attr = attr_rule(p)) // attr && - _PyPegen_lookahead(0, _tmp_56_rule, p) + _PyPegen_lookahead(0, _tmp_55_rule, p) ) { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); + D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); _res = attr; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -5788,7 +5753,7 @@ constant_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'? attr !('.' | '(' | '=')")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); } _res = NULL; done: @@ -6091,7 +6056,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_57_rule(p)) // ','.pattern+ + (args = _gather_56_rule(p)) // ','.pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6137,7 +6102,7 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (keywords = _gather_59_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_58_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6185,11 +6150,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_61_rule(p)) // ','.pattern+ + (args = _gather_60_rule(p)) // ','.pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (keywords = _gather_63_rule(p)) // ','.keyword_pattern+ + (keywords = _gather_62_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6224,7 +6189,7 @@ class_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); - asdl_seq * _gather_66_var; + asdl_seq * _gather_65_var; Token * _literal; Token * _literal_1; Token * _literal_2; @@ -6241,15 +6206,15 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_65_rule(p), 1) // [','.pattern+ ','] + (_opt_var = _tmp_64_rule(p), 1) // [','.pattern+ ','] && - (_gather_66_var = _gather_66_rule(p)) // ','.keyword_pattern+ + (_gather_65_var = _gather_65_rule(p)) // ','.keyword_pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && (error = pattern_rule(p)) // pattern && - (_opt_var_1 = _tmp_68_rule(p), 1) // [',' ','.error_argument_pattern+] + (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.error_argument_pattern+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6290,11 +6255,11 @@ class_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_opt_var = _tmp_69_rule(p), 1) // [','.error_argument_pattern+ ','] + (_opt_var = _tmp_68_rule(p), 1) // [','.error_argument_pattern+ ','] && (error = error_star_rule(p)) // error_star && - (_opt_var_1 = _tmp_70_rule(p), 1) // [',' ','.(error_argument_pattern | error_star)+] + (_opt_var_1 = _tmp_69_rule(p), 1) // [',' ','.(error_argument_pattern | error_star)+] && (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6573,7 +6538,7 @@ values_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * values; if ( - (values = _gather_71_rule(p)) // ','.value_pattern+ + (values = _gather_70_rule(p)) // ','.value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6618,7 +6583,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_73_rule(p)) // ','.key_value_pattern+ + (items = _gather_72_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6779,10 +6744,10 @@ error_star_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> error_star[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); - void *_tmp_75_var; + void *_tmp_74_var; expr_ty error; if ( - (_tmp_75_var = _tmp_75_rule(p)) // '*' | '**' + (_tmp_74_var = _tmp_74_rule(p)) // '*' | '**' && (error = _PyPegen_name_token(p)) // NAME ) @@ -6910,7 +6875,7 @@ key_value_pattern_rule(Parser *p) void *key; expr_ty value; if ( - (key = _tmp_76_rule(p)) // literal_pattern | constant_pattern + (key = _tmp_75_rule(p)) // literal_pattern | constant_pattern && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7059,7 +7024,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_77_rule(p), 1) // ['from' expression] + (b = _tmp_76_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -7234,7 +7199,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_78_rule(p), 1) // ['->' expression] + (a = _tmp_77_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7294,7 +7259,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_79_rule(p), 1) // ['->' expression] + (a = _tmp_78_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7358,7 +7323,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_80_rule, p) + _PyPegen_lookahead(1, _tmp_79_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -7502,9 +7467,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = _loop0_81_rule(p)) // param_no_default* + (b = _loop0_80_rule(p)) // param_no_default* && - (c = _loop0_82_rule(p)) // param_with_default* + (c = _loop0_81_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -7534,7 +7499,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_83_rule(p)) // param_with_default* + (b = _loop0_82_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7562,9 +7527,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_84_rule(p)) // param_no_default+ + (a = _loop1_83_rule(p)) // param_no_default+ && - (b = _loop0_85_rule(p)) // param_with_default* + (b = _loop0_84_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7591,7 +7556,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_86_rule(p)) // param_with_default+ + (a = _loop1_85_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -7660,7 +7625,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_87_rule(p)) // param_no_default+ + (a = _loop1_86_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7689,7 +7654,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_88_rule(p)) // param_no_default+ + (a = _loop1_87_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7739,9 +7704,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_89_rule(p)) // param_no_default* + (a = _loop0_88_rule(p)) // param_no_default* && - (b = _loop1_90_rule(p)) // param_with_default+ + (b = _loop1_89_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7771,9 +7736,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_91_rule(p)) // param_no_default* + (a = _loop0_90_rule(p)) // param_no_default* && - (b = _loop1_92_rule(p)) // param_with_default+ + (b = _loop1_91_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7829,7 +7794,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_93_rule(p)) // param_maybe_default* + (b = _loop0_92_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7862,7 +7827,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_94_rule(p)) // param_maybe_default+ + (b = _loop1_93_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -8384,7 +8349,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_seq * a; if ( - (a = _loop1_95_rule(p)) // (('@' named_expression NEWLINE))+ + (a = _loop1_94_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -8505,7 +8470,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_96_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_95_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -8654,7 +8619,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_97_rule(p)) // ','.star_expression+ + (a = _gather_96_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8714,7 +8679,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_99_rule(p)) // ((',' star_expression))+ + (b = _loop1_98_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8909,7 +8874,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_100_rule(p)) // ','.star_named_expression+ + (a = _gather_99_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9214,7 +9179,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_102_rule(p)) // ((',' expression))+ + (b = _loop1_101_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9568,9 +9533,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = _loop0_103_rule(p)) // lambda_param_no_default* + (b = _loop0_102_rule(p)) // lambda_param_no_default* && - (c = _loop0_104_rule(p)) // lambda_param_with_default* + (c = _loop0_103_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9600,7 +9565,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_105_rule(p)) // lambda_param_with_default* + (b = _loop0_104_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9628,9 +9593,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = _loop1_106_rule(p)) // lambda_param_no_default+ + (a = _loop1_105_rule(p)) // lambda_param_no_default+ && - (b = _loop0_107_rule(p)) // lambda_param_with_default* + (b = _loop0_106_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9657,7 +9622,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_108_rule(p)) // lambda_param_with_default+ + (a = _loop1_107_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9728,7 +9693,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_seq * a; if ( - (a = _loop1_109_rule(p)) // lambda_param_no_default+ + (a = _loop1_108_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9757,7 +9722,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_seq * a; if ( - (a = _loop1_110_rule(p)) // lambda_param_no_default+ + (a = _loop1_109_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9807,9 +9772,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_111_rule(p)) // lambda_param_no_default* + (a = _loop0_110_rule(p)) // lambda_param_no_default* && - (b = _loop1_112_rule(p)) // lambda_param_with_default+ + (b = _loop1_111_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9839,9 +9804,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_113_rule(p)) // lambda_param_no_default* + (a = _loop0_112_rule(p)) // lambda_param_no_default* && - (b = _loop1_114_rule(p)) // lambda_param_with_default+ + (b = _loop1_113_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9897,7 +9862,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_115_rule(p)) // lambda_param_maybe_default* + (b = _loop0_114_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9930,7 +9895,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_116_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_115_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -10357,7 +10322,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_117_rule(p)) // (('or' conjunction))+ + (b = _loop1_116_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -10443,7 +10408,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_118_rule(p)) // (('and' inversion))+ + (b = _loop1_117_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10611,7 +10576,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_119_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_118_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10939,10 +10904,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_120_var; + void *_tmp_119_var; expr_ty a; if ( - (_tmp_120_var = _tmp_120_rule(p)) // '!=' + (_tmp_119_var = _tmp_119_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12871,7 +12836,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_121_rule(p)) // ','.slice+ + (a = _gather_120_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12941,7 +12906,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_123_rule(p), 1) // [':' expression?] + (c = _tmp_122_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -13190,15 +13155,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_124_var; + void *_tmp_123_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_124_var = _tmp_124_rule(p)) // tuple | group | genexp + (_tmp_123_var = _tmp_123_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_124_var; + _res = _tmp_123_var; goto done; } p->mark = _mark; @@ -13211,15 +13176,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_125_var; + void *_tmp_124_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_125_var = _tmp_125_rule(p)) // list | listcomp + (_tmp_124_var = _tmp_124_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_125_var; + _res = _tmp_124_var; goto done; } p->mark = _mark; @@ -13232,15 +13197,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_126_var; + void *_tmp_125_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_126_var = _tmp_126_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_125_var = _tmp_125_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_126_var; + _res = _tmp_125_var; goto done; } p->mark = _mark; @@ -13309,7 +13274,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_127_rule(p)) // STRING+ + (a = _loop1_126_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -13523,7 +13488,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_128_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_127_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13579,7 +13544,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_129_rule(p)) // yield_expr | named_expression + (a = _tmp_128_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -14048,7 +14013,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_130_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_129_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14199,13 +14164,13 @@ for_if_clauses_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - asdl_seq * _loop1_132_var; + asdl_seq * _loop1_131_var; if ( - (_loop1_132_var = _loop1_132_rule(p)) // for_if_clause+ + (_loop1_131_var = _loop1_131_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); - _res = _loop1_132_var; + _res = _loop1_131_var; goto done; } p->mark = _mark; @@ -14258,7 +14223,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_133_rule(p)) // (('if' disjunction))* + (c = _loop0_132_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14301,7 +14266,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = _loop0_134_rule(p)) // (('if' disjunction))* + (c = _loop0_133_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14549,7 +14514,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) // starred_expression && - (b = _tmp_135_rule(p), 1) // [',' args] + (b = _tmp_134_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression [',' args]")); @@ -14618,7 +14583,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) // named_expression && - (b = _tmp_136_rule(p), 1) // [',' args] + (b = _tmp_135_rule(p), 1) // [',' args] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression [',' args]")); @@ -14673,11 +14638,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_137_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_136_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_139_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_138_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14699,13 +14664,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_141_var; + asdl_seq * _gather_140_var; if ( - (_gather_141_var = _gather_141_rule(p)) // ','.kwarg_or_starred+ + (_gather_140_var = _gather_140_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_141_var; + _res = _gather_140_var; goto done; } p->mark = _mark; @@ -14718,13 +14683,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_143_var; + asdl_seq * _gather_142_var; if ( - (_gather_143_var = _gather_143_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_142_var = _gather_142_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_143_var; + _res = _gather_142_var; goto done; } p->mark = _mark; @@ -15086,7 +15051,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_145_rule(p)) // ((',' star_target))* + (b = _loop0_144_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15140,7 +15105,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_146_rule(p)) // ','.star_target+ + (a = _gather_145_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15203,7 +15168,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_148_rule(p)) // !'*' star_target + (a = _tmp_147_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15725,7 +15690,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_149_rule(p)) // ','.del_target+ + (a = _gather_148_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16066,7 +16031,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_151_rule(p)) // ','.target+ + (a = _gather_150_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16778,7 +16743,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_153_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_152_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -17036,7 +17001,7 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_154_var; + asdl_seq * _loop0_153_var; expr_ty a; expr_ty expression_var; if ( @@ -17044,7 +17009,7 @@ invalid_assignment_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_154_var = _loop0_154_rule(p)) // star_named_expressions* + (_loop0_153_var = _loop0_153_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -17101,10 +17066,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); Token * _literal; - asdl_seq * _loop0_155_var; + asdl_seq * _loop0_154_var; expr_ty a; if ( - (_loop0_155_var = _loop0_155_rule(p)) // ((star_targets '='))* + (_loop0_154_var = _loop0_154_rule(p)) // ((star_targets '='))* && (a = star_expressions_rule(p)) // star_expressions && @@ -17131,10 +17096,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); Token * _literal; - asdl_seq * _loop0_156_var; + asdl_seq * _loop0_155_var; expr_ty a; if ( - (_loop0_156_var = _loop0_156_rule(p)) // ((star_targets '='))* + (_loop0_155_var = _loop0_155_rule(p)) // ((star_targets '='))* && (a = yield_expr_rule(p)) // yield_expr && @@ -17160,7 +17125,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_157_var; + void *_tmp_156_var; expr_ty a; AugOperator* augassign_var; if ( @@ -17168,7 +17133,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_157_var = _tmp_157_rule(p)) // yield_expr | star_expressions + (_tmp_156_var = _tmp_156_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -17379,11 +17344,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_158_var; + void *_tmp_157_var; expr_ty a; asdl_seq* for_if_clauses_var; if ( - (_tmp_158_var = _tmp_158_rule(p)) // '[' | '(' | '{' + (_tmp_157_var = _tmp_157_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -17480,13 +17445,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_159_var; - void *_tmp_160_var; + asdl_seq * _loop0_158_var; + void *_tmp_159_var; arg_ty param_no_default_var; if ( - (_loop0_159_var = _loop0_159_rule(p)) // param_no_default* + (_loop0_158_var = _loop0_158_rule(p)) // param_no_default* && - (_tmp_160_var = _tmp_160_rule(p)) // slash_with_default | param_with_default+ + (_tmp_159_var = _tmp_159_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -17528,13 +17493,13 @@ invalid_lambda_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); - asdl_seq * _loop0_161_var; - void *_tmp_162_var; + asdl_seq * _loop0_160_var; + void *_tmp_161_var; arg_ty lambda_param_no_default_var; if ( - (_loop0_161_var = _loop0_161_rule(p)) // lambda_param_no_default* + (_loop0_160_var = _loop0_160_rule(p)) // lambda_param_no_default* && - (_tmp_162_var = _tmp_162_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ + (_tmp_161_var = _tmp_161_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ && (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) @@ -17576,11 +17541,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_163_var; + void *_tmp_162_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_163_var = _tmp_163_rule(p)) // ')' | ',' (')' | '**') + (_tmp_162_var = _tmp_162_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -17650,11 +17615,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_164_var; + void *_tmp_163_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_164_var = _tmp_164_rule(p)) // ':' | ',' (':' | '**') + (_tmp_163_var = _tmp_163_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -19163,12 +19128,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_165_var; + void *_tmp_164_var; while ( - (_tmp_165_var = _tmp_165_rule(p)) // star_targets '=' + (_tmp_164_var = _tmp_164_rule(p)) // star_targets '=' ) { - _res = _tmp_165_var; + _res = _tmp_164_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19671,12 +19636,12 @@ _loop0_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_166_var; + void *_tmp_165_var; while ( - (_tmp_166_var = _tmp_166_rule(p)) // '.' | '...' + (_tmp_165_var = _tmp_165_rule(p)) // '.' | '...' ) { - _res = _tmp_166_var; + _res = _tmp_165_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19737,12 +19702,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_167_var; + void *_tmp_166_var; while ( - (_tmp_167_var = _tmp_167_rule(p)) // '.' | '...' + (_tmp_166_var = _tmp_166_rule(p)) // '.' | '...' ) { - _res = _tmp_167_var; + _res = _tmp_166_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21130,83 +21095,9 @@ _tmp_55_rule(Parser *p) return _res; } -// _tmp_56: '.' | '(' | '=' -static void * -_tmp_56_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '.' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - ) - { - D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); - } - { // '(' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - ) - { - D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); - } - { // '=' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 22)) // token='=' - ) - { - D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_58: ',' pattern +// _loop0_57: ',' pattern static asdl_seq * -_loop0_58_rule(Parser *p) +_loop0_57_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21230,7 +21121,7 @@ _loop0_58_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -21261,7 +21152,7 @@ _loop0_58_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21274,14 +21165,14 @@ _loop0_58_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); D(p->level--); return _seq; } -// _gather_57: pattern _loop0_58 +// _gather_56: pattern _loop0_57 static asdl_seq * -_gather_57_rule(Parser *p) +_gather_56_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21290,27 +21181,27 @@ _gather_57_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_58 + { // pattern _loop0_57 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_58_rule(p)) // _loop0_58 + (seq = _loop0_57_rule(p)) // _loop0_57 ) { - D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_58")); + D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_57")); } _res = NULL; done: @@ -21318,9 +21209,9 @@ _gather_57_rule(Parser *p) return _res; } -// _loop0_60: ',' keyword_pattern +// _loop0_59: ',' keyword_pattern static asdl_seq * -_loop0_60_rule(Parser *p) +_loop0_59_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21344,7 +21235,7 @@ _loop0_60_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; keyword_ty elem; while ( @@ -21375,7 +21266,7 @@ _loop0_60_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21388,14 +21279,14 @@ _loop0_60_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_59_type, _seq); D(p->level--); return _seq; } -// _gather_59: keyword_pattern _loop0_60 +// _gather_58: keyword_pattern _loop0_59 static asdl_seq * -_gather_59_rule(Parser *p) +_gather_58_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21404,27 +21295,27 @@ _gather_59_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_60 + { // keyword_pattern _loop0_59 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_60_rule(p)) // _loop0_60 + (seq = _loop0_59_rule(p)) // _loop0_59 ) { - D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_60")); + D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_59")); } _res = NULL; done: @@ -21432,9 +21323,9 @@ _gather_59_rule(Parser *p) return _res; } -// _loop0_62: ',' pattern +// _loop0_61: ',' pattern static asdl_seq * -_loop0_62_rule(Parser *p) +_loop0_61_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21458,7 +21349,7 @@ _loop0_62_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -21489,7 +21380,7 @@ _loop0_62_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21502,14 +21393,14 @@ _loop0_62_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); D(p->level--); return _seq; } -// _gather_61: pattern _loop0_62 +// _gather_60: pattern _loop0_61 static asdl_seq * -_gather_61_rule(Parser *p) +_gather_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21518,27 +21409,27 @@ _gather_61_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_62 + { // pattern _loop0_61 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_62")); + D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_62_rule(p)) // _loop0_62 + (seq = _loop0_61_rule(p)) // _loop0_61 ) { - D(fprintf(stderr, "%*c+ _gather_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_62")); + D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_61[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_62")); + D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_61")); } _res = NULL; done: @@ -21546,9 +21437,9 @@ _gather_61_rule(Parser *p) return _res; } -// _loop0_64: ',' keyword_pattern +// _loop0_63: ',' keyword_pattern static asdl_seq * -_loop0_64_rule(Parser *p) +_loop0_63_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21572,7 +21463,7 @@ _loop0_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; keyword_ty elem; while ( @@ -21603,7 +21494,7 @@ _loop0_64_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21616,14 +21507,14 @@ _loop0_64_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); D(p->level--); return _seq; } -// _gather_63: keyword_pattern _loop0_64 +// _gather_62: keyword_pattern _loop0_63 static asdl_seq * -_gather_63_rule(Parser *p) +_gather_62_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21632,27 +21523,27 @@ _gather_63_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_64 + { // keyword_pattern _loop0_63 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_64_rule(p)) // _loop0_64 + (seq = _loop0_63_rule(p)) // _loop0_63 ) { - D(fprintf(stderr, "%*c+ _gather_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_63[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_64")); + D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_63")); } _res = NULL; done: @@ -21660,9 +21551,9 @@ _gather_63_rule(Parser *p) return _res; } -// _tmp_65: ','.pattern+ ',' +// _tmp_64: ','.pattern+ ',' static void * -_tmp_65_rule(Parser *p) +_tmp_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21676,21 +21567,21 @@ _tmp_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - asdl_seq * _gather_168_var; + D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + asdl_seq * _gather_167_var; Token * _literal; if ( - (_gather_168_var = _gather_168_rule(p)) // ','.pattern+ + (_gather_167_var = _gather_167_rule(p)) // ','.pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_168_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_167_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ','")); } _res = NULL; @@ -21699,9 +21590,9 @@ _tmp_65_rule(Parser *p) return _res; } -// _loop0_67: ',' keyword_pattern +// _loop0_66: ',' keyword_pattern static asdl_seq * -_loop0_67_rule(Parser *p) +_loop0_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21725,7 +21616,7 @@ _loop0_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; keyword_ty elem; while ( @@ -21756,7 +21647,7 @@ _loop0_67_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_67[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -21769,14 +21660,14 @@ _loop0_67_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_67_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq); D(p->level--); return _seq; } -// _gather_66: keyword_pattern _loop0_67 +// _gather_65: keyword_pattern _loop0_66 static asdl_seq * -_gather_66_rule(Parser *p) +_gather_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21785,27 +21676,27 @@ _gather_66_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_67 + { // keyword_pattern _loop0_66 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_67")); + D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_67_rule(p)) // _loop0_67 + (seq = _loop0_66_rule(p)) // _loop0_66 ) { - D(fprintf(stderr, "%*c+ _gather_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_67")); + D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_66[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_67")); + D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_66")); } _res = NULL; done: @@ -21813,9 +21704,9 @@ _gather_66_rule(Parser *p) return _res; } -// _tmp_68: ',' ','.error_argument_pattern+ +// _tmp_67: ',' ','.error_argument_pattern+ static void * -_tmp_68_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21829,21 +21720,21 @@ _tmp_68_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); - asdl_seq * _gather_170_var; + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); + asdl_seq * _gather_169_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_170_var = _gather_170_rule(p)) // ','.error_argument_pattern+ + (_gather_169_var = _gather_169_rule(p)) // ','.error_argument_pattern+ ) { - D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_170_var); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_169_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.error_argument_pattern+")); } _res = NULL; @@ -21852,9 +21743,9 @@ _tmp_68_rule(Parser *p) return _res; } -// _tmp_69: ','.error_argument_pattern+ ',' +// _tmp_68: ','.error_argument_pattern+ ',' static void * -_tmp_69_rule(Parser *p) +_tmp_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21868,21 +21759,21 @@ _tmp_69_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); - asdl_seq * _gather_172_var; + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); + asdl_seq * _gather_171_var; Token * _literal; if ( - (_gather_172_var = _gather_172_rule(p)) // ','.error_argument_pattern+ + (_gather_171_var = _gather_171_rule(p)) // ','.error_argument_pattern+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_172_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); + _res = _PyPegen_dummy_name(p, _gather_171_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.error_argument_pattern+ ','")); } _res = NULL; @@ -21891,9 +21782,9 @@ _tmp_69_rule(Parser *p) return _res; } -// _tmp_70: ',' ','.(error_argument_pattern | error_star)+ +// _tmp_69: ',' ','.(error_argument_pattern | error_star)+ static void * -_tmp_70_rule(Parser *p) +_tmp_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21907,21 +21798,21 @@ _tmp_70_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); - asdl_seq * _gather_174_var; + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); + asdl_seq * _gather_173_var; Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_gather_174_var = _gather_174_rule(p)) // ','.(error_argument_pattern | error_star)+ + (_gather_173_var = _gather_173_rule(p)) // ','.(error_argument_pattern | error_star)+ ) { - D(fprintf(stderr, "%*c+ _tmp_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_174_var); + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); + _res = _PyPegen_dummy_name(p, _literal, _gather_173_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_70[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); } _res = NULL; @@ -21930,9 +21821,9 @@ _tmp_70_rule(Parser *p) return _res; } -// _loop0_72: ',' value_pattern +// _loop0_71: ',' value_pattern static asdl_seq * -_loop0_72_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21956,7 +21847,7 @@ _loop0_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); Token * _literal; expr_ty elem; while ( @@ -21987,7 +21878,7 @@ _loop0_72_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22000,14 +21891,14 @@ _loop0_72_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _gather_71: value_pattern _loop0_72 +// _gather_70: value_pattern _loop0_71 static asdl_seq * -_gather_71_rule(Parser *p) +_gather_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22016,27 +21907,27 @@ _gather_71_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // value_pattern _loop0_72 + { // value_pattern _loop0_71 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_72")); + D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); expr_ty elem; asdl_seq * seq; if ( (elem = value_pattern_rule(p)) // value_pattern && - (seq = _loop0_72_rule(p)) // _loop0_72 + (seq = _loop0_71_rule(p)) // _loop0_71 ) { - D(fprintf(stderr, "%*c+ _gather_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_72")); + D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_71[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_72")); + D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_71")); } _res = NULL; done: @@ -22044,9 +21935,9 @@ _gather_71_rule(Parser *p) return _res; } -// _loop0_74: ',' key_value_pattern +// _loop0_73: ',' key_value_pattern static asdl_seq * -_loop0_74_rule(Parser *p) +_loop0_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22070,7 +21961,7 @@ _loop0_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; KeyValuePair* elem; while ( @@ -22101,7 +21992,7 @@ _loop0_74_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22114,14 +22005,14 @@ _loop0_74_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); D(p->level--); return _seq; } -// _gather_73: key_value_pattern _loop0_74 +// _gather_72: key_value_pattern _loop0_73 static asdl_seq * -_gather_73_rule(Parser *p) +_gather_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22130,27 +22021,27 @@ _gather_73_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_74 + { // key_value_pattern _loop0_73 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_74")); + D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_74_rule(p)) // _loop0_74 + (seq = _loop0_73_rule(p)) // _loop0_73 ) { - D(fprintf(stderr, "%*c+ _gather_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_74")); + D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_74")); + D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_73")); } _res = NULL; done: @@ -22158,9 +22049,9 @@ _gather_73_rule(Parser *p) return _res; } -// _tmp_75: '*' | '**' +// _tmp_74: '*' | '**' static void * -_tmp_75_rule(Parser *p) +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22174,18 +22065,18 @@ _tmp_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); } { // '**' @@ -22193,18 +22084,18 @@ _tmp_75_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -22213,9 +22104,9 @@ _tmp_75_rule(Parser *p) return _res; } -// _tmp_76: literal_pattern | constant_pattern +// _tmp_75: literal_pattern | constant_pattern static void * -_tmp_76_rule(Parser *p) +_tmp_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22229,18 +22120,18 @@ _tmp_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); expr_ty literal_pattern_var; if ( (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); _res = literal_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } { // constant_pattern @@ -22248,18 +22139,18 @@ _tmp_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); expr_ty constant_pattern_var; if ( (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); + D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); _res = constant_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); } _res = NULL; @@ -22268,9 +22159,9 @@ _tmp_76_rule(Parser *p) return _res; } -// _tmp_77: 'from' expression +// _tmp_76: 'from' expression static void * -_tmp_77_rule(Parser *p) +_tmp_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22284,7 +22175,7 @@ _tmp_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); Token * _keyword; expr_ty z; if ( @@ -22293,7 +22184,7 @@ _tmp_77_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22303,7 +22194,7 @@ _tmp_77_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; @@ -22312,9 +22203,9 @@ _tmp_77_rule(Parser *p) return _res; } -// _tmp_78: '->' expression +// _tmp_77: '->' expression static void * -_tmp_78_rule(Parser *p) +_tmp_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22328,7 +22219,7 @@ _tmp_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -22337,7 +22228,7 @@ _tmp_78_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_78[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22347,7 +22238,7 @@ _tmp_78_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -22356,9 +22247,9 @@ _tmp_78_rule(Parser *p) return _res; } -// _tmp_79: '->' expression +// _tmp_78: '->' expression static void * -_tmp_79_rule(Parser *p) +_tmp_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22372,7 +22263,7 @@ _tmp_79_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty z; if ( @@ -22381,7 +22272,7 @@ _tmp_79_rule(Parser *p) (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_78[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -22391,7 +22282,7 @@ _tmp_79_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_79[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_78[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -22400,9 +22291,9 @@ _tmp_79_rule(Parser *p) return _res; } -// _tmp_80: NEWLINE INDENT +// _tmp_79: NEWLINE INDENT static void * -_tmp_80_rule(Parser *p) +_tmp_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22416,7 +22307,7 @@ _tmp_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -22425,12 +22316,12 @@ _tmp_80_rule(Parser *p) (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - D(fprintf(stderr, "%*c+ _tmp_80[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c+ _tmp_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); _res = _PyPegen_dummy_name(p, newline_var, indent_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -22439,9 +22330,9 @@ _tmp_80_rule(Parser *p) return _res; } -// _loop0_81: param_no_default +// _loop0_80: param_no_default static asdl_seq * -_loop0_81_rule(Parser *p) +_loop0_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22465,7 +22356,7 @@ _loop0_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22487,7 +22378,7 @@ _loop0_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22500,14 +22391,14 @@ _loop0_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); D(p->level--); return _seq; } -// _loop0_82: param_with_default +// _loop0_81: param_with_default static asdl_seq * -_loop0_82_rule(Parser *p) +_loop0_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22531,7 +22422,7 @@ _loop0_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22553,7 +22444,7 @@ _loop0_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22566,14 +22457,14 @@ _loop0_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); D(p->level--); return _seq; } -// _loop0_83: param_with_default +// _loop0_82: param_with_default static asdl_seq * -_loop0_83_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22597,7 +22488,7 @@ _loop0_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22619,7 +22510,7 @@ _loop0_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22632,14 +22523,14 @@ _loop0_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_84: param_no_default +// _loop1_83: param_no_default static asdl_seq * -_loop1_84_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22663,7 +22554,7 @@ _loop1_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22685,7 +22576,7 @@ _loop1_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22703,14 +22594,14 @@ _loop1_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop0_85: param_with_default +// _loop0_84: param_with_default static asdl_seq * -_loop0_85_rule(Parser *p) +_loop0_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22734,7 +22625,7 @@ _loop0_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22756,7 +22647,7 @@ _loop0_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -22769,14 +22660,14 @@ _loop0_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq); D(p->level--); return _seq; } -// _loop1_86: param_with_default +// _loop1_85: param_with_default static asdl_seq * -_loop1_86_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22800,7 +22691,7 @@ _loop1_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22822,7 +22713,7 @@ _loop1_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22840,14 +22731,14 @@ _loop1_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); D(p->level--); return _seq; } -// _loop1_87: param_no_default +// _loop1_86: param_no_default static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22871,7 +22762,7 @@ _loop1_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22893,7 +22784,7 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22911,14 +22802,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); D(p->level--); return _seq; } -// _loop1_88: param_no_default +// _loop1_87: param_no_default static asdl_seq * -_loop1_88_rule(Parser *p) +_loop1_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22942,7 +22833,7 @@ _loop1_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22964,7 +22855,7 @@ _loop1_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22982,14 +22873,14 @@ _loop1_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); D(p->level--); return _seq; } -// _loop0_89: param_no_default +// _loop0_88: param_no_default static asdl_seq * -_loop0_89_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23013,7 +22904,7 @@ _loop0_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -23035,7 +22926,7 @@ _loop0_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23048,14 +22939,14 @@ _loop0_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _loop1_90: param_with_default +// _loop1_89: param_with_default static asdl_seq * -_loop1_90_rule(Parser *p) +_loop1_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23079,7 +22970,7 @@ _loop1_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -23101,7 +22992,7 @@ _loop1_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23119,14 +23010,14 @@ _loop1_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); D(p->level--); return _seq; } -// _loop0_91: param_no_default +// _loop0_90: param_no_default static asdl_seq * -_loop0_91_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23150,7 +23041,7 @@ _loop0_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -23172,7 +23063,7 @@ _loop0_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23185,14 +23076,14 @@ _loop0_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _loop1_92: param_with_default +// _loop1_91: param_with_default static asdl_seq * -_loop1_92_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23216,7 +23107,7 @@ _loop1_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -23238,7 +23129,7 @@ _loop1_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23256,14 +23147,14 @@ _loop1_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _loop0_93: param_maybe_default +// _loop0_92: param_maybe_default static asdl_seq * -_loop0_93_rule(Parser *p) +_loop0_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23287,7 +23178,7 @@ _loop0_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -23309,7 +23200,7 @@ _loop0_93_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23322,14 +23213,14 @@ _loop0_93_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); D(p->level--); return _seq; } -// _loop1_94: param_maybe_default +// _loop1_93: param_maybe_default static asdl_seq * -_loop1_94_rule(Parser *p) +_loop1_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23353,7 +23244,7 @@ _loop1_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); NameDefaultPair* param_maybe_default_var; while ( (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default @@ -23375,7 +23266,7 @@ _loop1_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -23393,14 +23284,14 @@ _loop1_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); D(p->level--); return _seq; } -// _loop1_95: ('@' named_expression NEWLINE) +// _loop1_94: ('@' named_expression NEWLINE) static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23424,13 +23315,13 @@ _loop1_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_176_var; + D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_175_var; while ( - (_tmp_176_var = _tmp_176_rule(p)) // '@' named_expression NEWLINE + (_tmp_175_var = _tmp_175_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_176_var; + _res = _tmp_175_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23446,7 +23337,7 @@ _loop1_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); } if (_n == 0 || p->error_indicator) { @@ -23464,14 +23355,14 @@ _loop1_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); D(p->level--); return _seq; } -// _tmp_96: '(' arguments? ')' +// _tmp_95: '(' arguments? ')' static void * -_tmp_96_rule(Parser *p) +_tmp_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23485,7 +23376,7 @@ _tmp_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *z; @@ -23497,7 +23388,7 @@ _tmp_96_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23507,7 +23398,7 @@ _tmp_96_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -23516,9 +23407,9 @@ _tmp_96_rule(Parser *p) return _res; } -// _loop0_98: ',' star_expression +// _loop0_97: ',' star_expression static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23542,7 +23433,7 @@ _loop0_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty elem; while ( @@ -23573,7 +23464,7 @@ _loop0_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23586,14 +23477,14 @@ _loop0_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); D(p->level--); return _seq; } -// _gather_97: star_expression _loop0_98 +// _gather_96: star_expression _loop0_97 static asdl_seq * -_gather_97_rule(Parser *p) +_gather_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23602,27 +23493,27 @@ _gather_97_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_expression _loop0_98 + { // star_expression _loop0_97 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_98")); + D(fprintf(stderr, "%*c> _gather_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); expr_ty elem; asdl_seq * seq; if ( (elem = star_expression_rule(p)) // star_expression && - (seq = _loop0_98_rule(p)) // _loop0_98 + (seq = _loop0_97_rule(p)) // _loop0_97 ) { - D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_98")); + D(fprintf(stderr, "%*c+ _gather_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_98")); + D(fprintf(stderr, "%*c%s _gather_96[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_97")); } _res = NULL; done: @@ -23630,9 +23521,9 @@ _gather_97_rule(Parser *p) return _res; } -// _loop1_99: (',' star_expression) +// _loop1_98: (',' star_expression) static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23656,13 +23547,13 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_177_var; + D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_176_var; while ( - (_tmp_177_var = _tmp_177_rule(p)) // ',' star_expression + (_tmp_176_var = _tmp_176_rule(p)) // ',' star_expression ) { - _res = _tmp_177_var; + _res = _tmp_176_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23678,7 +23569,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -23696,14 +23587,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); D(p->level--); return _seq; } -// _loop0_101: ',' star_named_expression +// _loop0_100: ',' star_named_expression static asdl_seq * -_loop0_101_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23727,7 +23618,7 @@ _loop0_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -23758,7 +23649,7 @@ _loop0_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23771,14 +23662,14 @@ _loop0_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _gather_100: star_named_expression _loop0_101 +// _gather_99: star_named_expression _loop0_100 static asdl_seq * -_gather_100_rule(Parser *p) +_gather_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23787,27 +23678,27 @@ _gather_100_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_101 + { // star_named_expression _loop0_100 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_101")); + D(fprintf(stderr, "%*c> _gather_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_101_rule(p)) // _loop0_101 + (seq = _loop0_100_rule(p)) // _loop0_100 ) { - D(fprintf(stderr, "%*c+ _gather_100[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_101")); + D(fprintf(stderr, "%*c+ _gather_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_100[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_101")); + D(fprintf(stderr, "%*c%s _gather_99[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_100")); } _res = NULL; done: @@ -23815,9 +23706,9 @@ _gather_100_rule(Parser *p) return _res; } -// _loop1_102: (',' expression) +// _loop1_101: (',' expression) static asdl_seq * -_loop1_102_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23841,13 +23732,13 @@ _loop1_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_178_var; + D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_177_var; while ( - (_tmp_178_var = _tmp_178_rule(p)) // ',' expression + (_tmp_177_var = _tmp_177_rule(p)) // ',' expression ) { - _res = _tmp_178_var; + _res = _tmp_177_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23863,7 +23754,7 @@ _loop1_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -23881,14 +23772,14 @@ _loop1_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop0_103: lambda_param_no_default +// _loop0_102: lambda_param_no_default static asdl_seq * -_loop0_103_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23912,7 +23803,7 @@ _loop0_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23934,7 +23825,7 @@ _loop0_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -23947,14 +23838,14 @@ _loop0_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_with_default +// _loop0_103: lambda_param_with_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23978,7 +23869,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24000,7 +23891,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24013,14 +23904,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); D(p->level--); return _seq; } -// _loop0_105: lambda_param_with_default +// _loop0_104: lambda_param_with_default static asdl_seq * -_loop0_105_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24044,7 +23935,7 @@ _loop0_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24066,7 +23957,7 @@ _loop0_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24079,14 +23970,14 @@ _loop0_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_106: lambda_param_no_default +// _loop1_105: lambda_param_no_default static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24110,7 +24001,7 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24132,7 +24023,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -24150,14 +24041,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop0_107: lambda_param_with_default +// _loop0_106: lambda_param_with_default static asdl_seq * -_loop0_107_rule(Parser *p) +_loop0_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24181,7 +24072,7 @@ _loop0_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24203,7 +24094,7 @@ _loop0_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24216,14 +24107,14 @@ _loop0_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); D(p->level--); return _seq; } -// _loop1_108: lambda_param_with_default +// _loop1_107: lambda_param_with_default static asdl_seq * -_loop1_108_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24247,7 +24138,7 @@ _loop1_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24269,7 +24160,7 @@ _loop1_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24287,14 +24178,14 @@ _loop1_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop1_109: lambda_param_no_default +// _loop1_108: lambda_param_no_default static asdl_seq * -_loop1_109_rule(Parser *p) +_loop1_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24318,7 +24209,7 @@ _loop1_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24340,7 +24231,7 @@ _loop1_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -24358,14 +24249,14 @@ _loop1_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); D(p->level--); return _seq; } -// _loop1_110: lambda_param_no_default +// _loop1_109: lambda_param_no_default static asdl_seq * -_loop1_110_rule(Parser *p) +_loop1_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24389,7 +24280,7 @@ _loop1_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24411,7 +24302,7 @@ _loop1_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -24429,14 +24320,14 @@ _loop1_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); D(p->level--); return _seq; } -// _loop0_111: lambda_param_no_default +// _loop0_110: lambda_param_no_default static asdl_seq * -_loop0_111_rule(Parser *p) +_loop0_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24460,7 +24351,7 @@ _loop0_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24482,7 +24373,7 @@ _loop0_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24495,14 +24386,14 @@ _loop0_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); D(p->level--); return _seq; } -// _loop1_112: lambda_param_with_default +// _loop1_111: lambda_param_with_default static asdl_seq * -_loop1_112_rule(Parser *p) +_loop1_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24526,7 +24417,7 @@ _loop1_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24548,7 +24439,7 @@ _loop1_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24566,14 +24457,14 @@ _loop1_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); D(p->level--); return _seq; } -// _loop0_113: lambda_param_no_default +// _loop0_112: lambda_param_no_default static asdl_seq * -_loop0_113_rule(Parser *p) +_loop0_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24597,7 +24488,7 @@ _loop0_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24619,7 +24510,7 @@ _loop0_113_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24632,14 +24523,14 @@ _loop0_113_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_113_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); D(p->level--); return _seq; } -// _loop1_114: lambda_param_with_default +// _loop1_113: lambda_param_with_default static asdl_seq * -_loop1_114_rule(Parser *p) +_loop1_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24663,7 +24554,7 @@ _loop1_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24685,7 +24576,7 @@ _loop1_114_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24703,14 +24594,14 @@ _loop1_114_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); D(p->level--); return _seq; } -// _loop0_115: lambda_param_maybe_default +// _loop0_114: lambda_param_maybe_default static asdl_seq * -_loop0_115_rule(Parser *p) +_loop0_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24734,7 +24625,7 @@ _loop0_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -24756,7 +24647,7 @@ _loop0_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -24769,14 +24660,14 @@ _loop0_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); D(p->level--); return _seq; } -// _loop1_116: lambda_param_maybe_default +// _loop1_115: lambda_param_maybe_default static asdl_seq * -_loop1_116_rule(Parser *p) +_loop1_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24800,7 +24691,7 @@ _loop1_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -24822,7 +24713,7 @@ _loop1_116_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -24840,14 +24731,14 @@ _loop1_116_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); D(p->level--); return _seq; } -// _loop1_117: ('or' conjunction) +// _loop1_116: ('or' conjunction) static asdl_seq * -_loop1_117_rule(Parser *p) +_loop1_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24871,13 +24762,13 @@ _loop1_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_179_var; + D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_178_var; while ( - (_tmp_179_var = _tmp_179_rule(p)) // 'or' conjunction + (_tmp_178_var = _tmp_178_rule(p)) // 'or' conjunction ) { - _res = _tmp_179_var; + _res = _tmp_178_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24893,7 +24784,7 @@ _loop1_117_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -24911,14 +24802,14 @@ _loop1_117_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_117_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); D(p->level--); return _seq; } -// _loop1_118: ('and' inversion) +// _loop1_117: ('and' inversion) static asdl_seq * -_loop1_118_rule(Parser *p) +_loop1_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24942,13 +24833,13 @@ _loop1_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_180_var; + D(fprintf(stderr, "%*c> _loop1_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_179_var; while ( - (_tmp_180_var = _tmp_180_rule(p)) // 'and' inversion + (_tmp_179_var = _tmp_179_rule(p)) // 'and' inversion ) { - _res = _tmp_180_var; + _res = _tmp_179_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24964,7 +24855,7 @@ _loop1_118_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -24982,14 +24873,14 @@ _loop1_118_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_118_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_117_type, _seq); D(p->level--); return _seq; } -// _loop1_119: compare_op_bitwise_or_pair +// _loop1_118: compare_op_bitwise_or_pair static asdl_seq * -_loop1_119_rule(Parser *p) +_loop1_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25013,7 +24904,7 @@ _loop1_119_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -25035,7 +24926,7 @@ _loop1_119_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_119[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -25053,14 +24944,14 @@ _loop1_119_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_119_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_118_type, _seq); D(p->level--); return _seq; } -// _tmp_120: '!=' +// _tmp_119: '!=' static void * -_tmp_120_rule(Parser *p) +_tmp_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25074,13 +24965,13 @@ _tmp_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25090,7 +24981,7 @@ _tmp_120_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -25099,9 +24990,9 @@ _tmp_120_rule(Parser *p) return _res; } -// _loop0_122: ',' slice +// _loop0_121: ',' slice static asdl_seq * -_loop0_122_rule(Parser *p) +_loop0_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25125,7 +25016,7 @@ _loop0_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -25156,7 +25047,7 @@ _loop0_122_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25169,14 +25060,14 @@ _loop0_122_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); D(p->level--); return _seq; } -// _gather_121: slice _loop0_122 +// _gather_120: slice _loop0_121 static asdl_seq * -_gather_121_rule(Parser *p) +_gather_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25185,27 +25076,27 @@ _gather_121_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_122 + { // slice _loop0_121 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_122")); + D(fprintf(stderr, "%*c> _gather_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_122_rule(p)) // _loop0_122 + (seq = _loop0_121_rule(p)) // _loop0_121 ) { - D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_122")); + D(fprintf(stderr, "%*c+ _gather_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_122")); + D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_121")); } _res = NULL; done: @@ -25213,9 +25104,9 @@ _gather_121_rule(Parser *p) return _res; } -// _tmp_123: ':' expression? +// _tmp_122: ':' expression? static void * -_tmp_123_rule(Parser *p) +_tmp_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25229,7 +25120,7 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -25238,7 +25129,7 @@ _tmp_123_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25248,7 +25139,7 @@ _tmp_123_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -25257,9 +25148,9 @@ _tmp_123_rule(Parser *p) return _res; } -// _tmp_124: tuple | group | genexp +// _tmp_123: tuple | group | genexp static void * -_tmp_124_rule(Parser *p) +_tmp_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25273,18 +25164,18 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -25292,18 +25183,18 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -25311,18 +25202,18 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -25331,9 +25222,9 @@ _tmp_124_rule(Parser *p) return _res; } -// _tmp_125: list | listcomp +// _tmp_124: list | listcomp static void * -_tmp_125_rule(Parser *p) +_tmp_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25347,18 +25238,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -25366,18 +25257,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -25386,9 +25277,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _tmp_126: dict | set | dictcomp | setcomp +// _tmp_125: dict | set | dictcomp | setcomp static void * -_tmp_126_rule(Parser *p) +_tmp_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25402,18 +25293,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -25421,18 +25312,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -25440,18 +25331,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -25459,18 +25350,18 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -25479,9 +25370,9 @@ _tmp_126_rule(Parser *p) return _res; } -// _loop1_127: STRING +// _loop1_126: STRING static asdl_seq * -_loop1_127_rule(Parser *p) +_loop1_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25505,7 +25396,7 @@ _loop1_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -25527,7 +25418,7 @@ _loop1_127_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -25545,14 +25436,14 @@ _loop1_127_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_127_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_126_type, _seq); D(p->level--); return _seq; } -// _tmp_128: star_named_expression ',' star_named_expressions? +// _tmp_127: star_named_expression ',' star_named_expressions? static void * -_tmp_128_rule(Parser *p) +_tmp_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25566,7 +25457,7 @@ _tmp_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -25578,7 +25469,7 @@ _tmp_128_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25588,7 +25479,7 @@ _tmp_128_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -25597,9 +25488,9 @@ _tmp_128_rule(Parser *p) return _res; } -// _tmp_129: yield_expr | named_expression +// _tmp_128: yield_expr | named_expression static void * -_tmp_129_rule(Parser *p) +_tmp_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25613,18 +25504,18 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -25632,18 +25523,18 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -25652,9 +25543,9 @@ _tmp_129_rule(Parser *p) return _res; } -// _loop0_131: ',' double_starred_kvpair +// _loop0_130: ',' double_starred_kvpair static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25678,7 +25569,7 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -25709,7 +25600,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25722,14 +25613,14 @@ _loop0_131_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _gather_130: double_starred_kvpair _loop0_131 +// _gather_129: double_starred_kvpair _loop0_130 static asdl_seq * -_gather_130_rule(Parser *p) +_gather_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25738,27 +25629,27 @@ _gather_130_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_131 + { // double_starred_kvpair _loop0_130 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_131")); + D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_131_rule(p)) // _loop0_131 + (seq = _loop0_130_rule(p)) // _loop0_130 ) { - D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_131")); + D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_131")); + D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_130")); } _res = NULL; done: @@ -25766,9 +25657,9 @@ _gather_130_rule(Parser *p) return _res; } -// _loop1_132: for_if_clause +// _loop1_131: for_if_clause static asdl_seq * -_loop1_132_rule(Parser *p) +_loop1_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25792,7 +25683,7 @@ _loop1_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -25814,7 +25705,7 @@ _loop1_132_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -25832,14 +25723,14 @@ _loop1_132_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_132_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_131_type, _seq); D(p->level--); return _seq; } -// _loop0_133: ('if' disjunction) +// _loop0_132: ('if' disjunction) static asdl_seq * -_loop0_133_rule(Parser *p) +_loop0_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25863,13 +25754,13 @@ _loop0_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_181_var; + D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_180_var; while ( - (_tmp_181_var = _tmp_181_rule(p)) // 'if' disjunction + (_tmp_180_var = _tmp_180_rule(p)) // 'if' disjunction ) { - _res = _tmp_181_var; + _res = _tmp_180_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25885,7 +25776,7 @@ _loop0_133_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25898,14 +25789,14 @@ _loop0_133_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); D(p->level--); return _seq; } -// _loop0_134: ('if' disjunction) +// _loop0_133: ('if' disjunction) static asdl_seq * -_loop0_134_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25929,13 +25820,13 @@ _loop0_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_182_var; + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_181_var; while ( - (_tmp_182_var = _tmp_182_rule(p)) // 'if' disjunction + (_tmp_181_var = _tmp_181_rule(p)) // 'if' disjunction ) { - _res = _tmp_182_var; + _res = _tmp_181_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25951,7 +25842,7 @@ _loop0_134_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -25964,14 +25855,14 @@ _loop0_134_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _tmp_135: ',' args +// _tmp_134: ',' args static void * -_tmp_135_rule(Parser *p) +_tmp_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25985,7 +25876,7 @@ _tmp_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -25994,7 +25885,7 @@ _tmp_135_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26004,7 +25895,7 @@ _tmp_135_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -26013,9 +25904,9 @@ _tmp_135_rule(Parser *p) return _res; } -// _tmp_136: ',' args +// _tmp_135: ',' args static void * -_tmp_136_rule(Parser *p) +_tmp_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26029,7 +25920,7 @@ _tmp_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' args")); Token * _literal; expr_ty c; if ( @@ -26038,7 +25929,7 @@ _tmp_136_rule(Parser *p) (c = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); + D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' args")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26048,7 +25939,7 @@ _tmp_136_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); } _res = NULL; @@ -26057,9 +25948,9 @@ _tmp_136_rule(Parser *p) return _res; } -// _loop0_138: ',' kwarg_or_starred +// _loop0_137: ',' kwarg_or_starred static asdl_seq * -_loop0_138_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26083,7 +25974,7 @@ _loop0_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -26114,7 +26005,7 @@ _loop0_138_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26127,14 +26018,14 @@ _loop0_138_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_137: kwarg_or_starred _loop0_138 +// _gather_136: kwarg_or_starred _loop0_137 static asdl_seq * -_gather_137_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26143,27 +26034,27 @@ _gather_137_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_138 + { // kwarg_or_starred _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_137")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_138_rule(p)) // _loop0_138 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_137")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_138")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_137")); } _res = NULL; done: @@ -26171,9 +26062,9 @@ _gather_137_rule(Parser *p) return _res; } -// _loop0_140: ',' kwarg_or_double_starred +// _loop0_139: ',' kwarg_or_double_starred static asdl_seq * -_loop0_140_rule(Parser *p) +_loop0_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26197,7 +26088,7 @@ _loop0_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -26228,7 +26119,7 @@ _loop0_140_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26241,14 +26132,14 @@ _loop0_140_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); D(p->level--); return _seq; } -// _gather_139: kwarg_or_double_starred _loop0_140 +// _gather_138: kwarg_or_double_starred _loop0_139 static asdl_seq * -_gather_139_rule(Parser *p) +_gather_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26257,27 +26148,27 @@ _gather_139_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_140 + { // kwarg_or_double_starred _loop0_139 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_139")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_140_rule(p)) // _loop0_140 + (seq = _loop0_139_rule(p)) // _loop0_139 ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_139")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_139")); } _res = NULL; done: @@ -26285,9 +26176,9 @@ _gather_139_rule(Parser *p) return _res; } -// _loop0_142: ',' kwarg_or_starred +// _loop0_141: ',' kwarg_or_starred static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26311,7 +26202,7 @@ _loop0_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -26342,7 +26233,7 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26355,14 +26246,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _gather_141: kwarg_or_starred _loop0_142 +// _gather_140: kwarg_or_starred _loop0_141 static asdl_seq * -_gather_141_rule(Parser *p) +_gather_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26371,27 +26262,27 @@ _gather_141_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_142 + { // kwarg_or_starred _loop0_141 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_142")); + D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_141")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_142_rule(p)) // _loop0_142 + (seq = _loop0_141_rule(p)) // _loop0_141 ) { - D(fprintf(stderr, "%*c+ _gather_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_142")); + D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_141")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_141[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_142")); + D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_141")); } _res = NULL; done: @@ -26399,9 +26290,9 @@ _gather_141_rule(Parser *p) return _res; } -// _loop0_144: ',' kwarg_or_double_starred +// _loop0_143: ',' kwarg_or_double_starred static asdl_seq * -_loop0_144_rule(Parser *p) +_loop0_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26425,7 +26316,7 @@ _loop0_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -26456,7 +26347,7 @@ _loop0_144_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26469,14 +26360,14 @@ _loop0_144_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); D(p->level--); return _seq; } -// _gather_143: kwarg_or_double_starred _loop0_144 +// _gather_142: kwarg_or_double_starred _loop0_143 static asdl_seq * -_gather_143_rule(Parser *p) +_gather_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26485,27 +26376,27 @@ _gather_143_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_144 + { // kwarg_or_double_starred _loop0_143 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_144")); + D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_143")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_144_rule(p)) // _loop0_144 + (seq = _loop0_143_rule(p)) // _loop0_143 ) { - D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_144")); + D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_143")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_144")); + D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_143")); } _res = NULL; done: @@ -26513,9 +26404,9 @@ _gather_143_rule(Parser *p) return _res; } -// _loop0_145: (',' star_target) +// _loop0_144: (',' star_target) static asdl_seq * -_loop0_145_rule(Parser *p) +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26539,13 +26430,13 @@ _loop0_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_183_var; + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_182_var; while ( - (_tmp_183_var = _tmp_183_rule(p)) // ',' star_target + (_tmp_182_var = _tmp_182_rule(p)) // ',' star_target ) { - _res = _tmp_183_var; + _res = _tmp_182_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26561,7 +26452,7 @@ _loop0_145_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26574,14 +26465,14 @@ _loop0_145_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); D(p->level--); return _seq; } -// _loop0_147: ',' star_target +// _loop0_146: ',' star_target static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26605,7 +26496,7 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -26636,7 +26527,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26649,14 +26540,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); D(p->level--); return _seq; } -// _gather_146: star_target _loop0_147 +// _gather_145: star_target _loop0_146 static asdl_seq * -_gather_146_rule(Parser *p) +_gather_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26665,27 +26556,27 @@ _gather_146_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_147 + { // star_target _loop0_146 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_147")); + D(fprintf(stderr, "%*c> _gather_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_146")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_147_rule(p)) // _loop0_147 + (seq = _loop0_146_rule(p)) // _loop0_146 ) { - D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_147")); + D(fprintf(stderr, "%*c+ _gather_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_146")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_147")); + D(fprintf(stderr, "%*c%s _gather_145[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_146")); } _res = NULL; done: @@ -26693,9 +26584,9 @@ _gather_146_rule(Parser *p) return _res; } -// _tmp_148: !'*' star_target +// _tmp_147: !'*' star_target static void * -_tmp_148_rule(Parser *p) +_tmp_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26709,7 +26600,7 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -26717,12 +26608,12 @@ _tmp_148_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -26731,9 +26622,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _loop0_150: ',' del_target +// _loop0_149: ',' del_target static asdl_seq * -_loop0_150_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26757,7 +26648,7 @@ _loop0_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -26788,7 +26679,7 @@ _loop0_150_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26801,14 +26692,14 @@ _loop0_150_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _gather_149: del_target _loop0_150 +// _gather_148: del_target _loop0_149 static asdl_seq * -_gather_149_rule(Parser *p) +_gather_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26817,27 +26708,27 @@ _gather_149_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_150 + { // del_target _loop0_149 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_150")); + D(fprintf(stderr, "%*c> _gather_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_149")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_150_rule(p)) // _loop0_150 + (seq = _loop0_149_rule(p)) // _loop0_149 ) { - D(fprintf(stderr, "%*c+ _gather_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_150")); + D(fprintf(stderr, "%*c+ _gather_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_149")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_149[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_150")); + D(fprintf(stderr, "%*c%s _gather_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_149")); } _res = NULL; done: @@ -26845,9 +26736,9 @@ _gather_149_rule(Parser *p) return _res; } -// _loop0_152: ',' target +// _loop0_151: ',' target static asdl_seq * -_loop0_152_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26871,7 +26762,7 @@ _loop0_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -26902,7 +26793,7 @@ _loop0_152_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -26915,14 +26806,14 @@ _loop0_152_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); D(p->level--); return _seq; } -// _gather_151: target _loop0_152 +// _gather_150: target _loop0_151 static asdl_seq * -_gather_151_rule(Parser *p) +_gather_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26931,27 +26822,27 @@ _gather_151_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_152 + { // target _loop0_151 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_152")); + D(fprintf(stderr, "%*c> _gather_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_151")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_152_rule(p)) // _loop0_152 + (seq = _loop0_151_rule(p)) // _loop0_151 ) { - D(fprintf(stderr, "%*c+ _gather_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_152")); + D(fprintf(stderr, "%*c+ _gather_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_151")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_151[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_152")); + D(fprintf(stderr, "%*c%s _gather_150[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_151")); } _res = NULL; done: @@ -26959,9 +26850,9 @@ _gather_151_rule(Parser *p) return _res; } -// _tmp_153: args | expression for_if_clauses +// _tmp_152: args | expression for_if_clauses static void * -_tmp_153_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26975,18 +26866,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -26994,7 +26885,7 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_seq* for_if_clauses_var; if ( @@ -27003,12 +26894,12 @@ _tmp_153_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -27017,9 +26908,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _loop0_154: star_named_expressions +// _loop0_153: star_named_expressions static asdl_seq * -_loop0_154_rule(Parser *p) +_loop0_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27043,7 +26934,7 @@ _loop0_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -27065,7 +26956,7 @@ _loop0_154_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27078,14 +26969,14 @@ _loop0_154_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_154_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_153_type, _seq); D(p->level--); return _seq; } -// _loop0_155: (star_targets '=') +// _loop0_154: (star_targets '=') static asdl_seq * -_loop0_155_rule(Parser *p) +_loop0_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27109,13 +27000,13 @@ _loop0_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_184_var; + D(fprintf(stderr, "%*c> _loop0_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_183_var; while ( - (_tmp_184_var = _tmp_184_rule(p)) // star_targets '=' + (_tmp_183_var = _tmp_183_rule(p)) // star_targets '=' ) { - _res = _tmp_184_var; + _res = _tmp_183_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27131,7 +27022,7 @@ _loop0_155_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27144,14 +27035,14 @@ _loop0_155_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_154_type, _seq); D(p->level--); return _seq; } -// _loop0_156: (star_targets '=') +// _loop0_155: (star_targets '=') static asdl_seq * -_loop0_156_rule(Parser *p) +_loop0_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27175,13 +27066,13 @@ _loop0_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_185_var; + D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_184_var; while ( - (_tmp_185_var = _tmp_185_rule(p)) // star_targets '=' + (_tmp_184_var = _tmp_184_rule(p)) // star_targets '=' ) { - _res = _tmp_185_var; + _res = _tmp_184_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27197,7 +27088,7 @@ _loop0_156_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27210,14 +27101,14 @@ _loop0_156_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); D(p->level--); return _seq; } -// _tmp_157: yield_expr | star_expressions +// _tmp_156: yield_expr | star_expressions static void * -_tmp_157_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27231,18 +27122,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -27250,18 +27141,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -27270,9 +27161,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: '[' | '(' | '{' +// _tmp_157: '[' | '(' | '{' static void * -_tmp_158_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27286,18 +27177,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -27305,18 +27196,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -27324,18 +27215,18 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -27344,9 +27235,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _loop0_159: param_no_default +// _loop0_158: param_no_default static asdl_seq * -_loop0_159_rule(Parser *p) +_loop0_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27370,7 +27261,7 @@ _loop0_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -27392,7 +27283,7 @@ _loop0_159_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27405,14 +27296,14 @@ _loop0_159_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_159_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_158_type, _seq); D(p->level--); return _seq; } -// _tmp_160: slash_with_default | param_with_default+ +// _tmp_159: slash_with_default | param_with_default+ static void * -_tmp_160_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27426,18 +27317,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -27445,18 +27336,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_186_var; + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_185_var; if ( - (_loop1_186_var = _loop1_186_rule(p)) // param_with_default+ + (_loop1_185_var = _loop1_185_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_186_var; + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_185_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -27465,9 +27356,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _loop0_161: lambda_param_no_default +// _loop0_160: lambda_param_no_default static asdl_seq * -_loop0_161_rule(Parser *p) +_loop0_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27491,7 +27382,7 @@ _loop0_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -27513,7 +27404,7 @@ _loop0_161_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27526,14 +27417,14 @@ _loop0_161_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_161_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_160_type, _seq); D(p->level--); return _seq; } -// _tmp_162: lambda_slash_with_default | lambda_param_with_default+ +// _tmp_161: lambda_slash_with_default | lambda_param_with_default+ static void * -_tmp_162_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27547,18 +27438,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); SlashWithDefault* lambda_slash_with_default_var; if ( (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); _res = lambda_slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); } { // lambda_param_with_default+ @@ -27566,18 +27457,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - asdl_seq * _loop1_187_var; + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + asdl_seq * _loop1_186_var; if ( - (_loop1_187_var = _loop1_187_rule(p)) // lambda_param_with_default+ + (_loop1_186_var = _loop1_186_rule(p)) // lambda_param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - _res = _loop1_187_var; + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + _res = _loop1_186_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); } _res = NULL; @@ -27586,9 +27477,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _tmp_163: ')' | ',' (')' | '**') +// _tmp_162: ')' | ',' (')' | '**') static void * -_tmp_163_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27602,18 +27493,18 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -27621,21 +27512,21 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_188_var; + void *_tmp_187_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_188_var = _tmp_188_rule(p)) // ')' | '**' + (_tmp_187_var = _tmp_187_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_188_var); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_187_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -27644,9 +27535,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: ':' | ',' (':' | '**') +// _tmp_163: ':' | ',' (':' | '**') static void * -_tmp_164_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27660,18 +27551,18 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -27679,21 +27570,21 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_189_var; + void *_tmp_188_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_189_var = _tmp_189_rule(p)) // ':' | '**' + (_tmp_188_var = _tmp_188_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_189_var); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_188_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -27702,9 +27593,9 @@ _tmp_164_rule(Parser *p) return _res; } -// _tmp_165: star_targets '=' +// _tmp_164: star_targets '=' static void * -_tmp_165_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27718,7 +27609,7 @@ _tmp_165_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -27727,7 +27618,7 @@ _tmp_165_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27737,7 +27628,7 @@ _tmp_165_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -27746,9 +27637,9 @@ _tmp_165_rule(Parser *p) return _res; } -// _tmp_166: '.' | '...' +// _tmp_165: '.' | '...' static void * -_tmp_166_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27762,18 +27653,18 @@ _tmp_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -27781,18 +27672,18 @@ _tmp_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -27801,9 +27692,9 @@ _tmp_166_rule(Parser *p) return _res; } -// _tmp_167: '.' | '...' +// _tmp_166: '.' | '...' static void * -_tmp_167_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27817,18 +27708,18 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -27836,18 +27727,18 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -27856,9 +27747,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _loop0_169: ',' pattern +// _loop0_168: ',' pattern static asdl_seq * -_loop0_169_rule(Parser *p) +_loop0_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27882,7 +27773,7 @@ _loop0_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; expr_ty elem; while ( @@ -27913,7 +27804,7 @@ _loop0_169_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -27926,14 +27817,14 @@ _loop0_169_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_169_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); D(p->level--); return _seq; } -// _gather_168: pattern _loop0_169 +// _gather_167: pattern _loop0_168 static asdl_seq * -_gather_168_rule(Parser *p) +_gather_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27942,27 +27833,27 @@ _gather_168_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_169 + { // pattern _loop0_168 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_169")); + D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_168")); expr_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_169_rule(p)) // _loop0_169 + (seq = _loop0_168_rule(p)) // _loop0_168 ) { - D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_169")); + D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_168")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_168[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_169")); + D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_168")); } _res = NULL; done: @@ -27970,9 +27861,9 @@ _gather_168_rule(Parser *p) return _res; } -// _loop0_171: ',' error_argument_pattern +// _loop0_170: ',' error_argument_pattern static asdl_seq * -_loop0_171_rule(Parser *p) +_loop0_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27996,7 +27887,7 @@ _loop0_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); Token * _literal; void *elem; while ( @@ -28027,7 +27918,7 @@ _loop0_171_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -28040,14 +27931,14 @@ _loop0_171_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_171_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); D(p->level--); return _seq; } -// _gather_170: error_argument_pattern _loop0_171 +// _gather_169: error_argument_pattern _loop0_170 static asdl_seq * -_gather_170_rule(Parser *p) +_gather_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28056,27 +27947,27 @@ _gather_170_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // error_argument_pattern _loop0_171 + { // error_argument_pattern _loop0_170 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_170")); void *elem; asdl_seq * seq; if ( (elem = error_argument_pattern_rule(p)) // error_argument_pattern && - (seq = _loop0_171_rule(p)) // _loop0_171 + (seq = _loop0_170_rule(p)) // _loop0_170 ) { - D(fprintf(stderr, "%*c+ _gather_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_170")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_170[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_170")); } _res = NULL; done: @@ -28084,9 +27975,9 @@ _gather_170_rule(Parser *p) return _res; } -// _loop0_173: ',' error_argument_pattern +// _loop0_172: ',' error_argument_pattern static asdl_seq * -_loop0_173_rule(Parser *p) +_loop0_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28110,7 +28001,7 @@ _loop0_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); + D(fprintf(stderr, "%*c> _loop0_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); Token * _literal; void *elem; while ( @@ -28141,7 +28032,7 @@ _loop0_173_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -28154,14 +28045,14 @@ _loop0_173_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_173_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_172_type, _seq); D(p->level--); return _seq; } -// _gather_172: error_argument_pattern _loop0_173 +// _gather_171: error_argument_pattern _loop0_172 static asdl_seq * -_gather_172_rule(Parser *p) +_gather_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28170,27 +28061,27 @@ _gather_172_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // error_argument_pattern _loop0_173 + { // error_argument_pattern _loop0_172 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c> _gather_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_172")); void *elem; asdl_seq * seq; if ( (elem = error_argument_pattern_rule(p)) // error_argument_pattern && - (seq = _loop0_173_rule(p)) // _loop0_173 + (seq = _loop0_172_rule(p)) // _loop0_172 ) { - D(fprintf(stderr, "%*c+ _gather_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c+ _gather_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_172")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_172[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c%s _gather_171[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_172")); } _res = NULL; done: @@ -28198,9 +28089,9 @@ _gather_172_rule(Parser *p) return _res; } -// _loop0_175: ',' (error_argument_pattern | error_star) +// _loop0_174: ',' (error_argument_pattern | error_star) static asdl_seq * -_loop0_175_rule(Parser *p) +_loop0_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28224,13 +28115,13 @@ _loop0_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (error_argument_pattern | error_star)")); + D(fprintf(stderr, "%*c> _loop0_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (error_argument_pattern | error_star)")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_190_rule(p)) // error_argument_pattern | error_star + (elem = _tmp_189_rule(p)) // error_argument_pattern | error_star ) { _res = elem; @@ -28255,7 +28146,7 @@ _loop0_175_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (error_argument_pattern | error_star)")); } asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); @@ -28268,14 +28159,14 @@ _loop0_175_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_175_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_174_type, _seq); D(p->level--); return _seq; } -// _gather_174: (error_argument_pattern | error_star) _loop0_175 +// _gather_173: (error_argument_pattern | error_star) _loop0_174 static asdl_seq * -_gather_174_rule(Parser *p) +_gather_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28284,27 +28175,27 @@ _gather_174_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (error_argument_pattern | error_star) _loop0_175 + { // (error_argument_pattern | error_star) _loop0_174 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c> _gather_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_174")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_190_rule(p)) // error_argument_pattern | error_star + (elem = _tmp_189_rule(p)) // error_argument_pattern | error_star && - (seq = _loop0_175_rule(p)) // _loop0_175 + (seq = _loop0_174_rule(p)) // _loop0_174 ) { - D(fprintf(stderr, "%*c+ _gather_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c+ _gather_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_174")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_174[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c%s _gather_173[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(error_argument_pattern | error_star) _loop0_174")); } _res = NULL; done: @@ -28312,9 +28203,9 @@ _gather_174_rule(Parser *p) return _res; } -// _tmp_176: '@' named_expression NEWLINE +// _tmp_175: '@' named_expression NEWLINE static void * -_tmp_176_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28328,7 +28219,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -28340,7 +28231,7 @@ _tmp_176_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28350,7 +28241,7 @@ _tmp_176_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -28359,9 +28250,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: ',' star_expression +// _tmp_176: ',' star_expression static void * -_tmp_177_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28375,7 +28266,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -28384,7 +28275,7 @@ _tmp_177_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28394,7 +28285,7 @@ _tmp_177_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -28403,9 +28294,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _tmp_178: ',' expression +// _tmp_177: ',' expression static void * -_tmp_178_rule(Parser *p) +_tmp_177_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28419,7 +28310,7 @@ _tmp_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -28428,7 +28319,7 @@ _tmp_178_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28438,7 +28329,7 @@ _tmp_178_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -28447,9 +28338,9 @@ _tmp_178_rule(Parser *p) return _res; } -// _tmp_179: 'or' conjunction +// _tmp_178: 'or' conjunction static void * -_tmp_179_rule(Parser *p) +_tmp_178_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28463,7 +28354,7 @@ _tmp_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -28472,7 +28363,7 @@ _tmp_179_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28482,7 +28373,7 @@ _tmp_179_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -28491,9 +28382,9 @@ _tmp_179_rule(Parser *p) return _res; } -// _tmp_180: 'and' inversion +// _tmp_179: 'and' inversion static void * -_tmp_180_rule(Parser *p) +_tmp_179_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28507,7 +28398,7 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -28516,7 +28407,7 @@ _tmp_180_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28526,7 +28417,7 @@ _tmp_180_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -28535,9 +28426,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: 'if' disjunction +// _tmp_180: 'if' disjunction static void * -_tmp_181_rule(Parser *p) +_tmp_180_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28551,7 +28442,7 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -28560,7 +28451,7 @@ _tmp_181_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28570,7 +28461,7 @@ _tmp_181_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -28579,9 +28470,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: 'if' disjunction +// _tmp_181: 'if' disjunction static void * -_tmp_182_rule(Parser *p) +_tmp_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28595,7 +28486,7 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -28604,7 +28495,7 @@ _tmp_182_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28614,7 +28505,7 @@ _tmp_182_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -28623,9 +28514,9 @@ _tmp_182_rule(Parser *p) return _res; } -// _tmp_183: ',' star_target +// _tmp_182: ',' star_target static void * -_tmp_183_rule(Parser *p) +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28639,7 +28530,7 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -28648,7 +28539,7 @@ _tmp_183_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28658,7 +28549,7 @@ _tmp_183_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -28667,9 +28558,9 @@ _tmp_183_rule(Parser *p) return _res; } -// _tmp_184: star_targets '=' +// _tmp_183: star_targets '=' static void * -_tmp_184_rule(Parser *p) +_tmp_183_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28683,7 +28574,7 @@ _tmp_184_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -28692,12 +28583,12 @@ _tmp_184_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -28706,9 +28597,9 @@ _tmp_184_rule(Parser *p) return _res; } -// _tmp_185: star_targets '=' +// _tmp_184: star_targets '=' static void * -_tmp_185_rule(Parser *p) +_tmp_184_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28722,7 +28613,7 @@ _tmp_185_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -28731,12 +28622,12 @@ _tmp_185_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -28745,9 +28636,9 @@ _tmp_185_rule(Parser *p) return _res; } -// _loop1_186: param_with_default +// _loop1_185: param_with_default static asdl_seq * -_loop1_186_rule(Parser *p) +_loop1_185_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28771,7 +28662,7 @@ _loop1_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -28793,7 +28684,7 @@ _loop1_186_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_185[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28811,14 +28702,14 @@ _loop1_186_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_186_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_185_type, _seq); D(p->level--); return _seq; } -// _loop1_187: lambda_param_with_default +// _loop1_186: lambda_param_with_default static asdl_seq * -_loop1_187_rule(Parser *p) +_loop1_186_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28842,7 +28733,7 @@ _loop1_187_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -28864,7 +28755,7 @@ _loop1_187_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_187[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_186[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28882,14 +28773,14 @@ _loop1_187_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_187_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_186_type, _seq); D(p->level--); return _seq; } -// _tmp_188: ')' | '**' +// _tmp_187: ')' | '**' static void * -_tmp_188_rule(Parser *p) +_tmp_187_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28903,18 +28794,18 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -28922,18 +28813,18 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -28942,9 +28833,9 @@ _tmp_188_rule(Parser *p) return _res; } -// _tmp_189: ':' | '**' +// _tmp_188: ':' | '**' static void * -_tmp_189_rule(Parser *p) +_tmp_188_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28958,18 +28849,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -28977,18 +28868,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -28997,9 +28888,9 @@ _tmp_189_rule(Parser *p) return _res; } -// _tmp_190: error_argument_pattern | error_star +// _tmp_189: error_argument_pattern | error_star static void * -_tmp_190_rule(Parser *p) +_tmp_189_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29013,18 +28904,18 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); void *error_argument_pattern_var; if ( (error_argument_pattern_var = error_argument_pattern_rule(p)) // error_argument_pattern ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); _res = error_argument_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern")); } { // error_star @@ -29032,18 +28923,18 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); expr_ty error_star_var; if ( (error_star_var = error_star_rule(p)) // error_star ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); _res = error_star_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); } _res = NULL; diff --git a/Python/compile.c b/Python/compile.c index b12037bfd97b3c..246310a261ee71 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2749,15 +2749,14 @@ compiler_if(struct compiler *c, stmt_ty s) } #define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && (N)->v.Name.ctx == Store && \ - _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + ((N)->kind == Name_kind && \ + _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context pc) { - assert(p->kind == Attribute_kind || p->kind == Constant_kind || p->kind == Name_kind); + assert(p->kind == Attribute_kind || p->kind == Constant_kind); assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); - assert(p->kind != Name_kind || p->v.Name.ctx == Load); VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); return 1; @@ -2899,9 +2898,6 @@ static int compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == Name_kind); - if (p->v.Name.ctx == Load) { - return compiler_pattern_load(c, p, pc); - } assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { ADDOP(c, POP_TOP); From 123e15b2b6fc1176e600b01d9cc67eaf0a691257 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 5 Jul 2020 08:57:41 -0700 Subject: [PATCH 122/218] Only use nonnegative integer indices --- Doc/library/dis.rst | 21 ++++++++++++ Include/opcode.h | 3 ++ Lib/importlib/_bootstrap_external.py | 4 +-- Lib/opcode.py | 4 ++- Python/ceval.c | 49 ++++++++++++++++++++++++++++ Python/compile.c | 48 ++++++++++----------------- Python/importlib_external.h | 2 +- Python/opcode_targets.h | 6 ++-- 8 files changed, 100 insertions(+), 37 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 361eec0a5696f9..7efaf05e9ffcc9 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1227,6 +1227,27 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 +.. opcode:: MATCH_ITEM (i) + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_ITEM_END (i) + + TODO + + .. versionadded:: 3.10 + + +.. opcode:: MATCH_ITEM_SLICE (ij) + + TODO + + .. versionadded:: 3.10 + + .. opcode:: HAVE_ARGUMENT This is not really an opcode. It identifies the dividing line between diff --git a/Include/opcode.h b/Include/opcode.h index 24a21dc86b590a..db4da0bfad8ef5 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -122,6 +122,9 @@ extern "C" { #define LOAD_CLASSDEREF 148 #define MATCH_CLASS 149 #define MATCH_KEYS 150 +#define MATCH_ITEM 151 +#define MATCH_ITEM_END 152 +#define MATCH_ITEM_SLICE 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 17de85a43e8b39..05b87ea214c54c 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3464 (add structural pattern matching) +# Python 3.10a0 3465 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3464).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3465).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index e0ef77ea5e51f8..fb68736fa03155 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -197,7 +197,9 @@ def jabs_op(name, op): hasfree.append(148) def_op('MATCH_CLASS', 149) def_op('MATCH_KEYS', 150) - +def_op('MATCH_ITEM', 151) +def_op('MATCH_ITEM_END', 152) +def_op('MATCH_ITEM_SLICE', 153) jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) def_op('BUILD_CONST_KEY_MAP', 156) diff --git a/Python/ceval.c b/Python/ceval.c index 57c6f74b1f64ee..24013dd782c9af 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3634,6 +3634,55 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } + case TARGET(MATCH_ITEM): { + PyObject *item = PySequence_GetItem(SECOND(), oparg); + if (!item) { + goto error; + } + PUSH(item); + DISPATCH(); + } + + case TARGET(MATCH_ITEM_END): { + Py_ssize_t len = PyLong_AsSsize_t(TOP()); + if (len < 0) { + goto error; + } + assert(len - 1 - oparg >= 0); + PyObject *item = PySequence_GetItem(SECOND(), len - 1 - oparg); + if (!item) { + goto error; + } + PUSH(item); + DISPATCH(); + } + + case TARGET(MATCH_ITEM_SLICE): { + Py_ssize_t len = PyLong_AsSsize_t(TOP()); + if (len < 0) { + goto error; + } + Py_ssize_t start = oparg >> 16; + Py_ssize_t stop = len - (oparg & 0xFFFF); + assert(start <= stop); + PyObject *items = PyList_New(stop - start); + if (!items) { + goto error; + } + PyObject *target = SECOND(); + PyObject *item; + for (Py_ssize_t i = start; i < stop; i++) { + item = PySequence_GetItem(target, i); + if (!item) { + Py_DECREF(items); + goto error; + } + PyList_SET_ITEM(items, i - start, item); + } + PUSH(items); + DISPATCH(); + } + case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index 246310a261ee71..824e825bad36b5 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1109,6 +1109,9 @@ stack_effect(int opcode, int oparg, int jump) return 1; case MATCH_CLASS: return -1; + case MATCH_ITEM: + case MATCH_ITEM_END: + case MATCH_ITEM_SLICE: case MATCH_KEYS: case MATCH_MAPPING: case MATCH_SEQUENCE: @@ -2995,31 +2998,32 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) } star = i; } - basicblock *end; + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP(c, GET_LEN); if (star < 0) { - ADDOP(c, GET_LEN); + ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } else if (size) { - ADDOP(c, GET_LEN); + ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } for (Py_ssize_t i = 0; i < size; i++) { + // TODO: Raise for invalid sizes to MATCH_ITEM* opcodes. expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { continue; } if (star < 0 || i < star) { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); - ADDOP(c, BINARY_SUBSCR); + ADDOP_I(c, MATCH_ITEM, i); } else if (i == star) { assert(value->kind == Starred_kind); @@ -3027,34 +3031,18 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) if (WILDCARD_CHECK(value)) { continue; } - ADDOP(c, DUP_TOP); - ADDOP_I(c, BUILD_LIST, 0); - ADDOP(c, ROT_TWO); - if (i) { - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); - } - else { - ADDOP_LOAD_CONST(c, Py_None); - } - if (i != size - 1) { - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - 1 - i))); - } - else { - ADDOP_LOAD_CONST(c, Py_None); - } - ADDOP_I(c, BUILD_SLICE, 2); - ADDOP(c, BINARY_SUBSCR); - ADDOP_I(c, LIST_EXTEND, 1); + ADDOP_I(c, MATCH_ITEM_SLICE, (i << 16) + (size - 1 - i)); } else { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(-(size - i))); - ADDOP(c, BINARY_SUBSCR); + ADDOP_I(c, MATCH_ITEM_END, size - 1 - i); } CHECK(compiler_pattern(c, value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, block); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); compiler_use_next_block(c, end); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index f96f2c5d782bc6..53148ddda84dd1 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,136,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,137,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index d877d6b0697880..4febf772d76a52 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -150,9 +150,9 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_CLASSDEREF, &&TARGET_MATCH_CLASS, &&TARGET_MATCH_KEYS, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_ITEM, + &&TARGET_MATCH_ITEM_END, + &&TARGET_MATCH_ITEM_SLICE, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, From 2f03ae0b11fe69c3fa219c0a0e0a8c0a531d2b55 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 5 Jul 2020 08:58:00 -0700 Subject: [PATCH 123/218] Remove leading dot rules from unparsing logic --- Lib/ast.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index abb9ffc5cfdf41..aecbd013c0af07 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1106,8 +1106,6 @@ def _fstring_FormattedValue(self, node, write): write("}") def visit_Name(self, node): - if self.in_pattern() and isinstance(node.ctx, Load): - self.write(".") self.write(node.id) def _write_docstring(self, node): @@ -1367,14 +1365,7 @@ def visit_Attribute(self, node): def visit_Call(self, node): self.set_precedence(_Precedence.ATOM, node.func) - # We need to surround self.traverse(node.func) like this because - # ".xxx()" isn't legal in patterns (but visit_Name will try to include - # the leading dot if we're in a pattern). Temporary, as it's likely the - # pattern name load/store syntax will change... - _pattern = self.in_pattern() - self._pattern = False self.traverse(node.func) - self._pattern = _pattern with self.delimit("(", ")"): comma = False for e in node.args: From ef881fa07aea3a7f48d09bf2eba27b71b56a70d4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 5 Jul 2020 14:38:13 -0700 Subject: [PATCH 124/218] Use MATCH_ITEM for mapping and class patterns --- Python/ceval.c | 10 +++++----- Python/compile.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 24013dd782c9af..3420a1b4ba68e6 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3635,7 +3635,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_ITEM): { - PyObject *item = PySequence_GetItem(SECOND(), oparg); + PyObject *item = PySequence_GetItem(TOP(), oparg); if (!item) { goto error; } @@ -3644,12 +3644,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_ITEM_END): { - Py_ssize_t len = PyLong_AsSsize_t(TOP()); + Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; } assert(len - 1 - oparg >= 0); - PyObject *item = PySequence_GetItem(SECOND(), len - 1 - oparg); + PyObject *item = PySequence_GetItem(TOP(), len - 1 - oparg); if (!item) { goto error; } @@ -3658,7 +3658,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_ITEM_SLICE): { - Py_ssize_t len = PyLong_AsSsize_t(TOP()); + Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; } @@ -3669,7 +3669,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (!items) { goto error; } - PyObject *target = SECOND(); + PyObject *target = TOP(); PyObject *item; for (Py_ssize_t i = start; i < stop; i++) { item = PySequence_GetItem(target, i); diff --git a/Python/compile.c b/Python/compile.c index 824e825bad36b5..2fb98aefc4c135 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2795,9 +2795,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { if (WILDCARD_CHECK(arg)) { continue; } - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); - ADDOP(c, BINARY_SUBSCR); + // TODO: Validate arg; + ADDOP_I(c, MATCH_ITEM, i); CHECK(compiler_pattern(c, arg, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } @@ -2806,9 +2805,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { if (WILDCARD_CHECK(kwarg->value)) { continue; } - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(nargs + i)); - ADDOP(c, BINARY_SUBSCR); + // TODO: Validate arg; + ADDOP_I(c, MATCH_ITEM, nargs + i); CHECK(compiler_pattern(c, kwarg->value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } @@ -2874,9 +2872,8 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context pc) if (WILDCARD_CHECK(value)) { continue; } - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); - ADDOP(c, BINARY_SUBSCR); + // TODO: Validate arg; + ADDOP_I(c, MATCH_ITEM, i); CHECK(compiler_pattern(c, value, pc)); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } @@ -3016,6 +3013,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) ADDOP_COMPARE(c, GtE); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } + ADDOP(c, ROT_TWO); for (Py_ssize_t i = 0; i < size; i++) { // TODO: Raise for invalid sizes to MATCH_ITEM* opcodes. expr_ty value = asdl_seq_GET(values, i); From eb86fa7b798dbd82e73b332d13ab266872ade9ed Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 5 Jul 2020 17:10:09 -0700 Subject: [PATCH 125/218] Reduce unnecessary EXTENDED_ARG instructions --- Lib/importlib/_bootstrap_external.py | 4 ++-- Python/ceval.c | 4 ++-- Python/compile.c | 2 +- Python/importlib_external.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 05b87ea214c54c..299583fdd5f593 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3465 (add structural pattern matching) +# Python 3.10a0 3466 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3465).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3466).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/ceval.c b/Python/ceval.c index 3420a1b4ba68e6..353b69ffa13489 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3662,8 +3662,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (len < 0) { goto error; } - Py_ssize_t start = oparg >> 16; - Py_ssize_t stop = len - (oparg & 0xFFFF); + Py_ssize_t start = oparg & 0xFF; + Py_ssize_t stop = len - (oparg >> 8); assert(start <= stop); PyObject *items = PyList_New(stop - start); if (!items) { diff --git a/Python/compile.c b/Python/compile.c index 2fb98aefc4c135..526eb4e4210c5e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3029,7 +3029,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) if (WILDCARD_CHECK(value)) { continue; } - ADDOP_I(c, MATCH_ITEM_SLICE, (i << 16) + (size - 1 - i)); + ADDOP_I(c, MATCH_ITEM_SLICE, ((size - 1 - i) << 8) + i); } else { ADDOP_I(c, MATCH_ITEM_END, size - 1 - i); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 53148ddda84dd1..e52b9111c5519f 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,137,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,138,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, From f3d3d8350dec5847af149647df3628930ee2821e Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 11 Jul 2020 16:56:55 -0700 Subject: [PATCH 126/218] Documentation and cleanup --- Doc/library/dis.rst | 11 +- Python/ceval.c | 3 +- Python/compile.c | 1486 ++++++++++++++++++++++--------------------- 3 files changed, 779 insertions(+), 721 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 7efaf05e9ffcc9..f07742f5c07cf4 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1229,21 +1229,24 @@ All of the following opcodes use their arguments. .. opcode:: MATCH_ITEM (i) - TODO + TOS is a sequence. Push ``TOS[i]`` onto the stack. .. versionadded:: 3.10 .. opcode:: MATCH_ITEM_END (i) - TODO + TOS is a sequence, and TOS1 is its length. Push ``TOS[TOS1 - 1 - i]`` onto + the stack. .. versionadded:: 3.10 -.. opcode:: MATCH_ITEM_SLICE (ij) +.. opcode:: MATCH_ITEM_SLICE (i) - TODO + TOS is a sequence, and TOS1 is its length. Push a list formed from + ``TOS[x:TOS1 - 1 - y]`` onto the stack, where *x* is the low byte of *i* and + *y* is the high bytes of *i*. .. versionadded:: 3.10 diff --git a/Python/ceval.c b/Python/ceval.c index 353b69ffa13489..3deac496908c80 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3521,8 +3521,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_LEN): { - PyObject *target = TOP(); - Py_ssize_t l = PyObject_Length(target); + Py_ssize_t l = PyObject_Length(TOP()); if (l < 0) { goto error; } diff --git a/Python/compile.c b/Python/compile.c index 526eb4e4210c5e..aab9f514ba5577 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -225,6 +225,7 @@ static int compiler_async_comprehension_generator( expr_ty elt, expr_ty val, int type); static int compiler_pattern(struct compiler *, expr_ty, pattern_context); +static int compiler_match(struct compiler *, stmt_ty); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -2751,563 +2752,184 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } -#define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && \ - _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) static int -compiler_pattern_load(struct compiler *c, expr_ty p, pattern_context pc) +compiler_for(struct compiler *c, stmt_ty s) { - assert(p->kind == Attribute_kind || p->kind == Constant_kind); - assert(p->kind != Attribute_kind || p->v.Attribute.ctx == Load); - VISIT(c, expr, p); - ADDOP_COMPARE(c, Eq); - return 1; -} + basicblock *start, *cleanup, *end; -static int -compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { - asdl_seq *args = p->v.Call.args; - asdl_seq *kwargs = p->v.Call.keywords; - Py_ssize_t nargs = asdl_seq_LEN(args); - Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); - expr_ty func = p->v.Call.func; - assert(func->kind == Attribute_kind || func->kind == Name_kind); - assert(func->kind != Attribute_kind || func->v.Attribute.ctx == Load); - assert(func->kind != Name_kind || func->v.Name.ctx == Load); - VISIT(c, expr, func); - PyObject *kwnames; - CHECK(kwnames = PyTuple_New(nkwargs)); - Py_ssize_t i; - for (i = 0; i < nkwargs; i++) { - PyObject *name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; - Py_INCREF(name); - PyTuple_SET_ITEM(kwnames, i, name); - } - ADDOP_LOAD_CONST_NEW(c, kwnames); - ADDOP_I(c, MATCH_CLASS, nargs); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); - for (i = 0; i < nargs; i++) { - expr_ty arg = asdl_seq_GET(args, i); - if (WILDCARD_CHECK(arg)) { - continue; - } - // TODO: Validate arg; - ADDOP_I(c, MATCH_ITEM, i); - CHECK(compiler_pattern(c, arg, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + start = compiler_new_block(c); + cleanup = compiler_new_block(c); + end = compiler_new_block(c); + if (start == NULL || end == NULL || cleanup == NULL) { + return 0; } - for (i = 0; i < nkwargs; i++) { - keyword_ty kwarg = asdl_seq_GET(kwargs, i); - if (WILDCARD_CHECK(kwarg->value)) { - continue; - } - // TODO: Validate arg; - ADDOP_I(c, MATCH_ITEM, nargs + i); - CHECK(compiler_pattern(c, kwarg->value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) { + return 0; } - ADDOP_LOAD_CONST(c, Py_True); + VISIT(c, expr, s->v.For.iter); + ADDOP(c, GET_ITER); + compiler_use_next_block(c, start); + ADDOP_JREL(c, FOR_ITER, cleanup); + VISIT(c, expr, s->v.For.target); + VISIT_SEQ(c, stmt, s->v.For.body); + ADDOP_JABS(c, JUMP_ABSOLUTE, start); + compiler_use_next_block(c, cleanup); + + compiler_pop_fblock(c, FOR_LOOP, start); + + VISIT_SEQ(c, stmt, s->v.For.orelse); compiler_use_next_block(c, end); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); return 1; } + static int -compiler_pattern_store(struct compiler *c, expr_ty p, pattern_context pc) { - assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Store); - if (WILDCARD_CHECK(p)) { - return compiler_error(c, "can't assign to '_' here; " - "consider removing or renaming?"); +compiler_async_for(struct compiler *c, stmt_ty s) +{ + basicblock *start, *except, *end; + if (IS_TOP_LEVEL_AWAIT(c)){ + c->u->u_ste->ste_coroutine = 1; + } else if (c->u->u_scope_type != COMPILER_SCOPE_ASYNC_FUNCTION) { + return compiler_error(c, "'async for' outside async function"); } - if (PySet_Contains(pc.stores, p->v.Name.id)) { - // TODO: Format this error message with the name. - return compiler_error(c, "multiple assignments to name in pattern"); + + start = compiler_new_block(c); + except = compiler_new_block(c); + end = compiler_new_block(c); + + if (start == NULL || except == NULL || end == NULL) { + return 0; } - CHECK(!PySet_Add(pc.stores, p->v.Name.id)); - VISIT(c, expr, p); - ADDOP_LOAD_CONST(c, Py_True); + VISIT(c, expr, s->v.AsyncFor.iter); + ADDOP(c, GET_AITER); + + compiler_use_next_block(c, start); + if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) { + return 0; + } + /* SETUP_FINALLY to guard the __anext__ call */ + ADDOP_JREL(c, SETUP_FINALLY, except); + ADDOP(c, GET_ANEXT); + ADDOP_LOAD_CONST(c, Py_None); + ADDOP(c, YIELD_FROM); + ADDOP(c, POP_BLOCK); /* for SETUP_FINALLY */ + + /* Success block for __anext__ */ + VISIT(c, expr, s->v.AsyncFor.target); + VISIT_SEQ(c, stmt, s->v.AsyncFor.body); + ADDOP_JABS(c, JUMP_ABSOLUTE, start); + + compiler_pop_fblock(c, FOR_LOOP, start); + + /* Except block for __anext__ */ + compiler_use_next_block(c, except); + ADDOP(c, END_ASYNC_FOR); + + /* `else` block */ + VISIT_SEQ(c, stmt, s->v.For.orelse); + + compiler_use_next_block(c, end); + return 1; } static int -compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context pc) +compiler_while(struct compiler *c, stmt_ty s) { - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); - asdl_seq *keys = p->v.Dict.keys; - asdl_seq *values = p->v.Dict.values; - Py_ssize_t size = asdl_seq_LEN(values); - int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - ADDOP(c, MATCH_MAPPING); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - if (size - star) { - ADDOP(c, GET_LEN); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); - ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - } - Py_ssize_t i; - for (i = 0; i < size - star; i++) { - expr_ty key = asdl_seq_GET(keys, i); - if (!key) { - return compiler_error(c, "can't use starred pattern here; consider moving to end?"); + basicblock *loop, *orelse, *end, *anchor = NULL; + int constant = expr_constant(s->v.While.test); + + if (constant == 0) { + BEGIN_DO_NOT_EMIT_BYTECODE + // Push a dummy block so the VISIT_SEQ knows that we are + // inside a while loop so it can correctly evaluate syntax + // errors. + if (!compiler_push_fblock(c, WHILE_LOOP, NULL, NULL, NULL)) { + return 0; } - assert(key->kind == Attribute_kind || key->kind == Constant_kind || key->kind == Name_kind); - assert(key->kind != Attribute_kind || key->v.Attribute.ctx == Load); - assert(key->kind != Name_kind || key->v.Name.ctx == Load); - VISIT(c, expr, asdl_seq_GET(keys, i)); - } - ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); - for (i = 0; i < size - star; i++) { - expr_ty value = asdl_seq_GET(values, i); - if (WILDCARD_CHECK(value)) { - continue; + VISIT_SEQ(c, stmt, s->v.While.body); + // Remove the dummy block now that is not needed. + compiler_pop_fblock(c, WHILE_LOOP, NULL); + END_DO_NOT_EMIT_BYTECODE + if (s->v.While.orelse) { + VISIT_SEQ(c, stmt, s->v.While.orelse); } - // TODO: Validate arg; - ADDOP_I(c, MATCH_ITEM, i); - CHECK(compiler_pattern(c, value, pc)); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + return 1; } - ADDOP(c, POP_TOP); - if (star) { - CHECK(compiler_pattern_store(c, asdl_seq_GET(values, size - 1), pc)); + loop = compiler_new_block(c); + end = compiler_new_block(c); + if (constant == -1) { + anchor = compiler_new_block(c); + if (anchor == NULL) + return 0; } - else { - ADDOP(c, POP_TOP); - ADDOP_LOAD_CONST(c, Py_True); + if (loop == NULL || end == NULL) + return 0; + if (s->v.While.orelse) { + orelse = compiler_new_block(c); + if (orelse == NULL) + return 0; } - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP(c, POP_TOP); - ADDOP_LOAD_CONST(c, Py_False); + else + orelse = NULL; + + compiler_use_next_block(c, loop); + if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL)) + return 0; + if (constant == -1) { + if (!compiler_jump_if(c, s->v.While.test, anchor, 0)) + return 0; + } + VISIT_SEQ(c, stmt, s->v.While.body); + ADDOP_JABS(c, JUMP_ABSOLUTE, loop); + + /* XXX should the two POP instructions be in a separate block + if there is no else clause ? + */ + + if (constant == -1) + compiler_use_next_block(c, anchor); + compiler_pop_fblock(c, WHILE_LOOP, loop); + + if (orelse != NULL) /* what if orelse is just pass? */ + VISIT_SEQ(c, stmt, s->v.While.orelse); compiler_use_next_block(c, end); + return 1; } static int -compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) +compiler_return(struct compiler *c, stmt_ty s) { - assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Store); - if (WILDCARD_CHECK(p)) { - ADDOP(c, POP_TOP); - ADDOP_LOAD_CONST(c, Py_True); - return 1; + int preserve_tos = ((s->v.Return.value != NULL) && + (s->v.Return.value->kind != Constant_kind)); + if (c->u->u_ste->ste_type != FunctionBlock) + return compiler_error(c, "'return' outside function"); + if (s->v.Return.value != NULL && + c->u->u_ste->ste_coroutine && c->u->u_ste->ste_generator) + { + return compiler_error( + c, "'return' with value in async generator"); } - return compiler_pattern_store(c, p, pc); -} + if (preserve_tos) { + VISIT(c, expr, s->v.Return.value); + } + if (!compiler_unwind_fblock_stack(c, preserve_tos, NULL)) + return 0; + if (s->v.Return.value == NULL) { + ADDOP_LOAD_CONST(c, Py_None); + } + else if (!preserve_tos) { + VISIT(c, expr, s->v.Return.value); + } + ADDOP(c, RETURN_VALUE); -static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context pc) -{ - assert(p->kind == NamedExpr_kind); - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); - ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - CHECK(compiler_pattern_store(c, p->v.NamedExpr.target, pc)); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, end); return 1; } static int -compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context pc) -{ - assert(p->kind == BoolOp_kind); - assert(p->v.BoolOp.op == Or); - basicblock *end; - PyObject *control = NULL; - CHECK(end = compiler_new_block(c)); - Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); - assert(size > 1); - PyObject *names_copy; - for (Py_ssize_t i = 0; i < size; i++) { - CHECK(names_copy = PySet_New(pc.stores)); - ADDOP(c, DUP_TOP); - // TODO: Just modify pc instead. - pattern_context sub_pc = pc; - sub_pc.stores = names_copy; - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), sub_pc)); - ADDOP_JABS(c, JUMP_IF_TRUE_OR_POP, end); - // TODO: Reuse names_copy without actually building a new copy each loop? - if (!i) { - control = names_copy; - } - else if (PySet_GET_SIZE(control) || PySet_GET_SIZE(names_copy)) { - PyObject *diff = PyNumber_InPlaceXor(names_copy, control); - if (!diff) { - Py_DECREF(control); - return 0; - } - Py_DECREF(names_copy); - if (PySet_GET_SIZE(diff)) { - // TODO: Format this error message with a name. - // PyObject *extra = PySet_Pop(diff); - Py_DECREF(control); - Py_DECREF(diff); - return compiler_error(c, "pattern binds different names based on target"); - } - Py_DECREF(diff); - } - else { - Py_DECREF(names_copy); - } - } - assert(control); - Py_DECREF(control); - ADDOP_LOAD_CONST(c, Py_False); - compiler_use_next_block(c, end); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - return 1; -} - -static int -compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context pc) -{ - assert(p->kind == List_kind || p->kind == Tuple_kind); - asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; - Py_ssize_t size = asdl_seq_LEN(values); - Py_ssize_t star = -1; - for (Py_ssize_t i = 0; i < size; i++) { - expr_ty value = asdl_seq_GET(values, i); - if (value->kind != Starred_kind) { - continue; - } - if (star >= 0) { - return compiler_error(c, "multiple starred names in pattern"); - } - star = i; - } - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); - ADDOP(c, MATCH_SEQUENCE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); - ADDOP(c, GET_LEN); - if (star < 0) { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); - ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - } - else if (size) { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); - ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - } - ADDOP(c, ROT_TWO); - for (Py_ssize_t i = 0; i < size; i++) { - // TODO: Raise for invalid sizes to MATCH_ITEM* opcodes. - expr_ty value = asdl_seq_GET(values, i); - if (WILDCARD_CHECK(value)) { - continue; - } - if (star < 0 || i < star) { - ADDOP_I(c, MATCH_ITEM, i); - } - else if (i == star) { - assert(value->kind == Starred_kind); - value = value->v.Starred.value; - if (WILDCARD_CHECK(value)) { - continue; - } - ADDOP_I(c, MATCH_ITEM_SLICE, ((size - 1 - i) << 8) + i); - } - else { - ADDOP_I(c, MATCH_ITEM_END, size - 1 - i); - } - CHECK(compiler_pattern(c, value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - } - ADDOP_LOAD_CONST(c, Py_True); - compiler_use_next_block(c, block); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, end); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - return 1; -} - -static int -compiler_pattern(struct compiler *c, expr_ty p, pattern_context pc) -{ - SET_LOC(c, p); - switch (p->kind) { - case Attribute_kind: - case Constant_kind: - return compiler_pattern_load(c, p, pc); - case BinOp_kind: - // Because we allow "2+2j", things like "2+2" make it this far: - return compiler_error(c, "patterns cannot include operators"); - case BoolOp_kind: - return compiler_pattern_or(c, p, pc); - case Call_kind: - return compiler_pattern_call(c, p, pc); - case Dict_kind: - return compiler_pattern_mapping(c, p, pc); - case JoinedStr_kind: - // Because we allow strings, f-strings make it this far: - return compiler_error(c, "patterns cannot include f-strings"); - case List_kind: - case Tuple_kind: - return compiler_pattern_sequence(c, p, pc); - case Name_kind: - return compiler_pattern_name(c, p, pc); - case NamedExpr_kind: - return compiler_pattern_namedexpr(c, p, pc); - default: - Py_UNREACHABLE(); - } -} - -static int -compiler_match(struct compiler *c, stmt_ty s) -{ - VISIT(c, expr, s->v.Match.target); - basicblock *next, *end; - CHECK(end = compiler_new_block(c)); - int warned = 0; - Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); - assert(cases); - pattern_context pc; - CHECK(pc.stores = PySet_New(NULL)); - int last = 0; - match_case_ty m; - // TODO: Leaks pc.stores on failure. - for (Py_ssize_t i = 0; i < cases; i++) { - if (i == cases - 1) { - last = 1; - } - m = asdl_seq_GET(s->v.Match.cases, i); - SET_LOC(c, m->pattern); - CHECK(next = compiler_new_block(c)); - if (!last) { - ADDOP(c, DUP_TOP); - } - if (!warned && !last && !m->guard - && m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store) - { - warned = 1; - CHECK(compiler_warn(c, "unguarded name capture pattern makes " - "remaining cases unreachable")); - } - int result = compiler_pattern(c, m->pattern, pc); - PySet_Clear(pc.stores); - CHECK(result); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); - if (m->guard) { - CHECK(compiler_jump_if(c, m->guard, next, 0)); - } - if (!last) { - ADDOP(c, POP_TOP); - } - VISIT_SEQ(c, stmt, m->body); - if (!last) { - ADDOP_JREL(c, JUMP_FORWARD, end); - } - compiler_use_next_block(c, next); - } - Py_DECREF(pc.stores); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_for(struct compiler *c, stmt_ty s) -{ - basicblock *start, *cleanup, *end; - - start = compiler_new_block(c); - cleanup = compiler_new_block(c); - end = compiler_new_block(c); - if (start == NULL || end == NULL || cleanup == NULL) { - return 0; - } - if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) { - return 0; - } - VISIT(c, expr, s->v.For.iter); - ADDOP(c, GET_ITER); - compiler_use_next_block(c, start); - ADDOP_JREL(c, FOR_ITER, cleanup); - VISIT(c, expr, s->v.For.target); - VISIT_SEQ(c, stmt, s->v.For.body); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - compiler_use_next_block(c, cleanup); - - compiler_pop_fblock(c, FOR_LOOP, start); - - VISIT_SEQ(c, stmt, s->v.For.orelse); - compiler_use_next_block(c, end); - return 1; -} - - -static int -compiler_async_for(struct compiler *c, stmt_ty s) -{ - basicblock *start, *except, *end; - if (IS_TOP_LEVEL_AWAIT(c)){ - c->u->u_ste->ste_coroutine = 1; - } else if (c->u->u_scope_type != COMPILER_SCOPE_ASYNC_FUNCTION) { - return compiler_error(c, "'async for' outside async function"); - } - - start = compiler_new_block(c); - except = compiler_new_block(c); - end = compiler_new_block(c); - - if (start == NULL || except == NULL || end == NULL) { - return 0; - } - VISIT(c, expr, s->v.AsyncFor.iter); - ADDOP(c, GET_AITER); - - compiler_use_next_block(c, start); - if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) { - return 0; - } - /* SETUP_FINALLY to guard the __anext__ call */ - ADDOP_JREL(c, SETUP_FINALLY, except); - ADDOP(c, GET_ANEXT); - ADDOP_LOAD_CONST(c, Py_None); - ADDOP(c, YIELD_FROM); - ADDOP(c, POP_BLOCK); /* for SETUP_FINALLY */ - - /* Success block for __anext__ */ - VISIT(c, expr, s->v.AsyncFor.target); - VISIT_SEQ(c, stmt, s->v.AsyncFor.body); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - - compiler_pop_fblock(c, FOR_LOOP, start); - - /* Except block for __anext__ */ - compiler_use_next_block(c, except); - ADDOP(c, END_ASYNC_FOR); - - /* `else` block */ - VISIT_SEQ(c, stmt, s->v.For.orelse); - - compiler_use_next_block(c, end); - - return 1; -} - -static int -compiler_while(struct compiler *c, stmt_ty s) -{ - basicblock *loop, *orelse, *end, *anchor = NULL; - int constant = expr_constant(s->v.While.test); - - if (constant == 0) { - BEGIN_DO_NOT_EMIT_BYTECODE - // Push a dummy block so the VISIT_SEQ knows that we are - // inside a while loop so it can correctly evaluate syntax - // errors. - if (!compiler_push_fblock(c, WHILE_LOOP, NULL, NULL, NULL)) { - return 0; - } - VISIT_SEQ(c, stmt, s->v.While.body); - // Remove the dummy block now that is not needed. - compiler_pop_fblock(c, WHILE_LOOP, NULL); - END_DO_NOT_EMIT_BYTECODE - if (s->v.While.orelse) { - VISIT_SEQ(c, stmt, s->v.While.orelse); - } - return 1; - } - loop = compiler_new_block(c); - end = compiler_new_block(c); - if (constant == -1) { - anchor = compiler_new_block(c); - if (anchor == NULL) - return 0; - } - if (loop == NULL || end == NULL) - return 0; - if (s->v.While.orelse) { - orelse = compiler_new_block(c); - if (orelse == NULL) - return 0; - } - else - orelse = NULL; - - compiler_use_next_block(c, loop); - if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL)) - return 0; - if (constant == -1) { - if (!compiler_jump_if(c, s->v.While.test, anchor, 0)) - return 0; - } - VISIT_SEQ(c, stmt, s->v.While.body); - ADDOP_JABS(c, JUMP_ABSOLUTE, loop); - - /* XXX should the two POP instructions be in a separate block - if there is no else clause ? - */ - - if (constant == -1) - compiler_use_next_block(c, anchor); - compiler_pop_fblock(c, WHILE_LOOP, loop); - - if (orelse != NULL) /* what if orelse is just pass? */ - VISIT_SEQ(c, stmt, s->v.While.orelse); - compiler_use_next_block(c, end); - - return 1; -} - -static int -compiler_return(struct compiler *c, stmt_ty s) -{ - int preserve_tos = ((s->v.Return.value != NULL) && - (s->v.Return.value->kind != Constant_kind)); - if (c->u->u_ste->ste_type != FunctionBlock) - return compiler_error(c, "'return' outside function"); - if (s->v.Return.value != NULL && - c->u->u_ste->ste_coroutine && c->u->u_ste->ste_generator) - { - return compiler_error( - c, "'return' with value in async generator"); - } - if (preserve_tos) { - VISIT(c, expr, s->v.Return.value); - } - if (!compiler_unwind_fblock_stack(c, preserve_tos, NULL)) - return 0; - if (s->v.Return.value == NULL) { - ADDOP_LOAD_CONST(c, Py_None); - } - else if (!preserve_tos) { - VISIT(c, expr, s->v.Return.value); - } - ADDOP(c, RETURN_VALUE); - - return 1; -} - -static int -compiler_break(struct compiler *c) +compiler_break(struct compiler *c) { struct fblockinfo *loop = NULL; if (!compiler_unwind_fblock_stack(c, 0, &loop)) { @@ -5545,264 +5167,698 @@ compiler_augassign(struct compiler *c, stmt_ty s) return 0; } - c->u->u_lineno = old_lineno; - c->u->u_col_offset = old_col_offset; + c->u->u_lineno = old_lineno; + c->u->u_col_offset = old_col_offset; + + VISIT(c, expr, s->v.AugAssign.value); + ADDOP(c, inplace_binop(s->v.AugAssign.op)); + + SET_LOC(c, e); + + switch (e->kind) { + case Attribute_kind: + ADDOP(c, ROT_TWO); + ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names); + break; + case Subscript_kind: + ADDOP(c, ROT_THREE); + ADDOP(c, STORE_SUBSCR); + break; + case Name_kind: + return compiler_nameop(c, e->v.Name.id, Store); + default: + Py_UNREACHABLE(); + } + return 1; +} + +static int +check_ann_expr(struct compiler *c, expr_ty e) +{ + VISIT(c, expr, e); + ADDOP(c, POP_TOP); + return 1; +} + +static int +check_annotation(struct compiler *c, stmt_ty s) +{ + /* Annotations are only evaluated in a module or class. */ + if (c->u->u_scope_type == COMPILER_SCOPE_MODULE || + c->u->u_scope_type == COMPILER_SCOPE_CLASS) { + return check_ann_expr(c, s->v.AnnAssign.annotation); + } + return 1; +} + +static int +check_ann_subscr(struct compiler *c, expr_ty e) +{ + /* We check that everything in a subscript is defined at runtime. */ + switch (e->kind) { + case Slice_kind: + if (e->v.Slice.lower && !check_ann_expr(c, e->v.Slice.lower)) { + return 0; + } + if (e->v.Slice.upper && !check_ann_expr(c, e->v.Slice.upper)) { + return 0; + } + if (e->v.Slice.step && !check_ann_expr(c, e->v.Slice.step)) { + return 0; + } + return 1; + case Tuple_kind: { + /* extended slice */ + asdl_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))) { + return 0; + } + } + return 1; + } + default: + return check_ann_expr(c, e); + } +} + +static int +compiler_annassign(struct compiler *c, stmt_ty s) +{ + expr_ty targ = s->v.AnnAssign.target; + PyObject* mangled; + + assert(s->kind == AnnAssign_kind); + + /* We perform the actual assignment first. */ + if (s->v.AnnAssign.value) { + VISIT(c, expr, s->v.AnnAssign.value); + VISIT(c, expr, targ); + } + switch (targ->kind) { + case Name_kind: + if (forbidden_name(c, targ->v.Name.id, Store)) + return 0; + /* If we have a simple name in a module or class, store annotation. */ + if (s->v.AnnAssign.simple && + (c->u->u_scope_type == COMPILER_SCOPE_MODULE || + c->u->u_scope_type == COMPILER_SCOPE_CLASS)) { + if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) { + VISIT(c, annexpr, s->v.AnnAssign.annotation) + } + else { + VISIT(c, expr, s->v.AnnAssign.annotation); + } + ADDOP_NAME(c, LOAD_NAME, __annotations__, names); + mangled = _Py_Mangle(c->u->u_private, targ->v.Name.id); + ADDOP_LOAD_CONST_NEW(c, mangled); + ADDOP(c, STORE_SUBSCR); + } + break; + case Attribute_kind: + if (forbidden_name(c, targ->v.Attribute.attr, Store)) + return 0; + if (!s->v.AnnAssign.value && + !check_ann_expr(c, targ->v.Attribute.value)) { + return 0; + } + break; + case Subscript_kind: + if (!s->v.AnnAssign.value && + (!check_ann_expr(c, targ->v.Subscript.value) || + !check_ann_subscr(c, targ->v.Subscript.slice))) { + return 0; + } + break; + default: + PyErr_Format(PyExc_SystemError, + "invalid node type (%d) for annotated assignment", + targ->kind); + return 0; + } + /* Annotation is evaluated last. */ + if (!s->v.AnnAssign.simple && !check_annotation(c, s)) { + return 0; + } + return 1; +} + +/* Raises a SyntaxError and returns 0. + If something goes wrong, a different exception may be raised. +*/ + +static int +compiler_error(struct compiler *c, const char *errstr) +{ + PyObject *loc; + PyObject *u = NULL, *v = NULL; + + loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno); + if (!loc) { + Py_INCREF(Py_None); + loc = Py_None; + } + u = Py_BuildValue("(OiiO)", c->c_filename, c->u->u_lineno, + c->u->u_col_offset + 1, loc); + if (!u) + goto exit; + v = Py_BuildValue("(zO)", errstr, u); + if (!v) + goto exit; + PyErr_SetObject(PyExc_SyntaxError, v); + exit: + Py_DECREF(loc); + Py_XDECREF(u); + Py_XDECREF(v); + return 0; +} + +/* Emits a SyntaxWarning and returns 1 on success. + If a SyntaxWarning raised as error, replaces it with a SyntaxError + and returns 0. +*/ +static int +compiler_warn(struct compiler *c, const char *format, ...) +{ + va_list vargs; +#ifdef HAVE_STDARG_PROTOTYPES + va_start(vargs, format); +#else + va_start(vargs); +#endif + PyObject *msg = PyUnicode_FromFormatV(format, vargs); + va_end(vargs); + if (msg == NULL) { + return 0; + } + if (PyErr_WarnExplicitObject(PyExc_SyntaxWarning, msg, c->c_filename, + c->u->u_lineno, NULL, NULL) < 0) + { + if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { + /* Replace the SyntaxWarning exception with a SyntaxError + to get a more accurate error report */ + PyErr_Clear(); + assert(PyUnicode_AsUTF8(msg) != NULL); + compiler_error(c, PyUnicode_AsUTF8(msg)); + } + Py_DECREF(msg); + return 0; + } + Py_DECREF(msg); + return 1; +} + +static int +compiler_subscript(struct compiler *c, expr_ty e) +{ + expr_context_ty ctx = e->v.Subscript.ctx; + int op = 0; + + if (ctx == Load) { + if (!check_subscripter(c, e->v.Subscript.value)) { + return 0; + } + if (!check_index(c, e->v.Subscript.value, e->v.Subscript.slice)) { + return 0; + } + } + + switch (ctx) { + case Load: op = BINARY_SUBSCR; break; + case Store: op = STORE_SUBSCR; break; + case Del: op = DELETE_SUBSCR; break; + } + assert(op); + VISIT(c, expr, e->v.Subscript.value); + VISIT(c, expr, e->v.Subscript.slice); + ADDOP(c, op); + return 1; +} + +static int +compiler_slice(struct compiler *c, expr_ty s) +{ + int n = 2; + assert(s->kind == Slice_kind); + + /* only handles the cases where BUILD_SLICE is emitted */ + if (s->v.Slice.lower) { + VISIT(c, expr, s->v.Slice.lower); + } + else { + ADDOP_LOAD_CONST(c, Py_None); + } + + if (s->v.Slice.upper) { + VISIT(c, expr, s->v.Slice.upper); + } + else { + ADDOP_LOAD_CONST(c, Py_None); + } - VISIT(c, expr, s->v.AugAssign.value); - ADDOP(c, inplace_binop(s->v.AugAssign.op)); + if (s->v.Slice.step) { + n++; + VISIT(c, expr, s->v.Slice.step); + } + ADDOP_I(c, BUILD_SLICE, n); + return 1; +} - SET_LOC(c, e); - switch (e->kind) { - case Attribute_kind: - ADDOP(c, ROT_TWO); - ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names); - break; - case Subscript_kind: - ADDOP(c, ROT_THREE); - ADDOP(c, STORE_SUBSCR); - break; - case Name_kind: - return compiler_nameop(c, e->v.Name.id, Store); - default: - Py_UNREACHABLE(); +// PEP 622: Structural Pattern Matching + +// To keep things simple, all compiler_pattern_* routines follow the convention +// of replacing TOS (the subject for the given pattern) with either True (match) +// or False (no match). We do this even for irrefutable patterns; the idea is +// that it's much easier to smooth out any redundant pushing, popping, and +// jumping in the peephole optimizer than to detect or predict it here. + +// Other than that, go nuts. The PEP intentionally gives us broad freedom to +// take (reasonable) shortcuts - the AST optimization pass in particular is full +// of low-hanging fruit. Please *always* document these with a comment of the +// form "OPTIM: ...", so we can track exactly when and where they're happening. + +// For now, we eschew a full decision tree in favor of a simpler pass that just +// tracks the most-recently-checked subclass and length info for the current +// subject in the pattern_context struct. More complicated strategies are +// possible, but early experimentation suggests that the current approach keeps +// most of the runtime benefits while dramatically reducing compiler complexity. + + +#define WILDCARD_CHECK(N) \ + ((N)->kind == Name_kind && \ + _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) + + +static int +pattern_load(struct compiler *c, expr_ty p, pattern_context pc) +{ + if (p->kind == Attribute_kind) { + assert(p->v.Attribute.ctx == Load); + CHECK(pattern_load(c, p->v.Attribute.value, pc)); + ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); + } + else if (p->kind == Name_kind) { + assert(p->v.Name.ctx == Load); + CHECK(compiler_nameop(c, p->v.Name.id, Load)); + } + else { + assert(p->kind == Constant_kind); + ADDOP_LOAD_CONST(c, p->v.Constant.value); } return 1; } + static int -check_ann_expr(struct compiler *c, expr_ty e) -{ - VISIT(c, expr, e); - ADDOP(c, POP_TOP); +pattern_store(struct compiler *c, expr_ty p, pattern_context pc) { + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Store); + if (WILDCARD_CHECK(p)) { + return compiler_error(c, + "can't assign to '_' here; consider removing or renaming?"); + } + if (PySet_Contains(pc.stores, p->v.Name.id)) { + // TODO: Format this error message with the name. + return compiler_error(c, "multiple assignments to name in pattern"); + } + CHECK(!PySet_Add(pc.stores, p->v.Name.id)); + CHECK(compiler_nameop(c, p->v.Name.id, Store)); return 1; } + static int -check_annotation(struct compiler *c, stmt_ty s) +compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context pc) { - /* Annotations are only evaluated in a module or class. */ - if (c->u->u_scope_type == COMPILER_SCOPE_MODULE || - c->u->u_scope_type == COMPILER_SCOPE_CLASS) { - return check_ann_expr(c, s->v.AnnAssign.annotation); - } + assert(p->kind == Attribute_kind); + assert(p->v.Attribute.ctx == Load); + CHECK(pattern_load(c, p, pc)); + ADDOP_COMPARE(c, Eq); return 1; } + static int -check_ann_subscr(struct compiler *c, expr_ty e) +compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context pc) { - /* We check that everything in a subscript is defined at runtime. */ - switch (e->kind) { - case Slice_kind: - if (e->v.Slice.lower && !check_ann_expr(c, e->v.Slice.lower)) { - return 0; - } - if (e->v.Slice.upper && !check_ann_expr(c, e->v.Slice.upper)) { - return 0; - } - if (e->v.Slice.step && !check_ann_expr(c, e->v.Slice.step)) { - return 0; + assert(p->kind == BoolOp_kind); + assert(p->v.BoolOp.op == Or); + basicblock *end; + PyObject *control = NULL; + CHECK(end = compiler_new_block(c)); + Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); + assert(size > 1); + PyObject *names_copy; + for (Py_ssize_t i = 0; i < size; i++) { + CHECK(names_copy = PySet_New(pc.stores)); + ADDOP(c, DUP_TOP); + // TODO: Just modify pc instead. + pattern_context sub_pc = pc; + sub_pc.stores = names_copy; + CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), sub_pc)); + ADDOP_JABS(c, JUMP_IF_TRUE_OR_POP, end); + // TODO: Reuse names_copy without actually building a new copy each loop? + if (!i) { + control = names_copy; } - return 1; - case Tuple_kind: { - /* extended slice */ - asdl_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))) { + else if (PySet_GET_SIZE(control) || PySet_GET_SIZE(names_copy)) { + PyObject *diff = PyNumber_InPlaceXor(names_copy, control); + if (!diff) { + Py_DECREF(control); return 0; } + Py_DECREF(names_copy); + if (PySet_GET_SIZE(diff)) { + // TODO: Format this error message with a name. + // PyObject *extra = PySet_Pop(diff); + Py_DECREF(control); + Py_DECREF(diff); + // TODO: Catch this during store. + return compiler_error(c, "pattern binds different names based on target"); + } + Py_DECREF(diff); + } + else { + Py_DECREF(names_copy); } - return 1; } - default: - return check_ann_expr(c, e); + assert(control); + Py_DECREF(control); + ADDOP_LOAD_CONST(c, Py_False); + compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + return 1; +} + + +static int +compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { + asdl_seq *args = p->v.Call.args; + asdl_seq *kwargs = p->v.Call.keywords; + Py_ssize_t nargs = asdl_seq_LEN(args); + Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); + basicblock *block, *end; + CHECK(!validate_keywords(c, kwargs)); + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + CHECK(pattern_load(c, p->v.Call.func, pc)); + PyObject *kwnames, *name; + CHECK(kwnames = PyTuple_New(nkwargs)); + Py_ssize_t i; + for (i = 0; i < nkwargs; i++) { + name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; + Py_INCREF(name); + PyTuple_SET_ITEM(kwnames, i, name); + } + ADDOP_LOAD_CONST_NEW(c, kwnames); + ADDOP_I(c, MATCH_CLASS, nargs); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + expr_ty arg; + for (i = 0; i < nargs + nkwargs; i++) { + if (i < nargs) { + arg = asdl_seq_GET(args, i); + } + else { + arg = ((keyword_ty) asdl_seq_GET(kwargs, i - nargs))->value; + } + if (WILDCARD_CHECK(arg)) { + continue; + } + // TODO: Validate arg: + ADDOP_I(c, MATCH_ITEM, i); + CHECK(compiler_pattern(c, arg, pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } + ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + return 1; } + static int -compiler_annassign(struct compiler *c, stmt_ty s) +compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context pc) { - expr_ty targ = s->v.AnnAssign.target; - PyObject* mangled; + assert(p->kind == Constant_kind); + ADDOP_LOAD_CONST(c, p->v.Constant.value); + ADDOP_COMPARE(c, Eq); + return 1; +} - assert(s->kind == AnnAssign_kind); - /* We perform the actual assignment first. */ - if (s->v.AnnAssign.value) { - VISIT(c, expr, s->v.AnnAssign.value); - VISIT(c, expr, targ); +static int +compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context pc) +{ + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + asdl_seq *keys = p->v.Dict.keys; + asdl_seq *values = p->v.Dict.values; + Py_ssize_t size = asdl_seq_LEN(values); + int star = size ? !asdl_seq_GET(keys, size - 1) : 0; + ADDOP(c, MATCH_MAPPING); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + if (size - star) { + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); + ADDOP_COMPARE(c, GtE); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } - switch (targ->kind) { - case Name_kind: - if (forbidden_name(c, targ->v.Name.id, Store)) - return 0; - /* If we have a simple name in a module or class, store annotation. */ - if (s->v.AnnAssign.simple && - (c->u->u_scope_type == COMPILER_SCOPE_MODULE || - c->u->u_scope_type == COMPILER_SCOPE_CLASS)) { - if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) { - VISIT(c, annexpr, s->v.AnnAssign.annotation) - } - else { - VISIT(c, expr, s->v.AnnAssign.annotation); - } - ADDOP_NAME(c, LOAD_NAME, __annotations__, names); - mangled = _Py_Mangle(c->u->u_private, targ->v.Name.id); - ADDOP_LOAD_CONST_NEW(c, mangled); - ADDOP(c, STORE_SUBSCR); - } - break; - case Attribute_kind: - if (forbidden_name(c, targ->v.Attribute.attr, Store)) - return 0; - if (!s->v.AnnAssign.value && - !check_ann_expr(c, targ->v.Attribute.value)) { - return 0; + Py_ssize_t i; + for (i = 0; i < size - star; i++) { + expr_ty key = asdl_seq_GET(keys, i); + if (!key) { + return compiler_error(c, "can't use starred pattern here; consider moving to end?"); } - break; - case Subscript_kind: - if (!s->v.AnnAssign.value && - (!check_ann_expr(c, targ->v.Subscript.value) || - !check_ann_subscr(c, targ->v.Subscript.slice))) { - return 0; + CHECK(pattern_load(c, key, pc)); + } + ADDOP_I(c, BUILD_TUPLE, size - star); + ADDOP_I(c, MATCH_KEYS, star); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + for (i = 0; i < size - star; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; } - break; - default: - PyErr_Format(PyExc_SystemError, - "invalid node type (%d) for annotated assignment", - targ->kind); - return 0; + // TODO: Validate arg; + ADDOP_I(c, MATCH_ITEM, i); + CHECK(compiler_pattern(c, value, pc)); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } - /* Annotation is evaluated last. */ - if (!s->v.AnnAssign.simple && !check_annotation(c, s)) { - return 0; + ADDOP(c, POP_TOP); + if (star) { + CHECK(pattern_store(c, asdl_seq_GET(values, size - 1), pc)); + } + else { + ADDOP(c, POP_TOP); } + ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); + compiler_use_next_block(c, end); return 1; } -/* Raises a SyntaxError and returns 0. - If something goes wrong, a different exception may be raised. -*/ static int -compiler_error(struct compiler *c, const char *errstr) +compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context pc) { - PyObject *loc; - PyObject *u = NULL, *v = NULL; - - loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno); - if (!loc) { - Py_INCREF(Py_None); - loc = Py_None; + assert(p->kind == List_kind || p->kind == Tuple_kind); + asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + Py_ssize_t size = asdl_seq_LEN(values); + Py_ssize_t star = -1; + for (Py_ssize_t i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (value->kind != Starred_kind) { + continue; + } + if (star >= 0) { + return compiler_error(c, "multiple starred names in pattern"); + } + star = i; } - u = Py_BuildValue("(OiiO)", c->c_filename, c->u->u_lineno, - c->u->u_col_offset + 1, loc); - if (!u) - goto exit; - v = Py_BuildValue("(zO)", errstr, u); - if (!v) - goto exit; - PyErr_SetObject(PyExc_SyntaxError, v); - exit: - Py_DECREF(loc); - Py_XDECREF(u); - Py_XDECREF(v); - return 0; -} - -/* Emits a SyntaxWarning and returns 1 on success. - If a SyntaxWarning raised as error, replaces it with a SyntaxError - and returns 0. -*/ -static int -compiler_warn(struct compiler *c, const char *format, ...) -{ - va_list vargs; -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - PyObject *msg = PyUnicode_FromFormatV(format, vargs); - va_end(vargs); - if (msg == NULL) { - return 0; + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + ADDOP(c, MATCH_SEQUENCE); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP(c, GET_LEN); + if (star < 0) { + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); + ADDOP_COMPARE(c, Eq); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } - if (PyErr_WarnExplicitObject(PyExc_SyntaxWarning, msg, c->c_filename, - c->u->u_lineno, NULL, NULL) < 0) - { - if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { - /* Replace the SyntaxWarning exception with a SyntaxError - to get a more accurate error report */ - PyErr_Clear(); - assert(PyUnicode_AsUTF8(msg) != NULL); - compiler_error(c, PyUnicode_AsUTF8(msg)); + else if (size) { + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); + ADDOP_COMPARE(c, GtE); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + } + ADDOP(c, ROT_TWO); + for (Py_ssize_t i = 0; i < size; i++) { + // TODO: Raise for invalid sizes to MATCH_ITEM* opcodes. + expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; } - Py_DECREF(msg); - return 0; + if (star < 0 || i < star) { + ADDOP_I(c, MATCH_ITEM, i); + } + else if (i == star) { + assert(value->kind == Starred_kind); + value = value->v.Starred.value; + if (WILDCARD_CHECK(value)) { + continue; + } + ADDOP_I(c, MATCH_ITEM_SLICE, ((size - 1 - i) << 8) + i); + } + else { + ADDOP_I(c, MATCH_ITEM_END, size - 1 - i); + } + CHECK(compiler_pattern(c, value, pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } - Py_DECREF(msg); + ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, block); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + compiler_use_next_block(c, end); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); return 1; } + static int -compiler_subscript(struct compiler *c, expr_ty e) +compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) { - expr_context_ty ctx = e->v.Subscript.ctx; - int op = 0; - - if (ctx == Load) { - if (!check_subscripter(c, e->v.Subscript.value)) { - return 0; - } - if (!check_index(c, e->v.Subscript.value, e->v.Subscript.slice)) { - return 0; - } + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Store); + if (WILDCARD_CHECK(p)) { + ADDOP(c, POP_TOP); } - - switch (ctx) { - case Load: op = BINARY_SUBSCR; break; - case Store: op = STORE_SUBSCR; break; - case Del: op = DELETE_SUBSCR; break; + else { + CHECK(pattern_store(c, p, pc)); } - assert(op); - VISIT(c, expr, e->v.Subscript.value); - VISIT(c, expr, e->v.Subscript.slice); - ADDOP(c, op); + ADDOP_LOAD_CONST(c, Py_True); return 1; } + static int -compiler_slice(struct compiler *c, expr_ty s) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context pc) { - int n = 2; - assert(s->kind == Slice_kind); + assert(p->kind == NamedExpr_kind); + basicblock *block, *end; + CHECK(block = compiler_new_block(c)); + CHECK(end = compiler_new_block(c)); + ADDOP(c, DUP_TOP); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + CHECK(pattern_store(c, p->v.NamedExpr.target, pc)); + ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, block); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + compiler_use_next_block(c, end); + return 1; +} - /* only handles the cases where BUILD_SLICE is emitted */ - if (s->v.Slice.lower) { - VISIT(c, expr, s->v.Slice.lower); - } - else { - ADDOP_LOAD_CONST(c, Py_None); - } - if (s->v.Slice.upper) { - VISIT(c, expr, s->v.Slice.upper); - } - else { - ADDOP_LOAD_CONST(c, Py_None); +static int +compiler_pattern(struct compiler *c, expr_ty p, pattern_context pc) +{ + SET_LOC(c, p); + switch (p->kind) { + case Attribute_kind: + return compiler_pattern_attribute(c, p, pc); + case BinOp_kind: + // Because we allow "2+2j", things like "2+2" make it this far: + return compiler_error(c, "patterns cannot include operators"); + case BoolOp_kind: + return compiler_pattern_boolop(c, p, pc); + case Call_kind: + return compiler_pattern_call(c, p, pc); + case Constant_kind: + return compiler_pattern_constant(c, p, pc); + case Dict_kind: + return compiler_pattern_dict(c, p, pc); + case JoinedStr_kind: + // Because we allow strings, f-strings make it this far: + return compiler_error(c, "patterns cannot include f-strings"); + case List_kind: + case Tuple_kind: + return compiler_pattern_list_tuple(c, p, pc); + case Name_kind: + return compiler_pattern_name(c, p, pc); + case NamedExpr_kind: + return compiler_pattern_namedexpr(c, p, pc); + default: + Py_UNREACHABLE(); } +} - if (s->v.Slice.step) { - n++; - VISIT(c, expr, s->v.Slice.step); + +static int +compiler_match(struct compiler *c, stmt_ty s) +{ + VISIT(c, expr, s->v.Match.target); + basicblock *next, *end; + CHECK(end = compiler_new_block(c)); + Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); + assert(cases); + pattern_context pc; + int last = 0, result; + match_case_ty m; + for (Py_ssize_t i = 0; i < cases; i++) { + if (i == cases - 1) { + last = 1; + } + m = asdl_seq_GET(s->v.Match.cases, i); + SET_LOC(c, m->pattern); + CHECK(next = compiler_new_block(c)); + if (!last) { + ADDOP(c, DUP_TOP); + } + // TODO: Set pc.stores lazily. + CHECK(pc.stores = PySet_New(NULL)); + result = compiler_pattern(c, m->pattern, pc); + Py_DECREF(pc.stores); + CHECK(result); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); + if (m->guard) { + CHECK(compiler_jump_if(c, m->guard, next, 0)); + } + if (!last) { + ADDOP(c, POP_TOP); + } + VISIT_SEQ(c, stmt, m->body); + if (!last) { + ADDOP_JREL(c, JUMP_FORWARD, end); + } + compiler_use_next_block(c, next); + if (m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store + && !m->guard && !last) + { + CHECK(compiler_warn(c, "unguarded name capture pattern makes " + "remaining cases unreachable")); + break; + } } - ADDOP_I(c, BUILD_SLICE, n); + compiler_use_next_block(c, end); return 1; } + /* End of the compiler section, beginning of the assembler section */ /* do depth-first search of basic block graph, starting with block. From b0a02f510bbdfe1c45c670422817369874e911dc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 12 Jul 2020 14:14:36 -0700 Subject: [PATCH 127/218] Generalize conditional jump peepholing --- Python/peephole.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Python/peephole.c b/Python/peephole.c index fe67de42227b5b..1d9c170fed367e 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -15,7 +15,12 @@ #define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE \ || op==POP_JUMP_IF_FALSE || op==POP_JUMP_IF_TRUE \ || op==JUMP_IF_FALSE_OR_POP || op==JUMP_IF_TRUE_OR_POP || op==JUMP_IF_NOT_EXC_MATCH) +#define JUMPS_ON_FALSE(op) (op==POP_JUMP_IF_FALSE || op==JUMP_IF_FALSE_OR_POP) #define JUMPS_ON_TRUE(op) (op==POP_JUMP_IF_TRUE || op==JUMP_IF_TRUE_OR_POP) +#define POPS_ON_FALSE(op) (op==POP_JUMP_IF_TRUE || op==POP_JUMP_IF_FALSE \ + || op==JUMP_IF_TRUE_OR_POP) +#define POPS_ON_TRUE(op) (op==POP_JUMP_IF_TRUE || op==POP_JUMP_IF_FALSE \ + || op==JUMP_IF_FALSE_OR_POP) #define GETJUMPTGT(arr, i) (get_arg(arr, i) / sizeof(_Py_CODEUNIT) + \ (ABSOLUTE_JUMP(_Py_OPCODE(arr[i])) ? 0 : i+1)) #define ISBASICBLOCK(blocks, start, end) \ @@ -299,12 +304,10 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, cumlc = 0; switch (opcode) { - /* Skip over LOAD_CONST trueconst - POP_JUMP_IF_FALSE xx. This improves - "while 1" performance. */ + // Fold LOAD_CONST followed by conditional jumping/popping: case LOAD_CONST: cumlc = lastlc + 1; - if (nextop != POP_JUMP_IF_FALSE || + if (!(JUMPS_ON_FALSE(nextop) || JUMPS_ON_TRUE(nextop)) || !ISBASICBLOCK(blocks, op_start, i + 1)) { break; } @@ -313,9 +316,11 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, if (is_true == -1) { goto exitError; } - if (is_true == 1) { - fill_nops(codestr, op_start, nexti + 1); - cumlc = 0; + int jump = JUMPS_ON_TRUE(nextop) == is_true; + int pop = is_true ? POPS_ON_TRUE(nextop) : POPS_ON_FALSE(nextop); + fill_nops(codestr, pop ? op_start : i + 1, (jump ? i : nexti) + 1); + if (jump) { + codestr[nexti] = PACKOPARG(JUMP_ABSOLUTE, _Py_OPARG(codestr[nexti])); } break; From da6ee98e817e7c6378207c9de6fe5b1ba98da20d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 12 Jul 2020 14:14:58 -0700 Subject: [PATCH 128/218] MATCH_ITEM* -> GET_INDEX* --- Doc/library/dis.rst | 26 ++++++++++----------- Include/opcode.h | 10 ++++---- Lib/importlib/_bootstrap_external.py | 4 ++-- Lib/opcode.py | 10 ++++---- Lib/test/test_dis.py | 34 +++++++++++++--------------- Python/ceval.c | 6 ++--- Python/compile.c | 31 +++++++++++++------------ Python/importlib_external.h | 2 +- Python/opcode_targets.h | 6 ++--- 9 files changed, 65 insertions(+), 64 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index f07742f5c07cf4..6567c5a35bec14 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1213,40 +1213,40 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: MATCH_CLASS (count) +.. opcode:: GET_INDEX (i) - TODO + TOS is a sequence. Push ``TOS[i]`` onto the stack. .. versionadded:: 3.10 -.. opcode:: MATCH_KEYS (copy) +.. opcode:: GET_INDEX_END (i) - TODO + TOS is a sequence, and TOS1 is its length. Push ``TOS[TOS1 - 1 - i]`` onto + the stack. .. versionadded:: 3.10 -.. opcode:: MATCH_ITEM (i) +.. opcode:: GET_INDEX_SLICE (i) - TOS is a sequence. Push ``TOS[i]`` onto the stack. + TOS is a sequence, and TOS1 is its length. Push a list formed from + ``TOS[x:TOS1 - 1 - y]`` onto the stack, where *x* is the low byte of *i* and + *y* is the high bytes of *i*. .. versionadded:: 3.10 -.. opcode:: MATCH_ITEM_END (i) +.. opcode:: MATCH_CLASS (count) - TOS is a sequence, and TOS1 is its length. Push ``TOS[TOS1 - 1 - i]`` onto - the stack. + TODO .. versionadded:: 3.10 -.. opcode:: MATCH_ITEM_SLICE (i) +.. opcode:: MATCH_KEYS (copy) - TOS is a sequence, and TOS1 is its length. Push a list formed from - ``TOS[x:TOS1 - 1 - y]`` onto the stack, where *x* is the low byte of *i* and - *y* is the high bytes of *i*. + TODO .. versionadded:: 3.10 diff --git a/Include/opcode.h b/Include/opcode.h index db4da0bfad8ef5..2e978e25dfc9fc 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -120,11 +120,11 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 -#define MATCH_CLASS 149 -#define MATCH_KEYS 150 -#define MATCH_ITEM 151 -#define MATCH_ITEM_END 152 -#define MATCH_ITEM_SLICE 153 +#define GET_INDEX 149 +#define GET_INDEX_END 150 +#define GET_INDEX_SLICE 151 +#define MATCH_CLASS 152 +#define MATCH_KEYS 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 299583fdd5f593..df709f1a6ec770 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -277,7 +277,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156) # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) -# Python 3.10a0 3466 (add structural pattern matching) +# Python 3.10a0 3467 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -287,7 +287,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3466).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3467).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index fb68736fa03155..5a4474bb82a7b4 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -195,11 +195,11 @@ def jabs_op(name, op): def_op('MAP_ADD', 147) def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('MATCH_CLASS', 149) -def_op('MATCH_KEYS', 150) -def_op('MATCH_ITEM', 151) -def_op('MATCH_ITEM_END', 152) -def_op('MATCH_ITEM_SLICE', 153) +def_op('GET_INDEX', 149) +def_op('GET_INDEX_END', 150) +def_op('GET_INDEX_SLICE', 151) +def_op('MATCH_CLASS', 152) +def_op('MATCH_KEYS', 153) jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) def_op('BUILD_CONST_KEY_MAP', 156) diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index ac5836d288978c..9c761e5a42260b 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -145,24 +145,22 @@ def bug1333982(x=[]): pass dis_bug1333982 = """\ -%3d 0 LOAD_CONST 1 (0) - 2 POP_JUMP_IF_TRUE 26 - 4 LOAD_ASSERTION_ERROR - 6 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) - 8 LOAD_CONST 3 ('bug1333982..') - 10 MAKE_FUNCTION 0 - 12 LOAD_FAST 0 (x) - 14 GET_ITER - 16 CALL_FUNCTION 1 - -%3d 18 LOAD_CONST 4 (1) - -%3d 20 BINARY_ADD - 22 CALL_FUNCTION 1 - 24 RAISE_VARARGS 1 - -%3d >> 26 LOAD_CONST 0 (None) - 28 RETURN_VALUE +%3d 0 LOAD_ASSERTION_ERROR + 2 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) + 4 LOAD_CONST 3 ('bug1333982..') + 6 MAKE_FUNCTION 0 + 8 LOAD_FAST 0 (x) + 10 GET_ITER + 12 CALL_FUNCTION 1 + +%3d 14 LOAD_CONST 4 (1) + +%3d 16 BINARY_ADD + 18 CALL_FUNCTION 1 + 20 RAISE_VARARGS 1 + +%3d 22 LOAD_CONST 0 (None) + 24 RETURN_VALUE """ % (bug1333982.__code__.co_firstlineno + 1, __file__, bug1333982.__code__.co_firstlineno + 1, diff --git a/Python/ceval.c b/Python/ceval.c index 3deac496908c80..91d9c00fea0f48 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3633,7 +3633,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_ITEM): { + case TARGET(GET_INDEX): { PyObject *item = PySequence_GetItem(TOP(), oparg); if (!item) { goto error; @@ -3642,7 +3642,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_ITEM_END): { + case TARGET(GET_INDEX_END): { Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; @@ -3656,7 +3656,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(MATCH_ITEM_SLICE): { + case TARGET(GET_INDEX_SLICE): { Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; diff --git a/Python/compile.c b/Python/compile.c index aab9f514ba5577..14927170195924 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1110,9 +1110,9 @@ stack_effect(int opcode, int oparg, int jump) return 1; case MATCH_CLASS: return -1; - case MATCH_ITEM: - case MATCH_ITEM_END: - case MATCH_ITEM_SLICE: + case GET_INDEX: + case GET_INDEX_END: + case GET_INDEX_SLICE: case MATCH_KEYS: case MATCH_MAPPING: case MATCH_SEQUENCE: @@ -5441,9 +5441,9 @@ compiler_slice(struct compiler *c, expr_ty s) // For now, we eschew a full decision tree in favor of a simpler pass that just // tracks the most-recently-checked subclass and length info for the current -// subject in the pattern_context struct. More complicated strategies are -// possible, but early experimentation suggests that the current approach keeps -// most of the runtime benefits while dramatically reducing compiler complexity. +// subject in the pattern_context struct. Experimentation suggests that the +// current approach keeps most of the runtime benefits while dramatically +// reducing compiler complexity. #define WILDCARD_CHECK(N) \ @@ -5511,6 +5511,7 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context pc) Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); assert(size > 1); PyObject *names_copy; + // TODO: Leaks sets. for (Py_ssize_t i = 0; i < size; i++) { CHECK(names_copy = PySet_New(pc.stores)); ADDOP(c, DUP_TOP); @@ -5560,6 +5561,9 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { asdl_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); + if (nargs + nkwargs > INT_MAX) { + return compiler_error(c, "too many sub-patterns in class pattern"); + } basicblock *block, *end; CHECK(!validate_keywords(c, kwargs)); CHECK(block = compiler_new_block(c)); @@ -5587,8 +5591,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { if (WILDCARD_CHECK(arg)) { continue; } - // TODO: Validate arg: - ADDOP_I(c, MATCH_ITEM, i); + ADDOP_I(c, GET_INDEX, i); CHECK(compiler_pattern(c, arg, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } @@ -5620,6 +5623,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context pc) asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; + // TODO :(i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) ADDOP(c, MATCH_MAPPING); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); if (size - star) { @@ -5644,8 +5648,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context pc) if (WILDCARD_CHECK(value)) { continue; } - // TODO: Validate arg; - ADDOP_I(c, MATCH_ITEM, i); + ADDOP_I(c, GET_INDEX, i); CHECK(compiler_pattern(c, value, pc)); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } @@ -5704,13 +5707,13 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context pc) } ADDOP(c, ROT_TWO); for (Py_ssize_t i = 0; i < size; i++) { - // TODO: Raise for invalid sizes to MATCH_ITEM* opcodes. + // TODO :(i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { continue; } if (star < 0 || i < star) { - ADDOP_I(c, MATCH_ITEM, i); + ADDOP_I(c, GET_INDEX, i); } else if (i == star) { assert(value->kind == Starred_kind); @@ -5718,10 +5721,10 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context pc) if (WILDCARD_CHECK(value)) { continue; } - ADDOP_I(c, MATCH_ITEM_SLICE, ((size - 1 - i) << 8) + i); + ADDOP_I(c, GET_INDEX_SLICE, ((size - 1 - i) << 8) + i); } else { - ADDOP_I(c, MATCH_ITEM_END, size - 1 - i); + ADDOP_I(c, GET_INDEX_END, size - 1 - i); } CHECK(compiler_pattern(c, value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); diff --git a/Python/importlib_external.h b/Python/importlib_external.h index e52b9111c5519f..23f0bb69338368 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -286,7 +286,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0, 0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40, 1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0, - 0,0,105,138,13,0,0,114,28,0,0,0,114,17,0,0, + 0,0,105,139,13,0,0,114,28,0,0,0,114,17,0,0, 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, 122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 4febf772d76a52..70be8acaec99e0 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -148,11 +148,11 @@ static void *opcode_targets[256] = { &&TARGET_SET_ADD, &&TARGET_MAP_ADD, &&TARGET_LOAD_CLASSDEREF, + &&TARGET_GET_INDEX, + &&TARGET_GET_INDEX_END, + &&TARGET_GET_INDEX_SLICE, &&TARGET_MATCH_CLASS, &&TARGET_MATCH_KEYS, - &&TARGET_MATCH_ITEM, - &&TARGET_MATCH_ITEM_END, - &&TARGET_MATCH_ITEM_SLICE, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, From 3eda95e045a3a304acf8f1b6d34e715f9abaa820 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 12 Jul 2020 14:56:38 -0700 Subject: [PATCH 129/218] Revert old unparse hack --- Lib/ast.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index aecbd013c0af07..1085326b4a26b7 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1350,11 +1350,8 @@ def increasing_level_traverse(node): self.interleave(lambda: self.write(s), increasing_level_traverse, node.values) def visit_Attribute(self, node): - if self.in_pattern() and isinstance(node.value, Name): - self.write(node.value.id) - else: - self.set_precedence(_Precedence.ATOM, node.value) - self.traverse(node.value) + self.set_precedence(_Precedence.ATOM, node.value) + self.traverse(node.value) # Special case: 3.__abs__() is a syntax error, so if node.value # is an integer literal then we need to either parenthesize # it or add an extra space to get 3 .__abs__(). From b3840befa23f29a6f4b5e62a2e4a277d56a55033 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 12 Jul 2020 16:24:15 -0700 Subject: [PATCH 130/218] Improve performance for wildcards --- Python/compile.c | 34 ++++++++++++++++++++-------------- Python/peephole.c | 11 +++++++++-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 14927170195924..7777f87d5c3d3e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5447,7 +5447,7 @@ compiler_slice(struct compiler *c, expr_ty s) #define WILDCARD_CHECK(N) \ - ((N)->kind == Name_kind && \ + ((N)->kind == Name_kind && \ _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) @@ -5607,7 +5607,7 @@ static int compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context pc) { assert(p->kind == Constant_kind); - ADDOP_LOAD_CONST(c, p->v.Constant.value); + CHECK(pattern_load(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; } @@ -5820,12 +5820,11 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; - int last = 0, result; - match_case_ty m; - for (Py_ssize_t i = 0; i < cases; i++) { - if (i == cases - 1) { - last = 1; - } + int last, result; + match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); + int has_default = WILDCARD_CHECK(m->pattern); + for (Py_ssize_t i = 0; i < cases - has_default; i++) { + last = i == cases - 1 - has_default; m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); CHECK(next = compiler_new_block(c)); @@ -5845,18 +5844,25 @@ compiler_match(struct compiler *c, stmt_ty s) ADDOP(c, POP_TOP); } VISIT_SEQ(c, stmt, m->body); - if (!last) { - ADDOP_JREL(c, JUMP_FORWARD, end); - } + ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, next); - if (m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store - && !m->guard && !last) + if (!m->guard && m->pattern->kind == Name_kind && + m->pattern->v.Name.ctx == Store && i != cases - 1) { CHECK(compiler_warn(c, "unguarded name capture pattern makes " "remaining cases unreachable")); - break; } } + if (has_default) { + if (cases == 1) { + ADDOP(c, POP_TOP); + } + m = asdl_seq_GET(s->v.Match.cases, cases - 1); + if (m->guard) { + CHECK(compiler_jump_if(c, m->guard, end, 0)); + } + VISIT_SEQ(c, stmt, m->body); + } compiler_use_next_block(c, end); return 1; } diff --git a/Python/peephole.c b/Python/peephole.c index 1d9c170fed367e..2e5c0436d5385d 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -304,9 +304,9 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, cumlc = 0; switch (opcode) { - // Fold LOAD_CONST followed by conditional jumping/popping: + // Simplify LOAD_CONST followed by conditional jumping/popping: case LOAD_CONST: - cumlc = lastlc + 1; + cumlc = lastlc + 1; // TODO? if (!(JUMPS_ON_FALSE(nextop) || JUMPS_ON_TRUE(nextop)) || !ISBASICBLOCK(blocks, op_start, i + 1)) { break; @@ -324,6 +324,13 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, } break; + // Remove DUP_TOP + POP_TOP: + case DUP_TOP: + if (nextop == POP_TOP) { + fill_nops(codestr, op_start, nexti + 1); + } + break; + /* Try to fold tuples of constants. Skip over BUILD_SEQN 1 UNPACK_SEQN 1. Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2. From 14e4eaabad04f55b8ba5cb87897d4da0aac2045d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 12 Jul 2020 21:43:25 -0700 Subject: [PATCH 131/218] Add/fix tests --- Doc/library/dis.rst | 2 +- Doc/tools/susp-ignored.csv | 1 + Lib/test/test_patma.py | 548 ++++++++++++++++++++++++++----------- Python/compile.c | 12 +- 4 files changed, 393 insertions(+), 170 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 6567c5a35bec14..1ca57b53739ceb 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -769,7 +769,7 @@ iterations of the loop. .. opcode:: MATCH_SEQUENCE If TOS is an instance of :class:`collections.abc.Sequence`, is not an - instance of :class:`string`/:class:`bytes`/:class:`bytearray`, and is not an + instance of :class:`str`/:class:`bytes`/:class:`bytearray`, and is not an :term:`iterator`, push ``True`` onto the stack. Otherwise, push ``False``. .. versionadded:: 3.10 diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 7be8d0abd69a57..392dd68359d23b 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -362,3 +362,4 @@ whatsnew/changelog,,::,default::DeprecationWarning library/importlib.metadata,,:main,"EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')" library/importlib.metadata,,`,loading the metadata for packages for the indicated ``context``. library/re,,`,"`" +library/dis,,:TOS1,TOS[x:TOS1 - 1 - y] diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 75a93e8ea8ba10..2c14d485009339 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,16 +1,17 @@ import collections +import contextlib import unittest class TestMatch(unittest.TestCase): - def test_patma_000(self) -> None: + def test_patma_000(self): match 0: case 0: x = True self.assertEqual(x, True) - def test_patma_001(self) -> None: + def test_patma_001(self): match 0: case 0 if False: x = False @@ -18,7 +19,7 @@ def test_patma_001(self) -> None: x = True self.assertEqual(x, True) - def test_patma_002(self) -> None: + def test_patma_002(self): match 0: case 0: x = True @@ -26,42 +27,42 @@ def test_patma_002(self) -> None: x = False self.assertEqual(x, True) - def test_patma_003(self) -> None: + def test_patma_003(self): x = False match 0: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_patma_004(self) -> None: + def test_patma_004(self): x = False match 1: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_patma_005(self) -> None: + def test_patma_005(self): x = False match 2: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_patma_006(self) -> None: + def test_patma_006(self): x = False match 3: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, True) - def test_patma_007(self) -> None: + def test_patma_007(self): x = False match 4: case 0 | 1 | 2 | 3: x = True self.assertEqual(x, False) - def test_patma_008(self) -> None: + def test_patma_008(self): x = 0 class A: y = 1 @@ -73,7 +74,7 @@ class A: self.assertEqual(A.y, 1) self.assertEqual(z, None) - def test_patma_009(self) -> None: + def test_patma_009(self): class A: B = 0 match 0: @@ -88,90 +89,90 @@ class A: self.assertEqual(y, 0) self.assertEqual(z, 2) - def test_patma_010(self) -> None: + def test_patma_010(self): match (): case []: x = 0 self.assertEqual(x, 0) - def test_patma_011(self) -> None: + def test_patma_011(self): match (0, 1, 2): case [*x]: y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) - def test_patma_012(self) -> None: + def test_patma_012(self): match (0, 1, 2): case [0, *x]: y = 0 self.assertEqual(x, [1, 2]) self.assertEqual(y, 0) - def test_patma_013(self) -> None: + def test_patma_013(self): match (0, 1, 2): case [0, 1, *x,]: y = 0 self.assertEqual(x, [2]) self.assertEqual(y, 0) - def test_patma_014(self) -> None: + def test_patma_014(self): match (0, 1, 2): case [0, 1, 2, *x]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_015(self) -> None: + def test_patma_015(self): match (0, 1, 2): case [*x, 2,]: y = 0 self.assertEqual(x, [0, 1]) self.assertEqual(y, 0) - def test_patma_016(self) -> None: + def test_patma_016(self): match (0, 1, 2): case [*x, 1, 2]: y = 0 self.assertEqual(x, [0]) self.assertEqual(y, 0) - def test_patma_017(self) -> None: + def test_patma_017(self): match (0, 1, 2): case [*x, 0, 1, 2,]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_018(self) -> None: + def test_patma_018(self): match (0, 1, 2): case [0, *x, 2]: y = 0 self.assertEqual(x, [1]) self.assertEqual(y, 0) - def test_patma_019(self) -> None: + def test_patma_019(self): match (0, 1, 2): case [0, 1, *x, 2,]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_020(self) -> None: + def test_patma_020(self): match (0, 1, 2): case [0, *x, 1, 2]: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_021(self) -> None: + def test_patma_021(self): match (0, 1, 2): case [*x,]: y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) - def test_patma_022(self) -> None: + def test_patma_022(self): x = {} match x: case {}: @@ -179,7 +180,7 @@ def test_patma_022(self) -> None: self.assertEqual(x, {}) self.assertEqual(y, 0) - def test_patma_023(self) -> None: + def test_patma_023(self): x = {0: 0} match x: case {}: @@ -187,7 +188,7 @@ def test_patma_023(self) -> None: self.assertEqual(x, {0: 0}) self.assertEqual(y, 0) - def test_patma_024(self) -> None: + def test_patma_024(self): x = {} y = None match x: @@ -196,7 +197,7 @@ def test_patma_024(self) -> None: self.assertEqual(x, {}) self.assertEqual(y, None) - def test_patma_025(self) -> None: + def test_patma_025(self): x = {0: 0} match x: case {0: (z := 0 | 1 | 2)}: @@ -205,7 +206,7 @@ def test_patma_025(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 0) - def test_patma_026(self) -> None: + def test_patma_026(self): x = {0: 1} match x: case {0: (z := 0 | 1 | 2)}: @@ -214,7 +215,7 @@ def test_patma_026(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 1) - def test_patma_027(self) -> None: + def test_patma_027(self): x = {0: 2} match x: case {0: (z := 0 | 1 | 2)}: @@ -223,7 +224,7 @@ def test_patma_027(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 2) - def test_patma_028(self) -> None: + def test_patma_028(self): x = {0: 3} y = None z = None @@ -234,7 +235,7 @@ def test_patma_028(self) -> None: self.assertEqual(y, None) self.assertEqual(z, None) - def test_patma_029(self) -> None: + def test_patma_029(self): x = {} y = None match x: @@ -247,7 +248,7 @@ def test_patma_029(self) -> None: self.assertEqual(x, {}) self.assertEqual(y, None) - def test_patma_030(self) -> None: + def test_patma_030(self): x = {False: (True, 2.0, {})} match x: case {0: [1, 2, {}]}: @@ -259,7 +260,7 @@ def test_patma_030(self) -> None: self.assertEqual(x, {False: (True, 2.0, {})}) self.assertEqual(y, 0) - def test_patma_031(self) -> None: + def test_patma_031(self): x = {False: (True, 2.0, {}), 1: [[]], 2: 0} match x: case {0: [1, 2, {}]}: @@ -271,7 +272,7 @@ def test_patma_031(self) -> None: self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0}) self.assertEqual(y, 0) - def test_patma_032(self) -> None: + def test_patma_032(self): x = {False: (True, 2.0, {}), 1: [[]], 2: 0} match x: case {0: [1, 2]}: @@ -283,7 +284,7 @@ def test_patma_032(self) -> None: self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0}) self.assertEqual(y, 1) - def test_patma_033(self) -> None: + def test_patma_033(self): x = [] match x: case {0: [1, 2, {}]}: @@ -295,7 +296,7 @@ def test_patma_033(self) -> None: self.assertEqual(x, []) self.assertEqual(y, 2) - def test_patma_034(self) -> None: + def test_patma_034(self): x = {0: 0} match x: case {0: [1, 2, {}]}: @@ -307,7 +308,7 @@ def test_patma_034(self) -> None: self.assertEqual(x, {0: 0}) self.assertEqual(y, 1) - def test_patma_035(self) -> None: + def test_patma_035(self): x = {0: 0} match x: case {0: [1, 2, {}]}: @@ -319,7 +320,7 @@ def test_patma_035(self) -> None: self.assertEqual(x, {0: 0}) self.assertEqual(y, 1) - def test_patma_036(self) -> None: + def test_patma_036(self): x = 0 match x: case 0 | 1 | 2: @@ -327,7 +328,7 @@ def test_patma_036(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_037(self) -> None: + def test_patma_037(self): x = 1 match x: case 0 | 1 | 2: @@ -335,7 +336,7 @@ def test_patma_037(self) -> None: self.assertEqual(x, 1) self.assertEqual(y, 0) - def test_patma_038(self) -> None: + def test_patma_038(self): x = 2 match x: case 0 | 1 | 2: @@ -343,7 +344,7 @@ def test_patma_038(self) -> None: self.assertEqual(x, 2) self.assertEqual(y, 0) - def test_patma_039(self) -> None: + def test_patma_039(self): x = 3 y = None match x: @@ -352,7 +353,7 @@ def test_patma_039(self) -> None: self.assertEqual(x, 3) self.assertEqual(y, None) - def test_patma_040(self) -> None: + def test_patma_040(self): x = 0 match x: case (z := 0) | (z := 1) | (z := 2) if z == x % 2: @@ -361,7 +362,7 @@ def test_patma_040(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 0) - def test_patma_041(self) -> None: + def test_patma_041(self): x = 1 match x: case (z := 0) | (z := 1) | (z := 2) if z == x % 2: @@ -370,7 +371,7 @@ def test_patma_041(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 1) - def test_patma_042(self) -> None: + def test_patma_042(self): x = 2 y = None match x: @@ -380,7 +381,7 @@ def test_patma_042(self) -> None: self.assertEqual(y, None) self.assertEqual(z, 2) - def test_patma_043(self) -> None: + def test_patma_043(self): x = 3 y = None z = None @@ -391,7 +392,7 @@ def test_patma_043(self) -> None: self.assertEqual(y, None) self.assertEqual(z, None) - def test_patma_044(self) -> None: + def test_patma_044(self): x = () match x: case []: @@ -399,7 +400,7 @@ def test_patma_044(self) -> None: self.assertEqual(x, ()) self.assertEqual(y, 0) - def test_patma_045(self) -> None: + def test_patma_045(self): x = () match x: case []: @@ -407,7 +408,7 @@ def test_patma_045(self) -> None: self.assertEqual(x, ()) self.assertEqual(y, 0) - def test_patma_046(self) -> None: + def test_patma_046(self): x = (0,) match x: case [0]: @@ -415,7 +416,7 @@ def test_patma_046(self) -> None: self.assertEqual(x, (0,)) self.assertEqual(y, 0) - def test_patma_047(self) -> None: + def test_patma_047(self): x = ((),) match x: case [[]]: @@ -423,7 +424,7 @@ def test_patma_047(self) -> None: self.assertEqual(x, ((),)) self.assertEqual(y, 0) - def test_patma_048(self) -> None: + def test_patma_048(self): x = [0, 1] match x: case [0, 1] | [1, 0]: @@ -431,7 +432,7 @@ def test_patma_048(self) -> None: self.assertEqual(x, [0, 1]) self.assertEqual(y, 0) - def test_patma_049(self) -> None: + def test_patma_049(self): x = [1, 0] match x: case [0, 1] | [1, 0]: @@ -439,7 +440,7 @@ def test_patma_049(self) -> None: self.assertEqual(x, [1, 0]) self.assertEqual(y, 0) - def test_patma_050(self) -> None: + def test_patma_050(self): x = [0, 0] y = None match x: @@ -448,7 +449,7 @@ def test_patma_050(self) -> None: self.assertEqual(x, [0, 0]) self.assertEqual(y, None) - def test_patma_051(self) -> None: + def test_patma_051(self): w = None x = [1, 0] match x: @@ -461,7 +462,7 @@ def test_patma_051(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, 0) - def test_patma_052(self) -> None: + def test_patma_052(self): x = [1, 0] match x: case [0]: @@ -473,7 +474,7 @@ def test_patma_052(self) -> None: self.assertEqual(x, []) self.assertEqual(y, 2) - def test_patma_053(self) -> None: + def test_patma_053(self): x = {0} y = None match x: @@ -482,7 +483,7 @@ def test_patma_053(self) -> None: self.assertEqual(x, {0}) self.assertEqual(y, None) - def test_patma_054(self) -> None: + def test_patma_054(self): x = set() y = None match x: @@ -491,7 +492,7 @@ def test_patma_054(self) -> None: self.assertEqual(x, set()) self.assertEqual(y, None) - def test_patma_055(self) -> None: + def test_patma_055(self): x = iter([1, 2, 3]) y = None match x: @@ -500,7 +501,7 @@ def test_patma_055(self) -> None: self.assertEqual([*x], [1, 2, 3]) self.assertEqual(y, None) - def test_patma_056(self) -> None: + def test_patma_056(self): x = {} y = None match x: @@ -509,7 +510,7 @@ def test_patma_056(self) -> None: self.assertEqual(x, {}) self.assertEqual(y, None) - def test_patma_057(self) -> None: + def test_patma_057(self): x = {0: False, 1: True} y = None match x: @@ -518,7 +519,7 @@ def test_patma_057(self) -> None: self.assertEqual(x, {0: False, 1: True}) self.assertEqual(y, None) - def test_patma_058(self) -> None: + def test_patma_058(self): x = 0 match x: case 0: @@ -526,7 +527,7 @@ def test_patma_058(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_059(self) -> None: + def test_patma_059(self): x = 0 match x: case False: @@ -534,7 +535,7 @@ def test_patma_059(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_060(self) -> None: + def test_patma_060(self): x = 0 y = None match x: @@ -543,7 +544,7 @@ def test_patma_060(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, None) - def test_patma_061(self) -> None: + def test_patma_061(self): x = 0 y = None match x: @@ -552,7 +553,7 @@ def test_patma_061(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, None) - def test_patma_062(self) -> None: + def test_patma_062(self): x = 0 match x: case 0: @@ -562,7 +563,7 @@ def test_patma_062(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_063(self) -> None: + def test_patma_063(self): x = 0 y = None match x: @@ -573,7 +574,7 @@ def test_patma_063(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, None) - def test_patma_064(self) -> None: + def test_patma_064(self): x = "x" match x: case "x": @@ -583,7 +584,7 @@ def test_patma_064(self) -> None: self.assertEqual(x, "x") self.assertEqual(y, 0) - def test_patma_065(self) -> None: + def test_patma_065(self): x = "x" match x: case "y": @@ -593,7 +594,7 @@ def test_patma_065(self) -> None: self.assertEqual(x, "x") self.assertEqual(y, 1) - def test_patma_066(self) -> None: + def test_patma_066(self): x = "x" match x: case "x": @@ -603,7 +604,7 @@ def test_patma_066(self) -> None: self.assertEqual(x, "x") self.assertEqual(y, 0) - def test_patma_067(self) -> None: + def test_patma_067(self): x = b"x" match x: case b"y": @@ -613,7 +614,7 @@ def test_patma_067(self) -> None: self.assertEqual(x, b"x") self.assertEqual(y, 1) - def test_patma_068(self) -> None: + def test_patma_068(self): x = 0 match x: case 0 if False: @@ -623,7 +624,7 @@ def test_patma_068(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 1) - def test_patma_069(self) -> None: + def test_patma_069(self): x = 0 y = None match x: @@ -634,7 +635,7 @@ def test_patma_069(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, None) - def test_patma_070(self) -> None: + def test_patma_070(self): x = 0 match x: case 0 if True: @@ -644,7 +645,7 @@ def test_patma_070(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_071(self) -> None: + def test_patma_071(self): x = 0 match x: case 0 if 1: @@ -654,7 +655,7 @@ def test_patma_071(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_072(self) -> None: + def test_patma_072(self): x = 0 match x: case 0 if True: @@ -665,7 +666,7 @@ def test_patma_072(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 2) - def test_patma_073(self) -> None: + def test_patma_073(self): x = 0 match x: case 0 if 0: @@ -676,7 +677,7 @@ def test_patma_073(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 2) - def test_patma_074(self) -> None: + def test_patma_074(self): x = 0 y = None match x: @@ -687,7 +688,7 @@ def test_patma_074(self) -> None: self.assertEqual(x, 1) self.assertEqual(y, None) - def test_patma_075(self) -> None: + def test_patma_075(self): x = "x" match x: case ["x"]: @@ -697,7 +698,7 @@ def test_patma_075(self) -> None: self.assertEqual(x, "x") self.assertEqual(y, 1) - def test_patma_076(self) -> None: + def test_patma_076(self): x = b"x" match x: case [b"x"]: @@ -711,7 +712,7 @@ def test_patma_076(self) -> None: self.assertEqual(x, b"x") self.assertEqual(y, 4) - def test_patma_077(self) -> None: + def test_patma_077(self): x = bytearray(b"x") y = None match x: @@ -722,7 +723,7 @@ def test_patma_077(self) -> None: self.assertEqual(x, b"x") self.assertEqual(y, None) - def test_patma_078(self) -> None: + def test_patma_078(self): x = "" match x: case []: @@ -734,7 +735,7 @@ def test_patma_078(self) -> None: self.assertEqual(x, "") self.assertEqual(y, 2) - def test_patma_079(self) -> None: + def test_patma_079(self): x = "xxx" match x: case ["x", "x", "x"]: @@ -746,7 +747,7 @@ def test_patma_079(self) -> None: self.assertEqual(x, "xxx") self.assertEqual(y, 2) - def test_patma_080(self) -> None: + def test_patma_080(self): x = b"xxx" match x: case [120, 120, 120]: @@ -758,7 +759,7 @@ def test_patma_080(self) -> None: self.assertEqual(x, b"xxx") self.assertEqual(y, 2) - def test_patma_081(self) -> None: + def test_patma_081(self): x = 0 match x: case 0 if not (x := 1): @@ -769,7 +770,7 @@ def test_patma_081(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, 0) - def test_patma_082(self) -> None: + def test_patma_082(self): x = 0 z = None match x: @@ -781,7 +782,7 @@ def test_patma_082(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, None) - def test_patma_083(self) -> None: + def test_patma_083(self): x = 0 match x: case (z := 0): @@ -790,7 +791,7 @@ def test_patma_083(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 0) - def test_patma_084(self) -> None: + def test_patma_084(self): x = 0 y = None z = None @@ -801,7 +802,7 @@ def test_patma_084(self) -> None: self.assertEqual(y, None) self.assertEqual(z, None) - def test_patma_085(self) -> None: + def test_patma_085(self): x = 0 y = None match x: @@ -812,7 +813,7 @@ def test_patma_085(self) -> None: self.assertEqual(y, None) self.assertEqual(z, 0) - def test_patma_086(self) -> None: + def test_patma_086(self): x = 0 match x: case (z := (w := 0)): @@ -822,7 +823,7 @@ def test_patma_086(self) -> None: self.assertEqual(y, 0) self.assertEqual(z, 0) - def test_patma_087(self) -> None: + def test_patma_087(self): x = 0 match x: case (0 | 1) | 2: @@ -830,7 +831,7 @@ def test_patma_087(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_088(self) -> None: + def test_patma_088(self): x = 1 match x: case (0 | 1) | 2: @@ -838,7 +839,7 @@ def test_patma_088(self) -> None: self.assertEqual(x, 1) self.assertEqual(y, 0) - def test_patma_089(self) -> None: + def test_patma_089(self): x = 2 match x: case (0 | 1) | 2: @@ -846,7 +847,7 @@ def test_patma_089(self) -> None: self.assertEqual(x, 2) self.assertEqual(y, 0) - def test_patma_090(self) -> None: + def test_patma_090(self): x = 3 y = None match x: @@ -855,7 +856,7 @@ def test_patma_090(self) -> None: self.assertEqual(x, 3) self.assertEqual(y, None) - def test_patma_091(self) -> None: + def test_patma_091(self): x = 0 match x: case 0 | (1 | 2): @@ -863,7 +864,7 @@ def test_patma_091(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_092(self) -> None: + def test_patma_092(self): x = 1 match x: case 0 | (1 | 2): @@ -871,7 +872,7 @@ def test_patma_092(self) -> None: self.assertEqual(x, 1) self.assertEqual(y, 0) - def test_patma_093(self) -> None: + def test_patma_093(self): x = 2 match x: case 0 | (1 | 2): @@ -879,7 +880,7 @@ def test_patma_093(self) -> None: self.assertEqual(x, 2) self.assertEqual(y, 0) - def test_patma_094(self) -> None: + def test_patma_094(self): x = 3 y = None match x: @@ -888,7 +889,7 @@ def test_patma_094(self) -> None: self.assertEqual(x, 3) self.assertEqual(y, None) - def test_patma_095(self) -> None: + def test_patma_095(self): x = 0 match x: case -0: @@ -896,7 +897,7 @@ def test_patma_095(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_096(self) -> None: + def test_patma_096(self): x = 0 match x: case -0.0: @@ -904,7 +905,7 @@ def test_patma_096(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_097(self) -> None: + def test_patma_097(self): x = 0 match x: case -0j: @@ -912,7 +913,7 @@ def test_patma_097(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_098(self) -> None: + def test_patma_098(self): x = 0 match x: case -0.0j: @@ -920,7 +921,7 @@ def test_patma_098(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_099(self) -> None: + def test_patma_099(self): x = -1 match x: case -1: @@ -928,7 +929,7 @@ def test_patma_099(self) -> None: self.assertEqual(x, -1) self.assertEqual(y, 0) - def test_patma_100(self) -> None: + def test_patma_100(self): x = -1.5 match x: case -1.5: @@ -936,7 +937,7 @@ def test_patma_100(self) -> None: self.assertEqual(x, -1.5) self.assertEqual(y, 0) - def test_patma_101(self) -> None: + def test_patma_101(self): x = -1j match x: case -1j: @@ -944,7 +945,7 @@ def test_patma_101(self) -> None: self.assertEqual(x, -1j) self.assertEqual(y, 0) - def test_patma_102(self) -> None: + def test_patma_102(self): x = -1.5j match x: case -1.5j: @@ -952,7 +953,7 @@ def test_patma_102(self) -> None: self.assertEqual(x, -1.5j) self.assertEqual(y, 0) - def test_patma_103(self) -> None: + def test_patma_103(self): x = 0 match x: case 0 + 0j: @@ -960,7 +961,7 @@ def test_patma_103(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_104(self) -> None: + def test_patma_104(self): x = 0 match x: case 0 - 0j: @@ -968,7 +969,7 @@ def test_patma_104(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_105(self) -> None: + def test_patma_105(self): x = 0 match x: case -0 + 0j: @@ -976,7 +977,7 @@ def test_patma_105(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_106(self) -> None: + def test_patma_106(self): x = 0 match x: case -0 - 0j: @@ -984,7 +985,7 @@ def test_patma_106(self) -> None: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_107(self) -> None: + def test_patma_107(self): x = 0.25 + 1.75j match x: case 0.25 + 1.75j: @@ -992,7 +993,7 @@ def test_patma_107(self) -> None: self.assertEqual(x, 0.25 + 1.75j) self.assertEqual(y, 0) - def test_patma_108(self) -> None: + def test_patma_108(self): x = 0.25 - 1.75j match x: case 0.25 - 1.75j: @@ -1000,7 +1001,7 @@ def test_patma_108(self) -> None: self.assertEqual(x, 0.25 - 1.75j) self.assertEqual(y, 0) - def test_patma_109(self) -> None: + def test_patma_109(self): x = -0.25 + 1.75j match x: case -0.25 + 1.75j: @@ -1008,7 +1009,7 @@ def test_patma_109(self) -> None: self.assertEqual(x, -0.25 + 1.75j) self.assertEqual(y, 0) - def test_patma_110(self) -> None: + def test_patma_110(self): x = -0.25 - 1.75j match x: case -0.25 - 1.75j: @@ -1016,7 +1017,7 @@ def test_patma_110(self) -> None: self.assertEqual(x, -0.25 - 1.75j) self.assertEqual(y, 0) - def test_patma_111(self) -> None: + def test_patma_111(self): class A: B = 0 x = 0 @@ -1027,7 +1028,7 @@ class A: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_112(self) -> None: + def test_patma_112(self): class A: class B: C = 0 @@ -1039,7 +1040,7 @@ class B: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_113(self) -> None: + def test_patma_113(self): class A: class B: C = 0 @@ -1051,7 +1052,7 @@ class B: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_114(self) -> None: + def test_patma_114(self): class A: class B: class C: @@ -1064,7 +1065,7 @@ class C: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_115(self) -> None: + def test_patma_115(self): class A: class B: class C: @@ -1077,7 +1078,7 @@ class C: self.assertEqual(x, 0) self.assertEqual(y, 0) - def test_patma_116(self) -> None: + def test_patma_116(self): match = case = 0 match match: case case: @@ -1086,7 +1087,7 @@ def test_patma_116(self) -> None: self.assertEqual(case, 0) self.assertEqual(x, 0) - def test_patma_117(self) -> None: + def test_patma_117(self): match = case = 0 match case: case match: @@ -1095,7 +1096,7 @@ def test_patma_117(self) -> None: self.assertEqual(case, 0) self.assertEqual(x, 0) - def test_patma_118(self) -> None: + def test_patma_118(self): x = [] match x: case [*_, _]: @@ -1105,7 +1106,7 @@ def test_patma_118(self) -> None: self.assertEqual(x, []) self.assertEqual(y, 1) - def test_patma_119(self) -> None: + def test_patma_119(self): x = collections.defaultdict(int) match x: case {0: 0}: @@ -1115,7 +1116,7 @@ def test_patma_119(self) -> None: self.assertEqual(x, {}) self.assertEqual(y, 1) - def test_patma_120(self) -> None: + def test_patma_120(self): x = collections.defaultdict(int) match x: case {0: 0}: @@ -1126,90 +1127,90 @@ def test_patma_120(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {}) - def test_patma_121(self) -> None: + def test_patma_121(self): match (): case (): x = 0 self.assertEqual(x, 0) - def test_patma_122(self) -> None: + def test_patma_122(self): match (0, 1, 2): case (*x,): y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) - def test_patma_123(self) -> None: + def test_patma_123(self): match (0, 1, 2): case 0, *x: y = 0 self.assertEqual(x, [1, 2]) self.assertEqual(y, 0) - def test_patma_124(self) -> None: + def test_patma_124(self): match (0, 1, 2): case (0, 1, *x,): y = 0 self.assertEqual(x, [2]) self.assertEqual(y, 0) - def test_patma_125(self) -> None: + def test_patma_125(self): match (0, 1, 2): case 0, 1, 2, *x: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_126(self) -> None: + def test_patma_126(self): match (0, 1, 2): case *x, 2,: y = 0 self.assertEqual(x, [0, 1]) self.assertEqual(y, 0) - def test_patma_127(self) -> None: + def test_patma_127(self): match (0, 1, 2): case (*x, 1, 2): y = 0 self.assertEqual(x, [0]) self.assertEqual(y, 0) - def test_patma_128(self) -> None: + def test_patma_128(self): match (0, 1, 2): case *x, 0, 1, 2,: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_129(self) -> None: + def test_patma_129(self): match (0, 1, 2): case (0, *x, 2): y = 0 self.assertEqual(x, [1]) self.assertEqual(y, 0) - def test_patma_130(self) -> None: + def test_patma_130(self): match (0, 1, 2): case 0, 1, *x, 2,: y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_131(self) -> None: + def test_patma_131(self): match (0, 1, 2): case (0, *x, 1, 2): y = 0 self.assertEqual(x, []) self.assertEqual(y, 0) - def test_patma_132(self) -> None: + def test_patma_132(self): match (0, 1, 2): case *x,: y = 0 self.assertEqual(x, [0, 1, 2]) self.assertEqual(y, 0) - def test_patma_133(self) -> None: + def test_patma_133(self): x = collections.defaultdict(int, {0: 1}) match x: case {1: 0}: @@ -1221,7 +1222,7 @@ def test_patma_133(self) -> None: self.assertEqual(x, {0: 1}) self.assertEqual(y, 2) - def test_patma_134(self) -> None: + def test_patma_134(self): x = collections.defaultdict(int, {0: 1}) match x: case {1: 0}: @@ -1234,7 +1235,7 @@ def test_patma_134(self) -> None: self.assertEqual(y, 2) self.assertEqual(z, {0: 1}) - def test_patma_135(self) -> None: + def test_patma_135(self): x = collections.defaultdict(int, {0: 1}) match x: case {1: 0}: @@ -1247,7 +1248,7 @@ def test_patma_135(self) -> None: self.assertEqual(y, 2) self.assertEqual(z, {}) - def test_patma_136(self) -> None: + def test_patma_136(self): x = {0: 1} match x: case {1: 0}: @@ -1259,7 +1260,7 @@ def test_patma_136(self) -> None: self.assertEqual(x, {0: 1}) self.assertEqual(y, 1) - def test_patma_137(self) -> None: + def test_patma_137(self): x = {0: 1} match x: case {1: 0}: @@ -1272,7 +1273,7 @@ def test_patma_137(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {0: 1}) - def test_patma_138(self) -> None: + def test_patma_138(self): x = {0: 1} match x: case {1: 0}: @@ -1285,7 +1286,7 @@ def test_patma_138(self) -> None: self.assertEqual(y, 1) self.assertEqual(z, {}) - def test_patma_139(self) -> None: + def test_patma_139(self): x = False match x: case bool(z): @@ -1294,7 +1295,7 @@ def test_patma_139(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_140(self) -> None: + def test_patma_140(self): x = True match x: case bool(z): @@ -1303,7 +1304,7 @@ def test_patma_140(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_141(self) -> None: + def test_patma_141(self): x = bytearray() match x: case bytearray(z): @@ -1312,7 +1313,7 @@ def test_patma_141(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_142(self) -> None: + def test_patma_142(self): x = b"" match x: case bytes(z): @@ -1321,7 +1322,7 @@ def test_patma_142(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_143(self) -> None: + def test_patma_143(self): x = {} match x: case dict(z): @@ -1330,7 +1331,7 @@ def test_patma_143(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_144(self) -> None: + def test_patma_144(self): x = 0.0 match x: case float(z): @@ -1339,7 +1340,7 @@ def test_patma_144(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_145(self) -> None: + def test_patma_145(self): x = frozenset() match x: case frozenset(z): @@ -1348,7 +1349,7 @@ def test_patma_145(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_146(self) -> None: + def test_patma_146(self): x = 0 match x: case int(z): @@ -1357,7 +1358,7 @@ def test_patma_146(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_147(self) -> None: + def test_patma_147(self): x = [] match x: case list(z): @@ -1366,7 +1367,7 @@ def test_patma_147(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_148(self) -> None: + def test_patma_148(self): x = set() match x: case set(z): @@ -1375,7 +1376,7 @@ def test_patma_148(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_149(self) -> None: + def test_patma_149(self): x = "" match x: case str(z): @@ -1384,7 +1385,7 @@ def test_patma_149(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_150(self) -> None: + def test_patma_150(self): x = () match x: case tuple(z): @@ -1393,7 +1394,7 @@ def test_patma_150(self) -> None: self.assertEqual(y, 0) self.assertIs(z, x) - def test_patma_151(self) -> None: + def test_patma_151(self): x = 0 match x,: case y,: @@ -1402,7 +1403,7 @@ def test_patma_151(self) -> None: self.assertIs(y, x) self.assertIs(z, 0) - def test_patma_152(self) -> None: + def test_patma_152(self): w = 0 x = 0 match w, x: @@ -1414,7 +1415,7 @@ def test_patma_152(self) -> None: self.assertIs(z, x) self.assertEqual(v, 0) - def test_patma_152(self) -> None: + def test_patma_153(self): x = 0 match w := x,: case v := y,: @@ -1425,15 +1426,236 @@ def test_patma_152(self) -> None: self.assertIs(w, x) self.assertIs(v, y) + def test_patma_154(self): + x = 0 + y = None + match x: + case 0 if x: + y = 0 + self.assertEqual(x, 0) + self.assertIs(y, None) + + def test_patma_155(self): + x = 0 + y = None + match x: + case 1: + y = 0 + self.assertEqual(x, 0) + self.assertIs(y, None) + + def test_patma_156(self): + x = 0 + match x: + case z: + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_157(self): + x = 0 + y = None + match x: + case _ if x: + y = 0 + self.assertEqual(x, 0) + self.assertIs(y, None) + + def test_patma_158(self): + x = 0 + match x: + case 0: + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_159(self): + x = 0 + match x: + case 0 if not x: + y = 0 + case 1: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_160(self): + x = 0 + z = None + match x: + case 0: + y = 0 + case z if x: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, None) + + def test_patma_161(self): + x = 0 + match x: + case 0: + y = 0 + case _: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_162(self): + x = 0 + match x: + case 1 if x: + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 1) + + def test_patma_163(self): + x = 0 + y = None + match x: + case 1: + y = 0 + case 1 if not x: + y = 1 + self.assertEqual(x, 0) + self.assertIs(y, None) + + def test_patma_164(self): + x = 0 + match x: + case 1: + y = 0 + case z: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertIs(z, x) + + def test_patma_165(self): + x = 0 + match x: + case 1 if x: + y = 0 + case _: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 1) + + def test_patma_166(self): + x = 0 + match x: + case z if not z: + y = 0 + case 0 if x: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_167(self): + x = 0 + match x: + case z if not z: + y = 0 + case 1: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_168(self): + x = 0 + match x: + case z if not x: + y = 0 + case z: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_169(self): + x = 0 + match x: + case z if not z: + y = 0 + case _ if x: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, x) + + def test_patma_170(self): + x = 0 + match x: + case _ if not x: + y = 0 + case 0: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + def test_patma_171(self): + x = 0 + y = None + match x: + case _ if x: + y = 0 + case 1: + y = 1 + self.assertEqual(x, 0) + self.assertIs(y, None) + + def test_patma_172(self): + x = 0 + z = None + match x: + case _ if not x: + y = 0 + case z if not x: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertIs(z, None) + + def test_patma_173(self): + x = 0 + match x: + case _ if not x: + y = 0 + case _: + y = 1 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + + +class PerfMatch(TestMatch): + + @staticmethod + def setUpClass(): + raise unittest.SkipTest("performance testing") + + def assertEqual(*_, **__): + pass + + def assertIs(*_, **__): + pass + def run_perf(self): - # ./python -m pyperf timeit -s "from test.test_patma import TestMatch; t = TestMatch()" "t.run_perf()" attrs = vars(type(self)).items() tests = [attr for name, attr in attrs if name.startswith("test_")] - assert_equal, assert_is = self.assertEqual, self.assertIs - try: - self.assertEqual = self.assertIs = lambda *_: None - for _ in range(1 << 10): - for test in tests: - test(self) - finally: - self.assertEqual, self.assertIs = assert_equal, assert_is + for _ in range(1 << 10): + for test in tests: + test(self) + + +""" +sudo ./python -m pyperf system tune && \ + ./python -m pyperf timeit -s "from test.test_patma import PerfMatch; p = PerfMatch()" "p.run_perf()"; \ +sudo ./python -m pyperf system reset +""" diff --git a/Python/compile.c b/Python/compile.c index 7777f87d5c3d3e..d53679296d4a7c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5827,6 +5827,12 @@ compiler_match(struct compiler *c, stmt_ty s) last = i == cases - 1 - has_default; m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); + if (!m->guard && m->pattern->kind == Name_kind && + m->pattern->v.Name.ctx == Store && i != cases - 1) + { + CHECK(compiler_warn(c, "unguarded name capture pattern makes " + "remaining cases unreachable")); + } CHECK(next = compiler_new_block(c)); if (!last) { ADDOP(c, DUP_TOP); @@ -5846,12 +5852,6 @@ compiler_match(struct compiler *c, stmt_ty s) VISIT_SEQ(c, stmt, m->body); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, next); - if (!m->guard && m->pattern->kind == Name_kind && - m->pattern->v.Name.ctx == Store && i != cases - 1) - { - CHECK(compiler_warn(c, "unguarded name capture pattern makes " - "remaining cases unreachable")); - } } if (has_default) { if (cases == 1) { From 4789bff6f36f7c9446380839ff2dde3aa8c21fb3 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 13 Jul 2020 09:00:04 -0700 Subject: [PATCH 132/218] Fix refleaks when tracking names --- Python/compile.c | 118 ++++++++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 47 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index d53679296d4a7c..4c73dfbe37680b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -176,7 +176,7 @@ struct compiler { }; typedef struct { - PyObject* stores; + PyObject *stores; } pattern_context; static int compiler_enter_scope(struct compiler *, identifier, int, void *, int); @@ -224,7 +224,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_pattern(struct compiler *, expr_ty, pattern_context); +static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); static int compiler_match(struct compiler *, stmt_ty); static PyCodeObject *assemble(struct compiler *, int addNone); @@ -5452,7 +5452,7 @@ compiler_slice(struct compiler *c, expr_ty s) static int -pattern_load(struct compiler *c, expr_ty p, pattern_context pc) +pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) { if (p->kind == Attribute_kind) { assert(p->v.Attribute.ctx == Load); @@ -5472,25 +5472,45 @@ pattern_load(struct compiler *c, expr_ty p, pattern_context pc) static int -pattern_store(struct compiler *c, expr_ty p, pattern_context pc) { +pattern_store(struct compiler *c, expr_ty p, pattern_context *pc) +{ assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { return compiler_error(c, "can't assign to '_' here; consider removing or renaming?"); } - if (PySet_Contains(pc.stores, p->v.Name.id)) { - // TODO: Format this error message with the name. - return compiler_error(c, "multiple assignments to name in pattern"); + if (!pc->stores) { + CHECK(pc->stores = PySet_New(NULL)); + } + else { + int dupe = PySet_Contains(pc->stores, p->v.Name.id); + if (dupe < 0) { + return 0; + } + if (dupe) { + PyObject *str = PyUnicode_FromFormat( + "multiple assignments to name %R in pattern", p->v.Name.id); + if (!str) { + return 0; + } + const char *s = PyUnicode_AsUTF8(str); + if (!s) { + return 0; + } + compiler_error(c, s); + Py_DECREF(str); + return 0; + } } - CHECK(!PySet_Add(pc.stores, p->v.Name.id)); + CHECK(!PySet_Add(pc->stores, p->v.Name.id)); CHECK(compiler_nameop(c, p->v.Name.id, Store)); return 1; } static int -compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); @@ -5501,62 +5521,67 @@ compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == BoolOp_kind); assert(p->v.BoolOp.op == Or); basicblock *end; PyObject *control = NULL; + PyObject *diff; CHECK(end = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); assert(size > 1); - PyObject *names_copy; - // TODO: Leaks sets. + PyObject *stores_init = pc->stores; + expr_ty alt; for (Py_ssize_t i = 0; i < size; i++) { - CHECK(names_copy = PySet_New(pc.stores)); - ADDOP(c, DUP_TOP); - // TODO: Just modify pc instead. - pattern_context sub_pc = pc; - sub_pc.stores = names_copy; - CHECK(compiler_pattern(c, asdl_seq_GET(p->v.BoolOp.values, i), sub_pc)); - ADDOP_JABS(c, JUMP_IF_TRUE_OR_POP, end); - // TODO: Reuse names_copy without actually building a new copy each loop? + // Can't use our helpful returning macros here (they'll leak sets): + alt = asdl_seq_GET(p->v.BoolOp.values, i); + pc->stores = PySet_New(stores_init); + SET_LOC(c, alt); + if (alt->kind == Name_kind && alt->v.Name.ctx == Store && i != size - 1) { + compiler_warn(c, "name capture pattern makes remaining alternate " + "patterns unreachable"); + } + if (!(pc->stores && compiler_addop(c, DUP_TOP) && + compiler_pattern(c, alt, pc) && + compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end, 1))) + { + goto fail; + } if (!i) { - control = names_copy; + control = pc->stores; + continue; } - else if (PySet_GET_SIZE(control) || PySet_GET_SIZE(names_copy)) { - PyObject *diff = PyNumber_InPlaceXor(names_copy, control); + if (PySet_GET_SIZE(pc->stores) || PySet_GET_SIZE(control)) { + diff = PyNumber_InPlaceXor(pc->stores, control); if (!diff) { - Py_DECREF(control); - return 0; + goto fail; } - Py_DECREF(names_copy); if (PySet_GET_SIZE(diff)) { - // TODO: Format this error message with a name. - // PyObject *extra = PySet_Pop(diff); - Py_DECREF(control); Py_DECREF(diff); - // TODO: Catch this during store. - return compiler_error(c, "pattern binds different names based on target"); + compiler_error(c, "pattern binds different names based on target"); + goto fail; } Py_DECREF(diff); } - else { - Py_DECREF(names_copy); - } + Py_DECREF(pc->stores); } - assert(control); - Py_DECREF(control); + Py_XDECREF(stores_init); + pc->stores = control; ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); return 1; +fail: + Py_XDECREF(stores_init); + Py_XDECREF(control); + return 0; } static int -compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { +compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { asdl_seq *args = p->v.Call.args; asdl_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); @@ -5604,7 +5629,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context pc) { static int -compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); CHECK(pattern_load(c, p, pc)); @@ -5614,7 +5639,7 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) { basicblock *block, *end; CHECK(block = compiler_new_block(c)); @@ -5671,7 +5696,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; @@ -5741,7 +5766,7 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); @@ -5757,7 +5782,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == NamedExpr_kind); basicblock *block, *end; @@ -5778,7 +5803,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context pc) static int -compiler_pattern(struct compiler *c, expr_ty p, pattern_context pc) +compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) { SET_LOC(c, p); switch (p->kind) { @@ -5837,10 +5862,9 @@ compiler_match(struct compiler *c, stmt_ty s) if (!last) { ADDOP(c, DUP_TOP); } - // TODO: Set pc.stores lazily. - CHECK(pc.stores = PySet_New(NULL)); - result = compiler_pattern(c, m->pattern, pc); - Py_DECREF(pc.stores); + pc.stores = NULL; + result = compiler_pattern(c, m->pattern, &pc); + Py_CLEAR(pc.stores); CHECK(result); ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); if (m->guard) { From 1260139a373bdb889add2a384682b26062e2dd86 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 13 Jul 2020 10:12:46 -0700 Subject: [PATCH 133/218] Regenerate keyword module --- Lib/keyword.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/keyword.py b/Lib/keyword.py index ccc951500f6d8c..e6b5f3d9626512 100644 --- a/Lib/keyword.py +++ b/Lib/keyword.py @@ -54,7 +54,8 @@ ] softkwlist = [ - + 'case', + 'match' ] iskeyword = frozenset(kwlist).__contains__ From 34f8111aa140a66f584944a3e77fc546159a80ea Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 14 Jul 2020 09:09:19 -0700 Subject: [PATCH 134/218] Add a ton of tests --- Lib/test/test_patma.py | 407 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 401 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 2c14d485009339..8f7ffac487bc8a 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,9 +1,11 @@ import collections import contextlib +import dataclasses +import enum import unittest -class TestMatch(unittest.TestCase): +class TestPatma(unittest.TestCase): def test_patma_000(self): match 0: @@ -1633,12 +1635,397 @@ def test_patma_173(self): self.assertEqual(x, 0) self.assertEqual(y, 0) + def test_patma_174(self): + def http_error(status): + match status: + case 400: + return "Bad request" + case 401: + return "Unauthorized" + case 403: + return "Forbidden" + case 404: + return "Not found" + case 418: + return "I'm a teapot" + case _: + return "Something else" + self.assertEqual(http_error(400), "Bad request") + self.assertEqual(http_error(401), "Unauthorized") + self.assertEqual(http_error(403), "Forbidden") + self.assertEqual(http_error(404), "Not found") + self.assertEqual(http_error(418), "I'm a teapot") + self.assertEqual(http_error(123), "Something else") + self.assertEqual(http_error("400"), "Something else") + self.assertEqual(http_error(401 | 403 | 404), "Something else") # 407 + + def test_patma_175(self): + def http_error(status): + match status: + case 400: + return "Bad request" + case 401 | 403 | 404: + return "Not allowed" + case 418: + return "I'm a teapot" + self.assertEqual(http_error(400), "Bad request") + self.assertEqual(http_error(401), "Not allowed") + self.assertEqual(http_error(403), "Not allowed") + self.assertEqual(http_error(404), "Not allowed") + self.assertEqual(http_error(418), "I'm a teapot") + self.assertIs(http_error(123), None) + self.assertIs(http_error("400"), None) + self.assertIs(http_error(401 | 403 | 404), None) # 407 + + def test_patma_176(self): + def whereis(point): + match point: + case (0, 0): + return "Origin" + case (0, y): + return f"Y={y}" + case (x, 0): + return f"X={x}" + case (x, y): + return f"X={x}, Y={y}" + case _: + raise ValueError("Not a point") + self.assertEqual(whereis((0, 0)), "Origin") + self.assertEqual(whereis((0, -1.0)), "Y=-1.0") + self.assertEqual(whereis(("X", 0)), "X=X") + self.assertEqual(whereis((None, 1j)), "X=None, Y=1j") + with self.assertRaises(ValueError): + whereis(42) + + def test_patma_177(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(0, 0): + return "Origin" + case Point(0, y): + return f"Y={y}" + case Point(x, 0): + return f"X={x}" + case Point(): + return "Somewhere else" + case _: + return "Not a point" + self.assertEqual(whereis(Point(1, 0)), "X=1") + self.assertEqual(whereis(Point(0, 0)), "Origin") + self.assertEqual(whereis(10), "Not a point") + self.assertEqual(whereis(Point(False, False)), "Origin") + self.assertEqual(whereis(Point(0, -1.0)), "Y=-1.0") + self.assertEqual(whereis(Point("X", 0)), "X=X") + self.assertEqual(whereis(Point(None, 1j)), "Somewhere else") + self.assertEqual(whereis(Point), "Not a point") + self.assertEqual(whereis(42), "Not a point") + + def test_patma_178(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(1, var): + return var + self.assertEqual(whereis(Point(1, 0)), 0) + self.assertIs(whereis(Point(0, 0)), None) + + def test_patma_179(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(1, y=var): + return var + self.assertEqual(whereis(Point(1, 0)), 0) + self.assertIs(whereis(Point(0, 0)), None) + + def test_patma_180(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(x=1, y=var): + return var + self.assertEqual(whereis(Point(1, 0)), 0) + self.assertIs(whereis(Point(0, 0)), None) + + def test_patma_181(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(y=var, x=1): + return var + self.assertEqual(whereis(Point(1, 0)), 0) + self.assertIs(whereis(Point(0, 0)), None) + + def test_patma_182(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(points): + match points: + case []: + return "No points" + case [Point(0, 0)]: + return "The origin" + case [Point(x, y)]: + return f"Single point {x}, {y}" + case [Point(0, y1), Point(0, y2)]: + return f"Two on the Y axis at {y1}, {y2}" + case _: + return "Something else" + self.assertEqual(whereis([]), "No points") + self.assertEqual(whereis([Point(0, 0)]), "The origin") + self.assertEqual(whereis([Point(0, 1)]), "Single point 0, 1") + self.assertEqual(whereis([Point(0, 0), Point(0, 0)]), "Two on the Y axis at 0, 0") + self.assertEqual(whereis([Point(0, 1), Point(0, 1)]), "Two on the Y axis at 1, 1") + self.assertEqual(whereis([Point(0, 0), Point(1, 0)]), "Something else") + self.assertEqual(whereis([Point(0, 0), Point(0, 0), Point(0, 0)]), "Something else") + self.assertEqual(whereis([Point(0, 1), Point(0, 1), Point(0, 1)]), "Something else") + + def test_patma_183(self): + @dataclasses.dataclass + class Point: + x: int + y: int + def whereis(point): + match point: + case Point(x, y) if x == y: + return f"Y=X at {x}" + case Point(x, y): + return "Not on the diagonal" + self.assertEqual(whereis(Point(0, 0)), "Y=X at 0") + self.assertEqual(whereis(Point(0, False)), "Y=X at 0") + self.assertEqual(whereis(Point(False, 0)), "Y=X at False") + self.assertEqual(whereis(Point(-1 - 1j, -1 - 1j)), "Y=X at (-1-1j)") + self.assertEqual(whereis(Point("X", "X")), "Y=X at X") + self.assertEqual(whereis(Point("X", "x")), "Not on the diagonal") + + def test_patma_184(self): + class Seq(collections.abc.Sequence): + __getitem__ = None + def __len__(self): + return 0 + match Seq(): + case []: + y = 0 + self.assertEqual(y, 0) -class PerfMatch(TestMatch): + def test_patma_185(self): + class Seq(collections.abc.Sequence): + __getitem__ = None + def __len__(self): + return 42 + match Seq(): + case [*_]: + y = 0 + self.assertEqual(y, 0) - @staticmethod - def setUpClass(): - raise unittest.SkipTest("performance testing") + def test_patma_186(self): + class Seq(collections.abc.Sequence): + def __getitem__(self, i): + return i + def __len__(self): + return 42 + match Seq(): + case [x, *y, z]: + w = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertEqual(y, list(range(1, 41))) + self.assertEqual(z, 41) + + def test_patma_187(self): + w = range(10) + match w: + case [x, y, *rest]: + z = 0 + self.assertEqual(w, range(10)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + self.assertEqual(rest, list(range(2, 10))) + + def test_patma_188(self): + w = range(100) + match w: + case (x, y, *rest): + z = 0 + self.assertEqual(w, range(100)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + self.assertEqual(rest, list(range(2, 100))) + + def test_patma_189(self): + w = range(1000) + match w: + case x, y, *rest: + z = 0 + self.assertEqual(w, range(1000)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + self.assertEqual(rest, list(range(2, 1000))) + + def test_patma_190(self): + w = range(1 << 10) + match w: + case [x, y, *_]: + z = 0 + self.assertEqual(w, range(1 << 10)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + + def test_patma_191(self): + w = range(1 << 20) + match w: + case (x, y, *_): + z = 0 + self.assertEqual(w, range(1 << 20)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + + def test_patma_192(self): + w = range(1 << 30) + match w: + case x, y, *_: + z = 0 + self.assertEqual(w, range(1 << 30)) + self.assertEqual(x, 0) + self.assertEqual(y, 1) + self.assertEqual(z, 0) + + def test_patma_193(self): + x = {"bandwidth": 0, "latency": 1} + match x: + case {"bandwidth": b, "latency": l}: + y = 0 + self.assertEqual(x, {"bandwidth": 0, "latency": 1}) + self.assertIs(b, x["bandwidth"]) + self.assertIs(l, x["latency"]) + self.assertEqual(y, 0) + + def test_patma_194(self): + x = {"bandwidth": 0, "latency": 1, "key": "value"} + match x: + case {"latency": l, "bandwidth": b}: + y = 0 + self.assertEqual(x, {"bandwidth": 0, "latency": 1, "key": "value"}) + self.assertIs(l, x["latency"]) + self.assertIs(b, x["bandwidth"]) + self.assertEqual(y, 0) + + def test_patma_195(self): + x = {"bandwidth": 0, "latency": 1, "key": "value"} + match x: + case {"bandwidth": b, "latency": l, **rest}: + y = 0 + self.assertEqual(x, {"bandwidth": 0, "latency": 1, "key": "value"}) + self.assertIs(b, x["bandwidth"]) + self.assertIs(l, x["latency"]) + self.assertEqual(rest, {"key": "value"}) + self.assertEqual(y, 0) + + def test_patma_196(self): + x = {"bandwidth": 0, "latency": 1} + match x: + case {"latency": l, "bandwidth": b, **rest}: + y = 0 + self.assertEqual(x, {"bandwidth": 0, "latency": 1}) + self.assertIs(l, x["latency"]) + self.assertIs(b, x["bandwidth"]) + self.assertEqual(rest, {}) + self.assertEqual(y, 0) + + def test_patma_197(self): + @dataclasses.dataclass + class Point: + x: int + y: int + w = [Point(-1, 0), Point(1, 2)] + match w: + case (Point(x1, y1), p2 := Point(x2, y2)): + z = 0 + self.assertEqual(w, [Point(-1, 0), Point(1, 2)]) + self.assertIs(x1, w[0].x) + self.assertIs(y1, w[0].y) + self.assertIs(p2, w[1]) + self.assertIs(x2, w[1].x) + self.assertIs(y2, w[1].y) + self.assertIs(z, 0) + + def test_patma_198(self): + class Color(enum.Enum): + RED = 0 + GREEN = 1 + BLUE = 2 + def f(color): + match color: + case Color.RED: + return "I see red!" + case Color.GREEN: + return "Grass is green" + case Color.BLUE: + return "I'm feeling the blues :(" + self.assertEqual(f(Color.RED), "I see red!") + self.assertEqual(f(Color.GREEN), "Grass is green") + self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(") + self.assertEqual(f(Color), None) + self.assertEqual(f(0), None) + self.assertEqual(f(1), None) + self.assertEqual(f(2), None) + self.assertEqual(f(3), None) + self.assertEqual(f(False), None) + self.assertEqual(f(True), None) + self.assertEqual(f(2+0j), None) + self.assertEqual(f(3.0), None) + + def test_patma_199(self): + class Color(int, enum.Enum): + RED = 0 + GREEN = 1 + BLUE = 2 + def f(color): + match color: + case Color.RED: + return "I see red!" + case Color.GREEN: + return "Grass is green" + case Color.BLUE: + return "I'm feeling the blues :(" + self.assertEqual(f(Color.RED), "I see red!") + self.assertEqual(f(Color.GREEN), "Grass is green") + self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(") + self.assertEqual(f(Color), None) + self.assertEqual(f(0), "I see red!") + self.assertEqual(f(1), "Grass is green") + self.assertEqual(f(2), "I'm feeling the blues :(") + self.assertEqual(f(3), None) + self.assertEqual(f(False), "I see red!") + self.assertEqual(f(True), "Grass is green") + self.assertEqual(f(2+0j), "I'm feeling the blues :(") + self.assertEqual(f(3.0), None) + + +class PerfPatma(TestPatma): def assertEqual(*_, **__): pass @@ -1646,6 +2033,10 @@ def assertEqual(*_, **__): def assertIs(*_, **__): pass + @contextlib.contextmanager + def assertRaises(*_, **__): + yield + def run_perf(self): attrs = vars(type(self)).items() tests = [attr for name, attr in attrs if name.startswith("test_")] @@ -1653,9 +2044,13 @@ def run_perf(self): for test in tests: test(self) + @staticmethod + def setUpClass(): + raise unittest.SkipTest("performance testing") + """ sudo ./python -m pyperf system tune && \ - ./python -m pyperf timeit -s "from test.test_patma import PerfMatch; p = PerfMatch()" "p.run_perf()"; \ + ./python -m pyperf timeit -s "from test.test_patma import PerfPatma; p = PerfPatma()" "p.run_perf()"; \ sudo ./python -m pyperf system reset """ From 3eadc5357c216d7da311d264f2f720792c694495 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 14 Jul 2020 13:22:50 -0700 Subject: [PATCH 135/218] Add more tests --- Lib/test/test_patma.py | 225 +++++++++++++++++++++++++++++++++++------ 1 file changed, 193 insertions(+), 32 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 8f7ffac487bc8a..6458c9ccb0d46e 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1,3 +1,4 @@ +import array import collections import contextlib import dataclasses @@ -5,6 +6,12 @@ import unittest +@dataclasses.dataclass +class Point: + x: int + y: int + + class TestPatma(unittest.TestCase): def test_patma_000(self): @@ -1698,10 +1705,6 @@ def whereis(point): whereis(42) def test_patma_177(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(0, 0): @@ -1725,10 +1728,6 @@ def whereis(point): self.assertEqual(whereis(42), "Not a point") def test_patma_178(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(1, var): @@ -1737,10 +1736,6 @@ def whereis(point): self.assertIs(whereis(Point(0, 0)), None) def test_patma_179(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(1, y=var): @@ -1749,10 +1744,6 @@ def whereis(point): self.assertIs(whereis(Point(0, 0)), None) def test_patma_180(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(x=1, y=var): @@ -1761,10 +1752,6 @@ def whereis(point): self.assertIs(whereis(Point(0, 0)), None) def test_patma_181(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(y=var, x=1): @@ -1773,10 +1760,6 @@ def whereis(point): self.assertIs(whereis(Point(0, 0)), None) def test_patma_182(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(points): match points: case []: @@ -1799,10 +1782,6 @@ def whereis(points): self.assertEqual(whereis([Point(0, 1), Point(0, 1), Point(0, 1)]), "Something else") def test_patma_183(self): - @dataclasses.dataclass - class Point: - x: int - y: int def whereis(point): match point: case Point(x, y) if x == y: @@ -1956,10 +1935,6 @@ def test_patma_196(self): self.assertEqual(y, 0) def test_patma_197(self): - @dataclasses.dataclass - class Point: - x: int - y: int w = [Point(-1, 0), Point(1, 2)] match w: case (Point(x1, y1), p2 := Point(x2, y2)): @@ -2024,6 +1999,192 @@ def f(color): self.assertEqual(f(2+0j), "I'm feeling the blues :(") self.assertEqual(f(3.0), None) + def test_patma_200(self): + class Class: + __match_args__ = ["a", "b"] + c = Class() + c.a = 0 + c.b = 1 + match c: + case Class(x, y): + z = 0 + self.assertIs(x, c.a) + self.assertIs(y, c.b) + self.assertEqual(z, 0) + + def test_patma_201(self): + class Class: + __match_args__ = ("a", "b") + c = Class() + c.a = 0 + c.b = 1 + match c: + case Class(x, b=y): + z = 0 + self.assertIs(x, c.a) + self.assertIs(y, c.b) + self.assertEqual(z, 0) + + def test_patma_202(self): + class Parent: + __match_args__ = "a", "b" + class Child(Parent): + __match_args__ = ["c", "d"] + c = Child() + c.a = 0 + c.b = 1 + match c: + case Parent(x, y): + z = 0 + self.assertIs(x, c.a) + self.assertIs(y, c.b) + self.assertEqual(z, 0) + + def test_patma_203(self): + class Parent: + __match_args__ = ("a", "b") + class Child(Parent): + __match_args__ = "c", "d" + c = Child() + c.a = 0 + c.b = 1 + match c: + case Parent(x, b=y): + z = 0 + self.assertIs(x, c.a) + self.assertIs(y, c.b) + self.assertEqual(z, 0) + + def test_patma_204(self): + def f(w): + match w: + case 42: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f(42), {}) + self.assertIs(f(0), None) + self.assertEqual(f(42.0), {}) + self.assertIs(f("42"), None) + + def test_patma_205(self): + def f(w): + match w: + case 42.0: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f(42.0), {}) + self.assertEqual(f(42), {}) + self.assertIs(f(0.0), None) + self.assertIs(f(0), None) + + def test_patma_206(self): + def f(w): + match w: + case 1 | 2 | 3: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f(1), {}) + self.assertEqual(f(2), {}) + self.assertEqual(f(3), {}) + self.assertEqual(f(3.0), {}) + self.assertIs(f(0), None) + self.assertIs(f(4), None) + self.assertIs(f("1"), None) + + def test_patma_207(self): + def f(w): + match w: + case [1, 2] | [3, 4]: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f([1, 2]), {}) + self.assertEqual(f([3, 4]), {}) + self.assertIs(f(42), None) + self.assertIs(f([2, 3]), None) + self.assertIs(f([1, 2, 3]), None) + self.assertEqual(f([1, 2.0]), {}) + + def test_patma_208(self): + def f(w): + match w: + case x: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f(42), {"x": 42}) + self.assertEqual(f((1, 2)), {"x": (1, 2)}) + self.assertEqual(f(None), {"x": None}) + + def test_patma_209(self): + def f(w): + match w: + case _: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f(42), {}) + self.assertEqual(f(None), {}) + self.assertEqual(f((1, 2)), {}) + + def test_patma_210(self): + def f(w): + match w: + case (x, y, z): + out = locals().copy() + del out["w"] + return out + self.assertEqual(f((1, 2, 3)), {"x": 1, "y": 2, "z": 3}) + self.assertIs(f((1, 2)), None) + self.assertIs(f((1, 2, 3, 4)), None) + self.assertIs(f(123), None) + self.assertIs(f("abc"), None) + self.assertIs(f(b"abc"), None) + self.assertIs(f(array.array("b", b"abc")), None) + self.assertEqual(f(memoryview(b"abc")), {"x": 97, "y": 98, "z": 99}) + self.assertIs(f(bytearray(b"abc")), None) + + def test_patma_211(self): + def f(w): + match w: + case {"x": x, "y": "y", "z": z}: + out = locals().copy() + del out["w"] + return out + self.assertEqual(f({"x": "x", "y": "y", "z": "z"}), {"x": "x", "z": "z"}) + self.assertEqual(f({"x": "x", "y": "y", "z": "z", "a": "a"}), {"x": "x", "z": "z"}) + self.assertIs(f(({"x": "x", "y": "yy", "z": "z", "a": "a"})), None) + self.assertIs(f(({"x": "x", "y": "y"})), None) + + def test_patma_212(self): + @dataclasses.dataclass + class MyClass: + x: int + y: str + __match_args__ = ["x", "y"] + def f(w): + match w: + case MyClass(int(xx), y="hello"): + out = locals().copy() + del out["w"], out["MyClass"] + return out + self.assertEqual(f(MyClass(42, "hello")), {"xx": 42}) + + def test_patma_213(self): + def f(w): + match w: + case x := (p, q): + out = locals().copy() + del out["w"] + return out + self.assertEqual(f((1, 2)), {"p": 1, "q": 2, "x": (1, 2)}) + self.assertEqual(f([1, 2]), {"p": 1, "q": 2, "x": [1, 2]}) + self.assertIs(f(12), None) + self.assertIs(f((1, 2, 3)), None) + class PerfPatma(TestPatma): From 7d232590385edf99b68aa90a353a46e2c5534422 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 14 Jul 2020 13:58:10 -0700 Subject: [PATCH 136/218] Update test --- Lib/test/test_patma.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 6458c9ccb0d46e..f8f8714789edaf 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2143,7 +2143,7 @@ def f(w): self.assertIs(f(123), None) self.assertIs(f("abc"), None) self.assertIs(f(b"abc"), None) - self.assertIs(f(array.array("b", b"abc")), None) + self.assertEqual(f(array.array("b", b"abc")), {'x': 97, 'y': 98, 'z': 99}) self.assertEqual(f(memoryview(b"abc")), {"x": 97, "y": 98, "z": 99}) self.assertIs(f(bytearray(b"abc")), None) @@ -2185,6 +2185,12 @@ def f(w): self.assertIs(f(12), None) self.assertIs(f((1, 2, 3)), None) + # TODO: PEP tests + # TODO: Don't check side-effecty assignments + # TODO: Full coverage of errors and warnings + # TODO: Check numbers, dupes + # TODO: Better use of assertIs + class PerfPatma(TestPatma): From bed2e68225a68d487085b368a2c9df32e8ff9c36 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 14 Jul 2020 15:31:08 -0700 Subject: [PATCH 137/218] target -> subject --- Grammar/python.gram | 4 ++-- Include/Python-ast.h | 7 ++++--- Lib/ast.py | 2 +- Parser/Python.asdl | 2 +- Parser/parser.c | 6 +++--- Python/Python-ast.c | 32 ++++++++++++++++++-------------- Python/ast.c | 2 +- Python/ast_opt.c | 2 +- Python/ceval.c | 38 +++++++++++++++++++------------------- Python/compile.c | 9 +++++---- Python/symtable.c | 2 +- 11 files changed, 56 insertions(+), 50 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 1b9e9fbbbfa3d7..f8e488771fef9a 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -202,8 +202,8 @@ match_expr[expr_ty]: | named_expression match_stmt[stmt_ty]: - | "match" target=match_expr ':' NEWLINE INDENT cases=case_block+ DEDENT { - _Py_Match(target, cases, EXTRA) } + | "match" subject=match_expr ':' NEWLINE INDENT cases=case_block+ DEDENT { + _Py_Match(subject, cases, EXTRA) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } diff --git a/Include/Python-ast.h b/Include/Python-ast.h index f2ebf9244aa512..38cb5f840da4ed 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -180,7 +180,7 @@ struct _stmt { } AsyncWith; struct { - expr_ty target; + expr_ty subject; asdl_seq *cases; } Match; @@ -537,8 +537,9 @@ stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); #define Match(a0, a1, a2, a3, a4, a5, a6) _Py_Match(a0, a1, a2, a3, a4, a5, a6) -stmt_ty _Py_Match(expr_ty target, asdl_seq * cases, int lineno, int col_offset, - int end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _Py_Match(expr_ty subject, asdl_seq * cases, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); #define Raise(a0, a1, a2, a3, a4, a5, a6) _Py_Raise(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); diff --git a/Lib/ast.py b/Lib/ast.py index 1085326b4a26b7..89c59f30152ae5 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1417,7 +1417,7 @@ def visit_Slice(self, node): def visit_Match(self, node): self.fill("match ") - self.traverse(node.target) + self.traverse(node.subject) with self.block(): for case in node.cases: self.traverse(case) diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 517aa256d8d00f..2ea375366873ee 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -36,7 +36,7 @@ module Python | With(withitem* items, stmt* body, string? type_comment) | AsyncWith(withitem* items, stmt* body, string? type_comment) - | Match(expr target, match_case* cases) + | Match(expr subject, match_case* cases) | Raise(expr? exc, expr? cause) | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) diff --git a/Parser/parser.c b/Parser/parser.c index a2e39d8840d493..426a997a3356f6 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -4899,11 +4899,11 @@ match_stmt_rule(Parser *p) Token * dedent_var; Token * indent_var; Token * newline_var; - expr_ty target; + expr_ty subject; if ( (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' && - (target = match_expr_rule(p)) // match_expr + (subject = match_expr_rule(p)) // match_expr && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -4926,7 +4926,7 @@ match_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Match ( target , cases , EXTRA ); + _res = _Py_Match ( subject , cases , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 132a8276ce5360..afddbc623aa4b0 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -213,6 +213,7 @@ typedef struct { PyObject *slice; PyObject *step; PyObject *stmt_type; + PyObject *subject; PyObject *tag; PyObject *target; PyObject *targets; @@ -469,6 +470,7 @@ static int astmodule_clear(PyObject *module) Py_CLEAR(state->slice); Py_CLEAR(state->step); Py_CLEAR(state->stmt_type); + Py_CLEAR(state->subject); Py_CLEAR(state->tag); Py_CLEAR(state->target); Py_CLEAR(state->targets); @@ -695,6 +697,7 @@ static int astmodule_traverse(PyObject *module, visitproc visit, void* arg) Py_VISIT(state->slice); Py_VISIT(state->step); Py_VISIT(state->stmt_type); + Py_VISIT(state->subject); Py_VISIT(state->tag); Py_VISIT(state->target); Py_VISIT(state->targets); @@ -786,6 +789,7 @@ static int init_identifiers(astmodulestate *state) if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return 0; if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return 0; if ((state->step = PyUnicode_InternFromString("step")) == NULL) return 0; + if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return 0; if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return 0; if ((state->target = PyUnicode_InternFromString("target")) == NULL) return 0; if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return 0; @@ -902,7 +906,7 @@ static const char * const AsyncWith_fields[]={ "type_comment", }; static const char * const Match_fields[]={ - "target", + "subject", "cases", }; static const char * const Raise_fields[]={ @@ -1508,7 +1512,7 @@ static int init_types(astmodulestate *state) " | If(expr test, stmt* body, stmt* orelse)\n" " | With(withitem* items, stmt* body, string? type_comment)\n" " | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" - " | Match(expr target, match_case* cases)\n" + " | Match(expr subject, match_case* cases)\n" " | Raise(expr? exc, expr? cause)\n" " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" " | Assert(expr test, expr? msg)\n" @@ -1613,7 +1617,7 @@ static int init_types(astmodulestate *state) return 0; state->Match_type = make_type(state, "Match", state->stmt_type, Match_fields, 2, - "Match(expr target, match_case* cases)"); + "Match(expr subject, match_case* cases)"); if (!state->Match_type) return 0; state->Raise_type = make_type(state, "Raise", state->stmt_type, Raise_fields, 2, @@ -2616,20 +2620,20 @@ AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, } stmt_ty -Match(expr_ty target, asdl_seq * cases, int lineno, int col_offset, int +Match(expr_ty subject, asdl_seq * cases, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; - if (!target) { + if (!subject) { PyErr_SetString(PyExc_ValueError, - "field 'target' is required for Match"); + "field 'subject' is required for Match"); return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; p->kind = Match_kind; - p->v.Match.target = target; + p->v.Match.subject = subject; p->v.Match.cases = cases; p->lineno = lineno; p->col_offset = col_offset; @@ -4100,9 +4104,9 @@ ast2obj_stmt(astmodulestate *state, void* _o) tp = (PyTypeObject *)state->Match_type; result = PyType_GenericNew(tp, NULL, NULL); if (!result) goto failed; - value = ast2obj_expr(state, o->v.Match.target); + value = ast2obj_expr(state, o->v.Match.subject); if (!value) goto failed; - if (PyObject_SetAttr(result, state->target, value) == -1) + if (PyObject_SetAttr(result, state->subject, value) == -1) goto failed; Py_DECREF(value); value = ast2obj_list(state, o->v.Match.cases, ast2obj_match_case); @@ -6873,19 +6877,19 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena) return 1; } if (isinstance) { - expr_ty target; + expr_ty subject; asdl_seq* cases; - if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) { + if (_PyObject_LookupAttr(obj, state->subject, &tmp) < 0) { return 1; } if (tmp == NULL) { - PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from Match"); + PyErr_SetString(PyExc_TypeError, "required field \"subject\" missing from Match"); return 1; } else { int res; - res = obj2ast_expr(state, tmp, &target, arena); + res = obj2ast_expr(state, tmp, &subject, arena); if (res != 0) goto failed; Py_CLEAR(tmp); } @@ -6922,7 +6926,7 @@ obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena) } Py_CLEAR(tmp); } - *out = Match(target, cases, lineno, col_offset, end_lineno, + *out = Match(subject, cases, lineno, col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; diff --git a/Python/ast.c b/Python/ast.c index 90e6e9b4313605..a80e45969e526b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -538,7 +538,7 @@ validate_stmt(stmt_ty stmt) } return validate_body(stmt->v.AsyncWith.body, "AsyncWith"); case Match_kind: - if (!validate_expr(stmt->v.Match.target, Load) + if (!validate_expr(stmt->v.Match.subject, Load) || !validate_nonempty_seq(stmt->v.Match.cases, "cases", "Match")) { return 0; } diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 265d80aca0f529..a12c55471e4a6f 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -713,7 +713,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) CALL(astfold_expr, expr_ty, node_->v.Expr.value); break; case Match_kind: - CALL(astfold_expr, expr_ty, node_->v.Match.target); + CALL(astfold_expr, expr_ty, node_->v.Match.subject); CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); break; default: diff --git a/Python/ceval.c b/Python/ceval.c index 91d9c00fea0f48..fd59d5d756cd49 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -973,7 +973,7 @@ get_match_args(PyThreadState *tstate, PyObject *type) } static PyObject * -do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *target) +do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *subject) { // TODO: Break this up! if (!PyType_Check(type)) { @@ -982,7 +982,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty return NULL; } assert(PyTuple_CheckExact(kwargs)); - if (PyObject_IsInstance(target, type) <= 0) { + if (PyObject_IsInstance(subject, type) <= 0) { return NULL; } PyObject *args = NULL; @@ -1040,8 +1040,8 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty if (i < nargs) { if (!args) { assert(!i); - Py_INCREF(target); - PyTuple_SET_ITEM(attrs, 0, target); + Py_INCREF(subject); + PyTuple_SET_ITEM(attrs, 0, subject); continue; } name = PyTuple_GET_ITEM(args, i); @@ -1063,7 +1063,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty } goto error; } - attr = PyObject_GetAttr(target, name); + attr = PyObject_GetAttr(subject, name); if (!attr) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); @@ -3536,11 +3536,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_CLASS): { PyObject *names = POP(); PyObject *type = TOP(); - PyObject *target = SECOND(); - PyObject *attrs = do_match(tstate, oparg, names, type, target); + PyObject *subject = SECOND(); + PyObject *attrs = do_match(tstate, oparg, names, type, subject); Py_DECREF(names); if (attrs) { - Py_DECREF(target); + Py_DECREF(subject); SET_SECOND(attrs); } else if (_PyErr_Occurred(tstate)) { @@ -3573,11 +3573,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQUENCE): { - PyObject *target = TOP(); - if (PyType_FastSubclass(Py_TYPE(target), + PyObject *subject = TOP(); + if (PyType_FastSubclass(Py_TYPE(subject), Py_TPFLAGS_BYTES_SUBCLASS | Py_TPFLAGS_UNICODE_SUBCLASS) - || PyIter_Check(target) - || PyByteArray_Check(target)) + || PyIter_Check(subject) + || PyByteArray_Check(subject)) { Py_INCREF(Py_False); PUSH(Py_False); @@ -3595,7 +3595,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } } - int match = PyObject_IsInstance(target, interp->seq_abc); + int match = PyObject_IsInstance(subject, interp->seq_abc); if (match < 0) { goto error; } @@ -3605,8 +3605,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_KEYS): { PyObject *keys = TOP(); - PyObject *target = SECOND(); - PyObject *values = match_map_items(tstate, target, keys); + PyObject *subject = SECOND(); + PyObject *values = match_map_items(tstate, subject, keys); if (!values) { if (_PyErr_Occurred(tstate)) { goto error; @@ -3619,12 +3619,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } if (oparg) { - PyObject *rest = match_map_copy(tstate, target, keys); + PyObject *rest = match_map_copy(tstate, subject, keys); if (!rest) { goto error; } SET_SECOND(rest); - Py_DECREF(target); + Py_DECREF(subject); } SET_TOP(values); Py_DECREF(keys); @@ -3668,10 +3668,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (!items) { goto error; } - PyObject *target = TOP(); + PyObject *subject = TOP(); PyObject *item; for (Py_ssize_t i = start; i < stop; i++) { - item = PySequence_GetItem(target, i); + item = PySequence_GetItem(subject, i); if (!item) { Py_DECREF(items); goto error; diff --git a/Python/compile.c b/Python/compile.c index 1c3355a534ccb9..032da7beb4454e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5544,9 +5544,10 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) compiler_warn(c, "name capture pattern makes remaining alternate " "patterns unreachable"); } - if (!(pc->stores && compiler_addop(c, DUP_TOP) && - compiler_pattern(c, alt, pc) && - compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end, 1))) + if (!pc->stores || + !compiler_addop(c, DUP_TOP) || + !compiler_pattern(c, alt, pc) || + !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end, 1)) { goto fail; } @@ -5841,7 +5842,7 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) static int compiler_match(struct compiler *c, stmt_ty s) { - VISIT(c, expr, s->v.Match.target); + VISIT(c, expr, s->v.Match.subject); basicblock *next, *end; CHECK(end = compiler_new_block(c)); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); diff --git a/Python/symtable.c b/Python/symtable.c index 5cf1f90ed5f942..83f744301257ee 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1293,7 +1293,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) VISIT_SEQ(st, stmt, s->v.If.orelse); break; case Match_kind: - VISIT(st, expr, s->v.Match.target); + VISIT(st, expr, s->v.Match.subject); VISIT_SEQ(st, match_case, s->v.Match.cases); break; case Raise_kind: From 1a70d2c690f9cb82a859299767141b80b1a50525 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 15 Jul 2020 07:41:00 -0700 Subject: [PATCH 138/218] Add tests --- Lib/test/test_patma.py | 181 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 162 insertions(+), 19 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index f8f8714789edaf..cb67d8af3b9eba 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -3,7 +3,16 @@ import contextlib import dataclasses import enum +import inspect import unittest +import warnings + + +@dataclasses.dataclass +class MyClass: + x: int + y: str + __match_args__ = ["x", "y"] @dataclasses.dataclass @@ -2059,7 +2068,7 @@ def test_patma_204(self): def f(w): match w: case 42: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f(42), {}) @@ -2071,7 +2080,7 @@ def test_patma_205(self): def f(w): match w: case 42.0: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f(42.0), {}) @@ -2083,7 +2092,7 @@ def test_patma_206(self): def f(w): match w: case 1 | 2 | 3: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f(1), {}) @@ -2098,7 +2107,7 @@ def test_patma_207(self): def f(w): match w: case [1, 2] | [3, 4]: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f([1, 2]), {}) @@ -2112,7 +2121,7 @@ def test_patma_208(self): def f(w): match w: case x: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f(42), {"x": 42}) @@ -2123,7 +2132,7 @@ def test_patma_209(self): def f(w): match w: case _: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f(42), {}) @@ -2134,7 +2143,7 @@ def test_patma_210(self): def f(w): match w: case (x, y, z): - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f((1, 2, 3)), {"x": 1, "y": 2, "z": 3}) @@ -2151,7 +2160,7 @@ def test_patma_211(self): def f(w): match w: case {"x": x, "y": "y", "z": z}: - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f({"x": "x", "y": "y", "z": "z"}), {"x": "x", "z": "z"}) @@ -2160,16 +2169,11 @@ def f(w): self.assertIs(f(({"x": "x", "y": "y"})), None) def test_patma_212(self): - @dataclasses.dataclass - class MyClass: - x: int - y: str - __match_args__ = ["x", "y"] def f(w): match w: case MyClass(int(xx), y="hello"): - out = locals().copy() - del out["w"], out["MyClass"] + out = locals() + del out["w"] return out self.assertEqual(f(MyClass(42, "hello")), {"xx": 42}) @@ -2177,7 +2181,7 @@ def test_patma_213(self): def f(w): match w: case x := (p, q): - out = locals().copy() + out = locals() del out["w"] return out self.assertEqual(f((1, 2)), {"p": 1, "q": 2, "x": (1, 2)}) @@ -2185,6 +2189,136 @@ def f(w): self.assertIs(f(12), None) self.assertIs(f((1, 2, 3)), None) + def test_patma_214(self): + def f(): + match 42: + case 42: + return locals() + self.assertEqual(set(f()), set()) + + def test_patma_215(self): + def f(): + match 1: + case 1 | 2 | 3: + return locals() + self.assertEqual(set(f()), set()) + + def test_patma_216(self): + def f(): + match ...: + case _: + return locals() + self.assertEqual(set(f()), set()) + + def test_patma_217(self): + def f(): + match ...: + case abc: + return locals() + self.assertEqual(set(f()), {"abc"}) + + def test_patma_218(self): + namespace = {} + code = """ + match ...: + case a | a: + pass + """ + with self.assertWarns(SyntaxWarning): + exec(inspect.cleandoc(code), None, namespace) + self.assertEqual(set(namespace), {"a"}) + + def test_patma_219(self): + code = """ + match ...: + case a | "a": + pass + """ + with self.assertWarns(SyntaxWarning), self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_220(self): + def f(): + match ..., ...: + case a, b: + return locals() + self.assertEqual(set(f()), {"a", "b"}) + + def test_patma_221(self): + code = """ + match ...: + case a, a: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_222(self): + def f(): + match {"k": ..., "l": ...}: + case {"k": a, "l": b}: + return locals() + self.assertEqual(set(f()), {"a", "b"}) + + def test_patma_223(self): + code = """ + match ...: + case {"k": a, "l": a}: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_224(self): + def f(): + match MyClass(..., ...): + case MyClass(x, y=y): + return locals() + self.assertEqual(set(f()), {"x", "y"}) + + def test_patma_225(self): + code = """ + match ...: + case MyClass(x, x): + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_226(self): + code = """ + match ...: + case MyClass(x=x, y=x): + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_227(self): + code = """ + match ...: + case MyClass(x, y=x): + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_228(self): + def f(): + match ...: + case a := b: + return locals() + self.assertEqual(set(f()), {"a", "b"}) + + def test_patma_229(self): + code = """ + match ...: + case a := a: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + # TODO: PEP tests # TODO: Don't check side-effecty assignments # TODO: Full coverage of errors and warnings @@ -2202,12 +2336,21 @@ def assertIs(*_, **__): @contextlib.contextmanager def assertRaises(*_, **__): - yield + try: + yield + except: + pass + + @contextlib.contextmanager + def assertWarns(*_, **__): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + yield def run_perf(self): - attrs = vars(type(self)).items() + attrs = vars(TestPatma).items() tests = [attr for name, attr in attrs if name.startswith("test_")] - for _ in range(1 << 10): + for _ in range(1 << 8): for test in tests: test(self) From f83302ff389bc214b81b8c71c0fc36f180ad1cc6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 15 Jul 2020 09:07:18 -0700 Subject: [PATCH 139/218] Refactor loads --- Python/ast_opt.c | 25 +++++++++------- Python/compile.c | 74 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 70 insertions(+), 29 deletions(-) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index a12c55471e4a6f..f26bec062fb0e9 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -751,11 +751,16 @@ astfold_pattern_negative(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat assert(node_->v.UnaryOp.op == USub); assert(node_->v.UnaryOp.operand->kind == Constant_kind); PyObject *value = node_->v.UnaryOp.operand->v.Constant.value; - assert(PyComplex_CheckExact(value) || PyFloat_CheckExact(value) || PyLong_CheckExact(value)); + assert(PyComplex_CheckExact(value) || + PyFloat_CheckExact(value) || + PyLong_CheckExact(value)); PyObject *negated = PyNumber_Negative(value); if (!negated) { return 0; } + assert(PyComplex_CheckExact(negated) || + PyFloat_CheckExact(negated) || + PyLong_CheckExact(negated)); return make_const(node_, negated, ctx_); } @@ -763,31 +768,31 @@ static int astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { expr_ty left = node_->v.BinOp.left; + expr_ty right = node_->v.BinOp.right; if (left->kind == UnaryOp_kind) { CALL(astfold_pattern_negative, expr_ty, left); } - expr_ty right = node_->v.BinOp.right; - assert(node_->v.BinOp.op == Add || node_->v.BinOp.op == Sub); - assert(node_->v.BinOp.left->kind = Constant_kind); - assert(node_->v.BinOp.right->kind = Constant_kind); - if (!PyFloat_CheckExact(left->v.Constant.value) && !PyLong_CheckExact(left->v.Constant.value)) { + assert(left->kind = Constant_kind); + assert(right->kind = Constant_kind); + if (!(PyFloat_CheckExact(left->v.Constant.value) || + PyLong_CheckExact(left->v.Constant.value)) || + !PyComplex_CheckExact(right->v.Constant.value)) + { // Not actually valid, but it's the complier's job to complain: return 1; } - if (!PyComplex_CheckExact(right->v.Constant.value)) { - // Ditto: - return 1; - } PyObject *new; if (node_->v.BinOp.op == Add) { new = PyNumber_Add(left->v.Constant.value, right->v.Constant.value); } else { + assert(node_->v.BinOp.op == Sub); new = PyNumber_Subtract(left->v.Constant.value, right->v.Constant.value); } if (!new) { return 0; } + assert(PyComplex_CheckExact(new)); return make_const(node_, new, ctx_); } diff --git a/Python/compile.c b/Python/compile.c index 032da7beb4454e..b92faa8bb33499 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5454,27 +5454,51 @@ compiler_slice(struct compiler *c, expr_ty s) static int -pattern_load(struct compiler *c, expr_ty p, pattern_context *pc) +pattern_load_name(struct compiler *c, expr_ty p, pattern_context *pc) { - if (p->kind == Attribute_kind) { - assert(p->v.Attribute.ctx == Load); - CHECK(pattern_load(c, p->v.Attribute.value, pc)); - ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); - } - else if (p->kind == Name_kind) { - assert(p->v.Name.ctx == Load); - CHECK(compiler_nameop(c, p->v.Name.id, Load)); + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Load); + CHECK(compiler_nameop(c, p->v.Name.id, Load)); + return 1; +} + + +static int +pattern_load_attribute(struct compiler *c, expr_ty p, pattern_context *pc) +{ + assert(p->kind == Attribute_kind); + assert(p->v.Attribute.ctx == Load); + if (p->v.Attribute.value->kind == Attribute_kind) { + CHECK(pattern_load_attribute(c, p->v.Attribute.value, pc)); } else { - assert(p->kind == Constant_kind); - ADDOP_LOAD_CONST(c, p->v.Constant.value); + assert(p->v.Attribute.value->kind == Name_kind); + CHECK(pattern_load_name(c, p->v.Attribute.value, pc)); } + ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); return 1; } static int -pattern_store(struct compiler *c, expr_ty p, pattern_context *pc) +pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) +{ + assert(p->kind == Constant_kind); + assert(PyBytes_CheckExact(p->v.Constant.value) || + PyComplex_CheckExact(p->v.Constant.value) || + PyFloat_CheckExact(p->v.Constant.value) || + PyLong_CheckExact(p->v.Constant.value) || + PyUnicode_CheckExact(p->v.Constant.value) || + p->v.Constant.value == Py_False || + p->v.Constant.value == Py_None || + p->v.Constant.value == Py_True); + ADDOP_LOAD_CONST(c, p->v.Constant.value); + return 1; +} + + +static int +pattern_store_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); @@ -5516,7 +5540,7 @@ compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); - CHECK(pattern_load(c, p, pc)); + CHECK(pattern_load_attribute(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; } @@ -5596,7 +5620,13 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { CHECK(!validate_keywords(c, kwargs)); CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - CHECK(pattern_load(c, p->v.Call.func, pc)); + if (p->v.Call.func->kind == Attribute_kind) { + CHECK(pattern_load_attribute(c, p->v.Call.func, pc)); + } + else { + assert(p->v.Call.func->kind == Name_kind); + CHECK(pattern_load_name(c, p->v.Call.func, pc)); + } PyObject *kwnames, *name; CHECK(kwnames = PyTuple_New(nkwargs)); Py_ssize_t i; @@ -5635,7 +5665,7 @@ static int compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); - CHECK(pattern_load(c, p, pc)); + CHECK(pattern_load_constant(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; } @@ -5666,7 +5696,13 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) if (!key) { return compiler_error(c, "can't use starred pattern here; consider moving to end?"); } - CHECK(pattern_load(c, key, pc)); + if (key->kind == Attribute_kind) { + CHECK(pattern_load_attribute(c, key, pc)); + } + else { + assert(key->kind == Constant_kind); + CHECK(pattern_load_constant(c, key, pc)); + } } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); @@ -5682,7 +5718,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP(c, POP_TOP); if (star) { - CHECK(pattern_store(c, asdl_seq_GET(values, size - 1), pc)); + CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1), pc)); } else { ADDOP(c, POP_TOP); @@ -5777,7 +5813,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, POP_TOP); } else { - CHECK(pattern_store(c, p, pc)); + CHECK(pattern_store_name(c, p, pc)); } ADDOP_LOAD_CONST(c, Py_True); return 1; @@ -5794,7 +5830,7 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, DUP_TOP); CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); - CHECK(pattern_store(c, p->v.NamedExpr.target, pc)); + CHECK(pattern_store_name(c, p->v.NamedExpr.target, pc)); ADDOP_LOAD_CONST(c, Py_True); ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, block); From 1ba56a003b4e46c1833821c8133201e33b1ecddc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 16 Jul 2020 17:23:24 -0700 Subject: [PATCH 140/218] Cleanup and better performance for default cases --- Lib/test/test_patma.py | 82 +++++++++++++++++--- Python/ceval.c | 45 ++++++++--- Python/compile.c | 169 ++++++++++++++++++----------------------- 3 files changed, 180 insertions(+), 116 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index cb67d8af3b9eba..06af444667d415 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -84,13 +84,11 @@ def test_patma_008(self): x = 0 class A: y = 1 - z = None match x: case z := A.y: pass self.assertEqual(x, 0) self.assertEqual(A.y, 1) - self.assertEqual(z, None) def test_patma_009(self): class A: @@ -245,13 +243,11 @@ def test_patma_027(self): def test_patma_028(self): x = {0: 3} y = None - z = None match x: case {0: (z := 0 | 1 | 2)}: y = 0 self.assertEqual(x, {0: 3}) self.assertEqual(y, None) - self.assertEqual(z, None) def test_patma_029(self): x = {} @@ -402,13 +398,11 @@ def test_patma_042(self): def test_patma_043(self): x = 3 y = None - z = None match x: case (z := 0) | (z := 1) | (z := 2) if z == x % 2: y = 0 self.assertEqual(x, 3) self.assertEqual(y, None) - self.assertEqual(z, None) def test_patma_044(self): x = () @@ -790,7 +784,6 @@ def test_patma_081(self): def test_patma_082(self): x = 0 - z = None match x: case (z := 1) if not (x := 1): y = 0 @@ -798,7 +791,6 @@ def test_patma_082(self): y = 1 self.assertEqual(x, 0) self.assertEqual(y, 1) - self.assertEqual(z, None) def test_patma_083(self): x = 0 @@ -812,13 +804,11 @@ def test_patma_083(self): def test_patma_084(self): x = 0 y = None - z = None match x: case (z := 1): y = 0 self.assertEqual(x, 0) self.assertEqual(y, None) - self.assertEqual(z, None) def test_patma_085(self): x = 0 @@ -2319,6 +2309,78 @@ def test_patma_229(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + def test_patma_230(self): + def f(x): + match x: + case _: + return 0 + self.assertEqual(f(0), 0) + self.assertEqual(f(1), 0) + self.assertEqual(f(2), 0) + self.assertEqual(f(3), 0) + + def test_patma_231(self): + def f(x): + match x: + case 0: + return 0 + self.assertEqual(f(0), 0) + self.assertIs(f(1), None) + self.assertIs(f(2), None) + self.assertIs(f(3), None) + + def test_patma_232(self): + def f(x): + match x: + case 0: + return 0 + case _: + return 1 + self.assertEqual(f(0), 0) + self.assertEqual(f(1), 1) + self.assertEqual(f(2), 1) + self.assertEqual(f(3), 1) + + def test_patma_233(self): + def f(x): + match x: + case 0: + return 0 + case 1: + return 1 + self.assertEqual(f(0), 0) + self.assertEqual(f(1), 1) + self.assertIs(f(2), None) + self.assertIs(f(3), None) + + def test_patma_234(self): + def f(x): + match x: + case 0: + return 0 + case 1: + return 1 + case _: + return 2 + self.assertEqual(f(0), 0) + self.assertEqual(f(1), 1) + self.assertEqual(f(2), 2) + self.assertEqual(f(3), 2) + + def test_patma_235(self): + def f(x): + match x: + case 0: + return 0 + case 1: + return 1 + case 2: + return 2 + self.assertEqual(f(0), 0) + self.assertEqual(f(1), 1) + self.assertEqual(f(2), 2) + self.assertIs(f(3), None) + # TODO: PEP tests # TODO: Don't check side-effecty assignments # TODO: Full coverage of errors and warnings diff --git a/Python/ceval.c b/Python/ceval.c index fd59d5d756cd49..448c354a9fe3c4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -855,7 +855,10 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) if (!nkeys) { return PyTuple_New(0); } - PyObject *get = NULL, *dummy = NULL, *seen = NULL, *values = NULL; + PyObject *get = NULL; + PyObject *dummy = NULL; + PyObject *seen = NULL; + PyObject *values = NULL; if (!PyDict_CheckExact(map)) { _Py_IDENTIFIER(get); get = _PyObject_GetAttrId(map, &PyId_get); @@ -3634,6 +3637,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX): { + // PUSH(TOS[oparg]) PyObject *item = PySequence_GetItem(TOP(), oparg); if (!item) { goto error; @@ -3643,6 +3647,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_END): { + // PUSH(TOS[TOS1 - 1 - oparg]) + // NOTE: We can't rely on support for negative indexing! + // Although PySequence_GetItem tries to correct negative indexes, we + // just use the length we already have at TOS1. In addition to + // avoiding tons of redundant __len__ calls, this also handles + // length changes during extraction more intuitively. Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; @@ -3657,6 +3667,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_SLICE): { + // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) + // NOTE: We can't rely on support for slicing or negative indexing! + // Ditto GET_INDEX_END's length handling. Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; @@ -3664,19 +3677,29 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) Py_ssize_t start = oparg & 0xFF; Py_ssize_t stop = len - (oparg >> 8); assert(start <= stop); - PyObject *items = PyList_New(stop - start); - if (!items) { - goto error; - } PyObject *subject = TOP(); - PyObject *item; - for (Py_ssize_t i = start; i < stop; i++) { - item = PySequence_GetItem(subject, i); - if (!item) { - Py_DECREF(items); + PyObject *items; + if (PyList_CheckExact(subject)) { + items = PyList_GetSlice(subject, start, stop); + if (!items) { + goto error; + } + assert(PyList_CheckExact(items)); + } + else { + items = PyList_New(stop - start); + if (!items) { goto error; } - PyList_SET_ITEM(items, i - start, item); + PyObject *item; + for (Py_ssize_t i = start; i < stop; i++) { + item = PySequence_GetItem(subject, i); + if (!item) { + Py_DECREF(items); + goto error; + } + PyList_SET_ITEM(items, i - start, item); + } } PUSH(items); DISPATCH(); diff --git a/Python/compile.c b/Python/compile.c index b92faa8bb33499..bd8a283328c943 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -186,7 +186,7 @@ static int compiler_next_instr(basicblock *); static int compiler_addop(struct compiler *, int); static int compiler_addop_i(struct compiler *, int, Py_ssize_t); static int compiler_addop_j(struct compiler *, int, basicblock *, int); -static int compiler_error(struct compiler *, const char *); +static int compiler_error(struct compiler *, const char *, ...); static int compiler_warn(struct compiler *, const char *, ...); static int compiler_nameop(struct compiler *, identifier, expr_context_ty); @@ -4129,13 +4129,8 @@ validate_keywords(struct compiler *c, asdl_seq *keywords) for (Py_ssize_t j = i + 1; j < nkeywords; j++) { keyword_ty other = ((keyword_ty)asdl_seq_GET(keywords, j)); if (other->arg && !PyUnicode_Compare(key->arg, other->arg)) { - PyObject *msg = PyUnicode_FromFormat("keyword argument repeated: %U", key->arg); - if (msg == NULL) { - return -1; - } c->u->u_col_offset = other->col_offset; - compiler_error(c, PyUnicode_AsUTF8(msg)); - Py_DECREF(msg); + compiler_error(c, "keyword argument repeated: %U", key->arg); return -1; } } @@ -5311,28 +5306,34 @@ compiler_annassign(struct compiler *c, stmt_ty s) */ static int -compiler_error(struct compiler *c, const char *errstr) +compiler_error(struct compiler *c, const char *format, ...) { - PyObject *loc; - PyObject *u = NULL, *v = NULL; - - loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno); + va_list vargs; +#ifdef HAVE_STDARG_PROTOTYPES + va_start(vargs, format); +#else + va_start(vargs); +#endif + PyObject *msg = PyUnicode_FromFormatV(format, vargs); + va_end(vargs); + if (!msg) { + return 0; + } + PyObject *loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno); if (!loc) { Py_INCREF(Py_None); loc = Py_None; } - u = Py_BuildValue("(OiiO)", c->c_filename, c->u->u_lineno, - c->u->u_col_offset + 1, loc); - if (!u) - goto exit; - v = Py_BuildValue("(zO)", errstr, u); - if (!v) + PyObject *args = Py_BuildValue("O(OiiO)", msg, c->c_filename, + c->u->u_lineno, c->u->u_col_offset + 1, loc); + Py_DECREF(msg); + if (!args) { goto exit; - PyErr_SetObject(PyExc_SyntaxError, v); + } + PyErr_SetObject(PyExc_SyntaxError, args); exit: Py_DECREF(loc); - Py_XDECREF(u); - Py_XDECREF(v); + Py_XDECREF(args); return 0; } @@ -5444,7 +5445,7 @@ compiler_slice(struct compiler *c, expr_ty s) // For now, we eschew a full decision tree in favor of a simpler pass that just // tracks the most-recently-checked subclass and length info for the current // subject in the pattern_context struct. Experimentation suggests that the -// current approach keeps most of the runtime benefits while dramatically +// current approach can keep most of the runtime benefits while dramatically // reducing compiler complexity. @@ -5453,16 +5454,6 @@ compiler_slice(struct compiler *c, expr_ty s) _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) -static int -pattern_load_name(struct compiler *c, expr_ty p, pattern_context *pc) -{ - assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Load); - CHECK(compiler_nameop(c, p->v.Name.id, Load)); - return 1; -} - - static int pattern_load_attribute(struct compiler *c, expr_ty p, pattern_context *pc) { @@ -5473,7 +5464,8 @@ pattern_load_attribute(struct compiler *c, expr_ty p, pattern_context *pc) } else { assert(p->v.Attribute.value->kind == Name_kind); - CHECK(pattern_load_name(c, p->v.Attribute.value, pc)); + assert(p->v.Attribute.value->v.Name.ctx == Load); + CHECK(compiler_nameop(c, p->v.Attribute.value->v.Name.id, Load)); } ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); return 1; @@ -5515,18 +5507,8 @@ pattern_store_name(struct compiler *c, expr_ty p, pattern_context *pc) return 0; } if (dupe) { - PyObject *str = PyUnicode_FromFormat( + return compiler_error(c, "multiple assignments to name %R in pattern", p->v.Name.id); - if (!str) { - return 0; - } - const char *s = PyUnicode_AsUTF8(str); - if (!s) { - return 0; - } - compiler_error(c, s); - Py_DECREF(str); - return 0; } } CHECK(!PySet_Add(pc->stores, p->v.Name.id)); @@ -5564,9 +5546,10 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) alt = asdl_seq_GET(p->v.BoolOp.values, i); pc->stores = PySet_New(stores_init); SET_LOC(c, alt); - if (alt->kind == Name_kind && alt->v.Name.ctx == Store && i != size - 1) { - compiler_warn(c, "name capture pattern makes remaining alternate " - "patterns unreachable"); + if (alt->kind == Name_kind && alt->v.Name.ctx == Store && i != size - 1) + { + compiler_warn(c, "name capture pattern %R makes remaining alternate " + "patterns unreachable", alt->v.Name.id); } if (!pc->stores || !compiler_addop(c, DUP_TOP) || @@ -5586,7 +5569,7 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) } if (PySet_GET_SIZE(diff)) { Py_DECREF(diff); - compiler_error(c, "pattern binds different names based on target"); + compiler_error(c, "alternate patterns bind different names"); goto fail; } Py_DECREF(diff); @@ -5625,7 +5608,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { } else { assert(p->v.Call.func->kind == Name_kind); - CHECK(pattern_load_name(c, p->v.Call.func, pc)); + assert(p->v.Call.func->v.Name.ctx == Load); + CHECK(compiler_nameop(c, p->v.Call.func->v.Name.id, Load)); } PyObject *kwnames, *name; CHECK(kwnames = PyTuple_New(nkwargs)); @@ -5690,33 +5674,36 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_COMPARE(c, GtE); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } - Py_ssize_t i; - for (i = 0; i < size - star; i++) { - expr_ty key = asdl_seq_GET(keys, i); - if (!key) { - return compiler_error(c, "can't use starred pattern here; consider moving to end?"); - } - if (key->kind == Attribute_kind) { - CHECK(pattern_load_attribute(c, key, pc)); - } - else { - assert(key->kind == Constant_kind); - CHECK(pattern_load_constant(c, key, pc)); - } - } - ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); - for (i = 0; i < size - star; i++) { - expr_ty value = asdl_seq_GET(values, i); - if (WILDCARD_CHECK(value)) { - continue; + if (size) { + Py_ssize_t i; + for (i = 0; i < size - star; i++) { + expr_ty key = asdl_seq_GET(keys, i); + if (!key) { + return compiler_error(c, + "can't use starred pattern here; consider moving to end?"); + } + if (key->kind == Attribute_kind) { + CHECK(pattern_load_attribute(c, key, pc)); + } + else { + assert(key->kind == Constant_kind); + CHECK(pattern_load_constant(c, key, pc)); + } } - ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_pattern(c, value, pc)); + ADDOP_I(c, BUILD_TUPLE, size - star); + ADDOP_I(c, MATCH_KEYS, star); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + for (i = 0; i < size - star; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; + } + ADDOP_I(c, GET_INDEX, i); + CHECK(compiler_pattern(c, value, pc)); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); + } + ADDOP(c, POP_TOP); } - ADDOP(c, POP_TOP); if (star) { CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1), pc)); } @@ -5824,19 +5811,9 @@ static int compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == NamedExpr_kind); - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); ADDOP(c, DUP_TOP); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); CHECK(pattern_store_name(c, p->v.NamedExpr.target, pc)); - ADDOP_LOAD_CONST(c, Py_True); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, end); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); return 1; } @@ -5884,21 +5861,22 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; - int last, result; + int keep_subject, result; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); - int has_default = WILDCARD_CHECK(m->pattern); + int has_default = WILDCARD_CHECK(m->pattern) && 1 < cases; for (Py_ssize_t i = 0; i < cases - has_default; i++) { - last = i == cases - 1 - has_default; + keep_subject = i < cases - has_default - 1; m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); if (!m->guard && m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store && i != cases - 1) { - CHECK(compiler_warn(c, "unguarded name capture pattern makes " - "remaining cases unreachable")); + CHECK(compiler_warn(c, "unguarded name capture pattern %R makes " + "remaining cases unreachable", + m->pattern->v.Name.id)); } CHECK(next = compiler_new_block(c)); - if (!last) { + if (keep_subject) { ADDOP(c, DUP_TOP); } pc.stores = NULL; @@ -5909,17 +5887,18 @@ compiler_match(struct compiler *c, stmt_ty s) if (m->guard) { CHECK(compiler_jump_if(c, m->guard, next, 0)); } - if (!last) { + if (keep_subject) { ADDOP(c, POP_TOP); } VISIT_SEQ(c, stmt, m->body); - ADDOP_JREL(c, JUMP_FORWARD, end); + if (i != cases - 1) { + ADDOP_JREL(c, JUMP_FORWARD, end); + } compiler_use_next_block(c, next); } if (has_default) { - if (cases == 1) { - ADDOP(c, POP_TOP); - } + // A trailing "case _" is common, and lets us save a bit of redundant + // pushing and popping in the loop above: m = asdl_seq_GET(s->v.Match.cases, cases - 1); if (m->guard) { CHECK(compiler_jump_if(c, m->guard, end, 0)); From 3fd91d9d721f9da8b82e43552fe4e4534cbc0b98 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 20 Jul 2020 08:46:18 -0700 Subject: [PATCH 141/218] More cleanup --- Lib/test/test_patma.py | 92 +++++++++++++++++++++--------------------- Python/compile.c | 40 +++++++++--------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 06af444667d415..33264ed86cbdac 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -27,7 +27,7 @@ def test_patma_000(self): match 0: case 0: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_001(self): match 0: @@ -35,7 +35,7 @@ def test_patma_001(self): x = False case 0 if True: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_002(self): match 0: @@ -43,42 +43,42 @@ def test_patma_002(self): x = True case 0: x = False - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_003(self): x = False match 0: case 0 | 1 | 2 | 3: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_004(self): x = False match 1: case 0 | 1 | 2 | 3: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_005(self): x = False match 2: case 0 | 1 | 2 | 3: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_006(self): x = False match 3: case 0 | 1 | 2 | 3: x = True - self.assertEqual(x, True) + self.assertIs(x, True) def test_patma_007(self): x = False match 4: case 0 | 1 | 2 | 3: x = True - self.assertEqual(x, False) + self.assertIs(x, False) def test_patma_008(self): x = 0 @@ -211,7 +211,7 @@ def test_patma_024(self): case {0: 0}: y = 0 self.assertEqual(x, {}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_025(self): x = {0: 0} @@ -247,7 +247,7 @@ def test_patma_028(self): case {0: (z := 0 | 1 | 2)}: y = 0 self.assertEqual(x, {0: 3}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_029(self): x = {} @@ -260,7 +260,7 @@ def test_patma_029(self): case []: y = 2 self.assertEqual(x, {}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_030(self): x = {False: (True, 2.0, {})} @@ -365,7 +365,7 @@ def test_patma_039(self): case 0 | 1 | 2: y = 0 self.assertEqual(x, 3) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_040(self): x = 0 @@ -392,7 +392,7 @@ def test_patma_042(self): case (z := 0) | (z := 1) | (z := 2) if z == x % 2: y = 0 self.assertEqual(x, 2) - self.assertEqual(y, None) + self.assertIs(y, None) self.assertEqual(z, 2) def test_patma_043(self): @@ -402,7 +402,7 @@ def test_patma_043(self): case (z := 0) | (z := 1) | (z := 2) if z == x % 2: y = 0 self.assertEqual(x, 3) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_044(self): x = () @@ -459,7 +459,7 @@ def test_patma_050(self): case [0, 1] | [1, 0]: y = 0 self.assertEqual(x, [0, 0]) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_051(self): w = None @@ -469,7 +469,7 @@ def test_patma_051(self): y = 0 case [z] | [1, (z := 0 | 1)] | [z]: y = 1 - self.assertEqual(w, None) + self.assertIs(w, None) self.assertEqual(x, [1, 0]) self.assertEqual(y, 1) self.assertEqual(z, 0) @@ -493,7 +493,7 @@ def test_patma_053(self): case [0]: y = 0 self.assertEqual(x, {0}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_054(self): x = set() @@ -502,7 +502,7 @@ def test_patma_054(self): case []: y = 0 self.assertEqual(x, set()) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_055(self): x = iter([1, 2, 3]) @@ -511,7 +511,7 @@ def test_patma_055(self): case []: y = 0 self.assertEqual([*x], [1, 2, 3]) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_056(self): x = {} @@ -520,7 +520,7 @@ def test_patma_056(self): case []: y = 0 self.assertEqual(x, {}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_057(self): x = {0: False, 1: True} @@ -529,7 +529,7 @@ def test_patma_057(self): case [0, 1]: y = 0 self.assertEqual(x, {0: False, 1: True}) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_058(self): x = 0 @@ -554,7 +554,7 @@ def test_patma_060(self): case 1: y = 0 self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_061(self): x = 0 @@ -563,7 +563,7 @@ def test_patma_061(self): case None: y = 0 self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_062(self): x = 0 @@ -584,7 +584,7 @@ def test_patma_063(self): case 1: y = 1 self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_064(self): x = "x" @@ -645,7 +645,7 @@ def test_patma_069(self): case 0 if 0: y = 1 self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_070(self): x = 0 @@ -698,7 +698,7 @@ def test_patma_074(self): case 1: y = 1 self.assertEqual(x, 1) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_075(self): x = "x" @@ -733,7 +733,7 @@ def test_patma_077(self): case 120: y = 1 self.assertEqual(x, b"x") - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_078(self): x = "" @@ -808,7 +808,7 @@ def test_patma_084(self): case (z := 1): y = 0 self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_085(self): x = 0 @@ -818,7 +818,7 @@ def test_patma_085(self): y = 0 self.assertEqual(w, 0) self.assertEqual(x, 0) - self.assertEqual(y, None) + self.assertIs(y, None) self.assertEqual(z, 0) def test_patma_086(self): @@ -862,7 +862,7 @@ def test_patma_090(self): case (0 | 1) | 2: y = 0 self.assertEqual(x, 3) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_091(self): x = 0 @@ -895,7 +895,7 @@ def test_patma_094(self): case 0 | (1 | 2): y = 0 self.assertEqual(x, 3) - self.assertEqual(y, None) + self.assertIs(y, None) def test_patma_095(self): x = 0 @@ -1962,15 +1962,15 @@ def f(color): self.assertEqual(f(Color.RED), "I see red!") self.assertEqual(f(Color.GREEN), "Grass is green") self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(") - self.assertEqual(f(Color), None) - self.assertEqual(f(0), None) - self.assertEqual(f(1), None) - self.assertEqual(f(2), None) - self.assertEqual(f(3), None) - self.assertEqual(f(False), None) - self.assertEqual(f(True), None) - self.assertEqual(f(2+0j), None) - self.assertEqual(f(3.0), None) + self.assertIs(f(Color), None) + self.assertIs(f(0), None) + self.assertIs(f(1), None) + self.assertIs(f(2), None) + self.assertIs(f(3), None) + self.assertIs(f(False), None) + self.assertIs(f(True), None) + self.assertIs(f(2+0j), None) + self.assertIs(f(3.0), None) def test_patma_199(self): class Color(int, enum.Enum): @@ -1988,15 +1988,15 @@ def f(color): self.assertEqual(f(Color.RED), "I see red!") self.assertEqual(f(Color.GREEN), "Grass is green") self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(") - self.assertEqual(f(Color), None) + self.assertIs(f(Color), None) self.assertEqual(f(0), "I see red!") self.assertEqual(f(1), "Grass is green") self.assertEqual(f(2), "I'm feeling the blues :(") - self.assertEqual(f(3), None) + self.assertIs(f(3), None) self.assertEqual(f(False), "I see red!") self.assertEqual(f(True), "Grass is green") self.assertEqual(f(2+0j), "I'm feeling the blues :(") - self.assertEqual(f(3.0), None) + self.assertIs(f(3.0), None) def test_patma_200(self): class Class: @@ -2381,11 +2381,11 @@ def f(x): self.assertEqual(f(2), 2) self.assertIs(f(3), None) - # TODO: PEP tests - # TODO: Don't check side-effecty assignments - # TODO: Full coverage of errors and warnings # TODO: Check numbers, dupes + # TODO: Full coverage of errors and warnings # TODO: Better use of assertIs + # TODO: PEP tests + # TODO: Don't check side-effecty assignments class PerfPatma(TestPatma): diff --git a/Python/compile.c b/Python/compile.c index bd8a283328c943..ce8672f65723ad 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5476,14 +5476,13 @@ static int pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); - assert(PyBytes_CheckExact(p->v.Constant.value) || + assert(PyBool_Check(p->v.Constant.value) || + PyBytes_CheckExact(p->v.Constant.value) || PyComplex_CheckExact(p->v.Constant.value) || PyFloat_CheckExact(p->v.Constant.value) || PyLong_CheckExact(p->v.Constant.value) || PyUnicode_CheckExact(p->v.Constant.value) || - p->v.Constant.value == Py_False || - p->v.Constant.value == Py_None || - p->v.Constant.value == Py_True); + p->v.Constant.value == Py_None); ADDOP_LOAD_CONST(c, p->v.Constant.value); return 1; } @@ -5495,20 +5494,21 @@ pattern_store_name(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (WILDCARD_CHECK(p)) { - return compiler_error(c, - "can't assign to '_' here; consider removing or renaming?"); + const char *e = "can't assign to '_' here; consider removing or " + "renaming?"; + return compiler_error(c, e); } if (!pc->stores) { CHECK(pc->stores = PySet_New(NULL)); } else { - int dupe = PySet_Contains(pc->stores, p->v.Name.id); - if (dupe < 0) { + int duplicate = PySet_Contains(pc->stores, p->v.Name.id); + if (duplicate < 0) { return 0; } - if (dupe) { - return compiler_error(c, - "multiple assignments to name %R in pattern", p->v.Name.id); + if (duplicate) { + const char *e = "multiple assignments to name %R in pattern"; + return compiler_error(c, e, p->v.Name.id); } } CHECK(!PySet_Add(pc->stores, p->v.Name.id)); @@ -5548,8 +5548,11 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) SET_LOC(c, alt); if (alt->kind == Name_kind && alt->v.Name.ctx == Store && i != size - 1) { - compiler_warn(c, "name capture pattern %R makes remaining alternate " - "patterns unreachable", alt->v.Name.id); + const char *w = "name capture pattern %R makes remaining alternate " + "patterns unreachable" + if (compiler_warn(c, w, alt->v.Name.id)) { + goto fail; + } } if (!pc->stores || !compiler_addop(c, DUP_TOP) || @@ -5679,8 +5682,9 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); if (!key) { - return compiler_error(c, - "can't use starred pattern here; consider moving to end?"); + const char *e = "can't use starred pattern here; consider " + "moving to end?"; + return compiler_error(c, e); } if (key->kind == Attribute_kind) { CHECK(pattern_load_attribute(c, key, pc)); @@ -5871,9 +5875,9 @@ compiler_match(struct compiler *c, stmt_ty s) if (!m->guard && m->pattern->kind == Name_kind && m->pattern->v.Name.ctx == Store && i != cases - 1) { - CHECK(compiler_warn(c, "unguarded name capture pattern %R makes " - "remaining cases unreachable", - m->pattern->v.Name.id)); + const char *w = "unguarded name capture pattern %R makes remaining " + "cases unreachable"; + CHECK(compiler_warn(c, w, m->pattern->v.Name.id)); } CHECK(next = compiler_new_block(c)); if (keep_subject) { From 1de2a1c923a7a3056b70301ff067c6425de90924 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sun, 16 Aug 2020 15:36:07 -0700 Subject: [PATCH 142/218] Ditch unhelpful warning and add OPTIM note --- Lib/test/test_patma.py | 10 ++++------ Python/compile.c | 10 ++-------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 33264ed86cbdac..99d1562360e8d3 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2208,15 +2208,13 @@ def f(): self.assertEqual(set(f()), {"abc"}) def test_patma_218(self): - namespace = {} code = """ match ...: - case a | a: + case "a" | a: pass """ - with self.assertWarns(SyntaxWarning): - exec(inspect.cleandoc(code), None, namespace) - self.assertEqual(set(namespace), {"a"}) + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) def test_patma_219(self): code = """ @@ -2224,7 +2222,7 @@ def test_patma_219(self): case a | "a": pass """ - with self.assertWarns(SyntaxWarning), self.assertRaises(SyntaxError): + with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) def test_patma_220(self): diff --git a/Python/compile.c b/Python/compile.c index ce8672f65723ad..0535e84709c8ae 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5546,14 +5546,6 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) alt = asdl_seq_GET(p->v.BoolOp.values, i); pc->stores = PySet_New(stores_init); SET_LOC(c, alt); - if (alt->kind == Name_kind && alt->v.Name.ctx == Store && i != size - 1) - { - const char *w = "name capture pattern %R makes remaining alternate " - "patterns unreachable" - if (compiler_warn(c, w, alt->v.Name.id)) { - goto fail; - } - } if (!pc->stores || !compiler_addop(c, DUP_TOP) || !compiler_pattern(c, alt, pc) || @@ -5816,6 +5808,8 @@ compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == NamedExpr_kind); ADDOP(c, DUP_TOP); + // OPTIM: We store the target *before* matching the inner pattern, to avoid + // complicated cleanup if the inner pattern fails to match. CHECK(pattern_store_name(c, p->v.NamedExpr.target, pc)); CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); return 1; From 7864718292e21da438f9d461ff50fddfec26558a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 17 Aug 2020 08:42:14 -0700 Subject: [PATCH 143/218] Preserve TOS when compiling patterns --- Lib/test/test_patma.py | 2 +- Python/compile.c | 102 ++++++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 99d1562360e8d3..616f6d39db7811 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2421,6 +2421,6 @@ def setUpClass(): """ sudo ./python -m pyperf system tune && \ - ./python -m pyperf timeit -s "from test.test_patma import PerfPatma; p = PerfPatma()" "p.run_perf()"; \ + ./python -m pyperf timeit --rigorous --setup "from test.test_patma import PerfPatma; p = PerfPatma()" "p.run_perf()"; \ sudo ./python -m pyperf system reset """ diff --git a/Python/compile.c b/Python/compile.c index 0535e84709c8ae..27a965863580aa 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5432,10 +5432,11 @@ compiler_slice(struct compiler *c, expr_ty s) // PEP 622: Structural Pattern Matching // To keep things simple, all compiler_pattern_* routines follow the convention -// of replacing TOS (the subject for the given pattern) with either True (match) -// or False (no match). We do this even for irrefutable patterns; the idea is -// that it's much easier to smooth out any redundant pushing, popping, and -// jumping in the peephole optimizer than to detect or predict it here. +// of preserving TOS (the subject for the given pattern) and pushing either True +// (match) or False (no match) on top of it. We do this even for irrefutable +// patterns; the idea is that it's much easier to smooth out any redundant +// pushing, popping, and jumping in the peephole optimizer than to detect or +// predict it here. // Other than that, go nuts. The PEP intentionally gives us broad freedom to // take (reasonable) shortcuts - the AST optimization pass in particular is full @@ -5522,6 +5523,7 @@ compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); + ADDOP(c, DUP_TOP); CHECK(pattern_load_attribute(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; @@ -5547,7 +5549,6 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) pc->stores = PySet_New(stores_init); SET_LOC(c, alt); if (!pc->stores || - !compiler_addop(c, DUP_TOP) || !compiler_pattern(c, alt, pc) || !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end, 1)) { @@ -5575,8 +5576,6 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) pc->stores = control; ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); return 1; fail: Py_XDECREF(stores_init); @@ -5598,6 +5597,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { CHECK(!validate_keywords(c, kwargs)); CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); + ADDOP(c, DUP_TOP); // TODO: Refactor MATCH_CLASS if (p->v.Call.func->kind == Attribute_kind) { CHECK(pattern_load_attribute(c, p->v.Call.func, pc)); } @@ -5630,6 +5630,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { } ADDOP_I(c, GET_INDEX, i); CHECK(compiler_pattern(c, arg, pc)); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } ADDOP_LOAD_CONST(c, Py_True); @@ -5644,6 +5646,7 @@ static int compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); + ADDOP(c, DUP_TOP); CHECK(pattern_load_constant(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; @@ -5660,16 +5663,17 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) asdl_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - // TODO :(i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) + // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) ADDOP(c, MATCH_MAPPING); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); if (size - star) { ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); } if (size) { + ADDOP(c, DUP_TOP); Py_ssize_t i; for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); @@ -5696,15 +5700,17 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_I(c, GET_INDEX, i); CHECK(compiler_pattern(c, value, pc)); + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); } ADDOP(c, POP_TOP); - } - if (star) { - CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1), pc)); - } - else { - ADDOP(c, POP_TOP); + if (star) { + CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1), pc)); + } + else { + ADDOP(c, POP_TOP); + } } ADDOP_LOAD_CONST(c, Py_True); ADDOP_JREL(c, JUMP_FORWARD, end); @@ -5734,27 +5740,32 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) } star = i; } - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); + basicblock *block, *end, *subblock; CHECK(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); ADDOP(c, GET_LEN); + if (!size) { + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); + ADDOP_COMPARE(c, Eq); + compiler_use_next_block(c, end); + return 1; + } + CHECK(subblock = compiler_new_block(c)); + CHECK(block = compiler_new_block(c)); + ADDOP(c, DUP_TOP); if (star < 0) { - ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } - else if (size) { - ADDOP(c, DUP_TOP); + else { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); } + ADDOP_JABS(c, POP_JUMP_IF_FALSE, block); ADDOP(c, ROT_TWO); for (Py_ssize_t i = 0; i < size; i++) { - // TODO :(i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) + // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { continue; @@ -5774,15 +5785,20 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_I(c, GET_INDEX_END, size - 1 - i); } CHECK(compiler_pattern(c, value, pc)); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, block); + ADDOP_JABS(c, POP_JUMP_IF_FALSE, subblock); + ADDOP(c, POP_TOP); } - ADDOP_LOAD_CONST(c, Py_True); - compiler_use_next_block(c, block); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); - compiler_use_next_block(c, end); + ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JREL(c, JUMP_FORWARD, end); + compiler_use_next_block(c, subblock); + ADDOP(c, POP_TOP); ADDOP(c, ROT_TWO); + compiler_use_next_block(c, block); ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); + compiler_use_next_block(c, end); return 1; } @@ -5792,10 +5808,8 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); - if (WILDCARD_CHECK(p)) { - ADDOP(c, POP_TOP); - } - else { + if (!WILDCARD_CHECK(p)) { + ADDOP(c, DUP_TOP); CHECK(pattern_store_name(c, p, pc)); } ADDOP_LOAD_CONST(c, Py_True); @@ -5807,11 +5821,14 @@ static int compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == NamedExpr_kind); + basicblock *end; + CHECK(end = compiler_new_block(c)); + CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); + ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, end); ADDOP(c, DUP_TOP); - // OPTIM: We store the target *before* matching the inner pattern, to avoid - // complicated cleanup if the inner pattern fails to match. CHECK(pattern_store_name(c, p->v.NamedExpr.target, pc)); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); + ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, end); return 1; } @@ -5859,11 +5876,10 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; - int keep_subject, result; + int result; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); int has_default = WILDCARD_CHECK(m->pattern) && 1 < cases; for (Py_ssize_t i = 0; i < cases - has_default; i++) { - keep_subject = i < cases - has_default - 1; m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); if (!m->guard && m->pattern->kind == Name_kind && @@ -5874,9 +5890,6 @@ compiler_match(struct compiler *c, stmt_ty s) CHECK(compiler_warn(c, w, m->pattern->v.Name.id)); } CHECK(next = compiler_new_block(c)); - if (keep_subject) { - ADDOP(c, DUP_TOP); - } pc.stores = NULL; result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); @@ -5885,15 +5898,12 @@ compiler_match(struct compiler *c, stmt_ty s) if (m->guard) { CHECK(compiler_jump_if(c, m->guard, next, 0)); } - if (keep_subject) { - ADDOP(c, POP_TOP); - } + ADDOP(c, POP_TOP); VISIT_SEQ(c, stmt, m->body); - if (i != cases - 1) { - ADDOP_JREL(c, JUMP_FORWARD, end); - } + ADDOP_JREL(c, JUMP_FORWARD, end); compiler_use_next_block(c, next); } + ADDOP(c, POP_TOP); if (has_default) { // A trailing "case _" is common, and lets us save a bit of redundant // pushing and popping in the loop above: From 6fdc00c65f7107b6eb13ef6438a2b665c86647fa Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 17 Aug 2020 22:42:31 -0700 Subject: [PATCH 144/218] Clean up some duplicate tests --- Lib/test/test_patma.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 616f6d39db7811..c97c1a65e07eb9 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -415,7 +415,7 @@ def test_patma_044(self): def test_patma_045(self): x = () match x: - case []: + case (): y = 0 self.assertEqual(x, ()) self.assertEqual(y, 0) @@ -609,12 +609,12 @@ def test_patma_065(self): def test_patma_066(self): x = "x" match x: - case "x": + case "": y = 0 - case "y": + case "x": y = 1 self.assertEqual(x, "x") - self.assertEqual(y, 0) + self.assertEqual(y, 1) def test_patma_067(self): x = b"x" @@ -1052,13 +1052,17 @@ def test_patma_113(self): class A: class B: C = 0 - x = 0 + D = 1 + x = 1 match x: case A.B.C: y = 0 + case A.B.D: + y = 1 self.assertEqual(A.B.C, 0) - self.assertEqual(x, 0) - self.assertEqual(y, 0) + self.assertEqual(A.B.D, 1) + self.assertEqual(x, 1) + self.assertEqual(y, 1) def test_patma_114(self): class A: @@ -1078,13 +1082,17 @@ class A: class B: class C: D = 0 - x = 0 + E = 1 + x = 1 match x: case A.B.C.D: y = 0 + case A.B.C.E: + y = 1 self.assertEqual(A.B.C.D, 0) - self.assertEqual(x, 0) - self.assertEqual(y, 0) + self.assertEqual(A.B.C.E, 1) + self.assertEqual(x, 1) + self.assertEqual(y, 1) def test_patma_116(self): match = case = 0 @@ -1447,7 +1455,7 @@ def test_patma_155(self): x = 0 y = None match x: - case 1: + case 1e1000: y = 0 self.assertEqual(x, 0) self.assertIs(y, None) @@ -1473,12 +1481,12 @@ def test_patma_157(self): def test_patma_158(self): x = 0 match x: - case 0: + case -1e1000: y = 0 case 0: y = 1 self.assertEqual(x, 0) - self.assertEqual(y, 0) + self.assertEqual(y, 1) def test_patma_159(self): x = 0 @@ -2379,10 +2387,8 @@ def f(x): self.assertEqual(f(2), 2) self.assertIs(f(3), None) - # TODO: Check numbers, dupes # TODO: Full coverage of errors and warnings # TODO: Better use of assertIs - # TODO: PEP tests # TODO: Don't check side-effecty assignments From ee2beb22a65751275b84bb711155732b1c2ff61c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 18 Aug 2020 20:32:08 -0700 Subject: [PATCH 145/218] Improve test coverage for errors and warnings --- Lib/test/test_patma.py | 176 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 175 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index c97c1a65e07eb9..990e0400169806 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2387,7 +2387,181 @@ def f(x): self.assertEqual(f(2), 2) self.assertIs(f(3), None) - # TODO: Full coverage of errors and warnings + def test_patma_236(self): + code = """ + match ...: + case {**rest, "key": value}: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_237(self): + code = """ + match ...: + case {"first": first, **rest, "last": last}: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_238(self): + code = """ + match ...: + case *a, b, *c, d, *e: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_239(self): + code = """ + match ...: + case a, *b, c, *d, e: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_240(self): + code = """ + match ...: + case 0+0: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_241(self): + code = """ + match ...: + case f"": + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_242(self): + code = """ + match ...: + case f"{x}": + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_243(self): + namespace = {} + code = """ + match 42: + case x: + pass + case y: + pass + """ + with self.assertWarns(SyntaxWarning): + exec(inspect.cleandoc(code), None, namespace) + self.assertEqual(namespace, {"x": 42}) + + def test_patma_244(self): + code = """ + match ...: + case {**_}: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_245(self): + code = """ + match ...: + case _ := 42: + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_246(self): + class Class: + __match_args__ = None + x = Class() + y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y): + z = 0 + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_247(self): + class Class: + __match_args__ = "XYZ" + x = Class() + y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y): + z = 0 + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_248(self): + class Class: + __match_args__ = [None] + x = Class() + y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y): + z = 0 + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_249(self): + class Class: + __match_args__ = [] + x = Class() + y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y): + z = 0 + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_250(self): + code = """ + match ...: + case Class(a=_, a=_): + pass + """ + with self.assertRaises(SyntaxError): + exec(inspect.cleandoc(code)) + + def test_patma_251(self): + x = {"a": 0, "b": 1} + w = y = z = None + with self.assertRaises(ValueError): + match x: + case {"a": y, "a": z}: + w = 0 + self.assertIs(w, None) + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_252(self): + class Keys: + KEY = "a" + x = {"a": 0, "b": 1} + w = y = z = None + with self.assertRaises(ValueError): + match x: + case {Keys.KEY: y, "a": z}: + w = 0 + self.assertIs(w, None) + self.assertIs(y, None) + self.assertIs(z, None) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments From b4b841677c4cb4f90ed528d2a7364da384e98e44 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 18 Aug 2020 20:36:12 -0700 Subject: [PATCH 146/218] Add more tests for runtime errors --- Lib/test/test_patma.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 990e0400169806..d3b2da34b80eb0 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2562,6 +2562,34 @@ class Keys: self.assertIs(y, None) self.assertIs(z, None) + def test_patma_253(self): + class Class: + __match_args__ = ["a", "a"] + a = None + x = Class() + w = y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y, z): + w = 0 + self.assertIs(w, None) + self.assertIs(y, None) + self.assertIs(z, None) + + def test_patma_254(self): + class Class: + __match_args__ = ["a"] + a = None + x = Class() + w = y = z = None + with self.assertRaises(TypeError): + match x: + case Class(y, a=z): + w = 0 + self.assertIs(w, None) + self.assertIs(y, None) + self.assertIs(z, None) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments From f819084b89469e24fd9bcdc7b07f855db4f1f273 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 18 Aug 2020 20:36:38 -0700 Subject: [PATCH 147/218] Clean up comments --- Python/compile.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 27a965863580aa..e5ccfc34882c91 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5443,12 +5443,6 @@ compiler_slice(struct compiler *c, expr_ty s) // of low-hanging fruit. Please *always* document these with a comment of the // form "OPTIM: ...", so we can track exactly when and where they're happening. -// For now, we eschew a full decision tree in favor of a simpler pass that just -// tracks the most-recently-checked subclass and length info for the current -// subject in the pattern_context struct. Experimentation suggests that the -// current approach can keep most of the runtime benefits while dramatically -// reducing compiler complexity. - #define WILDCARD_CHECK(N) \ ((N)->kind == Name_kind && \ @@ -5597,7 +5591,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { CHECK(!validate_keywords(c, kwargs)); CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, DUP_TOP); // TODO: Refactor MATCH_CLASS + ADDOP(c, DUP_TOP); // TODO: Refactor MATCH_CLASS? if (p->v.Call.func->kind == Attribute_kind) { CHECK(pattern_load_attribute(c, p->v.Call.func, pc)); } From 6228a57fdc6172f02af8f80e3e671c2d67da965f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 18 Aug 2020 21:07:06 -0700 Subject: [PATCH 148/218] Fix bugs in peephole optimizer changes --- Python/peephole.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Python/peephole.c b/Python/peephole.c index 2e5c0436d5385d..e87a2951e4f787 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -306,9 +306,10 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, switch (opcode) { // Simplify LOAD_CONST followed by conditional jumping/popping: case LOAD_CONST: - cumlc = lastlc + 1; // TODO? if (!(JUMPS_ON_FALSE(nextop) || JUMPS_ON_TRUE(nextop)) || - !ISBASICBLOCK(blocks, op_start, i + 1)) { + !ISBASICBLOCK(blocks, op_start, nexti)) + { + cumlc = lastlc + 1; break; } PyObject* cnt = PyList_GET_ITEM(consts, get_arg(codestr, i)); @@ -326,7 +327,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, // Remove DUP_TOP + POP_TOP: case DUP_TOP: - if (nextop == POP_TOP) { + if (nextop == POP_TOP && ISBASICBLOCK(blocks, op_start, nexti)) + { fill_nops(codestr, op_start, nexti + 1); } break; From 92f6c53e706beedb73a3cec8a187763f6c6236c8 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 19 Aug 2020 19:19:58 -0700 Subject: [PATCH 149/218] Disable unfinished validation --- Python/ast.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 7a71fd6317591d..9c3ec54f01cf6c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -390,12 +390,12 @@ validate_pattern(expr_ty p) if (i != size - 1) { // TODO } - if (key->kind != Name_kind) { - // TODO - } - if (key->v.Name.ctx != Store) { - // TODO - } + // if (key->kind != Name_kind) { + // // TODO + // } + // if (key->v.Name.ctx != Store) { + // // TODO + // } } if (!validate_pattern(asdl_seq_GET(values, i))) { return 0; From 466becdf1400f36bd0621cb74551a396e9932e11 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 19 Aug 2020 22:20:48 -0700 Subject: [PATCH 150/218] Skip performance benchmarking for some tests --- Lib/test/test_patma.py | 49 +++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index d3b2da34b80eb0..fcd98d1e6b13ee 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -8,6 +8,11 @@ import warnings +def no_perf(f): + f.no_perf = None + return f + + @dataclasses.dataclass class MyClass: x: int @@ -1691,6 +1696,7 @@ def http_error(status): self.assertIs(http_error("400"), None) self.assertIs(http_error(401 | 403 | 404), None) # 407 + @no_perf def test_patma_176(self): def whereis(point): match point: @@ -2215,6 +2221,7 @@ def f(): return locals() self.assertEqual(set(f()), {"abc"}) + @no_perf def test_patma_218(self): code = """ match ...: @@ -2224,6 +2231,7 @@ def test_patma_218(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_219(self): code = """ match ...: @@ -2240,6 +2248,7 @@ def f(): return locals() self.assertEqual(set(f()), {"a", "b"}) + @no_perf def test_patma_221(self): code = """ match ...: @@ -2256,6 +2265,7 @@ def f(): return locals() self.assertEqual(set(f()), {"a", "b"}) + @no_perf def test_patma_223(self): code = """ match ...: @@ -2272,6 +2282,7 @@ def f(): return locals() self.assertEqual(set(f()), {"x", "y"}) + @no_perf def test_patma_225(self): code = """ match ...: @@ -2281,6 +2292,7 @@ def test_patma_225(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_226(self): code = """ match ...: @@ -2290,6 +2302,7 @@ def test_patma_226(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_227(self): code = """ match ...: @@ -2306,6 +2319,7 @@ def f(): return locals() self.assertEqual(set(f()), {"a", "b"}) + @no_perf def test_patma_229(self): code = """ match ...: @@ -2387,6 +2401,7 @@ def f(x): self.assertEqual(f(2), 2) self.assertIs(f(3), None) + @no_perf def test_patma_236(self): code = """ match ...: @@ -2396,6 +2411,7 @@ def test_patma_236(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_237(self): code = """ match ...: @@ -2405,6 +2421,7 @@ def test_patma_237(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_238(self): code = """ match ...: @@ -2414,6 +2431,7 @@ def test_patma_238(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_239(self): code = """ match ...: @@ -2423,6 +2441,7 @@ def test_patma_239(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_240(self): code = """ match ...: @@ -2432,6 +2451,7 @@ def test_patma_240(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_241(self): code = """ match ...: @@ -2441,6 +2461,7 @@ def test_patma_241(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_242(self): code = """ match ...: @@ -2450,6 +2471,7 @@ def test_patma_242(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_243(self): namespace = {} code = """ @@ -2463,6 +2485,7 @@ def test_patma_243(self): exec(inspect.cleandoc(code), None, namespace) self.assertEqual(namespace, {"x": 42}) + @no_perf def test_patma_244(self): code = """ match ...: @@ -2472,6 +2495,7 @@ def test_patma_244(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_245(self): code = """ match ...: @@ -2481,6 +2505,7 @@ def test_patma_245(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_246(self): class Class: __match_args__ = None @@ -2493,6 +2518,7 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_247(self): class Class: __match_args__ = "XYZ" @@ -2505,6 +2531,7 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_248(self): class Class: __match_args__ = [None] @@ -2517,6 +2544,7 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_249(self): class Class: __match_args__ = [] @@ -2529,6 +2557,7 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_250(self): code = """ match ...: @@ -2538,6 +2567,7 @@ def test_patma_250(self): with self.assertRaises(SyntaxError): exec(inspect.cleandoc(code)) + @no_perf def test_patma_251(self): x = {"a": 0, "b": 1} w = y = z = None @@ -2549,6 +2579,7 @@ def test_patma_251(self): self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_252(self): class Keys: KEY = "a" @@ -2562,6 +2593,7 @@ class Keys: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_253(self): class Class: __match_args__ = ["a", "a"] @@ -2576,6 +2608,7 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + @no_perf def test_patma_254(self): class Class: __match_args__ = ["a"] @@ -2602,22 +2635,18 @@ def assertEqual(*_, **__): def assertIs(*_, **__): pass - @contextlib.contextmanager def assertRaises(*_, **__): - try: - yield - except: - pass + assert False, "this test should be decorated with @no_perf!" - @contextlib.contextmanager def assertWarns(*_, **__): - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - yield + assert False, "this test should be decorated with @no_perf!" def run_perf(self): attrs = vars(TestPatma).items() - tests = [attr for name, attr in attrs if name.startswith("test_")] + tests = [ + attr for name, attr in attrs + if name.startswith("test_") and not hasattr(attr, "no_perf") + ] for _ in range(1 << 8): for test in tests: test(self) From a8d0a86ed24a8354cbddc64d243a8a834472bb7c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 19 Aug 2020 22:21:43 -0700 Subject: [PATCH 151/218] Fix typo --- Python/ast_opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index f26bec062fb0e9..b3125781ee8d0d 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -778,7 +778,7 @@ astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state PyLong_CheckExact(left->v.Constant.value)) || !PyComplex_CheckExact(right->v.Constant.value)) { - // Not actually valid, but it's the complier's job to complain: + // Not actually valid, but it's the compiler's job to complain: return 1; } PyObject *new; @@ -810,7 +810,7 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case Call_kind: case Constant_kind: case Dict_kind: - // Not actually valid, but it's the complier's job to complain: + // Not actually valid, but it's the compiler's job to complain: case JoinedStr_kind: case List_kind: case Name_kind: From 66d614b6dcf3c690ef34b3f069637c2835cb0d3c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 22 Aug 2020 17:46:59 -0700 Subject: [PATCH 152/218] Unify shared SyntaxError test logic --- Lib/test/test_patma.py | 112 +++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 72 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index fcd98d1e6b13ee..485fa6d8d3ef3a 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -28,6 +28,10 @@ class Point: class TestPatma(unittest.TestCase): + def assert_syntax_error(self, code: str): + with self.assertRaises(SyntaxError): + compile(inspect.cleandoc(code), "", "exec") + def test_patma_000(self): match 0: case 0: @@ -2223,23 +2227,19 @@ def f(): @no_perf def test_patma_218(self): - code = """ + self.assert_syntax_error(""" match ...: case "a" | a: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_219(self): - code = """ + self.assert_syntax_error(""" match ...: case a | "a": pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) def test_patma_220(self): def f(): @@ -2250,13 +2250,11 @@ def f(): @no_perf def test_patma_221(self): - code = """ + self.assert_syntax_error(""" match ...: case a, a: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) def test_patma_222(self): def f(): @@ -2267,13 +2265,11 @@ def f(): @no_perf def test_patma_223(self): - code = """ + self.assert_syntax_error(""" match ...: case {"k": a, "l": a}: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) def test_patma_224(self): def f(): @@ -2284,33 +2280,27 @@ def f(): @no_perf def test_patma_225(self): - code = """ + self.assert_syntax_error(""" match ...: case MyClass(x, x): pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_226(self): - code = """ + self.assert_syntax_error(""" match ...: case MyClass(x=x, y=x): pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_227(self): - code = """ + self.assert_syntax_error(""" match ...: case MyClass(x, y=x): pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) def test_patma_228(self): def f(): @@ -2321,13 +2311,11 @@ def f(): @no_perf def test_patma_229(self): - code = """ + self.assert_syntax_error(""" match ...: case a := a: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) def test_patma_230(self): def f(x): @@ -2403,73 +2391,59 @@ def f(x): @no_perf def test_patma_236(self): - code = """ + self.assert_syntax_error(""" match ...: case {**rest, "key": value}: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_237(self): - code = """ + self.assert_syntax_error(""" match ...: case {"first": first, **rest, "last": last}: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_238(self): - code = """ + self.assert_syntax_error(""" match ...: case *a, b, *c, d, *e: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_239(self): - code = """ + self.assert_syntax_error(""" match ...: case a, *b, c, *d, e: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_240(self): - code = """ + self.assert_syntax_error(""" match ...: case 0+0: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_241(self): - code = """ + self.assert_syntax_error(""" match ...: case f"": pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_242(self): - code = """ + self.assert_syntax_error(""" match ...: case f"{x}": pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_243(self): @@ -2487,23 +2461,19 @@ def test_patma_243(self): @no_perf def test_patma_244(self): - code = """ + self.assert_syntax_error(""" match ...: case {**_}: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_245(self): - code = """ + self.assert_syntax_error(""" match ...: case _ := 42: pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_246(self): @@ -2559,13 +2529,11 @@ class Class: @no_perf def test_patma_250(self): - code = """ + self.assert_syntax_error(""" match ...: case Class(a=_, a=_): pass - """ - with self.assertRaises(SyntaxError): - exec(inspect.cleandoc(code)) + """) @no_perf def test_patma_251(self): From 3f7640379a334c0b72ed0a3b7bed85981c0ed128 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 22 Aug 2020 17:47:22 -0700 Subject: [PATCH 153/218] Add two more tests for soft keywords --- Lib/test/test_patma.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 485fa6d8d3ef3a..8a5202a492b065 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2591,6 +2591,20 @@ class Class: self.assertIs(y, None) self.assertIs(z, None) + def test_patma_255(self): + match(): + case(): + x = 0 + self.assertEqual(x, 0) + + def test_patma_256(self): + x = 0 + match(x): + case(x): + y = 0 + self.assertEqual(x, 0) + self.assertEqual(y, 0) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments From a527f666be25656b07cb0b4a0522c4d7aa8b47d9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 22 Aug 2020 17:47:41 -0700 Subject: [PATCH 154/218] Refactor MATCH_CLASS --- Python/ceval.c | 11 +++++------ Python/compile.c | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 57a44f772fd2a2..29af149f4d9d0d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3543,20 +3543,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_CLASS): { - PyObject *names = POP(); - PyObject *type = TOP(); - PyObject *subject = SECOND(); + PyObject *names = TOP(); + PyObject *type = SECOND(); + PyObject *subject = THIRD(); PyObject *attrs = do_match(tstate, oparg, names, type, subject); - Py_DECREF(names); if (attrs) { - Py_DECREF(subject); + Py_DECREF(type); SET_SECOND(attrs); } else if (_PyErr_Occurred(tstate)) { goto error; } + Py_DECREF(names); SET_TOP(PyBool_FromLong(!!attrs)); - Py_DECREF(type); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index 257ae920b1d744..2a524bdc787fce 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1135,7 +1135,7 @@ stack_effect(int opcode, int oparg, int jump) case GET_LEN: return 1; case MATCH_CLASS: - return -1; + return 0; case GET_INDEX: case GET_INDEX_END: case GET_INDEX_SLICE: @@ -5613,7 +5613,6 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { CHECK(!validate_keywords(c, kwargs)); CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - ADDOP(c, DUP_TOP); // TODO: Refactor MATCH_CLASS? if (p->v.Call.func->kind == Attribute_kind) { CHECK(pattern_load_attribute(c, p->v.Call.func, pc)); } @@ -5633,6 +5632,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP_LOAD_CONST_NEW(c, kwnames); ADDOP_I(c, MATCH_CLASS, nargs); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); expr_ty arg; for (i = 0; i < nargs + nkwargs; i++) { if (i < nargs) { From 19af7d547e094006bfdc40a358385ad49503c597 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 15 Sep 2020 20:46:54 -0700 Subject: [PATCH 155/218] Literal False/True/None compares by identity --- Lib/test/test_patma.py | 35 ++++++++++++++++++++++++++++++++++- Python/compile.c | 8 +++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 8a5202a492b065..90a855aff4ec1f 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -550,11 +550,12 @@ def test_patma_058(self): def test_patma_059(self): x = 0 + y = None match x: case False: y = 0 self.assertEqual(x, 0) - self.assertEqual(y, 0) + self.assertEqual(y, None) def test_patma_060(self): x = 0 @@ -2605,6 +2606,38 @@ def test_patma_256(self): self.assertEqual(x, 0) self.assertEqual(y, 0) + def test_patma_257(self): + x = 0 + match x: + case False: + y = 1 + case 0: + y = 2 + self.assertEqual(x, 0) + self.assertEqual(y, 2) + + def test_patma_258(self): + x = 1 + match x: + case True: + y = 1 + case 1: + y = 2 + self.assertEqual(x, 1) + self.assertEqual(y, 2) + + def test_patma_259(self): + class Eq: + def __eq__(self, other): + return True + x = eq = Eq() + y = None + match x: + case None: + y = 1 + self.assertIs(x, eq) + self.assertEqual(y, None) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments diff --git a/Python/compile.c b/Python/compile.c index 2a524bdc787fce..487796568d6614 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5665,7 +5665,13 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Constant_kind); ADDOP(c, DUP_TOP); CHECK(pattern_load_constant(c, p, pc)); - ADDOP_COMPARE(c, Eq); + PyObject *v = p->v.Constant.value; + if (v == Py_None || PyBool_Check(v)) { + ADDOP_COMPARE(c, Is); + } + else { + ADDOP_COMPARE(c, Eq); + } return 1; } From 601645b76a3443b60c6af97164158c62fa114610 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 15 Sep 2020 20:51:47 -0700 Subject: [PATCH 156/218] Remove sealed --- Lib/test/test_typing.py | 12 ------------ Lib/typing.py | 37 ------------------------------------- 2 files changed, 49 deletions(-) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 2c91734e4952bb..b3be99141afca9 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -23,7 +23,6 @@ from typing import IO, TextIO, BinaryIO from typing import Pattern, Match from typing import Annotated, ForwardRef -from typing import sealed import abc import typing import weakref @@ -2301,17 +2300,6 @@ def test_final_unmodified(self): def func(x): ... self.assertIs(func, final(func)) - def test_sealed_unmodified(self): - class C: ... - self.assertIs(C, sealed(C)) - - def test_sealed_type(self): - def f(): ... - with self.assertRaises(TypeError): - sealed(f) - with self.assertRaises(TypeError): - sealed(42) - class CastTests(BaseTestCase): diff --git a/Lib/typing.py b/Lib/typing.py index 407c0c478b74ff..2899a0213d4340 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -109,7 +109,6 @@ 'NoReturn', 'overload', 'runtime_checkable', - 'sealed', 'Text', 'TYPE_CHECKING', ] @@ -1561,42 +1560,6 @@ class Other(Leaf): # Error reported by type checker return f -def sealed(cls): - """A decorator to indicate sealed classes. - - Use this decorator to indicate to type checkers that all subclasses of this - class must be defined in the current module. The type checker can then treat - the sealed base class as a union of all its known subclasses, allowing for - static exhaustiveness checks. For example: - - @sealed - class Parent: - ... - - class Child(Parent): - ... - - class X(Child): - ... - - class Y(Child): - ... - - class Z(Parent): - ... - - With this definition: - - - Child can be treated as Union[X, Y] - - Parent can be treated as Union[X, Y, Z] - - There is no runtime-checking of this property. - """ - if not isinstance(cls, type): - raise TypeError("only classes can be @sealed") - return cls - - # Some unconstrained type variables. These are used by the container types. # (These are not for export.) T = TypeVar('T') # Any type. From eed68066c22cdf5fbc7f593754ed03f435559f19 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 15 Sep 2020 20:51:59 -0700 Subject: [PATCH 157/218] Revert whitespace change --- Python/compile.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Python/compile.c b/Python/compile.c index 487796568d6614..a6b51cd1f10f44 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2768,7 +2768,6 @@ compiler_if(struct compiler *c, stmt_ty s) return 1; } - static int compiler_for(struct compiler *c, stmt_ty s) { From 3c4796c7bcecde12c5d38d3851c37aef1e8f4555 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 15 Sep 2020 21:14:53 -0700 Subject: [PATCH 158/218] Assorted cleanup --- Lib/ast.py | 2 +- Lib/test/test_collections.py | 2 +- Lib/test/test_dataclasses.py | 19 ++++++++----------- Python/symtable.c | 1 - 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index 76751f2b7bec59..e3383f8c99b751 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1520,7 +1520,7 @@ def visit_match_case(self, node): if node.guard: self.write(" if ") self.traverse(node.guard) - with self.block(): + with self.block(): self.traverse(node.body) def unparse(ast_obj): diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index a1fc42ae1e8f53..807fbb9f3c0efd 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -667,7 +667,7 @@ class NewPoint(tuple): def test_match_args(self): Point = namedtuple('Point', 'x y') - self.assertEqual(Point.__match_args__, ('x', 'y')) # matches a real tuple + self.assertEqual(Point.__match_args__, ('x', 'y')) ################################################################################ diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index 81c3ec1e37814b..b36dfe88004630 100644 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -3335,20 +3335,17 @@ class C: class TestMatchArgs(unittest.TestCase): def test_match_args(self): @dataclass - class B: - x: int - - o = B(4) - self.assertEqual(o.__match_args__, ('x',)) + class C: + a: int + self.assertEqual(C(42).__match_args__, ('a',)) def test_explicit_match_args(self): + ma = [] @dataclass - class B: - x: int - __match_args__ = [] - - o = B(4) - self.assertEqual(o.__match_args__, []) + class C: + a: int + __match_args__ = ma + self.assertIs(C(42).__match_args__, ma) if __name__ == '__main__': unittest.main() diff --git a/Python/symtable.c b/Python/symtable.c index 83f744301257ee..223554ea22c17f 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1787,7 +1787,6 @@ symtable_visit_withitem(struct symtable *st, withitem_ty item) return 1; } - static int symtable_visit_match_case(struct symtable *st, match_case_ty m) { From 45b14293d1ee826690947bfaeee8a0fe85115ce0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 15 Sep 2020 22:49:43 -0700 Subject: [PATCH 159/218] Add three more identity tests --- Lib/test/test_patma.py | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 90a855aff4ec1f..6530439784d727 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2610,21 +2610,21 @@ def test_patma_257(self): x = 0 match x: case False: - y = 1 + y = 0 case 0: - y = 2 + y = 1 self.assertEqual(x, 0) - self.assertEqual(y, 2) + self.assertEqual(y, 1) def test_patma_258(self): x = 1 match x: case True: - y = 1 + y = 0 case 1: - y = 2 + y = 1 self.assertEqual(x, 1) - self.assertEqual(y, 2) + self.assertEqual(y, 1) def test_patma_259(self): class Eq: @@ -2634,10 +2634,34 @@ def __eq__(self, other): y = None match x: case None: - y = 1 + y = 0 self.assertIs(x, eq) self.assertEqual(y, None) + def test_patma_260(self): + x = False + match x: + case False: + y = 0 + self.assertIs(x, False) + self.assertEqual(y, 0) + + def test_patma_261(self): + x = True + match x: + case True: + y = 0 + self.assertIs(x, True) + self.assertEqual(y, 0) + + def test_patma_262(self): + x = None + match x: + case None: + y = 0 + self.assertIs(x, None) + self.assertEqual(y, 0) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments From 5505fc337bd4f5a5ee867f5fb4d0b574bf13ab7f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 24 Sep 2020 23:37:16 -0700 Subject: [PATCH 160/218] Fixes for grammar changes --- Grammar/python.gram | 10 +++++----- Parser/parser.c | 24 ++++++++++++------------ Python/ast.c | 2 +- Python/ast_opt.c | 4 ++-- Python/compile.c | 10 +++++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index e90431bf825f3d..60c50d3e746caf 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -202,7 +202,7 @@ match_expr[expr_ty]: | named_expression match_stmt[stmt_ty]: - | "match" subject=match_expr ':' NEWLINE INDENT cases=case_block+ DEDENT { + | "match" subject=match_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT { _Py_Match(subject, cases, EXTRA) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { @@ -221,7 +221,7 @@ pattern[expr_ty]: | or_pattern or_pattern[expr_ty]: - | values='|'.closed_pattern+ { + | values[asdl_expr_seq*]='|'.closed_pattern+ { asdl_seq_LEN(values) == 1 ? asdl_seq_GET(values, 0) : _Py_BoolOp(Or, values, EXTRA) } closed_pattern[expr_ty]: @@ -255,11 +255,11 @@ mapping_pattern[expr_ty]: _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } class_pattern[expr_ty]: | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ ','? ')' { + | func=name_or_attr '(' args[asdl_expr_seq*]=','.pattern+ ','? ')' { _Py_Call(func, args, NULL, EXTRA) } - | func=name_or_attr '(' keywords=','.keyword_pattern+ ','? ')' { + | func=name_or_attr '(' keywords[asdl_keyword_seq*]=','.keyword_pattern+ ','? ')' { _Py_Call(func, NULL, keywords, EXTRA) } - | func=name_or_attr '(' args=','.pattern+ ',' keywords=','.keyword_pattern+ ','? ')' { + | func=name_or_attr '(' args[asdl_expr_seq*]=','.pattern+ ',' keywords[asdl_keyword_seq*]=','.keyword_pattern+ ','? ')' { _Py_Call(func, args, keywords, EXTRA) } | func=name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' error=pattern [',' ','.error_argument_pattern+] ','? ')' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "positional pattern follows keyword pattern") } diff --git a/Parser/parser.c b/Parser/parser.c index 911175678c9e05..57f95658a7d1cb 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -4909,7 +4909,7 @@ match_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); expr_ty _keyword; Token * _literal; - asdl_seq * cases; + asdl_match_case_seq* cases; Token * dedent_var; Token * indent_var; Token * newline_var; @@ -4925,7 +4925,7 @@ match_stmt_rule(Parser *p) && (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' && - (cases = _loop1_50_rule(p)) // case_block+ + (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ && (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) @@ -5249,9 +5249,9 @@ or_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); - asdl_seq * values; + asdl_expr_seq* values; if ( - (values = _gather_51_rule(p)) // '|'.closed_pattern+ + (values = (asdl_expr_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ ) { D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); @@ -6063,14 +6063,14 @@ class_pattern_rule(Parser *p) Token * _literal_1; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * args; + asdl_expr_seq* args; expr_ty func; if ( (func = name_or_attr_rule(p)) // name_or_attr && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_56_rule(p)) // ','.pattern+ + (args = (asdl_expr_seq*)_gather_56_rule(p)) // ','.pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6110,13 +6110,13 @@ class_pattern_rule(Parser *p) void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty func; - asdl_seq * keywords; + asdl_keyword_seq* keywords; if ( (func = name_or_attr_rule(p)) // name_or_attr && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (keywords = _gather_58_rule(p)) // ','.keyword_pattern+ + (keywords = (asdl_keyword_seq*)_gather_58_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -6156,19 +6156,19 @@ class_pattern_rule(Parser *p) Token * _literal_2; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * args; + asdl_expr_seq* args; expr_ty func; - asdl_seq * keywords; + asdl_keyword_seq* keywords; if ( (func = name_or_attr_rule(p)) // name_or_attr && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = _gather_60_rule(p)) // ','.pattern+ + (args = (asdl_expr_seq*)_gather_60_rule(p)) // ','.pattern+ && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (keywords = _gather_62_rule(p)) // ','.keyword_pattern+ + (keywords = (asdl_keyword_seq*)_gather_62_rule(p)) // ','.keyword_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? && diff --git a/Python/ast.c b/Python/ast.c index 6a40d4f836e210..3d1d5b7dc7f00c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -326,7 +326,7 @@ validate_expr(expr_ty exp, expr_context_ty ctx) static int validate_pattern(expr_ty p) { - asdl_seq *keys, *values; + asdl_expr_seq *keys, *values; expr_ty key, value; Py_ssize_t i, size; switch (p->kind) { diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 9bd7893c0ecdf8..d79ef4c80ffb43 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -714,7 +714,7 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) break; case Match_kind: CALL(astfold_expr, expr_ty, node_->v.Match.subject); - CALL_SEQ(astfold_match_case, match_case_ty, node_->v.Match.cases); + CALL_SEQ(astfold_match_case, match_case, node_->v.Match.cases); break; default: break; @@ -831,7 +831,7 @@ astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat { CALL(astfold_pattern, expr_ty, node_->pattern); CALL_OPT(astfold_expr, expr_ty, node_->guard); - CALL_SEQ(astfold_stmt, stmt_ty, node_->body); + CALL_SEQ(astfold_stmt, stmt, node_->body); return 1; } diff --git a/Python/compile.c b/Python/compile.c index b6206e6377c7ed..c6333494f7c10c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5598,8 +5598,8 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) static int compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { - asdl_seq *args = p->v.Call.args; - asdl_seq *kwargs = p->v.Call.keywords; + asdl_expr_seq *args = p->v.Call.args; + asdl_keyword_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); if (nargs + nkwargs > INT_MAX) { @@ -5678,8 +5678,8 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) basicblock *block, *end; CHECK(block = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); - asdl_seq *keys = p->v.Dict.keys; - asdl_seq *values = p->v.Dict.values; + asdl_expr_seq *keys = p->v.Dict.keys; + asdl_expr_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) @@ -5750,7 +5750,7 @@ static int compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); - asdl_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + asdl_expr_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; for (Py_ssize_t i = 0; i < size; i++) { From 587ba871896b44af3ee8471d7a6bf9bf668579ac Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 10:11:36 -0700 Subject: [PATCH 161/218] Use sets to track map keys and attribute names. --- Python/ceval.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 0df1ec3d6e27cd..686de3db92c0b2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -860,7 +860,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) goto fail; } } - seen = PyList_New(0); + seen = PySet_New(NULL); if (!seen) { goto fail; } @@ -871,7 +871,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) PyObject *key, *value; for (Py_ssize_t i = 0; i < nkeys; i++) { key = PyTuple_GET_ITEM(keys, i); - if (PySequence_Contains(seen, key) || PyList_Append(seen, key)) { + if (PySet_Contains(seen, key) || PySet_Add(seen, key)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_ValueError, "mapping pattern checks duplicate key (%R)", key); @@ -1024,7 +1024,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty if (!attrs) { goto error; } - seen = PyList_New(0); + seen = PySet_New(NULL); if (!seen) { goto error; } @@ -1048,7 +1048,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty else { name = PyTuple_GET_ITEM(kwargs, i - nargs); } - if (PySequence_Contains(seen, name) || PyList_Append(seen, name)) { + if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_TypeError, "%s() got multiple sub-patterns for attribute %R", From a1e88fe3c2eb2e99ab08f2293b2f53b2075e8283 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 10:13:24 -0700 Subject: [PATCH 162/218] Add a few notes. --- Python/ast.c | 8 ++++---- Python/ceval.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 3d1d5b7dc7f00c..dc76e5f4726008 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -331,7 +331,7 @@ validate_pattern(expr_ty p) Py_ssize_t i, size; switch (p->kind) { case Attribute_kind: - return validate_expr(p, Load); + return validate_expr(p, Load); // TODO case BinOp_kind: // TODO return 1; @@ -358,7 +358,7 @@ validate_pattern(expr_ty p) // TODO return 1; case Constant_kind: - return validate_expr(p, Load); + return validate_expr(p, Load); // TODO case Dict_kind: keys = p->v.Dict.keys; values = p->v.Dict.values; @@ -431,10 +431,10 @@ validate_pattern(expr_ty p) "Name ctx in pattern must be Load or Store"); return 0; } - return validate_expr(p, p->v.Name.ctx); + return validate_expr(p, p->v.Name.ctx); // TODO case NamedExpr_kind: return (validate_pattern(p->v.NamedExpr.value) - && validate_expr(p->v.NamedExpr.target, Store)); + && validate_expr(p->v.NamedExpr.target, Store)); // TODO case UnaryOp_kind: // TODO return 1; diff --git a/Python/ceval.c b/Python/ceval.c index 686de3db92c0b2..a0e29e5a4cae00 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -984,7 +984,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); Py_ssize_t count = nargs + nkwargs; Py_ssize_t nmatch_args; - // TODO: Just build attrs in two passes (nargs and nkwargs) + // TODO: Just build attrs in two passes (nargs and nkwargs)? if (!nargs) { nmatch_args = 0; args = PyTuple_New(0); From 91661eb08ae100bdadf9f6c5ae74d4804c93f824 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 11:54:03 -0700 Subject: [PATCH 163/218] "n := p" -> "p as n" --- Grammar/python.gram | 2 +- Lib/ast.py | 15 ++++++++--- Lib/test/test_patma.py | 58 +++++++++++++++++++++++++----------------- Parser/parser.c | 18 ++++++------- 4 files changed, 55 insertions(+), 38 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 00925d4fa8676d..1e9cc7ed80ba12 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -216,7 +216,7 @@ patterns[expr_ty]: | pattern pattern[expr_ty]: - | target=NAME ':=' value=or_pattern { + | value=or_pattern 'as' target=NAME { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } | or_pattern diff --git a/Lib/ast.py b/Lib/ast.py index 350bdd49212419..af27f40997cce7 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -743,6 +743,7 @@ def pattern(self): assert self._pattern self._pattern = False + @property def in_pattern(self): return self._pattern @@ -839,9 +840,15 @@ def visit_Expr(self, node): def visit_NamedExpr(self, node): with self.require_parens(_Precedence.TUPLE, node): self.set_precedence(_Precedence.ATOM, node.target, node.value) - self.traverse(node.target) - self.write(" := ") - self.traverse(node.value) + # XXX + if self.in_pattern: + self.traverse(node.value) + self.write(" as ") + self.traverse(node.target) + else: + self.traverse(node.target) + self.write(" := ") + self.traverse(node.value) def visit_Import(self, node): self.fill("import ") @@ -1346,7 +1353,7 @@ def visit_Compare(self, node): boolop_precedence = {"and": _Precedence.AND, "or": _Precedence.OR} def visit_BoolOp(self, node): - if self.in_pattern(): + if self.in_pattern: operator = "|" operator_precedence = _Precedence.OR else: diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 6530439784d727..40cf89ec82e273 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -94,7 +94,7 @@ def test_patma_008(self): class A: y = 1 match x: - case z := A.y: + case A.y as z: pass self.assertEqual(x, 0) self.assertEqual(A.y, 1) @@ -105,7 +105,7 @@ class A: match 0: case x if x: z = 0 - case y := _ if y == x and y: + case _ as y if y == x and y: z = 1 case A.B: z = 2 @@ -225,7 +225,7 @@ def test_patma_024(self): def test_patma_025(self): x = {0: 0} match x: - case {0: (z := 0 | 1 | 2)}: + case {0: (0 | 1 | 2 as z)}: y = 0 self.assertEqual(x, {0: 0}) self.assertEqual(y, 0) @@ -234,7 +234,7 @@ def test_patma_025(self): def test_patma_026(self): x = {0: 1} match x: - case {0: (z := 0 | 1 | 2)}: + case {0: (0 | 1 | 2 as z)}: y = 0 self.assertEqual(x, {0: 1}) self.assertEqual(y, 0) @@ -243,7 +243,7 @@ def test_patma_026(self): def test_patma_027(self): x = {0: 2} match x: - case {0: (z := 0 | 1 | 2)}: + case {0: (0 | 1 | 2 as z)}: y = 0 self.assertEqual(x, {0: 2}) self.assertEqual(y, 0) @@ -253,7 +253,7 @@ def test_patma_028(self): x = {0: 3} y = None match x: - case {0: (z := 0 | 1 | 2)}: + case {0: (0 | 1 | 2 as z)}: y = 0 self.assertEqual(x, {0: 3}) self.assertIs(y, None) @@ -379,7 +379,7 @@ def test_patma_039(self): def test_patma_040(self): x = 0 match x: - case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + case (0 as z) | (1 as z) | (2 as z) if z == x % 2: y = 0 self.assertEqual(x, 0) self.assertEqual(y, 0) @@ -388,7 +388,7 @@ def test_patma_040(self): def test_patma_041(self): x = 1 match x: - case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + case (0 as z) | (1 as z) | (2 as z) if z == x % 2: y = 0 self.assertEqual(x, 1) self.assertEqual(y, 0) @@ -398,7 +398,7 @@ def test_patma_042(self): x = 2 y = None match x: - case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + case (0 as z) | (1 as z) | (2 as z) if z == x % 2: y = 0 self.assertEqual(x, 2) self.assertIs(y, None) @@ -408,7 +408,7 @@ def test_patma_043(self): x = 3 y = None match x: - case (z := 0) | (z := 1) | (z := 2) if z == x % 2: + case (0 as z) | (1 as z) | (2 as z) if z == x % 2: y = 0 self.assertEqual(x, 3) self.assertIs(y, None) @@ -474,9 +474,9 @@ def test_patma_051(self): w = None x = [1, 0] match x: - case [(w := 0)]: + case [(0 as w)]: y = 0 - case [z] | [1, (z := 0 | 1)] | [z]: + case [z] | [1, (0 | 1 as z)] | [z]: y = 1 self.assertIs(w, None) self.assertEqual(x, [1, 0]) @@ -786,7 +786,7 @@ def test_patma_081(self): match x: case 0 if not (x := 1): y = 0 - case (z := 0): + case (0 as z): y = 1 self.assertEqual(x, 1) self.assertEqual(y, 1) @@ -795,7 +795,7 @@ def test_patma_081(self): def test_patma_082(self): x = 0 match x: - case (z := 1) if not (x := 1): + case (1 as z) if not (x := 1): y = 0 case 0: y = 1 @@ -805,7 +805,7 @@ def test_patma_082(self): def test_patma_083(self): x = 0 match x: - case (z := 0): + case (0 as z): y = 0 self.assertEqual(x, 0) self.assertEqual(y, 0) @@ -815,7 +815,7 @@ def test_patma_084(self): x = 0 y = None match x: - case (z := 1): + case (1 as z): y = 0 self.assertEqual(x, 0) self.assertIs(y, None) @@ -824,7 +824,7 @@ def test_patma_085(self): x = 0 y = None match x: - case (z := 0) if (w := 0): + case (0 as z) if (w := 0): y = 0 self.assertEqual(w, 0) self.assertEqual(x, 0) @@ -834,7 +834,7 @@ def test_patma_085(self): def test_patma_086(self): x = 0 match x: - case (z := (w := 0)): + case ((0 as w) as z): y = 0 self.assertEqual(w, 0) self.assertEqual(x, 0) @@ -1444,7 +1444,7 @@ def test_patma_152(self): def test_patma_153(self): x = 0 match w := x,: - case v := y,: + case y as v,: z = 0 self.assertEqual(x, 0) self.assertIs(y, x) @@ -1955,7 +1955,7 @@ def test_patma_196(self): def test_patma_197(self): w = [Point(-1, 0), Point(1, 2)] match w: - case (Point(x1, y1), p2 := Point(x2, y2)): + case (Point(x1, y1), Point(x2, y2) as p2): z = 0 self.assertEqual(w, [Point(-1, 0), Point(1, 2)]) self.assertIs(x1, w[0].x) @@ -2189,7 +2189,7 @@ def f(w): def test_patma_213(self): def f(w): match w: - case x := (p, q): + case (p, q) as x: out = locals() del out["w"] return out @@ -2306,7 +2306,7 @@ def test_patma_227(self): def test_patma_228(self): def f(): match ...: - case a := b: + case b as a: return locals() self.assertEqual(set(f()), {"a", "b"}) @@ -2314,7 +2314,7 @@ def f(): def test_patma_229(self): self.assert_syntax_error(""" match ...: - case a := a: + case a as a: pass """) @@ -2472,7 +2472,7 @@ def test_patma_244(self): def test_patma_245(self): self.assert_syntax_error(""" match ...: - case _ := 42: + case 42 as _: pass """) @@ -2662,6 +2662,16 @@ def test_patma_262(self): self.assertIs(x, None) self.assertEqual(y, 0) + def test_patma_263(self): + x = 0 + match x: + case (0 as w) as z: + y = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments diff --git a/Parser/parser.c b/Parser/parser.c index eec96bccbb8d20..8e3ea334d8ccfa 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -5142,7 +5142,7 @@ patterns_rule(Parser *p) return _res; } -// pattern: NAME ':=' or_pattern | or_pattern +// pattern: or_pattern 'as' NAME | or_pattern static expr_ty pattern_rule(Parser *p) { @@ -5162,24 +5162,24 @@ pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME ':=' or_pattern + { // or_pattern 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); - Token * _literal; + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' NAME")); + Token * _keyword; expr_ty target; expr_ty value; if ( - (target = _PyPegen_name_token(p)) // NAME + (value = or_pattern_rule(p)) // or_pattern && - (_literal = _PyPegen_expect_token(p, 53)) // token=':=' + (_keyword = _PyPegen_expect_token(p, 520)) // token='as' && - (value = or_pattern_rule(p)) // or_pattern + (target = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' or_pattern")); + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' NAME")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5199,7 +5199,7 @@ pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' or_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' NAME")); } { // or_pattern if (p->error_indicator) { From 28ba072423109de35472c15aed8ebe539c703e1a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 14:24:21 -0700 Subject: [PATCH 164/218] Use new MatchAs node for named patterns --- Grammar/python.gram | 7 ++- Include/Python-ast.h | 12 ++++- Lib/ast.py | 17 ++++--- Lib/test/test_patma.py | 29 ++++++++++++ Lib/test/test_unparse.py | 2 +- Parser/Python.asdl | 3 ++ Parser/parser.c | 28 +++++------ Python/Python-ast.c | 100 ++++++++++++++++++++++++++++++++++++++- Python/ast.c | 10 ++-- Python/ast_opt.c | 2 +- Python/compile.c | 33 ++++++------- Python/symtable.c | 4 ++ 12 files changed, 196 insertions(+), 51 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 1e9cc7ed80ba12..43c8749845194e 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -216,8 +216,7 @@ patterns[expr_ty]: | pattern pattern[expr_ty]: - | value=or_pattern 'as' target=NAME { - _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, target, Store)), value, EXTRA) } + | value=or_pattern 'as' target=NAME { _Py_MatchAs(value, target->v.Name.id, EXTRA) } | or_pattern or_pattern[expr_ty]: @@ -281,7 +280,7 @@ values_pattern[asdl_seq*]: items_pattern[asdl_seq*]: | items=','.key_value_pattern+ ','? { items } keyword_pattern[keyword_ty]: - | arg=NAME '=' value=or_pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } + | arg=NAME '=' value=pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } error_argument_pattern: | pattern | keyword_pattern @@ -292,7 +291,7 @@ value_pattern[expr_ty]: | '*' value=name_pattern { _Py_Starred(value, Store, EXTRA) } | pattern key_value_pattern[KeyValuePair*]: - | key=(literal_pattern | constant_pattern) ':' value=or_pattern { + | key=(literal_pattern | constant_pattern) ':' value=pattern { _PyPegen_key_value_pair(p, key, value) } | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 8c6c17022a7ceb..25f2deed378fff 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -326,7 +326,8 @@ enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4, YieldFrom_kind=15, Compare_kind=16, Call_kind=17, FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20, Attribute_kind=21, Subscript_kind=22, Starred_kind=23, - Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27}; + Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27, + MatchAs_kind=28}; struct _expr { enum _expr_kind kind; union { @@ -469,6 +470,11 @@ struct _expr { expr_ty step; } Slice; + struct { + expr_ty pattern; + identifier name; + } MatchAs; + } v; int lineno; int col_offset; @@ -768,6 +774,10 @@ expr_ty _Py_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int expr_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); +#define MatchAs(a0, a1, a2, a3, a4, a5, a6) _Py_MatchAs(a0, a1, a2, a3, a4, a5, a6) +expr_ty _Py_MatchAs(expr_ty pattern, identifier name, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); #define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4) comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, PyArena *arena); diff --git a/Lib/ast.py b/Lib/ast.py index af27f40997cce7..cc9c57752776c6 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -840,15 +840,9 @@ def visit_Expr(self, node): def visit_NamedExpr(self, node): with self.require_parens(_Precedence.TUPLE, node): self.set_precedence(_Precedence.ATOM, node.target, node.value) - # XXX - if self.in_pattern: - self.traverse(node.value) - self.write(" as ") - self.traverse(node.target) - else: - self.traverse(node.target) - self.write(" := ") - self.traverse(node.value) + self.traverse(node.target) + self.write(" := ") + self.traverse(node.value) def visit_Import(self, node): self.fill("import ") @@ -1537,6 +1531,11 @@ def visit_match_case(self, node): with self.block(): self.traverse(node.body) + def visit_MatchAs(self, node): + with self.require_parens(_Precedence.TUPLE, node): + self.traverse(node.pattern) + self.write(f" as {node.name}") + def unparse(ast_obj): unparser = _Unparser() return unparser.visit(ast_obj) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 40cf89ec82e273..7a9e36911214cd 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2672,6 +2672,35 @@ def test_patma_263(self): self.assertEqual(y, 0) self.assertEqual(z, 0) + def test_patma_264(self): + x = 0 + match x: + case (0 as w) as z: + y = 0 + self.assertEqual(w, 0) + self.assertEqual(x, 0) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + + def test_patma_265(self): + x = ((0, 1), (2, 3)) + match x: + case ((a as b, c as d) as e) as w, ((f as g, h) as i) as z: + y = 0 + self.assertEqual(a, 0) + self.assertEqual(b, 0) + self.assertEqual(c, 1) + self.assertEqual(d, 1) + self.assertEqual(e, (0, 1)) + self.assertEqual(f, 2) + self.assertEqual(g, 2) + self.assertEqual(h, 3) + self.assertEqual(i, (2, 3)) + self.assertEqual(w, (0, 1)) + self.assertEqual(x, ((0, 1), (2, 3))) + self.assertEqual(y, 0) + self.assertEqual(z, (2, 3)) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 532aa3a6390414..4701f81562f498 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -485,7 +485,7 @@ class DirectoryTestCase(ASTTestCase): test_directories = (lib_dir, lib_dir / "test") skip_files = {"test_fstring.py"} run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py", - "test_ast.py", "test_asdl_parser.py"} + "test_ast.py", "test_asdl_parser.py", "test_patma.py"} # XXX _files_to_test = None diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 2ea375366873ee..8b0c1ef7ba60eb 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -89,6 +89,9 @@ module Python -- can appear only in Subscript | Slice(expr? lower, expr? upper, expr? step) + -- only used for named patterns + | MatchAs(expr pattern, identifier name) + -- col_offset is the byte offset in the utf8 string the parser uses attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset) diff --git a/Parser/parser.c b/Parser/parser.c index 8e3ea334d8ccfa..592420876f2151 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -5189,7 +5189,7 @@ pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , target , Store ) ) , value , EXTRA ); + _res = _Py_MatchAs ( value , target -> v . Name . id , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6624,7 +6624,7 @@ items_pattern_rule(Parser *p) return _res; } -// keyword_pattern: NAME '=' or_pattern +// keyword_pattern: NAME '=' pattern static keyword_ty keyword_pattern_rule(Parser *p) { @@ -6644,12 +6644,12 @@ keyword_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME '=' or_pattern + { // NAME '=' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); Token * _literal; expr_ty arg; expr_ty value; @@ -6658,10 +6658,10 @@ keyword_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (value = or_pattern_rule(p)) // or_pattern + (value = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' or_pattern")); + D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6681,7 +6681,7 @@ keyword_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' or_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); } _res = NULL; done: @@ -6869,9 +6869,7 @@ value_pattern_rule(Parser *p) return _res; } -// key_value_pattern: -// | (literal_pattern | constant_pattern) ':' or_pattern -// | '**' name_pattern +// key_value_pattern: (literal_pattern | constant_pattern) ':' pattern | '**' name_pattern static KeyValuePair* key_value_pattern_rule(Parser *p) { @@ -6882,12 +6880,12 @@ key_value_pattern_rule(Parser *p) } KeyValuePair* _res = NULL; int _mark = p->mark; - { // (literal_pattern | constant_pattern) ':' or_pattern + { // (literal_pattern | constant_pattern) ':' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); Token * _literal; void *key; expr_ty value; @@ -6896,10 +6894,10 @@ key_value_pattern_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && - (value = or_pattern_rule(p)) // or_pattern + (value = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); _res = _PyPegen_key_value_pair ( p , key , value ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -6910,7 +6908,7 @@ key_value_pattern_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' or_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); } { // '**' name_pattern if (p->error_indicator) { diff --git a/Python/Python-ast.c b/Python/Python-ast.c index c599a86adea581..e81247dc8a6519 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -87,6 +87,7 @@ typedef struct { PyObject *Lt_type; PyObject *MatMult_singleton; PyObject *MatMult_type; + PyObject *MatchAs_type; PyObject *Match_type; PyObject *Mod_singleton; PyObject *Mod_type; @@ -339,6 +340,7 @@ void _PyAST_Fini(PyThreadState *tstate) Py_CLEAR(state->Lt_type); Py_CLEAR(state->MatMult_singleton); Py_CLEAR(state->MatMult_type); + Py_CLEAR(state->MatchAs_type); Py_CLEAR(state->Match_type); Py_CLEAR(state->Mod_singleton); Py_CLEAR(state->Mod_type); @@ -836,6 +838,10 @@ static const char * const Slice_fields[]={ "upper", "step", }; +static const char * const MatchAs_fields[]={ + "pattern", + "name", +}; static PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty); static PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty); static PyObject* ast2obj_operator(astmodulestate *state, operator_ty); @@ -1474,7 +1480,8 @@ static int init_types(astmodulestate *state) " | Name(identifier id, expr_context ctx)\n" " | List(expr* elts, expr_context ctx)\n" " | Tuple(expr* elts, expr_context ctx)\n" - " | Slice(expr? lower, expr? upper, expr? step)"); + " | Slice(expr? lower, expr? upper, expr? step)\n" + " | MatchAs(expr pattern, identifier name)"); if (!state->expr_type) return 0; if (!add_attributes(state, state->expr_type, expr_attributes, 4)) return 0; if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1) @@ -1607,6 +1614,10 @@ static int init_types(astmodulestate *state) return 0; if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1) return 0; + state->MatchAs_type = make_type(state, "MatchAs", state->expr_type, + MatchAs_fields, 2, + "MatchAs(expr pattern, identifier name)"); + if (!state->MatchAs_type) return 0; state->expr_context_type = make_type(state, "expr_context", state->AST_type, NULL, 0, "expr_context = Load | Store | Del"); @@ -3297,6 +3308,34 @@ Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset, return p; } +expr_ty +MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena) +{ + expr_ty p; + if (!pattern) { + PyErr_SetString(PyExc_ValueError, + "field 'pattern' is required for MatchAs"); + return NULL; + } + if (!name) { + PyErr_SetString(PyExc_ValueError, + "field 'name' is required for MatchAs"); + return NULL; + } + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = MatchAs_kind; + p->v.MatchAs.pattern = pattern; + p->v.MatchAs.name = name; + p->lineno = lineno; + p->col_offset = col_offset; + p->end_lineno = end_lineno; + p->end_col_offset = end_col_offset; + return p; +} + comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, PyArena *arena) @@ -4528,6 +4567,21 @@ ast2obj_expr(astmodulestate *state, void* _o) goto failed; Py_DECREF(value); break; + case MatchAs_kind: + tp = (PyTypeObject *)state->MatchAs_type; + result = PyType_GenericNew(tp, NULL, NULL); + if (!result) goto failed; + value = ast2obj_expr(state, o->v.MatchAs.pattern); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->pattern, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_identifier(state, o->v.MatchAs.name); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->name, value) == -1) + goto failed; + Py_DECREF(value); + break; } value = ast2obj_int(state, o->lineno); if (!value) goto failed; @@ -8751,6 +8805,46 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena) if (*out == NULL) goto failed; return 0; } + tp = state->MatchAs_type; + isinstance = PyObject_IsInstance(obj, tp); + if (isinstance == -1) { + return 1; + } + if (isinstance) { + expr_ty pattern; + identifier name; + + if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from MatchAs"); + return 1; + } + else { + int res; + res = obj2ast_expr(state, tmp, &pattern, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from MatchAs"); + return 1; + } + else { + int res; + res = obj2ast_identifier(state, tmp, &name, arena); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + *out = MatchAs(pattern, name, lineno, col_offset, end_lineno, + end_col_offset, arena); + if (*out == NULL) goto failed; + return 0; + } PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj); failed: @@ -10209,6 +10303,10 @@ astmodule_exec(PyObject *m) return -1; } Py_INCREF(state->Slice_type); + if (PyModule_AddObject(m, "MatchAs", state->MatchAs_type) < 0) { + return -1; + } + Py_INCREF(state->MatchAs_type); if (PyModule_AddObject(m, "expr_context", state->expr_context_type) < 0) { return -1; } diff --git a/Python/ast.c b/Python/ast.c index 6a0e21c3a8efa6..419eaf5a29ca34 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -309,6 +309,10 @@ validate_expr(expr_ty exp, expr_context_ty ctx) return validate_exprs(exp->v.Tuple.elts, ctx, 0); case NamedExpr_kind: return validate_expr(exp->v.NamedExpr.value, Load); + case MatchAs_kind: + PyErr_SetString( + PyExc_ValueError, "MatchAs can only be used in match_case patterns"); + return 0; /* This last case doesn't have any checking. */ case Name_kind: return 1; @@ -426,9 +430,9 @@ validate_pattern(expr_ty p) return 0; } return validate_expr(p, p->v.Name.ctx); // TODO - case NamedExpr_kind: - return (validate_pattern(p->v.NamedExpr.value) - && validate_expr(p->v.NamedExpr.target, Store)); // TODO + case MatchAs_kind: + return validate_pattern(p->v.MatchAs.pattern) + && validate_name(p->v.MatchAs.name); case UnaryOp_kind: // TODO return 1; diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 025e168a01283b..9e451b57491017 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -789,8 +789,8 @@ astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) // Not actually valid, but it's the compiler's job to complain: case JoinedStr_kind: case List_kind: + case MatchAs_kind: case Name_kind: - case NamedExpr_kind: case Tuple_kind: return 1; case UnaryOp_kind: diff --git a/Python/compile.c b/Python/compile.c index de59011f8a08fb..2884aa5138d15e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5130,6 +5130,9 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) return compiler_list(c, e); case Tuple_kind: return compiler_tuple(c, e); + case MatchAs_kind: + // Can only occur in patterns, which are handled elsewhere. + Py_UNREACHABLE(); } return 1; } @@ -5494,11 +5497,9 @@ pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) static int -pattern_store_name(struct compiler *c, expr_ty p, pattern_context *pc) +pattern_store_name(struct compiler *c, identifier n, pattern_context *pc) { - assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Store); - if (WILDCARD_CHECK(p)) { + if (_PyUnicode_EqualToASCIIString(n, "_")) { const char *e = "can't assign to '_' here; consider removing or " "renaming?"; return compiler_error(c, e); @@ -5507,17 +5508,17 @@ pattern_store_name(struct compiler *c, expr_ty p, pattern_context *pc) CHECK(pc->stores = PySet_New(NULL)); } else { - int duplicate = PySet_Contains(pc->stores, p->v.Name.id); + int duplicate = PySet_Contains(pc->stores, n); if (duplicate < 0) { return 0; } if (duplicate) { const char *e = "multiple assignments to name %R in pattern"; - return compiler_error(c, e, p->v.Name.id); + return compiler_error(c, e, n); } } - CHECK(!PySet_Add(pc->stores, p->v.Name.id)); - CHECK(compiler_nameop(c, p->v.Name.id, Store)); + CHECK(!PySet_Add(pc->stores, n)); + CHECK(compiler_nameop(c, n, Store)); return 1; } @@ -5722,7 +5723,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP(c, POP_TOP); if (star) { - CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1), pc)); + CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1)->v.Name.id, pc)); } else { ADDOP(c, POP_TOP); @@ -5829,7 +5830,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->v.Name.ctx == Store); if (!WILDCARD_CHECK(p)) { ADDOP(c, DUP_TOP); - CHECK(pattern_store_name(c, p, pc)); + CHECK(pattern_store_name(c, p->v.Name.id, pc)); } ADDOP_LOAD_CONST(c, Py_True); return 1; @@ -5837,16 +5838,16 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) static int -compiler_pattern_namedexpr(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == NamedExpr_kind); + assert(p->kind == MatchAs_kind); basicblock *end; CHECK(end = compiler_new_block(c)); - CHECK(compiler_pattern(c, p->v.NamedExpr.value, pc)); + CHECK(compiler_pattern(c, p->v.MatchAs.pattern, pc)); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); ADDOP(c, DUP_TOP); - CHECK(pattern_store_name(c, p->v.NamedExpr.target, pc)); + CHECK(pattern_store_name(c, p->v.MatchAs.name, pc)); ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; @@ -5877,10 +5878,10 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) case List_kind: case Tuple_kind: return compiler_pattern_list_tuple(c, p, pc); + case MatchAs_kind: + return compiler_pattern_as(c, p, pc); case Name_kind: return compiler_pattern_name(c, p, pc); - case NamedExpr_kind: - return compiler_pattern_namedexpr(c, p, pc); default: Py_UNREACHABLE(); } diff --git a/Python/symtable.c b/Python/symtable.c index 9f4e2c06cd985d..6f208d3ca7169e 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1669,6 +1669,10 @@ symtable_visit_expr(struct symtable *st, expr_ty e) case Tuple_kind: VISIT_SEQ(st, expr, e->v.Tuple.elts); break; + case MatchAs_kind: + VISIT(st, expr, e->v.MatchAs.pattern); + symtable_add_def(st, e->v.MatchAs.name, DEF_LOCAL); + break; } VISIT_QUIT(st, 1); } From 462796eec213f33ea3adf74464e272728f51f4e2 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 15:27:06 -0700 Subject: [PATCH 165/218] Add version check --- Grammar/python.gram | 2 +- Parser/parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 43c8749845194e..a470fb4a1b540b 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -203,7 +203,7 @@ match_expr[expr_ty]: match_stmt[stmt_ty]: | "match" subject=match_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT { - _Py_Match(subject, cases, EXTRA) } + CHECK_VERSION(10, "Pattern matching is", _Py_Match(subject, cases, EXTRA)) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } diff --git a/Parser/parser.c b/Parser/parser.c index 592420876f2151..2b7ca3dcd99389 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -4943,7 +4943,7 @@ match_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Match ( subject , cases , EXTRA ); + _res = CHECK_VERSION ( 10 , "Pattern matching is" , _Py_Match ( subject , cases , EXTRA ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); From ebd95c62ac1929084210009ce485f6b0e4e526fe Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 17:03:22 -0700 Subject: [PATCH 166/218] Raise for unreachable patterns --- Lib/test/test_patma.py | 88 +++++++++++++++++++++++++++++++++++++++--- Python/compile.c | 47 +++++++++++++++------- 2 files changed, 114 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 7a9e36911214cd..bae1df45e7313e 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2448,17 +2448,13 @@ def test_patma_242(self): @no_perf def test_patma_243(self): - namespace = {} - code = """ + self.assert_syntax_error(""" match 42: case x: pass case y: pass - """ - with self.assertWarns(SyntaxWarning): - exec(inspect.cleandoc(code), None, namespace) - self.assertEqual(namespace, {"x": 42}) + """) @no_perf def test_patma_244(self): @@ -2701,6 +2697,86 @@ def test_patma_265(self): self.assertEqual(y, 0) self.assertEqual(z, (2, 3)) + @no_perf + def test_patma_266(self): + self.assert_syntax_error(""" + match ...: + case _ | _: + pass + """) + + @no_perf + def test_patma_267(self): + self.assert_syntax_error(""" + match ...: + case (_ as x) | [x]: + pass + """) + + + @no_perf + def test_patma_268(self): + self.assert_syntax_error(""" + match ...: + case _ | _ if condition(): + pass + """) + + + @no_perf + def test_patma_269(self): + self.assert_syntax_error(""" + match ...: + case x | [_ as x] if x: + pass + """) + + @no_perf + def test_patma_270(self): + self.assert_syntax_error(""" + match ...: + case _: + pass + case None: + pass + """) + + @no_perf + def test_patma_271(self): + self.assert_syntax_error(""" + match ...: + case x: + pass + case [x] if x: + pass + """) + + @no_perf + def test_patma_272(self): + self.assert_syntax_error(""" + match ...: + case x: + pass + case _: + pass + """) + + @no_perf + def test_patma_273(self): + self.assert_syntax_error(""" + match ...: + case (None | _) | _: + pass + """) + + @no_perf + def test_patma_274(self): + self.assert_syntax_error(""" + match ...: + case _ | (True | False): + pass + """) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments diff --git a/Python/compile.c b/Python/compile.c index 2884aa5138d15e..ebde815491a6a8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -203,6 +203,7 @@ struct compiler { typedef struct { PyObject *stores; + int irrefutable; } pattern_context; static int compiler_enter_scope(struct compiler *, identifier, int, void *, int); @@ -250,6 +251,7 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); +static int compiler_subpattern(struct compiler *, expr_ty, pattern_context *); static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); static int compiler_match(struct compiler *, stmt_ty); @@ -5451,11 +5453,6 @@ compiler_slice(struct compiler *c, expr_ty s) // pushing, popping, and jumping in the peephole optimizer than to detect or // predict it here. -// Other than that, go nuts. The PEP intentionally gives us broad freedom to -// take (reasonable) shortcuts - the AST optimization pass in particular is full -// of low-hanging fruit. Please *always* document these with a comment of the -// form "OPTIM: ...", so we can track exactly when and where they're happening. - #define WILDCARD_CHECK(N) \ ((N)->kind == Name_kind && \ @@ -5547,12 +5544,17 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); assert(size > 1); PyObject *stores_init = pc->stores; + assert(!pc->irrefutable); expr_ty alt; for (Py_ssize_t i = 0; i < size; i++) { // Can't use our helpful returning macros here (they'll leak sets): alt = asdl_seq_GET(p->v.BoolOp.values, i); pc->stores = PySet_New(stores_init); SET_LOC(c, alt); + if (pc->irrefutable) { + compiler_error(c, "pattern follows an irrefutable alternative"); + goto fail; + } if (!pc->stores || !compiler_pattern(c, alt, pc) || !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || @@ -5635,7 +5637,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { continue; } ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_pattern(c, arg, pc)); + CHECK(compiler_subpattern(c, arg, pc)); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); @@ -5715,7 +5717,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) continue; } ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_pattern(c, value, pc)); + CHECK(compiler_subpattern(c, value, pc)); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, block); @@ -5803,7 +5805,7 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) else { ADDOP_I(c, GET_INDEX_END, size - 1 - i); } - CHECK(compiler_pattern(c, value, pc)); + CHECK(compiler_subpattern(c, value, pc)); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, subblock); NEXT_BLOCK(c); ADDOP(c, POP_TOP); @@ -5828,6 +5830,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); + pc->irrefutable = 1; if (!WILDCARD_CHECK(p)) { ADDOP(c, DUP_TOP); CHECK(pattern_store_name(c, p->v.Name.id, pc)); @@ -5854,6 +5857,16 @@ compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) } +static int +compiler_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) +{ + assert(!pc->irrefutable); + CHECK(compiler_pattern(c, p, pc)); + pc->irrefutable = 0; + return 1; +} + + static int compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) { @@ -5897,27 +5910,26 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; + pc.irrefutable = 0; + pc.stores = NULL; int result; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); int has_default = WILDCARD_CHECK(m->pattern) && 1 < cases; for (Py_ssize_t i = 0; i < cases - has_default; i++) { m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); - if (!m->guard && m->pattern->kind == Name_kind && - m->pattern->v.Name.ctx == Store && i != cases - 1) - { - const char *w = "unguarded name capture pattern %R makes remaining " - "cases unreachable"; - CHECK(compiler_warn(c, w, m->pattern->v.Name.id)); + if (pc.irrefutable) { + const char *w = "case follows irrefutable match arm"; + CHECK(compiler_error(c, w, m->pattern->v.Name.id)); } CHECK(next = compiler_new_block(c)); - pc.stores = NULL; result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); CHECK(result); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, next); NEXT_BLOCK(c); if (m->guard) { + pc.irrefutable = 0; CHECK(compiler_jump_if(c, m->guard, next, 0)); } ADDOP(c, POP_TOP); @@ -5930,6 +5942,11 @@ compiler_match(struct compiler *c, stmt_ty s) // A trailing "case _" is common, and lets us save a bit of redundant // pushing and popping in the loop above: m = asdl_seq_GET(s->v.Match.cases, cases - 1); + SET_LOC(c, m->pattern); + if (pc.irrefutable) { + const char *w = "case follows irrefutable match arm"; + CHECK(compiler_error(c, w, m->pattern->v.Name.id)); + } if (m->guard) { CHECK(compiler_jump_if(c, m->guard, end, 0)); } From de1b0208a31df1e30b9c27f443014c8a4dc95534 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 19 Oct 2020 17:31:49 -0700 Subject: [PATCH 167/218] Clean up error messages --- Python/compile.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index ebde815491a6a8..789405c11918a8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5552,7 +5552,9 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) pc->stores = PySet_New(stores_init); SET_LOC(c, alt); if (pc->irrefutable) { - compiler_error(c, "pattern follows an irrefutable alternative"); + const char *e = "the previous pattern always matches, making this " + "one unreachable"; + compiler_error(c, e); goto fail; } if (!pc->stores || @@ -5919,8 +5921,9 @@ compiler_match(struct compiler *c, stmt_ty s) m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); if (pc.irrefutable) { - const char *w = "case follows irrefutable match arm"; - CHECK(compiler_error(c, w, m->pattern->v.Name.id)); + const char *e = "the previous case always matches, making this one " + "unreachable"; + CHECK(compiler_error(c, e)); } CHECK(next = compiler_new_block(c)); result = compiler_pattern(c, m->pattern, &pc); @@ -5944,8 +5947,9 @@ compiler_match(struct compiler *c, stmt_ty s) m = asdl_seq_GET(s->v.Match.cases, cases - 1); SET_LOC(c, m->pattern); if (pc.irrefutable) { - const char *w = "case follows irrefutable match arm"; - CHECK(compiler_error(c, w, m->pattern->v.Name.id)); + const char *e = "the previous case always matches, making this one " + "unreachable"; + CHECK(compiler_error(c, e)); } if (m->guard) { CHECK(compiler_jump_if(c, m->guard, end, 0)); From f5c248200e27330bdad5804c4a708f52c94622e0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Oct 2020 09:59:21 -0700 Subject: [PATCH 168/218] Minor cleanup --- Doc/library/dis.rst | 17 +++++++++++++++++ Lib/test/test_unparse.py | 2 +- Python/compile.c | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 91c0d5ebe124c5..8dfa1fe38b88de 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1241,6 +1241,14 @@ All of the following opcodes use their arguments. TODO + TOS is a tuple of keyword attribute names. + TOS1 is the "class" being called. + TOS2 is the subject. + *oparg* is the number of positional sub-patterns. + + On match, replaces TOS1 with a tuple extracted attributes, and TOS with True. + On no match, replaces TOS with False. + .. versionadded:: 3.10 @@ -1248,6 +1256,15 @@ All of the following opcodes use their arguments. TODO + TOS is a tuple of keys. + TOS1 is the match subject. + + On failure, replaces TOS with None and pushes False. + + On success, replaces TOS with a tuple of keys and pushes TRUE. If *oparg* is + non-zero, gather remaining items into a dict and put it on the stack where + the subject used to be. + .. versionadded:: 3.10 diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 4701f81562f498..532aa3a6390414 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -485,7 +485,7 @@ class DirectoryTestCase(ASTTestCase): test_directories = (lib_dir, lib_dir / "test") skip_files = {"test_fstring.py"} run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py", - "test_ast.py", "test_asdl_parser.py", "test_patma.py"} # XXX + "test_ast.py", "test_asdl_parser.py"} _files_to_test = None diff --git a/Python/compile.c b/Python/compile.c index 789405c11918a8..f14b413130ec68 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5444,7 +5444,7 @@ compiler_slice(struct compiler *c, expr_ty s) } -// PEP 622: Structural Pattern Matching +// PEP 634: Structural Pattern Matching // To keep things simple, all compiler_pattern_* routines follow the convention // of preserving TOS (the subject for the given pattern) and pushing either True From 4de619a49dac871b5d60d4956927f2a1464b29e5 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Oct 2020 22:50:48 -0700 Subject: [PATCH 169/218] Reorganize some sequence/mapping logic --- Include/internal/pycore_interp.h | 1 + Lib/importlib/_bootstrap_external.py | 4 +- Python/ceval.c | 101 ++++++++++++++++----------- Python/compile.c | 31 +++----- Python/importlib_external.h | 2 +- 5 files changed, 74 insertions(+), 65 deletions(-) diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 55745f110d3b4e..38713c4be8a2f4 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -193,6 +193,7 @@ struct _is { // Kept handy for pattern matching: PyObject *map_abc; // _collections_abc.Mapping PyObject *seq_abc; // _collections_abc.Sequence + Py_ssize_t get_len; // Cached length of subject /* Used in Modules/_threadmodule.c. */ long num_threads; diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 862149c7ad9f1b..588141213a1899 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,7 +278,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) -# Python 3.10a1 3467 (add structural pattern matching) +# Python 3.10a1 3470 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -288,7 +288,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3467).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3470).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/ceval.c b/Python/ceval.c index b9b6a196b456fd..0a34505bd78814 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -834,6 +834,34 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: +static PyObject* +get_seq_abc() +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return NULL; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + } + return interp->seq_abc; +} + +static PyObject* +get_map_abc() +{ + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + return NULL; + } + interp->map_abc = PyObject_GetAttrString(abc, "Sequence"); + } + return interp->map_abc; +} + static PyObject* match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) { @@ -3537,6 +3565,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (l < 0) { goto error; } + PyInterpreterState *interp = PyInterpreterState_Get(); + interp->get_len = l; PyObject *len = PyLong_FromSsize_t(l); if (!len) { goto error; @@ -3563,19 +3593,17 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_MAPPING): { - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->map_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - goto error; - } - interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); - Py_DECREF(abc); - if (!interp->map_abc) { - goto error; - } + PyObject *subject = TOP(); + if (PyDict_Check(subject)) { + Py_INCREF(Py_True); + PUSH(Py_True); + DISPATCH(); } - int match = PyObject_IsInstance(TOP(), interp->map_abc); + PyObject *map_abc = get_map_abc(); + if (!map_abc) { + goto error; + } + int match = PyObject_IsInstance(subject, map_abc); if (match < 0) { goto error; } @@ -3586,7 +3614,16 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_SEQUENCE): { PyObject *subject = TOP(); if (PyType_FastSubclass(Py_TYPE(subject), - Py_TPFLAGS_BYTES_SUBCLASS | Py_TPFLAGS_UNICODE_SUBCLASS) + Py_TPFLAGS_LIST_SUBCLASS | + Py_TPFLAGS_TUPLE_SUBCLASS)) + { + Py_INCREF(Py_True); + PUSH(Py_True); + DISPATCH(); + } + if (PyType_FastSubclass(Py_TYPE(subject), + Py_TPFLAGS_BYTES_SUBCLASS | + Py_TPFLAGS_UNICODE_SUBCLASS) || PyIter_Check(subject) || PyByteArray_Check(subject)) { @@ -3594,19 +3631,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PUSH(Py_False); DISPATCH(); } - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->seq_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - goto error; - } - interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - Py_DECREF(abc); - if (!interp->seq_abc) { - goto error; - } + PyObject *seq_abc = get_seq_abc(); + if (!seq_abc) { + goto error; } - int match = PyObject_IsInstance(subject, interp->seq_abc); + int match = PyObject_IsInstance(subject, seq_abc); if (match < 0) { goto error; } @@ -3655,18 +3684,15 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_END): { - // PUSH(TOS[TOS1 - 1 - oparg]) + // PUSH(TOS[len(TOS) - 1 - oparg]) // NOTE: We can't rely on support for negative indexing! // Although PySequence_GetItem tries to correct negative indexes, we - // just use the length we already have at TOS1. In addition to + // just use the length we already cached from GET_LEN. In addition to // avoiding tons of redundant __len__ calls, this also handles // length changes during extraction more intuitively. - Py_ssize_t len = PyLong_AsSsize_t(SECOND()); - if (len < 0) { - goto error; - } - assert(len - 1 - oparg >= 0); - PyObject *item = PySequence_GetItem(TOP(), len - 1 - oparg); + PyInterpreterState *interp = PyInterpreterState_Get(); + assert(interp->get_len - 1 - oparg >= 0); + PyObject *item = PySequence_GetItem(TOP(), interp->get_len - 1 - oparg); if (!item) { goto error; } @@ -3675,15 +3701,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_SLICE): { - // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) + // PUSH(list(TOS[oparg & 0xFF: len(TOS) - (oparg >> 8)])) // NOTE: We can't rely on support for slicing or negative indexing! // Ditto GET_INDEX_END's length handling. - Py_ssize_t len = PyLong_AsSsize_t(SECOND()); - if (len < 0) { - goto error; - } + PyInterpreterState *interp = PyInterpreterState_Get(); Py_ssize_t start = oparg & 0xFF; - Py_ssize_t stop = len - (oparg >> 8); + Py_ssize_t stop = interp->get_len - (oparg >> 8); assert(start <= stop); PyObject *subject = TOP(); PyObject *items; diff --git a/Python/compile.c b/Python/compile.c index f14b413130ec68..292ea1cb643d0f 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5660,12 +5660,9 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, DUP_TOP); CHECK(pattern_load_constant(c, p, pc)); PyObject *v = p->v.Constant.value; - if (v == Py_None || PyBool_Check(v)) { - ADDOP_COMPARE(c, Is); - } - else { - ADDOP_COMPARE(c, Eq); - } + // Literal True, False, and None are compared by identity. + // All others use equality. + ADDOP_COMPARE(c, v == Py_None || PyBool_Check(v) ? Is : Eq); return 1; } @@ -5761,7 +5758,7 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) } star = i; } - basicblock *block, *end, *subblock; + basicblock *end; CHECK(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); @@ -5773,9 +5770,6 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) compiler_use_next_block(c, end); return 1; } - CHECK(subblock = compiler_new_block(c)); - CHECK(block = compiler_new_block(c)); - ADDOP(c, DUP_TOP); if (star < 0) { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); @@ -5784,9 +5778,8 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); } - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, block); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); - ADDOP(c, ROT_TWO); for (Py_ssize_t i = 0; i < size; i++) { // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) expr_ty value = asdl_seq_GET(values, i); @@ -5808,20 +5801,12 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_I(c, GET_INDEX_END, size - 1 - i); } CHECK(compiler_subpattern(c, value, pc)); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, subblock); - NEXT_BLOCK(c); + ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); } - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); - ADDOP_JUMP(c, JUMP_FORWARD, end); - compiler_use_next_block(c, subblock); - ADDOP(c, POP_TOP); - ADDOP(c, ROT_TWO); - compiler_use_next_block(c, block); - ADDOP(c, POP_TOP); - ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 9259090d00450b..36e58673c584bd 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -285,7 +285,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,13,95,119,114,105,116,101,95,97,116,111,109,105,99, 120,0,0,0,115,28,0,0,0,0,5,16,1,6,1,22, 255,4,2,2,3,14,1,40,1,16,1,12,1,2,1,14, - 1,12,1,6,1,114,69,0,0,0,105,139,13,0,0,114, + 1,12,1,6,1,114,69,0,0,0,105,142,13,0,0,114, 28,0,0,0,114,17,0,0,0,115,2,0,0,0,13,10, 90,11,95,95,112,121,99,97,99,104,101,95,95,122,4,111, 112,116,45,122,3,46,112,121,122,4,46,112,121,99,78,41, From 9f1c91d1f05694e4e82657cd458841444f2da09b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Oct 2020 23:40:15 -0700 Subject: [PATCH 170/218] More ceval cleanup --- Python/ceval.c | 114 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 0a34505bd78814..2bd7f30976b894 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -834,34 +834,6 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: -static PyObject* -get_seq_abc() -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->seq_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return NULL; - } - interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - } - return interp->seq_abc; -} - -static PyObject* -get_map_abc() -{ - PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->map_abc) { - PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { - return NULL; - } - interp->map_abc = PyObject_GetAttrString(abc, "Sequence"); - } - return interp->map_abc; -} - static PyObject* match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) { @@ -3565,6 +3537,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (l < 0) { goto error; } + // We might have one or more GET_INDEX_* instructions soon. Cache + // the length on the PyInterpreterState struct so they can reuse it: PyInterpreterState *interp = PyInterpreterState_Get(); interp->get_len = l; PyObject *len = PyLong_FromSsize_t(l); @@ -3594,16 +3568,26 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_MAPPING): { PyObject *subject = TOP(); + // Fast path for dicts: if (PyDict_Check(subject)) { Py_INCREF(Py_True); PUSH(Py_True); DISPATCH(); } - PyObject *map_abc = get_map_abc(); - if (!map_abc) { - goto error; + // Lazily import _collections_abc.Mapping, and keep it handy on the + // PyInterpreterState struct (it gets cleaned up at exit): + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp->map_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); + if (!interp->map_abc) { + goto error; + } } - int match = PyObject_IsInstance(subject, map_abc); + int match = PyObject_IsInstance(subject, interp->map_abc); if (match < 0) { goto error; } @@ -3613,6 +3597,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(MATCH_SEQUENCE): { PyObject *subject = TOP(); + // Fast path for lists and tuples: if (PyType_FastSubclass(Py_TYPE(subject), Py_TPFLAGS_LIST_SUBCLASS | Py_TPFLAGS_TUPLE_SUBCLASS)) @@ -3621,21 +3606,31 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PUSH(Py_True); DISPATCH(); } + // Bail on some possible Sequences that we intentionally exclude: if (PyType_FastSubclass(Py_TYPE(subject), Py_TPFLAGS_BYTES_SUBCLASS | - Py_TPFLAGS_UNICODE_SUBCLASS) - || PyIter_Check(subject) - || PyByteArray_Check(subject)) + Py_TPFLAGS_UNICODE_SUBCLASS) || + PyIter_Check(subject) || + PyByteArray_Check(subject)) { Py_INCREF(Py_False); PUSH(Py_False); DISPATCH(); } - PyObject *seq_abc = get_seq_abc(); - if (!seq_abc) { - goto error; + // Lazily import _collections_abc.Sequence, and keep it handy on the + // PyInterpreterState struct (it gets cleaned up at exit): + PyInterpreterState *interp = PyInterpreterState_Get(); + if (!interp->seq_abc) { + PyObject *abc = PyImport_ImportModule("_collections_abc"); + if (!abc) { + goto error; + } + interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); + if (!interp->seq_abc) { + goto error; + } } - int match = PyObject_IsInstance(subject, seq_abc); + int match = PyObject_IsInstance(subject, interp->seq_abc); if (match < 0) { goto error; } @@ -3687,9 +3682,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // PUSH(TOS[len(TOS) - 1 - oparg]) // NOTE: We can't rely on support for negative indexing! // Although PySequence_GetItem tries to correct negative indexes, we - // just use the length we already cached from GET_LEN. In addition to - // avoiding tons of redundant __len__ calls, this also handles - // length changes during extraction more intuitively. + // just use the length we already have cached from GET_LEN on the + // PyInterpreterState struct. In addition to avoiding tons of + // redundant __len__ calls, this also handles length changes during + // extraction more intuitively. It's also much faster and simpler + // than trying to rotate it around on the stack and pop it off when + // we're done. PyInterpreterState *interp = PyInterpreterState_Get(); assert(interp->get_len - 1 - oparg >= 0); PyObject *item = PySequence_GetItem(TOP(), interp->get_len - 1 - oparg); @@ -3708,31 +3706,31 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) Py_ssize_t start = oparg & 0xFF; Py_ssize_t stop = interp->get_len - (oparg >> 8); assert(start <= stop); + PyObject *slice = PyList_New(stop - start); + if (!slice) { + goto error; + } + PyObject **slice_items = PySequence_Fast_ITEMS(slice); PyObject *subject = TOP(); - PyObject *items; - if (PyList_CheckExact(subject)) { - items = PyList_GetSlice(subject, start, stop); - if (!items) { - goto error; + if (PyList_CheckExact(subject) || PyTuple_CheckExact(subject)) { + // Fast path for lists and tuples: no errors! + assert(stop <= PySequence_Fast_GET_SIZE(subject)); + PyObject **subject_items = PySequence_Fast_ITEMS(subject); + for (Py_ssize_t i = start; i < stop; i++) { + slice_items[i - start] = subject_items[i]; + Py_INCREF(subject_items[i]); } - assert(PyList_CheckExact(items)); } else { - items = PyList_New(stop - start); - if (!items) { - goto error; - } - PyObject *item; for (Py_ssize_t i = start; i < stop; i++) { - item = PySequence_GetItem(subject, i); - if (!item) { - Py_DECREF(items); + slice_items[i - start] = PySequence_GetItem(subject, i); + if (!slice_items[i - start]) { + Py_DECREF(slice); goto error; } - PyList_SET_ITEM(items, i - start, item); } } - PUSH(items); + PUSH(slice); DISPATCH(); } From 88bd791dd5eb8f79da1c38a556924dd51d3a7c06 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 09:04:05 -0700 Subject: [PATCH 171/218] Don't mark _ as local in patterns --- Include/symtable.h | 1 + Python/symtable.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Include/symtable.h b/Include/symtable.h index abd19a7923e1ba..6f0b7cb8b1c6ac 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -33,6 +33,7 @@ struct symtable { the symbol table */ int recursion_depth; /* current recursion depth */ int recursion_limit; /* recursion limit */ + int in_pattern; /* whether we are currently in a pattern */ }; typedef struct _symtable_entry { diff --git a/Python/symtable.c b/Python/symtable.c index 6f208d3ca7169e..bccdb756581dab 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -240,6 +240,7 @@ symtable_new(void) goto fail; st->st_cur = NULL; st->st_private = NULL; + st->in_pattern = 0; return st; fail: PySymtable_Free(st); @@ -1650,6 +1651,13 @@ symtable_visit_expr(struct symtable *st, expr_ty e) VISIT(st, expr, e->v.Slice.step) break; case Name_kind: + // Don't make "_" a local when used in a pattern: + if (st->in_pattern && + e->v.Name.ctx == Store && + _PyUnicode_EqualToASCIIString(e->v.Name.id, "_")) + { + break; + } if (!symtable_add_def(st, e->v.Name.id, e->v.Name.ctx == Load ? USE : DEF_LOCAL)) VISIT_QUIT(st, 0); @@ -1671,6 +1679,7 @@ symtable_visit_expr(struct symtable *st, expr_ty e) break; case MatchAs_kind: VISIT(st, expr, e->v.MatchAs.pattern); + // "_" is not actually valid, but it's the compiler's job to complain: symtable_add_def(st, e->v.MatchAs.name, DEF_LOCAL); break; } @@ -1794,7 +1803,11 @@ symtable_visit_withitem(struct symtable *st, withitem_ty item) static int symtable_visit_match_case(struct symtable *st, match_case_ty m) { + assert(!st->in_pattern); + st->in_pattern = 1; VISIT(st, expr, m->pattern); + assert(st->in_pattern); + st->in_pattern = 0; if (m->guard) { VISIT(st, expr, m->guard); } From 12b65753145e38d9e4aa93ff8f5f11480b4153fe Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 09:04:43 -0700 Subject: [PATCH 172/218] More cleanup --- Python/ceval.c | 47 ++++++++++++++++++++++++++--------------------- Python/compile.c | 5 ++++- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 2bd7f30976b894..10682d99ceef64 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3533,19 +3533,20 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_LEN): { - Py_ssize_t l = PyObject_Length(TOP()); - if (l < 0) { + // PUSH(len(TOS)) + Py_ssize_t len_i = PyObject_Length(TOP()); + if (len_i < 0) { goto error; } // We might have one or more GET_INDEX_* instructions soon. Cache // the length on the PyInterpreterState struct so they can reuse it: PyInterpreterState *interp = PyInterpreterState_Get(); - interp->get_len = l; - PyObject *len = PyLong_FromSsize_t(l); - if (!len) { + interp->get_len = len_i; + PyObject *len_o = PyLong_FromSsize_t(len_i); + if (!len_o) { goto error; } - PUSH(len); + PUSH(len_o); DISPATCH(); } @@ -3567,6 +3568,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_MAPPING): { + // PUSH(isinstance(TOS, _collections_abc.Mapping)) PyObject *subject = TOP(); // Fast path for dicts: if (PyDict_Check(subject)) { @@ -3596,6 +3598,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQUENCE): { + // PUSH(isinstance(TOS, _collections_abc.Sequence) + // and not isinstance(TOS, (bytearray, bytes, str)) + // and not hasattr(TOS, "__next__")) PyObject *subject = TOP(); // Fast path for lists and tuples: if (PyType_FastSubclass(Py_TYPE(subject), @@ -3618,7 +3623,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } // Lazily import _collections_abc.Sequence, and keep it handy on the - // PyInterpreterState struct (it gets cleaned up at exit): + // PyInterpreterState struct (it gets cleaned up at exit): PyInterpreterState *interp = PyInterpreterState_Get(); if (!interp->seq_abc) { PyObject *abc = PyImport_ImportModule("_collections_abc"); @@ -3686,8 +3691,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // PyInterpreterState struct. In addition to avoiding tons of // redundant __len__ calls, this also handles length changes during // extraction more intuitively. It's also much faster and simpler - // than trying to rotate it around on the stack and pop it off when - // we're done. + // than trying to rotate the length around on the stack and pop it + // off when we're done. PyInterpreterState *interp = PyInterpreterState_Get(); assert(interp->get_len - 1 - oparg >= 0); PyObject *item = PySequence_GetItem(TOP(), interp->get_len - 1 - oparg); @@ -3704,27 +3709,27 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // Ditto GET_INDEX_END's length handling. PyInterpreterState *interp = PyInterpreterState_Get(); Py_ssize_t start = oparg & 0xFF; - Py_ssize_t stop = interp->get_len - (oparg >> 8); - assert(start <= stop); - PyObject *slice = PyList_New(stop - start); + Py_ssize_t size = interp->get_len - (oparg >> 8) - start; + assert(0 <= size); + PyObject *slice = PyList_New(size); if (!slice) { goto error; } PyObject **slice_items = PySequence_Fast_ITEMS(slice); PyObject *subject = TOP(); if (PyList_CheckExact(subject) || PyTuple_CheckExact(subject)) { - // Fast path for lists and tuples: no errors! - assert(stop <= PySequence_Fast_GET_SIZE(subject)); - PyObject **subject_items = PySequence_Fast_ITEMS(subject); - for (Py_ssize_t i = start; i < stop; i++) { - slice_items[i - start] = subject_items[i]; - Py_INCREF(subject_items[i]); + // Fast path for lists and tuples (no errors)! + assert(start + size <= PySequence_Fast_GET_SIZE(subject)); + memcpy(slice_items, &PySequence_Fast_ITEMS(subject)[start], + size * sizeof(PyObject*)); + for (Py_ssize_t i = 0; i < size; i++) { + Py_INCREF(slice_items[i]); } } else { - for (Py_ssize_t i = start; i < stop; i++) { - slice_items[i - start] = PySequence_GetItem(subject, i); - if (!slice_items[i - start]) { + for (Py_ssize_t i = 0; i < size; i++) { + slice_items[i] = PySequence_GetItem(subject, start + i); + if (!slice_items[i]) { Py_DECREF(slice); goto error; } diff --git a/Python/compile.c b/Python/compile.c index 292ea1cb643d0f..dc25b08c54d69b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5662,7 +5662,7 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) PyObject *v = p->v.Constant.value; // Literal True, False, and None are compared by identity. // All others use equality. - ADDOP_COMPARE(c, v == Py_None || PyBool_Check(v) ? Is : Eq); + ADDOP_COMPARE(c, (v == Py_None || PyBool_Check(v)) ? Is : Eq); return 1; } @@ -5946,6 +5946,9 @@ compiler_match(struct compiler *c, stmt_ty s) } +#undef WILDCARD_CHECK + + /* End of the compiler section, beginning of the assembler section */ /* do depth-first search of basic block graph, starting with block. From d394aa489f26d3f063f4b10f3e8c258a2ee6231e Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 09:37:18 -0700 Subject: [PATCH 173/218] Add some tests for non-dict Mappings --- Lib/test/test_patma.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index bae1df45e7313e..6727a2f7113226 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2777,6 +2777,23 @@ def test_patma_274(self): pass """) + def test_patma_275(self): + x = collections.UserDict({0: 1, 2: 3}) + match x: + case {2: 3}: + y = 0 + self.assertEqual(x, {0: 1, 2: 3}) + self.assertEqual(y, 0) + + def test_patma_276(self): + x = collections.UserDict({0: 1, 2: 3}) + match x: + case {2: 3, **z}: + y = 0 + self.assertEqual(x, {0: 1, 2: 3}) + self.assertEqual(y, 0) + self.assertEqual(z, {0: 1}) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments From 2028445b02eb227629f7dabf9fa4717537ab45aa Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 11:38:59 -0700 Subject: [PATCH 174/218] Remove half-finished PyAST_Validate implementation --- Python/ast.c | 122 ++------------------------------------------------- 1 file changed, 4 insertions(+), 118 deletions(-) diff --git a/Python/ast.c b/Python/ast.c index 419eaf5a29ca34..f52f1dfc424dbd 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -310,8 +310,8 @@ validate_expr(expr_ty exp, expr_context_ty ctx) case NamedExpr_kind: return validate_expr(exp->v.NamedExpr.value, Load); case MatchAs_kind: - PyErr_SetString( - PyExc_ValueError, "MatchAs can only be used in match_case patterns"); + PyErr_SetString(PyExc_ValueError, + "MatchAs is only valid in match_case patterns"); return 0; /* This last case doesn't have any checking. */ case Name_kind: @@ -324,122 +324,8 @@ validate_expr(expr_ty exp, expr_context_ty ctx) static int validate_pattern(expr_ty p) { - asdl_expr_seq *keys, *values; - expr_ty key, value; - Py_ssize_t i, size; - switch (p->kind) { - case Attribute_kind: - return validate_expr(p, Load); // TODO - case BinOp_kind: - // TODO - return 1; - case BoolOp_kind: - if (p->v.BoolOp.op != Or) { - PyErr_SetString(PyExc_ValueError, - "BoolOp op in pattern must be Or"); - return 0; - } - values = p->v.BoolOp.values; - size = asdl_seq_LEN(values); - if (size < 2) { - PyErr_SetString(PyExc_ValueError, - "BoolOp must have at least two values"); - return 0; - } - for (i = 0; i < size; i++) { - if (!validate_pattern(asdl_seq_GET(values, i))) { - return 0; - } - } - return 1; - case Call_kind: - // TODO - return 1; - case Constant_kind: - return validate_expr(p, Load); // TODO - case Dict_kind: - keys = p->v.Dict.keys; - values = p->v.Dict.values; - size = asdl_seq_LEN(values); - if (asdl_seq_LEN(keys) != size) { - PyErr_SetString(PyExc_ValueError, - "Dict keys and values must be equal-length"); - return 0; - } - for (i = 0; i < size; i++) { - key = asdl_seq_GET(keys, i); - if (key) { - // TODO: Attribute is valid here, not Name! - // if (key->kind == Name_kind) { - // if (key->v.Name.ctx != Load) { - // PyErr_SetString(PyExc_ValueError, - // "Name ctx in Dict keys pattern must be Load"); - // return 0; - // } - // } - // else if (key->kind != Constant_kind) { - // PyErr_SetString(PyExc_ValueError, - // "Dict keys pattern must be Constant or Name"); - // return 0; - // } - return validate_expr(key, Load); - } - else { - if (i != size - 1) { - // TODO - } - // if (key->kind != Name_kind) { - // // TODO - // } - // if (key->v.Name.ctx != Store) { - // // TODO - // } - } - if (!validate_pattern(asdl_seq_GET(values, i))) { - return 0; - } - } - return 1; - case JoinedStr_kind: - // Not actually valid, but it's the compiler's job to complain: - return 1; - case List_kind: - case Tuple_kind: - values = p->kind == List_kind ? p->v.List.elts : p->v.Tuple.elts; - size = asdl_seq_LEN(values); - for (i = 0; i < size; i++) { - value = asdl_seq_GET(values, i); - if (value->kind == Starred_kind) { - value = value->v.Starred.value; - if (value->kind != Name_kind) { - // TODO - } - if (value->v.Name.ctx != Store) { - // TODO - } - } - if (!validate_pattern(value)) { - return 0; - } - } - return 1; - case Name_kind: - if (p->v.Name.ctx != Load && p->v.Name.ctx != Store) { - PyErr_SetString(PyExc_ValueError, - "Name ctx in pattern must be Load or Store"); - return 0; - } - return validate_expr(p, p->v.Name.ctx); // TODO - case MatchAs_kind: - return validate_pattern(p->v.MatchAs.pattern) - && validate_name(p->v.MatchAs.name); - case UnaryOp_kind: - // TODO - return 1; - default: - PyErr_SetString(PyExc_ValueError, "invalid Match pattern"); - return 0; - } + // Coming soon (thanks Batuhan)! + return 1; } static int From 20b59b214f1790603ad72bd09dc1f3510684e0d1 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 12:55:23 -0700 Subject: [PATCH 175/218] Remove some questionable fast paths --- Python/ceval.c | 80 +++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 10682d99ceef64..5710c56b538d54 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -842,20 +842,16 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) if (!nkeys) { return PyTuple_New(0); } - PyObject *get = NULL; - PyObject *dummy = NULL; PyObject *seen = NULL; PyObject *values = NULL; - if (!PyDict_CheckExact(map)) { - _Py_IDENTIFIER(get); - get = _PyObject_GetAttrId(map, &PyId_get); - if (!get) { - return NULL; - } - dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); - if (!dummy) { - goto fail; - } + _Py_IDENTIFIER(get); + PyObject *get = _PyObject_GetAttrId(map, &PyId_get); + if (!get) { + return NULL; + } + PyObject *dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); + if (!dummy) { + goto fail; } seen = PySet_New(NULL); if (!seen) { @@ -875,30 +871,19 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) } goto fail; } - if (!get) { - assert(PyDict_CheckExact(map)); - value = PyDict_GetItemWithError(map, key); - if (!value) { - goto fail; - } - Py_INCREF(value); - } - else { - assert(dummy); - value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); - if (!value || value == dummy) { - Py_XDECREF(value); - goto fail; - } + value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); + if (!value || value == dummy) { + Py_XDECREF(value); + goto fail; } PyTuple_SET_ITEM(values, i, value); } - Py_XDECREF(get); - Py_XDECREF(dummy); + Py_DECREF(get); + Py_DECREF(dummy); Py_DECREF(seen); return values; fail: - Py_XDECREF(get); + Py_DECREF(get); Py_XDECREF(dummy); Py_XDECREF(seen); Py_XDECREF(values); @@ -3538,8 +3523,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (len_i < 0) { goto error; } - // We might have one or more GET_INDEX_* instructions soon. Cache - // the length on the PyInterpreterState struct so they can reuse it: + // We might have one or more GET_INDEX_* instructions coming up. + // Cache the length on the PyInterpreterState struct so they can + // reuse it: PyInterpreterState *interp = PyInterpreterState_Get(); interp->get_len = len_i; PyObject *len_o = PyLong_FromSsize_t(len_i); @@ -3551,6 +3537,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_CLASS): { + // TODO PyObject *names = TOP(); PyObject *type = SECOND(); PyObject *subject = THIRD(); @@ -3644,6 +3631,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_KEYS): { + // TODO PyObject *keys = TOP(); PyObject *subject = SECOND(); PyObject *values = match_map_items(tstate, subject, keys); @@ -3715,25 +3703,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (!slice) { goto error; } - PyObject **slice_items = PySequence_Fast_ITEMS(slice); PyObject *subject = TOP(); - if (PyList_CheckExact(subject) || PyTuple_CheckExact(subject)) { - // Fast path for lists and tuples (no errors)! - assert(start + size <= PySequence_Fast_GET_SIZE(subject)); - memcpy(slice_items, &PySequence_Fast_ITEMS(subject)[start], - size * sizeof(PyObject*)); - for (Py_ssize_t i = 0; i < size; i++) { - Py_INCREF(slice_items[i]); - } - } - else { - for (Py_ssize_t i = 0; i < size; i++) { - slice_items[i] = PySequence_GetItem(subject, start + i); - if (!slice_items[i]) { - Py_DECREF(slice); - goto error; - } + // NOTE: Fast path for lists and tuples showed no perf improvement, + // likely because test_patma's star-unpacking examples are too small + // to make a difference. It will be interesting to see if real-world + // code commonly uses star-unpacking in patterns with big list/tuple + // subjects. A fast path could pay off, if so. + for (Py_ssize_t i = 0; i < size; i++) { + PyObject *item = PySequence_GetItem(subject, start + i); + if (!item) { + Py_DECREF(slice); + goto error; } + PyList_SET_ITEM(slice, i, item); } PUSH(slice); DISPATCH(); From b42a3ac222efe36b9d2f721949d9c462b95d5c3e Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 12:55:33 -0700 Subject: [PATCH 176/218] Add test_patma to PGO --- Lib/test/libregrtest/pgo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/libregrtest/pgo.py b/Lib/test/libregrtest/pgo.py index 379ff05fb955a5..582e812e284cc9 100644 --- a/Lib/test/libregrtest/pgo.py +++ b/Lib/test/libregrtest/pgo.py @@ -35,6 +35,7 @@ 'test_memoryview', 'test_operator', 'test_ordered_dict', + 'test_patma', 'test_pickle', 'test_pprint', 'test_re', From ccb5d907c25f5fa425f276d443a032c5b82b59bc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 17:27:18 -0700 Subject: [PATCH 177/218] Clean up SyntaxErroring --- Python/compile.c | 59 +++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index dc25b08c54d69b..9d638fe2a82c8e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -203,7 +203,7 @@ struct compiler { typedef struct { PyObject *stores; - int irrefutable; + int allow_irrefutable; } pattern_context; static int compiler_enter_scope(struct compiler *, identifier, int, void *, int); @@ -5481,13 +5481,13 @@ static int pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); - assert(PyBool_Check(p->v.Constant.value) || + assert(p->v.Constant.value == Py_None || + PyBool_Check(p->v.Constant.value) || PyBytes_CheckExact(p->v.Constant.value) || PyComplex_CheckExact(p->v.Constant.value) || PyFloat_CheckExact(p->v.Constant.value) || PyLong_CheckExact(p->v.Constant.value) || - PyUnicode_CheckExact(p->v.Constant.value) || - p->v.Constant.value == Py_None); + PyUnicode_CheckExact(p->v.Constant.value)); ADDOP_LOAD_CONST(c, p->v.Constant.value); return 1; } @@ -5497,8 +5497,8 @@ static int pattern_store_name(struct compiler *c, identifier n, pattern_context *pc) { if (_PyUnicode_EqualToASCIIString(n, "_")) { - const char *e = "can't assign to '_' here; consider removing or " - "renaming?"; + const char *e = "can't assign to '_' here " + "(consider removing or renaming)"; return compiler_error(c, e); } if (!pc->stores) { @@ -5544,19 +5544,15 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); assert(size > 1); PyObject *stores_init = pc->stores; - assert(!pc->irrefutable); + int allow_irrefutable = pc->allow_irrefutable; expr_ty alt; for (Py_ssize_t i = 0; i < size; i++) { - // Can't use our helpful returning macros here (they'll leak sets): + // Can't use our helpful returning macros here: they'll leak sets! alt = asdl_seq_GET(p->v.BoolOp.values, i); pc->stores = PySet_New(stores_init); + // An irrefutable sub-pattern must be last, if it is allowed at all: + pc->allow_irrefutable = allow_irrefutable && (i == size - 1); SET_LOC(c, alt); - if (pc->irrefutable) { - const char *e = "the previous pattern always matches, making this " - "one unreachable"; - compiler_error(c, e); - goto fail; - } if (!pc->stores || !compiler_pattern(c, alt, pc) || !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || @@ -5584,6 +5580,7 @@ compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) } Py_XDECREF(stores_init); pc->stores = control; + pc->allow_irrefutable = allow_irrefutable; ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; @@ -5601,7 +5598,8 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { Py_ssize_t nargs = asdl_seq_LEN(args); Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); if (nargs + nkwargs > INT_MAX) { - return compiler_error(c, "too many sub-patterns in class pattern"); + const char *e = "too many sub-patterns in class pattern %R"; + return compiler_error(c, e, p->v.Call.func); } basicblock *block, *end; CHECK(!validate_keywords(c, kwargs)); @@ -5694,8 +5692,8 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) for (i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); if (!key) { - const char *e = "can't use starred pattern here; consider " - "moving to end?"; + const char *e = "can't use starred name here " + "(consider moving to end)"; return compiler_error(c, e); } if (key->kind == Attribute_kind) { @@ -5754,7 +5752,8 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) continue; } if (star >= 0) { - return compiler_error(c, "multiple starred names in pattern"); + const char *e = "multiple starred names in sequence pattern"; + return compiler_error(c, e); } star = i; } @@ -5817,7 +5816,10 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); - pc->irrefutable = 1; + if (!pc->allow_irrefutable) { + const char *e = "name capture %R makes remaining patterns unreachable"; + return compiler_error(c, e, p->v.Name.id); + } if (!WILDCARD_CHECK(p)) { ADDOP(c, DUP_TOP); CHECK(pattern_store_name(c, p->v.Name.id, pc)); @@ -5847,9 +5849,10 @@ compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) static int compiler_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(!pc->irrefutable); + int allow_irrefutable = pc->allow_irrefutable; + pc->allow_irrefutable = 1; CHECK(compiler_pattern(c, p, pc)); - pc->irrefutable = 0; + pc->allow_irrefutable = allow_irrefutable; return 1; } @@ -5897,7 +5900,6 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; - pc.irrefutable = 0; pc.stores = NULL; int result; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); @@ -5905,19 +5907,15 @@ compiler_match(struct compiler *c, stmt_ty s) for (Py_ssize_t i = 0; i < cases - has_default; i++) { m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); - if (pc.irrefutable) { - const char *e = "the previous case always matches, making this one " - "unreachable"; - CHECK(compiler_error(c, e)); - } CHECK(next = compiler_new_block(c)); + // An irrefutable case must be either guarded, last, or both: + pc.allow_irrefutable = !!m->guard || (i == cases - 1); result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); CHECK(result); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, next); NEXT_BLOCK(c); if (m->guard) { - pc.irrefutable = 0; CHECK(compiler_jump_if(c, m->guard, next, 0)); } ADDOP(c, POP_TOP); @@ -5931,11 +5929,6 @@ compiler_match(struct compiler *c, stmt_ty s) // pushing and popping in the loop above: m = asdl_seq_GET(s->v.Match.cases, cases - 1); SET_LOC(c, m->pattern); - if (pc.irrefutable) { - const char *e = "the previous case always matches, making this one " - "unreachable"; - CHECK(compiler_error(c, e)); - } if (m->guard) { CHECK(compiler_jump_if(c, m->guard, end, 0)); } From 7a97a1f19217394b46ecc9d7a64011abaf5415bc Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 18:03:11 -0700 Subject: [PATCH 178/218] Unsafe caching strikes again --- Lib/importlib/_bootstrap_external.py | 4 ++-- Python/ceval.c | 29 ++++++++++++++-------------- Python/compile.c | 25 ++++++++++++++++++------ Python/importlib_external.h | 2 +- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 588141213a1899..2afa5b258eb973 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,7 +278,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) -# Python 3.10a1 3470 (add structural pattern matching) +# Python 3.10a1 3471 (add structural pattern matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -288,7 +288,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3470).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3471).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/ceval.c b/Python/ceval.c index 5710c56b538d54..3f3d28fb47238f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3523,11 +3523,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (len_i < 0) { goto error; } - // We might have one or more GET_INDEX_* instructions coming up. - // Cache the length on the PyInterpreterState struct so they can - // reuse it: - PyInterpreterState *interp = PyInterpreterState_Get(); - interp->get_len = len_i; PyObject *len_o = PyLong_FromSsize_t(len_i); if (!len_o) { goto error; @@ -3672,18 +3667,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_END): { - // PUSH(TOS[len(TOS) - 1 - oparg]) + // PUSH(TOS[TOS1 - 1 - oparg]) // NOTE: We can't rely on support for negative indexing! // Although PySequence_GetItem tries to correct negative indexes, we // just use the length we already have cached from GET_LEN on the // PyInterpreterState struct. In addition to avoiding tons of // redundant __len__ calls, this also handles length changes during - // extraction more intuitively. It's also much faster and simpler - // than trying to rotate the length around on the stack and pop it - // off when we're done. - PyInterpreterState *interp = PyInterpreterState_Get(); - assert(interp->get_len - 1 - oparg >= 0); - PyObject *item = PySequence_GetItem(TOP(), interp->get_len - 1 - oparg); + // extraction more intuitively. + Py_ssize_t len = PyLong_AsSsize_t(SECOND()); + if (len < 0) { + goto error; + } + assert(0 <= len - 1 - oparg); + PyObject *item = PySequence_GetItem(TOP(), len - 1 - oparg); if (!item) { goto error; } @@ -3692,12 +3688,15 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(GET_INDEX_SLICE): { - // PUSH(list(TOS[oparg & 0xFF: len(TOS) - (oparg >> 8)])) + // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) // NOTE: We can't rely on support for slicing or negative indexing! // Ditto GET_INDEX_END's length handling. - PyInterpreterState *interp = PyInterpreterState_Get(); + Py_ssize_t len = PyLong_AsSsize_t(SECOND()); + if (len < 0) { + goto error; + } Py_ssize_t start = oparg & 0xFF; - Py_ssize_t size = interp->get_len - (oparg >> 8) - start; + Py_ssize_t size = len - (oparg >> 8) - start; assert(0 <= size); PyObject *slice = PyList_New(size); if (!slice) { diff --git a/Python/compile.c b/Python/compile.c index 9d638fe2a82c8e..9130f9a00457b0 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5743,7 +5743,8 @@ static int compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); - asdl_expr_seq *values = p->kind == Tuple_kind ? p->v.Tuple.elts : p->v.List.elts; + asdl_expr_seq *values = (p->kind == Tuple_kind) ? p->v.Tuple.elts + : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); Py_ssize_t star = -1; for (Py_ssize_t i = 0; i < size; i++) { @@ -5757,7 +5758,7 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) } star = i; } - basicblock *end; + basicblock *wrong_size, *end, *fail; CHECK(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); @@ -5769,6 +5770,9 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) compiler_use_next_block(c, end); return 1; } + CHECK(fail = compiler_new_block(c)); + CHECK(wrong_size = compiler_new_block(c)); + ADDOP(c, DUP_TOP) if (star < 0) { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); @@ -5777,8 +5781,9 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); } - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, wrong_size); NEXT_BLOCK(c); + ADDOP(c, ROT_TWO); for (Py_ssize_t i = 0; i < size; i++) { // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) expr_ty value = asdl_seq_GET(values, i); @@ -5800,12 +5805,20 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_I(c, GET_INDEX_END, size - 1 - i); } CHECK(compiler_subpattern(c, value, pc)); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail) NEXT_BLOCK(c); + ADDOP(c, POP_TOP); } + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail); + ADDOP(c, POP_TOP); + ADDOP(c, ROT_TWO); + compiler_use_next_block(c, wrong_size); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 36e58673c584bd..bfe027cd6a128b 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -285,7 +285,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,13,95,119,114,105,116,101,95,97,116,111,109,105,99, 120,0,0,0,115,28,0,0,0,0,5,16,1,6,1,22, 255,4,2,2,3,14,1,40,1,16,1,12,1,2,1,14, - 1,12,1,6,1,114,69,0,0,0,105,142,13,0,0,114, + 1,12,1,6,1,114,69,0,0,0,105,143,13,0,0,114, 28,0,0,0,114,17,0,0,0,115,2,0,0,0,13,10, 90,11,95,95,112,121,99,97,99,104,101,95,95,122,4,111, 112,116,45,122,3,46,112,121,122,4,46,112,121,99,78,41, From ff011e007fd14f9ebb6b7d91f1d346452b4ac7ef Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 18:06:21 -0700 Subject: [PATCH 179/218] Fix comment --- Python/ceval.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 3f3d28fb47238f..36eaa3643acf2c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3670,10 +3670,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // PUSH(TOS[TOS1 - 1 - oparg]) // NOTE: We can't rely on support for negative indexing! // Although PySequence_GetItem tries to correct negative indexes, we - // just use the length we already have cached from GET_LEN on the - // PyInterpreterState struct. In addition to avoiding tons of - // redundant __len__ calls, this also handles length changes during - // extraction more intuitively. + // just use the length we already have at TOS1. In addition to + // avoiding tons of redundant __len__ calls, this also handles + // length changes during extraction more intuitively. + assert(PyLong_CheckExact(SECOND())); Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; @@ -3691,6 +3691,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) // NOTE: We can't rely on support for slicing or negative indexing! // Ditto GET_INDEX_END's length handling. + assert(PyLong_CheckExact(SECOND())); Py_ssize_t len = PyLong_AsSsize_t(SECOND()); if (len < 0) { goto error; From 99ae758db9de436d35e56dc33e9baed9b6229638 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 18:11:37 -0700 Subject: [PATCH 180/218] Remove unused get_len member --- Include/internal/pycore_interp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 38713c4be8a2f4..55745f110d3b4e 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -193,7 +193,6 @@ struct _is { // Kept handy for pattern matching: PyObject *map_abc; // _collections_abc.Mapping PyObject *seq_abc; // _collections_abc.Sequence - Py_ssize_t get_len; // Cached length of subject /* Used in Modules/_threadmodule.c. */ long num_threads; From ad844037c0a6f3aca9b99f12e9038195b1aa208c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Oct 2020 22:48:33 -0700 Subject: [PATCH 181/218] Rename simple match flag --- Include/object.h | 2 +- Objects/bytearrayobject.c | 2 +- Objects/bytesobject.c | 2 +- Objects/dictobject.c | 2 +- Objects/floatobject.c | 2 +- Objects/listobject.c | 2 +- Objects/longobject.c | 2 +- Objects/setobject.c | 7 +++---- Objects/tupleobject.c | 2 +- Objects/typeobject.c | 4 ++-- Objects/unicodeobject.c | 2 +- Python/ceval.c | 2 +- 12 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Include/object.h b/Include/object.h index b53949692105d4..615eaeb77bfa6d 100644 --- a/Include/object.h +++ b/Include/object.h @@ -359,7 +359,7 @@ given type object has a specified feature. // This undocumented flag gives certain built-ins their unique pattern-matching // behavior, which allows a single positional subpattern to match against the // match proxy itself (rather than a mapped attribute on it): -#define _Py_TPFLAGS_SIMPLE_MATCH (1UL << 21) +#define _Py_TPFLAGS_MATCH_SELF (1UL << 21) /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 61c6513c9dc0e2..2b9a79060490e5 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2341,7 +2341,7 @@ PyTypeObject PyByteArray_Type = { 0, /* tp_setattro */ &bytearray_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ bytearray_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 9fd25dbc828392..a9c18d5c852b79 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2942,7 +2942,7 @@ PyTypeObject PyBytes_Type = { &bytes_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_BYTES_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ bytes_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 94d398aaa09c01..790869478d6e77 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3503,7 +3503,7 @@ PyTypeObject PyDict_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ dictionary_doc, /* tp_doc */ dict_traverse, /* tp_traverse */ dict_tp_clear, /* tp_clear */ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 6ab08399d8775f..fcc1b68d5883a3 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1937,7 +1937,7 @@ PyTypeObject PyFloat_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ float_new__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/listobject.c b/Objects/listobject.c index c3c6f2574b800a..c3aa41aac8cbba 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -3053,7 +3053,7 @@ PyTypeObject PyList_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ list___init____doc__, /* tp_doc */ (traverseproc)list_traverse, /* tp_traverse */ (inquiry)_list_clear, /* tp_clear */ diff --git a/Objects/longobject.c b/Objects/longobject.c index aa4cb85dd6867e..741ea60aec0b2b 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5648,7 +5648,7 @@ PyTypeObject PyLong_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LONG_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ long_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/setobject.c b/Objects/setobject.c index 9513871cfe7ef8..c235aaf6618f13 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2092,10 +2092,9 @@ PyTypeObject PySet_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | - Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ set_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_clear_internal, /* tp_clear */ @@ -2196,7 +2195,7 @@ PyTypeObject PyFrozenSet_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ frozenset_doc, /* tp_doc */ (traverseproc)set_traverse, /* tp_traverse */ (inquiry)set_clear_internal, /* tp_clear */ diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 605551af6dd753..8d04ebfbd8c150 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -918,7 +918,7 @@ PyTypeObject PyTuple_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ tuple_new__doc__, /* tp_doc */ (traverseproc)tupletraverse, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7c34f653ba192d..f3a2380f488c65 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5173,8 +5173,8 @@ inherit_special(PyTypeObject *type, PyTypeObject *base) else if (PyType_IsSubtype(base, &PyDict_Type)) type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS; - if (PyType_HasFeature(base, _Py_TPFLAGS_SIMPLE_MATCH)) { - type->tp_flags |= _Py_TPFLAGS_SIMPLE_MATCH; + if (PyType_HasFeature(base, _Py_TPFLAGS_MATCH_SELF)) { + type->tp_flags |= _Py_TPFLAGS_MATCH_SELF; } } diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f29cc799787404..ecff587d57f26d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -15629,7 +15629,7 @@ PyTypeObject PyUnicode_Type = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_UNICODE_SUBCLASS | - _Py_TPFLAGS_SIMPLE_MATCH, /* tp_flags */ + _Py_TPFLAGS_MATCH_SELF, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ diff --git a/Python/ceval.c b/Python/ceval.c index 36eaa3643acf2c..e2b0b2771d3e91 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -984,7 +984,7 @@ do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *ty if (!nmatch_args) { Py_DECREF(match_args); nmatch_args = PyType_HasFeature((PyTypeObject *)type, - _Py_TPFLAGS_SIMPLE_MATCH); + _Py_TPFLAGS_MATCH_SELF); args = NULL; } else { From 1b0602fa5e8e4e91cc1176e749e3f01d2092055e Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 11:05:20 -0700 Subject: [PATCH 182/218] BoolOp -> MatchOr and fix constant folding --- Grammar/python.gram | 2 +- Include/Python-ast.h | 9 +++- Lib/ast.py | 32 +++++---------- Lib/test/test_patma.py | 9 ++++ Parser/Python.asdl | 3 +- Parser/parser.c | 2 +- Python/Python-ast.c | 93 +++++++++++++++++++++++++++++++++++++++++- Python/ast.c | 4 ++ Python/ast_opt.c | 37 ++++++++++++++--- Python/compile.c | 18 ++++---- Python/symtable.c | 3 ++ 11 files changed, 171 insertions(+), 41 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index a470fb4a1b540b..2f4b5de2ef1a9e 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -221,7 +221,7 @@ pattern[expr_ty]: or_pattern[expr_ty]: | values[asdl_expr_seq*]='|'.closed_pattern+ { - asdl_seq_LEN(values) == 1 ? asdl_seq_GET(values, 0) : _Py_BoolOp(Or, values, EXTRA) } + asdl_seq_LEN(values) == 1 ? asdl_seq_GET(values, 0) : _Py_MatchOr(values, EXTRA) } closed_pattern[expr_ty]: | name_pattern diff --git a/Include/Python-ast.h b/Include/Python-ast.h index 25f2deed378fff..f9f15ab5125a20 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -327,7 +327,7 @@ enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4, FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20, Attribute_kind=21, Subscript_kind=22, Starred_kind=23, Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27, - MatchAs_kind=28}; + MatchAs_kind=28, MatchOr_kind=29}; struct _expr { enum _expr_kind kind; union { @@ -475,6 +475,10 @@ struct _expr { identifier name; } MatchAs; + struct { + asdl_expr_seq *patterns; + } MatchOr; + } v; int lineno; int col_offset; @@ -778,6 +782,9 @@ expr_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int expr_ty _Py_MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); +#define MatchOr(a0, a1, a2, a3, a4, a5) _Py_MatchOr(a0, a1, a2, a3, a4, a5) +expr_ty _Py_MatchOr(asdl_expr_seq * patterns, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); #define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4) comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, PyArena *arena); diff --git a/Lib/ast.py b/Lib/ast.py index cc9c57752776c6..1f71b452db99c5 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -673,7 +673,6 @@ def __init__(self): self._precedences = {} self._type_ignores = {} self._indent = 0 - self._pattern = False def interleave(self, inter, f, seq): """Call f on each item in seq, calling inter() in between.""" @@ -735,18 +734,6 @@ def block(self, *, extra = None): yield self._indent -= 1 - @contextmanager - def pattern(self): - assert not self._pattern - self._pattern = True - yield - assert self._pattern - self._pattern = False - - @property - def in_pattern(self): - return self._pattern - @contextmanager def delimit(self, start, end): """A context manager for preparing the source for expressions. It adds @@ -1347,12 +1334,8 @@ def visit_Compare(self, node): boolop_precedence = {"and": _Precedence.AND, "or": _Precedence.OR} def visit_BoolOp(self, node): - if self.in_pattern: - operator = "|" - operator_precedence = _Precedence.OR - else: - operator = self.boolops[node.op.__class__.__name__] - operator_precedence = self.boolop_precedence[operator] + operator = self.boolops[node.op.__class__.__name__] + operator_precedence = self.boolop_precedence[operator] def increasing_level_traverse(node): nonlocal operator_precedence @@ -1523,8 +1506,7 @@ def visit_withitem(self, node): def visit_match_case(self, node): self.fill("case ") - with self.pattern(): - self.traverse(node.pattern) + self.traverse(node.pattern) if node.guard: self.write(" if ") self.traverse(node.guard) @@ -1532,10 +1514,16 @@ def visit_match_case(self, node): self.traverse(node.body) def visit_MatchAs(self, node): - with self.require_parens(_Precedence.TUPLE, node): + with self.require_parens(_Precedence.TEST, node): + self.set_precedence(_Precedence.EXPR, node.pattern) self.traverse(node.pattern) self.write(f" as {node.name}") + def visit_MatchOr(self, node): + with self.require_parens(_Precedence.EXPR, node): + self.set_precedence(_Precedence.ATOM, *node.patterns) + self.interleave(lambda: self.write(" | "), self.traverse, node.patterns) + def unparse(ast_obj): unparser = _Unparser() return unparser.visit(ast_obj) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 6727a2f7113226..cb735efc8fcf65 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2794,6 +2794,15 @@ def test_patma_276(self): self.assertEqual(y, 0) self.assertEqual(z, {0: 1}) + def test_patma_277(self): + x = [[{0: 0}]] + match x: + case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]): + y = 0 + self.assertEqual(x, [[{0: 0}]]) + self.assertEqual(y, 0) + self.assertEqual(z, 0) + # TODO: Better use of assertIs # TODO: Don't check side-effecty assignments diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 8b0c1ef7ba60eb..ddc019da48e8ae 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -89,8 +89,9 @@ module Python -- can appear only in Subscript | Slice(expr? lower, expr? upper, expr? step) - -- only used for named patterns + -- only used in patterns | MatchAs(expr pattern, identifier name) + | MatchOr(expr* patterns) -- col_offset is the byte offset in the utf8 string the parser uses attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset) diff --git a/Parser/parser.c b/Parser/parser.c index 2b7ca3dcd99389..9c46f3bd11133a 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -5267,7 +5267,7 @@ or_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = asdl_seq_LEN ( values ) == 1 ? asdl_seq_GET ( values , 0 ) : _Py_BoolOp ( Or , values , EXTRA ); + _res = asdl_seq_LEN ( values ) == 1 ? asdl_seq_GET ( values , 0 ) : _Py_MatchOr ( values , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); diff --git a/Python/Python-ast.c b/Python/Python-ast.c index e81247dc8a6519..55ca099b02a638 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -88,6 +88,7 @@ typedef struct { PyObject *MatMult_singleton; PyObject *MatMult_type; PyObject *MatchAs_type; + PyObject *MatchOr_type; PyObject *Match_type; PyObject *Mod_singleton; PyObject *Mod_type; @@ -207,6 +208,7 @@ typedef struct { PyObject *optional_vars; PyObject *orelse; PyObject *pattern; + PyObject *patterns; PyObject *posonlyargs; PyObject *returns; PyObject *right; @@ -341,6 +343,7 @@ void _PyAST_Fini(PyThreadState *tstate) Py_CLEAR(state->MatMult_singleton); Py_CLEAR(state->MatMult_type); Py_CLEAR(state->MatchAs_type); + Py_CLEAR(state->MatchOr_type); Py_CLEAR(state->Match_type); Py_CLEAR(state->Mod_singleton); Py_CLEAR(state->Mod_type); @@ -460,6 +463,7 @@ void _PyAST_Fini(PyThreadState *tstate) Py_CLEAR(state->optional_vars); Py_CLEAR(state->orelse); Py_CLEAR(state->pattern); + Py_CLEAR(state->patterns); Py_CLEAR(state->posonlyargs); Py_CLEAR(state->returns); Py_CLEAR(state->right); @@ -549,6 +553,7 @@ static int init_identifiers(astmodulestate *state) if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return 0; if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return 0; if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return 0; + if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return 0; if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return 0; if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return 0; if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 0; @@ -842,6 +847,9 @@ static const char * const MatchAs_fields[]={ "pattern", "name", }; +static const char * const MatchOr_fields[]={ + "patterns", +}; static PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty); static PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty); static PyObject* ast2obj_operator(astmodulestate *state, operator_ty); @@ -1481,7 +1489,8 @@ static int init_types(astmodulestate *state) " | List(expr* elts, expr_context ctx)\n" " | Tuple(expr* elts, expr_context ctx)\n" " | Slice(expr? lower, expr? upper, expr? step)\n" - " | MatchAs(expr pattern, identifier name)"); + " | MatchAs(expr pattern, identifier name)\n" + " | MatchOr(expr* patterns)"); if (!state->expr_type) return 0; if (!add_attributes(state, state->expr_type, expr_attributes, 4)) return 0; if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1) @@ -1618,6 +1627,10 @@ static int init_types(astmodulestate *state) MatchAs_fields, 2, "MatchAs(expr pattern, identifier name)"); if (!state->MatchAs_type) return 0; + state->MatchOr_type = make_type(state, "MatchOr", state->expr_type, + MatchOr_fields, 1, + "MatchOr(expr* patterns)"); + if (!state->MatchOr_type) return 0; state->expr_context_type = make_type(state, "expr_context", state->AST_type, NULL, 0, "expr_context = Load | Store | Del"); @@ -3336,6 +3349,23 @@ MatchAs(expr_ty pattern, identifier name, int lineno, int col_offset, int return p; } +expr_ty +MatchOr(asdl_expr_seq * patterns, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena) +{ + expr_ty p; + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = MatchOr_kind; + p->v.MatchOr.patterns = patterns; + p->lineno = lineno; + p->col_offset = col_offset; + p->end_lineno = end_lineno; + p->end_col_offset = end_col_offset; + return p; +} + comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int is_async, PyArena *arena) @@ -4582,6 +4612,17 @@ ast2obj_expr(astmodulestate *state, void* _o) goto failed; Py_DECREF(value); break; + case MatchOr_kind: + tp = (PyTypeObject *)state->MatchOr_type; + result = PyType_GenericNew(tp, NULL, NULL); + if (!result) goto failed; + value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns, + ast2obj_expr); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->patterns, value) == -1) + goto failed; + Py_DECREF(value); + break; } value = ast2obj_int(state, o->lineno); if (!value) goto failed; @@ -8845,6 +8886,52 @@ obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena) if (*out == NULL) goto failed; return 0; } + tp = state->MatchOr_type; + isinstance = PyObject_IsInstance(obj, tp); + if (isinstance == -1) { + return 1; + } + if (isinstance) { + asdl_expr_seq* patterns; + + if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchOr"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "MatchOr field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + patterns = _Py_asdl_expr_seq_new(len, arena); + if (patterns == NULL) goto failed; + for (i = 0; i < len; i++) { + expr_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + res = obj2ast_expr(state, tmp2, &val, arena); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "MatchOr field \"patterns\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(patterns, i, val); + } + Py_CLEAR(tmp); + } + *out = MatchOr(patterns, lineno, col_offset, end_lineno, + end_col_offset, arena); + if (*out == NULL) goto failed; + return 0; + } PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj); failed: @@ -10307,6 +10394,10 @@ astmodule_exec(PyObject *m) return -1; } Py_INCREF(state->MatchAs_type); + if (PyModule_AddObject(m, "MatchOr", state->MatchOr_type) < 0) { + return -1; + } + Py_INCREF(state->MatchOr_type); if (PyModule_AddObject(m, "expr_context", state->expr_context_type) < 0) { return -1; } diff --git a/Python/ast.c b/Python/ast.c index f52f1dfc424dbd..9133aaea88634c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -313,6 +313,10 @@ validate_expr(expr_ty exp, expr_context_ty ctx) PyErr_SetString(PyExc_ValueError, "MatchAs is only valid in match_case patterns"); return 0; + case MatchOr_kind: + PyErr_SetString(PyExc_ValueError, + "MatchOr is only valid in match_case patterns"); + return 0; /* This last case doesn't have any checking. */ case Name_kind: return 1; diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 9e451b57491017..0d7351f602e0af 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -395,6 +395,7 @@ static int astfold_keyword(keyword_ty node_, PyArena *ctx_, _PyASTOptimizeState static int astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); +static int astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state); #define CALL(FUNC, TYPE, ARG) \ if (!FUNC((ARG), ctx_, state)) \ @@ -772,30 +773,56 @@ astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state return make_const(node_, new, ctx_); } +static int +astfold_pattern_keyword(keyword_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) +{ + CALL(astfold_pattern, expr_ty, node_->value); + return 1; +} + static int astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { // Don't blindly optimize the pattern as an expr; it plays by its own rules! switch (node_->kind) { case Attribute_kind: - return 1; + break; case BinOp_kind: CALL(astfold_pattern_complex, expr_ty, node_); - return 1; - case BoolOp_kind: + break; case Call_kind: + CALL_SEQ(astfold_pattern, expr, node_->v.Call.args); + CALL_SEQ(astfold_pattern_keyword, keyword, node_->v.Call.keywords); + break; case Constant_kind: + break; case Dict_kind: + CALL_SEQ(astfold_pattern, expr, node_->v.Dict.keys); + CALL_SEQ(astfold_pattern, expr, node_->v.Dict.values); + break; // Not actually valid, but it's the compiler's job to complain: case JoinedStr_kind: + break; case List_kind: + CALL_SEQ(astfold_pattern, expr, node_->v.List.elts); + break; case MatchAs_kind: + CALL(astfold_pattern, expr_ty, node_->v.MatchAs.pattern); + break; + case MatchOr_kind: + CALL_SEQ(astfold_pattern, expr, node_->v.MatchOr.patterns); + break; case Name_kind: + break; + case Starred_kind: + CALL(astfold_pattern, expr_ty, node_->v.Starred.value); + break; case Tuple_kind: - return 1; + CALL_SEQ(astfold_pattern, expr, node_->v.Tuple.elts); + break; case UnaryOp_kind: CALL(astfold_pattern_negative, expr_ty, node_); - return 1; + break; default: Py_UNREACHABLE(); } diff --git a/Python/compile.c b/Python/compile.c index 9130f9a00457b0..df19167343b3d8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5133,6 +5133,7 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) case Tuple_kind: return compiler_tuple(c, e); case MatchAs_kind: + case MatchOr_kind: // Can only occur in patterns, which are handled elsewhere. Py_UNREACHABLE(); } @@ -5533,22 +5534,21 @@ compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) static int -compiler_pattern_boolop(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_match_or(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == BoolOp_kind); - assert(p->v.BoolOp.op == Or); + assert(p->kind == MatchOr_kind); basicblock *end; PyObject *control = NULL; PyObject *diff; CHECK(end = compiler_new_block(c)); - Py_ssize_t size = asdl_seq_LEN(p->v.BoolOp.values); + Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns); assert(size > 1); PyObject *stores_init = pc->stores; int allow_irrefutable = pc->allow_irrefutable; expr_ty alt; for (Py_ssize_t i = 0; i < size; i++) { // Can't use our helpful returning macros here: they'll leak sets! - alt = asdl_seq_GET(p->v.BoolOp.values, i); + alt = asdl_seq_GET(p->v.MatchOr.patterns, i); pc->stores = PySet_New(stores_init); // An irrefutable sub-pattern must be last, if it is allowed at all: pc->allow_irrefutable = allow_irrefutable && (i == size - 1); @@ -5843,7 +5843,7 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) static int -compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_match_as(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == MatchAs_kind); basicblock *end; @@ -5880,8 +5880,6 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) case BinOp_kind: // Because we allow "2+2j", things like "2+2" make it this far: return compiler_error(c, "patterns cannot include operators"); - case BoolOp_kind: - return compiler_pattern_boolop(c, p, pc); case Call_kind: return compiler_pattern_call(c, p, pc); case Constant_kind: @@ -5895,7 +5893,9 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) case Tuple_kind: return compiler_pattern_list_tuple(c, p, pc); case MatchAs_kind: - return compiler_pattern_as(c, p, pc); + return compiler_pattern_match_as(c, p, pc); + case MatchOr_kind: + return compiler_pattern_match_or(c, p, pc); case Name_kind: return compiler_pattern_name(c, p, pc); default: diff --git a/Python/symtable.c b/Python/symtable.c index bccdb756581dab..3521f3aa524aa6 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1682,6 +1682,9 @@ symtable_visit_expr(struct symtable *st, expr_ty e) // "_" is not actually valid, but it's the compiler's job to complain: symtable_add_def(st, e->v.MatchAs.name, DEF_LOCAL); break; + case MatchOr_kind: + VISIT_SEQ(st, expr, e->v.MatchOr.patterns); + break; } VISIT_QUIT(st, 1); } From e212cebcf05afd925bba2dabb3c038cc62bb2c9e Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 12:49:07 -0700 Subject: [PATCH 183/218] Minor cleanup --- Include/object.h | 2 +- Lib/dataclasses.py | 13 +++++-------- Python/ast.c | 6 ++---- Python/ast_opt.c | 2 ++ 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Include/object.h b/Include/object.h index 615eaeb77bfa6d..94b17dfbac66f3 100644 --- a/Include/object.h +++ b/Include/object.h @@ -358,7 +358,7 @@ given type object has a specified feature. // This undocumented flag gives certain built-ins their unique pattern-matching // behavior, which allows a single positional subpattern to match against the -// match proxy itself (rather than a mapped attribute on it): +// subject itself (rather than a mapped attribute on it): #define _Py_TPFLAGS_MATCH_SELF (1UL << 21) /* These flags are used to determine if a type is a subclass. */ diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index f2a2256924e2d2..c33f99e6821cf9 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -158,9 +158,8 @@ # +=======+=======+ # | add | | <- the default # +=======+=======+ -# __match_args__ is always added unless the class already defines it. -# __match_args__ contains the set of names of __init__ parameters. -# Non-init fields must be matched by name. +# __match_args__ is always added unless the class already defines it. It is a +# tuple of __init__ parameter names; non-init fields must be matched by keyword. # Raised when an attempt is made to modify a frozen class. @@ -1010,12 +1009,10 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen): cls.__doc__ = (cls.__name__ + str(inspect.signature(cls)).replace(' -> NoneType', '')) - abc.update_abstractmethods(cls) + if '__match_args__' not in cls.__dict__: + cls.__match_args__ = tuple(f.name for f in flds if f.init) - match_args = cls.__dict__.get('__match_args__', MISSING) - if match_args is MISSING: - # Create a __match_args__ attribute. - _set_new_attribute(cls, '__match_args__', tuple(f.name for f in flds if f.init)) + abc.update_abstractmethods(cls) return cls diff --git a/Python/ast.c b/Python/ast.c index 9133aaea88634c..c58b4a69b1e321 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -435,10 +435,8 @@ validate_stmt(stmt_ty stmt) || !validate_nonempty_seq(stmt->v.Match.cases, "cases", "Match")) { return 0; } - match_case_ty m; - Py_ssize_t cases = asdl_seq_LEN(stmt->v.Match.cases); - for (i = 0; i < cases; i++) { - m = asdl_seq_GET(stmt->v.Match.cases, i); + for (i = 0; i < asdl_seq_LEN(stmt->v.Match.cases); i++) { + match_case_ty m = asdl_seq_GET(stmt->v.Match.cases, i); if (!validate_pattern(m->pattern) || (m->guard && !validate_expr(m->guard, Load)) || !validate_body(m->body, "match_case")) { diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 0d7351f602e0af..9728fc5cecb7f0 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -751,6 +751,7 @@ astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state } assert(left->kind = Constant_kind); assert(right->kind = Constant_kind); + // LHS must be real, RHS must be imaginary: if (!(PyFloat_CheckExact(left->v.Constant.value) || PyLong_CheckExact(left->v.Constant.value)) || !PyComplex_CheckExact(right->v.Constant.value)) @@ -784,6 +785,7 @@ static int astfold_pattern(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { // Don't blindly optimize the pattern as an expr; it plays by its own rules! + // Currently, this is only used to form complex/negative numeric constants. switch (node_->kind) { case Attribute_kind: break; From 94b19ee4b020ab2173b952468b0681e01ff759be Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 15:12:02 -0700 Subject: [PATCH 184/218] Unify grammar with PEP 634 (mostly) --- Grammar/python.gram | 123 +- Parser/parser.c | 7730 +++++++++++++++++++------------------------ Python/compile.c | 10 +- Python/symtable.c | 1 - 4 files changed, 3474 insertions(+), 4390 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 2f4b5de2ef1a9e..8db40e0c5e19cf 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -196,44 +196,40 @@ except_block[excepthandler_ty]: | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } finally_block[asdl_stmt_seq*]: 'finally' ':' a=block { a } -match_expr[expr_ty]: +match_stmt[stmt_ty]: + | "match" subject=subject_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT { + CHECK_VERSION(10, "Pattern matching is", _Py_Match(subject, cases, EXTRA)) } +subject_expr[expr_ty]: | value=star_named_expression ',' values=star_named_expressions? { _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } | named_expression - -match_stmt[stmt_ty]: - | "match" subject=match_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT { - CHECK_VERSION(10, "Pattern matching is", _Py_Match(subject, cases, EXTRA)) } case_block[match_case_ty]: | "case" pattern=patterns guard=guard? ':' body=block { _Py_match_case(pattern, guard, body, p->arena) } -guard[expr_ty]: - | 'if' guard=named_expression { guard } +guard[expr_ty]: 'if' guard=named_expression { guard } patterns[expr_ty]: - | value=value_pattern ',' values=values_pattern? { - _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } + | open_sequence_pattern | pattern - pattern[expr_ty]: - | value=or_pattern 'as' target=NAME { _Py_MatchAs(value, target->v.Name.id, EXTRA) } + | as_pattern | or_pattern - +as_pattern[expr_ty]: + | pattern=or_pattern 'as' target=capture_pattern { + _Py_MatchAs(pattern, target->v.Name.id, EXTRA) } or_pattern[expr_ty]: - | values[asdl_expr_seq*]='|'.closed_pattern+ { - asdl_seq_LEN(values) == 1 ? asdl_seq_GET(values, 0) : _Py_MatchOr(values, EXTRA) } - + | patterns[asdl_expr_seq*]='|'.closed_pattern+ { + asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : _Py_MatchOr(patterns, EXTRA) } closed_pattern[expr_ty]: - | name_pattern | literal_pattern - | constant_pattern + | capture_pattern + | wildcard_pattern + | value_pattern | group_pattern | sequence_pattern | mapping_pattern | class_pattern -name_pattern[expr_ty]: - | name=NAME !('.' | '(' | '=') { _PyPegen_set_expr_context(p, name, Store) } literal_pattern[expr_ty]: | signed_number !('+' | '-') | real=signed_number '+' imag=NUMBER { _Py_BinOp(real, Add, imag, EXTRA) } @@ -242,32 +238,19 @@ literal_pattern[expr_ty]: | 'None' { _Py_Constant(Py_None, NULL, EXTRA) } | 'True' { _Py_Constant(Py_True, NULL, EXTRA) } | 'False' { _Py_Constant(Py_False, NULL, EXTRA) } -constant_pattern[expr_ty]: - | attr=attr !('.' | '(' | '=') { attr } -group_pattern[expr_ty]: - | '(' pattern=patterns ')' { pattern } -sequence_pattern[expr_ty]: - | '[' values=values_pattern? ']' { _Py_List(values, Load, EXTRA) } - | '(' ')' { _Py_Tuple(NULL, Load, EXTRA) } -mapping_pattern[expr_ty]: - | '{' items=items_pattern? '}' { - _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } -class_pattern[expr_ty]: - | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } - | func=name_or_attr '(' args[asdl_expr_seq*]=','.pattern+ ','? ')' { - _Py_Call(func, args, NULL, EXTRA) } - | func=name_or_attr '(' keywords[asdl_keyword_seq*]=','.keyword_pattern+ ','? ')' { - _Py_Call(func, NULL, keywords, EXTRA) } - | func=name_or_attr '(' args[asdl_expr_seq*]=','.pattern+ ',' keywords[asdl_keyword_seq*]=','.keyword_pattern+ ','? ')' { - _Py_Call(func, args, keywords, EXTRA) } - | func=name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' error=pattern [',' ','.error_argument_pattern+] ','? ')' { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "positional pattern follows keyword pattern") } - | func=name_or_attr '(' [','.error_argument_pattern+ ','] error=error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' { - RAISE_SYNTAX_ERROR_KNOWN_LOCATION(error, "can't use starred pattern here") } - signed_number[expr_ty]: | NUMBER | '-' number=NUMBER { _Py_UnaryOp(USub, number, EXTRA) } + +capture_pattern[expr_ty]: + | !"_" name=NAME !('.' | '(' | '=') { + _PyPegen_set_expr_context(p, name, Store) } + +wildcard_pattern[expr_ty]: + | "_" { _Py_Name(CHECK(_PyPegen_new_identifier(p, "_")), Store, EXTRA) } + +value_pattern[expr_ty]: + | attr=attr !('.' | '(' | '=') { attr } attr[expr_ty]: | value=name_or_attr '.' attr=NAME { _Py_Attribute(value, attr->v.Name.id, Load, EXTRA) } @@ -275,25 +258,51 @@ name_or_attr[expr_ty]: | attr | NAME -values_pattern[asdl_seq*]: - | values=','.value_pattern+ ','? { values } -items_pattern[asdl_seq*]: - | items=','.key_value_pattern+ ','? { items } -keyword_pattern[keyword_ty]: - | arg=NAME '=' value=pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } -error_argument_pattern: - | pattern - | keyword_pattern -error_star[expr_ty]: - | ('*' | '**') error=NAME { error } +group_pattern[expr_ty]: + | '(' pattern=pattern ')' { pattern } -value_pattern[expr_ty]: - | '*' value=name_pattern { _Py_Starred(value, Store, EXTRA) } +sequence_pattern[expr_ty]: + | '[' values=maybe_sequence_pattern? ']' { _Py_List(values, Load, EXTRA) } + | '(' values=open_sequence_pattern? ')' { + values ? values : _Py_Tuple(values, Load, EXTRA) } +open_sequence_pattern[expr_ty]: + | value=maybe_star_pattern ',' values=maybe_sequence_pattern? { + _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } +maybe_sequence_pattern[asdl_seq*]: + | values=','.maybe_star_pattern+ ','? { values } +maybe_star_pattern[expr_ty]: + | star_pattern | pattern +star_pattern[expr_ty]: + | '*' value=(capture_pattern | wildcard_pattern) { + _Py_Starred(value, Store, EXTRA) } + +mapping_pattern[expr_ty]: + | '{' items=items_pattern? '}' { + _Py_Dict(CHECK(_PyPegen_get_keys(p, items)), CHECK(_PyPegen_get_values(p, items)), EXTRA) } +items_pattern[asdl_seq*]: + | items=','.key_value_pattern+ ','? { items } key_value_pattern[KeyValuePair*]: - | key=(literal_pattern | constant_pattern) ':' value=pattern { + | key=(literal_pattern | value_pattern) ':' value=pattern { _PyPegen_key_value_pair(p, key, value) } - | '**' value=name_pattern { _PyPegen_key_value_pair(p, NULL, value) } + | double_star_pattern +double_star_pattern[KeyValuePair*]: + | '**' value=capture_pattern { _PyPegen_key_value_pair(p, NULL, value) } + +class_pattern[expr_ty]: + | func=name_or_attr '(' ')' { _Py_Call(func, NULL, NULL, EXTRA) } + | func=name_or_attr '(' args=positional_patterns ','? ')' { + _Py_Call(func, args, NULL, EXTRA) } + | func=name_or_attr '(' keywords=keyword_patterns ','? ')' { + _Py_Call(func, NULL, keywords, EXTRA) } + | func=name_or_attr '(' args=positional_patterns ',' keywords=keyword_patterns ','? ')' { + _Py_Call(func, args, keywords, EXTRA) } +positional_patterns[asdl_expr_seq*]: + | args[asdl_expr_seq*]=','.pattern+ { args } +keyword_patterns[asdl_keyword_seq*]: + | keywords[asdl_keyword_seq*]=','.keyword_pattern+ { keywords } +keyword_pattern[keyword_ty]: + | arg=NAME '=' value=pattern { _Py_keyword(arg->v.Name.id, value, EXTRA) } return_stmt[stmt_ty]: | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) } diff --git a/Parser/parser.c b/Parser/parser.c index 9c46f3bd11133a..6683ca4ec1bf72 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -104,345 +104,331 @@ static KeywordToken *reserved_keywords[] = { #define try_stmt_type 1035 #define except_block_type 1036 #define finally_block_type 1037 -#define match_expr_type 1038 -#define match_stmt_type 1039 +#define match_stmt_type 1038 +#define subject_expr_type 1039 #define case_block_type 1040 #define guard_type 1041 #define patterns_type 1042 #define pattern_type 1043 -#define or_pattern_type 1044 -#define closed_pattern_type 1045 -#define name_pattern_type 1046 +#define as_pattern_type 1044 +#define or_pattern_type 1045 +#define closed_pattern_type 1046 #define literal_pattern_type 1047 -#define constant_pattern_type 1048 -#define group_pattern_type 1049 -#define sequence_pattern_type 1050 -#define mapping_pattern_type 1051 -#define class_pattern_type 1052 -#define signed_number_type 1053 -#define attr_type 1054 // Left-recursive -#define name_or_attr_type 1055 // Left-recursive -#define values_pattern_type 1056 -#define items_pattern_type 1057 -#define keyword_pattern_type 1058 -#define error_argument_pattern_type 1059 -#define error_star_type 1060 -#define value_pattern_type 1061 +#define signed_number_type 1048 +#define capture_pattern_type 1049 +#define wildcard_pattern_type 1050 +#define value_pattern_type 1051 +#define attr_type 1052 // Left-recursive +#define name_or_attr_type 1053 // Left-recursive +#define group_pattern_type 1054 +#define sequence_pattern_type 1055 +#define open_sequence_pattern_type 1056 +#define maybe_sequence_pattern_type 1057 +#define maybe_star_pattern_type 1058 +#define star_pattern_type 1059 +#define mapping_pattern_type 1060 +#define items_pattern_type 1061 #define key_value_pattern_type 1062 -#define return_stmt_type 1063 -#define raise_stmt_type 1064 -#define function_def_type 1065 -#define function_def_raw_type 1066 -#define func_type_comment_type 1067 -#define params_type 1068 -#define parameters_type 1069 -#define slash_no_default_type 1070 -#define slash_with_default_type 1071 -#define star_etc_type 1072 -#define kwds_type 1073 -#define param_no_default_type 1074 -#define param_with_default_type 1075 -#define param_maybe_default_type 1076 -#define param_type 1077 -#define annotation_type 1078 -#define default_type 1079 -#define decorators_type 1080 -#define class_def_type 1081 -#define class_def_raw_type 1082 -#define block_type 1083 -#define expressions_list_type 1084 -#define star_expressions_type 1085 -#define star_expression_type 1086 -#define star_named_expressions_type 1087 -#define star_named_expression_type 1088 -#define named_expression_type 1089 -#define annotated_rhs_type 1090 -#define expressions_type 1091 -#define expression_type 1092 -#define lambdef_type 1093 -#define lambda_params_type 1094 -#define lambda_parameters_type 1095 -#define lambda_slash_no_default_type 1096 -#define lambda_slash_with_default_type 1097 -#define lambda_star_etc_type 1098 -#define lambda_kwds_type 1099 -#define lambda_param_no_default_type 1100 -#define lambda_param_with_default_type 1101 -#define lambda_param_maybe_default_type 1102 -#define lambda_param_type 1103 -#define disjunction_type 1104 -#define conjunction_type 1105 -#define inversion_type 1106 -#define comparison_type 1107 -#define compare_op_bitwise_or_pair_type 1108 -#define eq_bitwise_or_type 1109 -#define noteq_bitwise_or_type 1110 -#define lte_bitwise_or_type 1111 -#define lt_bitwise_or_type 1112 -#define gte_bitwise_or_type 1113 -#define gt_bitwise_or_type 1114 -#define notin_bitwise_or_type 1115 -#define in_bitwise_or_type 1116 -#define isnot_bitwise_or_type 1117 -#define is_bitwise_or_type 1118 -#define bitwise_or_type 1119 // Left-recursive -#define bitwise_xor_type 1120 // Left-recursive -#define bitwise_and_type 1121 // Left-recursive -#define shift_expr_type 1122 // Left-recursive -#define sum_type 1123 // Left-recursive -#define term_type 1124 // Left-recursive -#define factor_type 1125 -#define power_type 1126 -#define await_primary_type 1127 -#define primary_type 1128 // Left-recursive -#define slices_type 1129 -#define slice_type 1130 -#define atom_type 1131 -#define strings_type 1132 -#define list_type 1133 -#define listcomp_type 1134 -#define tuple_type 1135 -#define group_type 1136 -#define genexp_type 1137 -#define set_type 1138 -#define setcomp_type 1139 -#define dict_type 1140 -#define dictcomp_type 1141 -#define double_starred_kvpairs_type 1142 -#define double_starred_kvpair_type 1143 -#define kvpair_type 1144 -#define for_if_clauses_type 1145 -#define for_if_clause_type 1146 -#define yield_expr_type 1147 -#define arguments_type 1148 -#define args_type 1149 -#define kwargs_type 1150 -#define starred_expression_type 1151 -#define kwarg_or_starred_type 1152 -#define kwarg_or_double_starred_type 1153 -#define star_targets_type 1154 -#define star_targets_seq_type 1155 -#define star_target_type 1156 -#define star_atom_type 1157 -#define single_target_type 1158 -#define single_subscript_attribute_target_type 1159 -#define del_targets_type 1160 -#define del_target_type 1161 -#define del_t_atom_type 1162 -#define targets_type 1163 -#define target_type 1164 -#define t_primary_type 1165 // Left-recursive -#define t_lookahead_type 1166 -#define t_atom_type 1167 -#define incorrect_arguments_type 1168 -#define invalid_kwarg_type 1169 -#define invalid_named_expression_type 1170 -#define invalid_assignment_type 1171 -#define invalid_ann_assign_target_type 1172 -#define invalid_del_stmt_type 1173 -#define invalid_block_type 1174 -#define invalid_comprehension_type 1175 -#define invalid_dict_comprehension_type 1176 -#define invalid_parameters_type 1177 -#define invalid_lambda_parameters_type 1178 -#define invalid_star_etc_type 1179 -#define invalid_lambda_star_etc_type 1180 -#define invalid_double_type_comments_type 1181 -#define invalid_with_item_type 1182 -#define invalid_for_target_type 1183 -#define invalid_group_type 1184 -#define invalid_import_from_targets_type 1185 -#define _loop0_1_type 1186 -#define _loop0_2_type 1187 -#define _loop0_4_type 1188 -#define _gather_3_type 1189 -#define _loop0_6_type 1190 -#define _gather_5_type 1191 -#define _loop0_8_type 1192 -#define _gather_7_type 1193 -#define _loop0_10_type 1194 -#define _gather_9_type 1195 -#define _loop1_11_type 1196 -#define _loop0_13_type 1197 -#define _gather_12_type 1198 -#define _tmp_14_type 1199 -#define _tmp_15_type 1200 -#define _tmp_16_type 1201 -#define _tmp_17_type 1202 -#define _tmp_18_type 1203 -#define _tmp_19_type 1204 -#define _tmp_20_type 1205 -#define _tmp_21_type 1206 -#define _loop1_22_type 1207 -#define _tmp_23_type 1208 -#define _tmp_24_type 1209 -#define _loop0_26_type 1210 -#define _gather_25_type 1211 -#define _loop0_28_type 1212 -#define _gather_27_type 1213 -#define _tmp_29_type 1214 -#define _tmp_30_type 1215 -#define _loop0_31_type 1216 -#define _loop1_32_type 1217 -#define _loop0_34_type 1218 -#define _gather_33_type 1219 -#define _tmp_35_type 1220 -#define _loop0_37_type 1221 -#define _gather_36_type 1222 -#define _tmp_38_type 1223 -#define _loop0_40_type 1224 -#define _gather_39_type 1225 -#define _loop0_42_type 1226 -#define _gather_41_type 1227 -#define _loop0_44_type 1228 -#define _gather_43_type 1229 -#define _loop0_46_type 1230 -#define _gather_45_type 1231 -#define _tmp_47_type 1232 -#define _loop1_48_type 1233 -#define _tmp_49_type 1234 -#define _loop1_50_type 1235 -#define _loop0_52_type 1236 -#define _gather_51_type 1237 -#define _tmp_53_type 1238 -#define _tmp_54_type 1239 -#define _tmp_55_type 1240 -#define _loop0_57_type 1241 -#define _gather_56_type 1242 -#define _loop0_59_type 1243 -#define _gather_58_type 1244 -#define _loop0_61_type 1245 -#define _gather_60_type 1246 -#define _loop0_63_type 1247 -#define _gather_62_type 1248 -#define _tmp_64_type 1249 -#define _loop0_66_type 1250 -#define _gather_65_type 1251 -#define _tmp_67_type 1252 -#define _tmp_68_type 1253 -#define _tmp_69_type 1254 -#define _loop0_71_type 1255 -#define _gather_70_type 1256 -#define _loop0_73_type 1257 -#define _gather_72_type 1258 -#define _tmp_74_type 1259 -#define _tmp_75_type 1260 -#define _tmp_76_type 1261 -#define _tmp_77_type 1262 -#define _tmp_78_type 1263 -#define _tmp_79_type 1264 -#define _loop0_80_type 1265 -#define _loop0_81_type 1266 -#define _loop0_82_type 1267 -#define _loop1_83_type 1268 -#define _loop0_84_type 1269 -#define _loop1_85_type 1270 -#define _loop1_86_type 1271 -#define _loop1_87_type 1272 -#define _loop0_88_type 1273 -#define _loop1_89_type 1274 -#define _loop0_90_type 1275 -#define _loop1_91_type 1276 -#define _loop0_92_type 1277 -#define _loop1_93_type 1278 -#define _loop1_94_type 1279 -#define _tmp_95_type 1280 -#define _loop0_97_type 1281 -#define _gather_96_type 1282 -#define _loop1_98_type 1283 -#define _loop0_100_type 1284 -#define _gather_99_type 1285 -#define _loop1_101_type 1286 -#define _loop0_102_type 1287 -#define _loop0_103_type 1288 -#define _loop0_104_type 1289 -#define _loop1_105_type 1290 -#define _loop0_106_type 1291 -#define _loop1_107_type 1292 -#define _loop1_108_type 1293 -#define _loop1_109_type 1294 -#define _loop0_110_type 1295 -#define _loop1_111_type 1296 -#define _loop0_112_type 1297 -#define _loop1_113_type 1298 -#define _loop0_114_type 1299 -#define _loop1_115_type 1300 -#define _loop1_116_type 1301 -#define _loop1_117_type 1302 -#define _loop1_118_type 1303 -#define _tmp_119_type 1304 -#define _loop0_121_type 1305 -#define _gather_120_type 1306 -#define _tmp_122_type 1307 -#define _tmp_123_type 1308 -#define _tmp_124_type 1309 -#define _tmp_125_type 1310 -#define _loop1_126_type 1311 -#define _tmp_127_type 1312 -#define _tmp_128_type 1313 -#define _loop0_130_type 1314 -#define _gather_129_type 1315 -#define _loop1_131_type 1316 -#define _loop0_132_type 1317 -#define _loop0_133_type 1318 -#define _loop0_135_type 1319 -#define _gather_134_type 1320 -#define _tmp_136_type 1321 -#define _loop0_138_type 1322 -#define _gather_137_type 1323 -#define _loop0_140_type 1324 -#define _gather_139_type 1325 -#define _loop0_142_type 1326 -#define _gather_141_type 1327 -#define _loop0_144_type 1328 -#define _gather_143_type 1329 -#define _loop0_145_type 1330 -#define _loop0_147_type 1331 -#define _gather_146_type 1332 -#define _tmp_148_type 1333 -#define _loop0_150_type 1334 -#define _gather_149_type 1335 -#define _loop0_152_type 1336 -#define _gather_151_type 1337 -#define _tmp_153_type 1338 -#define _loop0_154_type 1339 -#define _loop0_155_type 1340 -#define _loop0_156_type 1341 -#define _tmp_157_type 1342 -#define _tmp_158_type 1343 -#define _loop0_159_type 1344 -#define _tmp_160_type 1345 -#define _loop0_161_type 1346 -#define _tmp_162_type 1347 -#define _tmp_163_type 1348 -#define _tmp_164_type 1349 -#define _tmp_165_type 1350 -#define _tmp_166_type 1351 -#define _tmp_167_type 1352 -#define _loop0_169_type 1353 -#define _gather_168_type 1354 -#define _loop0_171_type 1355 -#define _gather_170_type 1356 -#define _loop0_173_type 1357 -#define _gather_172_type 1358 -#define _loop0_175_type 1359 -#define _gather_174_type 1360 -#define _tmp_176_type 1361 -#define _tmp_177_type 1362 -#define _tmp_178_type 1363 -#define _tmp_179_type 1364 -#define _tmp_180_type 1365 -#define _tmp_181_type 1366 -#define _tmp_182_type 1367 -#define _tmp_183_type 1368 -#define _tmp_184_type 1369 -#define _tmp_185_type 1370 -#define _tmp_186_type 1371 -#define _loop1_187_type 1372 -#define _loop1_188_type 1373 -#define _tmp_189_type 1374 -#define _tmp_190_type 1375 -#define _tmp_191_type 1376 +#define double_star_pattern_type 1063 +#define class_pattern_type 1064 +#define positional_patterns_type 1065 +#define keyword_patterns_type 1066 +#define keyword_pattern_type 1067 +#define return_stmt_type 1068 +#define raise_stmt_type 1069 +#define function_def_type 1070 +#define function_def_raw_type 1071 +#define func_type_comment_type 1072 +#define params_type 1073 +#define parameters_type 1074 +#define slash_no_default_type 1075 +#define slash_with_default_type 1076 +#define star_etc_type 1077 +#define kwds_type 1078 +#define param_no_default_type 1079 +#define param_with_default_type 1080 +#define param_maybe_default_type 1081 +#define param_type 1082 +#define annotation_type 1083 +#define default_type 1084 +#define decorators_type 1085 +#define class_def_type 1086 +#define class_def_raw_type 1087 +#define block_type 1088 +#define expressions_list_type 1089 +#define star_expressions_type 1090 +#define star_expression_type 1091 +#define star_named_expressions_type 1092 +#define star_named_expression_type 1093 +#define named_expression_type 1094 +#define annotated_rhs_type 1095 +#define expressions_type 1096 +#define expression_type 1097 +#define lambdef_type 1098 +#define lambda_params_type 1099 +#define lambda_parameters_type 1100 +#define lambda_slash_no_default_type 1101 +#define lambda_slash_with_default_type 1102 +#define lambda_star_etc_type 1103 +#define lambda_kwds_type 1104 +#define lambda_param_no_default_type 1105 +#define lambda_param_with_default_type 1106 +#define lambda_param_maybe_default_type 1107 +#define lambda_param_type 1108 +#define disjunction_type 1109 +#define conjunction_type 1110 +#define inversion_type 1111 +#define comparison_type 1112 +#define compare_op_bitwise_or_pair_type 1113 +#define eq_bitwise_or_type 1114 +#define noteq_bitwise_or_type 1115 +#define lte_bitwise_or_type 1116 +#define lt_bitwise_or_type 1117 +#define gte_bitwise_or_type 1118 +#define gt_bitwise_or_type 1119 +#define notin_bitwise_or_type 1120 +#define in_bitwise_or_type 1121 +#define isnot_bitwise_or_type 1122 +#define is_bitwise_or_type 1123 +#define bitwise_or_type 1124 // Left-recursive +#define bitwise_xor_type 1125 // Left-recursive +#define bitwise_and_type 1126 // Left-recursive +#define shift_expr_type 1127 // Left-recursive +#define sum_type 1128 // Left-recursive +#define term_type 1129 // Left-recursive +#define factor_type 1130 +#define power_type 1131 +#define await_primary_type 1132 +#define primary_type 1133 // Left-recursive +#define slices_type 1134 +#define slice_type 1135 +#define atom_type 1136 +#define strings_type 1137 +#define list_type 1138 +#define listcomp_type 1139 +#define tuple_type 1140 +#define group_type 1141 +#define genexp_type 1142 +#define set_type 1143 +#define setcomp_type 1144 +#define dict_type 1145 +#define dictcomp_type 1146 +#define double_starred_kvpairs_type 1147 +#define double_starred_kvpair_type 1148 +#define kvpair_type 1149 +#define for_if_clauses_type 1150 +#define for_if_clause_type 1151 +#define yield_expr_type 1152 +#define arguments_type 1153 +#define args_type 1154 +#define kwargs_type 1155 +#define starred_expression_type 1156 +#define kwarg_or_starred_type 1157 +#define kwarg_or_double_starred_type 1158 +#define star_targets_type 1159 +#define star_targets_seq_type 1160 +#define star_target_type 1161 +#define star_atom_type 1162 +#define single_target_type 1163 +#define single_subscript_attribute_target_type 1164 +#define del_targets_type 1165 +#define del_target_type 1166 +#define del_t_atom_type 1167 +#define targets_type 1168 +#define target_type 1169 +#define t_primary_type 1170 // Left-recursive +#define t_lookahead_type 1171 +#define t_atom_type 1172 +#define incorrect_arguments_type 1173 +#define invalid_kwarg_type 1174 +#define invalid_named_expression_type 1175 +#define invalid_assignment_type 1176 +#define invalid_ann_assign_target_type 1177 +#define invalid_del_stmt_type 1178 +#define invalid_block_type 1179 +#define invalid_comprehension_type 1180 +#define invalid_dict_comprehension_type 1181 +#define invalid_parameters_type 1182 +#define invalid_lambda_parameters_type 1183 +#define invalid_star_etc_type 1184 +#define invalid_lambda_star_etc_type 1185 +#define invalid_double_type_comments_type 1186 +#define invalid_with_item_type 1187 +#define invalid_for_target_type 1188 +#define invalid_group_type 1189 +#define invalid_import_from_targets_type 1190 +#define _loop0_1_type 1191 +#define _loop0_2_type 1192 +#define _loop0_4_type 1193 +#define _gather_3_type 1194 +#define _loop0_6_type 1195 +#define _gather_5_type 1196 +#define _loop0_8_type 1197 +#define _gather_7_type 1198 +#define _loop0_10_type 1199 +#define _gather_9_type 1200 +#define _loop1_11_type 1201 +#define _loop0_13_type 1202 +#define _gather_12_type 1203 +#define _tmp_14_type 1204 +#define _tmp_15_type 1205 +#define _tmp_16_type 1206 +#define _tmp_17_type 1207 +#define _tmp_18_type 1208 +#define _tmp_19_type 1209 +#define _tmp_20_type 1210 +#define _tmp_21_type 1211 +#define _loop1_22_type 1212 +#define _tmp_23_type 1213 +#define _tmp_24_type 1214 +#define _loop0_26_type 1215 +#define _gather_25_type 1216 +#define _loop0_28_type 1217 +#define _gather_27_type 1218 +#define _tmp_29_type 1219 +#define _tmp_30_type 1220 +#define _loop0_31_type 1221 +#define _loop1_32_type 1222 +#define _loop0_34_type 1223 +#define _gather_33_type 1224 +#define _tmp_35_type 1225 +#define _loop0_37_type 1226 +#define _gather_36_type 1227 +#define _tmp_38_type 1228 +#define _loop0_40_type 1229 +#define _gather_39_type 1230 +#define _loop0_42_type 1231 +#define _gather_41_type 1232 +#define _loop0_44_type 1233 +#define _gather_43_type 1234 +#define _loop0_46_type 1235 +#define _gather_45_type 1236 +#define _tmp_47_type 1237 +#define _loop1_48_type 1238 +#define _tmp_49_type 1239 +#define _loop1_50_type 1240 +#define _loop0_52_type 1241 +#define _gather_51_type 1242 +#define _tmp_53_type 1243 +#define _tmp_54_type 1244 +#define _tmp_55_type 1245 +#define _loop0_57_type 1246 +#define _gather_56_type 1247 +#define _tmp_58_type 1248 +#define _loop0_60_type 1249 +#define _gather_59_type 1250 +#define _tmp_61_type 1251 +#define _loop0_63_type 1252 +#define _gather_62_type 1253 +#define _loop0_65_type 1254 +#define _gather_64_type 1255 +#define _tmp_66_type 1256 +#define _tmp_67_type 1257 +#define _tmp_68_type 1258 +#define _tmp_69_type 1259 +#define _loop0_70_type 1260 +#define _loop0_71_type 1261 +#define _loop0_72_type 1262 +#define _loop1_73_type 1263 +#define _loop0_74_type 1264 +#define _loop1_75_type 1265 +#define _loop1_76_type 1266 +#define _loop1_77_type 1267 +#define _loop0_78_type 1268 +#define _loop1_79_type 1269 +#define _loop0_80_type 1270 +#define _loop1_81_type 1271 +#define _loop0_82_type 1272 +#define _loop1_83_type 1273 +#define _loop1_84_type 1274 +#define _tmp_85_type 1275 +#define _loop0_87_type 1276 +#define _gather_86_type 1277 +#define _loop1_88_type 1278 +#define _loop0_90_type 1279 +#define _gather_89_type 1280 +#define _loop1_91_type 1281 +#define _loop0_92_type 1282 +#define _loop0_93_type 1283 +#define _loop0_94_type 1284 +#define _loop1_95_type 1285 +#define _loop0_96_type 1286 +#define _loop1_97_type 1287 +#define _loop1_98_type 1288 +#define _loop1_99_type 1289 +#define _loop0_100_type 1290 +#define _loop1_101_type 1291 +#define _loop0_102_type 1292 +#define _loop1_103_type 1293 +#define _loop0_104_type 1294 +#define _loop1_105_type 1295 +#define _loop1_106_type 1296 +#define _loop1_107_type 1297 +#define _loop1_108_type 1298 +#define _tmp_109_type 1299 +#define _loop0_111_type 1300 +#define _gather_110_type 1301 +#define _tmp_112_type 1302 +#define _tmp_113_type 1303 +#define _tmp_114_type 1304 +#define _tmp_115_type 1305 +#define _loop1_116_type 1306 +#define _tmp_117_type 1307 +#define _tmp_118_type 1308 +#define _loop0_120_type 1309 +#define _gather_119_type 1310 +#define _loop1_121_type 1311 +#define _loop0_122_type 1312 +#define _loop0_123_type 1313 +#define _loop0_125_type 1314 +#define _gather_124_type 1315 +#define _tmp_126_type 1316 +#define _loop0_128_type 1317 +#define _gather_127_type 1318 +#define _loop0_130_type 1319 +#define _gather_129_type 1320 +#define _loop0_132_type 1321 +#define _gather_131_type 1322 +#define _loop0_134_type 1323 +#define _gather_133_type 1324 +#define _loop0_135_type 1325 +#define _loop0_137_type 1326 +#define _gather_136_type 1327 +#define _tmp_138_type 1328 +#define _loop0_140_type 1329 +#define _gather_139_type 1330 +#define _loop0_142_type 1331 +#define _gather_141_type 1332 +#define _tmp_143_type 1333 +#define _loop0_144_type 1334 +#define _loop0_145_type 1335 +#define _loop0_146_type 1336 +#define _tmp_147_type 1337 +#define _tmp_148_type 1338 +#define _loop0_149_type 1339 +#define _tmp_150_type 1340 +#define _loop0_151_type 1341 +#define _tmp_152_type 1342 +#define _tmp_153_type 1343 +#define _tmp_154_type 1344 +#define _tmp_155_type 1345 +#define _tmp_156_type 1346 +#define _tmp_157_type 1347 +#define _tmp_158_type 1348 +#define _tmp_159_type 1349 +#define _tmp_160_type 1350 +#define _tmp_161_type 1351 +#define _tmp_162_type 1352 +#define _tmp_163_type 1353 +#define _tmp_164_type 1354 +#define _tmp_165_type 1355 +#define _tmp_166_type 1356 +#define _tmp_167_type 1357 +#define _tmp_168_type 1358 +#define _loop1_169_type 1359 +#define _loop1_170_type 1360 +#define _tmp_171_type 1361 +#define _tmp_172_type 1362 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -482,31 +468,36 @@ static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); static asdl_stmt_seq* finally_block_rule(Parser *p); -static expr_ty match_expr_rule(Parser *p); static stmt_ty match_stmt_rule(Parser *p); +static expr_ty subject_expr_rule(Parser *p); static match_case_ty case_block_rule(Parser *p); static expr_ty guard_rule(Parser *p); static expr_ty patterns_rule(Parser *p); static expr_ty pattern_rule(Parser *p); +static expr_ty as_pattern_rule(Parser *p); static expr_ty or_pattern_rule(Parser *p); static expr_ty closed_pattern_rule(Parser *p); -static expr_ty name_pattern_rule(Parser *p); static expr_ty literal_pattern_rule(Parser *p); -static expr_ty constant_pattern_rule(Parser *p); -static expr_ty group_pattern_rule(Parser *p); -static expr_ty sequence_pattern_rule(Parser *p); -static expr_ty mapping_pattern_rule(Parser *p); -static expr_ty class_pattern_rule(Parser *p); static expr_ty signed_number_rule(Parser *p); +static expr_ty capture_pattern_rule(Parser *p); +static expr_ty wildcard_pattern_rule(Parser *p); +static expr_ty value_pattern_rule(Parser *p); static expr_ty attr_rule(Parser *p); static expr_ty name_or_attr_rule(Parser *p); -static asdl_seq* values_pattern_rule(Parser *p); +static expr_ty group_pattern_rule(Parser *p); +static expr_ty sequence_pattern_rule(Parser *p); +static expr_ty open_sequence_pattern_rule(Parser *p); +static asdl_seq* maybe_sequence_pattern_rule(Parser *p); +static expr_ty maybe_star_pattern_rule(Parser *p); +static expr_ty star_pattern_rule(Parser *p); +static expr_ty mapping_pattern_rule(Parser *p); static asdl_seq* items_pattern_rule(Parser *p); -static keyword_ty keyword_pattern_rule(Parser *p); -static void *error_argument_pattern_rule(Parser *p); -static expr_ty error_star_rule(Parser *p); -static expr_ty value_pattern_rule(Parser *p); static KeyValuePair* key_value_pattern_rule(Parser *p); +static KeyValuePair* double_star_pattern_rule(Parser *p); +static expr_ty class_pattern_rule(Parser *p); +static asdl_expr_seq* positional_patterns_rule(Parser *p); +static asdl_keyword_seq* keyword_patterns_rule(Parser *p); +static keyword_ty keyword_pattern_rule(Parser *p); static stmt_ty return_stmt_rule(Parser *p); static stmt_ty raise_stmt_rule(Parser *p); static stmt_ty function_def_rule(Parser *p); @@ -687,140 +678,121 @@ static void *_tmp_54_rule(Parser *p); static void *_tmp_55_rule(Parser *p); static asdl_seq *_loop0_57_rule(Parser *p); static asdl_seq *_gather_56_rule(Parser *p); -static asdl_seq *_loop0_59_rule(Parser *p); -static asdl_seq *_gather_58_rule(Parser *p); -static asdl_seq *_loop0_61_rule(Parser *p); -static asdl_seq *_gather_60_rule(Parser *p); +static void *_tmp_58_rule(Parser *p); +static asdl_seq *_loop0_60_rule(Parser *p); +static asdl_seq *_gather_59_rule(Parser *p); +static void *_tmp_61_rule(Parser *p); static asdl_seq *_loop0_63_rule(Parser *p); static asdl_seq *_gather_62_rule(Parser *p); -static void *_tmp_64_rule(Parser *p); -static asdl_seq *_loop0_66_rule(Parser *p); -static asdl_seq *_gather_65_rule(Parser *p); +static asdl_seq *_loop0_65_rule(Parser *p); +static asdl_seq *_gather_64_rule(Parser *p); +static void *_tmp_66_rule(Parser *p); static void *_tmp_67_rule(Parser *p); static void *_tmp_68_rule(Parser *p); static void *_tmp_69_rule(Parser *p); +static asdl_seq *_loop0_70_rule(Parser *p); static asdl_seq *_loop0_71_rule(Parser *p); -static asdl_seq *_gather_70_rule(Parser *p); -static asdl_seq *_loop0_73_rule(Parser *p); -static asdl_seq *_gather_72_rule(Parser *p); -static void *_tmp_74_rule(Parser *p); -static void *_tmp_75_rule(Parser *p); -static void *_tmp_76_rule(Parser *p); -static void *_tmp_77_rule(Parser *p); -static void *_tmp_78_rule(Parser *p); -static void *_tmp_79_rule(Parser *p); +static asdl_seq *_loop0_72_rule(Parser *p); +static asdl_seq *_loop1_73_rule(Parser *p); +static asdl_seq *_loop0_74_rule(Parser *p); +static asdl_seq *_loop1_75_rule(Parser *p); +static asdl_seq *_loop1_76_rule(Parser *p); +static asdl_seq *_loop1_77_rule(Parser *p); +static asdl_seq *_loop0_78_rule(Parser *p); +static asdl_seq *_loop1_79_rule(Parser *p); static asdl_seq *_loop0_80_rule(Parser *p); -static asdl_seq *_loop0_81_rule(Parser *p); +static asdl_seq *_loop1_81_rule(Parser *p); static asdl_seq *_loop0_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static asdl_seq *_loop0_84_rule(Parser *p); -static asdl_seq *_loop1_85_rule(Parser *p); -static asdl_seq *_loop1_86_rule(Parser *p); -static asdl_seq *_loop1_87_rule(Parser *p); -static asdl_seq *_loop0_88_rule(Parser *p); -static asdl_seq *_loop1_89_rule(Parser *p); +static asdl_seq *_loop1_84_rule(Parser *p); +static void *_tmp_85_rule(Parser *p); +static asdl_seq *_loop0_87_rule(Parser *p); +static asdl_seq *_gather_86_rule(Parser *p); +static asdl_seq *_loop1_88_rule(Parser *p); static asdl_seq *_loop0_90_rule(Parser *p); +static asdl_seq *_gather_89_rule(Parser *p); static asdl_seq *_loop1_91_rule(Parser *p); static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_loop1_93_rule(Parser *p); -static asdl_seq *_loop1_94_rule(Parser *p); -static void *_tmp_95_rule(Parser *p); -static asdl_seq *_loop0_97_rule(Parser *p); -static asdl_seq *_gather_96_rule(Parser *p); +static asdl_seq *_loop0_93_rule(Parser *p); +static asdl_seq *_loop0_94_rule(Parser *p); +static asdl_seq *_loop1_95_rule(Parser *p); +static asdl_seq *_loop0_96_rule(Parser *p); +static asdl_seq *_loop1_97_rule(Parser *p); static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop1_99_rule(Parser *p); static asdl_seq *_loop0_100_rule(Parser *p); -static asdl_seq *_gather_99_rule(Parser *p); static asdl_seq *_loop1_101_rule(Parser *p); static asdl_seq *_loop0_102_rule(Parser *p); -static asdl_seq *_loop0_103_rule(Parser *p); +static asdl_seq *_loop1_103_rule(Parser *p); static asdl_seq *_loop0_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); -static asdl_seq *_loop0_106_rule(Parser *p); +static asdl_seq *_loop1_106_rule(Parser *p); static asdl_seq *_loop1_107_rule(Parser *p); static asdl_seq *_loop1_108_rule(Parser *p); -static asdl_seq *_loop1_109_rule(Parser *p); -static asdl_seq *_loop0_110_rule(Parser *p); -static asdl_seq *_loop1_111_rule(Parser *p); -static asdl_seq *_loop0_112_rule(Parser *p); -static asdl_seq *_loop1_113_rule(Parser *p); -static asdl_seq *_loop0_114_rule(Parser *p); -static asdl_seq *_loop1_115_rule(Parser *p); +static void *_tmp_109_rule(Parser *p); +static asdl_seq *_loop0_111_rule(Parser *p); +static asdl_seq *_gather_110_rule(Parser *p); +static void *_tmp_112_rule(Parser *p); +static void *_tmp_113_rule(Parser *p); +static void *_tmp_114_rule(Parser *p); +static void *_tmp_115_rule(Parser *p); static asdl_seq *_loop1_116_rule(Parser *p); -static asdl_seq *_loop1_117_rule(Parser *p); -static asdl_seq *_loop1_118_rule(Parser *p); -static void *_tmp_119_rule(Parser *p); -static asdl_seq *_loop0_121_rule(Parser *p); -static asdl_seq *_gather_120_rule(Parser *p); -static void *_tmp_122_rule(Parser *p); -static void *_tmp_123_rule(Parser *p); -static void *_tmp_124_rule(Parser *p); -static void *_tmp_125_rule(Parser *p); -static asdl_seq *_loop1_126_rule(Parser *p); -static void *_tmp_127_rule(Parser *p); -static void *_tmp_128_rule(Parser *p); +static void *_tmp_117_rule(Parser *p); +static void *_tmp_118_rule(Parser *p); +static asdl_seq *_loop0_120_rule(Parser *p); +static asdl_seq *_gather_119_rule(Parser *p); +static asdl_seq *_loop1_121_rule(Parser *p); +static asdl_seq *_loop0_122_rule(Parser *p); +static asdl_seq *_loop0_123_rule(Parser *p); +static asdl_seq *_loop0_125_rule(Parser *p); +static asdl_seq *_gather_124_rule(Parser *p); +static void *_tmp_126_rule(Parser *p); +static asdl_seq *_loop0_128_rule(Parser *p); +static asdl_seq *_gather_127_rule(Parser *p); static asdl_seq *_loop0_130_rule(Parser *p); static asdl_seq *_gather_129_rule(Parser *p); -static asdl_seq *_loop1_131_rule(Parser *p); static asdl_seq *_loop0_132_rule(Parser *p); -static asdl_seq *_loop0_133_rule(Parser *p); +static asdl_seq *_gather_131_rule(Parser *p); +static asdl_seq *_loop0_134_rule(Parser *p); +static asdl_seq *_gather_133_rule(Parser *p); static asdl_seq *_loop0_135_rule(Parser *p); -static asdl_seq *_gather_134_rule(Parser *p); -static void *_tmp_136_rule(Parser *p); -static asdl_seq *_loop0_138_rule(Parser *p); -static asdl_seq *_gather_137_rule(Parser *p); +static asdl_seq *_loop0_137_rule(Parser *p); +static asdl_seq *_gather_136_rule(Parser *p); +static void *_tmp_138_rule(Parser *p); static asdl_seq *_loop0_140_rule(Parser *p); static asdl_seq *_gather_139_rule(Parser *p); static asdl_seq *_loop0_142_rule(Parser *p); static asdl_seq *_gather_141_rule(Parser *p); +static void *_tmp_143_rule(Parser *p); static asdl_seq *_loop0_144_rule(Parser *p); -static asdl_seq *_gather_143_rule(Parser *p); static asdl_seq *_loop0_145_rule(Parser *p); -static asdl_seq *_loop0_147_rule(Parser *p); -static asdl_seq *_gather_146_rule(Parser *p); +static asdl_seq *_loop0_146_rule(Parser *p); +static void *_tmp_147_rule(Parser *p); static void *_tmp_148_rule(Parser *p); -static asdl_seq *_loop0_150_rule(Parser *p); -static asdl_seq *_gather_149_rule(Parser *p); -static asdl_seq *_loop0_152_rule(Parser *p); -static asdl_seq *_gather_151_rule(Parser *p); +static asdl_seq *_loop0_149_rule(Parser *p); +static void *_tmp_150_rule(Parser *p); +static asdl_seq *_loop0_151_rule(Parser *p); +static void *_tmp_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); -static asdl_seq *_loop0_154_rule(Parser *p); -static asdl_seq *_loop0_155_rule(Parser *p); -static asdl_seq *_loop0_156_rule(Parser *p); +static void *_tmp_154_rule(Parser *p); +static void *_tmp_155_rule(Parser *p); +static void *_tmp_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); -static asdl_seq *_loop0_159_rule(Parser *p); +static void *_tmp_159_rule(Parser *p); static void *_tmp_160_rule(Parser *p); -static asdl_seq *_loop0_161_rule(Parser *p); +static void *_tmp_161_rule(Parser *p); static void *_tmp_162_rule(Parser *p); static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); static void *_tmp_165_rule(Parser *p); static void *_tmp_166_rule(Parser *p); static void *_tmp_167_rule(Parser *p); -static asdl_seq *_loop0_169_rule(Parser *p); -static asdl_seq *_gather_168_rule(Parser *p); -static asdl_seq *_loop0_171_rule(Parser *p); -static asdl_seq *_gather_170_rule(Parser *p); -static asdl_seq *_loop0_173_rule(Parser *p); -static asdl_seq *_gather_172_rule(Parser *p); -static asdl_seq *_loop0_175_rule(Parser *p); -static asdl_seq *_gather_174_rule(Parser *p); -static void *_tmp_176_rule(Parser *p); -static void *_tmp_177_rule(Parser *p); -static void *_tmp_178_rule(Parser *p); -static void *_tmp_179_rule(Parser *p); -static void *_tmp_180_rule(Parser *p); -static void *_tmp_181_rule(Parser *p); -static void *_tmp_182_rule(Parser *p); -static void *_tmp_183_rule(Parser *p); -static void *_tmp_184_rule(Parser *p); -static void *_tmp_185_rule(Parser *p); -static void *_tmp_186_rule(Parser *p); -static asdl_seq *_loop1_187_rule(Parser *p); -static asdl_seq *_loop1_188_rule(Parser *p); -static void *_tmp_189_rule(Parser *p); -static void *_tmp_190_rule(Parser *p); -static void *_tmp_191_rule(Parser *p); +static void *_tmp_168_rule(Parser *p); +static asdl_seq *_loop1_169_rule(Parser *p); +static asdl_seq *_loop1_170_rule(Parser *p); +static void *_tmp_171_rule(Parser *p); +static void *_tmp_172_rule(Parser *p); // file: statements? $ @@ -4800,16 +4772,16 @@ finally_block_rule(Parser *p) return _res; } -// match_expr: star_named_expression ',' star_named_expressions? | named_expression -static expr_ty -match_expr_rule(Parser *p) +// match_stmt: "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT +static stmt_ty +match_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + stmt_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -4820,24 +4792,36 @@ match_expr_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // star_named_expression ',' star_named_expressions? + { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> match_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); + expr_ty _keyword; Token * _literal; - expr_ty value; - void *values; + asdl_match_case_seq* cases; + Token * dedent_var; + Token * indent_var; + Token * newline_var; + expr_ty subject; if ( - (value = star_named_expression_rule(p)) // star_named_expression + (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (subject = subject_expr_rule(p)) // subject_expr && - (values = star_named_expressions_rule(p), 1) // star_named_expressions? + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' + && + (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ + && + (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) { - D(fprintf(stderr, "%*c+ match_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4847,7 +4831,7 @@ match_expr_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); + _res = CHECK_VERSION ( 10 , "Pattern matching is" , _Py_Match ( subject , cases , EXTRA ) ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4856,27 +4840,8 @@ match_expr_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s match_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); - } - { // named_expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> match_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); - expr_ty named_expression_var; - if ( - (named_expression_var = named_expression_rule(p)) // named_expression - ) - { - D(fprintf(stderr, "%*c+ match_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); - _res = named_expression_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s match_expr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); } _res = NULL; done: @@ -4884,16 +4849,16 @@ match_expr_rule(Parser *p) return _res; } -// match_stmt: "match" match_expr ':' NEWLINE INDENT case_block+ DEDENT -static stmt_ty -match_stmt_rule(Parser *p) +// subject_expr: star_named_expression ',' star_named_expressions? | named_expression +static expr_ty +subject_expr_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - stmt_ty _res = NULL; + expr_ty _res = NULL; int _mark = p->mark; if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { p->error_indicator = 1; @@ -4904,36 +4869,24 @@ match_stmt_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // "match" match_expr ':' NEWLINE INDENT case_block+ DEDENT + { // star_named_expression ',' star_named_expressions? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); - expr_ty _keyword; + D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; - asdl_match_case_seq* cases; - Token * dedent_var; - Token * indent_var; - Token * newline_var; - expr_ty subject; + expr_ty value; + void *values; if ( - (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' - && - (subject = match_expr_rule(p)) // match_expr - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - && - (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' + (value = star_named_expression_rule(p)) // star_named_expression && - (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' + (values = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4943,7 +4896,7 @@ match_stmt_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = CHECK_VERSION ( 10 , "Pattern matching is" , _Py_Match ( subject , cases , EXTRA ) ); + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -4952,8 +4905,27 @@ match_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" match_expr ':' NEWLINE INDENT case_block+ DEDENT")); + D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + } + { // named_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + expr_ty named_expression_var; + if ( + (named_expression_var = named_expression_rule(p)) // named_expression + ) + { + D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + _res = named_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; done: @@ -5058,7 +5030,7 @@ guard_rule(Parser *p) return _res; } -// patterns: value_pattern ',' values_pattern? | pattern +// patterns: open_sequence_pattern | pattern static expr_ty patterns_rule(Parser *p) { @@ -5069,53 +5041,24 @@ patterns_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // value_pattern ',' values_pattern? + { // open_sequence_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern ',' values_pattern?")); - Token * _literal; - expr_ty value; - void *values; + D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); + expr_ty open_sequence_pattern_var; if ( - (value = value_pattern_rule(p)) // value_pattern - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (values = values_pattern_rule(p), 1) // values_pattern? + (open_sequence_pattern_var = open_sequence_pattern_rule(p)) // open_sequence_pattern ) { - D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern ',' values_pattern?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); + _res = open_sequence_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern ',' values_pattern?")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern")); } { // pattern if (p->error_indicator) { @@ -5142,9 +5085,64 @@ patterns_rule(Parser *p) return _res; } -// pattern: or_pattern 'as' NAME | or_pattern +// pattern: as_pattern | or_pattern static expr_ty pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + { // as_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern")); + expr_ty as_pattern_var; + if ( + (as_pattern_var = as_pattern_rule(p)) // as_pattern + ) + { + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern")); + _res = as_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern")); + } + { // or_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); + expr_ty or_pattern_var; + if ( + (or_pattern_var = or_pattern_rule(p)) // or_pattern + ) + { + D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); + _res = or_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// as_pattern: or_pattern 'as' capture_pattern +static expr_ty +as_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5162,24 +5160,24 @@ pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // or_pattern 'as' NAME + { // or_pattern 'as' capture_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' NAME")); + D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); Token * _keyword; + expr_ty pattern; expr_ty target; - expr_ty value; if ( - (value = or_pattern_rule(p)) // or_pattern + (pattern = or_pattern_rule(p)) // or_pattern && (_keyword = _PyPegen_expect_token(p, 520)) // token='as' && - (target = _PyPegen_name_token(p)) // NAME + (target = capture_pattern_rule(p)) // capture_pattern ) { - D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' NAME")); + D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' capture_pattern")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5189,7 +5187,7 @@ pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_MatchAs ( value , target -> v . Name . id , EXTRA ); + _res = _Py_MatchAs ( pattern , target -> v . Name . id , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5198,27 +5196,8 @@ pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' NAME")); - } - { // or_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); - expr_ty or_pattern_var; - if ( - (or_pattern_var = or_pattern_rule(p)) // or_pattern - ) - { - D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); - _res = or_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); + D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' capture_pattern")); } _res = NULL; done: @@ -5252,9 +5231,9 @@ or_pattern_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); - asdl_expr_seq* values; + asdl_expr_seq* patterns; if ( - (values = (asdl_expr_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ + (patterns = (asdl_expr_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ ) { D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); @@ -5267,7 +5246,7 @@ or_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = asdl_seq_LEN ( values ) == 1 ? asdl_seq_GET ( values , 0 ) : _Py_MatchOr ( values , EXTRA ); + _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _Py_MatchOr ( patterns , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5286,9 +5265,10 @@ or_pattern_rule(Parser *p) } // closed_pattern: -// | name_pattern // | literal_pattern -// | constant_pattern +// | capture_pattern +// | wildcard_pattern +// | value_pattern // | group_pattern // | sequence_pattern // | mapping_pattern @@ -5303,62 +5283,81 @@ closed_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // name_pattern + { // literal_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_pattern")); - expr_ty name_pattern_var; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + expr_ty literal_pattern_var; if ( - (name_pattern_var = name_pattern_rule(p)) // name_pattern + (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern ) { - D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_pattern")); - _res = name_pattern_var; + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + _res = literal_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); } - { // literal_pattern + { // capture_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - expr_ty literal_pattern_var; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); + expr_ty capture_pattern_var; if ( - (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern + (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern ) { - D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - _res = literal_pattern_var; + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); + _res = capture_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); + } + { // wildcard_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); + expr_ty wildcard_pattern_var; + if ( + (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern + ) + { + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); + _res = wildcard_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); } - { // constant_pattern + { // value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - expr_ty constant_pattern_var; + D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); + expr_ty value_pattern_var; if ( - (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern + (value_pattern_var = value_pattern_rule(p)) // value_pattern ) { - D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - _res = constant_pattern_var; + D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); + _res = value_pattern_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); } { // group_pattern if (p->error_indicator) { @@ -5442,9 +5441,16 @@ closed_pattern_rule(Parser *p) return _res; } -// name_pattern: NAME !('.' | '(' | '=') +// literal_pattern: +// | signed_number !('+' | '-') +// | signed_number '+' NUMBER +// | signed_number '-' NUMBER +// | strings +// | 'None' +// | 'True' +// | 'False' static expr_ty -name_pattern_rule(Parser *p) +literal_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5453,77 +5459,27 @@ name_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // NAME !('.' | '(' | '=') + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // signed_number !('+' | '-') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> name_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); - expr_ty name; + D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); + expr_ty signed_number_var; if ( - (name = _PyPegen_name_token(p)) // NAME + (signed_number_var = signed_number_rule(p)) // signed_number && _PyPegen_lookahead(0, _tmp_53_rule, p) ) - { - D(fprintf(stderr, "%*c+ name_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !('.' | '(' | '=')")); - _res = _PyPegen_set_expr_context ( p , name , Store ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s name_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !('.' | '(' | '=')")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// literal_pattern: -// | signed_number !('+' | '-') -// | signed_number '+' NUMBER -// | signed_number '-' NUMBER -// | strings -// | 'None' -// | 'True' -// | 'False' -static expr_ty -literal_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - expr_ty _res = NULL; - int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // signed_number !('+' | '-') - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); - expr_ty signed_number_var; - if ( - (signed_number_var = signed_number_rule(p)) // signed_number - && - _PyPegen_lookahead(0, _tmp_54_rule, p) - ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); _res = signed_number_var; @@ -5735,9 +5691,9 @@ literal_pattern_rule(Parser *p) return _res; } -// constant_pattern: attr !('.' | '(' | '=') +// signed_number: NUMBER | '-' NUMBER static expr_ty -constant_pattern_rule(Parser *p) +signed_number_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5746,21 +5702,59 @@ constant_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // attr !('.' | '(' | '=') + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NUMBER if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> constant_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); - expr_ty attr; + D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); + expr_ty number_var; if ( - (attr = attr_rule(p)) // attr + (number_var = _PyPegen_number_token(p)) // NUMBER + ) + { + D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); + _res = number_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); + } + { // '-' NUMBER + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token * _literal; + expr_ty number; + if ( + (_literal = _PyPegen_expect_token(p, 15)) // token='-' && - _PyPegen_lookahead(0, _tmp_55_rule, p) + (number = _PyPegen_number_token(p)) // NUMBER ) { - D(fprintf(stderr, "%*c+ constant_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); - _res = attr; + D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_UnaryOp ( USub , number , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5769,8 +5763,8 @@ constant_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s constant_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); + D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); } _res = NULL; done: @@ -5778,9 +5772,9 @@ constant_pattern_rule(Parser *p) return _res; } -// group_pattern: '(' patterns ')' +// capture_pattern: !"_" NAME !('.' | '(' | '=') static expr_ty -group_pattern_rule(Parser *p) +capture_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5789,25 +5783,23 @@ group_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // '(' patterns ')' + { // !"_" NAME !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' patterns ')'")); - Token * _literal; - Token * _literal_1; - expr_ty pattern; + D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); + expr_ty name; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_") && - (pattern = patterns_rule(p)) // patterns + (name = _PyPegen_name_token(p)) // NAME && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + _PyPegen_lookahead(0, _tmp_54_rule, p) ) { - D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' patterns ')'")); - _res = pattern; + D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); + _res = _PyPegen_set_expr_context ( p , name , Store ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5816,8 +5808,8 @@ group_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' patterns ')'")); + D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); } _res = NULL; done: @@ -5825,9 +5817,9 @@ group_pattern_rule(Parser *p) return _res; } -// sequence_pattern: '[' values_pattern? ']' | '(' ')' +// wildcard_pattern: "_" static expr_ty -sequence_pattern_rule(Parser *p) +wildcard_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5845,24 +5837,18 @@ sequence_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '[' values_pattern? ']' + { // "_" if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' values_pattern? ']'")); - Token * _literal; - Token * _literal_1; - void *values; + D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\"")); + expr_ty _keyword; if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - && - (values = values_pattern_rule(p), 1) // values_pattern? - && - (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' + (_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' ) { - D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' values_pattern? ']'")); + D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\"")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5872,7 +5858,7 @@ sequence_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_List ( values , Load , EXTRA ); + _res = _Py_Name ( CHECK ( _PyPegen_new_identifier ( p , "_" ) ) , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5881,34 +5867,41 @@ sequence_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' values_pattern? ']'")); + D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\"")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// value_pattern: attr !('.' | '(' | '=') +static expr_ty +value_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // '(' ')' + expr_ty _res = NULL; + int _mark = p->mark; + { // attr !('.' | '(' | '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); + expr_ty attr; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (attr = attr_rule(p)) // attr && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + _PyPegen_lookahead(0, _tmp_55_rule, p) ) { - D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' ')'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( NULL , Load , EXTRA ); + D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); + _res = attr; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5917,8 +5910,8 @@ sequence_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' ')'")); + D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); } _res = NULL; done: @@ -5926,9 +5919,39 @@ sequence_pattern_rule(Parser *p) return _res; } -// mapping_pattern: '{' items_pattern? '}' +// Left-recursive +// attr: name_or_attr '.' NAME +static expr_ty attr_raw(Parser *); static expr_ty -mapping_pattern_rule(Parser *p) +attr_rule(Parser *p) +{ + D(p->level++); + expr_ty _res = NULL; + if (_PyPegen_is_memoized(p, attr_type, &_res)) { + D(p->level--); + return _res; + } + int _mark = p->mark; + int _resmark = p->mark; + while (1) { + int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); + if (tmpvar_1) { + D(p->level--); + return _res; + } + p->mark = _mark; + void *_raw = attr_raw(p); + if (_raw == NULL || p->mark <= _resmark) + break; + _resmark = p->mark; + _res = _raw; + } + p->mark = _resmark; + D(p->level--); + return _res; +} +static expr_ty +attr_raw(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -5946,24 +5969,24 @@ mapping_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' items_pattern? '}' + { // name_or_attr '.' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); + D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token * _literal; - Token * _literal_1; - void *items; + expr_ty attr; + expr_ty value; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + (value = name_or_attr_rule(p)) // name_or_attr && - (items = items_pattern_rule(p), 1) // items_pattern? + (_literal = _PyPegen_expect_token(p, 23)) // token='.' && - (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' + (attr = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); + D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -5973,7 +5996,7 @@ mapping_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , items ) ) , CHECK ( _PyPegen_get_values ( p , items ) ) , EXTRA ); + _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -5982,8 +6005,8 @@ mapping_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern? '}'")); + D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); } _res = NULL; done: @@ -5991,15 +6014,10 @@ mapping_pattern_rule(Parser *p) return _res; } -// class_pattern: -// | name_or_attr '(' ')' -// | name_or_attr '(' ','.pattern+ ','? ')' -// | name_or_attr '(' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' -// | name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')' -// | name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' +// Left-recursive +// name_or_attr: attr | NAME static expr_ty -class_pattern_rule(Parser *p) +name_or_attr_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6008,89 +6026,80 @@ class_pattern_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // name_or_attr '(' ')' + { // attr if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); - Token * _literal; - Token * _literal_1; - expr_ty func; + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); + expr_ty attr_var; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (attr_var = attr_rule(p)) // attr ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( func , NULL , NULL , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); + _res = attr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); + } + { // NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); + expr_ty name_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); + _res = name_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// group_pattern: '(' pattern ')' +static expr_ty +group_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // name_or_attr '(' ','.pattern+ ','? ')' + expr_ty _res = NULL; + int _mark = p->mark; + { // '(' pattern ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); Token * _literal; Token * _literal_1; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_expr_seq* args; - expr_ty func; + expr_ty pattern; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = (asdl_expr_seq*)_gather_56_rule(p)) // ','.pattern+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (pattern = pattern_rule(p)) // pattern && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( func , args , NULL , EXTRA ); + D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); + _res = pattern; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6099,34 +6108,53 @@ class_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ','? ')'")); + D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')' +static expr_ty +sequence_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - { // name_or_attr '(' ','.keyword_pattern+ ','? ')' + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '[' maybe_sequence_pattern? ']' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); Token * _literal; Token * _literal_1; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty func; - asdl_keyword_seq* keywords; + void *values; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (keywords = (asdl_keyword_seq*)_gather_58_rule(p)) // ','.keyword_pattern+ + (_literal = _PyPegen_expect_token(p, 9)) // token='[' && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6136,7 +6164,7 @@ class_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( func , NULL , keywords , EXTRA ); + _res = _Py_List ( values , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6145,40 +6173,27 @@ class_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); } - { // name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')' + { // '(' open_sequence_pattern? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); Token * _literal; Token * _literal_1; - Token * _literal_2; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_expr_seq* args; - expr_ty func; - asdl_keyword_seq* keywords; + void *values; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (args = (asdl_expr_seq*)_gather_60_rule(p)) // ','.pattern+ - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' - && - (keywords = (asdl_keyword_seq*)_gather_62_rule(p)) // ','.keyword_pattern+ + (values = open_sequence_pattern_rule(p), 1) // open_sequence_pattern? && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? - && - (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6188,7 +6203,7 @@ class_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Call ( func , args , keywords , EXTRA ); + _res = values ? values : _Py_Tuple ( values , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6197,49 +6212,63 @@ class_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ','.pattern+ ',' ','.keyword_pattern+ ','? ')'")); + D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? +static expr_ty +open_sequence_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; } - { // name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')' + expr_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // maybe_star_pattern ',' maybe_sequence_pattern? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); - asdl_seq * _gather_65_var; + D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); Token * _literal; - Token * _literal_1; - Token * _literal_2; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - void *_opt_var_1; - UNUSED(_opt_var_1); // Silence compiler warnings - void *_opt_var_2; - UNUSED(_opt_var_2); // Silence compiler warnings - expr_ty error; - expr_ty func; + expr_ty value; + void *values; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (_opt_var = _tmp_64_rule(p), 1) // [','.pattern+ ','] - && - (_gather_65_var = _gather_65_rule(p)) // ','.keyword_pattern+ - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' - && - (error = pattern_rule(p)) // pattern + (value = maybe_star_pattern_rule(p)) // maybe_star_pattern && - (_opt_var_1 = _tmp_67_rule(p), 1) // [',' ','.error_argument_pattern+] - && - (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' + (values = maybe_sequence_pattern_rule(p), 1) // maybe_sequence_pattern? ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "positional pattern follows keyword pattern" ); + D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6248,43 +6277,43 @@ class_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.pattern+ ','] ','.keyword_pattern+ ',' pattern [',' ','.error_argument_pattern+] ','? ')'")); + D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); } - { // name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')' + _res = NULL; + done: + D(p->level--); + return _res; +} + +// maybe_sequence_pattern: ','.maybe_star_pattern+ ','? +static asdl_seq* +maybe_sequence_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq* _res = NULL; + int _mark = p->mark; + { // ','.maybe_star_pattern+ ','? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); - Token * _literal; - Token * _literal_1; + D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - void *_opt_var_1; - UNUSED(_opt_var_1); // Silence compiler warnings - void *_opt_var_2; - UNUSED(_opt_var_2); // Silence compiler warnings - expr_ty error; - expr_ty func; + asdl_seq * values; if ( - (func = name_or_attr_rule(p)) // name_or_attr - && - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (_opt_var = _tmp_68_rule(p), 1) // [','.error_argument_pattern+ ','] - && - (error = error_star_rule(p)) // error_star + (values = _gather_56_rule(p)) // ','.maybe_star_pattern+ && - (_opt_var_1 = _tmp_69_rule(p), 1) // [',' ','.(error_argument_pattern | error_star)+] - && - (_opt_var_2 = _PyPegen_expect_token(p, 12), 1) // ','? - && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) { - D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); - _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( error , "can't use starred pattern here" ); + D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); + _res = values; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6293,8 +6322,8 @@ class_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' [','.error_argument_pattern+ ','] error_star [',' ','.(error_argument_pattern | error_star)+] ','? ')'")); + D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?")); } _res = NULL; done: @@ -6302,9 +6331,9 @@ class_pattern_rule(Parser *p) return _res; } -// signed_number: NUMBER | '-' NUMBER +// maybe_star_pattern: star_pattern | pattern static expr_ty -signed_number_rule(Parser *p) +maybe_star_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6313,69 +6342,43 @@ signed_number_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NUMBER + { // star_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); - expr_ty number_var; + D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern")); + expr_ty star_pattern_var; if ( - (number_var = _PyPegen_number_token(p)) // NUMBER + (star_pattern_var = star_pattern_rule(p)) // star_pattern ) { - D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); - _res = number_var; + D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern")); + _res = star_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); + D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern")); } - { // '-' NUMBER + { // pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); - Token * _literal; - expr_ty number; + D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); + expr_ty pattern_var; if ( - (_literal = _PyPegen_expect_token(p, 15)) // token='-' - && - (number = _PyPegen_number_token(p)) // NUMBER + (pattern_var = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_UnaryOp ( USub , number , EXTRA ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); + _res = pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); + D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); } _res = NULL; done: @@ -6383,39 +6386,9 @@ signed_number_rule(Parser *p) return _res; } -// Left-recursive -// attr: name_or_attr '.' NAME -static expr_ty attr_raw(Parser *); -static expr_ty -attr_rule(Parser *p) -{ - D(p->level++); - expr_ty _res = NULL; - if (_PyPegen_is_memoized(p, attr_type, &_res)) { - D(p->level--); - return _res; - } - int _mark = p->mark; - int _resmark = p->mark; - while (1) { - int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); - if (tmpvar_1) { - D(p->level--); - return _res; - } - p->mark = _mark; - void *_raw = attr_raw(p); - if (_raw == NULL || p->mark <= _resmark) - break; - _resmark = p->mark; - _res = _raw; - } - p->mark = _resmark; - D(p->level--); - return _res; -} +// star_pattern: '*' (capture_pattern | wildcard_pattern) static expr_ty -attr_raw(Parser *p) +star_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6433,24 +6406,21 @@ attr_raw(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // name_or_attr '.' NAME + { // '*' (capture_pattern | wildcard_pattern) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); + D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); Token * _literal; - expr_ty attr; - expr_ty value; + void *value; if ( - (value = name_or_attr_rule(p)) // name_or_attr - && - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (attr = _PyPegen_name_token(p)) // NAME + (value = _tmp_58_rule(p)) // capture_pattern | wildcard_pattern ) { - D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); + D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6460,7 +6430,7 @@ attr_raw(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); + _res = _Py_Starred ( value , Store , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6469,8 +6439,8 @@ attr_raw(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); + D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (capture_pattern | wildcard_pattern)")); } _res = NULL; done: @@ -6478,10 +6448,9 @@ attr_raw(Parser *p) return _res; } -// Left-recursive -// name_or_attr: attr | NAME +// mapping_pattern: '{' items_pattern? '}' static expr_ty -name_or_attr_rule(Parser *p) +mapping_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6490,78 +6459,43 @@ name_or_attr_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; - { // attr - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); - expr_ty attr_var; - if ( - (attr_var = attr_rule(p)) // attr - ) - { - D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); - _res = attr_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); - } - { // NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); - expr_ty name_var; - if ( - (name_var = _PyPegen_name_token(p)) // NAME - ) - { - D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); - _res = name_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// values_pattern: ','.value_pattern+ ','? -static asdl_seq* -values_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; D(p->level--); return NULL; } - asdl_seq* _res = NULL; - int _mark = p->mark; - { // ','.value_pattern+ ','? + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // '{' items_pattern? '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> values_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.value_pattern+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_seq * values; + D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); + Token * _literal; + Token * _literal_1; + void *items; if ( - (values = _gather_70_rule(p)) // ','.value_pattern+ + (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + (items = items_pattern_rule(p), 1) // items_pattern? + && + (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ values_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.value_pattern+ ','?")); - _res = values; + D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern? '}'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , items ) ) , CHECK ( _PyPegen_get_values ( p , items ) ) , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6570,8 +6504,8 @@ values_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s values_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.value_pattern+ ','?")); + D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern? '}'")); } _res = NULL; done: @@ -6600,7 +6534,7 @@ items_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * items; if ( - (items = _gather_72_rule(p)) // ','.key_value_pattern+ + (items = _gather_59_rule(p)) // ','.key_value_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -6624,54 +6558,36 @@ items_pattern_rule(Parser *p) return _res; } -// keyword_pattern: NAME '=' pattern -static keyword_ty -keyword_pattern_rule(Parser *p) +// key_value_pattern: (literal_pattern | value_pattern) ':' pattern | double_star_pattern +static KeyValuePair* +key_value_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - keyword_ty _res = NULL; + KeyValuePair* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro - { // NAME '=' pattern + { // (literal_pattern | value_pattern) ':' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); Token * _literal; - expr_ty arg; + void *key; expr_ty value; if ( - (arg = _PyPegen_name_token(p)) // NAME + (key = _tmp_61_rule(p)) // literal_pattern | value_pattern && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (value = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_keyword ( arg -> v . Name . id , value , EXTRA ); + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); + _res = _PyPegen_key_value_pair ( p , key , value ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6680,63 +6596,27 @@ keyword_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// error_argument_pattern: pattern | keyword_pattern -static void * -error_argument_pattern_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> error_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - expr_ty pattern_var; - if ( - (pattern_var = pattern_rule(p)) // pattern - ) - { - D(fprintf(stderr, "%*c+ error_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); - _res = pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s error_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); + D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | value_pattern) ':' pattern")); } - { // keyword_pattern + { // double_star_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> error_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - keyword_ty keyword_pattern_var; + D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); + KeyValuePair* double_star_pattern_var; if ( - (keyword_pattern_var = keyword_pattern_rule(p)) // keyword_pattern + (double_star_pattern_var = double_star_pattern_rule(p)) // double_star_pattern ) { - D(fprintf(stderr, "%*c+ error_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern")); - _res = keyword_pattern_var; + D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_star_pattern")); + _res = double_star_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s error_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern")); + D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_star_pattern")); } _res = NULL; done: @@ -6744,33 +6624,33 @@ error_argument_pattern_rule(Parser *p) return _res; } -// error_star: ('*' | '**') NAME -static expr_ty -error_star_rule(Parser *p) +// double_star_pattern: '**' capture_pattern +static KeyValuePair* +double_star_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - expr_ty _res = NULL; + KeyValuePair* _res = NULL; int _mark = p->mark; - { // ('*' | '**') NAME + { // '**' capture_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> error_star[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); - void *_tmp_74_var; - expr_ty error; + D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); + Token * _literal; + expr_ty value; if ( - (_tmp_74_var = _tmp_74_rule(p)) // '*' | '**' + (_literal = _PyPegen_expect_token(p, 35)) // token='**' && - (error = _PyPegen_name_token(p)) // NAME + (value = capture_pattern_rule(p)) // capture_pattern ) { - D(fprintf(stderr, "%*c+ error_star[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('*' | '**') NAME")); - _res = error; + D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' capture_pattern")); + _res = _PyPegen_key_value_pair ( p , NULL , value ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6779,8 +6659,8 @@ error_star_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s error_star[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('*' | '**') NAME")); + D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' capture_pattern")); } _res = NULL; done: @@ -6788,9 +6668,13 @@ error_star_rule(Parser *p) return _res; } -// value_pattern: '*' name_pattern | pattern +// class_pattern: +// | name_or_attr '(' ')' +// | name_or_attr '(' positional_patterns ','? ')' +// | name_or_attr '(' keyword_patterns ','? ')' +// | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' static expr_ty -value_pattern_rule(Parser *p) +class_pattern_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -6808,21 +6692,24 @@ value_pattern_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '*' name_pattern + { // name_or_attr '(' ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' name_pattern")); + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); Token * _literal; - expr_ty value; + Token * _literal_1; + expr_ty func; if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (value = name_pattern_rule(p)) // name_pattern + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' name_pattern")); + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -6832,7 +6719,7 @@ value_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Starred ( value , Store , EXTRA ); + _res = _Py_Call ( func , NULL , NULL , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6841,27 +6728,152 @@ value_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' name_pattern")); + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); } - { // pattern + { // name_or_attr '(' positional_patterns ','? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); - expr_ty pattern_var; + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_expr_seq* args; + expr_ty func; if ( - (pattern_var = pattern_rule(p)) // pattern + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (args = positional_patterns_rule(p)) // positional_patterns + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); - _res = pattern_var; + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , args , NULL , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); + } + { // name_or_attr '(' keyword_patterns ','? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty func; + asdl_keyword_seq* keywords; + if ( + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (keywords = keyword_patterns_rule(p)) // keyword_patterns + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , NULL , keywords , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); + } + { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); + Token * _literal; + Token * _literal_1; + Token * _literal_2; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + asdl_expr_seq* args; + expr_ty func; + asdl_keyword_seq* keywords; + if ( + (func = name_or_attr_rule(p)) // name_or_attr + && + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (args = positional_patterns_rule(p)) // positional_patterns + && + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (keywords = keyword_patterns_rule(p)) // keyword_patterns + && + (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? + && + (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Call ( func , args , keywords , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); } _res = NULL; done: @@ -6869,36 +6881,30 @@ value_pattern_rule(Parser *p) return _res; } -// key_value_pattern: (literal_pattern | constant_pattern) ':' pattern | '**' name_pattern -static KeyValuePair* -key_value_pattern_rule(Parser *p) +// positional_patterns: ','.pattern+ +static asdl_expr_seq* +positional_patterns_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - KeyValuePair* _res = NULL; + asdl_expr_seq* _res = NULL; int _mark = p->mark; - { // (literal_pattern | constant_pattern) ':' pattern + { // ','.pattern+ if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); - Token * _literal; - void *key; - expr_ty value; + D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); + asdl_expr_seq* args; if ( - (key = _tmp_75_rule(p)) // literal_pattern | constant_pattern - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (value = pattern_rule(p)) // pattern + (args = (asdl_expr_seq*)_gather_62_rule(p)) // ','.pattern+ ) { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); - _res = _PyPegen_key_value_pair ( p , key , value ); + D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); + _res = args; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6907,25 +6913,104 @@ key_value_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_pattern | constant_pattern) ':' pattern")); + D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// keyword_patterns: ','.keyword_pattern+ +static asdl_keyword_seq* +keyword_patterns_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_keyword_seq* _res = NULL; + int _mark = p->mark; + { // ','.keyword_pattern+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); + asdl_keyword_seq* keywords; + if ( + (keywords = (asdl_keyword_seq*)_gather_64_rule(p)) // ','.keyword_pattern+ + ) + { + D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); + _res = keywords; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// keyword_pattern: NAME '=' pattern +static keyword_ty +keyword_pattern_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + keyword_ty _res = NULL; + int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - { // '**' name_pattern + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro + { // NAME '=' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' name_pattern")); + D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); Token * _literal; + expr_ty arg; expr_ty value; if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' + (arg = _PyPegen_name_token(p)) // NAME + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' && - (value = name_pattern_rule(p)) // name_pattern + (value = pattern_rule(p)) // pattern ) { - D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' name_pattern")); - _res = _PyPegen_key_value_pair ( p , NULL , value ); + D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_keyword ( arg -> v . Name . id , value , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6934,8 +7019,8 @@ key_value_pattern_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' name_pattern")); + D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); } _res = NULL; done: @@ -7039,7 +7124,7 @@ raise_stmt_rule(Parser *p) && (a = expression_rule(p)) // expression && - (b = _tmp_76_rule(p), 1) // ['from' expression] + (b = _tmp_66_rule(p), 1) // ['from' expression] ) { D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]")); @@ -7214,7 +7299,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_77_rule(p), 1) // ['->' expression] + (a = _tmp_67_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7274,7 +7359,7 @@ function_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (a = _tmp_78_rule(p), 1) // ['->' expression] + (a = _tmp_68_rule(p), 1) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -7338,7 +7423,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_79_rule, p) + _PyPegen_lookahead(1, _tmp_69_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -7482,9 +7567,9 @@ parameters_rule(Parser *p) if ( (a = slash_no_default_rule(p)) // slash_no_default && - (b = (asdl_arg_seq*)_loop0_80_rule(p)) // param_no_default* + (b = (asdl_arg_seq*)_loop0_70_rule(p)) // param_no_default* && - (c = _loop0_81_rule(p)) // param_with_default* + (c = _loop0_71_rule(p)) // param_with_default* && (d = star_etc_rule(p), 1) // star_etc? ) @@ -7514,7 +7599,7 @@ parameters_rule(Parser *p) if ( (a = slash_with_default_rule(p)) // slash_with_default && - (b = _loop0_82_rule(p)) // param_with_default* + (b = _loop0_72_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7542,9 +7627,9 @@ parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = (asdl_arg_seq*)_loop1_83_rule(p)) // param_no_default+ + (a = (asdl_arg_seq*)_loop1_73_rule(p)) // param_no_default+ && - (b = _loop0_84_rule(p)) // param_with_default* + (b = _loop0_74_rule(p)) // param_with_default* && (c = star_etc_rule(p), 1) // star_etc? ) @@ -7571,7 +7656,7 @@ parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_85_rule(p)) // param_with_default+ + (a = _loop1_75_rule(p)) // param_with_default+ && (b = star_etc_rule(p), 1) // star_etc? ) @@ -7640,7 +7725,7 @@ slash_no_default_rule(Parser *p) Token * _literal_1; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_86_rule(p)) // param_no_default+ + (a = (asdl_arg_seq*)_loop1_76_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7669,7 +7754,7 @@ slash_no_default_rule(Parser *p) Token * _literal; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_87_rule(p)) // param_no_default+ + (a = (asdl_arg_seq*)_loop1_77_rule(p)) // param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7719,9 +7804,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_88_rule(p)) // param_no_default* + (a = _loop0_78_rule(p)) // param_no_default* && - (b = _loop1_89_rule(p)) // param_with_default+ + (b = _loop1_79_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7751,9 +7836,9 @@ slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_90_rule(p)) // param_no_default* + (a = _loop0_80_rule(p)) // param_no_default* && - (b = _loop1_91_rule(p)) // param_with_default+ + (b = _loop1_81_rule(p)) // param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -7809,7 +7894,7 @@ star_etc_rule(Parser *p) && (a = param_no_default_rule(p)) // param_no_default && - (b = _loop0_92_rule(p)) // param_maybe_default* + (b = _loop0_82_rule(p)) // param_maybe_default* && (c = kwds_rule(p), 1) // kwds? ) @@ -7842,7 +7927,7 @@ star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_93_rule(p)) // param_maybe_default+ + (b = _loop1_83_rule(p)) // param_maybe_default+ && (c = kwds_rule(p), 1) // kwds? ) @@ -8364,7 +8449,7 @@ decorators_rule(Parser *p) D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_loop1_94_rule(p)) // (('@' named_expression NEWLINE))+ + (a = (asdl_expr_seq*)_loop1_84_rule(p)) // (('@' named_expression NEWLINE))+ ) { D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); @@ -8485,7 +8570,7 @@ class_def_raw_rule(Parser *p) && (a = _PyPegen_name_token(p)) // NAME && - (b = _tmp_95_rule(p), 1) // ['(' arguments? ')'] + (b = _tmp_85_rule(p), 1) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -8634,7 +8719,7 @@ expressions_list_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_96_rule(p)) // ','.star_expression+ + (a = (asdl_expr_seq*)_gather_86_rule(p)) // ','.star_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8694,7 +8779,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_98_rule(p)) // ((',' star_expression))+ + (b = _loop1_88_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8889,7 +8974,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_99_rule(p)) // ','.star_named_expression+ + (a = (asdl_expr_seq*)_gather_89_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9194,7 +9279,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_101_rule(p)) // ((',' expression))+ + (b = _loop1_91_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9548,9 +9633,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = (asdl_arg_seq*)_loop0_102_rule(p)) // lambda_param_no_default* + (b = (asdl_arg_seq*)_loop0_92_rule(p)) // lambda_param_no_default* && - (c = _loop0_103_rule(p)) // lambda_param_with_default* + (c = _loop0_93_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9580,7 +9665,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_104_rule(p)) // lambda_param_with_default* + (b = _loop0_94_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9608,9 +9693,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = (asdl_arg_seq*)_loop1_105_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_95_rule(p)) // lambda_param_no_default+ && - (b = _loop0_106_rule(p)) // lambda_param_with_default* + (b = _loop0_96_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9637,7 +9722,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_107_rule(p)) // lambda_param_with_default+ + (a = _loop1_97_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9708,7 +9793,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_108_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_98_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9737,7 +9822,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_109_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_99_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9787,9 +9872,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_110_rule(p)) // lambda_param_no_default* + (a = _loop0_100_rule(p)) // lambda_param_no_default* && - (b = _loop1_111_rule(p)) // lambda_param_with_default+ + (b = _loop1_101_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9819,9 +9904,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_112_rule(p)) // lambda_param_no_default* + (a = _loop0_102_rule(p)) // lambda_param_no_default* && - (b = _loop1_113_rule(p)) // lambda_param_with_default+ + (b = _loop1_103_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9877,7 +9962,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_114_rule(p)) // lambda_param_maybe_default* + (b = _loop0_104_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -9910,7 +9995,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_115_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_105_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -10337,7 +10422,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_116_rule(p)) // (('or' conjunction))+ + (b = _loop1_106_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -10423,7 +10508,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_117_rule(p)) // (('and' inversion))+ + (b = _loop1_107_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10591,7 +10676,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_118_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_108_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -10919,10 +11004,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_119_var; + void *_tmp_109_var; expr_ty a; if ( - (_tmp_119_var = _tmp_119_rule(p)) // '!=' + (_tmp_109_var = _tmp_109_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12851,7 +12936,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_120_rule(p)) // ','.slice+ + (a = (asdl_expr_seq*)_gather_110_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -12921,7 +13006,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_122_rule(p), 1) // [':' expression?] + (c = _tmp_112_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -13170,15 +13255,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_123_var; + void *_tmp_113_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_123_var = _tmp_123_rule(p)) // tuple | group | genexp + (_tmp_113_var = _tmp_113_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_123_var; + _res = _tmp_113_var; goto done; } p->mark = _mark; @@ -13191,15 +13276,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_124_var; + void *_tmp_114_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_124_var = _tmp_124_rule(p)) // list | listcomp + (_tmp_114_var = _tmp_114_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_124_var; + _res = _tmp_114_var; goto done; } p->mark = _mark; @@ -13212,15 +13297,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_125_var; + void *_tmp_115_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_125_var = _tmp_125_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_115_var = _tmp_115_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_125_var; + _res = _tmp_115_var; goto done; } p->mark = _mark; @@ -13289,7 +13374,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_126_rule(p)) // STRING+ + (a = _loop1_116_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -13503,7 +13588,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_127_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_117_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13559,7 +13644,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_128_rule(p)) // yield_expr | named_expression + (a = _tmp_118_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -14028,7 +14113,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_129_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_119_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14181,7 +14266,7 @@ for_if_clauses_rule(Parser *p) D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); asdl_comprehension_seq* a; if ( - (a = (asdl_comprehension_seq*)_loop1_131_rule(p)) // for_if_clause+ + (a = (asdl_comprehension_seq*)_loop1_121_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); @@ -14243,7 +14328,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_132_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_122_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14286,7 +14371,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_133_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_123_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14532,9 +14617,9 @@ args_rule(Parser *p) asdl_expr_seq* a; void *b; if ( - (a = (asdl_expr_seq*)_gather_134_rule(p)) // ','.(starred_expression | named_expression !'=')+ + (a = (asdl_expr_seq*)_gather_124_rule(p)) // ','.(starred_expression | named_expression !'=')+ && - (b = _tmp_136_rule(p), 1) // [',' kwargs] + (b = _tmp_126_rule(p), 1) // [',' kwargs] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); @@ -14622,11 +14707,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_137_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_127_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_139_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_129_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14648,13 +14733,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_141_var; + asdl_seq * _gather_131_var; if ( - (_gather_141_var = _gather_141_rule(p)) // ','.kwarg_or_starred+ + (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_141_var; + _res = _gather_131_var; goto done; } p->mark = _mark; @@ -14667,13 +14752,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_143_var; + asdl_seq * _gather_133_var; if ( - (_gather_143_var = _gather_143_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_133_var = _gather_133_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_143_var; + _res = _gather_133_var; goto done; } p->mark = _mark; @@ -15035,7 +15120,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_145_rule(p)) // ((',' star_target))* + (b = _loop0_135_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15089,7 +15174,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_146_rule(p)) // ','.star_target+ + (a = (asdl_expr_seq*)_gather_136_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15152,7 +15237,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_148_rule(p)) // !'*' star_target + (a = _tmp_138_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15674,7 +15759,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_149_rule(p)) // ','.del_target+ + (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16015,7 +16100,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_151_rule(p)) // ','.target+ + (a = (asdl_expr_seq*)_gather_141_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16727,7 +16812,7 @@ incorrect_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_153_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_143_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -16985,7 +17070,7 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_154_var; + asdl_seq * _loop0_144_var; expr_ty a; expr_ty expression_var; if ( @@ -16993,7 +17078,7 @@ invalid_assignment_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_154_var = _loop0_154_rule(p)) // star_named_expressions* + (_loop0_144_var = _loop0_144_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -17050,10 +17135,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); Token * _literal; - asdl_seq * _loop0_155_var; + asdl_seq * _loop0_145_var; expr_ty a; if ( - (_loop0_155_var = _loop0_155_rule(p)) // ((star_targets '='))* + (_loop0_145_var = _loop0_145_rule(p)) // ((star_targets '='))* && (a = star_expressions_rule(p)) // star_expressions && @@ -17080,10 +17165,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); Token * _literal; - asdl_seq * _loop0_156_var; + asdl_seq * _loop0_146_var; expr_ty a; if ( - (_loop0_156_var = _loop0_156_rule(p)) // ((star_targets '='))* + (_loop0_146_var = _loop0_146_rule(p)) // ((star_targets '='))* && (a = yield_expr_rule(p)) // yield_expr && @@ -17109,7 +17194,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_157_var; + void *_tmp_147_var; expr_ty a; AugOperator* augassign_var; if ( @@ -17117,7 +17202,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_157_var = _tmp_157_rule(p)) // yield_expr | star_expressions + (_tmp_147_var = _tmp_147_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -17328,11 +17413,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_158_var; + void *_tmp_148_var; expr_ty a; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_158_var = _tmp_158_rule(p)) // '[' | '(' | '{' + (_tmp_148_var = _tmp_148_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -17429,13 +17514,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_159_var; - void *_tmp_160_var; + asdl_seq * _loop0_149_var; + void *_tmp_150_var; arg_ty param_no_default_var; if ( - (_loop0_159_var = _loop0_159_rule(p)) // param_no_default* + (_loop0_149_var = _loop0_149_rule(p)) // param_no_default* && - (_tmp_160_var = _tmp_160_rule(p)) // slash_with_default | param_with_default+ + (_tmp_150_var = _tmp_150_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -17477,13 +17562,13 @@ invalid_lambda_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); - asdl_seq * _loop0_161_var; - void *_tmp_162_var; + asdl_seq * _loop0_151_var; + void *_tmp_152_var; arg_ty lambda_param_no_default_var; if ( - (_loop0_161_var = _loop0_161_rule(p)) // lambda_param_no_default* + (_loop0_151_var = _loop0_151_rule(p)) // lambda_param_no_default* && - (_tmp_162_var = _tmp_162_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ + (_tmp_152_var = _tmp_152_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ && (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) @@ -17525,11 +17610,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_163_var; + void *_tmp_153_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_163_var = _tmp_163_rule(p)) // ')' | ',' (')' | '**') + (_tmp_153_var = _tmp_153_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -17599,11 +17684,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_164_var; + void *_tmp_154_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_164_var = _tmp_164_rule(p)) // ':' | ',' (':' | '**') + (_tmp_154_var = _tmp_154_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -19112,12 +19197,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_165_var; + void *_tmp_155_var; while ( - (_tmp_165_var = _tmp_165_rule(p)) // star_targets '=' + (_tmp_155_var = _tmp_155_rule(p)) // star_targets '=' ) { - _res = _tmp_165_var; + _res = _tmp_155_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19620,12 +19705,12 @@ _loop0_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_166_var; + void *_tmp_156_var; while ( - (_tmp_166_var = _tmp_166_rule(p)) // '.' | '...' + (_tmp_156_var = _tmp_156_rule(p)) // '.' | '...' ) { - _res = _tmp_166_var; + _res = _tmp_156_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19686,12 +19771,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_167_var; + void *_tmp_157_var; while ( - (_tmp_167_var = _tmp_167_rule(p)) // '.' | '...' + (_tmp_157_var = _tmp_157_rule(p)) // '.' | '...' ) { - _res = _tmp_167_var; + _res = _tmp_157_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20876,7 +20961,7 @@ _gather_51_rule(Parser *p) return _res; } -// _tmp_53: '.' | '(' | '=' +// _tmp_53: '+' | '-' static void * _tmp_53_rule(Parser *p) { @@ -20887,62 +20972,43 @@ _tmp_53_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '.' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - ) - { - D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); - } - { // '(' + { // '+' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' + (_literal = _PyPegen_expect_token(p, 14)) // token='+' ) { - D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); _res = _literal; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); } - { // '=' + { // '-' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (_literal = _PyPegen_expect_token(p, 15)) // token='-' ) { - D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); _res = _literal; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); } _res = NULL; done: @@ -20950,7 +21016,7 @@ _tmp_53_rule(Parser *p) return _res; } -// _tmp_54: '+' | '-' +// _tmp_54: '.' | '(' | '=' static void * _tmp_54_rule(Parser *p) { @@ -20961,43 +21027,62 @@ _tmp_54_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '+' + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 14)) // token='+' + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } - { // '-' + { // '(' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 15)) // token='-' + (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + } + { // '=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + ) + { + D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } _res = NULL; done: @@ -21079,7 +21164,7 @@ _tmp_55_rule(Parser *p) return _res; } -// _loop0_57: ',' pattern +// _loop0_57: ',' maybe_star_pattern static asdl_seq * _loop0_57_rule(Parser *p) { @@ -21100,18 +21185,18 @@ _loop0_57_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' maybe_star_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); Token * _literal; expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern ) { _res = elem; @@ -21137,7 +21222,7 @@ _loop0_57_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -21154,7 +21239,7 @@ _loop0_57_rule(Parser *p) return _seq; } -// _gather_56: pattern _loop0_57 +// _gather_56: maybe_star_pattern _loop0_57 static asdl_seq * _gather_56_rule(Parser *p) { @@ -21165,27 +21250,27 @@ _gather_56_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_57 + { // maybe_star_pattern _loop0_57 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); + D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); expr_ty elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern && (seq = _loop0_57_rule(p)) // _loop0_57 ) { - D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_57")); + D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_57")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_57")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_57")); } _res = NULL; done: @@ -21193,113 +21278,54 @@ _gather_56_rule(Parser *p) return _res; } -// _loop0_59: ',' keyword_pattern -static asdl_seq * -_loop0_59_rule(Parser *p) +// _tmp_58: capture_pattern | wildcard_pattern +static void * +_tmp_58_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' keyword_pattern + { // capture_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); - Token * _literal; - keyword_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = keyword_pattern_rule(p)) // keyword_pattern + D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); + expr_ty capture_pattern_var; + if ( + (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); + _res = capture_pattern_var; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_59[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_59_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_58: keyword_pattern _loop0_59 -static asdl_seq * -_gather_58_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // keyword_pattern _loop0_59 + { // wildcard_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); - keyword_ty elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); + expr_ty wildcard_pattern_var; if ( - (elem = keyword_pattern_rule(p)) // keyword_pattern - && - (seq = _loop0_59_rule(p)) // _loop0_59 + (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern ) { - D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_59")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); + _res = wildcard_pattern_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_59")); + D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); } _res = NULL; done: @@ -21307,9 +21333,9 @@ _gather_58_rule(Parser *p) return _res; } -// _loop0_61: ',' pattern +// _loop0_60: ',' key_value_pattern static asdl_seq * -_loop0_61_rule(Parser *p) +_loop0_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21328,18 +21354,18 @@ _loop0_61_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // ',' key_value_pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; - expr_ty elem; + KeyValuePair* elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = pattern_rule(p)) // pattern + (elem = key_value_pattern_rule(p)) // key_value_pattern ) { _res = elem; @@ -21364,8 +21390,8 @@ _loop0_61_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -21377,14 +21403,14 @@ _loop0_61_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); D(p->level--); return _seq; } -// _gather_60: pattern _loop0_61 +// _gather_59: key_value_pattern _loop0_60 static asdl_seq * -_gather_60_rule(Parser *p) +_gather_59_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21393,27 +21419,82 @@ _gather_60_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_61 + { // key_value_pattern _loop0_60 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); + KeyValuePair* elem; asdl_seq * seq; if ( - (elem = pattern_rule(p)) // pattern + (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_61_rule(p)) // _loop0_61 + (seq = _loop0_60_rule(p)) // _loop0_60 ) { - D(fprintf(stderr, "%*c+ _gather_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_61")); + D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_60[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_61")); + D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_60")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_61: literal_pattern | value_pattern +static void * +_tmp_61_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // literal_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + expr_ty literal_pattern_var; + if ( + (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); + _res = literal_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); + } + { // value_pattern + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); + expr_ty value_pattern_var; + if ( + (value_pattern_var = value_pattern_rule(p)) // value_pattern + ) + { + D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); + _res = value_pattern_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); } _res = NULL; done: @@ -21421,7 +21502,7 @@ _gather_60_rule(Parser *p) return _res; } -// _loop0_63: ',' keyword_pattern +// _loop0_63: ',' pattern static asdl_seq * _loop0_63_rule(Parser *p) { @@ -21442,18 +21523,18 @@ _loop0_63_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' keyword_pattern + { // ',' pattern if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; - keyword_ty elem; + expr_ty elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = keyword_pattern_rule(p)) // keyword_pattern + (elem = pattern_rule(p)) // pattern ) { _res = elem; @@ -21479,7 +21560,7 @@ _loop0_63_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -21496,7 +21577,7 @@ _loop0_63_rule(Parser *p) return _seq; } -// _gather_62: keyword_pattern _loop0_63 +// _gather_62: pattern _loop0_63 static asdl_seq * _gather_62_rule(Parser *p) { @@ -21507,66 +21588,27 @@ _gather_62_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_63 + { // pattern _loop0_63 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); - keyword_ty elem; + D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); + expr_ty elem; asdl_seq * seq; if ( - (elem = keyword_pattern_rule(p)) // keyword_pattern + (elem = pattern_rule(p)) // pattern && (seq = _loop0_63_rule(p)) // _loop0_63 ) { - D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_63")); + D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_63")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_64: ','.pattern+ ',' -static void * -_tmp_64_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ','.pattern+ ',' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - asdl_seq * _gather_168_var; - Token * _literal; - if ( - (_gather_168_var = _gather_168_rule(p)) // ','.pattern+ - && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - ) - { - D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_168_var, _literal); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+ ','")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_63")); } _res = NULL; done: @@ -21574,9 +21616,9 @@ _tmp_64_rule(Parser *p) return _res; } -// _loop0_66: ',' keyword_pattern +// _loop0_65: ',' keyword_pattern static asdl_seq * -_loop0_66_rule(Parser *p) +_loop0_65_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21600,7 +21642,7 @@ _loop0_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; keyword_ty elem; while ( @@ -21631,7 +21673,7 @@ _loop0_66_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -21644,14 +21686,14 @@ _loop0_66_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); D(p->level--); return _seq; } -// _gather_65: keyword_pattern _loop0_66 +// _gather_64: keyword_pattern _loop0_65 static asdl_seq * -_gather_65_rule(Parser *p) +_gather_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21660,27 +21702,27 @@ _gather_65_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_66 + { // keyword_pattern _loop0_65 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); + D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); keyword_ty elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_66_rule(p)) // _loop0_66 + (seq = _loop0_65_rule(p)) // _loop0_65 ) { - D(fprintf(stderr, "%*c+ _gather_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_66")); + D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_65[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_66")); + D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_65")); } _res = NULL; done: @@ -21688,9 +21730,9 @@ _gather_65_rule(Parser *p) return _res; } -// _tmp_67: ',' ','.error_argument_pattern+ +// _tmp_66: 'from' expression static void * -_tmp_67_rule(Parser *p) +_tmp_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21699,27 +21741,32 @@ _tmp_67_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.error_argument_pattern+ + { // 'from' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); - asdl_seq * _gather_170_var; - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); + Token * _keyword; + expr_ty z; if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_keyword = _PyPegen_expect_token(p, 514)) // token='from' && - (_gather_170_var = _gather_170_rule(p)) // ','.error_argument_pattern+ + (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.error_argument_pattern+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_170_var); + D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.error_argument_pattern+")); + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); } _res = NULL; done: @@ -21727,9 +21774,9 @@ _tmp_67_rule(Parser *p) return _res; } -// _tmp_68: ','.error_argument_pattern+ ',' +// _tmp_67: '->' expression static void * -_tmp_68_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21738,27 +21785,32 @@ _tmp_68_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ','.error_argument_pattern+ ',' + { // '->' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); - asdl_seq * _gather_172_var; + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; + expr_ty z; if ( - (_gather_172_var = _gather_172_rule(p)) // ','.error_argument_pattern+ + (_literal = _PyPegen_expect_token(p, 51)) // token='->' && - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.error_argument_pattern+ ','")); - _res = _PyPegen_dummy_name(p, _gather_172_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.error_argument_pattern+ ','")); + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; done: @@ -21766,9 +21818,9 @@ _tmp_68_rule(Parser *p) return _res; } -// _tmp_69: ',' ','.(error_argument_pattern | error_star)+ +// _tmp_68: '->' expression static void * -_tmp_69_rule(Parser *p) +_tmp_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21777,27 +21829,32 @@ _tmp_69_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ',' ','.(error_argument_pattern | error_star)+ + { // '->' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); - asdl_seq * _gather_174_var; + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; + expr_ty z; if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (_literal = _PyPegen_expect_token(p, 51)) // token='->' && - (_gather_174_var = _gather_174_rule(p)) // ','.(error_argument_pattern | error_star)+ + (z = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); - _res = _PyPegen_dummy_name(p, _literal, _gather_174_var); + D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' ','.(error_argument_pattern | error_star)+")); + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; done: @@ -21805,48 +21862,78 @@ _tmp_69_rule(Parser *p) return _res; } -// _loop0_71: ',' value_pattern -static asdl_seq * -_loop0_71_rule(Parser *p) +// _tmp_69: NEWLINE INDENT +static void * +_tmp_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' value_pattern + { // NEWLINE INDENT if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' value_pattern")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + Token * indent_var; + Token * newline_var; + if ( + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' && - (elem = value_pattern_rule(p)) // value_pattern + (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + _res = _PyPegen_dummy_name(p, newline_var, indent_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_70: param_no_default +static asdl_seq * +_loop0_70_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // param_no_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + arg_ty param_no_default_var; + while ( + (param_no_default_var = param_no_default_rule(p)) // param_no_default + ) + { + _res = param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21862,8 +21949,8 @@ _loop0_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' value_pattern")); + D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -21875,53 +21962,80 @@ _loop0_71_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); D(p->level--); return _seq; } -// _gather_70: value_pattern _loop0_71 +// _loop0_71: param_with_default static asdl_seq * -_gather_70_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // value_pattern _loop0_71 + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = value_pattern_rule(p)) // value_pattern - && - (seq = _loop0_71_rule(p)) // _loop0_71 + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + NameDefaultPair* param_with_default_var; + while ( + (param_with_default_var = param_with_default_rule(p)) // param_with_default ) { - D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern _loop0_71")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; + _res = param_with_default_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern _loop0_71")); + D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); - return _res; + return _seq; } -// _loop0_73: ',' key_value_pattern +// _loop0_72: param_with_default static asdl_seq * -_loop0_73_rule(Parser *p) +_loop0_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -21940,27 +22054,18 @@ _loop0_73_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' key_value_pattern + { // param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); - Token * _literal; - KeyValuePair* elem; + D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + NameDefaultPair* param_with_default_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = key_value_pattern_rule(p)) // key_value_pattern + (param_with_default_var = param_with_default_rule(p)) // param_with_default ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21976,8 +22081,8 @@ _loop0_73_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -21989,364 +22094,115 @@ _loop0_73_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq); D(p->level--); return _seq; } -// _gather_72: key_value_pattern _loop0_73 +// _loop1_73: param_no_default static asdl_seq * -_gather_72_rule(Parser *p) +_loop1_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_73 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); - KeyValuePair* elem; - asdl_seq * seq; - if ( - (elem = key_value_pattern_rule(p)) // key_value_pattern - && - (seq = _loop0_73_rule(p)) // _loop0_73 - ) - { - D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_73")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_74: '*' | '**' -static void * -_tmp_74_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); D(p->level--); return NULL; } - void * _res = NULL; - int _mark = p->mark; - { // '*' + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 16)) // token='*' + D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + arg_ty param_no_default_var; + while ( + (param_no_default_var = param_no_default_rule(p)) // param_no_default ) { - D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); - _res = _literal; - goto done; + _res = param_no_default_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); + D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } - { // '**' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 35)) // token='**' - ) - { - D(fprintf(stderr, "%*c+ _tmp_74[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_75: literal_pattern | constant_pattern -static void * -_tmp_75_rule(Parser *p) +// _loop0_74: param_with_default +static asdl_seq * +_loop0_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // literal_pattern + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - expr_ty literal_pattern_var; - if ( - (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern + D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + NameDefaultPair* param_with_default_var; + while ( + (param_with_default_var = param_with_default_rule(p)) // param_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); - _res = literal_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); - } - { // constant_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - expr_ty constant_pattern_var; - if ( - (constant_pattern_var = constant_pattern_rule(p)) // constant_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "constant_pattern")); - _res = constant_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_75[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "constant_pattern")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_76: 'from' expression -static void * -_tmp_76_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'from' expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 514)) // token='from' - && - (z = expression_rule(p)) // expression - ) - { - D(fprintf(stderr, "%*c+ _tmp_76[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_76[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_77: '->' expression -static void * -_tmp_77_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '->' expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); - Token * _literal; - expr_ty z; - if ( - (_literal = _PyPegen_expect_token(p, 51)) // token='->' - && - (z = expression_rule(p)) // expression - ) - { - D(fprintf(stderr, "%*c+ _tmp_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_77[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_78: '->' expression -static void * -_tmp_78_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '->' expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); - Token * _literal; - expr_ty z; - if ( - (_literal = _PyPegen_expect_token(p, 51)) // token='->' - && - (z = expression_rule(p)) // expression - ) - { - D(fprintf(stderr, "%*c+ _tmp_78[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_78[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_79: NEWLINE INDENT -static void * -_tmp_79_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // NEWLINE INDENT - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); - Token * indent_var; - Token * newline_var; - if ( - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - && - (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' - ) - { - D(fprintf(stderr, "%*c+ _tmp_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); - _res = _PyPegen_dummy_name(p, newline_var, indent_var); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_79[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_80: param_no_default -static asdl_seq * -_loop0_80_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // param_no_default - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); - arg_ty param_no_default_var; - while ( - (param_no_default_var = param_no_default_rule(p)) // param_no_default - ) - { - _res = param_no_default_var; + _res = param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22362,8 +22218,8 @@ _loop0_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -22375,14 +22231,14 @@ _loop0_80_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); D(p->level--); return _seq; } -// _loop0_81: param_with_default +// _loop1_75: param_with_default static asdl_seq * -_loop0_81_rule(Parser *p) +_loop1_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22406,7 +22262,7 @@ _loop0_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22428,9 +22284,14 @@ _loop0_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; + } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { PyMem_Free(_children); @@ -22441,14 +22302,14 @@ _loop0_81_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); D(p->level--); return _seq; } -// _loop0_82: param_with_default +// _loop1_76: param_no_default static asdl_seq * -_loop0_82_rule(Parser *p) +_loop1_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22467,18 +22328,18 @@ _loop0_82_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_with_default + { // param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); - NameDefaultPair* param_with_default_var; + D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + arg_ty param_no_default_var; while ( - (param_with_default_var = param_with_default_rule(p)) // param_with_default + (param_no_default_var = param_no_default_rule(p)) // param_no_default ) { - _res = param_with_default_var; + _res = param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22494,8 +22355,13 @@ _loop0_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -22507,14 +22373,14 @@ _loop0_82_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); D(p->level--); return _seq; } -// _loop1_83: param_no_default +// _loop1_77: param_no_default static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22538,7 +22404,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22560,7 +22426,7 @@ _loop1_83_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -22578,14 +22444,14 @@ _loop1_83_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); D(p->level--); return _seq; } -// _loop0_84: param_with_default +// _loop0_78: param_no_default static asdl_seq * -_loop0_84_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22604,18 +22470,18 @@ _loop0_84_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_with_default + { // param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); - NameDefaultPair* param_with_default_var; + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + arg_ty param_no_default_var; while ( - (param_with_default_var = param_with_default_rule(p)) // param_with_default + (param_no_default_var = param_no_default_rule(p)) // param_no_default ) { - _res = param_with_default_var; + _res = param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22631,8 +22497,8 @@ _loop0_84_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -22644,14 +22510,14 @@ _loop0_84_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _loop1_85: param_with_default +// _loop1_79: param_with_default static asdl_seq * -_loop1_85_rule(Parser *p) +_loop1_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22675,7 +22541,7 @@ _loop1_85_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -22697,7 +22563,7 @@ _loop1_85_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -22715,14 +22581,14 @@ _loop1_85_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); D(p->level--); return _seq; } -// _loop1_86: param_no_default +// _loop0_80: param_no_default static asdl_seq * -_loop1_86_rule(Parser *p) +_loop0_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22746,7 +22612,7 @@ _loop1_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -22768,14 +22634,9 @@ _loop1_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { PyMem_Free(_children); @@ -22786,14 +22647,14 @@ _loop1_86_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); D(p->level--); return _seq; } -// _loop1_87: param_no_default +// _loop1_81: param_with_default static asdl_seq * -_loop1_87_rule(Parser *p) +_loop1_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22812,18 +22673,18 @@ _loop1_87_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_no_default + { // param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); - arg_ty param_no_default_var; + D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + NameDefaultPair* param_with_default_var; while ( - (param_no_default_var = param_no_default_rule(p)) // param_no_default + (param_with_default_var = param_with_default_rule(p)) // param_with_default ) { - _res = param_no_default_var; + _res = param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22839,8 +22700,8 @@ _loop1_87_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -22857,14 +22718,14 @@ _loop1_87_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); D(p->level--); return _seq; } -// _loop0_88: param_no_default +// _loop0_82: param_maybe_default static asdl_seq * -_loop0_88_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22883,18 +22744,18 @@ _loop0_88_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_no_default + { // param_maybe_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); - arg_ty param_no_default_var; + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + NameDefaultPair* param_maybe_default_var; while ( - (param_no_default_var = param_no_default_rule(p)) // param_no_default + (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default ) { - _res = param_no_default_var; + _res = param_maybe_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22910,8 +22771,8 @@ _loop0_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -22923,14 +22784,14 @@ _loop0_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _loop1_89: param_with_default +// _loop1_83: param_maybe_default static asdl_seq * -_loop1_89_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -22949,18 +22810,18 @@ _loop1_89_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_with_default + { // param_maybe_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); - NameDefaultPair* param_with_default_var; + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); + NameDefaultPair* param_maybe_default_var; while ( - (param_with_default_var = param_with_default_rule(p)) // param_with_default + (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default ) { - _res = param_with_default_var; + _res = param_maybe_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22976,8 +22837,8 @@ _loop1_89_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -22994,14 +22855,14 @@ _loop1_89_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop0_90: param_no_default +// _loop1_84: ('@' named_expression NEWLINE) static asdl_seq * -_loop0_90_rule(Parser *p) +_loop1_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23020,18 +22881,18 @@ _loop0_90_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_no_default + { // ('@' named_expression NEWLINE) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); - arg_ty param_no_default_var; + D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); + void *_tmp_158_var; while ( - (param_no_default_var = param_no_default_rule(p)) // param_no_default + (_tmp_158_var = _tmp_158_rule(p)) // '@' named_expression NEWLINE ) { - _res = param_no_default_var; + _res = _tmp_158_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23047,8 +22908,13 @@ _loop0_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23060,85 +22926,61 @@ _loop0_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); D(p->level--); return _seq; } -// _loop1_91: param_with_default -static asdl_seq * -_loop1_91_rule(Parser *p) +// _tmp_85: '(' arguments? ')' +static void * +_tmp_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // param_with_default + { // '(' arguments? ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); - NameDefaultPair* param_with_default_var; - while ( - (param_with_default_var = param_with_default_rule(p)) // param_with_default + D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + Token * _literal; + Token * _literal_1; + void *z; + if ( + (_literal = _PyPegen_expect_token(p, 7)) // token='(' + && + (z = arguments_rule(p), 1) // arguments? + && + (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - _res = param_with_default_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; + D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - _children[_n++] = _res; - _mark = p->mark; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _loop0_92: param_maybe_default +// _loop0_87: ',' star_expression static asdl_seq * -_loop0_92_rule(Parser *p) +_loop0_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23157,18 +22999,27 @@ _loop0_92_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_maybe_default + { // ',' star_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); - NameDefaultPair* param_maybe_default_var; + D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + Token * _literal; + expr_ty elem; while ( - (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = star_expression_rule(p)) // star_expression ) { - _res = param_maybe_default_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23184,8 +23035,8 @@ _loop0_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23197,14 +23048,53 @@ _loop0_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); D(p->level--); return _seq; } -// _loop1_93: param_maybe_default +// _gather_86: star_expression _loop0_87 +static asdl_seq * +_gather_86_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // star_expression _loop0_87 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_87")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = star_expression_rule(p)) // star_expression + && + (seq = _loop0_87_rule(p)) // _loop0_87 + ) + { + D(fprintf(stderr, "%*c+ _gather_86[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_87")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_86[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_87")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop1_88: (',' star_expression) static asdl_seq * -_loop1_93_rule(Parser *p) +_loop1_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23223,18 +23113,18 @@ _loop1_93_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_maybe_default + { // (',' star_expression) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); - NameDefaultPair* param_maybe_default_var; + D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_159_var; while ( - (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default + (_tmp_159_var = _tmp_159_rule(p)) // ',' star_expression ) { - _res = param_maybe_default_var; + _res = _tmp_159_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23250,8 +23140,8 @@ _loop1_93_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); + D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -23268,14 +23158,14 @@ _loop1_93_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); D(p->level--); return _seq; } -// _loop1_94: ('@' named_expression NEWLINE) +// _loop0_90: ',' star_named_expression static asdl_seq * -_loop1_94_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23294,18 +23184,27 @@ _loop1_94_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ('@' named_expression NEWLINE) + { // ',' star_named_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_176_var; + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + Token * _literal; + expr_ty elem; while ( - (_tmp_176_var = _tmp_176_rule(p)) // '@' named_expression NEWLINE + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = star_named_expression_rule(p)) // star_named_expression ) { - _res = _tmp_176_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23321,13 +23220,8 @@ _loop1_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_94[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23339,51 +23233,43 @@ _loop1_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _tmp_95: '(' arguments? ')' -static void * -_tmp_95_rule(Parser *p) +// _gather_89: star_named_expression _loop0_90 +static asdl_seq * +_gather_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // '(' arguments? ')' + { // star_named_expression _loop0_90 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); - Token * _literal; - Token * _literal_1; - void *z; + D(fprintf(stderr, "%*c> _gather_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_90")); + expr_ty elem; + asdl_seq * seq; if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - && - (z = arguments_rule(p), 1) // arguments? + (elem = star_named_expression_rule(p)) // star_named_expression && - (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' + (seq = _loop0_90_rule(p)) // _loop0_90 ) { - D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } + D(fprintf(stderr, "%*c+ _gather_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_90")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c%s _gather_89[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_90")); } _res = NULL; done: @@ -23391,9 +23277,9 @@ _tmp_95_rule(Parser *p) return _res; } -// _loop0_97: ',' star_expression +// _loop1_91: (',' expression) static asdl_seq * -_loop0_97_rule(Parser *p) +_loop1_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23412,27 +23298,18 @@ _loop0_97_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' star_expression + { // (',' expression) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); - Token * _literal; - expr_ty elem; + D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_160_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = star_expression_rule(p)) // star_expression + (_tmp_160_var = _tmp_160_rule(p)) // ',' expression ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23448,8 +23325,13 @@ _loop0_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_97[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23461,53 +23343,14 @@ _loop0_97_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); D(p->level--); return _seq; } -// _gather_96: star_expression _loop0_97 +// _loop0_92: lambda_param_no_default static asdl_seq * -_gather_96_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // star_expression _loop0_97 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = star_expression_rule(p)) // star_expression - && - (seq = _loop0_97_rule(p)) // _loop0_97 - ) - { - D(fprintf(stderr, "%*c+ _gather_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_97")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_96[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_97")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop1_98: (',' star_expression) -static asdl_seq * -_loop1_98_rule(Parser *p) +_loop0_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23526,18 +23369,18 @@ _loop1_98_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (',' star_expression) + { // lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_177_var; + D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + arg_ty lambda_param_no_default_var; while ( - (_tmp_177_var = _tmp_177_rule(p)) // ',' star_expression + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - _res = _tmp_177_var; + _res = lambda_param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23553,13 +23396,8 @@ _loop1_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23571,14 +23409,14 @@ _loop1_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); D(p->level--); return _seq; } -// _loop0_100: ',' star_named_expression +// _loop0_93: lambda_param_with_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23597,27 +23435,18 @@ _loop0_100_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' star_named_expression + { // lambda_param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); - Token * _literal; - expr_ty elem; + D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + NameDefaultPair* lambda_param_with_default_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = star_named_expression_rule(p)) // star_named_expression + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = lambda_param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23633,8 +23462,8 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23646,53 +23475,80 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq); D(p->level--); return _seq; } -// _gather_99: star_named_expression _loop0_100 +// _loop0_94: lambda_param_with_default static asdl_seq * -_gather_99_rule(Parser *p) +_loop0_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_100 + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // lambda_param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = star_named_expression_rule(p)) // star_named_expression - && - (seq = _loop0_100_rule(p)) // _loop0_100 + D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default ) { - D(fprintf(stderr, "%*c+ _gather_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_100")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; + _res = lambda_param_with_default_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_99[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_100")); + D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); D(p->level--); - return _res; + return _seq; } -// _loop1_101: (',' expression) +// _loop1_95: lambda_param_no_default static asdl_seq * -_loop1_101_rule(Parser *p) +_loop1_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23711,18 +23567,18 @@ _loop1_101_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (',' expression) + { // lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_178_var; + D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + arg_ty lambda_param_no_default_var; while ( - (_tmp_178_var = _tmp_178_rule(p)) // ',' expression + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - _res = _tmp_178_var; + _res = lambda_param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23738,8 +23594,8 @@ _loop1_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); + D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -23756,14 +23612,14 @@ _loop1_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); D(p->level--); return _seq; } -// _loop0_102: lambda_param_no_default +// _loop0_96: lambda_param_with_default static asdl_seq * -_loop0_102_rule(Parser *p) +_loop0_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23782,18 +23638,18 @@ _loop0_102_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_no_default + { // lambda_param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); - arg_ty lambda_param_no_default_var; + D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + NameDefaultPair* lambda_param_with_default_var; while ( - (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default ) { - _res = lambda_param_no_default_var; + _res = lambda_param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23809,8 +23665,8 @@ _loop0_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23822,14 +23678,14 @@ _loop0_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq); D(p->level--); return _seq; } -// _loop0_103: lambda_param_with_default +// _loop1_97: lambda_param_with_default static asdl_seq * -_loop0_103_rule(Parser *p) +_loop1_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23853,7 +23709,7 @@ _loop0_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23875,9 +23731,14 @@ _loop0_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; + } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { PyMem_Free(_children); @@ -23888,14 +23749,14 @@ _loop0_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_with_default +// _loop1_98: lambda_param_no_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop1_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23914,18 +23775,18 @@ _loop0_104_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_with_default + { // lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); - NameDefaultPair* lambda_param_with_default_var; + D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + arg_ty lambda_param_no_default_var; while ( - (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - _res = lambda_param_with_default_var; + _res = lambda_param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23941,8 +23802,13 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -23954,14 +23820,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_no_default +// _loop1_99: lambda_param_no_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23985,7 +23851,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24007,7 +23873,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -24025,14 +23891,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop0_106: lambda_param_with_default +// _loop0_100: lambda_param_no_default static asdl_seq * -_loop0_106_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24051,18 +23917,18 @@ _loop0_106_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_with_default + { // lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); - NameDefaultPair* lambda_param_with_default_var; + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + arg_ty lambda_param_no_default_var; while ( - (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - _res = lambda_param_with_default_var; + _res = lambda_param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24078,8 +23944,8 @@ _loop0_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -24091,14 +23957,14 @@ _loop0_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop1_107: lambda_param_with_default +// _loop1_101: lambda_param_with_default static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24122,7 +23988,7 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24144,7 +24010,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24162,14 +24028,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop1_108: lambda_param_no_default +// _loop0_102: lambda_param_no_default static asdl_seq * -_loop1_108_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24193,7 +24059,7 @@ _loop1_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24215,14 +24081,9 @@ _loop1_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { PyMem_Free(_children); @@ -24233,14 +24094,14 @@ _loop1_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop1_109: lambda_param_no_default +// _loop1_103: lambda_param_with_default static asdl_seq * -_loop1_109_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24259,18 +24120,18 @@ _loop1_109_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_no_default + { // lambda_param_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); - arg_ty lambda_param_no_default_var; + D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + NameDefaultPair* lambda_param_with_default_var; while ( - (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default ) { - _res = lambda_param_no_default_var; + _res = lambda_param_with_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24286,8 +24147,8 @@ _loop1_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_109[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -24304,14 +24165,14 @@ _loop1_109_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop0_110: lambda_param_no_default +// _loop0_104: lambda_param_maybe_default static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24330,18 +24191,18 @@ _loop0_110_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_no_default + { // lambda_param_maybe_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); - arg_ty lambda_param_no_default_var; + D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + NameDefaultPair* lambda_param_maybe_default_var; while ( - (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default ) { - _res = lambda_param_no_default_var; + _res = lambda_param_maybe_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24357,8 +24218,8 @@ _loop0_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -24370,14 +24231,14 @@ _loop0_110_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_111: lambda_param_with_default +// _loop1_105: lambda_param_maybe_default static asdl_seq * -_loop1_111_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24396,18 +24257,18 @@ _loop1_111_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_with_default + { // lambda_param_maybe_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); - NameDefaultPair* lambda_param_with_default_var; + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + NameDefaultPair* lambda_param_maybe_default_var; while ( - (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default ) { - _res = lambda_param_with_default_var; + _res = lambda_param_maybe_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24423,8 +24284,8 @@ _loop1_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_111[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -24441,14 +24302,14 @@ _loop1_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop0_112: lambda_param_no_default +// _loop1_106: ('or' conjunction) static asdl_seq * -_loop0_112_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24467,18 +24328,18 @@ _loop0_112_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_no_default + { // ('or' conjunction) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); - arg_ty lambda_param_no_default_var; + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_161_var; while ( - (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + (_tmp_161_var = _tmp_161_rule(p)) // 'or' conjunction ) { - _res = lambda_param_no_default_var; + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24494,8 +24355,13 @@ _loop0_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -24507,14 +24373,14 @@ _loop0_112_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _loop1_113: lambda_param_with_default +// _loop1_107: ('and' inversion) static asdl_seq * -_loop1_113_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24533,18 +24399,18 @@ _loop1_113_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_with_default + { // ('and' inversion) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); - NameDefaultPair* lambda_param_with_default_var; + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_162_var; while ( - (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default + (_tmp_162_var = _tmp_162_rule(p)) // 'and' inversion ) { - _res = lambda_param_with_default_var; + _res = _tmp_162_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24560,8 +24426,8 @@ _loop1_113_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -24578,80 +24444,14 @@ _loop1_113_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_113_type, _seq); - D(p->level--); - return _seq; -} - -// _loop0_114: lambda_param_maybe_default -static asdl_seq * -_loop0_114_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // lambda_param_maybe_default - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); - NameDefaultPair* lambda_param_maybe_default_var; - while ( - (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default - ) - { - _res = lambda_param_maybe_default_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop1_115: lambda_param_maybe_default +// _loop1_108: compare_op_bitwise_or_pair static asdl_seq * -_loop1_115_rule(Parser *p) +_loop1_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24670,18 +24470,18 @@ _loop1_115_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_maybe_default + { // compare_op_bitwise_or_pair if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); - NameDefaultPair* lambda_param_maybe_default_var; + D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + CmpopExprPair* compare_op_bitwise_or_pair_var; while ( - (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default + (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair ) { - _res = lambda_param_maybe_default_var; + _res = compare_op_bitwise_or_pair_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24697,8 +24497,8 @@ _loop1_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_115[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -24715,85 +24515,55 @@ _loop1_115_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); D(p->level--); return _seq; } -// _loop1_116: ('or' conjunction) -static asdl_seq * -_loop1_116_rule(Parser *p) +// _tmp_109: '!=' +static void * +_tmp_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ('or' conjunction) + { // '!=' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_179_var; - while ( - (_tmp_179_var = _tmp_179_rule(p)) // 'or' conjunction + D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + Token * tok; + if ( + (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - _res = _tmp_179_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; + D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; } - _children[_n++] = _res; - _mark = p->mark; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _loop1_117: ('and' inversion) +// _loop0_111: ',' slice static asdl_seq * -_loop1_117_rule(Parser *p) +_loop0_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24812,18 +24582,27 @@ _loop1_117_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ('and' inversion) + { // ',' slice if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_180_var; + D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + Token * _literal; + expr_ty elem; while ( - (_tmp_180_var = _tmp_180_rule(p)) // 'and' inversion + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = slice_rule(p)) // slice ) { - _res = _tmp_180_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24839,13 +24618,8 @@ _loop1_117_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_117[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -24857,85 +24631,53 @@ _loop1_117_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_117_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); D(p->level--); return _seq; } -// _loop1_118: compare_op_bitwise_or_pair +// _gather_110: slice _loop0_111 static asdl_seq * -_loop1_118_rule(Parser *p) +_gather_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // compare_op_bitwise_or_pair + { // slice _loop0_111 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); - CmpopExprPair* compare_op_bitwise_or_pair_var; - while ( - (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair + D(fprintf(stderr, "%*c> _gather_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_111")); + expr_ty elem; + asdl_seq * seq; + if ( + (elem = slice_rule(p)) // slice + && + (seq = _loop0_111_rule(p)) // _loop0_111 ) { - _res = compare_op_bitwise_or_pair_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _gather_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_111")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_118[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _gather_110[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_111")); } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_118_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _tmp_119: '!=' +// _tmp_112: ':' expression? static void * -_tmp_119_rule(Parser *p) +_tmp_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24944,19 +24686,22 @@ _tmp_119_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '!=' + { // ':' expression? if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); - Token * tok; + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + Token * _literal; + void *d; if ( - (tok = _PyPegen_expect_token(p, 28)) // token='!=' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); - _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -24965,8 +24710,8 @@ _tmp_119_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_119[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; done: @@ -24974,192 +24719,34 @@ _tmp_119_rule(Parser *p) return _res; } -// _loop0_121: ',' slice -static asdl_seq * -_loop0_121_rule(Parser *p) +// _tmp_113: tuple | group | genexp +static void * +_tmp_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' slice + { // tuple if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = slice_rule(p)) // slice - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_120: slice _loop0_121 -static asdl_seq * -_gather_120_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // slice _loop0_121 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = slice_rule(p)) // slice - && - (seq = _loop0_121_rule(p)) // _loop0_121 - ) - { - D(fprintf(stderr, "%*c+ _gather_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_121")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_121")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_122: ':' expression? -static void * -_tmp_122_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ':' expression? - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); - Token * _literal; - void *d; - if ( - (_literal = _PyPegen_expect_token(p, 11)) // token=':' - && - (d = expression_rule(p), 1) // expression? - ) - { - D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); - _res = d; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_123: tuple | group | genexp -static void * -_tmp_123_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // tuple - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -25167,18 +24754,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -25186,18 +24773,18 @@ _tmp_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -25206,9 +24793,9 @@ _tmp_123_rule(Parser *p) return _res; } -// _tmp_124: list | listcomp +// _tmp_114: list | listcomp static void * -_tmp_124_rule(Parser *p) +_tmp_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25222,18 +24809,18 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -25241,18 +24828,18 @@ _tmp_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -25261,9 +24848,9 @@ _tmp_124_rule(Parser *p) return _res; } -// _tmp_125: dict | set | dictcomp | setcomp +// _tmp_115: dict | set | dictcomp | setcomp static void * -_tmp_125_rule(Parser *p) +_tmp_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25277,18 +24864,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -25296,18 +24883,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -25315,18 +24902,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -25334,18 +24921,18 @@ _tmp_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -25354,9 +24941,9 @@ _tmp_125_rule(Parser *p) return _res; } -// _loop1_126: STRING +// _loop1_116: STRING static asdl_seq * -_loop1_126_rule(Parser *p) +_loop1_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25380,7 +24967,7 @@ _loop1_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -25402,7 +24989,7 @@ _loop1_126_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -25420,14 +25007,14 @@ _loop1_126_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_126_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); D(p->level--); return _seq; } -// _tmp_127: star_named_expression ',' star_named_expressions? +// _tmp_117: star_named_expression ',' star_named_expressions? static void * -_tmp_127_rule(Parser *p) +_tmp_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25441,7 +25028,7 @@ _tmp_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -25453,7 +25040,7 @@ _tmp_127_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25463,7 +25050,7 @@ _tmp_127_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -25472,9 +25059,9 @@ _tmp_127_rule(Parser *p) return _res; } -// _tmp_128: yield_expr | named_expression +// _tmp_118: yield_expr | named_expression static void * -_tmp_128_rule(Parser *p) +_tmp_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25487,742 +25074,39 @@ _tmp_128_rule(Parser *p) if (p->error_indicator) { D(p->level--); return NULL; - } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); - expr_ty yield_expr_var; - if ( - (yield_expr_var = yield_expr_rule(p)) // yield_expr - ) - { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); - _res = yield_expr_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); - } - { // named_expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); - expr_ty named_expression_var; - if ( - (named_expression_var = named_expression_rule(p)) // named_expression - ) - { - D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); - _res = named_expression_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_130: ',' double_starred_kvpair -static asdl_seq * -_loop0_130_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' double_starred_kvpair - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); - Token * _literal; - KeyValuePair* elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_129: double_starred_kvpair _loop0_130 -static asdl_seq * -_gather_129_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // double_starred_kvpair _loop0_130 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); - KeyValuePair* elem; - asdl_seq * seq; - if ( - (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair - && - (seq = _loop0_130_rule(p)) // _loop0_130 - ) - { - D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_130")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_130")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop1_131: for_if_clause -static asdl_seq * -_loop1_131_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // for_if_clause - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop1_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); - comprehension_ty for_if_clause_var; - while ( - (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause - ) - { - _res = for_if_clause_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_131[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); - } - if (_n == 0 || p->error_indicator) { - PyMem_Free(_children); - D(p->level--); - return NULL; - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_131_type, _seq); - D(p->level--); - return _seq; -} - -// _loop0_132: ('if' disjunction) -static asdl_seq * -_loop0_132_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ('if' disjunction) - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_181_var; - while ( - (_tmp_181_var = _tmp_181_rule(p)) // 'if' disjunction - ) - { - _res = _tmp_181_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); - D(p->level--); - return _seq; -} - -// _loop0_133: ('if' disjunction) -static asdl_seq * -_loop0_133_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ('if' disjunction) - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_182_var; - while ( - (_tmp_182_var = _tmp_182_rule(p)) // 'if' disjunction - ) - { - _res = _tmp_182_var; - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); - D(p->level--); - return _seq; -} - -// _loop0_135: ',' (starred_expression | named_expression !'=') -static asdl_seq * -_loop0_135_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' (starred_expression | named_expression !'=') - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')")); - Token * _literal; - void *elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = _tmp_183_rule(p)) // starred_expression | named_expression !'=' - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_134: (starred_expression | named_expression !'=') _loop0_135 -static asdl_seq * -_gather_134_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // (starred_expression | named_expression !'=') _loop0_135 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_135")); - void *elem; - asdl_seq * seq; - if ( - (elem = _tmp_183_rule(p)) // starred_expression | named_expression !'=' - && - (seq = _loop0_135_rule(p)) // _loop0_135 - ) - { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_135")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_135")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_136: ',' kwargs -static void * -_tmp_136_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ',' kwargs - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); - Token * _literal; - asdl_seq* k; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (k = kwargs_rule(p)) // kwargs - ) - { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); - _res = k; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_138: ',' kwarg_or_starred -static asdl_seq * -_loop0_138_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' kwarg_or_starred - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); - Token * _literal; - KeywordOrStarred* elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_137: kwarg_or_starred _loop0_138 -static asdl_seq * -_gather_137_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // kwarg_or_starred _loop0_138 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); - KeywordOrStarred* elem; - asdl_seq * seq; - if ( - (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred - && - (seq = _loop0_138_rule(p)) // _loop0_138 - ) - { - D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_138")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_138")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop0_140: ',' kwarg_or_double_starred -static asdl_seq * -_loop0_140_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' kwarg_or_double_starred - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); - Token * _literal; - KeywordOrStarred* elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_139: kwarg_or_double_starred _loop0_140 -static asdl_seq * -_gather_139_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + } + D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + expr_ty yield_expr_var; + if ( + (yield_expr_var = yield_expr_rule(p)) // yield_expr + ) + { + D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + _res = yield_expr_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // kwarg_or_double_starred _loop0_140 + { // named_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); - KeywordOrStarred* elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + expr_ty named_expression_var; if ( - (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred - && - (seq = _loop0_140_rule(p)) // _loop0_140 + (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_140")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_140")); + D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; done: @@ -26230,9 +25114,9 @@ _gather_139_rule(Parser *p) return _res; } -// _loop0_142: ',' kwarg_or_starred +// _loop0_120: ',' double_starred_kvpair static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26251,18 +25135,18 @@ _loop0_142_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' kwarg_or_starred + { // ',' double_starred_kvpair if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; - KeywordOrStarred* elem; + KeyValuePair* elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred + (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair ) { _res = elem; @@ -26287,8 +25171,8 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26300,14 +25184,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); D(p->level--); return _seq; } -// _gather_141: kwarg_or_starred _loop0_142 +// _gather_119: double_starred_kvpair _loop0_120 static asdl_seq * -_gather_141_rule(Parser *p) +_gather_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26316,27 +25200,27 @@ _gather_141_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_142 + { // double_starred_kvpair _loop0_120 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_142")); - KeywordOrStarred* elem; + D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_120")); + KeyValuePair* elem; asdl_seq * seq; if ( - (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred + (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_142_rule(p)) // _loop0_142 + (seq = _loop0_120_rule(p)) // _loop0_120 ) { - D(fprintf(stderr, "%*c+ _gather_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_142")); + D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_120")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_141[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_142")); + D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_120")); } _res = NULL; done: @@ -26344,9 +25228,9 @@ _gather_141_rule(Parser *p) return _res; } -// _loop0_144: ',' kwarg_or_double_starred +// _loop1_121: for_if_clause static asdl_seq * -_loop0_144_rule(Parser *p) +_loop1_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26365,27 +25249,18 @@ _loop0_144_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' kwarg_or_double_starred + { // for_if_clause if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); - Token * _literal; - KeywordOrStarred* elem; + D(fprintf(stderr, "%*c> _loop1_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + comprehension_ty for_if_clause_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred + (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = for_if_clause_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26401,8 +25276,13 @@ _loop0_144_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c%s _loop1_121[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26414,53 +25294,80 @@ _loop0_144_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_121_type, _seq); D(p->level--); return _seq; } -// _gather_143: kwarg_or_double_starred _loop0_144 +// _loop0_122: ('if' disjunction) static asdl_seq * -_gather_143_rule(Parser *p) +_loop0_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_144 + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ('if' disjunction) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_144")); - KeywordOrStarred* elem; - asdl_seq * seq; - if ( - (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred - && - (seq = _loop0_144_rule(p)) // _loop0_144 + D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_163_var; + while ( + (_tmp_163_var = _tmp_163_rule(p)) // 'if' disjunction ) { - D(fprintf(stderr, "%*c+ _gather_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_144")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; + _res = _tmp_163_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_143[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_144")); + D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); D(p->level--); - return _res; + return _seq; } -// _loop0_145: (',' star_target) +// _loop0_123: ('if' disjunction) static asdl_seq * -_loop0_145_rule(Parser *p) +_loop0_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26479,18 +25386,18 @@ _loop0_145_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (',' star_target) + { // ('if' disjunction) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_184_var; + D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_164_var; while ( - (_tmp_184_var = _tmp_184_rule(p)) // ',' star_target + (_tmp_164_var = _tmp_164_rule(p)) // 'if' disjunction ) { - _res = _tmp_184_var; + _res = _tmp_164_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26506,8 +25413,8 @@ _loop0_145_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); + D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26519,14 +25426,14 @@ _loop0_145_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq); D(p->level--); return _seq; } -// _loop0_147: ',' star_target +// _loop0_125: ',' (starred_expression | named_expression !'=') static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26545,18 +25452,18 @@ _loop0_147_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' star_target + { // ',' (starred_expression | named_expression !'=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')")); Token * _literal; - expr_ty elem; + void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = star_target_rule(p)) // star_target + (elem = _tmp_165_rule(p)) // starred_expression | named_expression !'=' ) { _res = elem; @@ -26581,8 +25488,8 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26594,14 +25501,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_125_type, _seq); D(p->level--); return _seq; } -// _gather_146: star_target _loop0_147 +// _gather_124: (starred_expression | named_expression !'=') _loop0_125 static asdl_seq * -_gather_146_rule(Parser *p) +_gather_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26610,27 +25517,27 @@ _gather_146_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_147 + { // (starred_expression | named_expression !'=') _loop0_125 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_147")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); + void *elem; asdl_seq * seq; if ( - (elem = star_target_rule(p)) // star_target + (elem = _tmp_165_rule(p)) // starred_expression | named_expression !'=' && - (seq = _loop0_147_rule(p)) // _loop0_147 + (seq = _loop0_125_rule(p)) // _loop0_125 ) { - D(fprintf(stderr, "%*c+ _gather_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_147")); + D(fprintf(stderr, "%*c+ _gather_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_147")); + D(fprintf(stderr, "%*c%s _gather_124[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); } _res = NULL; done: @@ -26638,9 +25545,9 @@ _gather_146_rule(Parser *p) return _res; } -// _tmp_148: !'*' star_target +// _tmp_126: ',' kwargs static void * -_tmp_148_rule(Parser *p) +_tmp_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26649,26 +25556,146 @@ _tmp_148_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // !'*' star_target + { // ',' kwargs if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); - expr_ty star_target_var; + D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + Token * _literal; + asdl_seq* k; if ( - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (star_target_var = star_target_rule(p)) // star_target + (k = kwargs_rule(p)) // kwargs ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); - _res = star_target_var; + D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + _res = k; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_128: ',' kwarg_or_starred +static asdl_seq * +_loop0_128_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // ',' kwarg_or_starred + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + Token * _literal; + KeywordOrStarred* elem; + while ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred + ) + { + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); + } + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); + D(p->level--); + return _seq; +} + +// _gather_127: kwarg_or_starred _loop0_128 +static asdl_seq * +_gather_127_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // kwarg_or_starred _loop0_128 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_128")); + KeywordOrStarred* elem; + asdl_seq * seq; + if ( + (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred + && + (seq = _loop0_128_rule(p)) // _loop0_128 + ) + { + D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_128")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_128")); } _res = NULL; done: @@ -26676,9 +25703,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _loop0_150: ',' del_target +// _loop0_130: ',' kwarg_or_double_starred static asdl_seq * -_loop0_150_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26697,18 +25724,18 @@ _loop0_150_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' del_target + { // ',' kwarg_or_double_starred if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; - expr_ty elem; + KeywordOrStarred* elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = del_target_rule(p)) // del_target + (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred ) { _res = elem; @@ -26733,8 +25760,8 @@ _loop0_150_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26746,14 +25773,14 @@ _loop0_150_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _gather_149: del_target _loop0_150 +// _gather_129: kwarg_or_double_starred _loop0_130 static asdl_seq * -_gather_149_rule(Parser *p) +_gather_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26762,27 +25789,27 @@ _gather_149_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_150 + { // kwarg_or_double_starred _loop0_130 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_150")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_130")); + KeywordOrStarred* elem; asdl_seq * seq; if ( - (elem = del_target_rule(p)) // del_target + (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_150_rule(p)) // _loop0_150 + (seq = _loop0_130_rule(p)) // _loop0_130 ) { - D(fprintf(stderr, "%*c+ _gather_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_150")); + D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_130")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_149[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_150")); + D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_130")); } _res = NULL; done: @@ -26790,9 +25817,9 @@ _gather_149_rule(Parser *p) return _res; } -// _loop0_152: ',' target +// _loop0_132: ',' kwarg_or_starred static asdl_seq * -_loop0_152_rule(Parser *p) +_loop0_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26811,18 +25838,18 @@ _loop0_152_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' target + { // ',' kwarg_or_starred if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; - expr_ty elem; + KeywordOrStarred* elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = target_rule(p)) // target + (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred ) { _res = elem; @@ -26847,8 +25874,8 @@ _loop0_152_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -26860,14 +25887,14 @@ _loop0_152_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); D(p->level--); return _seq; } -// _gather_151: target _loop0_152 +// _gather_131: kwarg_or_starred _loop0_132 static asdl_seq * -_gather_151_rule(Parser *p) +_gather_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26876,85 +25903,27 @@ _gather_151_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_152 + { // kwarg_or_starred _loop0_132 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_152")); - expr_ty elem; + D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_132")); + KeywordOrStarred* elem; asdl_seq * seq; if ( - (elem = target_rule(p)) // target + (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_152_rule(p)) // _loop0_152 + (seq = _loop0_132_rule(p)) // _loop0_132 ) { - D(fprintf(stderr, "%*c+ _gather_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_152")); + D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_132")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_151[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_152")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_153: args | expression for_if_clauses -static void * -_tmp_153_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // args - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); - expr_ty args_var; - if ( - (args_var = args_rule(p)) // args - ) - { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); - _res = args_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); - } - { // expression for_if_clauses - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); - expr_ty expression_var; - asdl_comprehension_seq* for_if_clauses_var; - if ( - (expression_var = expression_rule(p)) // expression - && - (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses - ) - { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); - _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_132")); } _res = NULL; done: @@ -26962,9 +25931,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _loop0_154: star_named_expressions +// _loop0_134: ',' kwarg_or_double_starred static asdl_seq * -_loop0_154_rule(Parser *p) +_loop0_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26983,18 +25952,27 @@ _loop0_154_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // star_named_expressions + { // ',' kwarg_or_double_starred if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); - asdl_expr_seq* star_named_expressions_var; + D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + Token * _literal; + KeywordOrStarred* elem; while ( - (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred ) { - _res = star_named_expressions_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27010,8 +25988,8 @@ _loop0_154_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_154[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27023,14 +26001,53 @@ _loop0_154_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_154_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); D(p->level--); return _seq; } -// _loop0_155: (star_targets '=') +// _gather_133: kwarg_or_double_starred _loop0_134 +static asdl_seq * +_gather_133_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + asdl_seq * _res = NULL; + int _mark = p->mark; + { // kwarg_or_double_starred _loop0_134 + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _gather_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + KeywordOrStarred* elem; + asdl_seq * seq; + if ( + (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred + && + (seq = _loop0_134_rule(p)) // _loop0_134 + ) + { + D(fprintf(stderr, "%*c+ _gather_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _gather_133[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop0_135: (',' star_target) static asdl_seq * -_loop0_155_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27049,18 +26066,18 @@ _loop0_155_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (star_targets '=') + { // (',' star_target) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_185_var; + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_166_var; while ( - (_tmp_185_var = _tmp_185_rule(p)) // star_targets '=' + (_tmp_166_var = _tmp_166_rule(p)) // ',' star_target ) { - _res = _tmp_185_var; + _res = _tmp_166_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27076,8 +26093,8 @@ _loop0_155_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27089,14 +26106,14 @@ _loop0_155_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _loop0_156: (star_targets '=') +// _loop0_137: ',' star_target static asdl_seq * -_loop0_156_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27115,18 +26132,27 @@ _loop0_156_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // (star_targets '=') + { // ',' star_target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_186_var; + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + Token * _literal; + expr_ty elem; while ( - (_tmp_186_var = _tmp_186_rule(p)) // star_targets '=' + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = star_target_rule(p)) // star_target ) { - _res = _tmp_186_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27142,8 +26168,8 @@ _loop0_156_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); + D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27155,59 +26181,43 @@ _loop0_156_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _tmp_157: yield_expr | star_expressions -static void * -_tmp_157_rule(Parser *p) +// _gather_136: star_target _loop0_137 +static asdl_seq * +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // yield_expr - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); - expr_ty yield_expr_var; - if ( - (yield_expr_var = yield_expr_rule(p)) // yield_expr - ) - { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); - _res = yield_expr_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); - } - { // star_expressions + { // star_target _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); - expr_ty star_expressions_var; + D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_137")); + expr_ty elem; + asdl_seq * seq; if ( - (star_expressions_var = star_expressions_rule(p)) // star_expressions + (elem = star_target_rule(p)) // star_target + && + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); - _res = star_expressions_var; + D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_137")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_137")); } _res = NULL; done: @@ -27215,9 +26225,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: '[' | '(' | '{' +// _tmp_138: !'*' star_target static void * -_tmp_158_rule(Parser *p) +_tmp_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27226,62 +26236,26 @@ _tmp_158_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '[' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 9)) // token='[' - ) - { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); - } - { // '(' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 7)) // token='(' - ) - { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); - } - { // '{' + { // !'*' star_target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + expr_ty star_target_var; if ( - (_literal = _PyPegen_expect_token(p, 25)) // token='{' + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' + && + (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; done: @@ -27289,9 +26263,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _loop0_159: param_no_default +// _loop0_140: ',' del_target static asdl_seq * -_loop0_159_rule(Parser *p) +_loop0_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27310,18 +26284,27 @@ _loop0_159_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // param_no_default + { // ',' del_target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); - arg_ty param_no_default_var; + D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + Token * _literal; + expr_ty elem; while ( - (param_no_default_var = param_no_default_rule(p)) // param_no_default + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = del_target_rule(p)) // del_target ) { - _res = param_no_default_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27337,8 +26320,8 @@ _loop0_159_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_159[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27350,59 +26333,43 @@ _loop0_159_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_159_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); D(p->level--); return _seq; } -// _tmp_160: slash_with_default | param_with_default+ -static void * -_tmp_160_rule(Parser *p) +// _gather_139: del_target _loop0_140 +static asdl_seq * +_gather_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // slash_with_default - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); - SlashWithDefault* slash_with_default_var; - if ( - (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default - ) - { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); - _res = slash_with_default_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); - } - { // param_with_default+ + { // del_target _loop0_140 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_187_var; + D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140")); + expr_ty elem; + asdl_seq * seq; if ( - (_loop1_187_var = _loop1_187_rule(p)) // param_with_default+ + (elem = del_target_rule(p)) // del_target + && + (seq = _loop0_140_rule(p)) // _loop0_140 ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_187_var; + D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); + D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_140")); } _res = NULL; done: @@ -27410,9 +26377,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _loop0_161: lambda_param_no_default +// _loop0_142: ',' target static asdl_seq * -_loop0_161_rule(Parser *p) +_loop0_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27431,18 +26398,27 @@ _loop0_161_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // lambda_param_no_default + { // ',' target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); - arg_ty lambda_param_no_default_var; + D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + Token * _literal; + expr_ty elem; while ( - (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (elem = target_rule(p)) // target ) { - _res = lambda_param_no_default_var; + _res = elem; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(_children); + D(p->level--); + return NULL; + } if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27458,8 +26434,8 @@ _loop0_161_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_161[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27471,59 +26447,43 @@ _loop0_161_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_161_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); D(p->level--); return _seq; } -// _tmp_162: lambda_slash_with_default | lambda_param_with_default+ -static void * -_tmp_162_rule(Parser *p) +// _gather_141: target _loop0_142 +static asdl_seq * +_gather_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + asdl_seq * _res = NULL; int _mark = p->mark; - { // lambda_slash_with_default - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); - SlashWithDefault* lambda_slash_with_default_var; - if ( - (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default - ) - { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); - _res = lambda_slash_with_default_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); - } - { // lambda_param_with_default+ + { // target _loop0_142 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - asdl_seq * _loop1_188_var; + D(fprintf(stderr, "%*c> _gather_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_142")); + expr_ty elem; + asdl_seq * seq; if ( - (_loop1_188_var = _loop1_188_rule(p)) // lambda_param_with_default+ + (elem = target_rule(p)) // target + && + (seq = _loop0_142_rule(p)) // _loop0_142 ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - _res = _loop1_188_var; + D(fprintf(stderr, "%*c+ _gather_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_142")); + _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); + D(fprintf(stderr, "%*c%s _gather_141[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_142")); } _res = NULL; done: @@ -27531,9 +26491,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _tmp_163: ')' | ',' (')' | '**') +// _tmp_143: args | expression for_if_clauses static void * -_tmp_163_rule(Parser *p) +_tmp_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27542,46 +26502,46 @@ _tmp_163_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // ')' + { // args if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + expr_ty args_var; if ( - (_literal = _PyPegen_expect_token(p, 8)) // token=')' + (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } - { // ',' (')' | '**') + { // expression for_if_clauses if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - Token * _literal; - void *_tmp_189_var; + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + expr_ty expression_var; + asdl_comprehension_seq* for_if_clauses_var; if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + (expression_var = expression_rule(p)) // expression && - (_tmp_189_var = _tmp_189_rule(p)) // ')' | '**' + (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_189_var); + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; done: @@ -27589,111 +26549,207 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: ':' | ',' (':' | '**') -static void * -_tmp_164_rule(Parser *p) +// _loop0_144: star_named_expressions +static asdl_seq * +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; + void *_res = NULL; int _mark = p->mark; - { // ':' + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // star_named_expressions if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + asdl_expr_seq* star_named_expressions_var; + while ( + (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); - _res = _literal; - goto done; + _res = star_named_expressions_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } - { // ',' (':' | '**') + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + D(p->level--); + return _seq; +} + +// _loop0_145: (star_targets '=') +static asdl_seq * +_loop0_145_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // (star_targets '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - Token * _literal; - void *_tmp_190_var; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (_tmp_190_var = _tmp_190_rule(p)) // ':' | '**' + D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_167_var; + while ( + (_tmp_167_var = _tmp_167_rule(p)) // star_targets '=' ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_190_var); - goto done; + _res = _tmp_167_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_165: star_targets '=' -static void * -_tmp_165_rule(Parser *p) +// _loop0_146: (star_targets '=') +static asdl_seq * +_loop0_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void * _res = NULL; - int _mark = p->mark; - { // star_targets '=' + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // (star_targets '=') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); - Token * _literal; - expr_ty z; - if ( - (z = star_targets_rule(p)) // star_targets - && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_168_var; + while ( + (_tmp_168_var = _tmp_168_rule(p)) // star_targets '=' ) { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; + _res = _tmp_168_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; } - goto done; + _children[_n++] = _res; + _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } - _res = NULL; - done: + asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_166: '.' | '...' +// _tmp_147: yield_expr | star_expressions static void * -_tmp_166_rule(Parser *p) +_tmp_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27702,43 +26758,43 @@ _tmp_166_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '.' + { // yield_expr if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + expr_ty yield_expr_var; if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } - { // '...' + { // star_expressions if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + expr_ty star_expressions_var; if ( - (_literal = _PyPegen_expect_token(p, 52)) // token='...' + (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; done: @@ -27746,9 +26802,9 @@ _tmp_166_rule(Parser *p) return _res; } -// _tmp_167: '.' | '...' +// _tmp_148: '[' | '(' | '{' static void * -_tmp_167_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27757,43 +26813,62 @@ _tmp_167_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // '.' + { // '[' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' + (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } - { // '...' + { // '(' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( - (_literal = _PyPegen_expect_token(p, 52)) // token='...' + (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); + } + { // '{' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 25)) // token='{' + ) + { + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; done: @@ -27801,9 +26876,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _loop0_169: ',' pattern +// _loop0_149: param_no_default static asdl_seq * -_loop0_169_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27822,27 +26897,18 @@ _loop0_169_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' pattern + { // param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); - Token * _literal; - expr_ty elem; + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + arg_ty param_no_default_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = pattern_rule(p)) // pattern + (param_no_default_var = param_no_default_rule(p)) // param_no_default ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27858,8 +26924,8 @@ _loop0_169_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_169[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27871,43 +26937,59 @@ _loop0_169_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_169_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _gather_168: pattern _loop0_169 -static asdl_seq * -_gather_168_rule(Parser *p) +// _tmp_150: slash_with_default | param_with_default+ +static void * +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // pattern _loop0_169 + { // slash_with_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_169")); - expr_ty elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + SlashWithDefault* slash_with_default_var; if ( - (elem = pattern_rule(p)) // pattern - && - (seq = _loop0_169_rule(p)) // _loop0_169 + (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _gather_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_169")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + _res = slash_with_default_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); + } + { // param_with_default+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_169_var; + if ( + (_loop1_169_var = _loop1_169_rule(p)) // param_with_default+ + ) + { + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_169_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_168[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_169")); + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; done: @@ -27915,9 +26997,9 @@ _gather_168_rule(Parser *p) return _res; } -// _loop0_171: ',' error_argument_pattern +// _loop0_151: lambda_param_no_default static asdl_seq * -_loop0_171_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27936,27 +27018,18 @@ _loop0_171_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ',' error_argument_pattern + { // lambda_param_no_default if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); - Token * _literal; - void *elem; + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + arg_ty lambda_param_no_default_var; while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = error_argument_pattern_rule(p)) // error_argument_pattern + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } + _res = lambda_param_no_default_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27972,8 +27045,8 @@ _loop0_171_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_171[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -27983,45 +27056,177 @@ _loop0_171_rule(Parser *p) D(p->level--); return NULL; } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_171_type, _seq); + for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); + D(p->level--); + return _seq; +} + +// _tmp_152: lambda_slash_with_default | lambda_param_with_default+ +static void * +_tmp_152_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // lambda_slash_with_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + SlashWithDefault* lambda_slash_with_default_var; + if ( + (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default + ) + { + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + _res = lambda_slash_with_default_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); + } + { // lambda_param_with_default+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + asdl_seq * _loop1_170_var; + if ( + (_loop1_170_var = _loop1_170_rule(p)) // lambda_param_with_default+ + ) + { + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + _res = _loop1_170_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_153: ')' | ',' (')' | '**') +static void * +_tmp_153_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ')' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 8)) // token=')' + ) + { + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); + } + { // ',' (')' | '**') + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + Token * _literal; + void *_tmp_171_var; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (_tmp_171_var = _tmp_171_rule(p)) // ')' | '**' + ) + { + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_171_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); + } + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _gather_170: error_argument_pattern _loop0_171 -static asdl_seq * -_gather_170_rule(Parser *p) +// _tmp_154: ':' | ',' (':' | '**') +static void * +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // error_argument_pattern _loop0_171 + { // ':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); - void *elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); + } + { // ',' (':' | '**') + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + Token * _literal; + void *_tmp_172_var; if ( - (elem = error_argument_pattern_rule(p)) // error_argument_pattern + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (seq = _loop0_171_rule(p)) // _loop0_171 + (_tmp_172_var = _tmp_172_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _gather_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_171")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_172_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_170[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_171")); + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; done: @@ -28029,113 +27234,98 @@ _gather_170_rule(Parser *p) return _res; } -// _loop0_173: ',' error_argument_pattern -static asdl_seq * -_loop0_173_rule(Parser *p) +// _tmp_155: star_targets '=' +static void * +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' error_argument_pattern + { // star_targets '=' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' error_argument_pattern")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; - void *elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' + expr_ty z; + if ( + (z = star_targets_rule(p)) // star_targets && - (elem = error_argument_pattern_rule(p)) // error_argument_pattern + (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - _res = elem; + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; - PyMem_Free(_children); D(p->level--); return NULL; } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_173[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' error_argument_pattern")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_173_type, _seq); + _res = NULL; + done: D(p->level--); - return _seq; + return _res; } -// _gather_172: error_argument_pattern _loop0_173 -static asdl_seq * -_gather_172_rule(Parser *p) +// _tmp_156: '.' | '...' +static void * +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - asdl_seq * _res = NULL; + void * _res = NULL; int _mark = p->mark; - { // error_argument_pattern _loop0_173 + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); - void *elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + Token * _literal; if ( - (elem = error_argument_pattern_rule(p)) // error_argument_pattern - && - (seq = _loop0_173_rule(p)) // _loop0_173 + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _gather_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern _loop0_173")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '...' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 52)) // token='...' + ) + { + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_172[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern _loop0_173")); + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; done: @@ -28143,113 +27333,54 @@ _gather_172_rule(Parser *p) return _res; } -// _loop0_175: ',' (error_argument_pattern | error_star) -static asdl_seq * -_loop0_175_rule(Parser *p) +// _tmp_157: '.' | '...' +static void * +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { D(p->level--); return NULL; } - void *_res = NULL; + void * _res = NULL; int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' (error_argument_pattern | error_star) + { // '.' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (error_argument_pattern | error_star)")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; - void *elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = _tmp_191_rule(p)) // error_argument_pattern | error_star + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_175[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (error_argument_pattern | error_star)")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_175_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_174: (error_argument_pattern | error_star) _loop0_175 -static asdl_seq * -_gather_174_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // (error_argument_pattern | error_star) _loop0_175 + { // '...' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); - void *elem; - asdl_seq * seq; + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + Token * _literal; if ( - (elem = _tmp_191_rule(p)) // error_argument_pattern | error_star - && - (seq = _loop0_175_rule(p)) // _loop0_175 + (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _gather_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_174[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(error_argument_pattern | error_star) _loop0_175")); + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; done: @@ -28257,9 +27388,9 @@ _gather_174_rule(Parser *p) return _res; } -// _tmp_176: '@' named_expression NEWLINE +// _tmp_158: '@' named_expression NEWLINE static void * -_tmp_176_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28273,7 +27404,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -28285,7 +27416,7 @@ _tmp_176_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28295,7 +27426,7 @@ _tmp_176_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -28304,9 +27435,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: ',' star_expression +// _tmp_159: ',' star_expression static void * -_tmp_177_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28320,7 +27451,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -28329,7 +27460,7 @@ _tmp_177_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28339,7 +27470,7 @@ _tmp_177_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -28348,9 +27479,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _tmp_178: ',' expression +// _tmp_160: ',' expression static void * -_tmp_178_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28364,7 +27495,7 @@ _tmp_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -28373,7 +27504,7 @@ _tmp_178_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28383,7 +27514,7 @@ _tmp_178_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -28392,9 +27523,9 @@ _tmp_178_rule(Parser *p) return _res; } -// _tmp_179: 'or' conjunction +// _tmp_161: 'or' conjunction static void * -_tmp_179_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28408,7 +27539,7 @@ _tmp_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -28417,7 +27548,7 @@ _tmp_179_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28427,7 +27558,7 @@ _tmp_179_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -28436,9 +27567,9 @@ _tmp_179_rule(Parser *p) return _res; } -// _tmp_180: 'and' inversion +// _tmp_162: 'and' inversion static void * -_tmp_180_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28452,7 +27583,7 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -28461,7 +27592,7 @@ _tmp_180_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28471,7 +27602,7 @@ _tmp_180_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -28480,9 +27611,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: 'if' disjunction +// _tmp_163: 'if' disjunction static void * -_tmp_181_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28496,7 +27627,7 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -28505,7 +27636,7 @@ _tmp_181_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28515,7 +27646,7 @@ _tmp_181_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -28524,9 +27655,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: 'if' disjunction +// _tmp_164: 'if' disjunction static void * -_tmp_182_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28540,7 +27671,7 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -28549,7 +27680,7 @@ _tmp_182_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28559,7 +27690,7 @@ _tmp_182_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -28568,9 +27699,9 @@ _tmp_182_rule(Parser *p) return _res; } -// _tmp_183: starred_expression | named_expression !'=' +// _tmp_165: starred_expression | named_expression !'=' static void * -_tmp_183_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28584,18 +27715,18 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); expr_ty starred_expression_var; if ( (starred_expression_var = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); _res = starred_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // named_expression !'=' @@ -28603,7 +27734,7 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression @@ -28611,12 +27742,12 @@ _tmp_183_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='")); } _res = NULL; @@ -28625,9 +27756,9 @@ _tmp_183_rule(Parser *p) return _res; } -// _tmp_184: ',' star_target +// _tmp_166: ',' star_target static void * -_tmp_184_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28641,7 +27772,7 @@ _tmp_184_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -28650,7 +27781,7 @@ _tmp_184_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28660,7 +27791,7 @@ _tmp_184_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -28669,9 +27800,9 @@ _tmp_184_rule(Parser *p) return _res; } -// _tmp_185: star_targets '=' +// _tmp_167: star_targets '=' static void * -_tmp_185_rule(Parser *p) +_tmp_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28685,7 +27816,7 @@ _tmp_185_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -28694,12 +27825,12 @@ _tmp_185_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -28708,9 +27839,9 @@ _tmp_185_rule(Parser *p) return _res; } -// _tmp_186: star_targets '=' +// _tmp_168: star_targets '=' static void * -_tmp_186_rule(Parser *p) +_tmp_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28724,7 +27855,7 @@ _tmp_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -28733,12 +27864,12 @@ _tmp_186_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -28747,9 +27878,9 @@ _tmp_186_rule(Parser *p) return _res; } -// _loop1_187: param_with_default +// _loop1_169: param_with_default static asdl_seq * -_loop1_187_rule(Parser *p) +_loop1_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28773,7 +27904,7 @@ _loop1_187_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -28795,7 +27926,7 @@ _loop1_187_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_187[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28813,14 +27944,14 @@ _loop1_187_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_187_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_169_type, _seq); D(p->level--); return _seq; } -// _loop1_188: lambda_param_with_default +// _loop1_170: lambda_param_with_default static asdl_seq * -_loop1_188_rule(Parser *p) +_loop1_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28844,7 +27975,7 @@ _loop1_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -28866,7 +27997,7 @@ _loop1_188_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28884,14 +28015,14 @@ _loop1_188_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_188_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_170_type, _seq); D(p->level--); return _seq; } -// _tmp_189: ')' | '**' +// _tmp_171: ')' | '**' static void * -_tmp_189_rule(Parser *p) +_tmp_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28905,18 +28036,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -28924,18 +28055,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -28944,9 +28075,9 @@ _tmp_189_rule(Parser *p) return _res; } -// _tmp_190: ':' | '**' +// _tmp_172: ':' | '**' static void * -_tmp_190_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28960,18 +28091,18 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -28979,18 +28110,18 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -28999,61 +28130,6 @@ _tmp_190_rule(Parser *p) return _res; } -// _tmp_191: error_argument_pattern | error_star -static void * -_tmp_191_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // error_argument_pattern - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); - void *error_argument_pattern_var; - if ( - (error_argument_pattern_var = error_argument_pattern_rule(p)) // error_argument_pattern - ) - { - D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_argument_pattern")); - _res = error_argument_pattern_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_argument_pattern")); - } - { // error_star - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "error_star")); - expr_ty error_star_var; - if ( - (error_star_var = error_star_rule(p)) // error_star - ) - { - D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "error_star")); - _res = error_star_var; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "error_star")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - void * _PyPegen_parse(Parser *p) { diff --git a/Python/compile.c b/Python/compile.c index df19167343b3d8..0e7a899d4b8785 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5497,11 +5497,7 @@ pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) static int pattern_store_name(struct compiler *c, identifier n, pattern_context *pc) { - if (_PyUnicode_EqualToASCIIString(n, "_")) { - const char *e = "can't assign to '_' here " - "(consider removing or renaming)"; - return compiler_error(c, e); - } + assert(!_PyUnicode_EqualToASCIIString(n, "_")); if (!pc->stores) { CHECK(pc->stores = PySet_New(NULL)); } @@ -5830,6 +5826,10 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); if (!pc->allow_irrefutable) { + if (WILDCARD_CHECK(p)) { + const char *e = "wildcard makes remaining patterns unreachable"; + return compiler_error(c, e); + } const char *e = "name capture %R makes remaining patterns unreachable"; return compiler_error(c, e, p->v.Name.id); } diff --git a/Python/symtable.c b/Python/symtable.c index 3521f3aa524aa6..93b0737f1b05ec 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1679,7 +1679,6 @@ symtable_visit_expr(struct symtable *st, expr_ty e) break; case MatchAs_kind: VISIT(st, expr, e->v.MatchAs.pattern); - // "_" is not actually valid, but it's the compiler's job to complain: symtable_add_def(st, e->v.MatchAs.name, DEF_LOCAL); break; case MatchOr_kind: From 77515ece9ec2d48f5e2ecd72d6ba52aee2c07f1f Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 15:32:58 -0700 Subject: [PATCH 185/218] Clean up open_sequence_pattern usage --- Grammar/python.gram | 10 ++++---- Parser/parser.c | 57 ++++++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 8db40e0c5e19cf..55bb3da31e0411 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -209,7 +209,8 @@ case_block[match_case_ty]: guard[expr_ty]: 'if' guard=named_expression { guard } patterns[expr_ty]: - | open_sequence_pattern + | values[asdl_expr_seq*]=open_sequence_pattern { + _Py_Tuple(values, Load, EXTRA) } | pattern pattern[expr_ty]: | as_pattern @@ -263,11 +264,10 @@ group_pattern[expr_ty]: sequence_pattern[expr_ty]: | '[' values=maybe_sequence_pattern? ']' { _Py_List(values, Load, EXTRA) } - | '(' values=open_sequence_pattern? ')' { - values ? values : _Py_Tuple(values, Load, EXTRA) } -open_sequence_pattern[expr_ty]: + | '(' values=open_sequence_pattern? ')' { _Py_Tuple(values, Load, EXTRA) } +open_sequence_pattern[asdl_seq*]: | value=maybe_star_pattern ',' values=maybe_sequence_pattern? { - _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) } + _PyPegen_seq_insert_in_front(p, value, values) } maybe_sequence_pattern[asdl_seq*]: | values=','.maybe_star_pattern+ ','? { values } maybe_star_pattern[expr_ty]: diff --git a/Parser/parser.c b/Parser/parser.c index 6683ca4ec1bf72..f384524d088306 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -486,7 +486,7 @@ static expr_ty attr_rule(Parser *p); static expr_ty name_or_attr_rule(Parser *p); static expr_ty group_pattern_rule(Parser *p); static expr_ty sequence_pattern_rule(Parser *p); -static expr_ty open_sequence_pattern_rule(Parser *p); +static asdl_seq* open_sequence_pattern_rule(Parser *p); static asdl_seq* maybe_sequence_pattern_rule(Parser *p); static expr_ty maybe_star_pattern_rule(Parser *p); static expr_ty star_pattern_rule(Parser *p); @@ -5041,19 +5041,42 @@ patterns_rule(Parser *p) } expr_ty _res = NULL; int _mark = p->mark; + if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + int _start_lineno = p->tokens[_mark]->lineno; + UNUSED(_start_lineno); // Only used by EXTRA macro + int _start_col_offset = p->tokens[_mark]->col_offset; + UNUSED(_start_col_offset); // Only used by EXTRA macro { // open_sequence_pattern if (p->error_indicator) { D(p->level--); return NULL; } D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); - expr_ty open_sequence_pattern_var; + asdl_expr_seq* values; if ( - (open_sequence_pattern_var = open_sequence_pattern_rule(p)) // open_sequence_pattern + (values = (asdl_expr_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern ) { D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); - _res = open_sequence_pattern_var; + Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); + if (_token == NULL) { + D(p->level--); + return NULL; + } + int _end_lineno = _token->end_lineno; + UNUSED(_end_lineno); // Only used by EXTRA macro + int _end_col_offset = _token->end_col_offset; + UNUSED(_end_col_offset); // Only used by EXTRA macro + _res = _Py_Tuple ( values , Load , EXTRA ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; @@ -6203,7 +6226,7 @@ sequence_pattern_rule(Parser *p) UNUSED(_end_lineno); // Only used by EXTRA macro int _end_col_offset = _token->end_col_offset; UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = values ? values : _Py_Tuple ( values , Load , EXTRA ); + _res = _Py_Tuple ( values , Load , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6222,7 +6245,7 @@ sequence_pattern_rule(Parser *p) } // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? -static expr_ty +static asdl_seq* open_sequence_pattern_rule(Parser *p) { D(p->level++); @@ -6230,17 +6253,8 @@ open_sequence_pattern_rule(Parser *p) D(p->level--); return NULL; } - expr_ty _res = NULL; + asdl_seq* _res = NULL; int _mark = p->mark; - if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - int _start_lineno = p->tokens[_mark]->lineno; - UNUSED(_start_lineno); // Only used by EXTRA macro - int _start_col_offset = p->tokens[_mark]->col_offset; - UNUSED(_start_col_offset); // Only used by EXTRA macro { // maybe_star_pattern ',' maybe_sequence_pattern? if (p->error_indicator) { D(p->level--); @@ -6259,16 +6273,7 @@ open_sequence_pattern_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); - Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); - if (_token == NULL) { - D(p->level--); - return NULL; - } - int _end_lineno = _token->end_lineno; - UNUSED(_end_lineno); // Only used by EXTRA macro - int _end_col_offset = _token->end_col_offset; - UNUSED(_end_col_offset); // Only used by EXTRA macro - _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); + _res = _PyPegen_seq_insert_in_front ( p , value , values ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); From c0a06d1459b34db2c13c3061936e04c64e900cb6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 17:03:16 -0700 Subject: [PATCH 186/218] More cleanup --- Doc/library/dis.rst | 28 +++++++++++--------------- Lib/importlib/_bootstrap_external.py | 4 ++-- Python/ceval.c | 30 +++++++++++++++------------- Python/importlib_external.h | 2 +- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 8dfa1fe38b88de..c63240f23a5040 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1239,31 +1239,27 @@ All of the following opcodes use their arguments. .. opcode:: MATCH_CLASS (count) - TODO + TOS is a tuple of keyword attribute names, TOS1 is the class being matched + against, and TOS2 is the match subject. *count* is the number of positional + sub-patterns. - TOS is a tuple of keyword attribute names. - TOS1 is the "class" being called. - TOS2 is the subject. - *oparg* is the number of positional sub-patterns. - - On match, replaces TOS1 with a tuple extracted attributes, and TOS with True. - On no match, replaces TOS with False. + If TOS2 is an instance of TOS1 and has the positional and keyword attributes + required by *count* and TOS, replace TOS with ``True`` and TOS1 with a tuple + of extracted attributes. Otherwise, replace TOS with ``False``. .. versionadded:: 3.10 .. opcode:: MATCH_KEYS (copy) - TODO - - TOS is a tuple of keys. - TOS1 is the match subject. + TOS is a tuple of mapping keys, and TOS1 is the match subject. If TOS1 + contains all of the keys in TOS, replace TOS with a tuple containing the + corresponding values and push ``True``. Otherwisem, push ``False``. - On failure, replaces TOS with None and pushes False. + TODO: This next bit is weird. Just make two non-arg opcodes? - On success, replaces TOS with a tuple of keys and pushes TRUE. If *oparg* is - non-zero, gather remaining items into a dict and put it on the stack where - the subject used to be. + If *copy* is non-zero, gather remaining items into a :class:`dict` and put it + on the stack where the subject used to be. .. versionadded:: 3.10 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 2afa5b258eb973..b0e5544b1971df 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,7 +278,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) -# Python 3.10a1 3471 (add structural pattern matching) +# Python 3.10a1 3431 (PEP 634: Structural Pattern Matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -288,7 +288,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3471).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3431).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/ceval.c b/Python/ceval.c index e2b0b2771d3e91..d19f11b265cdbc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -834,7 +834,7 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // Need these for pattern matching: -static PyObject* +static PyObject* // TODO match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) { assert(PyTuple_CheckExact(keys)); @@ -890,9 +890,13 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } -static PyObject * -match_map_copy(PyThreadState *tstate, PyObject *map, PyObject *keys) +static PyObject * // TODO +dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) { + // copy = dict(map) + // for key in keys: + // del copy[key] + // return copy PyObject *copy; if (PyDict_CheckExact(map)) { copy = PyDict_Copy(map); @@ -907,13 +911,10 @@ match_map_copy(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } } - Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); - for (Py_ssize_t i = 0; i < nkeys; i++) { + // This may seem a bit ineffient, but keys is rarely big enough to actually + // impact runtime. + for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(keys); i++) { if (PyDict_DelItem(copy, PyTuple_GET_ITEM(keys, i))) { - if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) { - _PyErr_Clear(tstate); - continue; - } Py_DECREF(copy); return NULL; } @@ -924,6 +925,10 @@ match_map_copy(PyThreadState *tstate, PyObject *map, PyObject *keys) static PyObject * get_match_args(PyThreadState *tstate, PyObject *type) { + // match_args = getattr(type, "__match_args__", ()) + // if match_args.__class__ in (list, tuple): + // return tuple(match_args) + // raise TypeError PyObject *match_args = PyObject_GetAttrString(type, "__match_args__"); if (!match_args) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -947,7 +952,7 @@ get_match_args(PyThreadState *tstate, PyObject *type) return NULL; } -static PyObject * +static PyObject * // TODO do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *subject) { // TODO: Break this up! @@ -3634,15 +3639,12 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (_PyErr_Occurred(tstate)) { goto error; } - Py_INCREF(Py_None); - SET_TOP(Py_None); - Py_DECREF(keys); Py_INCREF(Py_False); PUSH(Py_False); DISPATCH(); } if (oparg) { - PyObject *rest = match_map_copy(tstate, subject, keys); + PyObject *rest = dict_without_keys(tstate, subject, keys); if (!rest) { goto error; } diff --git a/Python/importlib_external.h b/Python/importlib_external.h index bfe027cd6a128b..e148973fbec610 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -285,7 +285,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,13,95,119,114,105,116,101,95,97,116,111,109,105,99, 120,0,0,0,115,28,0,0,0,0,5,16,1,6,1,22, 255,4,2,2,3,14,1,40,1,16,1,12,1,2,1,14, - 1,12,1,6,1,114,69,0,0,0,105,143,13,0,0,114, + 1,12,1,6,1,114,69,0,0,0,105,103,13,0,0,114, 28,0,0,0,114,17,0,0,0,115,2,0,0,0,13,10, 90,11,95,95,112,121,99,97,99,104,101,95,95,122,4,111, 112,116,45,122,3,46,112,121,122,4,46,112,121,99,78,41, From 26d35e51806297121cd249697adf9da41543703a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Oct 2020 18:07:16 -0700 Subject: [PATCH 187/218] Raise remaining SyntaxErrors in compiler --- Python/compile.c | 75 ++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 0e7a899d4b8785..05a79af79c28d4 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5461,12 +5461,12 @@ compiler_slice(struct compiler *c, expr_ty s) static int -pattern_load_attribute(struct compiler *c, expr_ty p, pattern_context *pc) +pattern_helper_load_attr(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); if (p->v.Attribute.value->kind == Attribute_kind) { - CHECK(pattern_load_attribute(c, p->v.Attribute.value, pc)); + CHECK(pattern_helper_load_attr(c, p->v.Attribute.value, pc)); } else { assert(p->v.Attribute.value->kind == Name_kind); @@ -5479,7 +5479,7 @@ pattern_load_attribute(struct compiler *c, expr_ty p, pattern_context *pc) static int -pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) +pattern_helper_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); assert(p->v.Constant.value == Py_None || @@ -5494,8 +5494,8 @@ pattern_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) } -static int -pattern_store_name(struct compiler *c, identifier n, pattern_context *pc) +static int // TODO +pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) { assert(!_PyUnicode_EqualToASCIIString(n, "_")); if (!pc->stores) { @@ -5523,13 +5523,13 @@ compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); ADDOP(c, DUP_TOP); - CHECK(pattern_load_attribute(c, p, pc)); + CHECK(pattern_helper_load_attr(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; } -static int +static int // TODO compiler_pattern_match_or(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == MatchOr_kind); @@ -5587,22 +5587,21 @@ compiler_pattern_match_or(struct compiler *c, expr_ty p, pattern_context *pc) } -static int +static int // TODO compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { asdl_expr_seq *args = p->v.Call.args; asdl_keyword_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); Py_ssize_t nkwargs = asdl_seq_LEN(kwargs); - if (nargs + nkwargs > INT_MAX) { + if (INT_MAX < nargs || INT_MAX < nargs + nkwargs - 1) { const char *e = "too many sub-patterns in class pattern %R"; return compiler_error(c, e, p->v.Call.func); } - basicblock *block, *end; CHECK(!validate_keywords(c, kwargs)); - CHECK(block = compiler_new_block(c)); + basicblock *end; CHECK(end = compiler_new_block(c)); if (p->v.Call.func->kind == Attribute_kind) { - CHECK(pattern_load_attribute(c, p->v.Call.func, pc)); + CHECK(pattern_helper_load_attr(c, p->v.Call.func, pc)); } else { assert(p->v.Call.func->kind == Name_kind); @@ -5652,7 +5651,7 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); ADDOP(c, DUP_TOP); - CHECK(pattern_load_constant(c, p, pc)); + CHECK(pattern_helper_load_constant(c, p, pc)); PyObject *v = p->v.Constant.value; // Literal True, False, and None are compared by identity. // All others use equality. @@ -5661,17 +5660,16 @@ compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) } -static int +static int // TODO compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) { - basicblock *block, *end; - CHECK(block = compiler_new_block(c)); + basicblock *fail, *end; + CHECK(fail = compiler_new_block(c)); CHECK(end = compiler_new_block(c)); asdl_expr_seq *keys = p->v.Dict.keys; asdl_expr_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); int star = size ? !asdl_seq_GET(keys, size - 1) : 0; - // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) ADDOP(c, MATCH_MAPPING); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); @@ -5682,6 +5680,9 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); } + if (INT_MAX < size - star - 1) { + return compiler_error(c, "too many sub-patterns in mapping pattern"); + } if (size) { ADDOP(c, DUP_TOP); Py_ssize_t i; @@ -5693,16 +5694,16 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_error(c, e); } if (key->kind == Attribute_kind) { - CHECK(pattern_load_attribute(c, key, pc)); + CHECK(pattern_helper_load_attr(c, key, pc)); } else { assert(key->kind == Constant_kind); - CHECK(pattern_load_constant(c, key, pc)); + CHECK(pattern_helper_load_constant(c, key, pc)); } } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, block); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); NEXT_BLOCK(c); for (i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -5713,12 +5714,13 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) CHECK(compiler_subpattern(c, value, pc)); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, block); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); NEXT_BLOCK(c); } ADDOP(c, POP_TOP); if (star) { - CHECK(pattern_store_name(c, asdl_seq_GET(values, size - 1)->v.Name.id, pc)); + PyObject *id = asdl_seq_GET(values, size - 1)->v.Name.id; + CHECK(pattern_helper_store_name(c, id, pc)); } else { ADDOP(c, POP_TOP); @@ -5726,7 +5728,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_LOAD_CONST(c, Py_True); ADDOP_JUMP(c, JUMP_FORWARD, end); - compiler_use_next_block(c, block); + compiler_use_next_block(c, fail); ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_False); @@ -5735,7 +5737,7 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } -static int +static int // TODO compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); @@ -5780,8 +5782,10 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_JUMP(c, POP_JUMP_IF_FALSE, wrong_size); NEXT_BLOCK(c); ADDOP(c, ROT_TWO); + if (INT_MAX < size - 1) { + return compiler_error(c, "too many sub-patterns in sequence pattern"); + } for (Py_ssize_t i = 0; i < size; i++) { - // TODO: (i >= (1 << 8)) || (n-i-1 >= (INT_MAX >> 8)) expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { continue; @@ -5795,6 +5799,13 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) if (WILDCARD_CHECK(value)) { continue; } + if (0xFF <= i || INT_MAX <= ((size - 1 - i) << 8)) { + // Technical limits are 0xFF patterns to the left of the star, + // one starred pattern, and 0xFFFFFF patterns to the right of + // the star... same as UNPACK_EX. + const char* e = "too many sub-patterns in sequence pattern"; + return compiler_error(c, e); + } ADDOP_I(c, GET_INDEX_SLICE, ((size - 1 - i) << 8) + i); } else { @@ -5825,17 +5836,19 @@ compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Name_kind); assert(p->v.Name.ctx == Store); + int wildcard = WILDCARD_CHECK(p); if (!pc->allow_irrefutable) { - if (WILDCARD_CHECK(p)) { + // Whoops, can't have a name capture here! + if (wildcard) { const char *e = "wildcard makes remaining patterns unreachable"; return compiler_error(c, e); } const char *e = "name capture %R makes remaining patterns unreachable"; return compiler_error(c, e, p->v.Name.id); } - if (!WILDCARD_CHECK(p)) { + if (!wildcard) { ADDOP(c, DUP_TOP); - CHECK(pattern_store_name(c, p->v.Name.id, pc)); + CHECK(pattern_helper_store_name(c, p->v.Name.id, pc)); } ADDOP_LOAD_CONST(c, Py_True); return 1; @@ -5852,14 +5865,14 @@ compiler_pattern_match_as(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); ADDOP(c, DUP_TOP); - CHECK(pattern_store_name(c, p->v.MatchAs.name, pc)); + CHECK(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; } -static int +static int // TODO compiler_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) { int allow_irrefutable = pc->allow_irrefutable; @@ -5904,7 +5917,7 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) } -static int +static int // TODO compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.subject); From d43bb0b4e0243c53a3d65b601aeaa17db0a1e3d5 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 08:03:11 -0700 Subject: [PATCH 188/218] Finish compiler cleanup --- Doc/library/dis.rst | 4 +- Lib/importlib/_bootstrap_external.py | 2 +- Lib/test/test_patma.py | 3 - Python/compile.c | 408 ++++++++++++++++----------- 4 files changed, 241 insertions(+), 176 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index c63240f23a5040..453ed0fd6a0843 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1254,9 +1254,7 @@ All of the following opcodes use their arguments. TOS is a tuple of mapping keys, and TOS1 is the match subject. If TOS1 contains all of the keys in TOS, replace TOS with a tuple containing the - corresponding values and push ``True``. Otherwisem, push ``False``. - - TODO: This next bit is weird. Just make two non-arg opcodes? + corresponding values and push ``True``. Otherwise, push ``False``. If *copy* is non-zero, gather remaining items into a :class:`dict` and put it on the stack where the subject used to be. diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index b0e5544b1971df..f1c5f214d71d87 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,7 +278,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) -# Python 3.10a1 3431 (PEP 634: Structural Pattern Matching) +# Python 3.10a2 3431 (PEP 634: Structural Pattern Matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index cb735efc8fcf65..ac53093f857f58 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2803,9 +2803,6 @@ def test_patma_277(self): self.assertEqual(y, 0) self.assertEqual(z, 0) - # TODO: Better use of assertIs - # TODO: Don't check side-effecty assignments - class PerfPatma(TestPatma): diff --git a/Python/compile.c b/Python/compile.c index 05a79af79c28d4..03663f168b1855 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -251,7 +251,6 @@ static int compiler_async_comprehension_generator( int depth, expr_ty elt, expr_ty val, int type); -static int compiler_subpattern(struct compiler *, expr_ty, pattern_context *); static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); static int compiler_match(struct compiler *, stmt_ty); @@ -5494,10 +5493,11 @@ pattern_helper_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) } -static int // TODO +static int pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) { assert(!_PyUnicode_EqualToASCIIString(n, "_")); + // Can't assign to the same name twice: if (!pc->stores) { CHECK(pc->stores = PySet_New(NULL)); } @@ -5518,77 +5518,55 @@ pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) static int -compiler_pattern_attribute(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == Attribute_kind); - assert(p->v.Attribute.ctx == Load); - ADDOP(c, DUP_TOP); - CHECK(pattern_helper_load_attr(c, p, pc)); - ADDOP_COMPARE(c, Eq); + // Like compiler_pattern, but turn off checks for irrefutability. + int allow_irrefutable = pc->allow_irrefutable; + pc->allow_irrefutable = 1; + CHECK(compiler_pattern(c, p, pc)); + pc->allow_irrefutable = allow_irrefutable; return 1; } -static int // TODO -compiler_pattern_match_or(struct compiler *c, expr_ty p, pattern_context *pc) +static int +compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == MatchOr_kind); + assert(p->kind == MatchAs_kind); basicblock *end; - PyObject *control = NULL; - PyObject *diff; CHECK(end = compiler_new_block(c)); - Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns); - assert(size > 1); - PyObject *stores_init = pc->stores; - int allow_irrefutable = pc->allow_irrefutable; - expr_ty alt; - for (Py_ssize_t i = 0; i < size; i++) { - // Can't use our helpful returning macros here: they'll leak sets! - alt = asdl_seq_GET(p->v.MatchOr.patterns, i); - pc->stores = PySet_New(stores_init); - // An irrefutable sub-pattern must be last, if it is allowed at all: - pc->allow_irrefutable = allow_irrefutable && (i == size - 1); - SET_LOC(c, alt); - if (!pc->stores || - !compiler_pattern(c, alt, pc) || - !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || - !compiler_next_block(c)) - { - goto fail; - } - if (!i) { - control = pc->stores; - continue; - } - if (PySet_GET_SIZE(pc->stores) || PySet_GET_SIZE(control)) { - diff = PyNumber_InPlaceXor(pc->stores, control); - if (!diff) { - goto fail; - } - if (PySet_GET_SIZE(diff)) { - Py_DECREF(diff); - compiler_error(c, "alternate patterns bind different names"); - goto fail; - } - Py_DECREF(diff); - } - Py_DECREF(pc->stores); - } - Py_XDECREF(stores_init); - pc->stores = control; - pc->allow_irrefutable = allow_irrefutable; - ADDOP_LOAD_CONST(c, Py_False); + CHECK(compiler_pattern(c, p->v.MatchAs.pattern, pc)); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); + ADDOP(c, DUP_TOP); + CHECK(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); + ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; -fail: - Py_XDECREF(stores_init); - Py_XDECREF(control); - return 0; } -static int // TODO -compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { +static int +compiler_pattern_capture(struct compiler *c, expr_ty p, pattern_context *pc) +{ + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Store); + assert(!WILDCARD_CHECK(p)); + if (!pc->allow_irrefutable) { + // Whoops, can't have a name capture here! + const char *e = "name capture %R makes remaining patterns unreachable"; + return compiler_error(c, e, p->v.Name.id); + } + ADDOP(c, DUP_TOP); + CHECK(pattern_helper_store_name(c, p->v.Name.id, pc)); + ADDOP_LOAD_CONST(c, Py_True); + return 1; +} + + +static int +compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) +{ asdl_expr_seq *args = p->v.Call.args; asdl_keyword_seq *kwargs = p->v.Call.keywords; Py_ssize_t nargs = asdl_seq_LEN(args); @@ -5600,6 +5578,7 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { CHECK(!validate_keywords(c, kwargs)); basicblock *end; CHECK(end = compiler_new_block(c)); + // The name of the class can only be an (optionally dotted) name: if (p->v.Call.func->kind == Attribute_kind) { CHECK(pattern_helper_load_attr(c, p->v.Call.func, pc)); } @@ -5608,11 +5587,11 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->v.Call.func->v.Name.ctx == Load); CHECK(compiler_nameop(c, p->v.Call.func->v.Name.id, Load)); } - PyObject *kwnames, *name; + PyObject *kwnames; CHECK(kwnames = PyTuple_New(nkwargs)); Py_ssize_t i; for (i = 0; i < nkwargs; i++) { - name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; + PyObject *name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; Py_INCREF(name); PyTuple_SET_ITEM(kwnames, i, name); } @@ -5620,26 +5599,35 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { ADDOP_I(c, MATCH_CLASS, nargs); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); - expr_ty arg; + // TOS is now a tuple of (nargs + nkwargs) attributes. for (i = 0; i < nargs + nkwargs; i++) { + expr_ty arg; if (i < nargs) { + // Positional: arg = asdl_seq_GET(args, i); } else { + // Keyword: arg = ((keyword_ty) asdl_seq_GET(kwargs, i - nargs))->value; } if (WILDCARD_CHECK(arg)) { continue; } + // Get the i-th attribute, and match it against the i-th pattern: ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_subpattern(c, arg, pc)); + CHECK(compiler_pattern_subpattern(c, arg, pc)); + // TOS is True or False, with the attribute beneath. Pop the attribute, + // we're done with it: ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); } + // If we made it this far, it's a match! ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); + // TOS is True or False, but we've still got either a class or a tuple of + // attributes beneath it. Pop it, we're done. ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); return 1; @@ -5647,21 +5635,21 @@ compiler_pattern_call(struct compiler *c, expr_ty p, pattern_context *pc) { static int -compiler_pattern_constant(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_literal(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); ADDOP(c, DUP_TOP); CHECK(pattern_helper_load_constant(c, p, pc)); PyObject *v = p->v.Constant.value; - // Literal True, False, and None are compared by identity. - // All others use equality. + // Literal True, False, and None are compared by identity. All others use + // equality: ADDOP_COMPARE(c, (v == Py_None || PyBool_Check(v)) ? Is : Eq); return 1; } -static int // TODO -compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) +static int +compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) { basicblock *fail, *end; CHECK(fail = compiler_new_block(c)); @@ -5669,11 +5657,19 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) asdl_expr_seq *keys = p->v.Dict.keys; asdl_expr_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); + // A starred pattern will be a keyless value. It is guranteed to be last: int star = size ? !asdl_seq_GET(keys, size - 1) : 0; ADDOP(c, MATCH_MAPPING); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); + if (!size) { + // If the pattern is just "{}", we're done! + ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, end); + return 1; + } if (size - star) { + // If the pattern has any keys in it, perform a length check: ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); ADDOP_COMPARE(c, GtE); @@ -5683,52 +5679,62 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) if (INT_MAX < size - star - 1) { return compiler_error(c, "too many sub-patterns in mapping pattern"); } - if (size) { - ADDOP(c, DUP_TOP); - Py_ssize_t i; - for (i = 0; i < size - star; i++) { - expr_ty key = asdl_seq_GET(keys, i); - if (!key) { - const char *e = "can't use starred name here " - "(consider moving to end)"; - return compiler_error(c, e); - } - if (key->kind == Attribute_kind) { - CHECK(pattern_helper_load_attr(c, key, pc)); - } - else { - assert(key->kind == Constant_kind); - CHECK(pattern_helper_load_constant(c, key, pc)); - } - } - ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_I(c, MATCH_KEYS, star); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); - NEXT_BLOCK(c); - for (i = 0; i < size - star; i++) { - expr_ty value = asdl_seq_GET(values, i); - if (WILDCARD_CHECK(value)) { - continue; - } - ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_subpattern(c, value, pc)); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); - NEXT_BLOCK(c); + // If we have a starred pattern, MATCH_KEYS *could* replace the subject on + // the stack with a dict of remaining keys. Duplicate it so we don't lose + // the subject: + ADDOP(c, DUP_TOP); + // Collect all of the keys into a tuple for MATCH_KEYS. They can either be + // dotted names or literals: + for (Py_ssize_t i = 0; i < size - star; i++) { + expr_ty key = asdl_seq_GET(keys, i); + if (!key) { + const char *e = "can't use starred name here " + "(consider moving to end)"; + return compiler_error(c, e); } - ADDOP(c, POP_TOP); - if (star) { - PyObject *id = asdl_seq_GET(values, size - 1)->v.Name.id; - CHECK(pattern_helper_store_name(c, id, pc)); + if (key->kind == Attribute_kind) { + CHECK(pattern_helper_load_attr(c, key, pc)); } else { - ADDOP(c, POP_TOP); + assert(key->kind == Constant_kind); + CHECK(pattern_helper_load_constant(c, key, pc)); + } + } + ADDOP_I(c, BUILD_TUPLE, size - star); + ADDOP_I(c, MATCH_KEYS, star); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); + NEXT_BLOCK(c); + // So far so good. There's now a tuple of values on the stack to match + // sub-patterns against. Extract them using GET_INDEX: + for (Py_ssize_t i = 0; i < size - star; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; } + ADDOP_I(c, GET_INDEX, i); + CHECK(compiler_pattern_subpattern(c, value, pc)); + // TOS is True or False. Don't care about the value underneath anymore: + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); + NEXT_BLOCK(c); + } + // If we get this far, it's a match! We're done with that tuple of values. + ADDOP(c, POP_TOP); + if (star) { + // There's now one of two things on TOS. If we had a starred name, it's + // a dict of remaining items to bind: + PyObject *id = asdl_seq_GET(values, size - 1)->v.Name.id; + CHECK(pattern_helper_store_name(c, id, pc)); + } + else { + // Otherwise, it's just another reference to the subject underneath. + ADDOP(c, POP_TOP); } ADDOP_LOAD_CONST(c, Py_True); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, fail); + // The top two items are a tuple of values, and a mapping. Pop them both: ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_False); @@ -5737,13 +5743,79 @@ compiler_pattern_dict(struct compiler *c, expr_ty p, pattern_context *pc) } -static int // TODO -compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) +static int +compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) +{ + assert(p->kind == MatchOr_kind); + // control is the set of names bound by the first alternate. If all of the + // others bind the same names (they should), then this becomes pc->stores. + PyObject *control = NULL; + basicblock *end; + CHECK(end = compiler_new_block(c)); + Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns); + assert(size > 1); + // We're going to be messing with pc. Keep the original info handy: + PyObject *stores_init = pc->stores; + int allow_irrefutable = pc->allow_irrefutable; + for (Py_ssize_t i = 0; i < size; i++) { + // NOTE: Can't use our nice returning macros in here: they'll leak sets! + expr_ty alt = asdl_seq_GET(p->v.MatchOr.patterns, i); + pc->stores = PySet_New(stores_init); + // An irrefutable sub-pattern must be last, if it is allowed at all: + pc->allow_irrefutable = allow_irrefutable && (i == size - 1); + SET_LOC(c, alt); + // The actual control flow is simple: + if (!pc->stores || + !compiler_pattern(c, alt, pc) || + !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || + !compiler_next_block(c)) + { + goto fail; + } + if (!i) { + // If this is the first alternate, save its stores as a "control" + // for the others (they can't bind a different set names): + control = pc->stores; + continue; + } + if (PySet_GET_SIZE(pc->stores) || PySet_GET_SIZE(control)) { + // Otherwise, check to see if we differ from the control set: + PyObject *diff = PyNumber_InPlaceXor(pc->stores, control); + if (!diff) { + goto fail; + } + if (PySet_GET_SIZE(diff)) { + // The names differ! Raise. + Py_DECREF(diff); + compiler_error(c, "alternate patterns bind different names"); + goto fail; + } + Py_DECREF(diff); + } + Py_DECREF(pc->stores); + } + Py_XDECREF(stores_init); + // Update pc->stores and restore pc->allow_irrefutable: + pc->stores = control; + pc->allow_irrefutable = allow_irrefutable; + ADDOP_LOAD_CONST(c, Py_False); + compiler_use_next_block(c, end); + return 1; +fail: + Py_XDECREF(stores_init); + Py_XDECREF(control); + return 0; +} + + +static int +compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == List_kind || p->kind == Tuple_kind); asdl_expr_seq *values = (p->kind == Tuple_kind) ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); + // Find a starred name, if it exists. There may be at most one: Py_ssize_t star = -1; for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -5756,20 +5828,23 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) } star = i; } - basicblock *wrong_size, *end, *fail; + basicblock *end; CHECK(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); ADDOP(c, GET_LEN); if (!size) { - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); + // Empty sequences only require a length check: + ADDOP_LOAD_CONST(c, _PyLong_Zero); ADDOP_COMPARE(c, Eq); compiler_use_next_block(c, end); return 1; } - CHECK(fail = compiler_new_block(c)); + basicblock *wrong_size; CHECK(wrong_size = compiler_new_block(c)); + // Duplicate the length, since both the length check and the GET_INDEX_* + // instructions need it: ADDOP(c, DUP_TOP) if (star < 0) { ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); @@ -5781,10 +5856,13 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_JUMP(c, POP_JUMP_IF_FALSE, wrong_size); NEXT_BLOCK(c); - ADDOP(c, ROT_TWO); if (INT_MAX < size - 1) { return compiler_error(c, "too many sub-patterns in sequence pattern"); } + basicblock *fail; + CHECK(fail = compiler_new_block(c)); + ADDOP(c, ROT_TWO); + // TOS is subject, length underneath. for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { @@ -5799,31 +5877,37 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) if (WILDCARD_CHECK(value)) { continue; } - if (0xFF <= i || INT_MAX <= ((size - 1 - i) << 8)) { + Py_ssize_t end_items = ((size - 1 - i) << 8); + if (0xFF <= i || INT_MAX <= end_items) { // Technical limits are 0xFF patterns to the left of the star, // one starred pattern, and 0xFFFFFF patterns to the right of // the star... same as UNPACK_EX. const char* e = "too many sub-patterns in sequence pattern"; return compiler_error(c, e); } - ADDOP_I(c, GET_INDEX_SLICE, ((size - 1 - i) << 8) + i); + ADDOP_I(c, GET_INDEX_SLICE, end_items + i); } else { + // Basically a negative index: ADDOP_I(c, GET_INDEX_END, size - 1 - i); } - CHECK(compiler_subpattern(c, value, pc)); + CHECK(compiler_pattern_subpattern(c, value, pc)); + // TOS is True or False. We're done with the item underneath: + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail) NEXT_BLOCK(c); - ADDOP(c, POP_TOP); } + // Success! TOS is subject, length undeneath. Pop the length: ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, fail); - ADDOP(c, POP_TOP); + // TOS is subject, length undeneath. Pop the length: ADDOP(c, ROT_TWO); compiler_use_next_block(c, wrong_size); + // TOS is the subject's length. Pop it: ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); @@ -5832,53 +5916,29 @@ compiler_pattern_list_tuple(struct compiler *c, expr_ty p, pattern_context *pc) static int -compiler_pattern_name(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_value(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == Name_kind); - assert(p->v.Name.ctx == Store); - int wildcard = WILDCARD_CHECK(p); - if (!pc->allow_irrefutable) { - // Whoops, can't have a name capture here! - if (wildcard) { - const char *e = "wildcard makes remaining patterns unreachable"; - return compiler_error(c, e); - } - const char *e = "name capture %R makes remaining patterns unreachable"; - return compiler_error(c, e, p->v.Name.id); - } - if (!wildcard) { - ADDOP(c, DUP_TOP); - CHECK(pattern_helper_store_name(c, p->v.Name.id, pc)); - } - ADDOP_LOAD_CONST(c, Py_True); + assert(p->kind == Attribute_kind); + assert(p->v.Attribute.ctx == Load); + ADDOP(c, DUP_TOP); + CHECK(pattern_helper_load_attr(c, p, pc)); + ADDOP_COMPARE(c, Eq); return 1; } static int -compiler_pattern_match_as(struct compiler *c, expr_ty p, pattern_context *pc) +compiler_pattern_wildcard(struct compiler *c, expr_ty p, pattern_context *pc) { - assert(p->kind == MatchAs_kind); - basicblock *end; - CHECK(end = compiler_new_block(c)); - CHECK(compiler_pattern(c, p->v.MatchAs.pattern, pc)); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); - NEXT_BLOCK(c); - ADDOP(c, DUP_TOP); - CHECK(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); + assert(p->kind == Name_kind); + assert(p->v.Name.ctx == Store); + assert(WILDCARD_CHECK(p)); + if (!pc->allow_irrefutable) { + // Whoops, can't have a wildcard here! + const char *e = "wildcard makes remaining patterns unreachable"; + return compiler_error(c, e); + } ADDOP_LOAD_CONST(c, Py_True); - compiler_use_next_block(c, end); - return 1; -} - - -static int // TODO -compiler_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) -{ - int allow_irrefutable = pc->allow_irrefutable; - pc->allow_irrefutable = 1; - CHECK(compiler_pattern(c, p, pc)); - pc->allow_irrefutable = allow_irrefutable; return 1; } @@ -5889,35 +5949,38 @@ compiler_pattern(struct compiler *c, expr_ty p, pattern_context *pc) SET_LOC(c, p); switch (p->kind) { case Attribute_kind: - return compiler_pattern_attribute(c, p, pc); + return compiler_pattern_value(c, p, pc); case BinOp_kind: // Because we allow "2+2j", things like "2+2" make it this far: return compiler_error(c, "patterns cannot include operators"); case Call_kind: - return compiler_pattern_call(c, p, pc); + return compiler_pattern_class(c, p, pc); case Constant_kind: - return compiler_pattern_constant(c, p, pc); + return compiler_pattern_literal(c, p, pc); case Dict_kind: - return compiler_pattern_dict(c, p, pc); + return compiler_pattern_mapping(c, p, pc); case JoinedStr_kind: // Because we allow strings, f-strings make it this far: return compiler_error(c, "patterns cannot include f-strings"); case List_kind: case Tuple_kind: - return compiler_pattern_list_tuple(c, p, pc); + return compiler_pattern_sequence(c, p, pc); case MatchAs_kind: - return compiler_pattern_match_as(c, p, pc); + return compiler_pattern_as(c, p, pc); case MatchOr_kind: - return compiler_pattern_match_or(c, p, pc); + return compiler_pattern_or(c, p, pc); case Name_kind: - return compiler_pattern_name(c, p, pc); + if (WILDCARD_CHECK(p)) { + return compiler_pattern_wildcard(c, p, pc); + } + return compiler_pattern_capture(c, p, pc); default: Py_UNREACHABLE(); } } -static int // TODO +static int compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.subject); @@ -5926,29 +5989,36 @@ compiler_match(struct compiler *c, stmt_ty s) Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; + // We use pc.stores to track: + // - Repeated name assignments in the same pattern. + // - Different name assignments in alternates. + // It's a set of names, but we don't create it until it's needed: pc.stores = NULL; - int result; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); int has_default = WILDCARD_CHECK(m->pattern) && 1 < cases; for (Py_ssize_t i = 0; i < cases - has_default; i++) { m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); CHECK(next = compiler_new_block(c)); - // An irrefutable case must be either guarded, last, or both: + // If pc.allow_irrefutable is 0, any name captures against our subject + // will raise. Irrefutable cases must be either guarded, last, or both: pc.allow_irrefutable = !!m->guard || (i == cases - 1); - result = compiler_pattern(c, m->pattern, &pc); + int result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); CHECK(result); + // TOS is either True or False, with the subject still waiting beneath: ADDOP_JUMP(c, POP_JUMP_IF_FALSE, next); NEXT_BLOCK(c); if (m->guard) { CHECK(compiler_jump_if(c, m->guard, next, 0)); } + // Success! Pop the subject off, we're done with it: ADDOP(c, POP_TOP); VISIT_SEQ(c, stmt, m->body); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, next); } + // No matches. Done with the subject: ADDOP(c, POP_TOP); if (has_default) { // A trailing "case _" is common, and lets us save a bit of redundant From d5f32da3227f90ee9f95c8be2dc0ab930625815a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 08:54:16 -0700 Subject: [PATCH 189/218] Add NEWS entry --- .../Core and Builtins/2020-10-23-08-54-04.bpo-42128.SWmVEm.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-10-23-08-54-04.bpo-42128.SWmVEm.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-10-23-08-54-04.bpo-42128.SWmVEm.rst b/Misc/NEWS.d/next/Core and Builtins/2020-10-23-08-54-04.bpo-42128.SWmVEm.rst new file mode 100644 index 00000000000000..e779eb8ceb1926 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-10-23-08-54-04.bpo-42128.SWmVEm.rst @@ -0,0 +1 @@ +Implement :pep:`634` (structural pattern matching). Patch by Brandt Bucher. From 949822c031eccfbd841e2569829916c1e90d3803 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 12:05:36 -0700 Subject: [PATCH 190/218] Improve precedence logic in ast.unparse --- Lib/ast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index 1f71b452db99c5..11c0746ce6faa2 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1515,13 +1515,13 @@ def visit_match_case(self, node): def visit_MatchAs(self, node): with self.require_parens(_Precedence.TEST, node): - self.set_precedence(_Precedence.EXPR, node.pattern) + self.set_precedence(_Precedence.BOR, node.pattern) self.traverse(node.pattern) self.write(f" as {node.name}") def visit_MatchOr(self, node): - with self.require_parens(_Precedence.EXPR, node): - self.set_precedence(_Precedence.ATOM, *node.patterns) + with self.require_parens(_Precedence.BOR, node): + self.set_precedence(_Precedence.BOR.next(), *node.patterns) self.interleave(lambda: self.write(" | "), self.traverse, node.patterns) def unparse(ast_obj): From a31f2efc13945178da6b5a5b1d61754fe4f9de4a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 13:35:32 -0700 Subject: [PATCH 191/218] Some VM cleanup --- Python/ceval.c | 63 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 1f7993dcfef35e..55e1119a0882a2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -858,27 +858,38 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) return 0; } -// Need these for pattern matching: -static PyObject* // TODO -match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) +// PEP 634: Structural Pattern Matching + + +static PyObject* +match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) { + // Return a tuple of values corresponding to keys, with error checks for + // duplicate/missing keys. assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); if (!nkeys) { + // No keys means no items. return PyTuple_New(0); } - PyObject *seen = NULL; - PyObject *values = NULL; + // We use the two argument form of map.get(key, default) for two reasons: + // - Atomically check for a key and get its value without error handling. + // - Don't cause key creation or resizing in dict subclasses like + // collections.defaultdict that define __missing__ (or similar). _Py_IDENTIFIER(get); PyObject *get = _PyObject_GetAttrId(map, &PyId_get); if (!get) { return NULL; } + PyObject *seen = NULL; + PyObject *values = NULL; + // dummy = object() PyObject *dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); if (!dummy) { goto fail; } + // We need to keep track of what we've seen in order to catch duplicates: seen = PySet_New(NULL); if (!seen) { goto fail; @@ -887,23 +898,25 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) if (!values) { goto fail; } - PyObject *key, *value; for (Py_ssize_t i = 0; i < nkeys; i++) { - key = PyTuple_GET_ITEM(keys, i); + PyObject *key = PyTuple_GET_ITEM(keys, i); if (PySet_Contains(seen, key) || PySet_Add(seen, key)) { if (!_PyErr_Occurred(tstate)) { + // Seen it before! _PyErr_Format(tstate, PyExc_ValueError, "mapping pattern checks duplicate key (%R)", key); } goto fail; } - value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); + PyObject *value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); if (!value || value == dummy) { + // Key not in map. Py_XDECREF(value); goto fail; } PyTuple_SET_ITEM(values, i, value); } + // Success. Py_DECREF(get); Py_DECREF(dummy); Py_DECREF(seen); @@ -916,7 +929,7 @@ match_map_items(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } -static PyObject * // TODO +static PyObject* dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) { // copy = dict(map) @@ -925,6 +938,7 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // return copy PyObject *copy; if (PyDict_CheckExact(map)) { + // TODO: check this. copy = PyDict_Copy(map); if (!copy) { return NULL; @@ -937,8 +951,8 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } } - // This may seem a bit ineffient, but keys is rarely big enough to actually - // impact runtime. + // This may seem a bit inefficient, but keys is rarely big enough to + // actually impact runtime. for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(keys); i++) { if (PyDict_DelItem(copy, PyTuple_GET_ITEM(keys, i))) { Py_DECREF(copy); @@ -948,7 +962,7 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return copy; } -static PyObject * +static PyObject* get_match_args(PyThreadState *tstate, PyObject *type) { // match_args = getattr(type, "__match_args__", ()) @@ -978,8 +992,8 @@ get_match_args(PyThreadState *tstate, PyObject *type) return NULL; } -static PyObject * // TODO -do_match(PyThreadState *tstate, Py_ssize_t nargs, PyObject *kwargs, PyObject *type, PyObject *subject) +static PyObject* // TODO +match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs) { // TODO: Break this up! if (!PyType_Check(type)) { @@ -3748,12 +3762,16 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_CLASS): { - // TODO + // On success, replace TOS with True and TOS1 with a tuple of + // attributes. On failure, replace TOS with False. PyObject *names = TOP(); PyObject *type = SECOND(); PyObject *subject = THIRD(); - PyObject *attrs = do_match(tstate, oparg, names, type, subject); + assert(PyTuple_CheckExact(names)); + PyObject *attrs = match_class(tstate, subject, type, oparg, names); if (attrs) { + // Success! + assert(PyTuple_CheckExact(attrs)); Py_DECREF(type); SET_SECOND(attrs); } @@ -3796,9 +3814,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQUENCE): { - // PUSH(isinstance(TOS, _collections_abc.Sequence) - // and not isinstance(TOS, (bytearray, bytes, str)) - // and not hasattr(TOS, "__next__")) + // PUSH(isinstance(TOS, _collections_abc.Sequence) and + // not isinstance(TOS, (bytearray, bytes, str)) and + // not hasattr(TOS, "__next__")) PyObject *subject = TOP(); // Fast path for lists and tuples: if (PyType_FastSubclass(Py_TYPE(subject), @@ -3845,7 +3863,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // TODO PyObject *keys = TOP(); PyObject *subject = SECOND(); - PyObject *values = match_map_items(tstate, subject, keys); + assert(PyTuple_CheckExact(keys)); + PyObject *values = match_keys(tstate, subject, keys); if (!values) { if (_PyErr_Occurred(tstate)) { goto error; @@ -3854,11 +3873,15 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PUSH(Py_False); DISPATCH(); } + // Success! if (oparg) { + // If oparg is nonzero, collect the remaining items into a dict + // and put it on the stack where the subject used to be: PyObject *rest = dict_without_keys(tstate, subject, keys); if (!rest) { goto error; } + assert(PyDict_CheckExact(rest)); SET_SECOND(rest); Py_DECREF(subject); } From fe35b088dc76093fe606f36ab64fe4508d497de5 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 14:17:13 -0700 Subject: [PATCH 192/218] alternate -> alternative --- Python/compile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 03663f168b1855..5cd33351f3223a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5747,7 +5747,7 @@ static int compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == MatchOr_kind); - // control is the set of names bound by the first alternate. If all of the + // control is the set of names bound by the first alternative. If all of the // others bind the same names (they should), then this becomes pc->stores. PyObject *control = NULL; basicblock *end; @@ -5773,7 +5773,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) goto fail; } if (!i) { - // If this is the first alternate, save its stores as a "control" + // If this is the first alternative, save its stores as a "control" // for the others (they can't bind a different set names): control = pc->stores; continue; @@ -5787,7 +5787,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) if (PySet_GET_SIZE(diff)) { // The names differ! Raise. Py_DECREF(diff); - compiler_error(c, "alternate patterns bind different names"); + compiler_error(c, "alternative patterns bind different names"); goto fail; } Py_DECREF(diff); @@ -5991,7 +5991,7 @@ compiler_match(struct compiler *c, stmt_ty s) pattern_context pc; // We use pc.stores to track: // - Repeated name assignments in the same pattern. - // - Different name assignments in alternates. + // - Different name assignments in alternatives. // It's a set of names, but we don't create it until it's needed: pc.stores = NULL; match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1); From e6880057c0787c282b89bf5955400c9eb4b27cf5 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 17:13:58 -0700 Subject: [PATCH 193/218] Remove dict copy fast-path, add comments --- Python/ceval.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 55e1119a0882a2..65b32eb755fae1 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -936,20 +936,10 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // for key in keys: // del copy[key] // return copy - PyObject *copy; - if (PyDict_CheckExact(map)) { - // TODO: check this. - copy = PyDict_Copy(map); - if (!copy) { - return NULL; - } - } - else { - copy = PyDict_New(); - if (!copy || PyDict_Update(copy, map)) { - Py_XDECREF(copy); - return NULL; - } + PyObject *copy = PyDict_New(); + if (!copy || PyDict_Update(copy, map)) { + Py_XDECREF(copy); + return NULL; } // This may seem a bit inefficient, but keys is rarely big enough to // actually impact runtime. @@ -992,19 +982,23 @@ get_match_args(PyThreadState *tstate, PyObject *type) return NULL; } -static PyObject* // TODO -match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs) +static PyObject* +match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, + Py_ssize_t nargs, PyObject *kwargs) { - // TODO: Break this up! + // On success (match), return a tuple of extracted attributes. On failure + // (no match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate. if (!PyType_Check(type)) { _PyErr_Format(tstate, PyExc_TypeError, "called match pattern must be a type"); return NULL; } assert(PyTuple_CheckExact(kwargs)); + // First an isinstance check: if (PyObject_IsInstance(subject, type) <= 0) { return NULL; } + // Okay, now the tricky part... PyObject *args = NULL; PyObject *attrs = NULL; PyObject *seen = NULL; @@ -1030,7 +1024,6 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t Py_DECREF(match_args); nmatch_args = PyType_HasFeature((PyTypeObject *)type, _Py_TPFLAGS_MATCH_SELF); - args = NULL; } else { args = PyTuple_GetSlice(match_args, 0, nargs); @@ -1055,8 +1048,8 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t if (!seen) { goto error; } - PyObject *name, *attr; for (Py_ssize_t i = 0; i < count; i++) { + PyObject *name; if (i < nargs) { if (!args) { assert(!i); @@ -1067,8 +1060,8 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t name = PyTuple_GET_ITEM(args, i); if (!PyUnicode_CheckExact(name)) { _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ elements must be strings (got %s)", - Py_TYPE(name)->tp_name); + "__match_args__ elements must be strings " + "(got %s)", Py_TYPE(name)->tp_name); goto error; } } @@ -1078,12 +1071,12 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { if (!_PyErr_Occurred(tstate)) { _PyErr_Format(tstate, PyExc_TypeError, - "%s() got multiple sub-patterns for attribute %R", - ((PyTypeObject *)type)->tp_name, name); + "%s() got multiple sub-patterns for attribute %R", + ((PyTypeObject *)type)->tp_name, name); } goto error; } - attr = PyObject_GetAttr(subject, name); + PyObject *attr = PyObject_GetAttr(subject, name); if (!attr) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); @@ -3860,7 +3853,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_KEYS): { - // TODO + // Final stage of mapping pattern matches (after Mapping and length + // checks): extract the desired values for further destructuring. PyObject *keys = TOP(); PyObject *subject = SECOND(); assert(PyTuple_CheckExact(keys)); From 5589f77c856cca6e126c1e1fa6ef95f4d097f6e9 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Oct 2020 23:59:59 -0700 Subject: [PATCH 194/218] Finish ceval cleanup --- Python/ceval.c | 232 ++++++++++++++++++++++++++----------------------- 1 file changed, 124 insertions(+), 108 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 65b32eb755fae1..3b4852a908b1af 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -889,7 +889,6 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) if (!dummy) { goto fail; } - // We need to keep track of what we've seen in order to catch duplicates: seen = PySet_New(NULL); if (!seen) { goto fail; @@ -952,34 +951,75 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return copy; } -static PyObject* -get_match_args(PyThreadState *tstate, PyObject *type) +static int +get_match_args(PyThreadState *tstate, PyObject *type, PyObject **match_args, + int *match_self) { - // match_args = getattr(type, "__match_args__", ()) - // if match_args.__class__ in (list, tuple): - // return tuple(match_args) - // raise TypeError - PyObject *match_args = PyObject_GetAttrString(type, "__match_args__"); - if (!match_args) { + // try: + // match_args = type.__match_args__ + // except AttributeError: + // match_self = type.__flags__ & _Py_TPFLAGS_MATCH_SELF + // match_args = () + // else: + // match_self = 0 + // if match_args.__class__ is list: + // match_args = tuple(match_args) + // elif match_args.__class__ is not tuple: + // raise TypeError + *match_args = PyObject_GetAttrString(type, "__match_args__"); + if (!*match_args) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); - return PyTuple_New(0); + // _Py_TPFLAGS_MATCH_SELF is only acknowledged if the type does not + // define __match_args__. This is natural behavior for subclasses: + // it's as if __match_args__ is some "magic" value that is lost as + // soon as they redefine it. + *match_self = PyType_HasFeature((PyTypeObject*)type, + _Py_TPFLAGS_MATCH_SELF); + *match_args = PyTuple_New(0); + return 0; } - return NULL; + return 1; } - if (PyTuple_CheckExact(match_args)) { - return match_args; + *match_self = 0; + if (PyTuple_CheckExact(*match_args)) { + return 0; } - if (PyList_CheckExact(match_args)) { - PyObject *tuple = PyList_AsTuple(match_args); - Py_DECREF(match_args); - return tuple; + if (PyList_CheckExact(*match_args)) { + Py_SETREF(*match_args, PyList_AsTuple(*match_args)); + return 0; } - _PyErr_Format(tstate, PyExc_TypeError, - "%s.__match_args__ must be a list or tuple (got %s)", - ((PyTypeObject *)type)->tp_name, Py_TYPE(match_args)->tp_name); - Py_DECREF(match_args); - return NULL; + const char *e = "%s.__match_args__ must be a list or tuple (got %s)"; + _PyErr_Format(tstate, PyExc_TypeError, e, ((PyTypeObject *)type)->tp_name, + Py_TYPE(*match_args)->tp_name); + Py_CLEAR(*match_args); + return 1; +} + +static PyObject* +match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, + PyObject *name, PyObject *seen) +{ + // Extract a named attribute from the subject, with additional bookkeeping + // to raise TypeErrors for repeated lookups. On failure, return NULL (with + // no error set). Use _PyErr_Occurred(tstate) to disambiguate. + assert(PyUnicode_CheckExact(name)); + // XXX: Why doesn't PySet_CheckExact exist? + assert(Py_IS_TYPE(seen, &PySet_Type)); + if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { + if (!_PyErr_Occurred(tstate)) { + // Seen it before! + _PyErr_Format(tstate, PyExc_TypeError, + "%s() got multiple sub-patterns for attribute %R", + ((PyTypeObject*)type)->tp_name, name); + } + return NULL; + } + PyObject *attr = PyObject_GetAttr(subject, name); + if (!attr && _PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { + _PyErr_Clear(tstate); + } + return attr; } static PyObject* @@ -989,111 +1029,87 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, // On success (match), return a tuple of extracted attributes. On failure // (no match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate. if (!PyType_Check(type)) { - _PyErr_Format(tstate, PyExc_TypeError, - "called match pattern must be a type"); + const char *e = "called match pattern must be a type"; + _PyErr_Format(tstate, PyExc_TypeError, e); return NULL; } assert(PyTuple_CheckExact(kwargs)); - // First an isinstance check: + // First, an isinstance check: if (PyObject_IsInstance(subject, type) <= 0) { return NULL; } - // Okay, now the tricky part... - PyObject *args = NULL; - PyObject *attrs = NULL; - PyObject *seen = NULL; - Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwargs); - Py_ssize_t count = nargs + nkwargs; - Py_ssize_t nmatch_args; - // TODO: Just build attrs in two passes (nargs and nkwargs)? - if (!nargs) { - nmatch_args = 0; - args = PyTuple_New(0); - if (!args) { - goto error; - } - } - else { - PyObject *match_args = get_match_args(tstate, type); - if (!match_args) { - goto error; - } - assert(PyTuple_CheckExact(match_args)); - nmatch_args = PyTuple_GET_SIZE(match_args); - if (!nmatch_args) { - Py_DECREF(match_args); - nmatch_args = PyType_HasFeature((PyTypeObject *)type, - _Py_TPFLAGS_MATCH_SELF); - } - else { - args = PyTuple_GetSlice(match_args, 0, nargs); - Py_DECREF(match_args); - if (!args) { - goto error; - } - } - } - if (nmatch_args < nargs) { - _PyErr_Format(tstate, PyExc_TypeError, - "%s() accepts %d positional sub-patterns (%d given)", - ((PyTypeObject *)type)->tp_name, nmatch_args, nargs); - goto error; - } - assert(!args || PyTuple_CheckExact(args)); - attrs = PyTuple_New(count); + // So far so good: + PyObject *attrs = PyTuple_New(nargs + PyTuple_GET_SIZE(kwargs)); if (!attrs) { - goto error; + return NULL; } - seen = PySet_New(NULL); + PyObject *seen = PySet_New(NULL); if (!seen) { - goto error; + Py_DECREF(attrs); + return NULL; } - for (Py_ssize_t i = 0; i < count; i++) { - PyObject *name; - if (i < nargs) { - if (!args) { - assert(!i); - Py_INCREF(subject); - PyTuple_SET_ITEM(attrs, 0, subject); - continue; - } - name = PyTuple_GET_ITEM(args, i); - if (!PyUnicode_CheckExact(name)) { - _PyErr_Format(tstate, PyExc_TypeError, - "__match_args__ elements must be strings " - "(got %s)", Py_TYPE(name)->tp_name); - goto error; - } + // NOTE: From this point on, goto fail on failure: + PyObject *match_args = NULL; + // First, the positional subpatterns: + if (nargs) { + int match_self; + if (get_match_args(tstate, type, &match_args, &match_self)) { + goto fail; } - else { - name = PyTuple_GET_ITEM(kwargs, i - nargs); + assert(PyTuple_CheckExact(match_args)); + // If match_self, no __match_args__: + assert(match_self ? !PyTuple_GET_SIZE(match_args) : 1); + Py_ssize_t allowed = PyTuple_GET_SIZE(match_args) + match_self; + if (allowed < nargs) { + const char *plural = (allowed == 1) ? "" : "s"; + _PyErr_Format(tstate, PyExc_TypeError, + "%s() accepts %d positional sub-pattern%s (%d given)", + ((PyTypeObject*)type)->tp_name, + allowed, plural, nargs); + goto fail; } - if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { - if (!_PyErr_Occurred(tstate)) { - _PyErr_Format(tstate, PyExc_TypeError, - "%s() got multiple sub-patterns for attribute %R", - ((PyTypeObject *)type)->tp_name, name); + if (match_self) { + // Easy. Copy the subject itself, and move on to kwargs. + assert(!PyTuple_GET_SIZE(match_args)); + Py_INCREF(subject); + PyTuple_SET_ITEM(attrs, 0, subject); + } + else { + for (Py_ssize_t i = 0; i < nargs; i++) { + PyObject *name = PyTuple_GET_ITEM(match_args, i); + if (!PyUnicode_CheckExact(name)) { + _PyErr_Format(tstate, PyExc_TypeError, + "__match_args__ elements must be strings " + "(got %s)", Py_TYPE(name)->tp_name); + goto fail; + } + PyObject *attr = match_class_attr(tstate, subject, type, name, + seen); + if (!attr) { + goto fail; + } + PyTuple_SET_ITEM(attrs, i, attr); } - goto error; } - PyObject *attr = PyObject_GetAttr(subject, name); + Py_CLEAR(match_args); + } + // Finally, the keyword subpatterns: + for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(kwargs); i++) { + PyObject *name = PyTuple_GET_ITEM(kwargs, i); + PyObject *attr = match_class_attr(tstate, subject, type, name, seen); if (!attr) { - if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { - _PyErr_Clear(tstate); - Py_CLEAR(attrs); - break; - } - goto error; + goto fail; } - PyTuple_SET_ITEM(attrs, i, attr); + PyTuple_SET_ITEM(attrs, nargs + i, attr); } - Py_XDECREF(args); Py_DECREF(seen); return attrs; -error: - Py_XDECREF(args); - Py_XDECREF(seen); - Py_XDECREF(attrs); +fail: + // We really don't care whether an error was raised or not... that's our + // caller's problem. All we know is that the match failed. + Py_DECREF(attrs); + Py_DECREF(seen); + Py_XDECREF(match_args); return NULL; } From 243f3d271ccfdd1f024402929d0bd68eb57545e6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 27 Oct 2020 15:02:07 -0700 Subject: [PATCH 195/218] Regenerate the keyword module --- Lib/keyword.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/keyword.py b/Lib/keyword.py index f394ffd7317a90..cc2b46b7229d53 100644 --- a/Lib/keyword.py +++ b/Lib/keyword.py @@ -54,6 +54,7 @@ ] softkwlist = [ + '_', 'case', 'match' ] From a1ba3a700deb0ac03f489500298587e9b3a36ed2 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 27 Oct 2020 15:08:34 -0700 Subject: [PATCH 196/218] Add regen-keyword to regen-all --- Makefile.pre.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 5b6c0b9b62d334..a0d6fafeb862fd 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -749,7 +749,7 @@ regen-importlib: Programs/_freeze_importlib regen-all: regen-opcode regen-opcode-targets regen-typeslots \ regen-token regen-ast regen-importlib clinic \ - regen-pegen-metaparser regen-pegen + regen-pegen-metaparser regen-pegen regen-keyword ############################################################################ # Special rules for object files From 8b093eb90451864685dc53f75283686e380e6bed Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 27 Oct 2020 23:17:51 -0700 Subject: [PATCH 197/218] Remove iterator checks from sequence patterns --- Doc/library/dis.rst | 6 +++--- Python/ceval.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 453ed0fd6a0843..6ee2f610713904 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -768,9 +768,9 @@ iterations of the loop. .. opcode:: MATCH_SEQUENCE - If TOS is an instance of :class:`collections.abc.Sequence`, is not an - instance of :class:`str`/:class:`bytes`/:class:`bytearray`, and is not an - :term:`iterator`, push ``True`` onto the stack. Otherwise, push ``False``. + If TOS is an instance of :class:`collections.abc.Sequence` and is *not* an + instance of :class:`str`/:class:`bytes`/:class:`bytearray`, push ``True`` + onto the stack. Otherwise, push ``False``. .. versionadded:: 3.10 diff --git a/Python/ceval.c b/Python/ceval.c index a6beeaab93a7c8..9afaad7b779191 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3830,9 +3830,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_SEQUENCE): { - // PUSH(isinstance(TOS, _collections_abc.Sequence) and - // not isinstance(TOS, (bytearray, bytes, str)) and - // not hasattr(TOS, "__next__")) + // PUSH(not isinstance(TOS, (bytearray, bytes, str)) + // and isinstance(TOS, _collections_abc.Sequence)) PyObject *subject = TOP(); // Fast path for lists and tuples: if (PyType_FastSubclass(Py_TYPE(subject), @@ -3847,7 +3846,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (PyType_FastSubclass(Py_TYPE(subject), Py_TPFLAGS_BYTES_SUBCLASS | Py_TPFLAGS_UNICODE_SUBCLASS) || - PyIter_Check(subject) || PyByteArray_Check(subject)) { Py_INCREF(Py_False); From e21d33a6eef56311578d560a68115289635c52fb Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 12 Nov 2020 08:43:45 -0800 Subject: [PATCH 198/218] Re-bump magic number --- Lib/importlib/_bootstrap_external.py | 5 +- Python/importlib_external.h | 222 +++++++++++++-------------- 2 files changed, 114 insertions(+), 113 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index f1c5f214d71d87..378b7a27558556 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -278,7 +278,8 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3424 (simplify bytecodes for *value unpacking) # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) -# Python 3.10a2 3431 (PEP 634: Structural Pattern Matching) +# Python 3.10a1 3431 (New line number table format -- PEP 626) +# Python 3.10a2 3432 (PEP 634: Structural Pattern Matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -288,7 +289,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3431).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3432).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Python/importlib_external.h b/Python/importlib_external.h index e148973fbec610..6c23bb989cf037 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -285,7 +285,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,13,95,119,114,105,116,101,95,97,116,111,109,105,99, 120,0,0,0,115,28,0,0,0,0,5,16,1,6,1,22, 255,4,2,2,3,14,1,40,1,16,1,12,1,2,1,14, - 1,12,1,6,1,114,69,0,0,0,105,103,13,0,0,114, + 1,12,1,6,1,114,69,0,0,0,105,104,13,0,0,114, 28,0,0,0,114,17,0,0,0,115,2,0,0,0,13,10, 90,11,95,95,112,121,99,97,99,104,101,95,95,122,4,111, 112,116,45,122,3,46,112,121,122,4,46,112,121,99,78,41, @@ -399,7 +399,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 90,15,97,108,109,111,115,116,95,102,105,108,101,110,97,109, 101,218,8,102,105,108,101,110,97,109,101,114,5,0,0,0, 114,5,0,0,0,114,8,0,0,0,218,17,99,97,99,104, - 101,95,102,114,111,109,95,115,111,117,114,99,101,47,1,0, + 101,95,102,114,111,109,95,115,111,117,114,99,101,48,1,0, 0,115,72,0,0,0,0,18,8,1,6,1,2,255,4,2, 8,1,4,1,8,1,12,1,10,1,12,1,16,1,8,1, 8,1,8,1,24,1,8,1,12,1,6,2,8,1,8,1, @@ -480,7 +480,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,90,9,111,112,116,95,108,101,118,101,108,90,13,98, 97,115,101,95,102,105,108,101,110,97,109,101,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,17,115,111,117, - 114,99,101,95,102,114,111,109,95,99,97,99,104,101,118,1, + 114,99,101,95,102,114,111,109,95,99,97,99,104,101,119,1, 0,0,115,60,0,0,0,0,9,12,1,8,1,10,1,12, 1,4,1,10,1,12,1,14,1,16,1,4,1,4,1,12, 1,8,1,8,1,2,255,8,2,10,1,8,1,16,1,10, @@ -516,7 +516,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, 95,112,97,116,104,114,5,0,0,0,114,5,0,0,0,114, 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,158,1,0,0,115,20,0,0,0,0,7, + 101,102,105,108,101,159,1,0,0,115,20,0,0,0,0,7, 12,1,4,1,16,1,24,1,4,1,2,1,12,1,16,1, 18,1,114,108,0,0,0,99,1,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,0, @@ -529,7 +529,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,114,101,0,0,0,114,97,0,0,0,114,82,0,0,0, 114,88,0,0,0,41,1,114,96,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,11,95,103,101, - 116,95,99,97,99,104,101,100,177,1,0,0,115,16,0,0, + 116,95,99,97,99,104,101,100,178,1,0,0,115,16,0,0, 0,0,1,14,1,2,1,10,1,12,1,6,1,14,1,4, 2,114,112,0,0,0,99,1,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,8,0,0,0,67,0,0,0,115, @@ -543,7 +543,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,233,128,0,0,0,41,3,114,49,0,0,0,114,51, 0,0,0,114,50,0,0,0,41,2,114,44,0,0,0,114, 52,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,10,95,99,97,108,99,95,109,111,100,101,189, + 0,0,0,218,10,95,99,97,108,99,95,109,111,100,101,190, 1,0,0,115,12,0,0,0,0,2,2,1,14,1,12,1, 10,3,8,1,114,114,0,0,0,99,1,0,0,0,0,0, 0,0,0,0,0,0,3,0,0,0,8,0,0,0,3,0, @@ -582,7 +582,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 103,115,218,6,107,119,97,114,103,115,169,1,218,6,109,101, 116,104,111,100,114,5,0,0,0,114,8,0,0,0,218,19, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, - 112,101,114,209,1,0,0,115,18,0,0,0,0,1,8,1, + 112,101,114,210,1,0,0,115,18,0,0,0,0,1,8,1, 8,1,10,1,4,1,8,255,2,1,2,255,6,2,122,40, 95,99,104,101,99,107,95,110,97,109,101,46,60,108,111,99, 97,108,115,62,46,95,99,104,101,99,107,95,110,97,109,101, @@ -600,7 +600,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,100,105,99,116,95,95,218,6,117,112,100,97,116,101,41, 3,90,3,110,101,119,90,3,111,108,100,114,67,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 5,95,119,114,97,112,220,1,0,0,115,8,0,0,0,0, + 5,95,119,114,97,112,221,1,0,0,115,8,0,0,0,0, 1,8,1,10,1,20,1,122,26,95,99,104,101,99,107,95, 110,97,109,101,46,60,108,111,99,97,108,115,62,46,95,119, 114,97,112,41,1,78,41,3,218,10,95,98,111,111,116,115, @@ -608,7 +608,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,41,3,114,122,0,0,0,114,123,0,0,0, 114,133,0,0,0,114,5,0,0,0,114,121,0,0,0,114, 8,0,0,0,218,11,95,99,104,101,99,107,95,110,97,109, - 101,201,1,0,0,115,14,0,0,0,0,8,14,7,2,1, + 101,202,1,0,0,115,14,0,0,0,0,8,14,7,2,1, 10,1,12,2,14,5,10,1,114,136,0,0,0,99,2,0, 0,0,0,0,0,0,0,0,0,0,5,0,0,0,6,0, 0,0,67,0,0,0,115,60,0,0,0,124,0,160,0,124, @@ -636,7 +636,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,97,100,101,114,218,8,112,111,114,116,105,111,110,115,218, 3,109,115,103,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,17,95,102,105,110,100,95,109,111,100,117,108, - 101,95,115,104,105,109,229,1,0,0,115,10,0,0,0,0, + 101,95,115,104,105,109,230,1,0,0,115,10,0,0,0,0, 10,14,1,16,1,4,1,22,1,114,143,0,0,0,99,3, 0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,4, 0,0,0,67,0,0,0,115,166,0,0,0,124,0,100,1, @@ -703,7 +703,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,95,100,101,116,97,105,108,115,90,5,109,97,103,105,99, 114,92,0,0,0,114,2,0,0,0,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,13,95,99,108,97,115, - 115,105,102,121,95,112,121,99,246,1,0,0,115,28,0,0, + 115,105,102,121,95,112,121,99,247,1,0,0,115,28,0,0, 0,0,16,12,1,8,1,16,1,12,1,16,1,12,1,10, 1,12,1,8,1,16,2,8,1,16,1,16,1,114,152,0, 0,0,99,5,0,0,0,0,0,0,0,0,0,0,0,6, @@ -758,7 +758,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,116,0,0,0,114,151,0,0,0,114,92,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,23, 95,118,97,108,105,100,97,116,101,95,116,105,109,101,115,116, - 97,109,112,95,112,121,99,23,2,0,0,115,16,0,0,0, + 97,109,112,95,112,121,99,24,2,0,0,115,16,0,0,0, 0,19,24,1,10,1,12,1,16,1,8,1,22,255,2,2, 114,156,0,0,0,99,4,0,0,0,0,0,0,0,0,0, 0,0,4,0,0,0,4,0,0,0,67,0,0,0,115,42, @@ -804,7 +804,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,11,115,111,117,114,99,101,95,104,97,115,104,114,116,0, 0,0,114,151,0,0,0,114,5,0,0,0,114,5,0,0, 0,114,8,0,0,0,218,18,95,118,97,108,105,100,97,116, - 101,95,104,97,115,104,95,112,121,99,51,2,0,0,115,12, + 101,95,104,97,115,104,95,112,121,99,52,2,0,0,115,12, 0,0,0,0,17,16,1,2,1,8,255,4,2,2,254,114, 158,0,0,0,99,4,0,0,0,0,0,0,0,0,0,0, 0,5,0,0,0,5,0,0,0,67,0,0,0,115,80,0, @@ -828,7 +828,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,116,0,0,0,114,106,0,0,0,114,107,0, 0,0,218,4,99,111,100,101,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,17,95,99,111,109,112,105,108, - 101,95,98,121,116,101,99,111,100,101,75,2,0,0,115,18, + 101,95,98,121,116,101,99,111,100,101,76,2,0,0,115,18, 0,0,0,0,2,10,1,10,1,12,1,8,1,12,1,4, 2,10,1,4,255,114,165,0,0,0,114,73,0,0,0,99, 3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0, @@ -847,7 +847,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,155,0,0,0,114,26,0,0,0,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,22,95,99,111,100,101, 95,116,111,95,116,105,109,101,115,116,97,109,112,95,112,121, - 99,88,2,0,0,115,12,0,0,0,0,2,8,1,14,1, + 99,89,2,0,0,115,12,0,0,0,0,2,8,1,14,1, 14,1,14,1,16,1,114,170,0,0,0,84,99,3,0,0, 0,0,0,0,0,0,0,0,0,5,0,0,0,5,0,0, 0,67,0,0,0,115,80,0,0,0,116,0,116,1,131,1, @@ -865,7 +865,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 7,99,104,101,99,107,101,100,114,26,0,0,0,114,2,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, 0,218,17,95,99,111,100,101,95,116,111,95,104,97,115,104, - 95,112,121,99,98,2,0,0,115,14,0,0,0,0,2,8, + 95,112,121,99,99,2,0,0,115,14,0,0,0,0,2,8, 1,12,1,14,1,16,1,10,1,16,1,114,171,0,0,0, 99,1,0,0,0,0,0,0,0,0,0,0,0,5,0,0, 0,6,0,0,0,67,0,0,0,115,62,0,0,0,100,1, @@ -892,7 +892,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,105,110,101,218,8,101,110,99,111,100,105,110,103,90,15, 110,101,119,108,105,110,101,95,100,101,99,111,100,101,114,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,13, - 100,101,99,111,100,101,95,115,111,117,114,99,101,109,2,0, + 100,101,99,111,100,101,95,115,111,117,114,99,101,110,2,0, 0,115,10,0,0,0,0,5,8,1,12,1,10,1,12,1, 114,176,0,0,0,169,2,114,140,0,0,0,218,26,115,117, 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, @@ -954,7 +954,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,7,100,105,114,110,97,109,101,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,23,115,112,101,99,95, 102,114,111,109,95,102,105,108,101,95,108,111,99,97,116,105, - 111,110,126,2,0,0,115,62,0,0,0,0,12,8,4,4, + 111,110,127,2,0,0,115,62,0,0,0,0,12,8,4,4, 1,10,2,2,1,14,1,12,1,6,2,10,8,16,1,6, 3,8,1,14,1,14,1,10,1,6,1,6,2,4,3,8, 2,10,1,2,1,14,1,12,1,6,2,4,1,8,2,6, @@ -991,7 +991,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 65,76,95,77,65,67,72,73,78,69,41,2,218,3,99,108, 115,114,7,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,14,95,111,112,101,110,95,114,101,103, - 105,115,116,114,121,206,2,0,0,115,8,0,0,0,0,2, + 105,115,116,114,121,207,2,0,0,115,8,0,0,0,0,2, 2,1,16,1,12,1,122,36,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,111, 112,101,110,95,114,101,103,105,115,116,114,121,99,2,0,0, @@ -1018,7 +1018,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 95,107,101,121,114,7,0,0,0,90,4,104,107,101,121,218, 8,102,105,108,101,112,97,116,104,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,16,95,115,101,97,114,99, - 104,95,114,101,103,105,115,116,114,121,213,2,0,0,115,24, + 104,95,114,101,103,105,115,116,114,121,214,2,0,0,115,24, 0,0,0,0,2,6,1,8,2,6,1,6,1,16,255,6, 2,2,1,12,1,46,1,12,1,8,1,122,38,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, @@ -1040,7 +1040,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,44,0,0,0,218,6,116,97,114,103,101,116, 114,199,0,0,0,114,140,0,0,0,114,189,0,0,0,114, 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,9,102,105,110,100,95,115,112,101,99,228,2, + 0,0,0,218,9,102,105,110,100,95,115,112,101,99,229,2, 0,0,115,28,0,0,0,0,2,10,1,8,1,4,1,2, 1,12,1,12,1,8,1,14,1,14,1,6,1,8,1,2, 254,6,3,122,31,87,105,110,100,111,119,115,82,101,103,105, @@ -1059,7 +1059,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 78,169,2,114,203,0,0,0,114,140,0,0,0,169,4,114, 193,0,0,0,114,139,0,0,0,114,44,0,0,0,114,187, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,11,102,105,110,100,95,109,111,100,117,108,101,244, + 0,0,218,11,102,105,110,100,95,109,111,100,117,108,101,245, 2,0,0,115,8,0,0,0,0,7,12,1,8,1,6,2, 122,33,87,105,110,100,111,119,115,82,101,103,105,115,116,114, 121,70,105,110,100,101,114,46,102,105,110,100,95,109,111,100, @@ -1069,7 +1069,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 11,99,108,97,115,115,109,101,116,104,111,100,114,194,0,0, 0,114,200,0,0,0,114,203,0,0,0,114,206,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,191,0,0,0,194,2,0,0,115,28,0, + 8,0,0,0,114,191,0,0,0,195,2,0,0,115,28,0, 0,0,8,2,4,3,2,255,2,4,2,255,2,3,4,2, 2,1,10,6,2,1,10,14,2,1,12,15,2,1,114,191, 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1105,7 +1105,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,139,0,0,0,114,96,0,0,0,90,13,102,105,108, 101,110,97,109,101,95,98,97,115,101,90,9,116,97,105,108, 95,110,97,109,101,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,182,0,0,0,7,3,0,0,115,8,0, + 8,0,0,0,114,182,0,0,0,8,3,0,0,115,8,0, 0,0,0,3,18,1,16,1,14,1,122,24,95,76,111,97, 100,101,114,66,97,115,105,99,115,46,105,115,95,112,97,99, 107,97,103,101,99,2,0,0,0,0,0,0,0,0,0,0, @@ -1116,7 +1116,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 105,111,110,46,78,114,5,0,0,0,169,2,114,118,0,0, 0,114,187,0,0,0,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,13,99,114,101,97,116,101,95,109,111, - 100,117,108,101,15,3,0,0,115,2,0,0,0,0,1,122, + 100,117,108,101,16,3,0,0,115,2,0,0,0,0,1,122, 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,5,0,0, @@ -1136,7 +1136,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,114,131,0,0,0,41,3,114,118,0,0,0,218,6,109, 111,100,117,108,101,114,164,0,0,0,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,11,101,120,101,99,95, - 109,111,100,117,108,101,18,3,0,0,115,12,0,0,0,0, + 109,111,100,117,108,101,19,3,0,0,115,12,0,0,0,0, 2,12,1,8,1,6,1,4,255,6,2,122,25,95,76,111, 97,100,101,114,66,97,115,105,99,115,46,101,120,101,99,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, @@ -1148,13 +1148,13 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,108,101,95,115,104,105,109,169,2,114,118,0,0,0,114, 139,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,108,111,97,100,95,109,111,100,117,108,101, - 26,3,0,0,115,2,0,0,0,0,2,122,25,95,76,111, + 27,3,0,0,115,2,0,0,0,0,2,122,25,95,76,111, 97,100,101,114,66,97,115,105,99,115,46,108,111,97,100,95, 109,111,100,117,108,101,78,41,8,114,125,0,0,0,114,124, 0,0,0,114,126,0,0,0,114,127,0,0,0,114,182,0, 0,0,114,212,0,0,0,114,217,0,0,0,114,220,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,208,0,0,0,2,3,0,0,115,10, + 114,8,0,0,0,114,208,0,0,0,3,3,0,0,115,10, 0,0,0,8,2,4,3,8,8,8,3,8,8,114,208,0, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,3,0,0,0,64,0,0,0,115,74,0,0,0, @@ -1179,7 +1179,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 10,32,32,32,32,32,32,32,32,78,41,1,114,50,0,0, 0,169,2,114,118,0,0,0,114,44,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,218,10,112,97, - 116,104,95,109,116,105,109,101,33,3,0,0,115,2,0,0, + 116,104,95,109,116,105,109,101,34,3,0,0,115,2,0,0, 0,0,6,122,23,83,111,117,114,99,101,76,111,97,100,101, 114,46,112,97,116,104,95,109,116,105,109,101,99,2,0,0, 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, @@ -1213,7 +1213,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,100,46,10,32,32,32,32,32,32,32,32,114,169,0, 0,0,41,1,114,223,0,0,0,114,222,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,10,112, - 97,116,104,95,115,116,97,116,115,41,3,0,0,115,2,0, + 97,116,104,95,115,116,97,116,115,42,3,0,0,115,2,0, 0,0,0,12,122,23,83,111,117,114,99,101,76,111,97,100, 101,114,46,112,97,116,104,95,115,116,97,116,115,99,4,0, 0,0,0,0,0,0,0,0,0,0,4,0,0,0,4,0, @@ -1237,7 +1237,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,107,0,0,0,90,10,99,97,99,104,101,95,112, 97,116,104,114,26,0,0,0,114,5,0,0,0,114,5,0, 0,0,114,8,0,0,0,218,15,95,99,97,99,104,101,95, - 98,121,116,101,99,111,100,101,55,3,0,0,115,2,0,0, + 98,121,116,101,99,111,100,101,56,3,0,0,115,2,0,0, 0,0,8,122,28,83,111,117,114,99,101,76,111,97,100,101, 114,46,95,99,97,99,104,101,95,98,121,116,101,99,111,100, 101,99,3,0,0,0,0,0,0,0,0,0,0,0,3,0, @@ -1254,7 +1254,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 108,101,115,46,10,32,32,32,32,32,32,32,32,78,114,5, 0,0,0,41,3,114,118,0,0,0,114,44,0,0,0,114, 26,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,225,0,0,0,65,3,0,0,115,2,0,0, + 0,0,0,114,225,0,0,0,66,3,0,0,115,2,0,0, 0,0,1,122,21,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,101,116,95,100,97,116,97,99,2,0,0,0,0, 0,0,0,0,0,0,0,5,0,0,0,10,0,0,0,67, @@ -1275,7 +1275,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,41,5,114,118,0,0,0,114,139,0,0,0,114, 44,0,0,0,114,174,0,0,0,218,3,101,120,99,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,218,10,103, - 101,116,95,115,111,117,114,99,101,72,3,0,0,115,20,0, + 101,116,95,115,111,117,114,99,101,73,3,0,0,115,20,0, 0,0,0,2,10,1,2,1,14,1,14,1,4,1,2,255, 4,1,2,255,24,2,122,23,83,111,117,114,99,101,76,111, 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,114, @@ -1298,7 +1298,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,26,0,0,0,114,44,0,0,0,114,230,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, 218,14,115,111,117,114,99,101,95,116,111,95,99,111,100,101, - 82,3,0,0,115,6,0,0,0,0,5,12,1,4,255,122, + 83,3,0,0,115,6,0,0,0,0,5,12,1,4,255,122, 27,83,111,117,114,99,101,76,111,97,100,101,114,46,115,111, 117,114,99,101,95,116,111,95,99,111,100,101,99,2,0,0, 0,0,0,0,0,0,0,0,0,15,0,0,0,9,0,0, @@ -1374,7 +1374,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,116,114,26,0,0,0,114,151,0,0,0,114,2,0,0, 0,90,10,98,121,116,101,115,95,100,97,116,97,90,11,99, 111,100,101,95,111,98,106,101,99,116,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,213,0,0,0,90,3, + 5,0,0,0,114,8,0,0,0,114,213,0,0,0,91,3, 0,0,115,152,0,0,0,0,7,10,1,4,1,4,1,4, 1,4,1,4,1,2,1,12,1,12,1,12,2,2,1,14, 1,12,1,8,2,12,1,2,1,14,1,12,1,6,3,2, @@ -1391,7 +1391,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,114,226,0,0,0,114,225,0,0,0,114,229,0,0, 0,114,233,0,0,0,114,213,0,0,0,114,5,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 221,0,0,0,31,3,0,0,115,14,0,0,0,8,2,8, + 221,0,0,0,32,3,0,0,115,14,0,0,0,8,2,8, 8,8,14,8,10,8,7,8,10,14,8,114,221,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,4,0,0,0,0,0,0,0,115,92,0,0,0,101,0, @@ -1418,7 +1418,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 32,32,32,32,32,32,32,102,105,110,100,101,114,46,78,114, 159,0,0,0,41,3,114,118,0,0,0,114,139,0,0,0, 114,44,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,180,3,0,0,115,4,0, + 8,0,0,0,114,209,0,0,0,181,3,0,0,115,4,0, 0,0,0,3,6,1,122,19,70,105,108,101,76,111,97,100, 101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, @@ -1427,7 +1427,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,109,0,0,0,169,2,218,9,95,95,99,108,97,115, 115,95,95,114,131,0,0,0,169,2,114,118,0,0,0,90, 5,111,116,104,101,114,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,218,6,95,95,101,113,95,95,186,3,0, + 114,8,0,0,0,218,6,95,95,101,113,95,95,187,3,0, 0,115,6,0,0,0,0,1,12,1,10,255,122,17,70,105, 108,101,76,111,97,100,101,114,46,95,95,101,113,95,95,99, 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, @@ -1436,7 +1436,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,109,0,0,0,169,3,218,4,104,97,115,104,114,116, 0,0,0,114,44,0,0,0,169,1,114,118,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,8, - 95,95,104,97,115,104,95,95,190,3,0,0,115,2,0,0, + 95,95,104,97,115,104,95,95,191,3,0,0,115,2,0,0, 0,0,1,122,19,70,105,108,101,76,111,97,100,101,114,46, 95,95,104,97,115,104,95,95,99,2,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,3,0,0,0,3,0,0, @@ -1450,7 +1450,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,97,100,46,10,10,32,32,32,32,32,32,32,32,41,3, 218,5,115,117,112,101,114,114,239,0,0,0,114,220,0,0, 0,114,219,0,0,0,169,1,114,241,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,220,0,0,0,193,3,0,0, + 0,0,114,8,0,0,0,114,220,0,0,0,194,3,0,0, 115,2,0,0,0,0,10,122,22,70,105,108,101,76,111,97, 100,101,114,46,108,111,97,100,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, @@ -1460,7 +1460,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,114,99,101,32,102,105,108,101,32,97,115,32,102,111,117, 110,100,32,98,121,32,116,104,101,32,102,105,110,100,101,114, 46,114,48,0,0,0,114,219,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,179,0,0,0,205, + 114,5,0,0,0,114,8,0,0,0,114,179,0,0,0,206, 3,0,0,115,2,0,0,0,0,3,122,23,70,105,108,101, 76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,110, 97,109,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -1482,7 +1482,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 84,0,0,0,90,4,114,101,97,100,114,65,0,0,0,41, 3,114,118,0,0,0,114,44,0,0,0,114,68,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 227,0,0,0,210,3,0,0,115,10,0,0,0,0,2,14, + 227,0,0,0,211,3,0,0,115,10,0,0,0,0,2,14, 1,16,1,40,2,14,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,103,101,116,95,100,97,116,97,99,2,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0, @@ -1494,7 +1494,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,114,216,0,0,0,114,253,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,19, 103,101,116,95,114,101,115,111,117,114,99,101,95,114,101,97, - 100,101,114,219,3,0,0,115,4,0,0,0,0,2,12,1, + 100,101,114,220,3,0,0,115,4,0,0,0,0,2,12,1, 122,30,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,114,101,115,111,117,114,99,101,95,114,101,97,100,101,114, 41,13,114,125,0,0,0,114,124,0,0,0,114,126,0,0, @@ -1503,7 +1503,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 179,0,0,0,114,227,0,0,0,114,254,0,0,0,90,13, 95,95,99,108,97,115,115,99,101,108,108,95,95,114,5,0, 0,0,114,5,0,0,0,114,249,0,0,0,114,8,0,0, - 0,114,239,0,0,0,175,3,0,0,115,22,0,0,0,8, + 0,114,239,0,0,0,176,3,0,0,115,22,0,0,0,8, 2,4,3,8,6,8,4,8,3,2,1,14,11,2,1,10, 4,8,9,2,1,114,239,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, @@ -1525,7 +1525,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 3,114,49,0,0,0,218,8,115,116,95,109,116,105,109,101, 90,7,115,116,95,115,105,122,101,41,3,114,118,0,0,0, 114,44,0,0,0,114,238,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,224,0,0,0,229,3, + 5,0,0,0,114,8,0,0,0,114,224,0,0,0,230,3, 0,0,115,4,0,0,0,0,2,8,1,122,27,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,112,97, 116,104,95,115,116,97,116,115,99,4,0,0,0,0,0,0, @@ -1536,7 +1536,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,225,0,0,0,41,5,114,118,0,0,0,114,107,0, 0,0,114,106,0,0,0,114,26,0,0,0,114,52,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 114,226,0,0,0,234,3,0,0,115,4,0,0,0,0,2, + 114,226,0,0,0,235,3,0,0,115,4,0,0,0,0,2, 8,1,122,32,83,111,117,114,99,101,70,105,108,101,76,111, 97,100,101,114,46,95,99,97,99,104,101,95,98,121,116,101, 99,111,100,101,114,60,0,0,0,114,1,1,0,0,99,3, @@ -1571,7 +1571,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,218,6,112,97,114,101,110,116,114,96,0,0,0,114,37, 0,0,0,114,33,0,0,0,114,228,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,225,0,0, - 0,239,3,0,0,115,46,0,0,0,0,2,12,1,4,2, + 0,240,3,0,0,115,46,0,0,0,0,2,12,1,4,2, 12,1,12,1,12,2,12,1,10,1,2,1,14,1,12,2, 8,1,14,3,6,1,4,255,4,2,26,1,2,1,12,1, 16,1,14,2,8,1,2,255,122,25,83,111,117,114,99,101, @@ -1580,7 +1580,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,126,0,0,0,114,127,0,0,0,114,224,0,0,0,114, 226,0,0,0,114,225,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,255,0, - 0,0,225,3,0,0,115,8,0,0,0,8,2,4,2,8, + 0,0,226,3,0,0,115,8,0,0,0,8,2,4,2,8, 5,8,5,114,255,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0, 0,115,32,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1602,7 +1602,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,41,5,114,118,0,0,0,114,139,0,0,0,114, 44,0,0,0,114,26,0,0,0,114,151,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,213,0, - 0,0,18,4,0,0,115,22,0,0,0,0,1,10,1,10, + 0,0,19,4,0,0,115,22,0,0,0,0,1,10,1,10, 4,2,1,2,254,6,4,12,1,2,1,14,1,2,1,2, 253,122,29,83,111,117,114,99,101,108,101,115,115,70,105,108, 101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101, @@ -1612,14 +1612,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,32,97,115,32,116,104,101,114,101,32,105,115,32,110,111, 32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,5, 0,0,0,114,219,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,229,0,0,0,34,4,0,0, + 0,0,114,8,0,0,0,114,229,0,0,0,35,4,0,0, 115,2,0,0,0,0,2,122,31,83,111,117,114,99,101,108, 101,115,115,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,115,111,117,114,99,101,78,41,6,114,125,0,0,0, 114,124,0,0,0,114,126,0,0,0,114,127,0,0,0,114, 213,0,0,0,114,229,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,5,1, - 0,0,14,4,0,0,115,6,0,0,0,8,2,4,2,8, + 0,0,15,4,0,0,115,6,0,0,0,8,2,4,2,8, 16,114,5,1,0,0,99,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, 92,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, @@ -1640,7 +1640,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,0,83,0,114,109,0,0,0,114,159,0,0,0,41,3, 114,118,0,0,0,114,116,0,0,0,114,44,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,209, - 0,0,0,51,4,0,0,115,4,0,0,0,0,1,6,1, + 0,0,0,52,4,0,0,115,4,0,0,0,0,1,6,1, 122,28,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2, @@ -1648,7 +1648,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,1,106,0,107,2,111,22,124,0,106,1,124,1,106,1, 107,2,83,0,114,109,0,0,0,114,240,0,0,0,114,242, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,243,0,0,0,55,4,0,0,115,6,0,0,0, + 0,0,114,243,0,0,0,56,4,0,0,115,6,0,0,0, 0,1,12,1,10,255,122,26,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,101,113, 95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1, @@ -1656,7 +1656,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,0,124,0,106,1,131,1,116,0,124,0,106,2,131,1, 65,0,83,0,114,109,0,0,0,114,244,0,0,0,114,246, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,247,0,0,0,59,4,0,0,115,2,0,0,0, + 0,0,114,247,0,0,0,60,4,0,0,115,2,0,0,0, 0,1,122,28,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0, @@ -1673,7 +1673,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,97,109,105,99,114,149,0,0,0,114,116,0,0,0,114, 44,0,0,0,41,3,114,118,0,0,0,114,187,0,0,0, 114,216,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,212,0,0,0,62,4,0,0,115,14,0, + 8,0,0,0,114,212,0,0,0,63,4,0,0,115,14,0, 0,0,0,2,4,1,6,255,4,2,6,1,8,255,4,2, 122,33,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,99,114,101,97,116,101,95,109,111,100, @@ -1691,7 +1691,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,114,149,0,0,0,114,116,0,0,0,114,44,0,0,0, 169,2,114,118,0,0,0,114,216,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,217,0,0,0, - 70,4,0,0,115,8,0,0,0,0,2,14,1,6,1,8, + 71,4,0,0,115,8,0,0,0,0,2,14,1,6,1,8, 255,122,31,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,101,120,101,99,95,109,111,100,117, 108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1709,7 +1709,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,169,2,114,32,0,0,0,218,6,115,117,102,102, 105,120,169,1,90,9,102,105,108,101,95,110,97,109,101,114, 5,0,0,0,114,8,0,0,0,218,9,60,103,101,110,101, - 120,112,114,62,79,4,0,0,115,4,0,0,0,4,1,2, + 120,112,114,62,80,4,0,0,115,4,0,0,0,4,1,2, 255,122,49,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,105,115,95,112,97,99,107,97,103, 101,46,60,108,111,99,97,108,115,62,46,60,103,101,110,101, @@ -1717,7 +1717,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 218,3,97,110,121,218,18,69,88,84,69,78,83,73,79,78, 95,83,85,70,70,73,88,69,83,114,219,0,0,0,114,5, 0,0,0,114,9,1,0,0,114,8,0,0,0,114,182,0, - 0,0,76,4,0,0,115,8,0,0,0,0,2,14,1,12, + 0,0,77,4,0,0,115,8,0,0,0,0,2,14,1,12, 1,2,255,122,30,69,120,116,101,110,115,105,111,110,70,105, 108,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, 97,103,101,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -1728,7 +1728,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,116,32,99,114,101,97,116,101,32,97,32,99,111,100,101, 32,111,98,106,101,99,116,46,78,114,5,0,0,0,114,219, 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,213,0,0,0,82,4,0,0,115,2,0,0,0, + 0,0,114,213,0,0,0,83,4,0,0,115,2,0,0,0, 0,2,122,28,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1738,14 +1738,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 111,100,117,108,101,115,32,104,97,118,101,32,110,111,32,115, 111,117,114,99,101,32,99,111,100,101,46,78,114,5,0,0, 0,114,219,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,229,0,0,0,86,4,0,0,115,2, + 114,8,0,0,0,114,229,0,0,0,87,4,0,0,115,2, 0,0,0,0,2,122,30,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,115, 111,117,114,99,101,99,2,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,6, 0,0,0,124,0,106,0,83,0,114,250,0,0,0,114,48, 0,0,0,114,219,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,179,0,0,0,90,4,0,0, + 0,0,114,8,0,0,0,114,179,0,0,0,91,4,0,0, 115,2,0,0,0,0,3,122,32,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,102,105,108,101,110,97,109,101,78,41,14,114,125,0,0, @@ -1754,7 +1754,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 212,0,0,0,114,217,0,0,0,114,182,0,0,0,114,213, 0,0,0,114,229,0,0,0,114,136,0,0,0,114,179,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,252,0,0,0,43,4,0,0,115, + 0,114,8,0,0,0,114,252,0,0,0,44,4,0,0,115, 22,0,0,0,8,2,4,6,8,4,8,4,8,3,8,8, 8,6,8,6,8,4,8,4,2,1,114,252,0,0,0,99, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1797,7 +1797,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,169,4,114,118,0,0,0,114,116,0,0,0,114,44,0, 0,0,90,11,112,97,116,104,95,102,105,110,100,101,114,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,209, - 0,0,0,103,4,0,0,115,8,0,0,0,0,1,6,1, + 0,0,0,104,4,0,0,115,8,0,0,0,0,1,6,1, 6,1,14,1,122,23,95,78,97,109,101,115,112,97,99,101, 80,97,116,104,46,95,95,105,110,105,116,95,95,99,1,0, 0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,0, @@ -1814,7 +1814,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 4,114,118,0,0,0,114,4,1,0,0,218,3,100,111,116, 90,2,109,101,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,23,95,102,105,110,100,95,112,97,114,101,110, - 116,95,112,97,116,104,95,110,97,109,101,115,109,4,0,0, + 116,95,112,97,116,104,95,110,97,109,101,115,110,4,0,0, 115,8,0,0,0,0,2,18,1,8,2,4,3,122,38,95, 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,102, 105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,95, @@ -1827,7 +1827,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,118,0,0,0,90,18,112,97,114,101,110,116,95,109,111, 100,117,108,101,95,110,97,109,101,90,14,112,97,116,104,95, 97,116,116,114,95,110,97,109,101,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,16,1,0,0,119,4,0, + 0,0,0,114,8,0,0,0,114,16,1,0,0,120,4,0, 0,115,4,0,0,0,0,1,12,1,122,31,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,103,101,116,95, 112,97,114,101,110,116,95,112,97,116,104,99,1,0,0,0, @@ -1843,7 +1843,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,15,1,0,0,41,3,114,118,0,0,0,90, 11,112,97,114,101,110,116,95,112,97,116,104,114,187,0,0, 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,12,95,114,101,99,97,108,99,117,108,97,116,101,123,4, + 218,12,95,114,101,99,97,108,99,117,108,97,116,101,124,4, 0,0,115,16,0,0,0,0,2,12,1,10,1,14,3,18, 1,6,1,8,1,6,1,122,27,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,114,101,99,97,108,99,117, @@ -1852,7 +1852,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,116,0,124,0,160,1,161,0,131,1,83,0,114,109, 0,0,0,41,2,218,4,105,116,101,114,114,23,1,0,0, 114,246,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,95,105,116,101,114,95,95,136,4, + 8,0,0,0,218,8,95,95,105,116,101,114,95,95,137,4, 0,0,115,2,0,0,0,0,1,122,23,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,95,105,116,101,114, 95,95,99,2,0,0,0,0,0,0,0,0,0,0,0,2, @@ -1861,7 +1861,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,169,1,114,23,1,0,0,41,2,114,118,0,0,0,218, 5,105,110,100,101,120,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,95,103,101,116,105,116,101,109, - 95,95,139,4,0,0,115,2,0,0,0,0,1,122,26,95, + 95,95,140,4,0,0,115,2,0,0,0,0,1,122,26,95, 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,95, 103,101,116,105,116,101,109,95,95,99,3,0,0,0,0,0, 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, @@ -1869,7 +1869,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,100,0,83,0,114,109,0,0,0,41,1,114,15,1,0, 0,41,3,114,118,0,0,0,114,27,1,0,0,114,44,0, 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,11,95,95,115,101,116,105,116,101,109,95,95,142,4, + 0,218,11,95,95,115,101,116,105,116,101,109,95,95,143,4, 0,0,115,2,0,0,0,0,1,122,26,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,95,115,101,116,105, 116,101,109,95,95,99,1,0,0,0,0,0,0,0,0,0, @@ -1877,7 +1877,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,116,0,124,0,160,1,161,0,131,1,83,0,114, 109,0,0,0,41,2,114,23,0,0,0,114,23,1,0,0, 114,246,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,7,95,95,108,101,110,95,95,145,4,0, + 8,0,0,0,218,7,95,95,108,101,110,95,95,146,4,0, 0,115,2,0,0,0,0,1,122,22,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,108,101,110,95,95, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, @@ -1886,7 +1886,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 78,97,109,101,115,112,97,99,101,80,97,116,104,40,123,33, 114,125,41,41,2,114,62,0,0,0,114,15,1,0,0,114, 246,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,8,95,95,114,101,112,114,95,95,148,4,0, + 0,0,0,218,8,95,95,114,101,112,114,95,95,149,4,0, 0,115,2,0,0,0,0,1,122,23,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,114,101,112,114,95, 95,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, @@ -1894,7 +1894,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 1,124,0,160,0,161,0,118,0,83,0,114,109,0,0,0, 114,26,1,0,0,169,2,114,118,0,0,0,218,4,105,116, 101,109,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,12,95,95,99,111,110,116,97,105,110,115,95,95,151, + 0,218,12,95,95,99,111,110,116,97,105,110,115,95,95,152, 4,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,95,99,111,110, 116,97,105,110,115,95,95,99,2,0,0,0,0,0,0,0, @@ -1902,7 +1902,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 115,16,0,0,0,124,0,106,0,160,1,124,1,161,1,1, 0,100,0,83,0,114,109,0,0,0,41,2,114,15,1,0, 0,114,186,0,0,0,114,32,1,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,186,0,0,0,154, + 114,5,0,0,0,114,8,0,0,0,114,186,0,0,0,155, 4,0,0,115,2,0,0,0,0,1,122,21,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,97,112,112,101,110, 100,78,41,15,114,125,0,0,0,114,124,0,0,0,114,126, @@ -1911,7 +1911,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,28,1,0,0,114,29,1,0,0,114,30,1,0,0, 114,31,1,0,0,114,34,1,0,0,114,186,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,13,1,0,0,96,4,0,0,115,24,0,0, + 0,0,0,114,13,1,0,0,97,4,0,0,115,24,0,0, 0,8,1,4,6,8,6,8,10,8,4,8,13,8,3,8, 3,8,3,8,3,8,3,8,3,114,13,1,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3, @@ -1927,7 +1927,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,1,124,2,124,3,131,3,124,0,95,1,100,0,83,0, 114,109,0,0,0,41,2,114,13,1,0,0,114,15,1,0, 0,114,19,1,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,209,0,0,0,160,4,0,0,115,2, + 114,8,0,0,0,114,209,0,0,0,161,4,0,0,115,2, 0,0,0,0,1,122,25,95,78,97,109,101,115,112,97,99, 101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, @@ -1945,20 +1945,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,125,0,0,0,41,2,114,193,0,0,0,114, 216,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, 0,0,0,218,11,109,111,100,117,108,101,95,114,101,112,114, - 163,4,0,0,115,2,0,0,0,0,7,122,28,95,78,97, + 164,4,0,0,115,2,0,0,0,0,7,122,28,95,78,97, 109,101,115,112,97,99,101,76,111,97,100,101,114,46,109,111, 100,117,108,101,95,114,101,112,114,99,2,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, 0,0,115,4,0,0,0,100,1,83,0,41,2,78,84,114, 5,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,182,0,0,0,172,4,0, + 0,0,0,114,8,0,0,0,114,182,0,0,0,173,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,76,111,97,100,101,114,46,105,115,95,112,97, 99,107,97,103,101,99,2,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, 0,0,0,100,1,83,0,41,2,78,114,40,0,0,0,114, 5,0,0,0,114,219,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,229,0,0,0,175,4,0, + 0,0,0,114,8,0,0,0,114,229,0,0,0,176,4,0, 0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,115, 112,97,99,101,76,111,97,100,101,114,46,103,101,116,95,115, 111,117,114,99,101,99,2,0,0,0,0,0,0,0,0,0, @@ -1968,20 +1968,20 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,105,110,103,62,114,215,0,0,0,84,41,1,114,231,0, 0,0,41,1,114,232,0,0,0,114,219,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,213,0, - 0,0,178,4,0,0,115,2,0,0,0,0,1,122,25,95, + 0,0,179,4,0,0,115,2,0,0,0,0,1,122,25,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, 0,115,4,0,0,0,100,1,83,0,114,210,0,0,0,114, 5,0,0,0,114,211,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,212,0,0,0,181,4,0, + 0,0,0,114,8,0,0,0,114,212,0,0,0,182,4,0, 0,115,2,0,0,0,0,1,122,30,95,78,97,109,101,115, 112,97,99,101,76,111,97,100,101,114,46,99,114,101,97,116, 101,95,109,111,100,117,108,101,99,2,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, 0,115,4,0,0,0,100,0,83,0,114,109,0,0,0,114, 5,0,0,0,114,6,1,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,217,0,0,0,184,4,0, + 0,0,0,114,8,0,0,0,114,217,0,0,0,185,4,0, 0,115,2,0,0,0,0,1,122,28,95,78,97,109,101,115, 112,97,99,101,76,111,97,100,101,114,46,101,120,101,99,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, @@ -1999,7 +1999,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 116,104,32,112,97,116,104,32,123,33,114,125,41,4,114,134, 0,0,0,114,149,0,0,0,114,15,1,0,0,114,218,0, 0,0,114,219,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,220,0,0,0,187,4,0,0,115, + 0,114,8,0,0,0,114,220,0,0,0,188,4,0,0,115, 8,0,0,0,0,7,6,1,4,255,4,2,122,28,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,108, 111,97,100,95,109,111,100,117,108,101,78,41,12,114,125,0, @@ -2008,7 +2008,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,229,0,0,0,114,213,0,0,0,114,212,0,0,0,114, 217,0,0,0,114,220,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,35,1, - 0,0,159,4,0,0,115,18,0,0,0,8,1,8,3,2, + 0,0,160,4,0,0,115,18,0,0,0,8,1,8,3,2, 1,10,8,8,3,8,3,8,3,8,3,8,3,114,35,1, 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,4,0,0,0,64,0,0,0,115,118,0,0,0, @@ -2045,7 +2045,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,128,0,0,0,114,38,1,0,0,41,3,114,193,0,0, 0,114,116,0,0,0,218,6,102,105,110,100,101,114,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,38,1, - 0,0,205,4,0,0,115,10,0,0,0,0,4,22,1,8, + 0,0,206,4,0,0,115,10,0,0,0,0,4,22,1,8, 1,10,1,10,1,122,28,80,97,116,104,70,105,110,100,101, 114,46,105,110,118,97,108,105,100,97,116,101,95,99,97,99, 104,101,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2065,7 +2065,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 117,0,0,0,41,3,114,193,0,0,0,114,44,0,0,0, 90,4,104,111,111,107,114,5,0,0,0,114,5,0,0,0, 114,8,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,215,4,0,0,115,16,0,0,0,0,3,16,1,12, + 107,115,216,4,0,0,115,16,0,0,0,0,3,16,1,12, 1,10,1,2,1,14,1,12,1,10,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,0,0,0,0, @@ -2096,7 +2096,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,114,111,114,114,44,1,0,0,41,3,114,193,0,0,0, 114,44,0,0,0,114,42,1,0,0,114,5,0,0,0,114, 5,0,0,0,114,8,0,0,0,218,20,95,112,97,116,104, - 95,105,109,112,111,114,116,101,114,95,99,97,99,104,101,228, + 95,105,109,112,111,114,116,101,114,95,99,97,99,104,101,229, 4,0,0,115,22,0,0,0,0,8,8,1,2,1,12,1, 12,3,8,1,2,1,14,1,12,1,10,1,16,1,122,31, 80,97,116,104,70,105,110,100,101,114,46,95,112,97,116,104, @@ -2114,7 +2114,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,139,0,0,0,114,42,1,0,0,114,140,0, 0,0,114,141,0,0,0,114,187,0,0,0,114,5,0,0, 0,114,5,0,0,0,114,8,0,0,0,218,16,95,108,101, - 103,97,99,121,95,103,101,116,95,115,112,101,99,250,4,0, + 103,97,99,121,95,103,101,116,95,115,112,101,99,251,4,0, 0,115,18,0,0,0,0,4,10,1,16,2,10,1,4,1, 8,1,12,1,12,1,6,1,122,27,80,97,116,104,70,105, 110,100,101,114,46,95,108,101,103,97,99,121,95,103,101,116, @@ -2146,7 +2146,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 97,116,104,90,5,101,110,116,114,121,114,42,1,0,0,114, 187,0,0,0,114,141,0,0,0,114,5,0,0,0,114,5, 0,0,0,114,8,0,0,0,218,9,95,103,101,116,95,115, - 112,101,99,9,5,0,0,115,40,0,0,0,0,5,4,1, + 112,101,99,10,5,0,0,115,40,0,0,0,0,5,4,1, 8,1,14,1,2,1,10,1,8,1,10,1,14,2,12,1, 8,1,2,1,10,1,8,1,6,1,8,1,8,5,12,2, 12,1,6,1,122,20,80,97,116,104,70,105,110,100,101,114, @@ -2173,7 +2173,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 193,0,0,0,114,139,0,0,0,114,44,0,0,0,114,202, 0,0,0,114,187,0,0,0,114,50,1,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,203,0,0, - 0,41,5,0,0,115,26,0,0,0,0,6,8,1,6,1, + 0,42,5,0,0,115,26,0,0,0,0,6,8,1,6,1, 14,1,8,1,4,1,10,1,6,1,4,3,6,1,16,1, 4,2,4,2,122,20,80,97,116,104,70,105,110,100,101,114, 46,102,105,110,100,95,115,112,101,99,99,3,0,0,0,0, @@ -2193,7 +2193,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32, 32,32,32,32,78,114,204,0,0,0,114,205,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,206, - 0,0,0,65,5,0,0,115,8,0,0,0,0,8,12,1, + 0,0,0,66,5,0,0,115,8,0,0,0,0,8,12,1, 8,1,4,1,122,22,80,97,116,104,70,105,110,100,101,114, 46,102,105,110,100,95,109,111,100,117,108,101,99,1,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0, @@ -2225,7 +2225,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 98,117,116,105,111,110,115,41,4,114,193,0,0,0,114,119, 0,0,0,114,120,0,0,0,114,52,1,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,53,1,0, - 0,78,5,0,0,115,4,0,0,0,0,10,12,1,122,29, + 0,79,5,0,0,115,4,0,0,0,0,10,12,1,122,29, 80,97,116,104,70,105,110,100,101,114,46,102,105,110,100,95, 100,105,115,116,114,105,98,117,116,105,111,110,115,41,1,78, 41,2,78,78,41,1,78,41,13,114,125,0,0,0,114,124, @@ -2234,7 +2234,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,48,1,0,0,114,51,1,0,0,114,203,0,0,0, 114,206,0,0,0,114,53,1,0,0,114,5,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,37, - 1,0,0,201,4,0,0,115,34,0,0,0,8,2,4,2, + 1,0,0,202,4,0,0,115,34,0,0,0,8,2,4,2, 2,1,10,9,2,1,10,12,2,1,10,21,2,1,10,14, 2,1,12,31,2,1,12,23,2,1,12,12,2,1,114,37, 1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, @@ -2279,7 +2279,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 2,86,0,1,0,113,2,100,0,83,0,114,109,0,0,0, 114,5,0,0,0,114,7,1,0,0,169,1,114,140,0,0, 0,114,5,0,0,0,114,8,0,0,0,114,10,1,0,0, - 107,5,0,0,243,0,0,0,0,122,38,70,105,108,101,70, + 108,5,0,0,243,0,0,0,0,122,38,70,105,108,101,70, 105,110,100,101,114,46,95,95,105,110,105,116,95,95,46,60, 108,111,99,97,108,115,62,46,60,103,101,110,101,120,112,114, 62,114,71,0,0,0,114,104,0,0,0,78,41,7,114,167, @@ -2291,7 +2291,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,218,14,108,111,97,100,101,114,95,100,101,116,97,105, 108,115,90,7,108,111,97,100,101,114,115,114,189,0,0,0, 114,5,0,0,0,114,55,1,0,0,114,8,0,0,0,114, - 209,0,0,0,101,5,0,0,115,16,0,0,0,0,4,4, + 209,0,0,0,102,5,0,0,115,16,0,0,0,0,4,4, 1,12,1,26,1,6,2,10,1,6,1,8,1,122,19,70, 105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116, 95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1, @@ -2301,7 +2301,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 101,99,116,111,114,121,32,109,116,105,109,101,46,114,104,0, 0,0,78,41,1,114,58,1,0,0,114,246,0,0,0,114, 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,38, - 1,0,0,115,5,0,0,115,2,0,0,0,0,2,122,28, + 1,0,0,116,5,0,0,115,2,0,0,0,0,2,122,28, 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0, @@ -2324,7 +2324,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,203,0,0,0,114,140,0,0,0,114,178,0,0,0,41, 3,114,118,0,0,0,114,139,0,0,0,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 137,0,0,0,121,5,0,0,115,8,0,0,0,0,7,10, + 137,0,0,0,122,5,0,0,115,8,0,0,0,0,7,10, 1,8,1,8,1,122,22,70,105,108,101,70,105,110,100,101, 114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0, 0,0,0,0,0,0,0,0,0,0,7,0,0,0,6,0, @@ -2334,7 +2334,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 190,0,0,0,41,7,114,118,0,0,0,114,188,0,0,0, 114,139,0,0,0,114,44,0,0,0,90,4,115,109,115,108, 114,202,0,0,0,114,140,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,51,1,0,0,133,5, + 5,0,0,0,114,8,0,0,0,114,51,1,0,0,134,5, 0,0,115,8,0,0,0,0,1,10,1,8,1,2,255,122, 20,70,105,108,101,70,105,110,100,101,114,46,95,103,101,116, 95,115,112,101,99,78,99,3,0,0,0,0,0,0,0,0, @@ -2389,7 +2389,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 13,105,110,105,116,95,102,105,108,101,110,97,109,101,90,9, 102,117,108,108,95,112,97,116,104,114,187,0,0,0,114,5, 0,0,0,114,5,0,0,0,114,8,0,0,0,114,203,0, - 0,0,138,5,0,0,115,72,0,0,0,0,5,4,1,14, + 0,0,139,5,0,0,115,72,0,0,0,0,5,4,1,14, 1,2,1,24,1,12,1,10,1,10,1,8,1,6,2,6, 1,6,1,10,2,6,1,4,2,8,1,12,1,14,1,8, 1,10,1,8,1,24,4,8,2,14,1,16,1,16,1,12, @@ -2420,7 +2420,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 124,1,160,0,161,0,146,2,113,4,83,0,114,5,0,0, 0,41,1,114,105,0,0,0,41,2,114,32,0,0,0,90, 2,102,110,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,9,60,115,101,116,99,111,109,112,62,215,5,0, + 0,0,218,9,60,115,101,116,99,111,109,112,62,216,5,0, 0,114,56,1,0,0,122,41,70,105,108,101,70,105,110,100, 101,114,46,95,102,105,108,108,95,99,97,99,104,101,46,60, 108,111,99,97,108,115,62,46,60,115,101,116,99,111,109,112, @@ -2437,7 +2437,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 120,95,99,111,110,116,101,110,116,115,114,33,1,0,0,114, 116,0,0,0,114,20,1,0,0,114,8,1,0,0,90,8, 110,101,119,95,110,97,109,101,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,63,1,0,0,186,5,0,0, + 0,0,114,8,0,0,0,114,63,1,0,0,187,5,0,0, 115,34,0,0,0,0,2,6,1,2,1,22,1,18,3,10, 3,12,1,12,7,6,1,8,1,16,1,4,1,18,2,4, 1,12,1,6,1,12,1,122,22,70,105,108,101,70,105,110, @@ -2476,14 +2476,14 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,169,2,114,193,0,0,0,114,62,1,0,0,114, 5,0,0,0,114,8,0,0,0,218,24,112,97,116,104,95, 104,111,111,107,95,102,111,114,95,70,105,108,101,70,105,110, - 100,101,114,227,5,0,0,115,6,0,0,0,0,2,8,1, + 100,101,114,228,5,0,0,115,6,0,0,0,0,2,8,1, 12,1,122,54,70,105,108,101,70,105,110,100,101,114,46,112, 97,116,104,95,104,111,111,107,46,60,108,111,99,97,108,115, 62,46,112,97,116,104,95,104,111,111,107,95,102,111,114,95, 70,105,108,101,70,105,110,100,101,114,114,5,0,0,0,41, 3,114,193,0,0,0,114,62,1,0,0,114,69,1,0,0, 114,5,0,0,0,114,68,1,0,0,114,8,0,0,0,218, - 9,112,97,116,104,95,104,111,111,107,217,5,0,0,115,4, + 9,112,97,116,104,95,104,111,111,107,218,5,0,0,115,4, 0,0,0,0,10,14,6,122,20,70,105,108,101,70,105,110, 100,101,114,46,112,97,116,104,95,104,111,111,107,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, @@ -2492,7 +2492,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 70,105,110,100,101,114,40,123,33,114,125,41,41,2,114,62, 0,0,0,114,44,0,0,0,114,246,0,0,0,114,5,0, 0,0,114,5,0,0,0,114,8,0,0,0,114,31,1,0, - 0,235,5,0,0,115,2,0,0,0,0,1,122,19,70,105, + 0,236,5,0,0,115,2,0,0,0,0,1,122,19,70,105, 108,101,70,105,110,100,101,114,46,95,95,114,101,112,114,95, 95,41,1,78,41,15,114,125,0,0,0,114,124,0,0,0, 114,126,0,0,0,114,127,0,0,0,114,209,0,0,0,114, @@ -2500,7 +2500,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,0,0,114,51,1,0,0,114,203,0,0,0,114,63,1, 0,0,114,207,0,0,0,114,70,1,0,0,114,31,1,0, 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,54,1,0,0,92,5,0,0,115,22, + 114,8,0,0,0,114,54,1,0,0,93,5,0,0,115,22, 0,0,0,8,2,4,7,8,14,8,4,4,2,8,12,8, 5,10,48,8,31,2,1,10,17,114,54,1,0,0,99,4, 0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,8, @@ -2523,7 +2523,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, 116,104,110,97,109,101,114,140,0,0,0,114,187,0,0,0, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,241, + 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,242, 5,0,0,115,34,0,0,0,0,2,10,1,10,1,4,1, 4,1,8,1,8,1,12,2,10,1,4,1,14,1,2,1, 8,1,8,1,8,1,12,1,12,2,114,75,1,0,0,99, @@ -2543,7 +2543,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 114,5,1,0,0,114,88,0,0,0,41,3,90,10,101,120, 116,101,110,115,105,111,110,115,90,6,115,111,117,114,99,101, 90,8,98,121,116,101,99,111,100,101,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,184,0,0,0,8,6, + 5,0,0,0,114,8,0,0,0,114,184,0,0,0,9,6, 0,0,115,8,0,0,0,0,5,12,1,8,1,8,1,114, 184,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, 0,10,0,0,0,9,0,0,0,67,0,0,0,115,130,1, @@ -2591,7 +2591,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,0,107,2,86,0,1,0,113,2,100,1,83,0,41,2, 114,39,0,0,0,78,41,1,114,23,0,0,0,41,2,114, 32,0,0,0,114,94,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,10,1,0,0,37,6,0, + 0,0,0,114,8,0,0,0,114,10,1,0,0,38,6,0, 0,114,56,1,0,0,122,25,95,115,101,116,117,112,46,60, 108,111,99,97,108,115,62,46,60,103,101,110,101,120,112,114, 62,114,73,0,0,0,122,30,105,109,112,111,114,116,108,105, @@ -2603,7 +2603,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,93,14,125,1,100,0,124,1,155,0,157,2,146,2,113, 4,83,0,41,1,114,74,0,0,0,114,5,0,0,0,41, 2,114,32,0,0,0,218,1,115,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,64,1,0,0,54,6,0, + 0,0,0,114,8,0,0,0,114,64,1,0,0,55,6,0, 0,114,56,1,0,0,122,25,95,115,101,116,117,112,46,60, 108,111,99,97,108,115,62,46,60,115,101,116,99,111,109,112, 62,41,3,114,64,0,0,0,114,75,0,0,0,114,160,0, @@ -2624,7 +2624,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 110,97,109,101,115,90,12,98,117,105,108,116,105,110,95,110, 97,109,101,90,14,98,117,105,108,116,105,110,95,109,111,100, 117,108,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,6,95,115,101,116,117,112,19,6,0,0,115,70, + 0,0,218,6,95,115,101,116,117,112,20,6,0,0,115,70, 0,0,0,0,8,4,1,6,1,6,2,10,3,22,1,12, 2,22,1,8,1,10,1,10,1,6,2,2,1,10,1,10, 1,12,1,10,2,8,2,12,1,12,1,18,1,22,3,8, @@ -2644,7 +2644,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 0,114,37,1,0,0,41,2,114,81,1,0,0,90,17,115, 117,112,112,111,114,116,101,100,95,108,111,97,100,101,114,115, 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 8,95,105,110,115,116,97,108,108,76,6,0,0,115,8,0, + 8,95,105,110,115,116,97,108,108,77,6,0,0,115,8,0, 0,0,0,2,8,1,6,1,20,1,114,84,1,0,0,41, 1,114,60,0,0,0,41,1,78,41,3,78,78,78,41,2, 114,73,0,0,0,114,73,0,0,0,41,1,84,41,1,78, @@ -2678,7 +2678,7 @@ const unsigned char _Py_M__importlib_bootstrap_external[] = { 100,117,108,101,62,1,0,0,0,115,126,0,0,0,4,22, 4,1,4,1,2,1,2,255,4,4,8,17,8,5,8,5, 8,6,8,6,8,12,8,10,8,9,8,5,8,7,8,9, - 10,22,10,127,0,22,16,1,12,2,4,1,4,2,6,2, + 10,22,10,127,0,23,16,1,12,2,4,1,4,2,6,2, 6,2,8,2,16,71,8,40,8,19,8,12,8,12,8,28, 8,17,8,33,8,28,8,24,10,13,10,10,10,11,8,14, 6,3,4,1,2,255,12,68,14,64,14,29,16,127,0,17, From 8bab3edb2ccbeeeeed34595af9121e5f3e190896 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 10 Dec 2020 13:27:06 -0800 Subject: [PATCH 199/218] Catch up with master --- .azure-pipelines/ci.yml | 2 +- .azure-pipelines/docs-steps.yml | 2 +- .azure-pipelines/pr.yml | 2 +- .github/workflows/build.yml | 37 +- .github/workflows/coverage.yml | 2 +- .github/workflows/doc.yml | 4 +- .travis.yml | 4 +- Doc/Makefile | 1 - Doc/c-api/structures.rst | 8 +- Doc/c-api/tuple.rst | 2 +- Doc/c-api/type.rst | 16 +- Doc/c-api/typeobj.rst | 8 + Doc/data/stable_abi.dat | 779 +++ Doc/howto/descriptor.rst | 637 +- Doc/library/abc.rst | 3 +- Doc/library/argparse.rst | 27 +- Doc/library/asyncio-eventloop.rst | 5 +- Doc/library/asyncio-policy.rst | 2 +- Doc/library/asyncio-queue.rst | 5 +- Doc/library/asyncio-stream.rst | 23 +- Doc/library/asyncio-subprocess.rst | 13 +- Doc/library/asyncio-sync.rst | 29 +- Doc/library/asyncio-task.rst | 34 +- Doc/library/bz2.rst | 8 - Doc/library/collections.abc.rst | 2 +- Doc/library/collections.rst | 3 + Doc/library/dis.rst | 16 +- Doc/library/filecmp.rst | 8 +- Doc/library/formatter.rst | 351 -- Doc/library/http.client.rst | 5 + Doc/library/imaplib.rst | 6 +- Doc/library/index.rst | 1 - Doc/library/itertools.rst | 33 +- Doc/library/misc.rst | 13 - Doc/library/mmap.rst | 2 + Doc/library/multiprocessing.rst | 8 +- Doc/library/os.rst | 129 + Doc/library/pathlib.rst | 2 + Doc/library/pipes.rst | 2 + Doc/library/platform.rst | 38 + Doc/library/signal.rst | 2 +- Doc/library/smtplib.rst | 4 +- Doc/library/socket.rst | 7 +- Doc/library/stdtypes.rst | 2 +- Doc/library/string.rst | 43 +- Doc/library/threading.rst | 7 + Doc/library/time.rst | 43 +- Doc/library/types.rst | 4 +- Doc/library/typing.rst | 11 +- Doc/library/unittest.rst | 3 +- Doc/library/urllib.request.rst | 5 + Doc/library/xml.dom.minidom.rst | 4 +- Doc/library/zipimport.rst | 46 +- Doc/reference/grammar.rst | 3 +- Doc/tools/extensions/c_annotations.py | 4 +- Doc/tools/extensions/pyspecific.py | 7 +- Doc/tutorial/datastructures.rst | 2 +- Doc/tutorial/inputoutput.rst | 15 +- Doc/using/windows.rst | 4 +- Doc/whatsnew/3.10.rst | 174 +- Doc/whatsnew/3.8.rst | 3 - Doc/whatsnew/3.9.rst | 33 +- Grammar/python.gram | 23 +- Include/bytesobject.h | 35 +- Include/cellobject.h | 2 +- Include/cpython/bytesobject.h | 2 +- Include/cpython/listobject.h | 2 +- Include/cpython/object.h | 4 +- Include/cpython/pystate.h | 3 +- Include/cpython/pythonrun.h | 122 + Include/cpython/tupleobject.h | 2 +- Include/internal/pycore_bitutils.h | 15 +- Include/internal/pycore_ceval.h | 16 - Include/internal/pycore_format.h | 27 + Include/internal/pycore_import.h | 2 +- Include/internal/pycore_pylifecycle.h | 3 +- Include/intrcheck.h | 1 - Include/object.h | 19 +- Include/objimpl.h | 10 +- Include/patchlevel.h | 4 +- Include/pymem.h | 34 +- Include/pyport.h | 12 + Include/pythonrun.h | 124 +- Include/pytime.h | 52 +- Lib/_collections_abc.py | 21 +- Lib/_osx_support.py | 38 +- Lib/ast.py | 110 +- Lib/asyncio/__init__.py | 4 - Lib/asyncio/base_events.py | 17 +- Lib/asyncio/events.py | 14 + Lib/asyncio/exceptions.py | 3 +- Lib/asyncio/futures.py | 2 +- Lib/asyncio/locks.py | 71 +- Lib/asyncio/mixins.py | 31 + Lib/asyncio/queues.py | 21 +- Lib/asyncio/runners.py | 3 +- Lib/asyncio/streams.py | 37 +- Lib/asyncio/subprocess.py | 30 +- Lib/asyncio/tasks.py | 81 +- Lib/asyncio/unix_events.py | 2 +- Lib/asyncore.py | 16 +- Lib/collections/__init__.py | 2 +- Lib/colorsys.py | 15 +- Lib/contextlib.py | 2 +- Lib/dis.py | 2 +- Lib/distutils/spawn.py | 4 +- Lib/distutils/tests/test_build_ext.py | 10 +- Lib/distutils/unixccompiler.py | 2 +- Lib/enum.py | 200 +- Lib/filecmp.py | 9 +- Lib/formatter.py | 452 -- Lib/http/client.py | 3 + Lib/http/server.py | 12 +- Lib/idlelib/NEWS.txt | 9 + Lib/idlelib/calltip.py | 6 +- Lib/idlelib/idle_test/test_calltip.py | 9 +- Lib/idlelib/idle_test/test_searchengine.py | 6 +- Lib/idlelib/pyshell.py | 6 +- Lib/idlelib/runscript.py | 26 +- Lib/idlelib/searchengine.py | 11 +- Lib/importlib/__init__.py | 2 +- Lib/importlib/_abc.py | 1 + Lib/importlib/_bootstrap.py | 43 +- Lib/importlib/_bootstrap_external.py | 142 +- Lib/importlib/abc.py | 1 - Lib/importlib/machinery.py | 2 - Lib/importlib/util.py | 1 - Lib/inspect.py | 14 +- Lib/pathlib.py | 5 +- Lib/pickle.py | 4 +- Lib/platform.py | 57 + Lib/pprint.py | 150 +- Lib/pydoc_data/topics.py | 103 +- Lib/smtpd.py | 2 +- Lib/socket.py | 6 +- Lib/sqlite3/__init__.py | 14 + Lib/sqlite3/test/factory.py | 7 +- Lib/subprocess.py | 6 +- Lib/sysconfig.py | 3 +- Lib/tarfile.py | 3 + Lib/test/inspect_fodder.py | 22 + Lib/test/support/__init__.py | 2 +- Lib/test/support/socket_helper.py | 2 +- Lib/test/test_asyncio/functional.py | 2 +- Lib/test/test_asyncio/test_base_events.py | 4 +- Lib/test/test_asyncio/test_events.py | 245 +- Lib/test/test_asyncio/test_locks.py | 222 +- Lib/test/test_asyncio/test_pep492.py | 26 +- Lib/test/test_asyncio/test_queues.py | 160 +- Lib/test/test_asyncio/test_server.py | 10 +- Lib/test/test_asyncio/test_sslproto.py | 34 +- Lib/test/test_asyncio/test_streams.py | 86 +- Lib/test/test_asyncio/test_subprocess.py | 20 - Lib/test/test_asyncio/test_tasks.py | 95 +- Lib/test/test_asyncio/utils.py | 7 - Lib/test/test_asyncore.py | 2 +- Lib/test/test_builtin.py | 13 + Lib/test/test_clinic.py | 26 +- Lib/test/test_collections.py | 72 + Lib/test/test_compile.py | 77 +- Lib/test/test_dict.py | 19 + Lib/test/test_dis.py | 305 +- Lib/test/test_doctest.py | 3 +- Lib/test/test_enum.py | 42 +- Lib/test/test_enumerate.py | 13 + Lib/test/test_exception_hierarchy.py | 4 +- Lib/test/test_exceptions.py | 52 +- Lib/test/test_filecmp.py | 53 +- Lib/test/test_format.py | 4 +- Lib/test/test_ftplib.py | 2 +- Lib/test/test_gdb.py | 5 - Lib/test/test_genericalias.py | 91 +- Lib/test/test_hashlib.py | 27 +- Lib/test/test_httpservers.py | 37 +- Lib/test/test_imaplib.py | 2 +- .../test_importlib/builtin/test_loader.py | 5 +- .../test_importlib/extension/test_loader.py | 44 +- Lib/test/test_importlib/frozen/test_loader.py | 20 +- .../test_importlib/import_/test___loader__.py | 39 +- .../import_/test___package__.py | 25 + Lib/test/test_importlib/import_/test_api.py | 31 + .../test_importlib/import_/test_caching.py | 39 +- .../test_importlib/import_/test_fromlist.py | 26 +- .../test_importlib/import_/test_meta_path.py | 14 +- Lib/test/test_importlib/test_abc.py | 84 +- Lib/test/test_importlib/test_api.py | 16 +- Lib/test/test_importlib/test_spec.py | 54 +- Lib/test/test_inspect.py | 34 +- Lib/test/test_itertools.py | 103 +- Lib/test/test_mailcap.py | 2 + Lib/test/test_named_expressions.py | 90 +- Lib/test/test_netrc.py | 90 +- Lib/test/test_ordered_dict.py | 11 + Lib/test/test_os.py | 215 + Lib/test/test_pathlib.py | 37 +- Lib/test/test_pipes.py | 5 +- Lib/test/test_platform.py | 111 +- Lib/test/test_poplib.py | 2 +- Lib/test/test_posix.py | 25 +- Lib/test/test_pprint.py | 13 +- Lib/test/test_pty.py | 122 +- Lib/test/test_re.py | 4 + Lib/test/test_shutil.py | 4 + Lib/test/test_signal.py | 15 +- Lib/test/test_smtplib.py | 4 +- Lib/test/test_socket.py | 38 +- Lib/test/test_ssl.py | 9 +- Lib/test/test_stat.py | 10 +- Lib/test/test_subprocess.py | 13 + Lib/test/test_sundry.py | 2 +- Lib/test/test_sys.py | 46 +- Lib/test/test_sys_settrace.py | 2 +- Lib/test/test_sysconfig.py | 4 +- Lib/test/test_tarfile.py | 6 +- Lib/test/test_tcl.py | 46 +- Lib/test/test_telnetlib.py | 2 +- Lib/test/test_threading.py | 50 + Lib/test/test_timeout.py | 8 +- Lib/test/test_traceback.py | 63 +- Lib/test/test_typing.py | 30 + Lib/test/test_unparse.py | 42 +- Lib/test/test_urllib2net.py | 2 +- Lib/test/test_uuid.py | 2 +- Lib/test/test_venv.py | 11 +- Lib/test/test_xmlrpc.py | 4 +- Lib/test/test_xxlimited.py | 79 + Lib/test/test_zipimport.py | 122 +- Lib/threading.py | 12 +- Lib/tkinter/test/test_ttk/test_extensions.py | 6 - Lib/tkinter/test/test_ttk/test_functions.py | 7 +- Lib/tkinter/test/test_ttk/test_style.py | 99 +- Lib/tkinter/test/test_ttk/test_widgets.py | 34 +- Lib/tkinter/ttk.py | 38 +- Lib/traceback.py | 5 +- Lib/typing.py | 99 +- Lib/unittest/mock.py | 2 +- Lib/unittest/test/testmock/testmock.py | 10 + Lib/urllib/request.py | 2 + Lib/zipimport.py | 38 +- Mac/BuildScript/build-installer.py | 59 +- Mac/BuildScript/resources/ReadMe.rtf | 12 +- Makefile.pre.in | 14 +- Misc/ACKS | 4 + Misc/NEWS.d/3.10.0a2.rst | 18 +- Misc/NEWS.d/3.10.0a3.rst | 1504 +++++ .../2020-11-12-13-45-15.bpo-38823.C0z_Fe.rst | 3 - .../2020-07-08-21-01-49.bpo-41073.VqQZON.rst | 1 - .../2020-10-19-15-58-16.bpo-42085.NhEf3W.rst | 1 - .../2020-10-21-18-43-06.bpo-42111.9pvtrc.rst | 2 + .../2020-10-27-21-10-14.bpo-42171.S3FWTP.rst | 4 - ...2020-11-03-11-52-27.bpo-1635741.aDYJKB.rst | 3 - .../2020-11-03-19-47-06.bpo-41832.dL1VJJ.rst | 2 - .../2020-11-04-16-31-55.bpo-42260.CmgHtF.rst | 3 - .../2020-11-04-17-22-36.bpo-42262.fCWzBb.rst | 2 - .../2020-11-05-18-02-07.bpo-42260.pAeaNR.rst | 5 - .../2020-11-10-14-27-39.bpo-42260.-Br3Co.rst | 7 - .../2020-11-01-23-34-56.bpo-42233.zOSzja.rst | 5 - .../2020-11-02-14-39-48.bpo-40077.grY9TG.rst | 1 - .../2020-11-02-15-48-17.bpo-42246.3CNQEX.rst | 2 - .../2020-11-03-21-58-27.bpo-40077.a9qM1j.rst | 1 - .../2020-11-04-23-03-25.bpo-42266.G4hGDe.rst | 3 - .../2020-11-07-21-02-05.bpo-42282.M1W4Wj.rst | 3 - .../2020-12-04-17-17-44.bpo-32381.NY5t2S.rst | 3 + .../2020-06-18-23-37-03.bpo-41028.vM8bC8.rst | 2 - .../2020-01-21-16-38-25.bpo-39411.9uHFqT.rst | 2 - .../2020-05-29-15-25-41.bpo-40816.w61Pob.rst | 1 - .../2020-08-03-17-54-32.bpo-41462.ek38d_.rst | 1 + .../2020-08-14-00-39-04.bpo-41543.RpcRjb.rst | 1 - .../2020-09-08-03-19-04.bpo-40624.0-gYfx.rst | 1 - .../2020-10-02-10-19-49.bpo-41907.wiIEsz.rst | 1 + .../2020-10-08-23-51-55.bpo-26389.uga44e.rst | 4 - .../2020-10-23-15-47-47.bpo-42133.BzizYV.rst | 2 - .../2020-10-24-04-02-36.bpo-42140.miLqvb.rst | 1 - .../2020-10-29-11-17-35.bpo-42183.50ZcIi.rst | 4 - .../2020-11-01-15-07-20.bpo-41754.DraSZh.rst | 1 - .../2020-11-02-23-05-17.bpo-42236.aJ6ZBR.rst | 3 - .../2020-11-03-09-22-56.bpo-42249.vfNO2u.rst | 1 - .../2020-11-03-14-15-35.bpo-42251.6TC32V.rst | 3 - .../2020-11-05-16-00-03.bpo-41877.FHbngM.rst | 2 - .../2020-11-10-14-27-49.bpo-42237.F363jO.rst | 1 - .../2020-11-10-15-40-56.bpo-42014.ShM37l.rst | 1 - .../2020-07-30-14-08-58.bpo-41439.yhteoi.rst | 1 + .../2020-07-30-18-43-05.bpo-41443.834gyg.rst | 1 + .../2020-05-03-01-30-46.bpo-36310.xDxxwY.rst | 2 - .../2020-11-01-16-40-23.bpo-41100.BApztP.rst | 8 - Misc/README.AIX | 5 - Modules/_blake2/blake2b_impl.c | 2 +- Modules/_blake2/blake2s_impl.c | 2 +- Modules/_ctypes/_ctypes.c | 2 +- Modules/_ctypes/callbacks.c | 11 +- Modules/_ctypes/callproc.c | 2 +- Modules/_curses_panel.c | 2 +- Modules/_cursesmodule.c | 2 +- Modules/_datetimemodule.c | 220 +- Modules/_decimal/_decimal.c | 2 +- Modules/_functoolsmodule.c | 10 +- Modules/_hashopenssl.c | 53 +- Modules/_localemodule.c | 5 +- Modules/_multiprocessing/posixshmem.c | 22 +- Modules/_multiprocessing/semaphore.c | 2 +- Modules/_operator.c | 2 +- Modules/_pickle.c | 26 +- Modules/_posixsubprocess.c | 85 +- Modules/_queuemodule.c | 73 +- Modules/_randommodule.c | 94 +- Modules/_sha3/sha3module.c | 2 +- Modules/_sqlite/cache.c | 16 +- Modules/_sqlite/module.c | 9 - Modules/_sre.c | 487 +- Modules/_ssl.c | 699 +-- Modules/_struct.c | 504 +- Modules/_testbuffer.c | 4 +- Modules/_testcapimodule.c | 69 +- Modules/_threadmodule.c | 8 +- Modules/_tkinter.c | 68 +- Modules/arraymodule.c | 4 +- Modules/cjkcodecs/multibytecodec.c | 6 +- Modules/clinic/_sre.c.h | 378 +- Modules/clinic/_ssl.c.h | 16 +- Modules/clinic/_struct.c.h | 10 +- Modules/clinic/itertoolsmodule.c.h | 33 +- Modules/clinic/posixmodule.c.h | 246 +- Modules/clinic/selectmodule.c.h | 6 +- Modules/gcmodule.c | 90 +- Modules/grpmodule.c | 71 +- Modules/itertoolsmodule.c | 163 +- Modules/main.c | 41 +- Modules/makexp_aix | 44 +- Modules/md5module.c | 2 +- Modules/mmapmodule.c | 8 + Modules/ossaudiodev.c | 4 +- Modules/overlapped.c | 2 +- Modules/posixmodule.c | 202 +- Modules/pwdmodule.c | 65 +- Modules/selectmodule.c | 209 +- Modules/sha1module.c | 2 +- Modules/sha256module.c | 2 +- Modules/sha512module.c | 2 +- Modules/signalmodule.c | 474 +- Modules/socketmodule.c | 18 +- Modules/spwdmodule.c | 84 +- Modules/sre_lib.h | 4 +- Modules/symtablemodule.c | 94 +- Modules/timemodule.c | 87 +- Modules/unicodedata.c | 2 +- Modules/xxlimited.c | 379 +- Modules/xxlimited_35.c | 301 + Modules/xxmodule.c | 2 +- Modules/zlibmodule.c | 2 +- Objects/bytearrayobject.c | 39 +- Objects/bytesobject.c | 63 +- Objects/capsule.c | 6 +- Objects/clinic/bytearrayobject.c.h | 4 +- Objects/clinic/bytesobject.c.h | 4 +- Objects/codeobject.c | 18 +- Objects/complexobject.c | 2 +- Objects/dictobject.c | 20 +- Objects/enumobject.c | 11 + Objects/exceptions.c | 4 +- Objects/floatobject.c | 4 +- Objects/funcobject.c | 19 + Objects/genericaliasobject.c | 8 +- Objects/listobject.c | 24 +- Objects/longobject.c | 2 +- Objects/moduleobject.c | 6 +- Objects/object.c | 13 +- Objects/odictobject.c | 17 +- Objects/rangeobject.c | 4 +- Objects/setobject.c | 6 +- Objects/stringlib/join.h | 2 +- Objects/stringlib/unicode_format.h | 4 +- Objects/structseq.c | 15 +- Objects/typeobject.c | 34 +- Objects/unicodeobject.c | 73 +- PC/_msi.c | 2 +- PC/launcher.c | 20 +- PC/layout/main.py | 2 +- PC/pyconfig.h | 1 - PC/winreg.c | 6 +- PCbuild/build.bat | 4 +- PCbuild/env.bat | 21 +- PCbuild/env.ps1 | 2 + PCbuild/idle.bat | 18 +- PCbuild/pcbuild.proj | 1 + PCbuild/prepare_libffi.bat | 13 +- PCbuild/pythoncore.vcxproj | 2 + PCbuild/pythoncore.vcxproj.filters | 6 + PCbuild/readme.txt | 3 + PCbuild/rt.bat | 18 +- PCbuild/xxlimited.vcxproj | 4 +- PCbuild/xxlimited_35.vcxproj | 114 + PCbuild/xxlimited_35.vcxproj.filters | 13 + Parser/parser.c | 2315 ++++---- Parser/string_parser.c | 5 +- Parser/tokenizer.c | 60 +- Python/_warnings.c | 78 +- Python/bltinmodule.c | 7 +- Python/ceval.c | 60 +- Python/compile.c | 531 +- Python/errors.c | 21 +- Python/fileutils.c | 4 +- Python/getargs.c | 4 +- Python/import.c | 181 +- Python/importlib.h | 3341 +++++------ Python/importlib_external.h | 5283 ++++++++--------- Python/importlib_zipimport.h | 1906 +++--- Python/initconfig.c | 16 +- Python/marshal.c | 18 +- Python/pylifecycle.c | 91 +- Python/pystate.c | 2 +- Python/pystrtod.c | 4 +- Python/pythonrun.c | 331 +- Python/pytime.c | 254 +- Python/symtable.c | 2 +- Python/sysmodule.c | 4 +- Python/traceback.c | 4 +- README.rst | 2 +- Tools/c-analyzer/c_analyzer/__main__.py | 18 +- Tools/c-analyzer/c_analyzer/datafiles.py | 71 +- Tools/c-analyzer/c_analyzer/info.py | 13 +- Tools/c-analyzer/c_common/fsutil.py | 120 +- Tools/c-analyzer/c_common/scriptutil.py | 34 +- Tools/c-analyzer/c_common/tables.py | 13 +- Tools/c-analyzer/c_parser/__main__.py | 10 +- Tools/c-analyzer/c_parser/datafiles.py | 35 +- Tools/c-analyzer/c_parser/info.py | 44 +- Tools/c-analyzer/cpython/__main__.py | 7 +- Tools/c-analyzer/cpython/_analyzer.py | 4 +- Tools/c-analyzer/cpython/_parser.py | 6 + Tools/c-analyzer/cpython/ignored.tsv | 2936 +++++++++ Tools/clinic/clinic.py | 54 +- Tools/msi/test/test_files.wxs | 4 +- Tools/scripts/smelly.py | 154 +- Tools/scripts/stable_abi.py | 254 + aclocal.m4 | 80 +- configure | 77 +- configure.ac | 40 +- pyconfig.h.in | 9 + setup.py | 58 +- 439 files changed, 22263 insertions(+), 13279 deletions(-) create mode 100644 Doc/data/stable_abi.dat delete mode 100644 Doc/library/formatter.rst delete mode 100644 Doc/library/misc.rst create mode 100644 Include/cpython/pythonrun.h create mode 100644 Include/internal/pycore_format.h create mode 100644 Lib/asyncio/mixins.py delete mode 100644 Lib/formatter.py mode change 100644 => 100755 Lib/test/test_uuid.py create mode 100644 Lib/test/test_xxlimited.py create mode 100644 Misc/NEWS.d/3.10.0a3.rst delete mode 100644 Misc/NEWS.d/next/Build/2020-11-12-13-45-15.bpo-38823.C0z_Fe.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-07-08-21-01-49.bpo-41073.VqQZON.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-10-19-15-58-16.bpo-42085.NhEf3W.rst create mode 100644 Misc/NEWS.d/next/C API/2020-10-21-18-43-06.bpo-42111.9pvtrc.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-10-27-21-10-14.bpo-42171.S3FWTP.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-03-11-52-27.bpo-1635741.aDYJKB.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-03-19-47-06.bpo-41832.dL1VJJ.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-04-16-31-55.bpo-42260.CmgHtF.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-04-17-22-36.bpo-42262.fCWzBb.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-05-18-02-07.bpo-42260.pAeaNR.rst delete mode 100644 Misc/NEWS.d/next/C API/2020-11-10-14-27-39.bpo-42260.-Br3Co.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-01-23-34-56.bpo-42233.zOSzja.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-02-14-39-48.bpo-40077.grY9TG.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-02-15-48-17.bpo-42246.3CNQEX.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-03-21-58-27.bpo-40077.a9qM1j.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-04-23-03-25.bpo-42266.G4hGDe.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-11-07-21-02-05.bpo-42282.M1W4Wj.rst create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-12-04-17-17-44.bpo-32381.NY5t2S.rst delete mode 100644 Misc/NEWS.d/next/Documentation/2020-06-18-23-37-03.bpo-41028.vM8bC8.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-01-21-16-38-25.bpo-39411.9uHFqT.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-05-29-15-25-41.bpo-40816.w61Pob.rst create mode 100644 Misc/NEWS.d/next/Library/2020-08-03-17-54-32.bpo-41462.ek38d_.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-08-14-00-39-04.bpo-41543.RpcRjb.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-09-08-03-19-04.bpo-40624.0-gYfx.rst create mode 100644 Misc/NEWS.d/next/Library/2020-10-02-10-19-49.bpo-41907.wiIEsz.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-10-08-23-51-55.bpo-26389.uga44e.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-10-23-15-47-47.bpo-42133.BzizYV.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-10-24-04-02-36.bpo-42140.miLqvb.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-10-29-11-17-35.bpo-42183.50ZcIi.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-02-23-05-17.bpo-42236.aJ6ZBR.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-03-09-22-56.bpo-42249.vfNO2u.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-03-14-15-35.bpo-42251.6TC32V.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-05-16-00-03.bpo-41877.FHbngM.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-10-14-27-49.bpo-42237.F363jO.rst delete mode 100644 Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst create mode 100644 Misc/NEWS.d/next/Tests/2020-07-30-14-08-58.bpo-41439.yhteoi.rst create mode 100644 Misc/NEWS.d/next/Tests/2020-07-30-18-43-05.bpo-41443.834gyg.rst delete mode 100644 Misc/NEWS.d/next/Tools-Demos/2020-05-03-01-30-46.bpo-36310.xDxxwY.rst delete mode 100644 Misc/NEWS.d/next/macOS/2020-11-01-16-40-23.bpo-41100.BApztP.rst create mode 100644 Modules/xxlimited_35.c create mode 100644 PCbuild/env.ps1 create mode 100644 PCbuild/xxlimited_35.vcxproj create mode 100644 PCbuild/xxlimited_35.vcxproj.filters create mode 100755 Tools/scripts/stable_abi.py diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml index 531ed060fd3866..3feb85ae6561de 100644 --- a/.azure-pipelines/ci.yml +++ b/.azure-pipelines/ci.yml @@ -104,7 +104,7 @@ jobs: matrix: win32: arch: win32 - buildOpt: + buildOpt: '-p Win32' testRunTitle: '$(Build.SourceBranchName)-win32' testRunPlatform: win32 win64: diff --git a/.azure-pipelines/docs-steps.yml b/.azure-pipelines/docs-steps.yml index eaf4ad01927aeb..55c38611b95c81 100644 --- a/.azure-pipelines/docs-steps.yml +++ b/.azure-pipelines/docs-steps.yml @@ -16,7 +16,7 @@ steps: displayName: 'Install build dependencies' - ${{ if ne(parameters.latex, 'true') }}: - - script: make check suspicious html PYTHON=python + - script: make check html PYTHON=python workingDirectory: '$(build.sourcesDirectory)/Doc' displayName: 'Build documentation' diff --git a/.azure-pipelines/pr.yml b/.azure-pipelines/pr.yml index 1ffe0a97a2465f..2e94af35600cfc 100644 --- a/.azure-pipelines/pr.yml +++ b/.azure-pipelines/pr.yml @@ -104,7 +104,7 @@ jobs: matrix: win32: arch: win32 - buildOpt: + buildOpt: '-p Win32' testRunTitle: '$(System.PullRequest.TargetBranch)-win32' testRunPlatform: win32 win64: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d00c227182f61a..71c307b6c62a35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,37 @@ jobs: # https://github.com/python/core-workflow/issues/373 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true fi + + check_generated_files: + name: 'Check if generated files are up to date' + runs-on: ubuntu-latest + needs: check_source + if: needs.check_source.outputs.run_tests == 'true' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install Dependencies + run: sudo ./.github/workflows/posix-deps-apt.sh + - name: Build CPython + run: | + # Build Python with the libpython dynamic library + ./configure --with-pydebug --enable-shared + make -j4 regen-all + - name: Check for changes + run: | + changes=$(git status --porcelain) + # Check for changes in regenerated files + if ! test -z "$changes" + then + echo "Generated files not up to date. Perhaps you forgot to run make regen-all ;)" + echo "$changes" + exit 1 + fi + - name: Check exported libpython symbols + run: make smelly + - name: Check limited ABI symbols + run: make check-limited-abi + build_win32: name: 'Windows (x86)' runs-on: windows-latest @@ -59,7 +90,7 @@ jobs: - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 build_win_amd64: name: 'Windows (x64)' @@ -73,7 +104,7 @@ jobs: - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 build_macos: name: 'macOS' @@ -106,7 +137,7 @@ jobs: run: sudo ./.github/workflows/posix-deps-apt.sh - name: 'Restore OpenSSL build' id: cache-openssl - uses: actions/cache@v2.1.2 + uses: actions/cache@v2.1.3 with: path: ./multissl/openssl/${{ env.OPENSSL_VER }} key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ed71a012395d4f..11748f0e449812 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -32,7 +32,7 @@ jobs: run: sudo ./.github/workflows/posix-deps-apt.sh - name: 'Restore OpenSSL build' id: cache-openssl - uses: actions/cache@v2.1.2 + uses: actions/cache@v2.1.3 with: path: ./multissl/openssl/${{ env.OPENSSL_VER }} key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 7c6012eed4f2d2..82e9645b5b3377 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -36,9 +36,9 @@ jobs: - name: 'Install build dependencies' run: make -C Doc/ PYTHON=../python venv - name: 'Build documentation' - run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" doctest suspicious html + run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" doctest html - name: 'Upload' - uses: actions/upload-artifact@v2.2.0 + uses: actions/upload-artifact@v2.2.1 with: name: doc-html path: Doc/build/html diff --git a/.travis.yml b/.travis.yml index 254a4ea35ab944..547d919974957c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ matrix: - cd Doc - make venv PYTHON=python script: - - make check suspicious html SPHINXOPTS="-q -W -j4" + - make check html SPHINXOPTS="-q -W -j4" - name: "Documentation tests" os: linux language: c @@ -192,6 +192,8 @@ script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi # Check that all symbols exported by libpython start with "Py" or "_Py" - make smelly + # Check that all symbols in the limited abi are present + - make check-limited-abi # `-r -w` implicitly provided through `make buildbottest`. - | if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then diff --git a/Doc/Makefile b/Doc/Makefile index 6bf1f408b56f0d..c24c70c699a06a 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -216,7 +216,6 @@ serve: # for development releases: always build autobuild-dev: make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1' - -make suspicious # for quick rebuilds (HTML only) autobuild-dev-html: diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 37602ed5b4dc78..37072d30d57153 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -68,9 +68,7 @@ the definition of all other Python objects. Return a :term:`borrowed reference`. - .. versionchanged:: 3.10 - :c:func:`Py_TYPE()` is changed to the inline static function. - Use :c:func:`Py_SET_TYPE()` to set an object type. + The :c:func:`Py_SET_TYPE` function must be used to set an object type. .. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type) @@ -108,9 +106,7 @@ the definition of all other Python objects. Get the size of the Python object *o*. - .. versionchanged:: 3.10 - :c:func:`Py_SIZE()` is changed to the inline static function. - Use :c:func:`Py_SET_SIZE()` to set an object size. + The :c:func:`Py_SET_SIZE` function must be used to set an object size. .. c:function:: void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size) diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst index bf751e44acde09..c0c14f480d39b8 100644 --- a/Doc/c-api/tuple.rst +++ b/Doc/c-api/tuple.rst @@ -57,7 +57,7 @@ Tuple Objects .. c:function:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos) Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is - out of bounds, return ``NULL`` and set an :exc:`IndexError` exception. + negative or out of bounds, return ``NULL`` and set an :exc:`IndexError` exception. .. c:function:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos) diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst index f9037c89d8bd3b..a869859dd421d1 100644 --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -154,10 +154,10 @@ The following functions and structs are used to create Creates and returns a heap type object from the *spec* (:const:`Py_TPFLAGS_HEAPTYPE`). - If *bases* is a tuple, the created heap type contains all types contained - in it as base types. - - If *bases* is ``NULL``, the *Py_tp_base* slot is used instead. + The *bases* argument can be used to specify base classes; it can either + be only one class or a tuple of classes. + If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead. + If that also is ``NULL``, the *Py_tp_base* slot is used instead. If that also is ``NULL``, the new type derives from :class:`object`. The *module* argument can be used to record the module in which the new @@ -173,7 +173,8 @@ The following functions and structs are used to create .. versionchanged:: 3.10 - The function now accepts NULL ``tp_doc`` slot. + The function now accepts a single class as the *bases* argument and + ``NULL`` as the ``tp_doc`` slot. .. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) @@ -253,7 +254,8 @@ The following functions and structs are used to create * :c:member:`~PyBufferProcs.bf_getbuffer` * :c:member:`~PyBufferProcs.bf_releasebuffer` - Setting :c:data:`Py_tp_bases` may be problematic on some platforms. + Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be + problematic on some platforms. To avoid issues, use the *bases* argument of :py:func:`PyType_FromSpecWithBases` instead. @@ -265,3 +267,5 @@ The following functions and structs are used to create The desired value of the slot. In most cases, this is a pointer to a function. + + Slots other than ``Py_tp_doc`` may not be ``NULL``. diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 6a67bfe9010890..9efe3aac2e1c9f 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -1170,6 +1170,14 @@ and :c:type:`PyType_Type` effectively act as defaults.) .. versionadded:: 3.9 + .. data:: Py_TPFLAGS_HAVE_AM_SEND + + This bit is set when the :c:member:`~PyAsyncMethods.am_send` entry is present in the + :c:member:`~PyTypeObject.tp_as_async` slot of type structure. + + .. versionadded:: 3.10 + + .. c:member:: const char* PyTypeObject.tp_doc An optional pointer to a NUL-terminated C string giving the docstring for this diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat new file mode 100644 index 00000000000000..28cb50b12301ba --- /dev/null +++ b/Doc/data/stable_abi.dat @@ -0,0 +1,779 @@ +# File generated by 'make regen-limited-abi' +# This is NOT an authoritative list of stable ABI symbols +PyArg_Parse +PyArg_ParseTuple +PyArg_ParseTupleAndKeywords +PyArg_UnpackTuple +PyArg_VaParse +PyArg_VaParseTupleAndKeywords +PyArg_ValidateKeywordArguments +PyBaseObject_Type +PyBool_FromLong +PyBool_Type +PyByteArrayIter_Type +PyByteArray_AsString +PyByteArray_Concat +PyByteArray_FromObject +PyByteArray_FromStringAndSize +PyByteArray_Resize +PyByteArray_Size +PyByteArray_Type +PyBytesIter_Type +PyBytes_AsString +PyBytes_AsStringAndSize +PyBytes_Concat +PyBytes_ConcatAndDel +PyBytes_DecodeEscape +PyBytes_FromFormat +PyBytes_FromFormatV +PyBytes_FromObject +PyBytes_FromString +PyBytes_FromStringAndSize +PyBytes_Repr +PyBytes_Size +PyBytes_Type +PyCFunction_Call +PyCFunction_GetFlags +PyCFunction_GetFunction +PyCFunction_GetSelf +PyCFunction_NewEx +PyCFunction_Type +PyCMethod_New +PyCallIter_New +PyCallIter_Type +PyCallable_Check +PyCapsule_GetContext +PyCapsule_GetDestructor +PyCapsule_GetName +PyCapsule_GetPointer +PyCapsule_Import +PyCapsule_IsValid +PyCapsule_New +PyCapsule_SetContext +PyCapsule_SetDestructor +PyCapsule_SetName +PyCapsule_SetPointer +PyCapsule_Type +PyClassMethodDescr_Type +PyCodec_BackslashReplaceErrors +PyCodec_Decode +PyCodec_Decoder +PyCodec_Encode +PyCodec_Encoder +PyCodec_IgnoreErrors +PyCodec_IncrementalDecoder +PyCodec_IncrementalEncoder +PyCodec_KnownEncoding +PyCodec_LookupError +PyCodec_NameReplaceErrors +PyCodec_Register +PyCodec_RegisterError +PyCodec_ReplaceErrors +PyCodec_StreamReader +PyCodec_StreamWriter +PyCodec_StrictErrors +PyCodec_Unregister +PyCodec_XMLCharRefReplaceErrors +PyComplex_FromDoubles +PyComplex_ImagAsDouble +PyComplex_RealAsDouble +PyComplex_Type +PyDescr_NewClassMethod +PyDescr_NewGetSet +PyDescr_NewMember +PyDescr_NewMethod +PyDictItems_Type +PyDictIterItem_Type +PyDictIterKey_Type +PyDictIterValue_Type +PyDictKeys_Type +PyDictProxy_New +PyDictProxy_Type +PyDictRevIterItem_Type +PyDictRevIterKey_Type +PyDictRevIterValue_Type +PyDictValues_Type +PyDict_Clear +PyDict_Contains +PyDict_Copy +PyDict_DelItem +PyDict_DelItemString +PyDict_GetItem +PyDict_GetItemString +PyDict_GetItemWithError +PyDict_Items +PyDict_Keys +PyDict_Merge +PyDict_MergeFromSeq2 +PyDict_New +PyDict_Next +PyDict_SetItem +PyDict_SetItemString +PyDict_Size +PyDict_Type +PyDict_Update +PyDict_Values +PyEllipsis_Type +PyEnum_Type +PyErr_BadArgument +PyErr_BadInternalCall +PyErr_CheckSignals +PyErr_Clear +PyErr_Display +PyErr_ExceptionMatches +PyErr_Fetch +PyErr_Format +PyErr_FormatV +PyErr_GetExcInfo +PyErr_GivenExceptionMatches +PyErr_NewException +PyErr_NewExceptionWithDoc +PyErr_NoMemory +PyErr_NormalizeException +PyErr_Occurred +PyErr_Print +PyErr_PrintEx +PyErr_ProgramText +PyErr_ResourceWarning +PyErr_Restore +PyErr_SetExcInfo +PyErr_SetFromErrno +PyErr_SetFromErrnoWithFilename +PyErr_SetFromErrnoWithFilenameObject +PyErr_SetFromErrnoWithFilenameObjects +PyErr_SetImportError +PyErr_SetImportErrorSubclass +PyErr_SetInterrupt +PyErr_SetNone +PyErr_SetObject +PyErr_SetString +PyErr_SyntaxLocation +PyErr_SyntaxLocationEx +PyErr_WarnEx +PyErr_WarnExplicit +PyErr_WarnFormat +PyErr_WriteUnraisable +PyEval_AcquireLock +PyEval_AcquireThread +PyEval_CallFunction +PyEval_CallMethod +PyEval_CallObjectWithKeywords +PyEval_EvalCode +PyEval_EvalCodeEx +PyEval_EvalFrame +PyEval_EvalFrameEx +PyEval_GetBuiltins +PyEval_GetFrame +PyEval_GetFuncDesc +PyEval_GetFuncName +PyEval_GetGlobals +PyEval_GetLocals +PyEval_InitThreads +PyEval_ReleaseLock +PyEval_ReleaseThread +PyEval_RestoreThread +PyEval_SaveThread +PyEval_ThreadsInitialized +PyExc_ArithmeticError +PyExc_AssertionError +PyExc_AttributeError +PyExc_BaseException +PyExc_BlockingIOError +PyExc_BrokenPipeError +PyExc_BufferError +PyExc_BytesWarning +PyExc_ChildProcessError +PyExc_ConnectionAbortedError +PyExc_ConnectionError +PyExc_ConnectionRefusedError +PyExc_ConnectionResetError +PyExc_DeprecationWarning +PyExc_EOFError +PyExc_EnvironmentError +PyExc_Exception +PyExc_FileExistsError +PyExc_FileNotFoundError +PyExc_FloatingPointError +PyExc_FutureWarning +PyExc_GeneratorExit +PyExc_IOError +PyExc_ImportError +PyExc_ImportWarning +PyExc_IndentationError +PyExc_IndexError +PyExc_InterruptedError +PyExc_IsADirectoryError +PyExc_KeyError +PyExc_KeyboardInterrupt +PyExc_LookupError +PyExc_MemoryError +PyExc_ModuleNotFoundError +PyExc_NameError +PyExc_NotADirectoryError +PyExc_NotImplementedError +PyExc_OSError +PyExc_OverflowError +PyExc_PendingDeprecationWarning +PyExc_PermissionError +PyExc_ProcessLookupError +PyExc_RecursionError +PyExc_ReferenceError +PyExc_ResourceWarning +PyExc_RuntimeError +PyExc_RuntimeWarning +PyExc_StopAsyncIteration +PyExc_StopIteration +PyExc_SyntaxError +PyExc_SyntaxWarning +PyExc_SystemError +PyExc_SystemExit +PyExc_TabError +PyExc_TimeoutError +PyExc_TypeError +PyExc_UnboundLocalError +PyExc_UnicodeDecodeError +PyExc_UnicodeEncodeError +PyExc_UnicodeError +PyExc_UnicodeTranslateError +PyExc_UnicodeWarning +PyExc_UserWarning +PyExc_ValueError +PyExc_Warning +PyExc_ZeroDivisionError +PyExceptionClass_Name +PyException_GetCause +PyException_GetContext +PyException_GetTraceback +PyException_SetCause +PyException_SetContext +PyException_SetTraceback +PyFile_FromFd +PyFile_GetLine +PyFile_WriteObject +PyFile_WriteString +PyFilter_Type +PyFloat_AsDouble +PyFloat_FromDouble +PyFloat_FromString +PyFloat_GetInfo +PyFloat_GetMax +PyFloat_GetMin +PyFloat_Type +PyFrame_GetCode +PyFrame_GetLineNumber +PyFrozenSet_New +PyFrozenSet_Type +PyGC_Collect +PyGILState_Ensure +PyGILState_GetThisThreadState +PyGILState_Release +PyGetSetDescr_Type +PyImport_AddModule +PyImport_AddModuleObject +PyImport_AppendInittab +PyImport_ExecCodeModule +PyImport_ExecCodeModuleEx +PyImport_ExecCodeModuleObject +PyImport_ExecCodeModuleWithPathnames +PyImport_GetImporter +PyImport_GetMagicNumber +PyImport_GetMagicTag +PyImport_GetModule +PyImport_GetModuleDict +PyImport_Import +PyImport_ImportFrozenModule +PyImport_ImportFrozenModuleObject +PyImport_ImportModule +PyImport_ImportModuleLevel +PyImport_ImportModuleLevelObject +PyImport_ImportModuleNoBlock +PyImport_ReloadModule +PyIndex_Check +PyInterpreterState_Clear +PyInterpreterState_Delete +PyInterpreterState_Get +PyInterpreterState_GetDict +PyInterpreterState_GetID +PyInterpreterState_New +PyIter_Check +PyIter_Next +PyIter_Send +PyListIter_Type +PyListRevIter_Type +PyList_Append +PyList_AsTuple +PyList_GetItem +PyList_GetSlice +PyList_Insert +PyList_New +PyList_Reverse +PyList_SetItem +PyList_SetSlice +PyList_Size +PyList_Sort +PyList_Type +PyLongRangeIter_Type +PyLong_AsDouble +PyLong_AsLong +PyLong_AsLongAndOverflow +PyLong_AsLongLong +PyLong_AsLongLongAndOverflow +PyLong_AsSize_t +PyLong_AsSsize_t +PyLong_AsUnsignedLong +PyLong_AsUnsignedLongLong +PyLong_AsUnsignedLongLongMask +PyLong_AsUnsignedLongMask +PyLong_AsVoidPtr +PyLong_FromDouble +PyLong_FromLong +PyLong_FromLongLong +PyLong_FromSize_t +PyLong_FromSsize_t +PyLong_FromString +PyLong_FromUnsignedLong +PyLong_FromUnsignedLongLong +PyLong_FromVoidPtr +PyLong_GetInfo +PyLong_Type +PyMap_Type +PyMapping_Check +PyMapping_GetItemString +PyMapping_HasKey +PyMapping_HasKeyString +PyMapping_Items +PyMapping_Keys +PyMapping_Length +PyMapping_SetItemString +PyMapping_Size +PyMapping_Values +PyMarshal_ReadObjectFromString +PyMarshal_WriteLongToFile +PyMarshal_WriteObjectToFile +PyMarshal_WriteObjectToString +PyMem_Free +PyMem_Malloc +PyMem_Realloc +PyMemberDescr_Type +PyMember_GetOne +PyMember_SetOne +PyMemoryView_FromMemory +PyMemoryView_FromObject +PyMemoryView_GetContiguous +PyMemoryView_Type +PyMethodDescr_Type +PyModuleDef_Init +PyModuleDef_Type +PyModule_AddFunctions +PyModule_AddIntConstant +PyModule_AddObject +PyModule_AddObjectRef +PyModule_AddStringConstant +PyModule_AddType +PyModule_Create2 +PyModule_ExecDef +PyModule_FromDefAndSpec2 +PyModule_GetDef +PyModule_GetDict +PyModule_GetFilename +PyModule_GetFilenameObject +PyModule_GetName +PyModule_GetNameObject +PyModule_GetState +PyModule_New +PyModule_NewObject +PyModule_SetDocString +PyModule_Type +PyNumber_Absolute +PyNumber_Add +PyNumber_And +PyNumber_AsSsize_t +PyNumber_Check +PyNumber_Divmod +PyNumber_Float +PyNumber_FloorDivide +PyNumber_InPlaceAdd +PyNumber_InPlaceAnd +PyNumber_InPlaceFloorDivide +PyNumber_InPlaceLshift +PyNumber_InPlaceMatrixMultiply +PyNumber_InPlaceMultiply +PyNumber_InPlaceOr +PyNumber_InPlacePower +PyNumber_InPlaceRemainder +PyNumber_InPlaceRshift +PyNumber_InPlaceSubtract +PyNumber_InPlaceTrueDivide +PyNumber_InPlaceXor +PyNumber_Index +PyNumber_Invert +PyNumber_Long +PyNumber_Lshift +PyNumber_MatrixMultiply +PyNumber_Multiply +PyNumber_Negative +PyNumber_Or +PyNumber_Positive +PyNumber_Power +PyNumber_Remainder +PyNumber_Rshift +PyNumber_Subtract +PyNumber_ToBase +PyNumber_TrueDivide +PyNumber_Xor +PyOS_AfterFork +PyOS_AfterFork_Child +PyOS_AfterFork_Parent +PyOS_BeforeFork +PyOS_FSPath +PyOS_InterruptOccurred +PyOS_double_to_string +PyOS_getsig +PyOS_mystricmp +PyOS_mystrnicmp +PyOS_setsig +PyOS_snprintf +PyOS_string_to_double +PyOS_strtol +PyOS_strtoul +PyOS_vsnprintf +PyObject_ASCII +PyObject_AsFileDescriptor +PyObject_Bytes +PyObject_Call +PyObject_CallFunction +PyObject_CallFunctionObjArgs +PyObject_CallMethod +PyObject_CallMethodObjArgs +PyObject_CallNoArgs +PyObject_CallObject +PyObject_Calloc +PyObject_ClearWeakRefs +PyObject_DelItem +PyObject_DelItemString +PyObject_Dir +PyObject_Format +PyObject_Free +PyObject_GC_Del +PyObject_GC_IsFinalized +PyObject_GC_IsTracked +PyObject_GC_Track +PyObject_GC_UnTrack +PyObject_GenericGetAttr +PyObject_GenericGetDict +PyObject_GenericSetAttr +PyObject_GenericSetDict +PyObject_GetAttr +PyObject_GetAttrString +PyObject_GetItem +PyObject_GetIter +PyObject_HasAttr +PyObject_HasAttrString +PyObject_Hash +PyObject_HashNotImplemented +PyObject_Init +PyObject_InitVar +PyObject_IsInstance +PyObject_IsSubclass +PyObject_IsTrue +PyObject_Length +PyObject_Malloc +PyObject_Not +PyObject_Realloc +PyObject_Repr +PyObject_RichCompare +PyObject_RichCompareBool +PyObject_SelfIter +PyObject_SetAttr +PyObject_SetAttrString +PyObject_SetItem +PyObject_Size +PyObject_Str +PyObject_Type +PyProperty_Type +PyRangeIter_Type +PyRange_Type +PyReversed_Type +PySeqIter_New +PySeqIter_Type +PySequence_Check +PySequence_Concat +PySequence_Contains +PySequence_Count +PySequence_DelItem +PySequence_DelSlice +PySequence_Fast +PySequence_GetItem +PySequence_GetSlice +PySequence_In +PySequence_InPlaceConcat +PySequence_InPlaceRepeat +PySequence_Index +PySequence_Length +PySequence_List +PySequence_Repeat +PySequence_SetItem +PySequence_SetSlice +PySequence_Size +PySequence_Tuple +PySetIter_Type +PySet_Add +PySet_Clear +PySet_Contains +PySet_Discard +PySet_New +PySet_Pop +PySet_Size +PySet_Type +PySlice_AdjustIndices +PySlice_GetIndices +PySlice_GetIndicesEx +PySlice_New +PySlice_Type +PySlice_Unpack +PyState_AddModule +PyState_FindModule +PyState_RemoveModule +PyStructSequence_GetItem +PyStructSequence_New +PyStructSequence_NewType +PyStructSequence_SetItem +PySuper_Type +PySys_AddWarnOption +PySys_AddWarnOptionUnicode +PySys_AddXOption +PySys_FormatStderr +PySys_FormatStdout +PySys_GetObject +PySys_GetXOptions +PySys_HasWarnOptions +PySys_ResetWarnOptions +PySys_SetArgv +PySys_SetArgvEx +PySys_SetObject +PySys_SetPath +PySys_WriteStderr +PySys_WriteStdout +PyThreadState_Clear +PyThreadState_Delete +PyThreadState_Get +PyThreadState_GetDict +PyThreadState_GetFrame +PyThreadState_GetID +PyThreadState_GetInterpreter +PyThreadState_New +PyThreadState_SetAsyncExc +PyThreadState_Swap +PyThread_GetInfo +PyThread_ReInitTLS +PyThread_acquire_lock +PyThread_acquire_lock_timed +PyThread_allocate_lock +PyThread_create_key +PyThread_delete_key +PyThread_delete_key_value +PyThread_exit_thread +PyThread_free_lock +PyThread_get_key_value +PyThread_get_stacksize +PyThread_get_thread_ident +PyThread_get_thread_native_id +PyThread_init_thread +PyThread_release_lock +PyThread_set_key_value +PyThread_set_stacksize +PyThread_start_new_thread +PyThread_tss_alloc +PyThread_tss_create +PyThread_tss_delete +PyThread_tss_free +PyThread_tss_get +PyThread_tss_is_created +PyThread_tss_set +PyTraceBack_Here +PyTraceBack_Print +PyTraceBack_Type +PyTupleIter_Type +PyTuple_GetItem +PyTuple_GetSlice +PyTuple_New +PyTuple_Pack +PyTuple_SetItem +PyTuple_Size +PyTuple_Type +PyType_ClearCache +PyType_FromModuleAndSpec +PyType_FromSpec +PyType_FromSpecWithBases +PyType_GenericAlloc +PyType_GenericNew +PyType_GetFlags +PyType_GetModule +PyType_GetModuleState +PyType_GetSlot +PyType_IsSubtype +PyType_Modified +PyType_Ready +PyType_Type +PyUnicodeDecodeError_Create +PyUnicodeDecodeError_GetEncoding +PyUnicodeDecodeError_GetEnd +PyUnicodeDecodeError_GetObject +PyUnicodeDecodeError_GetReason +PyUnicodeDecodeError_GetStart +PyUnicodeDecodeError_SetEnd +PyUnicodeDecodeError_SetReason +PyUnicodeDecodeError_SetStart +PyUnicodeEncodeError_GetEncoding +PyUnicodeEncodeError_GetEnd +PyUnicodeEncodeError_GetObject +PyUnicodeEncodeError_GetReason +PyUnicodeEncodeError_GetStart +PyUnicodeEncodeError_SetEnd +PyUnicodeEncodeError_SetReason +PyUnicodeEncodeError_SetStart +PyUnicodeIter_Type +PyUnicodeTranslateError_GetEnd +PyUnicodeTranslateError_GetObject +PyUnicodeTranslateError_GetReason +PyUnicodeTranslateError_GetStart +PyUnicodeTranslateError_SetEnd +PyUnicodeTranslateError_SetReason +PyUnicodeTranslateError_SetStart +PyUnicode_Append +PyUnicode_AppendAndDel +PyUnicode_AsASCIIString +PyUnicode_AsCharmapString +PyUnicode_AsDecodedObject +PyUnicode_AsDecodedUnicode +PyUnicode_AsEncodedObject +PyUnicode_AsEncodedString +PyUnicode_AsEncodedUnicode +PyUnicode_AsLatin1String +PyUnicode_AsRawUnicodeEscapeString +PyUnicode_AsUCS4 +PyUnicode_AsUCS4Copy +PyUnicode_AsUTF16String +PyUnicode_AsUTF32String +PyUnicode_AsUTF8AndSize +PyUnicode_AsUTF8String +PyUnicode_AsUnicodeEscapeString +PyUnicode_AsWideChar +PyUnicode_AsWideCharString +PyUnicode_BuildEncodingMap +PyUnicode_Compare +PyUnicode_CompareWithASCIIString +PyUnicode_Concat +PyUnicode_Contains +PyUnicode_Count +PyUnicode_Decode +PyUnicode_DecodeASCII +PyUnicode_DecodeCharmap +PyUnicode_DecodeFSDefault +PyUnicode_DecodeFSDefaultAndSize +PyUnicode_DecodeLatin1 +PyUnicode_DecodeLocale +PyUnicode_DecodeLocaleAndSize +PyUnicode_DecodeRawUnicodeEscape +PyUnicode_DecodeUTF16 +PyUnicode_DecodeUTF16Stateful +PyUnicode_DecodeUTF32 +PyUnicode_DecodeUTF32Stateful +PyUnicode_DecodeUTF7 +PyUnicode_DecodeUTF7Stateful +PyUnicode_DecodeUTF8 +PyUnicode_DecodeUTF8Stateful +PyUnicode_DecodeUnicodeEscape +PyUnicode_EncodeFSDefault +PyUnicode_EncodeLocale +PyUnicode_FSConverter +PyUnicode_FSDecoder +PyUnicode_Find +PyUnicode_FindChar +PyUnicode_Format +PyUnicode_FromEncodedObject +PyUnicode_FromFormat +PyUnicode_FromFormatV +PyUnicode_FromObject +PyUnicode_FromOrdinal +PyUnicode_FromString +PyUnicode_FromStringAndSize +PyUnicode_FromWideChar +PyUnicode_GetDefaultEncoding +PyUnicode_GetLength +PyUnicode_GetSize +PyUnicode_InternFromString +PyUnicode_InternImmortal +PyUnicode_InternInPlace +PyUnicode_IsIdentifier +PyUnicode_Join +PyUnicode_Partition +PyUnicode_RPartition +PyUnicode_RSplit +PyUnicode_ReadChar +PyUnicode_Replace +PyUnicode_Resize +PyUnicode_RichCompare +PyUnicode_Split +PyUnicode_Splitlines +PyUnicode_Substring +PyUnicode_Tailmatch +PyUnicode_Translate +PyUnicode_Type +PyUnicode_WriteChar +PyWeakref_GetObject +PyWeakref_NewProxy +PyWeakref_NewRef +PyWrapperDescr_Type +PyWrapper_New +PyZip_Type +Py_AddPendingCall +Py_AtExit +Py_BuildValue +Py_BytesMain +Py_CompileString +Py_DecRef +Py_DecodeLocale +Py_EncodeLocale +Py_EndInterpreter +Py_EnterRecursiveCall +Py_Exit +Py_FatalError +Py_FileSystemDefaultEncodeErrors +Py_FileSystemDefaultEncoding +Py_Finalize +Py_FinalizeEx +Py_GenericAlias +Py_GenericAliasType +Py_GetBuildInfo +Py_GetCompiler +Py_GetCopyright +Py_GetExecPrefix +Py_GetPath +Py_GetPlatform +Py_GetPrefix +Py_GetProgramFullPath +Py_GetProgramName +Py_GetPythonHome +Py_GetRecursionLimit +Py_GetVersion +Py_HasFileSystemDefaultEncoding +Py_IncRef +Py_Initialize +Py_InitializeEx +Py_IsInitialized +Py_LeaveRecursiveCall +Py_Main +Py_MakePendingCalls +Py_NewInterpreter +Py_NewRef +Py_ReprEnter +Py_ReprLeave +Py_SetPath +Py_SetProgramName +Py_SetPythonHome +Py_SetRecursionLimit +Py_SymtableString +Py_UTF8Mode +Py_VaBuildValue +Py_XNewRef diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index 8c2e8d562153db..ab5a573c6a06d1 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -16,7 +16,7 @@ storage, and deletion. This guide has four major sections: 1) The "primer" gives a basic overview, moving gently from simple examples, - adding one feature at a time. It is a great place to start. + adding one feature at a time. Start here if you're new to descriptors. 2) The second section shows a complete, practical descriptor example. If you already know the basics, start there. @@ -42,21 +42,27 @@ add new capabilities one by one. Simple example: A descriptor that returns a constant ---------------------------------------------------- -The :class:`Ten` class is a descriptor that always returns the constant ``10``:: +The :class:`Ten` class is a descriptor that always returns the constant ``10`` +from its :meth:`__get__` method: +.. testcode:: class Ten: def __get__(self, obj, objtype=None): return 10 -To use the descriptor, it must be stored as a class variable in another class:: +To use the descriptor, it must be stored as a class variable in another class: + +.. testcode:: class A: x = 5 # Regular class attribute y = Ten() # Descriptor instance An interactive session shows the difference between normal attribute lookup -and descriptor lookup:: +and descriptor lookup: + +.. doctest:: >>> a = A() # Make an instance of class A >>> a.x # Normal attribute lookup @@ -64,9 +70,11 @@ and descriptor lookup:: >>> a.y # Descriptor lookup 10 -In the ``a.x`` attribute lookup, the dot operator finds the value ``5`` stored -in the class dictionary. In the ``a.y`` descriptor lookup, the dot operator -calls the descriptor's :meth:`__get__()` method. That method returns ``10``. +In the ``a.x`` attribute lookup, the dot operator finds the key ``x`` and the +value ``5`` in the class dictionary. In the ``a.y`` lookup, the dot operator +finds a descriptor instance, recognized by its ``__get__`` method, and calls +that method which returns ``10``. + Note that the value ``10`` is not stored in either the class dictionary or the instance dictionary. Instead, the value ``10`` is computed on demand. @@ -79,7 +87,10 @@ In the next section, we'll create something more useful, a dynamic lookup. Dynamic lookups --------------- -Interesting descriptors typically run computations instead of doing lookups:: +Interesting descriptors typically run computations instead of returning +constants: + +.. testcode:: import os @@ -98,16 +109,15 @@ Interesting descriptors typically run computations instead of doing lookups:: An interactive session shows that the lookup is dynamic — it computes different, updated answers each time:: - >>> g = Directory('games') >>> s = Directory('songs') + >>> g = Directory('games') + >>> s.size # The songs directory has twenty files + 20 >>> g.size # The games directory has three files 3 - >>> os.system('touch games/newfile') # Add a fourth file to the directory - 0 - >>> g.size # Automatically updated + >>> open('games/newfile').close() # Add a fourth file to the directory + >>> g.size # File count is automatically updated 4 - >>> s.size # The songs directory has twenty files - 20 Besides showing how descriptors can run computations, this example also reveals the purpose of the parameters to :meth:`__get__`. The *self* @@ -128,7 +138,9 @@ the public attribute is accessed. In the following example, *age* is the public attribute and *_age* is the private attribute. When the public attribute is accessed, the descriptor logs -the lookup or update:: +the lookup or update: + +.. testcode:: import logging @@ -158,7 +170,15 @@ the lookup or update:: An interactive session shows that all access to the managed attribute *age* is -logged, but that the regular attribute *name* is not logged:: +logged, but that the regular attribute *name* is not logged: + +.. testcode:: + :hide: + + import logging, sys + logging.basicConfig(level=logging.INFO, stream=sys.stdout, force=True) + +.. doctest:: >>> mary = Person('Mary M', 30) # The initial age update is logged INFO:root:Updating 'age' to 30 @@ -198,7 +218,9 @@ variable name was used. In this example, the :class:`Person` class has two descriptor instances, *name* and *age*. When the :class:`Person` class is defined, it makes a callback to :meth:`__set_name__` in *LoggedAccess* so that the field names can -be recorded, giving each descriptor its own *public_name* and *private_name*:: +be recorded, giving each descriptor its own *public_name* and *private_name*: + +.. testcode:: import logging @@ -208,7 +230,7 @@ be recorded, giving each descriptor its own *public_name* and *private_name*:: def __set_name__(self, owner, name): self.public_name = name - self.private_name = f'_{name}' + self.private_name = '_' + name def __get__(self, obj, objtype=None): value = getattr(obj, self.private_name) @@ -233,14 +255,24 @@ be recorded, giving each descriptor its own *public_name* and *private_name*:: An interactive session shows that the :class:`Person` class has called :meth:`__set_name__` so that the field names would be recorded. Here -we call :func:`vars` to look up the descriptor without triggering it:: +we call :func:`vars` to look up the descriptor without triggering it: + +.. doctest:: >>> vars(vars(Person)['name']) {'public_name': 'name', 'private_name': '_name'} >>> vars(vars(Person)['age']) {'public_name': 'age', 'private_name': '_age'} -The new class now logs access to both *name* and *age*:: +The new class now logs access to both *name* and *age*: + +.. testcode:: + :hide: + + import logging, sys + logging.basicConfig(level=logging.INFO, stream=sys.stdout, force=True) + +.. doctest:: >>> pete = Person('Peter P', 10) INFO:root:Updating 'name' to 'Peter P' @@ -265,9 +297,10 @@ A :term:`descriptor` is what we call any object that defines :meth:`__get__`, Optionally, descriptors can have a :meth:`__set_name__` method. This is only used in cases where a descriptor needs to know either the class where it was -created or the name of class variable it was assigned to. +created or the name of class variable it was assigned to. (This method, if +present, is called even if the class is not a descriptor.) -Descriptors get invoked by the dot operator during attribute lookup. If a +Descriptors get invoked by the dot "operator" during attribute lookup. If a descriptor is accessed indirectly with ``vars(some_class)[descriptor_name]``, the descriptor instance is returned without invoking it. @@ -275,7 +308,7 @@ Descriptors only work when used as class variables. When put in instances, they have no effect. The main motivation for descriptors is to provide a hook allowing objects -stored in class variables to control what happens during dotted lookup. +stored in class variables to control what happens during attribute lookup. Traditionally, the calling class controls what happens during lookup. Descriptors invert that relationship and allow the data being looked-up to @@ -303,14 +336,16 @@ restrictions. If those restrictions aren't met, it raises an exception to prevent data corruption at its source. This :class:`Validator` class is both an :term:`abstract base class` and a -managed attribute descriptor:: +managed attribute descriptor: + +.. testcode:: from abc import ABC, abstractmethod class Validator(ABC): def __set_name__(self, owner, name): - self.private_name = f'_{name}' + self.private_name = '_' + name def __get__(self, obj, objtype=None): return getattr(obj, self.private_name) @@ -343,7 +378,7 @@ Here are three practical data validation utilities: user-defined `predicate `_ as well. -:: +.. testcode:: class OneOf(Validator): @@ -396,10 +431,12 @@ Here are three practical data validation utilities: ) -Practical use -------------- +Practical application +--------------------- + +Here's how the data validators can be used in a real class: -Here's how the data validators can be used in a real class:: +.. testcode:: class Component: @@ -412,13 +449,30 @@ Here's how the data validators can be used in a real class:: self.kind = kind self.quantity = quantity -The descriptors prevent invalid instances from being created:: +The descriptors prevent invalid instances from being created: + +.. doctest:: + + >>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all uppercase + Traceback (most recent call last): + ... + ValueError: Expected to be true for 'Widget' - Component('WIDGET', 'metal', 5) # Allowed. - Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all uppercase - Component('WIDGET', 'metle', 5) # Blocked: 'metle' is misspelled - Component('WIDGET', 'metal', -5) # Blocked: -5 is negative - Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number + >>> Component('WIDGET', 'metle', 5) # Blocked: 'metle' is misspelled + Traceback (most recent call last): + ... + ValueError: Expected 'metle' to be one of {'metal', 'plastic', 'wood'} + + >>> Component('WIDGET', 'metal', -5) # Blocked: -5 is negative + Traceback (most recent call last): + ... + ValueError: Expected -5 to be at least 0 + >>> Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number + Traceback (most recent call last): + ... + TypeError: Expected 'V' to be an int or float + + >>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid Technical Tutorial @@ -435,23 +489,21 @@ Defines descriptors, summarizes the protocol, and shows how descriptors are called. Provides an example showing how object relational mappings work. Learning about descriptors not only provides access to a larger toolset, it -creates a deeper understanding of how Python works and an appreciation for the -elegance of its design. +creates a deeper understanding of how Python works. Definition and introduction --------------------------- -In general, a descriptor is an object attribute with "binding behavior", one -whose attribute access has been overridden by methods in the descriptor -protocol. Those methods are :meth:`__get__`, :meth:`__set__`, and -:meth:`__delete__`. If any of those methods are defined for an object, it is -said to be a :term:`descriptor`. +In general, a descriptor is an attribute value that has one of the methods in +the descriptor protocol. Those methods are :meth:`__get__`, :meth:`__set__`, +and :meth:`__delete__`. If any of those methods are defined for an the +attribute, it is said to be a :term:`descriptor`. The default behavior for attribute access is to get, set, or delete the attribute from an object's dictionary. For instance, ``a.x`` has a lookup chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and -continuing through the base classes of ``type(a)``. If the +continuing through the method resolution order of ``type(a)``. If the looked-up value is an object defining one of the descriptor methods, then Python may override the default behavior and invoke the descriptor method instead. Where this occurs in the precedence chain depends on which descriptor methods @@ -479,7 +531,7 @@ as an attribute. If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered a data descriptor. Descriptors that only define :meth:`__get__` are called -non-data descriptors (they are typically used for methods but other uses are +non-data descriptors (they are often used for methods but other uses are possible). Data and non-data descriptors differ in how overrides are calculated with @@ -504,8 +556,9 @@ But it is more common for a descriptor to be invoked automatically from attribute access. The expression ``obj.x`` looks up the attribute ``x`` in the chain of -namespaces for ``obj``. If the search finds a descriptor, its :meth:`__get__` -method is invoked according to the precedence rules listed below. +namespaces for ``obj``. If the search finds a descriptor outside of the +instance ``__dict__``, its :meth:`__get__` method is invoked according to the +precedence rules listed below. The details of invocation depend on whether ``obj`` is an object, class, or instance of super. @@ -523,31 +576,145 @@ If a descriptor is found for ``a.x``, then it is invoked with: ``desc.__get__(a, type(a))``. The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here is -a pure Python equivalent:: +a pure Python equivalent: + +.. testcode:: def object_getattribute(obj, name): "Emulate PyObject_GenericGetAttr() in Objects/object.c" null = object() objtype = type(obj) - value = getattr(objtype, name, null) - if value is not null and hasattr(value, '__get__'): - if hasattr(value, '__set__') or hasattr(value, '__delete__'): - return value.__get__(obj, objtype) # data descriptor - try: - return vars(obj)[name] # instance variable - except (KeyError, TypeError): - pass - if hasattr(value, '__get__'): - return value.__get__(obj, objtype) # non-data descriptor - if value is not null: - return value # class variable - # Emulate slot_tp_getattr_hook() in Objects/typeobject.c - if hasattr(objtype, '__getattr__'): - return objtype.__getattr__(obj, name) # __getattr__ hook + cls_var = getattr(objtype, name, null) + descr_get = getattr(type(cls_var), '__get__', null) + if descr_get is not null: + if (hasattr(type(cls_var), '__set__') + or hasattr(type(cls_var), '__delete__')): + return descr_get(cls_var, obj, objtype) # data descriptor + if hasattr(obj, '__dict__') and name in vars(obj): + return vars(obj)[name] # instance variable + if descr_get is not null: + return descr_get(cls_var, obj, objtype) # non-data descriptor + if cls_var is not null: + return cls_var # class variable raise AttributeError(name) -The :exc:`TypeError` exception handler is needed because the instance dictionary -doesn't exist when its class defines :term:`__slots__`. + +.. testcode:: + :hide: + + # Test the fidelity of object_getattribute() by comparing it with the + # normal object.__getattribute__(). The former will be accessed by + # square brackets and the latter by the dot operator. + + class Object: + + def __getitem__(obj, name): + try: + return object_getattribute(obj, name) + except AttributeError: + if not hasattr(type(obj), '__getattr__'): + raise + return type(obj).__getattr__(obj, name) # __getattr__ + + class DualOperator(Object): + + x = 10 + + def __init__(self, z): + self.z = z + + @property + def p2(self): + return 2 * self.x + + @property + def p3(self): + return 3 * self.x + + def m5(self, y): + return 5 * y + + def m7(self, y): + return 7 * y + + def __getattr__(self, name): + return ('getattr_hook', self, name) + + class DualOperatorWithSlots: + + __getitem__ = Object.__getitem__ + + __slots__ = ['z'] + + x = 15 + + def __init__(self, z): + self.z = z + + @property + def p2(self): + return 2 * self.x + + def m5(self, y): + return 5 * y + + def __getattr__(self, name): + return ('getattr_hook', self, name) + + +.. doctest:: + :hide: + + >>> a = DualOperator(11) + >>> vars(a).update(p3 = '_p3', m7 = '_m7') + >>> a.x == a['x'] == 10 + True + >>> a.z == a['z'] == 11 + True + >>> a.p2 == a['p2'] == 20 + True + >>> a.p3 == a['p3'] == 30 + True + >>> a.m5(100) == a.m5(100) == 500 + True + >>> a.m7 == a['m7'] == '_m7' + True + >>> a.g == a['g'] == ('getattr_hook', a, 'g') + True + + >>> b = DualOperatorWithSlots(22) + >>> b.x == b['x'] == 15 + True + >>> b.z == b['z'] == 22 + True + >>> b.p2 == b['p2'] == 30 + True + >>> b.m5(200) == b['m5'](200) == 1000 + True + >>> b.g == b['g'] == ('getattr_hook', b, 'g') + True + + +Interestingly, attribute lookup doesn't call :meth:`object.__getattribute__` +directly. Instead, both the dot operator and the :func:`getattr` function +perform attribute lookup by way of a helper function: + +.. testcode:: + + def getattr_hook(obj, name): + "Emulate slot_tp_getattr_hook() in Objects/typeobject.c" + try: + return obj.__getattribute__(name) + except AttributeError: + if not hasattr(type(obj), '__getattr__'): + raise + return type(obj).__getattr__(obj, name) # __getattr__ + +So if :meth:`__getattr__` exists, it is called whenever :meth:`__getattribute__` +raises :exc:`AttributeError` (either directly or in one of the descriptor calls). + +Also, if a user calls :meth:`object.__getattribute__` directly, the +:meth:`__getattr__` hook is bypassed entirely. Invocation from a class @@ -634,7 +801,9 @@ be used to implement an `object relational mapping The essential idea is that the data is stored in an external database. The Python instances only hold keys to the database's tables. Descriptors take -care of lookups or updates:: +care of lookups or updates: + +.. testcode:: class Field: @@ -649,8 +818,11 @@ care of lookups or updates:: conn.execute(self.store, [value, obj.key]) conn.commit() -We can use the :class:`Field` class to define "models" that describe the schema -for each table in a database:: +We can use the :class:`Field` class to define `models +`_ that describe the schema for +each table in a database: + +.. testcode:: class Movie: table = 'Movies' # Table name @@ -671,12 +843,41 @@ for each table in a database:: def __init__(self, key): self.key = key -An interactive session shows how data is retrieved from the database and how -it can be updated:: +To use the models, first connect to the database:: >>> import sqlite3 >>> conn = sqlite3.connect('entertainment.db') +An interactive session shows how data is retrieved from the database and how +it can be updated: + +.. testsetup:: + + song_data = [ + ('Country Roads', 'John Denver', 1972), + ('Me and Bobby McGee', 'Janice Joplin', 1971), + ('Coal Miners Daughter', 'Loretta Lynn', 1970), + ] + + movie_data = [ + ('Star Wars', 'George Lucas', 1977), + ('Jaws', 'Steven Spielberg', 1975), + ('Aliens', 'James Cameron', 1986), + ] + + import sqlite3 + + conn = sqlite3.connect(':memory:') + conn.execute('CREATE TABLE Music (title text, artist text, year integer);') + conn.execute('CREATE INDEX MusicNdx ON Music (title);') + conn.executemany('INSERT INTO Music VALUES (?, ?, ?);', song_data) + conn.execute('CREATE TABLE Movies (title text, director text, year integer);') + conn.execute('CREATE INDEX MovieNdx ON Music (title);') + conn.executemany('INSERT INTO Movies VALUES (?, ?, ?);', movie_data) + conn.commit() + +.. doctest:: + >>> Movie('Star Wars').director 'George Lucas' >>> jaws = Movie('Jaws') @@ -690,6 +891,7 @@ it can be updated:: >>> Movie('Star Wars').director 'J.J. Abrams' + Pure Python Equivalents ^^^^^^^^^^^^^^^^^^^^^^^ @@ -707,7 +909,9 @@ triggers a function call upon access to an attribute. Its signature is:: property(fget=None, fset=None, fdel=None, doc=None) -> property -The documentation shows a typical use to define a managed attribute ``x``:: +The documentation shows a typical use to define a managed attribute ``x``: + +.. testcode:: class C: def getx(self): return self.__x @@ -716,7 +920,9 @@ The documentation shows a typical use to define a managed attribute ``x``:: x = property(getx, setx, delx, "I'm the 'x' property.") To see how :func:`property` is implemented in terms of the descriptor protocol, -here is a pure Python equivalent:: +here is a pure Python equivalent: + +.. testcode:: class Property: "Emulate PyProperty_Type() in Objects/descrobject.c" @@ -755,6 +961,57 @@ here is a pure Python equivalent:: def deleter(self, fdel): return type(self)(self.fget, self.fset, fdel, self.__doc__) +.. testcode:: + :hide: + + # Verify the Property() emulation + + class CC: + def getx(self): + return self.__x + def setx(self, value): + self.__x = value + def delx(self): + del self.__x + x = Property(getx, setx, delx, "I'm the 'x' property.") + + # Now do it again but use the decorator style + + class CCC: + @Property + def x(self): + return self.__x + @x.setter + def x(self, value): + self.__x = value + @x.deleter + def x(self): + del self.__x + + +.. doctest:: + :hide: + + >>> cc = CC() + >>> hasattr(cc, 'x') + False + >>> cc.x = 33 + >>> cc.x + 33 + >>> del cc.x + >>> hasattr(cc, 'x') + False + + >>> ccc = CCC() + >>> hasattr(ccc, 'x') + False + >>> ccc.x = 333 + >>> ccc.x == 333 + True + >>> del ccc.x + >>> hasattr(ccc, 'x') + False + The :func:`property` builtin helps whenever a user interface has granted attribute access and then subsequent changes require the intervention of a method. @@ -763,7 +1020,9 @@ For instance, a spreadsheet class may grant access to a cell value through ``Cell('b10').value``. Subsequent improvements to the program require the cell to be recalculated on every access; however, the programmer does not want to affect existing client code accessing the attribute directly. The solution is -to wrap access to the value attribute in a property data descriptor:: +to wrap access to the value attribute in a property data descriptor: + +.. testcode:: class Cell: ... @@ -774,6 +1033,9 @@ to wrap access to the value attribute in a property data descriptor:: self.recalc() return self._value +Either the built-in :func:`property` or our :func:`Property` equivalent would +work in this example. + Functions and methods --------------------- @@ -787,7 +1049,9 @@ prepended to the other arguments. By convention, the instance is called *self* but could be called *this* or any other variable name. Methods can be created manually with :class:`types.MethodType` which is -roughly equivalent to:: +roughly equivalent to: + +.. testcode:: class MethodType: "Emulate Py_MethodType in Objects/classobject.c" @@ -804,7 +1068,9 @@ roughly equivalent to:: To support automatic creation of methods, functions include the :meth:`__get__` method for binding methods during attribute access. This means that functions are non-data descriptors that return bound methods -during dotted lookup from an instance. Here's how it works:: +during dotted lookup from an instance. Here's how it works: + +.. testcode:: class Function: ... @@ -816,13 +1082,17 @@ during dotted lookup from an instance. Here's how it works:: return MethodType(self, obj) Running the following class in the interpreter shows how the function -descriptor works in practice:: +descriptor works in practice: + +.. testcode:: class D: def f(self, x): return x -The function has a :term:`qualified name` attribute to support introspection:: +The function has a :term:`qualified name` attribute to support introspection: + +.. doctest:: >>> D.f.__qualname__ 'D.f' @@ -850,7 +1120,7 @@ Internally, the bound method stores the underlying function and the bound instance:: >>> d.f.__func__ - + >>> d.f.__self__ <__main__.D object at 0x1012e1f98> @@ -902,20 +1172,26 @@ It can be called either from an object or the class: ``s.erf(1.5) --> .9332`` o ``Sample.erf(1.5) --> .9332``. Since static methods return the underlying function with no changes, the -example calls are unexciting:: +example calls are unexciting: + +.. testcode:: class E: @staticmethod def f(x): print(x) +.. doctest:: + >>> E.f(3) 3 >>> E().f(3) 3 Using the non-data descriptor protocol, a pure Python version of -:func:`staticmethod` would look like this:: +:func:`staticmethod` would look like this: + +.. doctest:: class StaticMethod: "Emulate PyStaticMethod_Type() in Objects/funcobject.c" @@ -932,27 +1208,31 @@ Class methods Unlike static methods, class methods prepend the class reference to the argument list before calling the function. This format is the same -for whether the caller is an object or a class:: +for whether the caller is an object or a class: + +.. testcode:: class F: @classmethod def f(cls, x): return cls.__name__, x - >>> print(F.f(3)) +.. doctest:: + + >>> F.f(3) ('F', 3) - >>> print(F().f(3)) + >>> F().f(3) ('F', 3) This behavior is useful whenever the method only needs to have a class -reference and does rely on data stored in a specific instance. One use for +reference and does not rely on data stored in a specific instance. One use for class methods is to create alternate class constructors. For example, the classmethod :func:`dict.fromkeys` creates a new dictionary from a list of -keys. The pure Python equivalent is:: +keys. The pure Python equivalent is: - class Dict: - ... +.. testcode:: + class Dict(dict): @classmethod def fromkeys(cls, iterable, value=None): "Emulate dict_fromkeys() in Objects/dictobject.c" @@ -961,13 +1241,20 @@ keys. The pure Python equivalent is:: d[key] = value return d -Now a new dictionary of unique keys can be constructed like this:: +Now a new dictionary of unique keys can be constructed like this: + +.. doctest:: - >>> Dict.fromkeys('abracadabra') - {'a': None, 'r': None, 'b': None, 'c': None, 'd': None} + >>> d = Dict.fromkeys('abracadabra') + >>> type(d) is Dict + True + >>> d + {'a': None, 'b': None, 'r': None, 'c': None, 'd': None} Using the non-data descriptor protocol, a pure Python version of -:func:`classmethod` would look like this:: +:func:`classmethod` would look like this: + +.. testcode:: class ClassMethod: "Emulate PyClassMethod_Type() in Objects/funcobject.c" @@ -982,9 +1269,31 @@ Using the non-data descriptor protocol, a pure Python version of return self.f.__get__(cls) return MethodType(self.f, cls) +.. testcode:: + :hide: + + # Verify the emulation works + class T: + @ClassMethod + def cm(cls, x, y): + return (cls, x, y) + +.. doctest:: + :hide: + + >>> T.cm(11, 22) + (, 11, 22) + + # Also call it from an instance + >>> t = T() + >>> t.cm(11, 22) + (, 11, 22) + The code path for ``hasattr(obj, '__get__')`` was added in Python 3.9 and makes it possible for :func:`classmethod` to support chained decorators. -For example, a classmethod and property could be chained together:: +For example, a classmethod and property could be chained together: + +.. testcode:: class G: @classmethod @@ -992,6 +1301,12 @@ For example, a classmethod and property could be chained together:: def __doc__(cls): return f'A doc for {cls.__name__!r}' +.. doctest:: + + >>> G.__doc__ + "A doc for 'G'" + + Member objects and __slots__ ---------------------------- @@ -1000,11 +1315,15 @@ fixed-length array of slot values. From a user point of view that has several effects: 1. Provides immediate detection of bugs due to misspelled attribute -assignments. Only attribute names specified in ``__slots__`` are allowed:: +assignments. Only attribute names specified in ``__slots__`` are allowed: + +.. testcode:: class Vehicle: __slots__ = ('id_number', 'make', 'model') +.. doctest:: + >>> auto = Vehicle() >>> auto.id_nubmer = 'VYE483814LQEX' Traceback (most recent call last): @@ -1012,7 +1331,9 @@ assignments. Only attribute names specified in ``__slots__`` are allowed:: AttributeError: 'Vehicle' object has no attribute 'id_nubmer' 2. Helps create immutable objects where descriptors manage access to private -attributes stored in ``__slots__``:: +attributes stored in ``__slots__``: + +.. testcode:: class Immutable: @@ -1030,7 +1351,19 @@ attributes stored in ``__slots__``:: def name(self): # Read-only descriptor return self._name - mark = Immutable('Botany', 'Mark Watney') # Create an immutable instance +.. doctest:: + + >>> mark = Immutable('Botany', 'Mark Watney') + >>> mark.dept + 'Botany' + >>> mark.dept = 'Space Pirate' + Traceback (most recent call last): + ... + AttributeError: can't set attribute + >>> mark.location = 'Mars' + Traceback (most recent call last): + ... + AttributeError: 'Immutable' object has no attribute 'location' 3. Saves memory. On a 64-bit Linux build, an instance with two attributes takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight @@ -1038,7 +1371,9 @@ design pattern `_ likely only matters when a large number of instances are going to be created. 4. Blocks tools like :func:`functools.cached_property` which require an -instance dictionary to function correctly:: +instance dictionary to function correctly: + +.. testcode:: from functools import cached_property @@ -1050,17 +1385,23 @@ instance dictionary to function correctly:: return 4 * sum((-1.0)**n / (2.0*n + 1.0) for n in reversed(range(100_000))) +.. doctest:: + >>> CP().pi Traceback (most recent call last): ... TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property. -It's not possible to create an exact drop-in pure Python version of +It is not possible to create an exact drop-in pure Python version of ``__slots__`` because it requires direct access to C structures and control over object memory allocation. However, we can build a mostly faithful simulation where the actual C structure for slots is emulated by a private ``_slotvalues`` list. Reads and writes to that private structure are managed -by member descriptors:: +by member descriptors: + +.. testcode:: + + null = object() class Member: @@ -1074,20 +1415,30 @@ by member descriptors:: def __get__(self, obj, objtype=None): 'Emulate member_get() in Objects/descrobject.c' # Also see PyMember_GetOne() in Python/structmember.c - return obj._slotvalues[self.offset] + value = obj._slotvalues[self.offset] + if value is null: + raise AttributeError(self.name) + return value def __set__(self, obj, value): 'Emulate member_set() in Objects/descrobject.c' obj._slotvalues[self.offset] = value + def __delete__(self, obj): + 'Emulate member_delete() in Objects/descrobject.c' + value = obj._slotvalues[self.offset] + if value is null: + raise AttributeError(self.name) + obj._slotvalues[self.offset] = null + def __repr__(self): 'Emulate member_repr() in Objects/descrobject.c' return f'' The :meth:`type.__new__` method takes care of adding member objects to class -variables. The :meth:`object.__new__` method takes care of creating instances -that have slots instead of an instance dictionary. Here is a rough equivalent -in pure Python:: +variables: + +.. testcode:: class Type(type): 'Simulate how the type metaclass adds member objects for slots' @@ -1100,6 +1451,12 @@ in pure Python:: mapping[name] = Member(name, clsname, offset) return type.__new__(mcls, clsname, bases, mapping) +The :meth:`object.__new__` method takes care of creating instances that have +slots instead of an instance dictionary. Here is a rough simulation in pure +Python: + +.. testcode:: + class Object: 'Simulate how object.__new__() allocates memory for __slots__' @@ -1107,13 +1464,35 @@ in pure Python:: 'Emulate object_new() in Objects/typeobject.c' inst = super().__new__(cls) if hasattr(cls, 'slot_names'): - inst._slotvalues = [None] * len(cls.slot_names) + empty_slots = [null] * len(cls.slot_names) + object.__setattr__(inst, '_slotvalues', empty_slots) return inst + def __setattr__(self, name, value): + 'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c' + cls = type(self) + if hasattr(cls, 'slot_names') and name not in cls.slot_names: + raise AttributeError( + f'{type(self).__name__!r} object has no attribute {name!r}' + ) + super().__setattr__(name, value) + + def __delattr__(self, name): + 'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c' + cls = type(self) + if hasattr(cls, 'slot_names') and name not in cls.slot_names: + raise AttributeError( + f'{type(self).__name__!r} object has no attribute {name!r}' + ) + super().__delattr__(name) + To use the simulation in a real class, just inherit from :class:`Object` and -set the :term:`metaclass` to :class:`Type`:: +set the :term:`metaclass` to :class:`Type`: + +.. testcode:: class H(Object, metaclass=Type): + 'Instance variables stored in slots' slot_names = ['x', 'y'] @@ -1123,17 +1502,29 @@ set the :term:`metaclass` to :class:`Type`:: At this point, the metaclass has loaded member objects for *x* and *y*:: - >>> import pprint - >>> pprint.pp(dict(vars(H))) + >>> from pprint import pp + >>> pp(dict(vars(H))) {'__module__': '__main__', + '__doc__': 'Instance variables stored in slots', 'slot_names': ['x', 'y'], '__init__': , 'x': , - 'y': , - '__doc__': None} + 'y': } + +.. doctest:: + :hide: + + # We test this separately because the preceding section is not + # doctestable due to the hex memory address for the __init__ function + >>> isinstance(vars(H)['x'], Member) + True + >>> isinstance(vars(H)['y'], Member) + True When instances are created, they have a ``slot_values`` list where the -attributes are stored:: +attributes are stored: + +.. doctest:: >>> h = H(10, 20) >>> vars(h) @@ -1142,8 +1533,30 @@ attributes are stored:: >>> vars(h) {'_slotvalues': [55, 20]} -Unlike the real ``__slots__``, this simulation does have an instance -dictionary just to hold the ``_slotvalues`` array. So, unlike the real code, -this simulation doesn't block assignments to misspelled attributes:: +Misspelled or unassigned attributes will raise an exception: + +.. doctest:: - >>> h.xz = 30 # For actual __slots__ this would raise an AttributeError + >>> h.xz + Traceback (most recent call last): + ... + AttributeError: 'H' object has no attribute 'xz' + +.. doctest:: + :hide: + + # Examples for deleted attributes are not shown because this section + # is already a bit lengthy. We still test that code here. + >>> del h.x + >>> hasattr(h, 'x') + False + + # Also test the code for uninitialized slots + >>> class HU(Object, metaclass=Type): + ... slot_names = ['x', 'y'] + ... + >>> hu = HU() + >>> hasattr(hu, 'x') + False + >>> hasattr(hu, 'y') + False diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index 3a7414d7358e7a..1a6ed474ff21da 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -336,6 +336,7 @@ The :mod:`abc` module also provides the following functions: .. versionadded:: 3.4 .. function:: update_abstractmethods(cls) + A function to recalculate an abstract class's abstraction status. This function should be called if a class's abstract methods have been implemented or changed after it was created. Usually, this function should @@ -343,7 +344,7 @@ The :mod:`abc` module also provides the following functions: Returns *cls*, to allow usage as a class decorator. - If *cls* is not an instance of ABCMeta, does nothing. + If *cls* is not an instance of :class:`ABCMeta`, does nothing. .. note:: diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 7a7a4cf94979a1..02cd70f4f71cd6 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -696,7 +696,7 @@ The add_argument() method * const_ - A constant value required by some action_ and nargs_ selections. * default_ - The value produced if the argument is absent from the - command line. + command line and if it is absent from the namespace object. * type_ - The type to which the command-line argument should be converted. @@ -1006,6 +1006,14 @@ was not present at the command line:: >>> parser.parse_args([]) Namespace(foo=42) +If the target namespace already has an attribute set, the action *default* +will not over write it:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--foo', default=42) + >>> parser.parse_args([], namespace=argparse.Namespace(foo=101)) + Namespace(foo=101) + If the ``default`` value is a string, the parser parses the value as if it were a command-line argument. In particular, the parser applies any type_ conversion argument, if provided, before setting the attribute on the @@ -1133,20 +1141,9 @@ container should match the type_ specified:: Any container can be passed as the *choices* value, so :class:`list` objects, :class:`set` objects, and custom containers are all supported. -This includes :class:`enum.Enum`, which could be used to restrain -argument's choices; if we reuse previous rock/paper/scissors game example, -this could be as follows:: - - >>> from enum import Enum - >>> class GameMove(Enum): - ... ROCK = 'rock' - ... PAPER = 'paper' - ... SCISSORS = 'scissors' - ... - >>> parser = argparse.ArgumentParser(prog='game.py') - >>> parser.add_argument('move', type=GameMove, choices=GameMove) - >>> parser.parse_args(['rock']) - Namespace(move=) + +Use of :class:`enum.Enum` is not recommended because it is difficult to +control its appearance in usage, help, and error messages. required diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index b1e73189a7a4cf..15b5b3fe822ce8 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1184,10 +1184,13 @@ Allows customizing how exceptions are handled in the event loop. * 'message': Error message; * 'exception' (optional): Exception object; * 'future' (optional): :class:`asyncio.Future` instance; + * 'task' (optional): :class:`asyncio.Task` instance; * 'handle' (optional): :class:`asyncio.Handle` instance; * 'protocol' (optional): :ref:`Protocol ` instance; * 'transport' (optional): :ref:`Transport ` instance; - * 'socket' (optional): :class:`socket.socket` instance. + * 'socket' (optional): :class:`socket.socket` instance; + * 'asyncgen' (optional): Asynchronous generator that caused + the exception. .. note:: diff --git a/Doc/library/asyncio-policy.rst b/Doc/library/asyncio-policy.rst index 88e69ceff9adc1..5e69525e90dd27 100644 --- a/Doc/library/asyncio-policy.rst +++ b/Doc/library/asyncio-policy.rst @@ -209,7 +209,7 @@ implementation used by the asyncio event loop: It works reliably even when the asyncio event loop is run in a non-main OS thread. There is no noticeable overhead when handling a big number of children (*O(1)* each - time a child terminates), but stating a thread per process requires extra memory. + time a child terminates), but starting a thread per process requires extra memory. This watcher is used by default. diff --git a/Doc/library/asyncio-queue.rst b/Doc/library/asyncio-queue.rst index 524560b691d720..289ad1b014c356 100644 --- a/Doc/library/asyncio-queue.rst +++ b/Doc/library/asyncio-queue.rst @@ -23,7 +23,7 @@ See also the `Examples`_ section below. Queue ===== -.. class:: Queue(maxsize=0, \*, loop=None) +.. class:: Queue(maxsize=0) A first in, first out (FIFO) queue. @@ -36,9 +36,6 @@ Queue the queue is always known and can be returned by calling the :meth:`qsize` method. - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - This class is :ref:`not thread safe `. diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index b76ed379c7f4c8..bee47bcdcbf21a 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -49,8 +49,8 @@ and work with streams: .. coroutinefunction:: open_connection(host=None, port=None, \*, \ - loop=None, limit=None, ssl=None, family=0, \ - proto=0, flags=0, sock=None, local_addr=None, \ + limit=None, ssl=None, family=0, proto=0, \ + flags=0, sock=None, local_addr=None, \ server_hostname=None, ssl_handshake_timeout=None) Establish a network connection and return a pair of @@ -59,9 +59,6 @@ and work with streams: The returned *reader* and *writer* objects are instances of :class:`StreamReader` and :class:`StreamWriter` classes. - The *loop* argument is optional and can always be determined - automatically when this function is awaited from a coroutine. - *limit* determines the buffer size limit used by the returned :class:`StreamReader` instance. By default the *limit* is set to 64 KiB. @@ -74,7 +71,7 @@ and work with streams: The *ssl_handshake_timeout* parameter. .. coroutinefunction:: start_server(client_connected_cb, host=None, \ - port=None, \*, loop=None, limit=None, \ + port=None, \*, limit=None, \ family=socket.AF_UNSPEC, \ flags=socket.AI_PASSIVE, sock=None, \ backlog=100, ssl=None, reuse_address=None, \ @@ -92,9 +89,6 @@ and work with streams: :ref:`coroutine function `; if it is a coroutine function, it will be automatically scheduled as a :class:`Task`. - The *loop* argument is optional and can always be determined - automatically when this method is awaited from a coroutine. - *limit* determines the buffer size limit used by the returned :class:`StreamReader` instance. By default the *limit* is set to 64 KiB. @@ -109,9 +103,9 @@ and work with streams: .. rubric:: Unix Sockets -.. coroutinefunction:: open_unix_connection(path=None, \*, loop=None, \ - limit=None, ssl=None, sock=None, \ - server_hostname=None, ssl_handshake_timeout=None) +.. coroutinefunction:: open_unix_connection(path=None, \*, limit=None, \ + ssl=None, sock=None, server_hostname=None, \ + ssl_handshake_timeout=None) Establish a Unix socket connection and return a pair of ``(reader, writer)``. @@ -132,9 +126,8 @@ and work with streams: .. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \ - \*, loop=None, limit=None, sock=None, \ - backlog=100, ssl=None, ssl_handshake_timeout=None, \ - start_serving=True) + \*, limit=None, sock=None, backlog=100, ssl=None, \ + ssl_handshake_timeout=None, start_serving=True) Start a Unix socket server. diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index b0330349dfb651..ea674302bd9d6a 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -62,8 +62,7 @@ Creating Subprocesses ===================== .. coroutinefunction:: create_subprocess_exec(program, \*args, stdin=None, \ - stdout=None, stderr=None, loop=None, \ - limit=None, \*\*kwds) + stdout=None, stderr=None, limit=None, \*\*kwds) Create a subprocess. @@ -76,13 +75,9 @@ Creating Subprocesses See the documentation of :meth:`loop.subprocess_exec` for other parameters. - .. deprecated-removed:: 3.8 3.10 - - The *loop* parameter. .. coroutinefunction:: create_subprocess_shell(cmd, stdin=None, \ - stdout=None, stderr=None, loop=None, \ - limit=None, \*\*kwds) + stdout=None, stderr=None, limit=None, \*\*kwds) Run the *cmd* shell command. @@ -104,10 +99,6 @@ Creating Subprocesses escape whitespace and special shell characters in strings that are going to be used to construct shell commands. - .. deprecated-removed:: 3.8 3.10 - - The *loop* parameter. - .. note:: Subprocesses are available for Windows if a :class:`ProactorEventLoop` is diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst index 84a52cb2d57571..a7688d5120efda 100644 --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -36,7 +36,7 @@ asyncio has the following basic synchronization primitives: Lock ==== -.. class:: Lock(\*, loop=None) +.. class:: Lock() Implements a mutex lock for asyncio tasks. Not thread-safe. @@ -63,9 +63,6 @@ Lock finally: lock.release() - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - .. coroutinemethod:: acquire() Acquire the lock. @@ -96,7 +93,7 @@ Lock Event ===== -.. class:: Event(\*, loop=None) +.. class:: Event() An event object. Not thread-safe. @@ -108,10 +105,6 @@ Event :meth:`clear` method. The :meth:`wait` method blocks until the flag is set to *true*. The flag is set to *false* initially. - - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - .. _asyncio_example_sync_event: Example:: @@ -166,7 +159,7 @@ Event Condition ========= -.. class:: Condition(lock=None, \*, loop=None) +.. class:: Condition(lock=None) A Condition object. Not thread-safe. @@ -184,10 +177,6 @@ Condition ``None``. In the latter case a new Lock object is created automatically. - - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - The preferred way to use a Condition is an :keyword:`async with` statement:: @@ -270,7 +259,7 @@ Condition Semaphore ========= -.. class:: Semaphore(value=1, \*, loop=None) +.. class:: Semaphore(value=1) A Semaphore object. Not thread-safe. @@ -284,10 +273,6 @@ Semaphore internal counter (``1`` by default). If the given value is less than ``0`` a :exc:`ValueError` is raised. - - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - The preferred way to use a Semaphore is an :keyword:`async with` statement:: @@ -332,7 +317,7 @@ Semaphore BoundedSemaphore ================ -.. class:: BoundedSemaphore(value=1, \*, loop=None) +.. class:: BoundedSemaphore(value=1) A bounded semaphore object. Not thread-safe. @@ -340,10 +325,6 @@ BoundedSemaphore a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the internal counter above the initial *value*. - - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - --------- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index eb51c704cea394..73ada0e2f006cd 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -283,7 +283,7 @@ Creating Tasks Sleeping ======== -.. coroutinefunction:: sleep(delay, result=None, \*, loop=None) +.. coroutinefunction:: sleep(delay, result=None) Block for *delay* seconds. @@ -293,9 +293,6 @@ Sleeping ``sleep()`` always suspends the current task, allowing other tasks to run. - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - .. _asyncio_example_sleep: Example of coroutine displaying the current date every second @@ -319,7 +316,7 @@ Sleeping Running Tasks Concurrently ========================== -.. awaitablefunction:: gather(\*aws, loop=None, return_exceptions=False) +.. awaitablefunction:: gather(\*aws, return_exceptions=False) Run :ref:`awaitable objects ` in the *aws* sequence *concurrently*. @@ -348,9 +345,6 @@ Running Tasks Concurrently cancellation of one submitted Task/Future to cause other Tasks/Futures to be cancelled. - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - .. _asyncio_example_gather: Example:: @@ -403,7 +397,7 @@ Running Tasks Concurrently Shielding From Cancellation =========================== -.. awaitablefunction:: shield(aw, \*, loop=None) +.. awaitablefunction:: shield(aw) Protect an :ref:`awaitable object ` from being :meth:`cancelled `. @@ -436,14 +430,11 @@ Shielding From Cancellation except CancelledError: res = None - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - Timeouts ======== -.. coroutinefunction:: wait_for(aw, timeout, \*, loop=None) +.. coroutinefunction:: wait_for(aw, timeout) Wait for the *aw* :ref:`awaitable ` to complete with a timeout. @@ -466,9 +457,6 @@ Timeouts If the wait is cancelled, the future *aw* is also cancelled. - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - .. _asyncio_example_waitfor: Example:: @@ -500,8 +488,7 @@ Timeouts Waiting Primitives ================== -.. coroutinefunction:: wait(aws, \*, loop=None, timeout=None,\ - return_when=ALL_COMPLETED) +.. coroutinefunction:: wait(aws, \*, timeout=None, return_when=ALL_COMPLETED) Run :ref:`awaitable objects ` in the *aws* iterable concurrently and block until the condition specified @@ -553,10 +540,6 @@ Waiting Primitives ``wait()`` directly is deprecated as it leads to :ref:`confusing behavior `. - .. deprecated-removed:: 3.8 3.10 - - The *loop* parameter. - .. _asyncio_example_wait_coroutine: .. note:: @@ -590,7 +573,7 @@ Waiting Primitives deprecated. -.. function:: as_completed(aws, \*, loop=None, timeout=None) +.. function:: as_completed(aws, \*, timeout=None) Run :ref:`awaitable objects ` in the *aws* iterable concurrently. Return an iterator of coroutines. @@ -600,9 +583,6 @@ Waiting Primitives Raises :exc:`asyncio.TimeoutError` if the timeout occurs before all Futures are done. - .. deprecated-removed:: 3.8 3.10 - The *loop* parameter. - Example:: for coro in as_completed(aws): @@ -618,7 +598,7 @@ Running in Threads Asynchronously run function *func* in a separate thread. Any \*args and \*\*kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propogated, + to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the event loop thread to be accessed in the separate thread. diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst index 85cdc16a7d78d4..637baf49da1fc0 100644 --- a/Doc/library/bz2.rst +++ b/Doc/library/bz2.rst @@ -266,7 +266,6 @@ Below are some examples of typical usage of the :mod:`bz2` module. Using :func:`compress` and :func:`decompress` to demonstrate round-trip compression: >>> import bz2 - >>> data = b"""\ ... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue ... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem, @@ -275,11 +274,9 @@ Using :func:`compress` and :func:`decompress` to demonstrate round-trip compress ... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo ... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum ... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum.""" - >>> c = bz2.compress(data) >>> len(data) / len(c) # Data compression ratio 1.513595166163142 - >>> d = bz2.decompress(c) >>> data == d # Check equality to original object after round-trip True @@ -287,7 +284,6 @@ Using :func:`compress` and :func:`decompress` to demonstrate round-trip compress Using :class:`BZ2Compressor` for incremental compression: >>> import bz2 - >>> def gen_data(chunks=10, chunksize=1000): ... """Yield incremental blocks of chunksize bytes.""" ... for _ in range(chunks): @@ -310,7 +306,6 @@ while ordered, repetitive data usually yields a high compression ratio. Writing and reading a bzip2-compressed file in binary mode: >>> import bz2 - >>> data = b"""\ ... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue ... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem, @@ -319,14 +314,11 @@ Writing and reading a bzip2-compressed file in binary mode: ... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo ... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum ... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum.""" - >>> with bz2.open("myfile.bz2", "wb") as f: ... # Write compressed data to file ... unused = f.write(data) - >>> with bz2.open("myfile.bz2", "rb") as f: ... # Decompress data from file ... content = f.read() - >>> content == data # Check equality to original object after round-trip True diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst index db0e25bb0772eb..2345e78a17e4f5 100644 --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -291,7 +291,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin: :meth:`_from_iterable` which calls ``cls(iterable)`` to produce a new set. If the :class:`Set` mixin is being used in a class with a different constructor signature, you will need to override :meth:`_from_iterable` - with a classmethod that can construct new instances from + with a classmethod or regular method that can construct new instances from an iterable argument. (2) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index f538da5e1c9faa..1293f542b04377 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -862,6 +862,9 @@ they add the ability to access fields by name instead of position index. Named tuple instances do not have per-instance dictionaries, so they are lightweight and require no more memory than regular tuples. + To support pickling, the named tuple class should be assigned to a variable + that matches *typename*. + .. versionchanged:: 3.1 Added support for *rename*. diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 6ee2f610713904..3a080d53f86145 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -885,7 +885,7 @@ All of the following opcodes use their arguments. .. opcode:: LIST_TO_TUPLE - Pops a list from the stack and pushes a tuple containing the same values. + Pops a list from the stack and pushes a tuple containing the same values. .. versionadded:: 3.9 @@ -913,7 +913,7 @@ All of the following opcodes use their arguments. .. opcode:: DICT_MERGE - Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys. + Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys. .. versionadded:: 3.9 @@ -931,14 +931,14 @@ All of the following opcodes use their arguments. .. opcode:: IS_OP (invert) - Performs ``is`` comparison, or ``is not`` if ``invert`` is 1. + Performs ``is`` comparison, or ``is not`` if ``invert`` is 1. .. versionadded:: 3.9 .. opcode:: CONTAINS_OP (invert) - Performs ``in`` comparison, or ``not in`` if ``invert`` is 1. + Performs ``in`` comparison, or ``not in`` if ``invert`` is 1. .. versionadded:: 3.9 @@ -979,8 +979,8 @@ All of the following opcodes use their arguments. .. opcode:: JUMP_IF_NOT_EXC_MATCH (target) - Tests whether the second value on the stack is an exception matching TOS, - and jumps if it is not. Pops two values from the stack. + Tests whether the second value on the stack is an exception matching TOS, + and jumps if it is not. Pops two values from the stack. .. versionadded:: 3.9 @@ -1168,11 +1168,13 @@ All of the following opcodes use their arguments. * ``0x01`` a tuple of default values for positional-only and positional-or-keyword parameters in positional order * ``0x02`` a dictionary of keyword-only parameters' default values - * ``0x04`` an annotation dictionary + * ``0x04`` a tuple of strings containing parameters' annotations * ``0x08`` a tuple containing cells for free variables, making a closure * the code associated with the function (at TOS1) * the :term:`qualified name` of the function (at TOS) + .. versionchanged:: 3.10 + Flag value ``0x04`` is a tuple of strings instead of dictionary .. opcode:: BUILD_SLICE (argc) diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index 31b9b4afab9348..c60603b30a6d7d 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -173,7 +173,13 @@ The :class:`dircmp` class .. attribute:: subdirs A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` - objects. + instances (or MyDirCmp instances if this instance is of type MyDirCmp, a + subclass of :class:`dircmp`). + + .. versionchanged:: 3.10 + Previously entries were always :class:`dircmp` instances. Now entries + are the same type as *self*, if *self* is a subclass of + :class:`dircmp`. .. attribute:: DEFAULT_IGNORES diff --git a/Doc/library/formatter.rst b/Doc/library/formatter.rst deleted file mode 100644 index 6c10ac6fab50e4..00000000000000 --- a/Doc/library/formatter.rst +++ /dev/null @@ -1,351 +0,0 @@ -:mod:`formatter` --- Generic output formatting -============================================== - -.. module:: formatter - :synopsis: Generic output formatter and device interface. - :deprecated: - -.. deprecated:: 3.4 - Due to lack of usage, the formatter module has been deprecated. - --------------- - -This module supports two interface definitions, each with multiple -implementations: The *formatter* interface, and the *writer* interface which is -required by the formatter interface. - -Formatter objects transform an abstract flow of formatting events into specific -output events on writer objects. Formatters manage several stack structures to -allow various properties of a writer object to be changed and restored; writers -need not be able to handle relative changes nor any sort of "change back" -operation. Specific writer properties which may be controlled via formatter -objects are horizontal alignment, font, and left margin indentations. A -mechanism is provided which supports providing arbitrary, non-exclusive style -settings to a writer as well. Additional interfaces facilitate formatting -events which are not reversible, such as paragraph separation. - -Writer objects encapsulate device interfaces. Abstract devices, such as file -formats, are supported as well as physical devices. The provided -implementations all work with abstract devices. The interface makes available -mechanisms for setting the properties which formatter objects manage and -inserting data into the output. - - -.. _formatter-interface: - -The Formatter Interface ------------------------ - -Interfaces to create formatters are dependent on the specific formatter class -being instantiated. The interfaces described below are the required interfaces -which all formatters must support once initialized. - -One data element is defined at the module level: - - -.. data:: AS_IS - - Value which can be used in the font specification passed to the ``push_font()`` - method described below, or as the new value to any other ``push_property()`` - method. Pushing the ``AS_IS`` value allows the corresponding ``pop_property()`` - method to be called without having to track whether the property was changed. - -The following attributes are defined for formatter instance objects: - - -.. attribute:: formatter.writer - - The writer instance with which the formatter interacts. - - -.. method:: formatter.end_paragraph(blanklines) - - Close any open paragraphs and insert at least *blanklines* before the next - paragraph. - - -.. method:: formatter.add_line_break() - - Add a hard line break if one does not already exist. This does not break the - logical paragraph. - - -.. method:: formatter.add_hor_rule(*args, **kw) - - Insert a horizontal rule in the output. A hard break is inserted if there is - data in the current paragraph, but the logical paragraph is not broken. The - arguments and keywords are passed on to the writer's :meth:`send_line_break` - method. - - -.. method:: formatter.add_flowing_data(data) - - Provide data which should be formatted with collapsed whitespace. Whitespace - from preceding and successive calls to :meth:`add_flowing_data` is considered as - well when the whitespace collapse is performed. The data which is passed to - this method is expected to be word-wrapped by the output device. Note that any - word-wrapping still must be performed by the writer object due to the need to - rely on device and font information. - - -.. method:: formatter.add_literal_data(data) - - Provide data which should be passed to the writer unchanged. Whitespace, - including newline and tab characters, are considered legal in the value of - *data*. - - -.. method:: formatter.add_label_data(format, counter) - - Insert a label which should be placed to the left of the current left margin. - This should be used for constructing bulleted or numbered lists. If the - *format* value is a string, it is interpreted as a format specification for - *counter*, which should be an integer. The result of this formatting becomes the - value of the label; if *format* is not a string it is used as the label value - directly. The label value is passed as the only argument to the writer's - :meth:`send_label_data` method. Interpretation of non-string label values is - dependent on the associated writer. - - Format specifications are strings which, in combination with a counter value, - are used to compute label values. Each character in the format string is copied - to the label value, with some characters recognized to indicate a transform on - the counter value. Specifically, the character ``'1'`` represents the counter - value formatter as an Arabic number, the characters ``'A'`` and ``'a'`` - represent alphabetic representations of the counter value in upper and lower - case, respectively, and ``'I'`` and ``'i'`` represent the counter value in Roman - numerals, in upper and lower case. Note that the alphabetic and roman - transforms require that the counter value be greater than zero. - - -.. method:: formatter.flush_softspace() - - Send any pending whitespace buffered from a previous call to - :meth:`add_flowing_data` to the associated writer object. This should be called - before any direct manipulation of the writer object. - - -.. method:: formatter.push_alignment(align) - - Push a new alignment setting onto the alignment stack. This may be - :const:`AS_IS` if no change is desired. If the alignment value is changed from - the previous setting, the writer's :meth:`new_alignment` method is called with - the *align* value. - - -.. method:: formatter.pop_alignment() - - Restore the previous alignment. - - -.. method:: formatter.push_font((size, italic, bold, teletype)) - - Change some or all font properties of the writer object. Properties which are - not set to :const:`AS_IS` are set to the values passed in while others are - maintained at their current settings. The writer's :meth:`new_font` method is - called with the fully resolved font specification. - - -.. method:: formatter.pop_font() - - Restore the previous font. - - -.. method:: formatter.push_margin(margin) - - Increase the number of left margin indentations by one, associating the logical - tag *margin* with the new indentation. The initial margin level is ``0``. - Changed values of the logical tag must be true values; false values other than - :const:`AS_IS` are not sufficient to change the margin. - - -.. method:: formatter.pop_margin() - - Restore the previous margin. - - -.. method:: formatter.push_style(*styles) - - Push any number of arbitrary style specifications. All styles are pushed onto - the styles stack in order. A tuple representing the entire stack, including - :const:`AS_IS` values, is passed to the writer's :meth:`new_styles` method. - - -.. method:: formatter.pop_style(n=1) - - Pop the last *n* style specifications passed to :meth:`push_style`. A tuple - representing the revised stack, including :const:`AS_IS` values, is passed to - the writer's :meth:`new_styles` method. - - -.. method:: formatter.set_spacing(spacing) - - Set the spacing style for the writer. - - -.. method:: formatter.assert_line_data(flag=1) - - Inform the formatter that data has been added to the current paragraph - out-of-band. This should be used when the writer has been manipulated - directly. The optional *flag* argument can be set to false if the writer - manipulations produced a hard line break at the end of the output. - - -.. _formatter-impls: - -Formatter Implementations -------------------------- - -Two implementations of formatter objects are provided by this module. Most -applications may use one of these classes without modification or subclassing. - - -.. class:: NullFormatter(writer=None) - - A formatter which does nothing. If *writer* is omitted, a :class:`NullWriter` - instance is created. No methods of the writer are called by - :class:`NullFormatter` instances. Implementations should inherit from this - class if implementing a writer interface but don't need to inherit any - implementation. - - -.. class:: AbstractFormatter(writer) - - The standard formatter. This implementation has demonstrated wide applicability - to many writers, and may be used directly in most circumstances. It has been - used to implement a full-featured World Wide Web browser. - - -.. _writer-interface: - -The Writer Interface --------------------- - -Interfaces to create writers are dependent on the specific writer class being -instantiated. The interfaces described below are the required interfaces which -all writers must support once initialized. Note that while most applications can -use the :class:`AbstractFormatter` class as a formatter, the writer must -typically be provided by the application. - - -.. method:: writer.flush() - - Flush any buffered output or device control events. - - -.. method:: writer.new_alignment(align) - - Set the alignment style. The *align* value can be any object, but by convention - is a string or ``None``, where ``None`` indicates that the writer's "preferred" - alignment should be used. Conventional *align* values are ``'left'``, - ``'center'``, ``'right'``, and ``'justify'``. - - -.. method:: writer.new_font(font) - - Set the font style. The value of *font* will be ``None``, indicating that the - device's default font should be used, or a tuple of the form ``(size, - italic, bold, teletype)``. Size will be a string indicating the size of - font that should be used; specific strings and their interpretation must be - defined by the application. The *italic*, *bold*, and *teletype* values are - Boolean values specifying which of those font attributes should be used. - - -.. method:: writer.new_margin(margin, level) - - Set the margin level to the integer *level* and the logical tag to *margin*. - Interpretation of the logical tag is at the writer's discretion; the only - restriction on the value of the logical tag is that it not be a false value for - non-zero values of *level*. - - -.. method:: writer.new_spacing(spacing) - - Set the spacing style to *spacing*. - - -.. method:: writer.new_styles(styles) - - Set additional styles. The *styles* value is a tuple of arbitrary values; the - value :const:`AS_IS` should be ignored. The *styles* tuple may be interpreted - either as a set or as a stack depending on the requirements of the application - and writer implementation. - - -.. method:: writer.send_line_break() - - Break the current line. - - -.. method:: writer.send_paragraph(blankline) - - Produce a paragraph separation of at least *blankline* blank lines, or the - equivalent. The *blankline* value will be an integer. Note that the - implementation will receive a call to :meth:`send_line_break` before this call - if a line break is needed; this method should not include ending the last line - of the paragraph. It is only responsible for vertical spacing between - paragraphs. - - -.. method:: writer.send_hor_rule(*args, **kw) - - Display a horizontal rule on the output device. The arguments to this method - are entirely application- and writer-specific, and should be interpreted with - care. The method implementation may assume that a line break has already been - issued via :meth:`send_line_break`. - - -.. method:: writer.send_flowing_data(data) - - Output character data which may be word-wrapped and re-flowed as needed. Within - any sequence of calls to this method, the writer may assume that spans of - multiple whitespace characters have been collapsed to single space characters. - - -.. method:: writer.send_literal_data(data) - - Output character data which has already been formatted for display. Generally, - this should be interpreted to mean that line breaks indicated by newline - characters should be preserved and no new line breaks should be introduced. The - data may contain embedded newline and tab characters, unlike data provided to - the :meth:`send_formatted_data` interface. - - -.. method:: writer.send_label_data(data) - - Set *data* to the left of the current left margin, if possible. The value of - *data* is not restricted; treatment of non-string values is entirely - application- and writer-dependent. This method will only be called at the - beginning of a line. - - -.. _writer-impls: - -Writer Implementations ----------------------- - -Three implementations of the writer object interface are provided as examples by -this module. Most applications will need to derive new writer classes from the -:class:`NullWriter` class. - - -.. class:: NullWriter() - - A writer which only provides the interface definition; no actions are taken on - any methods. This should be the base class for all writers which do not need to - inherit any implementation methods. - - -.. class:: AbstractWriter() - - A writer which can be used in debugging formatters, but not much else. Each - method simply announces itself by printing its name and arguments on standard - output. - - -.. class:: DumbWriter(file=None, maxcol=72) - - Simple writer class which writes output on the :term:`file object` passed - in as *file* or, if *file* is omitted, on standard output. The output is - simply word-wrapped to the number of columns specified by *maxcol*. This - class is suitable for reflowing a sequence of paragraphs. - diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 35997db2a9d27d..56f4c0a0d772f4 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -99,6 +99,11 @@ The module provides the following classes: :attr:`ssl.SSLContext.post_handshake_auth` for the default *context* or when *cert_file* is passed with a custom *context*. + .. versionchanged:: 3.10 + This class now sends an ALPN extension with protocol indicator + ``http/1.1`` when no *context* is given. Custom *context* should set + ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`. + .. deprecated:: 3.6 *key_file* and *cert_file* are deprecated in favor of *context*. diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst index 02ecfd95d43767..65681ec093598c 100644 --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -174,9 +174,9 @@ example of usage. .. seealso:: - Documents describing the protocol, and sources and binaries for servers - implementing it, can all be found at the University of Washington's *IMAP - Information Center* (https://www.washington.edu/imap/). + Documents describing the protocol, sources for servers + implementing it, by the University of Washington's IMAP Information Center + can all be found at (**Source Code**) https://github.com/uw-imap/imap (**Not Maintained**). .. _imap4-objects: diff --git a/Doc/library/index.rst b/Doc/library/index.rst index bebf7429b0e63e..42f994f8b87d14 100644 --- a/Doc/library/index.rst +++ b/Doc/library/index.rst @@ -72,7 +72,6 @@ the `Python Package Index `_. custominterp.rst modules.rst language.rst - misc.rst windows.rst unix.rst superseded.rst diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 107bc515a67785..44728b42287bce 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -55,6 +55,7 @@ Iterator Arguments Results :func:`filterfalse` pred, seq elements of seq where pred(elem) is false ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8`` :func:`groupby` iterable[, key] sub-iterators grouped by value of key(v) :func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G`` +:func:`pairwise` iterable (p[0], p[1]), (p[1], p[2]) ``pairwise('ABCDEFG') --> AB BC CD DE EF FG`` :func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000`` :func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4`` :func:`tee` it, n it1, it2, ... itn splits one iterator into n @@ -475,6 +476,22 @@ loops that truncate the stream. If *start* is ``None``, then iteration starts at zero. If *step* is ``None``, then the step defaults to one. +.. function:: pairwise(iterable) + + Return successive overlapping pairs taken from the input *iterable*. + + The number of 2-tuples in the output iterator will be one fewer than the + number of inputs. It will be empty if the input iterable has fewer than + two values. + + Roughly equivalent to:: + + def pairwise(iterable): + # pairwise('ABCDEFG') --> AB BC CD DE EF FG + a, b = tee(iterable) + next(b, None) + return zip(a, b) + .. function:: permutations(iterable, r=None) @@ -755,7 +772,7 @@ which incur interpreter overhead. "Count how many times the predicate is true" return sum(map(pred, iterable)) - def padnone(iterable): + def pad_none(iterable): """Returns the sequence elements and then returns None indefinitely. Useful for emulating the behavior of the built-in map() function. @@ -782,12 +799,6 @@ which incur interpreter overhead. return starmap(func, repeat(args)) return starmap(func, repeat(args, times)) - def pairwise(iterable): - "s -> (s0,s1), (s1,s2), (s2, s3), ..." - a, b = tee(iterable) - next(b, None) - return zip(a, b) - def grouper(iterable, n, fillvalue=None): "Collect data into fixed-length chunks or blocks" # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx" @@ -809,7 +820,7 @@ which incur interpreter overhead. nexts = cycle(islice(nexts, num_active)) def partition(pred, iterable): - 'Use a predicate to partition entries into false entries and true entries' + "Use a predicate to partition entries into false entries and true entries" # partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 t1, t2 = tee(iterable) return filterfalse(pred, t1), filter(pred, t2) @@ -881,7 +892,7 @@ which incur interpreter overhead. def random_product(*args, repeat=1): "Random selection from itertools.product(*args, **kwds)" pools = [tuple(pool) for pool in args] * repeat - return tuple(random.choice(pool) for pool in pools) + return tuple(map(random.choice, pools)) def random_permutation(iterable, r=None): "Random selection from itertools.permutations(iterable, r)" @@ -900,11 +911,11 @@ which incur interpreter overhead. "Random selection from itertools.combinations_with_replacement(iterable, r)" pool = tuple(iterable) n = len(pool) - indices = sorted(random.randrange(n) for i in range(r)) + indices = sorted(random.choices(range(n), k=r)) return tuple(pool[i] for i in indices) def nth_combination(iterable, r, index): - 'Equivalent to list(combinations(iterable, r))[index]' + "Equivalent to list(combinations(iterable, r))[index]" pool = tuple(iterable) n = len(pool) if r < 0 or r > n: diff --git a/Doc/library/misc.rst b/Doc/library/misc.rst deleted file mode 100644 index 0943235246a91b..00000000000000 --- a/Doc/library/misc.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. _misc: - -********************** -Miscellaneous Services -********************** - -The modules described in this chapter provide miscellaneous services that are -available in all Python versions. Here's an overview: - - -.. toctree:: - - formatter.rst diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 698c17653786b3..d9825b47c71333 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -337,6 +337,8 @@ MADV_* Constants MADV_NOCORE MADV_CORE MADV_PROTECT + MADV_FREE_REUSABLE + MADV_FREE_REUSE These options can be passed to :meth:`mmap.madvise`. Not every option will be present on every system. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index f8e7556f25b4e0..128aa43b8b76f4 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -98,7 +98,7 @@ to start a process. These *start methods* are *spawn* The parent process starts a fresh python interpreter process. The child process will only inherit those resources necessary to run - the process objects :meth:`~Process.run` method. In particular, + the process object's :meth:`~Process.run` method. In particular, unnecessary file descriptors and handles from the parent process will not be inherited. Starting a process using this method is rather slow compared to using *fork* or *forkserver*. @@ -2569,9 +2569,9 @@ Address Formats filesystem. * An ``'AF_PIPE'`` address is a string of the form - :samp:`r'\\\\.\\pipe\\{PipeName}'`. To use :func:`Client` to connect to a named - pipe on a remote computer called *ServerName* one should use an address of the - form :samp:`r'\\\\{ServerName}\\pipe\\{PipeName}'` instead. + :samp:`r'\\\\.\\pipe\\{PipeName}'`. To use :func:`Client` to connect to a named + pipe on a remote computer called *ServerName* one should use an address of the + form :samp:`r'\\\\{ServerName}\\pipe\\{PipeName}'` instead. Note that any string beginning with two backslashes is assumed by default to be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address. diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 3ffcfa04ffa752..a4c5fbb481521e 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1419,6 +1419,39 @@ or `the MSDN `_ on Windo .. versionadded:: 3.3 +.. function:: splice(src, dst, count, offset_src=None, offset_dst=None) + + Transfer *count* bytes from file descriptor *src*, starting from offset + *offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. + At least one of the file descriptors must refer to a pipe. If *offset_src* + is None, then *src* is read from the current position; respectively for + *offset_dst*. The offset associated to the file descriptor that refers to a + pipe must be ``None``. The files pointed by *src* and *dst* must reside in + the same filesystem, otherwise an :exc:`OSError` is raised with + :attr:`~OSError.errno` set to :data:`errno.EXDEV`. + + This copy is done without the additional cost of transferring data + from the kernel to user space and then back into the kernel. Additionally, + some filesystems could implement extra optimizations. The copy is done as if + both files are opened as binary. + + Upon successful completion, returns the number of bytes spliced to or from + the pipe. A return value of 0 means end of input. If *src* refers to a + pipe, then this means that there was no data to transfer, and it would not + make sense to block because there are no writers connected to the write end + of the pipe. + + .. availability:: Linux kernel >= 2.6.17 and glibc >= 2.5 + + .. versionadded:: 3.10 + + +.. data:: SPLICE_F_MOVE + SPLICE_F_NONBLOCK + SPLICE_F_MORE + + .. versionadded:: 3.10 + .. function:: readv(fd, buffers) Read from a file descriptor *fd* into a number of mutable :term:`bytes-like @@ -3276,6 +3309,102 @@ features: .. versionadded:: 3.8 +.. function:: eventfd(initval[, flags=os.EFD_CLOEXEC]) + + Create and return an event file descriptor. The file descriptors supports + raw :func:`read` and :func:`write` with a buffer size of 8, + :func:`~select.select`, :func:`~select.poll` and similar. See man page + :manpage:`eventfd(2)` for more information. By default, the + new file descriptor is :ref:`non-inheritable `. + + *initval* is the initial value of the event counter. The initial value + must be an 32 bit unsigned integer. Please note that the initial value is + limited to a 32 bit unsigned int although the event counter is an unsigned + 64 bit integer with a maximum value of 2\ :sup:`64`\ -\ 2. + + *flags* can be constructed from :const:`EFD_CLOEXEC`, + :const:`EFD_NONBLOCK`, and :const:`EFD_SEMAPHORE`. + + If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, + :func:`eventfd_read` returns 1 and decrements the counter by one. + + If :const:`EFD_SEMAPHORE` is not specified and the event counter is + non-zero, :func:`eventfd_read` returns the current event counter value and + resets the counter to zero. + + If the event counter is zero and :const:`EFD_NONBLOCK` is not + specified, :func:`eventfd_read` blocks. + + :func:`eventfd_write` increments the event counter. Write blocks if the + write operation would increment the counter to a value larger than + 2\ :sup:`64`\ -\ 2. + + Example:: + + import os + + # semaphore with start value '1' + fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFC_CLOEXEC) + try: + # acquire semaphore + v = os.eventfd_read(fd) + try: + do_work() + finally: + # release semaphore + os.eventfd_write(fd, v) + finally: + os.close(fd) + + .. availability:: Linux 2.6.27 or newer with glibc 2.8 or newer. + + .. versionadded:: 3.10 + +.. function:: eventfd_read(fd) + + Read value from an :func:`eventfd` file descriptor and return a 64 bit + unsigned int. The function does not verify that *fd* is an :func:`eventfd`. + + .. availability:: See :func:`eventfd` + + .. versionadded:: 3.10 + +.. function:: eventfd_write(fd, value) + + Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit + unsigned int. The function does not verify that *fd* is an :func:`eventfd`. + + .. availability:: See :func:`eventfd` + + .. versionadded:: 3.10 + +.. data:: EFD_CLOEXEC + + Set close-on-exec flag for new :func:`eventfd` file descriptor. + + .. availability:: See :func:`eventfd` + + .. versionadded:: 3.10 + +.. data:: EFD_NONBLOCK + + Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file + descriptor. + + .. availability:: See :func:`eventfd` + + .. versionadded:: 3.10 + +.. data:: EFD_SEMAPHORE + + Provide semaphore-like semantics for reads from a :func:`eventfd` file + descriptor. On read the internal counter is decremented by one. + + .. availability:: Linux 2.6.30 or newer with glibc 2.8 or newer. + + .. versionadded:: 3.10 + + Linux extended attributes ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 9de72bb725c758..2bbf3aad619884 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -336,6 +336,8 @@ Pure paths provide the following methods and properties: >>> p.parents[2] PureWindowsPath('c:/') + .. versionchanged:: 3.10 + The parents sequence now supports :term:`slices ` and negative index values. .. data:: PurePath.parent diff --git a/Doc/library/pipes.rst b/Doc/library/pipes.rst index 0a22da1f555bc2..57e27a6acf4b66 100644 --- a/Doc/library/pipes.rst +++ b/Doc/library/pipes.rst @@ -17,6 +17,8 @@ The :mod:`pipes` module defines a class to abstract the concept of a *pipeline* Because the module uses :program:`/bin/sh` command lines, a POSIX or compatible shell for :func:`os.system` and :func:`os.popen` is required. +.. availability:: Unix. Not available on VxWorks. + The :mod:`pipes` module defines the following class: diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index b293adf48e6e33..fc51b5de881cc4 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -253,3 +253,41 @@ Unix Platforms using :program:`gcc`. The file is read and scanned in chunks of *chunksize* bytes. + + +Linux Platforms +--------------- + +.. function:: freedesktop_os_release() + + Get operating system identification from ``os-release`` file and return + it as a dict. The ``os-release`` file is a `freedesktop.org standard + `_ and + is available in most Linux distributions. A noticeable exception is + Android and Android-based distributions. + + Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor + ``/usr/lib/os-release`` can be read. + + On success, the function returns a dictionary where keys and values are + strings. Values have their special characters like ``"`` and ``$`` + unquoted. The fields ``NAME``, ``ID``, and ``PRETTY_NAME`` are always + defined according to the standard. All other fields are optional. Vendors + may include additional fields. + + Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings + suitable for presentation to users. Programs should use fields like + ``ID``, ``ID_LIKE``, ``VERSION_ID``, or ``VARIANT_ID`` to identify + Linux distributions. + + Example:: + + def get_like_distro(): + info = platform.freedesktop_os_release() + ids = [info["ID"]] + if "ID_LIKE" in info: + # ids are space separated and ordered by precedence + ids.extend(info["ID_LIKE"].split()) + return ids + + .. versionadded:: 3.10 diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index 00a730b6b9ca6a..84a569d03eb293 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -117,7 +117,7 @@ The variables defined in the :mod:`signal` module are: Child process stopped or terminated. - .. availability:: Windows. + .. availability:: Unix. .. data:: SIGCLD diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index b3cc60357f554a..52220f7a7f30ac 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -32,7 +32,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions). than a success code, an :exc:`SMTPConnectError` is raised. The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout - setting will be used). If the timeout expires, :exc:`socket.timeout` is + setting will be used). If the timeout expires, :exc:`TimeoutError` is raised. The optional source_address parameter allows binding to some specific source address in a machine with multiple network interfaces, and/or to some specific source TCP port. It takes a 2-tuple @@ -115,7 +115,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions). If the *timeout* parameter is set to be zero, it will raise a :class:`ValueError` to prevent the creation of a non-blocking socket -.. class:: LMTP(host='', port=LMTP_PORT, local_hostname=None, +.. class:: LMTP(host='', port=LMTP_PORT, local_hostname=None, \ source_address=None[, timeout]) The LMTP protocol, which is very similar to ESMTP, is heavily based on the diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index faf8a76251420e..d52b84f610ed67 100755 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -283,6 +283,8 @@ Exceptions .. exception:: timeout + A deprecated alias of :exc:`TimeoutError`. + A subclass of :exc:`OSError`, this exception is raised when a timeout occurs on a socket which has had timeouts enabled via a prior call to :meth:`~socket.settimeout` (or implicitly through @@ -292,6 +294,9 @@ Exceptions .. versionchanged:: 3.3 This class was made a subclass of :exc:`OSError`. + .. versionchanged:: 3.10 + This class was made an alias of :exc:`TimeoutError`. + Constants ^^^^^^^^^ @@ -1208,7 +1213,7 @@ to sockets. address family --- see above.) If the connection is interrupted by a signal, the method waits until the - connection completes, or raise a :exc:`socket.timeout` on timeout, if the + connection completes, or raise a :exc:`TimeoutError` on timeout, if the signal handler doesn't raise an exception and the socket is blocking or has a timeout. For non-blocking sockets, the method raises an :exc:`InterruptedError` exception if the connection is interrupted by a diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 84d5a3a59f0b40..59c2b84b52719c 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -5065,7 +5065,7 @@ instantiated from the type:: >>> class M(type): ... def __or__(self, other): - ... return "Hello" + ... return "Hello" ... >>> class C(metaclass=M): ... pass diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 91f43e9353d915..5542e9b727a6b8 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -384,10 +384,10 @@ following: The ``'#'`` option causes the "alternate form" to be used for the conversion. The alternate form is defined differently for different -types. This option is only valid for integer, float, complex and -Decimal types. For integers, when binary, octal, or hexadecimal output +types. This option is only valid for integer, float and complex +types. For integers, when binary, octal, or hexadecimal output is used, this option adds the prefix respective ``'0b'``, ``'0o'``, or -``'0x'`` to the output value. For floats, complex and Decimal the +``'0x'`` to the output value. For float and complex the alternate form causes the result of the conversion to always contain a decimal-point character, even if no digits follow it. Normally, a decimal-point character appears in the result of these conversions @@ -476,20 +476,36 @@ with the floating point presentation types listed below (except ``'n'`` and ``None``). When doing so, :func:`float` is used to convert the integer to a floating point number before formatting. -The available presentation types for floating point and decimal values are: +The available presentation types for :class:`float` and +:class:`~decimal.Decimal` values are: +---------+----------------------------------------------------------+ | Type | Meaning | +=========+==========================================================+ - | ``'e'`` | Exponent notation. Prints the number in scientific | - | | notation using the letter 'e' to indicate the exponent. | - | | The default precision is ``6``. | + | ``'e'`` | Scientific notation. For a given precision ``p``, | + | | formats the number in scientific notation with the | + | | letter 'e' separating the coefficient from the exponent. | + | | The coefficient has one digit before and ``p`` digits | + | | after the decimal point, for a total of ``p + 1`` | + | | significant digits. With no precision given, uses a | + | | precision of ``6`` digits after the decimal point for | + | | :class:`float`, and shows all coefficient digits | + | | for :class:`~decimal.Decimal`. If no digits follow the | + | | decimal point, the decimal point is also removed unless | + | | the ``#`` option is used. | +---------+----------------------------------------------------------+ - | ``'E'`` | Exponent notation. Same as ``'e'`` except it uses an | - | | upper case 'E' as the separator character. | + | ``'E'`` | Scientific notation. Same as ``'e'`` except it uses | + | | an upper case 'E' as the separator character. | +---------+----------------------------------------------------------+ - | ``'f'`` | Fixed-point notation. Displays the number as a | - | | fixed-point number. The default precision is ``6``. | + | ``'f'`` | Fixed-point notation. For a given precision ``p``, | + | | formats the number as a decimal number with exactly | + | | ``p`` digits following the decimal point. With no | + | | precision given, uses a precision of ``6`` digits after | + | | the decimal point for :class:`float`, and uses a | + | | precision large enough to show all coefficient digits | + | | for :class:`~decimal.Decimal`. If no digits follow the | + | | decimal point, the decimal point is also removed unless | + | | the ``#`` option is used. | +---------+----------------------------------------------------------+ | ``'F'`` | Fixed-point notation. Same as ``'f'``, but converts | | | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | @@ -518,7 +534,10 @@ The available presentation types for floating point and decimal values are: | | the precision. | | | | | | A precision of ``0`` is treated as equivalent to a | - | | precision of ``1``. The default precision is ``6``. | + | | precision of ``1``. With no precision given, uses a | + | | precision of ``6`` significant digits for | + | | :class:`float`, and shows all coefficient digits | + | | for :class:`~decimal.Decimal`. | +---------+----------------------------------------------------------+ | ``'G'`` | General format. Same as ``'g'`` except switches to | | | ``'E'`` if the number gets too large. The | diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index e05486f7d08494..690735469d0bf6 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -71,6 +71,13 @@ This module defines the following functions: .. versionadded:: 3.8 +.. data:: __excepthook__ + + Holds the original value of :func:`threading.excepthook`. It is saved so that the + original value can be restored in case they happen to get replaced with + broken or alternative objects. + + .. versionadded:: 3.10 .. function:: get_ident() diff --git a/Doc/library/time.rst b/Doc/library/time.rst index cff6320b526db5..143f84b565f5e1 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -166,6 +166,9 @@ Functions Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*. + Use :func:`clock_gettime_ns` to avoid the precision loss caused by the + :class:`float` type. + .. availability:: Unix. .. versionadded:: 3.3 @@ -185,6 +188,9 @@ Functions Set the time of the specified clock *clk_id*. Currently, :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*. + Use :func:`clock_settime_ns` to avoid the precision loss caused by the + :class:`float` type. + .. availability:: Unix. .. versionadded:: 3.3 @@ -273,10 +279,17 @@ Functions The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. + Use :func:`monotonic_ns` to avoid the precision loss caused by the + :class:`float` type. + .. versionadded:: 3.3 + .. versionchanged:: 3.5 The function is now always available and always system-wide. + .. versionchanged:: 3.10 + On macOS, the function is now system-wide. + .. function:: monotonic_ns() -> int @@ -295,8 +308,14 @@ Functions point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. + Use :func:`perf_counter_ns` to avoid the precision loss caused by the + :class:`float` type. + .. versionadded:: 3.3 + .. versionchanged:: 3.10 + On Windows, the function is now system-wide. + .. function:: perf_counter_ns() -> int Similar to :func:`perf_counter`, but return time as nanoseconds. @@ -317,6 +336,9 @@ Functions returned value is undefined, so that only the difference between the results of consecutive calls is valid. + Use :func:`process_time_ns` to avoid the precision loss caused by the + :class:`float` type. + .. versionadded:: 3.3 .. function:: process_time_ns() -> int @@ -581,6 +603,17 @@ Functions :class:`struct_time` object is returned, from which the components of the calendar date may be accessed as attributes. + Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` + type. + + +.. function:: time_ns() -> int + + Similar to :func:`~time.time` but returns time as an integer number of nanoseconds + since the epoch_. + + .. versionadded:: 3.7 + .. function:: thread_time() -> float @@ -595,6 +628,9 @@ Functions returned value is undefined, so that only the difference between the results of consecutive calls in the same thread is valid. + Use :func:`thread_time_ns` to avoid the precision loss caused by the + :class:`float` type. + .. availability:: Windows, Linux, Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``. @@ -608,13 +644,6 @@ Functions .. versionadded:: 3.7 -.. function:: time_ns() -> int - - Similar to :func:`~time.time` but returns time as an integer number of nanoseconds - since the epoch_. - - .. versionadded:: 3.7 - .. function:: tzset() Reset the time conversion rules used by the library routines. The environment diff --git a/Doc/library/types.rst b/Doc/library/types.rst index ad40a9fbf32739..6f0dc259303fad 100644 --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -409,7 +409,9 @@ Additional Utility Classes and Functions return "{}({})".format(type(self).__name__, ", ".join(items)) def __eq__(self, other): - return self.__dict__ == other.__dict__ + if isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace): + return self.__dict__ == other.__dict__ + return NotImplemented ``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. However, for a structured record type use :func:`~collections.namedtuple` diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 9a993c073277f9..b07bb8943d16fd 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -641,7 +641,7 @@ These can be used as types in annotations using ``[]``, each having a unique syn :ref:`type variables `, and unions of any of these types. For example:: - def new_non_team_user(user_class: Type[Union[BaseUser, ProUser]]): ... + def new_non_team_user(user_class: Type[Union[BasicUser, ProUser]]): ... ``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent to ``type``, which is the root of Python's metaclass hierarchy. @@ -674,6 +674,12 @@ These can be used as types in annotations using ``[]``, each having a unique syn .. versionadded:: 3.8 + .. versionchanged:: 3.9.1 + ``Literal`` now de-duplicates parameters. Equality comparison of + ``Literal`` objects are no longer order dependent. ``Literal`` objects + will now raise a :exc:`TypeError` exception during equality comparisons + if one of their parameters are not :term:`immutable`. + .. data:: ClassVar Special type construct to mark class variables. @@ -1706,6 +1712,9 @@ Introspection helpers For a typing object of the form ``X[Y, Z, ...]`` these functions return ``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or :mod:`collections` class, it gets normalized to the original class. + If ``X`` is a :class:`Union` or :class:`Literal` contained in another + generic type, the order of ``(Y, Z, ...)`` may be different from the order + of the original arguments ``[Y, Z, ...]`` due to type caching. For unsupported objects return ``None`` and ``()`` correspondingly. Examples:: diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 51e10119d3e8d0..0a0993518efddc 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -897,8 +897,7 @@ Test cases .. method:: assertIs(first, second, msg=None) assertIsNot(first, second, msg=None) - Test that *first* and *second* evaluate (or don't evaluate) to the - same object. + Test that *first* and *second* are (or are not) the same object. .. versionadded:: 3.1 diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index b37f230feb6015..b4435a62ad43d9 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -109,6 +109,11 @@ The :mod:`urllib.request` module defines the following functions: .. versionchanged:: 3.4.3 *context* was added. + .. versionchanged:: 3.10 + HTTPS connection now send an ALPN extension with protocol indicator + ``http/1.1`` when no *context* is given. Custom *context* should set + ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`. + .. deprecated:: 3.6 *cafile*, *capath* and *cadefault* are deprecated in favor of *context*. diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst index 2c78cd939243a8..bf72c46561b7c7 100644 --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -132,7 +132,7 @@ module documentation. This section lists the differences between the API and ... # Work with dom. -.. method:: Node.writexml(writer, indent="", addindent="", newl="", +.. method:: Node.writexml(writer, indent="", addindent="", newl="", \ encoding=None, standalone=None) Write XML to the writer object. The writer receives texts but not bytes as input, @@ -174,7 +174,7 @@ module documentation. This section lists the differences between the API and The :meth:`toxml` method now preserves the attribute order specified by the user. -.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, +.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, \ standalone=None) Return a pretty-printed version of the document. *indent* specifies the diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst index 8ac3fb16bdb90d..8d579f21c7e8b0 100644 --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -44,8 +44,9 @@ doesn't contain :file:`.pyc` files, importing may be rather slow. follows the specification in :pep:`273`, but uses an implementation written by Just van Rossum that uses the import hooks described in :pep:`302`. - :pep:`302` - New Import Hooks - The PEP to add the import hooks that help this module work. + :mod:`importlib` - The implementation of the import machinery + Package providing the relevant protocols for all importers to + implement. This module defines an exception: @@ -73,7 +74,31 @@ zipimporter Objects :exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid ZIP archive. - .. method:: find_module(fullname[, path]) + .. method:: create_module(spec) + + Implementation of :meth:`importlib.abc.Loader.create_module` that returns + :const:`None` to explicitly request the default semantics. + + .. versionadded:: 3.10 + + + .. method:: exec_module(module) + + Implementation of :meth:`importlib.abc.Loader.exec_module`. + + .. versionadded:: 3.10 + + + .. method:: find_loader(fullname, path=None) + + An implementation of :meth:`importlib.abc.PathEntryFinder.find_loader`. + + .. deprecated:: 3.10 + + Use :meth:`find_spec` instead. + + + .. method:: find_module(fullname, path=None) Search for a module specified by *fullname*. *fullname* must be the fully qualified (dotted) module name. It returns the zipimporter instance itself @@ -81,6 +106,17 @@ zipimporter Objects *path* argument is ignored---it's there for compatibility with the importer protocol. + .. deprecated:: 3.10 + + Use :meth:`find_spec` instead. + + + .. method:: find_spec(fullname, target=None) + + An implementation of :meth:`importlib.abc.PathEntryFinder.find_spec`. + + .. versionadded:: 3.10 + .. method:: get_code(fullname) @@ -126,6 +162,10 @@ zipimporter Objects qualified (dotted) module name. It returns the imported module, or raises :exc:`ZipImportError` if it wasn't found. + .. deprecated:: 3.10 + + Use :meth:`exec_module` instead. + .. attribute:: archive diff --git a/Doc/reference/grammar.rst b/Doc/reference/grammar.rst index acf83765b5796c..59b45005836a76 100644 --- a/Doc/reference/grammar.rst +++ b/Doc/reference/grammar.rst @@ -13,7 +13,8 @@ In particular, ``&`` followed by a symbol, token or parenthesized group indicates a positive lookahead (i.e., is required to match but not consumed), while ``!`` indicates a negative lookahead (i.e., is required _not_ to match). We use the ``|`` separator to mean PEG's -"ordered choice" (written as ``/`` in traditional PEG grammars). +"ordered choice" (written as ``/`` in traditional PEG grammars). See +:pep:`617` for more details on the grammar's syntax. .. literalinclude:: ../../Grammar/python.gram :language: peg diff --git a/Doc/tools/extensions/c_annotations.py b/Doc/tools/extensions/c_annotations.py index fa8244a8fd318e..76c9d920cbe31f 100644 --- a/Doc/tools/extensions/c_annotations.py +++ b/Doc/tools/extensions/c_annotations.py @@ -79,9 +79,9 @@ def add_annotations(self, app, doctree): classes=['stableabi'])) if par['objtype'] != 'function': continue - if not par[0].has_key('names') or not par[0]['names']: + if not par[0].has_key('ids') or not par[0]['ids']: continue - name = par[0]['names'][0] + name = par[0]['ids'][0] if name.startswith("c."): name = name[2:] entry = self.get(name) diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index 80fbd96d56fdc0..28994399e25cf9 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -394,7 +394,12 @@ def run(self): translatable=False) node.append(para) env = self.state.document.settings.env - env.get_domain('changeset').note_changeset(node) + # deprecated pre-Sphinx-2 method + if hasattr(env, 'note_versionchange'): + env.note_versionchange('deprecated', version[0], node, self.lineno) + # new method + else: + env.get_domain('changeset').note_changeset(node) return [node] + messages diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index ff4c797f66cd63..5c6b65f05e1e5f 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -78,7 +78,7 @@ objects: Return the number of times *x* appears in the list. -.. method:: list.sort(key=None, reverse=False) +.. method:: list.sort(*, key=None, reverse=False) :noindex: Sort the items of the list in place (the arguments can be used for sort diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index 366a532e817afa..4e27cff83ce59f 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -329,11 +329,16 @@ equivalent :keyword:`try`\ -\ :keyword:`finally` blocks:: If you're not using the :keyword:`with` keyword, then you should call ``f.close()`` to close the file and immediately free up any system -resources used by it. If you don't explicitly close a file, Python's -garbage collector will eventually destroy the object and close the -open file for you, but the file may stay open for a while. Another -risk is that different Python implementations will do this clean-up at -different times. +resources used by it. + +.. warning:: + Calling ``f.write()`` without using the :keyword:`!with` keyword or calling + ``f.close()`` **might** result in the arguments + of ``f.write()`` not being completely written to the disk, even if the + program exits successfully. + +.. + See also https://bugs.python.org/issue17852 After a file object is closed, either by a :keyword:`with` statement or by calling ``f.close()``, attempts to use the file object will diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 78c1e03f7462c9..265c07c7099f35 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -23,8 +23,8 @@ available for application-local distributions. As specified in :pep:`11`, a Python release only supports a Windows platform while Microsoft considers the platform under extended support. This means that -Python |version| supports Windows Vista and newer. If you require Windows XP -support then please install Python 3.4. +Python |version| supports Windows 8.1 and newer. If you require Windows 7 +support, please install Python 3.8. There are a number of different installers available for Windows, each with certain benefits and downsides. diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 74c1c28ec0ff3b..23e28aa4fd8fc2 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -120,8 +120,8 @@ See :pep:`613` for more details. (Contributed by Mikhail Golubev in :issue:`41923`.) -PEP604: New Type Union Operator -------------------------------- +PEP 604: New Type Union Operator +-------------------------------- A new type union operator was introduced which enables the syntax ``X | Y``. This provides a cleaner way of expressing 'either type X or type Y' instead of @@ -154,6 +154,9 @@ Other Language Changes :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.) +* Assignment expressions can now be used unparenthesized within set literals + and set comprehensions, as well as in sequence indexes (but not slices). + New Modules =========== @@ -183,6 +186,9 @@ Add a :func:`contextlib.aclosing` context manager to safely close async generato and objects representing asynchronously released resources. (Contributed by Joongi Kim and John Belmonte in :issue:`41229`.) +Add asynchronous context manager support to :func:`contextlib.nullcontext`. +(Contributed by Tom Gringauz in :issue:`41543`.) + curses ------ @@ -229,6 +235,33 @@ os Added :func:`os.cpu_count()` support for VxWorks RTOS. (Contributed by Peixing Xin in :issue:`41440`.) +Added a new function :func:`os.eventfd` and related helpers to wrap the +``eventfd2`` syscall on Linux. +(Contributed by Christian Heimes in :issue:`41001`.) + +Added :func:`os.splice()` that allows to move data between two file +descriptors without copying between kernel address space and user +address space, where one of the file descriptors must refer to a +pipe. (Contributed by Pablo Galindo in :issue:`41625`.) + +pathlib +------- + +Added slice support to :attr:`PurePath.parents `. +(Contributed by Joshua Cannon in :issue:`35498`) + +Added negative indexing support to :attr:`PurePath.parents +`. +(Contributed by Yaroslav Pankovych in :issue:`21041`) + +platform +-------- + +Added :func:`platform.freedesktop_os_release()` to retrieve operation system +identification from `freedesktop.org os-release +`_ standard file. +(Contributed by Christian Heimes in :issue:`28468`) + py_compile ---------- @@ -248,6 +281,12 @@ site When a module does not define ``__loader__``, fall back to ``__spec__.loader``. (Contributed by Brett Cannon in :issue:`42133`.) +socket +------ + +The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`. +(Contributed by Christian Heimes in :issue:`42413`.) + sys --- @@ -263,6 +302,11 @@ retrieve the functions set by :func:`threading.settrace` and :func:`threading.setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.) +Add :data:`threading.__excepthook__` to allow retrieving the original value +of :func:`threading.excepthook` in case it is set to a broken or a different +value. +(Contributed by Mario Corchero in :issue:`42308`.) + traceback --------- @@ -280,6 +324,32 @@ and :data:`types.NotImplementedType` classes, providing a new set of types readily interpretable by type checkers. (Contributed by Bas van Beek in :issue:`41810`.) +typing +------ + +The behavior of :class:`typing.Literal` was changed to conform with :pep:`586` +and to match the behavior of static type checkers specified in the PEP. + +1. ``Literal`` now de-duplicates parameters. +2. Equality comparisons between ``Literal`` objects are now order independent. +3. ``Literal`` comparisons now respects types. For example, + ``Literal[0] == Literal[False]`` previously evaluated to ``True``. It is + now ``False``. To support this change, the internally used type cache now + supports differentiating types. +4. ``Literal`` objects will now raise a :exc:`TypeError` exception during + equality comparisons if one of their parameters are not :term:`immutable`. + Note that declaring ``Literal`` with mutable parameters will not throw + an error:: + + >>> from typing import Literal + >>> Literal[{0}] + >>> Literal[{0}] == Literal[{False}] + Traceback (most recent call last): + File "", line 1, in + TypeError: unhashable type: 'set' + +(Contributed by Yurii Karabas in :issue:`42345`.) + unittest -------- @@ -294,6 +364,13 @@ Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax.handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :issue:`35018`.) +zipimport +--------- +Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`, +:meth:`zipimport.zipimporter.create_module`, and +:meth:`zipimport.zipimporter.exec_module`. +(Contributed by Brett Cannon in :issue:`42131`. + Optimizations ============= @@ -317,7 +394,13 @@ Optimizations with ``gcc`` by up to 30%. See `this article `_ for more details. (Contributed by Victor Stinner and Pablo Galindo in - :issue:`38980`) + :issue:`38980`.) + + +* Function parameters and their annotations are no longer computed at runtime, + but rather at compilation time. They are stored as a tuple of strings at the + bytecode level. It is now around 100% faster to create a function with parameter + annotations. (Contributed by Yurii Karabas and Inada Naoki in :issue:`42202`) Deprecated ========== @@ -339,6 +422,26 @@ Deprecated as appropriate to help identify code which needs updating during this transition. +* The various ``load_module()`` methods of :mod:`importlib` have been + documented as deprecated since Python 3.6, but will now also trigger + a :exc:`DeprecationWarning`. Use + :meth:`~importlib.abc.Loader.exec_module` instead. + (Contributed by Brett Cannon in :issue:`26131`.) + +* :meth:`zimport.zipimporter.load_module` has been deprecated in + preference for :meth:`~zipimport.zipimporter.exec_module`. + (Contributed by Brett Cannon in :issue:`26131`.) + +* The use of :meth:`~importlib.abc.Loader.load_module` by the import + system now triggers an :exc:`ImportWarning` as + :meth:`~importlib.abc.Loader.exec_module` is preferred. + (Contributed by Brett Cannon in :issue:`26131`.) + +* ``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python + 3.3, when it was made an alias to :class:`str`. It is now deprecated, + scheduled for removal in Python 3.12. + (Contributed by Erlend E. Aasland in :issue:`42264`.) + Removed ======= @@ -360,6 +463,27 @@ Removed moved to the internal C API. (Contributed by Victor Stinner in :issue:`42157`.) +* Removed the ``parser`` module, which was deprecated in 3.9 due to the + switch to the new PEG parser, as well as all the C source and header files + that were only being used by the old parser, including ``node.h``, ``parser.h``, + ``graminit.h`` and ``grammar.h``. + +* Removed the Public C API functions :c:func:`PyParser_SimpleParseStringFlags`, + :c:func:`PyParser_SimpleParseStringFlagsFilename`, + :c:func:`PyParser_SimpleParseFileFlags` and :c:func:`PyNode_Compile` + that were deprecated in 3.9 due to the switch to the new PEG parser. + +* Removed the ``formatter`` module, which was deprecated in Python 3.4. + It is somewhat obsolete, little used, and not tested. It was originally + scheduled to be removed in Python 3.6, but such removals were delayed until + after Python 2.7 EOL. Existing users should copy whatever classes they use + into their code. + (Contributed by Dong-hee Na and Terry J. Reedy in :issue:`42299`.) + +* Removed the :c:func:`PyModule_GetWarningsModule` function that was useless + now due to the _warnings module was converted to a builtin module in 2.6. + (Contributed by Hai Shi in :issue:`42599`.) + Porting to Python 3.10 ====================== @@ -377,6 +501,12 @@ Changes in the Python API have been renamed to *exc*. (Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.) +CPython bytecode changes +======================== + +* The ``MAKE_FUNCTION`` instruction accepts tuple of strings as annotations + instead of dictionary. + (Contributed by Yurii Karabas and Inada Naoki in :issue:`42202`) Build Changes ============= @@ -432,6 +562,10 @@ New Features reference count of an object and return the object. (Contributed by Victor Stinner in :issue:`42262`.) +* The :c:func:`PyType_FromSpecWithBases` and :c:func:`PyType_FromModuleAndSpec` + functions now accept a single class as the *bases* argument. + (Contributed by Serhiy Storchaka in :issue:`42423`.) + * The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` slot. (Contributed by Hai Shi in :issue:`41832`.) @@ -450,17 +584,6 @@ Porting to Python 3.10 ` and the :pep:`353`. (Contributed by Victor Stinner in :issue:`40943`.) -* Since :c:func:`Py_TYPE()` is changed to the inline static function, - ``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, new_type)``: - see :c:func:`Py_SET_TYPE()` (available since Python 3.9). For backward - compatibility, this macro can be used:: - - #if PY_VERSION_HEX < 0x030900A4 - # define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) - #endif - - (Contributed by Dong-hee Na in :issue:`39573`.) - * Since :c:func:`Py_REFCNT()` is changed to the inline static function, ``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, new_refcnt)``: see :c:func:`Py_SET_REFCNT()` (available since Python 3.9). For backward @@ -472,17 +595,6 @@ Porting to Python 3.10 (Contributed by Victor Stinner in :issue:`39573`.) -* Since :c:func:`Py_SIZE()` is changed to the inline static function, - ``Py_SIZE(obj) = new_size`` must be replaced with ``Py_SET_SIZE(obj, new_size)``: - see :c:func:`Py_SET_SIZE()` (available since Python 3.9). For backward - compatibility, this macro can be used:: - - #if PY_VERSION_HEX < 0x030900A4 - # define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0) - #endif - - (Contributed by Victor Stinner in :issue:`39573`.) - * Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed for historical reason. It is no longer allowed. (Contributed by Victor Stinner in :issue:`40839`.) @@ -504,6 +616,13 @@ Porting to Python 3.10 :ref:`Python Path Configuration. `. (Contributed by Victor Stinner in :issue:`42260`.) +* :c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and + :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. + For example, ``x = PyList_SET_ITEM(a, b, c)`` and + ``PyList_SET_ITEM(a, b, c) = x`` now fail with a compiler error. It prevents + bugs like ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` test. + (Contributed by Zackery Spytz and Victor Stinner in :issue:`30459`.) + Deprecated ---------- @@ -552,3 +671,8 @@ Removed ``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :issue:`41936`.) + +* Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing + Python already implicitly installs signal handlers: see + :c:member:`PyConfig.install_signal_handlers`. + (Contributed by Victor Stinner in :issue:`41713`.) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 6a9fa341569465..0b4820f3333e13 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2113,9 +2113,6 @@ Changes in the C API (Contributed by Antoine Pitrou in :issue:`32388`.) -* The :c:func:`PyCode_New` has a new parameter in the second position (*posonlyargcount*) - to support :pep:`570`, indicating the number of positional-only arguments. - * The functions :c:func:`PyNode_AddChild` and :c:func:`PyParser_AddToken` now accept two additional ``int`` arguments *end_lineno* and *end_col_offset*. diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index a601b16f1c6059..a638e544cb38fe 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -135,8 +135,8 @@ More generally, try to run your tests in the :ref:`Python Development Mode ` which helps to prepare your code to make it compatible with the next Python version. -Note: a number of pre-existing deprecatations were removed in this version -of Python as well. Consult the :ref:`removed-in-python-39` section. +Note: a number of pre-existing deprecations were removed in this version of +Python as well. Consult the :ref:`removed-in-python-39` section. New Features @@ -1454,3 +1454,32 @@ Removed ``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, ``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:`39372`.) + +Notable changes in Python 3.9.1 +=============================== + +typing +------ + +The behavior of :class:`typing.Literal` was changed to conform with :pep:`586` +and to match the behavior of static type checkers specified in the PEP. + +1. ``Literal`` now de-duplicates parameters. +2. Equality comparisons between ``Literal`` objects are now order independent. +3. ``Literal`` comparisons now respect types. For example, + ``Literal[0] == Literal[False]`` previously evaluated to ``True``. It is + now ``False``. To support this change, the internally used type cache now + supports differentiating types. +4. ``Literal`` objects will now raise a :exc:`TypeError` exception during + equality comparisons if one of their parameters are not :term:`immutable`. + Note that declaring ``Literal`` with mutable parameters will not throw + an error:: + + >>> from typing import Literal + >>> Literal[{0}] + >>> Literal[{0}] == Literal[{False}] + Traceback (most recent call last): + File "", line 1, in + TypeError: unhashable type: 'set' + +(Contributed by Yurii Karabas in :issue:`42345`.) \ No newline at end of file diff --git a/Grammar/python.gram b/Grammar/python.gram index 6385e1ed61f1d1..07def1db3abfc4 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -52,18 +52,18 @@ type_expressions[asdl_expr_seq*]: | a[asdl_expr_seq*]=','.expression+ {a} statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) } -statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmt { a } +statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmts { a } statement_newline[asdl_stmt_seq*]: | a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } - | simple_stmt + | simple_stmts | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _Py_Pass(EXTRA))) } | ENDMARKER { _PyPegen_interactive_exit(p) } -simple_stmt[asdl_stmt_seq*]: - | a=small_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup - | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a } +simple_stmts[asdl_stmt_seq*]: + | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup + | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a } # NOTE: assignment MUST precede expression, else parsing a simple assignment # will throw a SyntaxError. -small_stmt[stmt_ty] (memo): +simple_stmt[stmt_ty] (memo): | assignment | e=star_expressions { _Py_Expr(e, EXTRA) } | &'return' return_stmt @@ -417,10 +417,9 @@ class_def_raw[stmt_ty]: block[asdl_stmt_seq*] (memo): | NEWLINE INDENT a=statements DEDENT { a } - | simple_stmt + | simple_stmts | invalid_block -expressions_list[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_expression+ [','] { a } star_expressions[expr_ty]: | a=star_expression b=(',' c=star_expression { c })+ [','] { _Py_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) } @@ -600,7 +599,7 @@ slices[expr_ty]: | a[asdl_expr_seq*]=','.slice+ [','] { _Py_Tuple(a, Load, EXTRA) } slice[expr_ty]: | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _Py_Slice(a, b, c, EXTRA) } - | a=expression { a } + | a=named_expression { a } atom[expr_ty]: | NAME | 'True' { _Py_Constant(Py_True, NULL, EXTRA) } @@ -626,11 +625,11 @@ group[expr_ty]: | '(' a=(yield_expr | named_expression) ')' { a } | invalid_group genexp[expr_ty]: - | '(' a=expression ~ b=for_if_clauses ')' { _Py_GeneratorExp(a, b, EXTRA) } + | '(' a=named_expression ~ b=for_if_clauses ')' { _Py_GeneratorExp(a, b, EXTRA) } | invalid_comprehension -set[expr_ty]: '{' a=expressions_list '}' { _Py_Set(a, EXTRA) } +set[expr_ty]: '{' a=star_named_expressions '}' { _Py_Set(a, EXTRA) } setcomp[expr_ty]: - | '{' a=expression ~ b=for_if_clauses '}' { _Py_SetComp(a, b, EXTRA) } + | '{' a=named_expression ~ b=for_if_clauses '}' { _Py_SetComp(a, b, EXTRA) } | invalid_comprehension dict[expr_ty]: | '{' a=[double_starred_kvpairs] '}' { diff --git a/Include/bytesobject.h b/Include/bytesobject.h index 5062d8d123ad3e..39c241a2dcf5f7 100644 --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -1,5 +1,5 @@ -/* Bytes (String) object interface */ +/* Bytes object interface */ #ifndef Py_BYTESOBJECT_H #define Py_BYTESOBJECT_H @@ -10,23 +10,20 @@ extern "C" { #include /* -Type PyBytesObject represents a character string. An extra zero byte is +Type PyBytesObject represents a byte string. An extra zero byte is reserved at the end to ensure it is zero-terminated, but a size is present so strings with null bytes in them can be represented. This is an immutable object type. -There are functions to create new string objects, to test -an object for string-ness, and to get the -string value. The latter function returns a null pointer +There are functions to create new bytes objects, to test +an object for bytes-ness, and to get the +byte string value. The latter function returns a null pointer if the object is not of the proper type. There is a variant that takes an explicit size as well as a variant that assumes a zero-terminated string. Note that none of the -functions should be applied to nil objects. +functions should be applied to NULL pointer. */ -/* Caching the hash (ob_shash) saves recalculation of a string's hash value. - This significantly speeds up dict lookups. */ - PyAPI_DATA(PyTypeObject) PyBytes_Type; PyAPI_DATA(PyTypeObject) PyBytesIter_Type; @@ -50,26 +47,16 @@ PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); -/* Provides access to the internal data buffer and size of a string - object or the default encoded version of a Unicode object. Passing - NULL as *len parameter will force the string buffer to be - 0-terminated (passing a string with embedded NULL characters will +/* Provides access to the internal data buffer and size of a bytes object. + Passing NULL as len parameter will force the string buffer to be + 0-terminated (passing a string with embedded NUL characters will cause an exception). */ PyAPI_FUNC(int) PyBytes_AsStringAndSize( - PyObject *obj, /* string or Unicode object */ + PyObject *obj, /* bytes object */ char **s, /* pointer to buffer variable */ - Py_ssize_t *len /* pointer to length variable or NULL - (only possible for 0-terminated - strings) */ + Py_ssize_t *len /* pointer to length variable or NULL */ ); -/* Flags used by string formatting */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - #ifndef Py_LIMITED_API # define Py_CPYTHON_BYTESOBJECT_H # include "cpython/bytesobject.h" diff --git a/Include/cellobject.h b/Include/cellobject.h index f12aa90a42a8fe..81bc784d36f3e0 100644 --- a/Include/cellobject.h +++ b/Include/cellobject.h @@ -20,7 +20,7 @@ PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) -#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) +#define PyCell_SET(op, v) ((void)(((PyCellObject *)(op))->ob_ref = v)) #ifdef __cplusplus } diff --git a/Include/cpython/bytesobject.h b/Include/cpython/bytesobject.h index f284c5835df099..6b3f55224fc553 100644 --- a/Include/cpython/bytesobject.h +++ b/Include/cpython/bytesobject.h @@ -10,7 +10,7 @@ typedef struct { /* Invariants: * ob_sval contains space for 'ob_size+1' elements. * ob_sval[ob_size] == 0. - * ob_shash is the hash of the string or -1 if not computed yet. + * ob_shash is the hash of the byte string or -1 if not computed yet. */ } PyBytesObject; diff --git a/Include/cpython/listobject.h b/Include/cpython/listobject.h index e1b9462d5b3612..e3239152c497c2 100644 --- a/Include/cpython/listobject.h +++ b/Include/cpython/listobject.h @@ -30,5 +30,5 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op)) #define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i]) -#define PyList_SET_ITEM(op, i, v) (_PyList_CAST(op)->ob_item[i] = (v)) +#define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v))) #define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op)) diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 43b0be37557a3f..19c066b0ab78c7 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -516,6 +516,8 @@ struct _ts; /* Python 3.9 private API, invoked by the macros below. */ PyAPI_FUNC(int) _PyTrash_begin(struct _ts *tstate, PyObject *op); PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate); +/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */ +PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc); #define PyTrash_UNWIND_LEVEL 50 @@ -539,7 +541,7 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate); #define Py_TRASHCAN_BEGIN(op, dealloc) \ Py_TRASHCAN_BEGIN_CONDITION(op, \ - Py_TYPE(op)->tp_dealloc == (destructor)(dealloc)) + _PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc)) /* For backwards compatibility, these macros enable the trashcan * unconditionally */ diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index 0e6cc290912366..cfaee890f97151 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -54,8 +54,7 @@ struct _ts { /* Borrowed reference to the current frame (it can be NULL) */ PyFrameObject *frame; int recursion_depth; - char overflowed; /* The stack has overflowed. Allow 50 more calls - to handle the runtime error. */ + int recursion_headroom; /* Allow 50 more calls to handle any errors. */ int stackcheck_counter; /* 'tracing' keeps track of the execution depth when tracing/profiling. diff --git a/Include/cpython/pythonrun.h b/Include/cpython/pythonrun.h new file mode 100644 index 00000000000000..febda73f3ec6c0 --- /dev/null +++ b/Include/cpython/pythonrun.h @@ -0,0 +1,122 @@ +#ifndef Py_CPYTHON_PYTHONRUN_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); +PyAPI_FUNC(int) _PyRun_SimpleFileObject( + FILE *fp, + PyObject *filename, + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_AnyFileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_SimpleFileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveOneFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveOneObject( + FILE *fp, + PyObject *filename, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + PyCompilerFlags *flags); + + +PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, + PyObject *, PyCompilerFlags *); + +PyAPI_FUNC(PyObject *) PyRun_FileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int start, + PyObject *globals, + PyObject *locals, + int closeit, + PyCompilerFlags *flags); + + +PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( + const char *str, + const char *filename, /* decoded from the filesystem encoding */ + int start, + PyCompilerFlags *flags, + int optimize); +PyAPI_FUNC(PyObject *) Py_CompileStringObject( + const char *str, + PyObject *filename, int start, + PyCompilerFlags *flags, + int optimize); + +#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) +#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) + + +PyAPI_FUNC(const char *) _Py_SourceAsString( + PyObject *cmd, + const char *funcname, + const char *what, + PyCompilerFlags *cf, + PyObject **cmd_copy); + +PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( + const char *str, + PyObject *filename, + int start); + +PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags( + const char *str, + PyObject *filename, + int start, + PyCompilerFlags *flags); + + +/* A function flavor is also exported by libpython. It is required when + libpython is accessed directly rather than using header files which defines + macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to + export functions in pythonXX.dll. */ +PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); +PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleString(const char *s); +PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c); +PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p); +PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c); +PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags); + +/* Use macros for a bunch of old variants */ +#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) +#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) +#define PyRun_AnyFileEx(fp, name, closeit) \ + PyRun_AnyFileExFlags(fp, name, closeit, NULL) +#define PyRun_AnyFileFlags(fp, name, flags) \ + PyRun_AnyFileExFlags(fp, name, 0, flags) +#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) +#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) +#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) +#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) +#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) +#define PyRun_File(fp, p, s, g, l) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) +#define PyRun_FileEx(fp, p, s, g, l, c) \ + PyRun_FileExFlags(fp, p, s, g, l, c, NULL) +#define PyRun_FileFlags(fp, p, s, g, l, flags) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, flags) + + +/* Stuff with no proper home (yet) */ +PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); +PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; diff --git a/Include/cpython/tupleobject.h b/Include/cpython/tupleobject.h index 51dcd4237be18c..7cada8848c49fc 100644 --- a/Include/cpython/tupleobject.h +++ b/Include/cpython/tupleobject.h @@ -23,6 +23,6 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i]) /* Macro, *only* to be used to fill in brand new tuples */ -#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v) +#define PyTuple_SET_ITEM(op, i, v) ((void)(_PyTuple_CAST(op)->ob_item[i] = v)) PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); diff --git a/Include/internal/pycore_bitutils.h b/Include/internal/pycore_bitutils.h index 1602fc68d94074..e4aa7a3d0d0567 100644 --- a/Include/internal/pycore_bitutils.h +++ b/Include/internal/pycore_bitutils.h @@ -17,12 +17,9 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#if ((defined(__GNUC__) \ - && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) \ - || (defined(__clang__) \ - && (__clang_major__ >= 4 \ - || (__clang_major__ == 3 && __clang_minor__ >= 2)))) - /* __builtin_bswap16() is available since GCC 4.8 and clang 3.2, +#if defined(__GNUC__) \ + && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) + /* __builtin_bswap16() is available since GCC 4.8, __builtin_bswap32() is available since GCC 4.3, __builtin_bswap64() is available since GCC 4.3. */ # define _PY_HAVE_BUILTIN_BSWAP @@ -36,7 +33,7 @@ extern "C" { static inline uint16_t _Py_bswap16(uint16_t word) { -#ifdef _PY_HAVE_BUILTIN_BSWAP +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap16) return __builtin_bswap16(word); #elif defined(_MSC_VER) Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned short)); @@ -51,7 +48,7 @@ _Py_bswap16(uint16_t word) static inline uint32_t _Py_bswap32(uint32_t word) { -#ifdef _PY_HAVE_BUILTIN_BSWAP +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap32) return __builtin_bswap32(word); #elif defined(_MSC_VER) Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned long)); @@ -68,7 +65,7 @@ _Py_bswap32(uint32_t word) static inline uint64_t _Py_bswap64(uint64_t word) { -#ifdef _PY_HAVE_BUILTIN_BSWAP +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap64) return __builtin_bswap64(word); #elif defined(_MSC_VER) return _byteswap_uint64(word); diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index bbb667ea32d27e..38fd681f20c459 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -92,24 +92,8 @@ static inline int _Py_EnterRecursiveCall_inline(const char *where) { #define Py_EnterRecursiveCall(where) _Py_EnterRecursiveCall_inline(where) -/* Compute the "lower-water mark" for a recursion limit. When - * Py_LeaveRecursiveCall() is called with a recursion depth below this mark, - * the overflowed flag is reset to 0. */ -static inline int _Py_RecursionLimitLowerWaterMark(int limit) { - if (limit > 200) { - return (limit - 50); - } - else { - return (3 * (limit >> 2)); - } -} - static inline void _Py_LeaveRecursiveCall(PyThreadState *tstate) { tstate->recursion_depth--; - int limit = tstate->interp->ceval.recursion_limit; - if (tstate->recursion_depth < _Py_RecursionLimitLowerWaterMark(limit)) { - tstate->overflowed = 0; - } } static inline void _Py_LeaveRecursiveCall_inline(void) { diff --git a/Include/internal/pycore_format.h b/Include/internal/pycore_format.h new file mode 100644 index 00000000000000..1b8d57539ca505 --- /dev/null +++ b/Include/internal/pycore_format.h @@ -0,0 +1,27 @@ +#ifndef Py_INTERNAL_FORMAT_H +#define Py_INTERNAL_FORMAT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Format codes + * F_LJUST '-' + * F_SIGN '+' + * F_BLANK ' ' + * F_ALT '#' + * F_ZERO '0' + */ +#define F_LJUST (1<<0) +#define F_SIGN (1<<1) +#define F_BLANK (1<<2) +#define F_ALT (1<<3) +#define F_ZERO (1<<4) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FORMAT_H */ diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h index 35a67abebac6f7..fd9fa5ab23faa2 100644 --- a/Include/internal/pycore_import.h +++ b/Include/internal/pycore_import.h @@ -13,7 +13,7 @@ PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( #ifdef HAVE_FORK extern PyStatus _PyImport_ReInitLock(void); #endif -extern void _PyImport_Cleanup(PyThreadState *tstate); +extern PyObject* _PyImport_BootstrapImp(PyThreadState *tstate); #ifdef __cplusplus } diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index e748112cbf7fe1..b691e6325780ed 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -68,7 +68,8 @@ extern void _PyFloat_Fini(PyThreadState *tstate); extern void _PySlice_Fini(PyThreadState *tstate); extern void _PyAsyncGen_Fini(PyThreadState *tstate); -extern void PyOS_FiniInterrupts(void); +extern int _PySignal_Init(int install_signal_handlers); +extern void _PySignal_Fini(void); extern void _PyExc_Fini(PyThreadState *tstate); extern void _PyImport_Fini(void); diff --git a/Include/intrcheck.h b/Include/intrcheck.h index 88f2a7076ce379..b8cc65601683cb 100644 --- a/Include/intrcheck.h +++ b/Include/intrcheck.h @@ -5,7 +5,6 @@ extern "C" { #endif PyAPI_FUNC(int) PyOS_InterruptOccurred(void); -PyAPI_FUNC(void) PyOS_InitInterrupts(void); #ifdef HAVE_FORK #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 PyAPI_FUNC(void) PyOS_BeforeFork(void); diff --git a/Include/object.h b/Include/object.h index 48ba0e1ac5a54b..cbf6fcba13997b 100644 --- a/Include/object.h +++ b/Include/object.h @@ -128,16 +128,11 @@ static inline Py_ssize_t _Py_REFCNT(const PyObject *ob) { #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob)) -static inline Py_ssize_t _Py_SIZE(const PyVarObject *ob) { - return ob->ob_size; -} -#define Py_SIZE(ob) _Py_SIZE(_PyVarObject_CAST_CONST(ob)) - +// bpo-39573: The Py_SET_TYPE() function must be used to set an object type. +#define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) -static inline PyTypeObject* _Py_TYPE(const PyObject *ob) { - return ob->ob_type; -} -#define Py_TYPE(ob) _Py_TYPE(_PyObject_CAST_CONST(ob)) +// bpo-39573: The Py_SET_SIZE() function must be used to set an object size. +#define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size) static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) { @@ -436,7 +431,6 @@ static inline void _Py_INCREF(PyObject *op) #endif op->ob_refcnt++; } - #define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op)) static inline void _Py_DECREF( @@ -459,7 +453,6 @@ static inline void _Py_DECREF( _Py_Dealloc(op); } } - #ifdef Py_REF_DEBUG # define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op)) #else @@ -558,8 +551,8 @@ static inline PyObject* _Py_XNewRef(PyObject *obj) // Py_NewRef() and Py_XNewRef() are exported as functions for the stable ABI. // Names overriden with macros by static inline functions for best // performances. -#define Py_NewRef(obj) _Py_NewRef(obj) -#define Py_XNewRef(obj) _Py_XNewRef(obj) +#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj)) +#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj)) /* diff --git a/Include/objimpl.h b/Include/objimpl.h index af537175bfed85..1408d051ba7efe 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -38,7 +38,7 @@ Functions and macros for modules that implement new object types. object with room for n items. In addition to the refcount and type pointer fields, this also fills in the ob_size field. - - PyObject_Del(op) releases the memory allocated for an object. It does not + - PyObject_Free(op) releases the memory allocated for an object. It does not run a destructor -- it only frees the memory. PyObject_Free is identical. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't @@ -102,7 +102,9 @@ PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); -/* Macros */ +// Deprecated aliases only kept for backward compatibility. +// PyObject_Del and PyObject_DEL are defined with no parameter to be able to +// use them as function pointers (ex: tp_free = PyObject_Del). #define PyObject_MALLOC PyObject_Malloc #define PyObject_REALLOC PyObject_Realloc #define PyObject_FREE PyObject_Free @@ -138,8 +140,8 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) -// Alias to PyObject_New(). In Python 3.8, PyObject_NEW() called directly -// PyObject_MALLOC() with _PyObject_VAR_SIZE(). +// Alias to PyObject_NewVar(). In Python 3.8, PyObject_NEW_VAR() called +// directly PyObject_MALLOC() with _PyObject_VAR_SIZE(). #define PyObject_NEW_VAR(type, typeobj, n) PyObject_NewVar(type, typeobj, n) diff --git a/Include/patchlevel.h b/Include/patchlevel.h index b7d2a9aa2e1b93..1af225ca0936b5 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 10 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_SERIAL 3 /* Version as a string */ -#define PY_VERSION "3.10.0a2+" +#define PY_VERSION "3.10.0a3+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Include/pymem.h b/Include/pymem.h index 607feb9484f24f..92cd5369589edb 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -53,18 +53,6 @@ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); -/* Macros. */ - -/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL - for malloc(0), which would be treated as an error. Some platforms - would return a pointer with no memory behind it, which would break - pymalloc. To solve these problems, allocate an extra byte. */ -/* Returns NULL to indicate error if a negative size or size larger than - Py_ssize_t can represent is supplied. Helps prevents security holes. */ -#define PyMem_MALLOC(n) PyMem_Malloc(n) -#define PyMem_REALLOC(p, n) PyMem_Realloc(p, n) -#define PyMem_FREE(p) PyMem_Free(p) - /* * Type-oriented memory interface * ============================== @@ -78,9 +66,6 @@ PyAPI_FUNC(void) PyMem_Free(void *ptr); #define PyMem_New(type, n) \ ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) -#define PyMem_NEW(type, n) \ - ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) /* * The value of (p) is always clobbered by this macro regardless of success. @@ -91,15 +76,18 @@ PyAPI_FUNC(void) PyMem_Free(void *ptr); #define PyMem_Resize(p, type, n) \ ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) -#define PyMem_RESIZE(p, type, n) \ - ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) -/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used - * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. - */ -#define PyMem_Del PyMem_Free -#define PyMem_DEL PyMem_FREE + +// Deprecated aliases only kept for backward compatibility. +// PyMem_Del and PyMem_DEL are defined with no parameter to be able to use +// them as function pointers (ex: dealloc = PyMem_Del). +#define PyMem_MALLOC(n) PyMem_Malloc(n) +#define PyMem_NEW(type, n) PyMem_New(type, n) +#define PyMem_REALLOC(p, n) PyMem_Realloc(p, n) +#define PyMem_RESIZE(p, type, n) PyMem_Resize(p, type, n) +#define PyMem_FREE(p) PyMem_Free(p) +#define PyMem_Del PyMem_Free +#define PyMem_DEL PyMem_Free #ifndef Py_LIMITED_API diff --git a/Include/pyport.h b/Include/pyport.h index 79fc7c4a5286f4..6687849d844724 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -869,4 +869,16 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; # define _Py_NO_RETURN #endif + +// Preprocessor check for a builtin preprocessor function. Always return 0 +// if __has_builtin() macro is not defined. +// +// __has_builtin() is available on clang and GCC 10. +#ifdef __has_builtin +# define _Py__has_builtin(x) __has_builtin(x) +#else +# define _Py__has_builtin(x) 0 +#endif + + #endif /* Py_PYPORT_H */ diff --git a/Include/pythonrun.h b/Include/pythonrun.h index d43734b5a12ff0..cc6c745a4d33d8 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -7,137 +7,21 @@ extern "C" { #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_AnyFileExFlags( - FILE *fp, - const char *filename, /* decoded from the filesystem encoding */ - int closeit, - PyCompilerFlags *flags); -PyAPI_FUNC(int) PyRun_SimpleFileExFlags( - FILE *fp, - const char *filename, /* decoded from the filesystem encoding */ - int closeit, - PyCompilerFlags *flags); -PyAPI_FUNC(int) PyRun_InteractiveOneFlags( - FILE *fp, - const char *filename, /* decoded from the filesystem encoding */ - PyCompilerFlags *flags); -PyAPI_FUNC(int) PyRun_InteractiveOneObject( - FILE *fp, - PyObject *filename, - PyCompilerFlags *flags); -PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( - FILE *fp, - const char *filename, /* decoded from the filesystem encoding */ - PyCompilerFlags *flags); - - -PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, - PyObject *, PyCompilerFlags *); - -PyAPI_FUNC(PyObject *) PyRun_FileExFlags( - FILE *fp, - const char *filename, /* decoded from the filesystem encoding */ - int start, - PyObject *globals, - PyObject *locals, - int closeit, - PyCompilerFlags *flags); -#endif - -#ifdef Py_LIMITED_API PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int); -#else -#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) -#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) -PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( - const char *str, - const char *filename, /* decoded from the filesystem encoding */ - int start, - PyCompilerFlags *flags, - int optimize); -PyAPI_FUNC(PyObject *) Py_CompileStringObject( - const char *str, - PyObject *filename, int start, - PyCompilerFlags *flags, - int optimize); -#endif + PyAPI_FUNC(struct symtable *) Py_SymtableString( const char *str, const char *filename, /* decoded from the filesystem encoding */ int start); -#ifndef Py_LIMITED_API -PyAPI_FUNC(const char *) _Py_SourceAsString( - PyObject *cmd, - const char *funcname, - const char *what, - PyCompilerFlags *cf, - PyObject **cmd_copy); - -PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( - const char *str, - PyObject *filename, - int start); - -PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags( - const char *str, - PyObject *filename, - int start, - PyCompilerFlags *flags); -#endif PyAPI_FUNC(void) PyErr_Print(void); PyAPI_FUNC(void) PyErr_PrintEx(int); PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); -#ifndef Py_LIMITED_API -/* A function flavor is also exported by libpython. It is required when - libpython is accessed directly rather than using header files which defines - macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to - export functions in pythonXX.dll. */ -PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); -PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); -PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); -PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_SimpleString(const char *s); -PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p); -PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c); -PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p); -PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p); -PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l); -PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c); -PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags); - -/* Use macros for a bunch of old variants */ -#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) -#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) -#define PyRun_AnyFileEx(fp, name, closeit) \ - PyRun_AnyFileExFlags(fp, name, closeit, NULL) -#define PyRun_AnyFileFlags(fp, name, flags) \ - PyRun_AnyFileExFlags(fp, name, 0, flags) -#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) -#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) -#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) -#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) -#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) -#define PyRun_File(fp, p, s, g, l) \ - PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) -#define PyRun_FileEx(fp, p, s, g, l, c) \ - PyRun_FileExFlags(fp, p, s, g, l, c, NULL) -#define PyRun_FileFlags(fp, p, s, g, l, flags) \ - PyRun_FileExFlags(fp, p, s, g, l, 0, flags) -#endif /* Stuff with no proper home (yet) */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); -#endif PyAPI_DATA(int) (*PyOS_InputHook)(void); PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); -#ifndef Py_LIMITED_API -PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; -#endif /* Stack size, in "pointers" (so we get extra safety margins on 64-bit platforms). On a 32-bit platform, this translates @@ -154,6 +38,12 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; PyAPI_FUNC(int) PyOS_CheckStack(void); #endif +#ifndef Py_LIMITED_API +# define Py_CPYTHON_PYTHONRUN_H +# include "cpython/pythonrun.h" +# undef Py_CPYTHON_PYTHONRUN_H +#endif + #ifdef __cplusplus } #endif diff --git a/Include/pytime.h b/Include/pytime.h index bdda1da2e6b8f2..944170f7d0c4c3 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -164,22 +164,6 @@ PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, _PyTime_t mul, _PyTime_t div); -/* Get the current time from the system clock. - - The function cannot fail. _PyTime_Init() ensures that the system clock - works. */ -PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); - -/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. - The clock is not affected by system clock updates. The reference point of - the returned value is undefined, so that only the difference between the - results of consecutive calls is valid. - - The function cannot fail. _PyTime_Init() ensures that a monotonic clock - is available and works. */ -PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); - - /* Structure used by time.get_clock_info() */ typedef struct { const char *implementation; @@ -189,13 +173,34 @@ typedef struct { } _Py_clock_info_t; /* Get the current time from the system clock. - * Fill clock information if info is not NULL. - * Raise an exception and return -1 on error, return 0 on success. + + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and truncated the clock to + _PyTime_MIN or _PyTime_MAX. + + Use _PyTime_GetSystemClockWithInfo() to check for failure. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); + +/* Get the current time from the system clock. + * On success, set *t and *info (if not NULL), and return 0. + * On error, raise an exception and return -1. */ PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( _PyTime_t *t, _Py_clock_info_t *info); +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and truncated the clock to + _PyTime_MIN or _PyTime_MAX. + + Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); + /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the @@ -209,10 +214,6 @@ PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( _Py_clock_info_t *info); -/* Initialize time. - Return 0 on success, raise an exception and return -1 on error. */ -PyAPI_FUNC(int) _PyTime_Init(void); - /* Converts a timestamp to the Gregorian time, using the local time zone. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); @@ -224,8 +225,11 @@ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); /* Get the performance counter: clock with the highest available resolution to measure a short duration. - The function cannot fail. _PyTime_Init() ensures that the system clock - works. */ + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and truncated the clock to + _PyTime_MIN or _PyTime_MAX. + + Use _PyTime_GetPerfCounterWithInfo() to check for failure. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); /* Get the performance counter: clock with the highest available resolution to diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py index 36cd9930003475..28690f8c0bdc5c 100644 --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -430,7 +430,6 @@ def __subclasshook__(cls, C): class Set(Collection): - """A set is a finite, iterable container. This class provides concrete generic implementations of all @@ -657,17 +656,15 @@ def __isub__(self, it): class Mapping(Collection): - - __slots__ = () - """A Mapping is a generic container for associating key/value pairs. This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__. - """ + __slots__ = () + @abstractmethod def __getitem__(self, key): raise KeyError @@ -789,18 +786,16 @@ def __iter__(self): class MutableMapping(Mapping): - - __slots__ = () - """A MutableMapping is a generic container for associating key/value pairs. This class provides concrete generic implementations of all methods except for __getitem__, __setitem__, __delitem__, __iter__, and __len__. - """ + __slots__ = () + @abstractmethod def __setitem__(self, key, value): raise KeyError @@ -879,7 +874,6 @@ def setdefault(self, key, default=None): class Sequence(Reversible, Collection): - """All the operations on a read-only sequence. Concrete subclasses must override __new__ or __init__, @@ -947,7 +941,6 @@ def count(self, value): class ByteString(Sequence): - """This unifies bytes and bytearray. XXX Should add all their methods. @@ -960,16 +953,14 @@ class ByteString(Sequence): class MutableSequence(Sequence): - - __slots__ = () - """All the operations on a read-write sequence. Concrete subclasses must provide __new__ or __init__, __getitem__, __setitem__, __delitem__, __len__, and insert(). - """ + __slots__ = () + @abstractmethod def __setitem__(self, index, value): raise IndexError diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py index 8a696ee9895e9b..37975fe8a3eefa 100644 --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -52,7 +52,7 @@ def _find_executable(executable, path=None): return executable -def _read_output(commandstring): +def _read_output(commandstring, capture_stderr=False): """Output from successful command execution or None""" # Similar to os.popen(commandstring, "r").read(), # but without actually using os.popen because that @@ -67,7 +67,10 @@ def _read_output(commandstring): os.getpid(),), "w+b") with contextlib.closing(fp) as fp: - cmd = "%s 2>/dev/null >'%s'" % (commandstring, fp.name) + if capture_stderr: + cmd = "%s >'%s' 2>&1" % (commandstring, fp.name) + else: + cmd = "%s 2>/dev/null >'%s'" % (commandstring, fp.name) return fp.read().decode('utf-8').strip() if not os.system(cmd) else None @@ -128,7 +131,7 @@ def _get_system_version_tuple(): _SYSTEM_VERSION_TUPLE = () return _SYSTEM_VERSION_TUPLE - + def _remove_original_values(_config_vars): """Remove original unmodified values for testing""" @@ -145,6 +148,33 @@ def _save_modified_value(_config_vars, cv, newvalue): _config_vars[_INITPRE + cv] = oldvalue _config_vars[cv] = newvalue + +_cache_default_sysroot = None +def _default_sysroot(cc): + """ Returns the root of the default SDK for this system, or '/' """ + global _cache_default_sysroot + + if _cache_default_sysroot is not None: + return _cache_default_sysroot + + contents = _read_output('%s -c -E -v - "): + in_incdirs = True + elif line.startswith("End of search list"): + in_incdirs = False + elif in_incdirs: + line = line.strip() + if line == '/usr/include': + _cache_default_sysroot = '/' + elif line.endswith(".sdk/usr/include"): + _cache_default_sysroot = line[:-12] + if _cache_default_sysroot is None: + _cache_default_sysroot = '/' + + return _cache_default_sysroot + def _supports_universal_builds(): """Returns True if universal builds are supported on this system""" # As an approximation, we assume that if we are running on 10.4 or above, @@ -357,7 +387,7 @@ def compiler_fixup(compiler_so, cc_args): elif not _supports_arm64_builds(): # Look for "-arch arm64" and drop that - for idx in range(len(compiler_so)): + for idx in reversed(range(len(compiler_so))): if compiler_so[idx] == '-arch' and compiler_so[idx+1] == "arm64": del compiler_so[idx:idx+2] diff --git a/Lib/ast.py b/Lib/ast.py index 11c0746ce6faa2..69fdeeaaf22767 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -662,17 +662,23 @@ def next(self): except ValueError: return self + +_SINGLE_QUOTES = ("'", '"') +_MULTI_QUOTES = ('"""', "'''") +_ALL_QUOTES = (*_SINGLE_QUOTES, *_MULTI_QUOTES) + class _Unparser(NodeVisitor): """Methods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting is disregarded.""" - def __init__(self): + def __init__(self, *, _avoid_backslashes=False): self._source = [] self._buffer = [] self._precedences = {} self._type_ignores = {} self._indent = 0 + self._avoid_backslashes = _avoid_backslashes def interleave(self, inter, f, seq): """Call f on each item in seq, calling inter() in between.""" @@ -1067,15 +1073,85 @@ def visit_AsyncWith(self, node): with self.block(extra=self.get_type_comment(node)): self.traverse(node.body) + def _str_literal_helper( + self, string, *, quote_types=_ALL_QUOTES, escape_special_whitespace=False + ): + """Helper for writing string literals, minimizing escapes. + Returns the tuple (string literal to write, possible quote types). + """ + def escape_char(c): + # \n and \t are non-printable, but we only escape them if + # escape_special_whitespace is True + if not escape_special_whitespace and c in "\n\t": + return c + # Always escape backslashes and other non-printable characters + if c == "\\" or not c.isprintable(): + return c.encode("unicode_escape").decode("ascii") + return c + + escaped_string = "".join(map(escape_char, string)) + possible_quotes = quote_types + if "\n" in escaped_string: + possible_quotes = [q for q in possible_quotes if q in _MULTI_QUOTES] + possible_quotes = [q for q in possible_quotes if q not in escaped_string] + if not possible_quotes: + # If there aren't any possible_quotes, fallback to using repr + # on the original string. Try to use a quote from quote_types, + # e.g., so that we use triple quotes for docstrings. + string = repr(string) + quote = next((q for q in quote_types if string[0] in q), string[0]) + return string[1:-1], [quote] + if escaped_string: + # Sort so that we prefer '''"''' over """\"""" + possible_quotes.sort(key=lambda q: q[0] == escaped_string[-1]) + # If we're using triple quotes and we'd need to escape a final + # quote, escape it + if possible_quotes[0][0] == escaped_string[-1]: + assert len(possible_quotes[0]) == 3 + escaped_string = escaped_string[:-1] + "\\" + escaped_string[-1] + return escaped_string, possible_quotes + + def _write_str_avoiding_backslashes(self, string, *, quote_types=_ALL_QUOTES): + """Write string literal value with a best effort attempt to avoid backslashes.""" + string, quote_types = self._str_literal_helper(string, quote_types=quote_types) + quote_type = quote_types[0] + self.write(f"{quote_type}{string}{quote_type}") + def visit_JoinedStr(self, node): self.write("f") - self._fstring_JoinedStr(node, self.buffer_writer) - self.write(repr(self.buffer)) + if self._avoid_backslashes: + self._fstring_JoinedStr(node, self.buffer_writer) + self._write_str_avoiding_backslashes(self.buffer) + return + + # If we don't need to avoid backslashes globally (i.e., we only need + # to avoid them inside FormattedValues), it's cosmetically preferred + # to use escaped whitespace. That is, it's preferred to use backslashes + # for cases like: f"{x}\n". To accomplish this, we keep track of what + # in our buffer corresponds to FormattedValues and what corresponds to + # Constant parts of the f-string, and allow escapes accordingly. + buffer = [] + for value in node.values: + meth = getattr(self, "_fstring_" + type(value).__name__) + meth(value, self.buffer_writer) + buffer.append((self.buffer, isinstance(value, Constant))) + new_buffer = [] + quote_types = _ALL_QUOTES + for value, is_constant in buffer: + # Repeatedly narrow down the list of possible quote_types + value, quote_types = self._str_literal_helper( + value, quote_types=quote_types, + escape_special_whitespace=is_constant + ) + new_buffer.append(value) + value = "".join(new_buffer) + quote_type = quote_types[0] + self.write(f"{quote_type}{value}{quote_type}") def visit_FormattedValue(self, node): self.write("f") self._fstring_FormattedValue(node, self.buffer_writer) - self.write(repr(self.buffer)) + self._write_str_avoiding_backslashes(self.buffer) def _fstring_JoinedStr(self, node, write): for value in node.values: @@ -1090,11 +1166,13 @@ def _fstring_Constant(self, node, write): def _fstring_FormattedValue(self, node, write): write("{") - unparser = type(self)() + unparser = type(self)(_avoid_backslashes=True) unparser.set_precedence(_Precedence.TEST.next(), node.value) expr = unparser.visit(node.value) if expr.startswith("{"): write(" ") # Separate pair of opening brackets as "{ {" + if "\\" in expr: + raise ValueError("Unable to avoid backslash in f-string expression part") write(expr) if node.conversion != -1: conversion = chr(node.conversion) @@ -1111,33 +1189,17 @@ def visit_Name(self, node): self.write(node.id) def _write_docstring(self, node): - def esc_char(c): - if c in ("\n", "\t"): - # In the AST form, we don't know the author's intentation - # about how this should be displayed. We'll only escape - # \n and \t, because they are more likely to be unescaped - # in the source - return c - return c.encode('unicode_escape').decode('ascii') - self.fill() if node.kind == "u": self.write("u") - - value = node.value - if value: - # Preserve quotes in the docstring by escaping them - value = "".join(map(esc_char, value)) - if value[-1] == '"': - value = value.replace('"', '\\"', -1) - value = value.replace('"""', '""\\"') - - self.write(f'"""{value}"""') + self._write_str_avoiding_backslashes(node.value, quote_types=_MULTI_QUOTES) def _write_constant(self, value): if isinstance(value, (float, complex)): # Substitute overflowing decimal literal for AST infinities. self.write(repr(value).replace("inf", _INFSTR)) + elif self._avoid_backslashes and isinstance(value, str): + self._write_str_avoiding_backslashes(value) else: self.write(repr(value)) diff --git a/Lib/asyncio/__init__.py b/Lib/asyncio/__init__.py index eb84bfb189ccf3..200b14c2a3f21e 100644 --- a/Lib/asyncio/__init__.py +++ b/Lib/asyncio/__init__.py @@ -20,10 +20,6 @@ from .threads import * from .transports import * -# Exposed for _asynciomodule.c to implement now deprecated -# Task.all_tasks() method. This function will be removed in 3.9. -from .tasks import _all_tasks_compat # NoQA - __all__ = (base_events.__all__ + coroutines.__all__ + events.__all__ + diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index b2d446a51fedb5..f789635e0f893a 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -350,7 +350,7 @@ async def start_serving(self): self._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. - await tasks.sleep(0, loop=self._loop) + await tasks.sleep(0) async def serve_forever(self): if self._serving_forever_fut is not None: @@ -541,8 +541,7 @@ async def shutdown_asyncgens(self): results = await tasks.gather( *[ag.aclose() for ag in closing_agens], - return_exceptions=True, - loop=self) + return_exceptions=True) for result, agen in zip(results, closing_agens): if isinstance(result, Exception): @@ -1457,7 +1456,7 @@ async def create_server( fs = [self._create_server_getaddrinfo(host, port, family=family, flags=flags) for host in hosts] - infos = await tasks.gather(*fs, loop=self) + infos = await tasks.gather(*fs) infos = set(itertools.chain.from_iterable(infos)) completed = False @@ -1515,7 +1514,7 @@ async def create_server( server._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. - await tasks.sleep(0, loop=self) + await tasks.sleep(0) if self._debug: logger.info("%r is serving", server) @@ -1525,14 +1524,6 @@ async def connect_accepted_socket( self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None): - """Handle an accepted connection. - - This is used by servers that accept connections outside of - asyncio but that use asyncio to handle connections. - - This method is a coroutine. When completed, the coroutine - returns a (transport, protocol) pair. - """ if sock.type != socket.SOCK_STREAM: raise ValueError(f'A Stream Socket was expected, got {sock!r}') diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 0dce87b8ecc586..1a20f362ec3869 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -418,6 +418,20 @@ async def create_unix_server( """ raise NotImplementedError + async def connect_accepted_socket( + self, protocol_factory, sock, + *, ssl=None, + ssl_handshake_timeout=None): + """Handle an accepted connection. + + This is used by servers that accept connections outside of + asyncio, but use asyncio to handle connections. + + This method is a coroutine. When completed, the coroutine + returns a (transport, protocol) pair. + """ + raise NotImplementedError + async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, diff --git a/Lib/asyncio/exceptions.py b/Lib/asyncio/exceptions.py index e03602ef576234..f07e4486577381 100644 --- a/Lib/asyncio/exceptions.py +++ b/Lib/asyncio/exceptions.py @@ -34,8 +34,9 @@ class IncompleteReadError(EOFError): - expected: total number of expected bytes (or None if unknown) """ def __init__(self, partial, expected): + r_expected = 'undefined' if expected is None else repr(expected) super().__init__(f'{len(partial)} bytes read on a total of ' - f'{expected!r} expected bytes') + f'{r_expected} expected bytes') self.partial = partial self.expected = expected diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index bed4da52fd4d98..2d22ef66c9c426 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -115,7 +115,7 @@ def _log_traceback(self): @_log_traceback.setter def _log_traceback(self, val): - if bool(val): + if val: raise ValueError('_log_traceback can only be set to False') self.__log_traceback = False diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index f1ce7324785ba9..a7453fb1c77287 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -3,10 +3,9 @@ __all__ = ('Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore') import collections -import warnings -from . import events from . import exceptions +from . import mixins class _ContextManagerMixin: @@ -20,7 +19,7 @@ async def __aexit__(self, exc_type, exc, tb): self.release() -class Lock(_ContextManagerMixin): +class Lock(_ContextManagerMixin, mixins._LoopBoundMixin): """Primitive lock objects. A primitive lock is a synchronization primitive that is not owned @@ -74,16 +73,10 @@ class Lock(_ContextManagerMixin): """ - def __init__(self, *, loop=None): + def __init__(self, *, loop=mixins._marker): + super().__init__(loop=loop) self._waiters = None self._locked = False - if loop is None: - self._loop = events.get_event_loop() - else: - self._loop = loop - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) def __repr__(self): res = super().__repr__() @@ -109,7 +102,7 @@ async def acquire(self): if self._waiters is None: self._waiters = collections.deque() - fut = self._loop.create_future() + fut = self._get_loop().create_future() self._waiters.append(fut) # Finally block should be called before the CancelledError @@ -161,7 +154,7 @@ def _wake_up_first(self): fut.set_result(True) -class Event: +class Event(mixins._LoopBoundMixin): """Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set @@ -170,16 +163,10 @@ class Event: false. """ - def __init__(self, *, loop=None): + def __init__(self, *, loop=mixins._marker): + super().__init__(loop=loop) self._waiters = collections.deque() self._value = False - if loop is None: - self._loop = events.get_event_loop() - else: - self._loop = loop - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) def __repr__(self): res = super().__repr__() @@ -220,7 +207,7 @@ async def wait(self): if self._value: return True - fut = self._loop.create_future() + fut = self._get_loop().create_future() self._waiters.append(fut) try: await fut @@ -229,7 +216,7 @@ async def wait(self): self._waiters.remove(fut) -class Condition(_ContextManagerMixin): +class Condition(_ContextManagerMixin, mixins._LoopBoundMixin): """Asynchronous equivalent to threading.Condition. This class implements condition variable objects. A condition variable @@ -239,18 +226,11 @@ class Condition(_ContextManagerMixin): A new Lock object is created and used as the underlying lock. """ - def __init__(self, lock=None, *, loop=None): - if loop is None: - self._loop = events.get_event_loop() - else: - self._loop = loop - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) - + def __init__(self, lock=None, *, loop=mixins._marker): + super().__init__(loop=loop) if lock is None: - lock = Lock(loop=loop) - elif lock._loop is not self._loop: + lock = Lock() + elif lock._loop is not self._get_loop(): raise ValueError("loop argument must agree with lock") self._lock = lock @@ -284,7 +264,7 @@ async def wait(self): self.release() try: - fut = self._loop.create_future() + fut = self._get_loop().create_future() self._waiters.append(fut) try: await fut @@ -351,7 +331,7 @@ def notify_all(self): self.notify(len(self._waiters)) -class Semaphore(_ContextManagerMixin): +class Semaphore(_ContextManagerMixin, mixins._LoopBoundMixin): """A Semaphore implementation. A semaphore manages an internal counter which is decremented by each @@ -366,18 +346,12 @@ class Semaphore(_ContextManagerMixin): ValueError is raised. """ - def __init__(self, value=1, *, loop=None): + def __init__(self, value=1, *, loop=mixins._marker): + super().__init__(loop=loop) if value < 0: raise ValueError("Semaphore initial value must be >= 0") self._value = value self._waiters = collections.deque() - if loop is None: - self._loop = events.get_event_loop() - else: - self._loop = loop - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) def __repr__(self): res = super().__repr__() @@ -407,7 +381,7 @@ async def acquire(self): True. """ while self._value <= 0: - fut = self._loop.create_future() + fut = self._get_loop().create_future() self._waiters.append(fut) try: await fut @@ -436,12 +410,7 @@ class BoundedSemaphore(Semaphore): above the initial value. """ - def __init__(self, value=1, *, loop=None): - if loop: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) - + def __init__(self, value=1, *, loop=mixins._marker): self._bound_value = value super().__init__(value, loop=loop) diff --git a/Lib/asyncio/mixins.py b/Lib/asyncio/mixins.py new file mode 100644 index 00000000000000..650df05ccc93ea --- /dev/null +++ b/Lib/asyncio/mixins.py @@ -0,0 +1,31 @@ +"""Event loop mixins.""" + +import threading +from . import events + +_global_lock = threading.Lock() + +# Used as a sentinel for loop parameter +_marker = object() + + +class _LoopBoundMixin: + _loop = None + + def __init__(self, *, loop=_marker): + if loop is not _marker: + raise TypeError( + f'As of 3.10, the *loop* parameter was removed from ' + f'{type(self).__name__}() since it is no longer necessary' + ) + + def _get_loop(self): + loop = events._get_running_loop() + + if self._loop is None: + with _global_lock: + if self._loop is None: + self._loop = loop + if loop is not self._loop: + raise RuntimeError(f'{self!r} is bound to a different event loop') + return loop diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py index cd3f7c6a567891..a87ec8b2158767 100644 --- a/Lib/asyncio/queues.py +++ b/Lib/asyncio/queues.py @@ -2,10 +2,9 @@ import collections import heapq -import warnings -from . import events from . import locks +from . import mixins class QueueEmpty(Exception): @@ -18,7 +17,7 @@ class QueueFull(Exception): pass -class Queue: +class Queue(mixins._LoopBoundMixin): """A queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it @@ -30,14 +29,8 @@ class Queue: interrupted between calling qsize() and doing an operation on the Queue. """ - def __init__(self, maxsize=0, *, loop=None): - if loop is None: - self._loop = events.get_event_loop() - else: - self._loop = loop - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + def __init__(self, maxsize=0, *, loop=mixins._marker): + super().__init__(loop=loop) self._maxsize = maxsize # Futures. @@ -45,7 +38,7 @@ def __init__(self, maxsize=0, *, loop=None): # Futures. self._putters = collections.deque() self._unfinished_tasks = 0 - self._finished = locks.Event(loop=loop) + self._finished = locks.Event() self._finished.set() self._init(maxsize) @@ -122,7 +115,7 @@ async def put(self, item): slot is available before adding item. """ while self.full(): - putter = self._loop.create_future() + putter = self._get_loop().create_future() self._putters.append(putter) try: await putter @@ -160,7 +153,7 @@ async def get(self): If queue is empty, wait until an item is available. """ while self.empty(): - getter = self._loop.create_future() + getter = self._get_loop().create_future() self._getters.append(getter) try: await getter diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index 268635d68fb0c0..9a5e9a48479ef7 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -60,8 +60,7 @@ def _cancel_all_tasks(loop): for task in to_cancel: task.cancel() - loop.run_until_complete( - tasks.gather(*to_cancel, loop=loop, return_exceptions=True)) + loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True)) for task in to_cancel: if task.cancelled(): diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 3c80bb88925905..96a9f97200d0d9 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -23,7 +23,7 @@ async def open_connection(host=None, port=None, *, - loop=None, limit=_DEFAULT_LIMIT, **kwds): + limit=_DEFAULT_LIMIT, **kwds): """A wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a @@ -41,12 +41,7 @@ async def open_connection(host=None, port=None, *, StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) """ - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, loop=loop) transport, _ = await loop.create_connection( @@ -56,7 +51,7 @@ async def open_connection(host=None, port=None, *, async def start_server(client_connected_cb, host=None, port=None, *, - loop=None, limit=_DEFAULT_LIMIT, **kwds): + limit=_DEFAULT_LIMIT, **kwds): """Start a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: @@ -78,12 +73,7 @@ async def start_server(client_connected_cb, host=None, port=None, *, The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. """ - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() def factory(): reader = StreamReader(limit=limit, loop=loop) @@ -98,14 +88,10 @@ def factory(): # UNIX Domain Sockets are supported on this platform async def open_unix_connection(path=None, *, - loop=None, limit=_DEFAULT_LIMIT, **kwds): + limit=_DEFAULT_LIMIT, **kwds): """Similar to `open_connection` but works with UNIX Domain Sockets.""" - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() + reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, loop=loop) transport, _ = await loop.create_unix_connection( @@ -114,14 +100,9 @@ async def open_unix_connection(path=None, *, return reader, writer async def start_unix_server(client_connected_cb, path=None, *, - loop=None, limit=_DEFAULT_LIMIT, **kwds): + limit=_DEFAULT_LIMIT, **kwds): """Similar to `start_server` but works with UNIX Domain Sockets.""" - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() def factory(): reader = StreamReader(limit=limit, loop=loop) diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index c9506b158302b5..cd10231f710f11 100644 --- a/Lib/asyncio/subprocess.py +++ b/Lib/asyncio/subprocess.py @@ -1,7 +1,6 @@ __all__ = 'create_subprocess_exec', 'create_subprocess_shell' import subprocess -import warnings from . import events from . import protocols @@ -193,24 +192,14 @@ async def communicate(self, input=None): stderr = self._read_stream(2) else: stderr = self._noop() - stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr, - loop=self._loop) + stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr) await self.wait() return (stdout, stderr) async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None, - loop=None, limit=streams._DEFAULT_LIMIT, - **kwds): - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8 " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, - stacklevel=2 - ) - + limit=streams._DEFAULT_LIMIT, **kwds): + loop = events.get_running_loop() protocol_factory = lambda: SubprocessStreamProtocol(limit=limit, loop=loop) transport, protocol = await loop.subprocess_shell( @@ -221,16 +210,9 @@ async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None, async def create_subprocess_exec(program, *args, stdin=None, stdout=None, - stderr=None, loop=None, - limit=streams._DEFAULT_LIMIT, **kwds): - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8 " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, - stacklevel=2 - ) + stderr=None, limit=streams._DEFAULT_LIMIT, + **kwds): + loop = events.get_running_loop() protocol_factory = lambda: SubprocessStreamProtocol(limit=limit, loop=loop) transport, protocol = await loop.subprocess_exec( diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index f486b672294111..0d3a24b7853f57 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -61,30 +61,6 @@ def all_tasks(loop=None): if futures._get_loop(t) is loop and not t.done()} -def _all_tasks_compat(loop=None): - # Different from "all_task()" by returning *all* Tasks, including - # the completed ones. Used to implement deprecated "Tasks.all_task()" - # method. - if loop is None: - loop = events.get_event_loop() - # Looping over a WeakSet (_all_tasks) isn't safe as it can be updated from another - # thread while we do so. Therefore we cast it to list prior to filtering. The list - # cast itself requires iteration, so we repeat it several times ignoring - # RuntimeErrors (which are not very likely to occur). See issues 34970 and 36607 for - # details. - i = 0 - while True: - try: - tasks = list(_all_tasks) - except RuntimeError: - i += 1 - if i >= 1000: - raise - else: - break - return {t for t in tasks if futures._get_loop(t) is loop} - - def _set_task_name(task, name): if name is not None: try: @@ -370,7 +346,7 @@ def create_task(coro, *, name=None): ALL_COMPLETED = concurrent.futures.ALL_COMPLETED -async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED): +async def wait(fs, *, timeout=None, return_when=ALL_COMPLETED): """Wait for the Futures and coroutines given by fs to complete. The fs iterable must not be empty. @@ -393,12 +369,7 @@ async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED): if return_when not in (FIRST_COMPLETED, FIRST_EXCEPTION, ALL_COMPLETED): raise ValueError(f'Invalid return_when value: {return_when}') - if loop is None: - loop = events.get_running_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() fs = set(fs) @@ -418,7 +389,7 @@ def _release_waiter(waiter, *args): waiter.set_result(None) -async def wait_for(fut, timeout, *, loop=None): +async def wait_for(fut, timeout): """Wait for the single Future or coroutine to complete, with timeout. Coroutine will be wrapped in Task. @@ -431,12 +402,7 @@ async def wait_for(fut, timeout, *, loop=None): This function is a coroutine. """ - if loop is None: - loop = events.get_running_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_running_loop() if timeout is None: return await fut @@ -556,7 +522,7 @@ async def _cancel_and_wait(fut, loop): # This is *not* a @coroutine! It is just an iterator (yielding Futures). -def as_completed(fs, *, loop=None, timeout=None): +def as_completed(fs, *, timeout=None): """Return an iterator whose values are coroutines. When waiting for the yielded coroutines you'll get the results (or @@ -578,14 +544,9 @@ def as_completed(fs, *, loop=None, timeout=None): raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}") from .queues import Queue # Import here to avoid circular import problem. - done = Queue(loop=loop) + done = Queue() - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_event_loop() todo = {ensure_future(f, loop=loop) for f in set(fs)} timeout_handle = None @@ -630,19 +591,13 @@ def __sleep0(): yield -async def sleep(delay, result=None, *, loop=None): +async def sleep(delay, result=None): """Coroutine that completes after a given time (in seconds).""" if delay <= 0: await __sleep0() return result - if loop is None: - loop = events.get_running_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) - + loop = events.get_running_loop() future = loop.create_future() h = loop.call_later(delay, futures._set_result_unless_cancelled, @@ -717,7 +672,7 @@ def cancel(self, msg=None): return ret -def gather(*coros_or_futures, loop=None, return_exceptions=False): +def gather(*coros_or_futures, return_exceptions=False): """Return a future aggregating results from the given coroutines/futures. Coroutines will be wrapped in a future and scheduled in the event @@ -748,12 +703,7 @@ def gather(*coros_or_futures, loop=None, return_exceptions=False): gather won't cancel any other awaitables. """ if not coros_or_futures: - if loop is None: - loop = events.get_event_loop() - else: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) + loop = events.get_event_loop() outer = loop.create_future() outer.set_result([]) return outer @@ -817,6 +767,7 @@ def _done_callback(fut): children = [] nfuts = 0 nfinished = 0 + loop = None for arg in coros_or_futures: if arg not in arg_to_fut: fut = ensure_future(arg, loop=loop) @@ -843,7 +794,7 @@ def _done_callback(fut): return outer -def shield(arg, *, loop=None): +def shield(arg): """Wait for a future, shielding it from cancellation. The statement @@ -869,11 +820,7 @@ def shield(arg, *, loop=None): except CancelledError: res = None """ - if loop is not None: - warnings.warn("The loop argument is deprecated since Python 3.8, " - "and scheduled for removal in Python 3.10.", - DeprecationWarning, stacklevel=2) - inner = ensure_future(arg, loop=loop) + inner = ensure_future(arg) if inner.done(): # Shortcut. return inner diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index f34a5b4b443736..1b57e34563eea9 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -323,7 +323,7 @@ async def create_unix_server( server._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. - await tasks.sleep(0, loop=self) + await tasks.sleep(0) return server diff --git a/Lib/asyncore.py b/Lib/asyncore.py index ce16f11a2f5cee..eeea48888616d7 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -113,7 +113,7 @@ def readwrite(obj, flags): if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): obj.handle_close() except OSError as e: - if e.args[0] not in _DISCONNECTED: + if e.errno not in _DISCONNECTED: obj.handle_error() else: obj.handle_close() @@ -236,7 +236,7 @@ def __init__(self, sock=None, map=None): try: self.addr = sock.getpeername() except OSError as err: - if err.args[0] in (ENOTCONN, EINVAL): + if err.errno in (ENOTCONN, EINVAL): # To handle the case where we got an unconnected # socket. self.connected = False @@ -346,7 +346,7 @@ def accept(self): except TypeError: return None except OSError as why: - if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN): + if why.errno in (EWOULDBLOCK, ECONNABORTED, EAGAIN): return None else: raise @@ -358,9 +358,9 @@ def send(self, data): result = self.socket.send(data) return result except OSError as why: - if why.args[0] == EWOULDBLOCK: + if why.errno == EWOULDBLOCK: return 0 - elif why.args[0] in _DISCONNECTED: + elif why.errno in _DISCONNECTED: self.handle_close() return 0 else: @@ -378,7 +378,7 @@ def recv(self, buffer_size): return data except OSError as why: # winsock sometimes raises ENOTCONN - if why.args[0] in _DISCONNECTED: + if why.errno in _DISCONNECTED: self.handle_close() return b'' else: @@ -393,7 +393,7 @@ def close(self): try: self.socket.close() except OSError as why: - if why.args[0] not in (ENOTCONN, EBADF): + if why.errno not in (ENOTCONN, EBADF): raise # log and log_info may be overridden to provide more sophisticated @@ -557,7 +557,7 @@ def close_all(map=None, ignore_all=False): try: x.close() except OSError as x: - if x.args[0] == EBADF: + if x.errno == EBADF: pass elif not ignore_all: raise diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 65b2860ec98af4..a7a9e6f394d1ae 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -1002,7 +1002,7 @@ def __len__(self): def __iter__(self): d = {} for mapping in reversed(self.maps): - d.update(mapping) # reuses stored hash values if possible + d.update(dict.fromkeys(mapping)) # reuses stored hash values if possible return iter(d) def __contains__(self, key): diff --git a/Lib/colorsys.py b/Lib/colorsys.py index b93e3844067e4e..0f52512a67d87c 100644 --- a/Lib/colorsys.py +++ b/Lib/colorsys.py @@ -75,17 +75,18 @@ def yiq_to_rgb(y, i, q): def rgb_to_hls(r, g, b): maxc = max(r, g, b) minc = min(r, g, b) - # XXX Can optimize (maxc+minc) and (maxc-minc) - l = (minc+maxc)/2.0 + sumc = (maxc+minc) + rangec = (maxc-minc) + l = sumc/2.0 if minc == maxc: return 0.0, l, 0.0 if l <= 0.5: - s = (maxc-minc) / (maxc+minc) + s = rangec / sumc else: - s = (maxc-minc) / (2.0-maxc-minc) - rc = (maxc-r) / (maxc-minc) - gc = (maxc-g) / (maxc-minc) - bc = (maxc-b) / (maxc-minc) + s = rangec / (2.0-sumc) + rc = (maxc-r) / rangec + gc = (maxc-g) / rangec + bc = (maxc-b) / rangec if r == maxc: h = bc-gc elif g == maxc: diff --git a/Lib/contextlib.py b/Lib/contextlib.py index a0b523c96fb285..eb5946145b47ee 100644 --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -9,7 +9,7 @@ __all__ = ["asynccontextmanager", "contextmanager", "closing", "nullcontext", "AbstractContextManager", "AbstractAsyncContextManager", "AsyncExitStack", "ContextDecorator", "ExitStack", - "redirect_stdout", "redirect_stderr", "suppress"] + "redirect_stdout", "redirect_stderr", "suppress", "aclosing"] class AbstractContextManager(abc.ABC): diff --git a/Lib/dis.py b/Lib/dis.py index ea50f564c87dc7..ccbd65be73255a 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -384,7 +384,7 @@ def _disassemble_bytes(code, lasti=-1, varnames=None, names=None, constants=None, cells=None, linestarts=None, *, file=None, line_offset=0): # Omit the line number column entirely if we have no line number info - show_lineno = linestarts is not None + show_lineno = bool(linestarts) if show_lineno: maxlineno = max(linestarts.values()) + line_offset if maxlineno >= 1000: diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py index 0d1bd0391e6f11..f50edd2da97100 100644 --- a/Lib/distutils/spawn.py +++ b/Lib/distutils/spawn.py @@ -54,8 +54,8 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0): global _cfg_target, _cfg_target_split if _cfg_target is None: from distutils import sysconfig - _cfg_target = sysconfig.get_config_var( - 'MACOSX_DEPLOYMENT_TARGET') or '' + _cfg_target = str(sysconfig.get_config_var( + 'MACOSX_DEPLOYMENT_TARGET') or '') if _cfg_target: _cfg_target_split = [int(x) for x in _cfg_target.split('.')] if _cfg_target: diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 6bb009a86f41eb..a3055c19840326 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -456,7 +456,7 @@ def test_deployment_target_higher_ok(self): deptarget = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') if deptarget: # increment the minor version number (i.e. 10.6 -> 10.7) - deptarget = [int(x) for x in deptarget.split('.')] + deptarget = [int(x) for x in str(deptarget).split('.')] deptarget[-1] += 1 deptarget = '.'.join(str(i) for i in deptarget) self._try_compile_deployment_target('<', deptarget) @@ -489,7 +489,7 @@ def _try_compile_deployment_target(self, operator, target): # get the deployment target that the interpreter was built with target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') - target = tuple(map(int, target.split('.')[0:2])) + target = tuple(map(int, str(target).split('.')[0:2])) # format the target value as defined in the Apple # Availability Macros. We can't use the macro names since # at least one value we test with will not exist yet. @@ -498,7 +498,11 @@ def _try_compile_deployment_target(self, operator, target): target = '%02d%01d0' % target else: # for 10.10 and beyond -> "10nn00" - target = '%02d%02d00' % target + if len(target) >= 2: + target = '%02d%02d00' % target + else: + # 11 and later can have no minor version (11 instead of 11.0) + target = '%02d0000' % target deptarget_ext = Extension( 'deptarget', [deptarget_c], diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 4d7a6de740ab3a..f0792de74a1a48 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -290,7 +290,7 @@ def find_library_file(self, dirs, lib, debug=0): cflags = sysconfig.get_config_var('CFLAGS') m = re.search(r'-isysroot\s*(\S+)', cflags) if m is None: - sysroot = '/' + sysroot = _osx_support._default_sysroot(sysconfig.get_config_var('CC')) else: sysroot = m.group(1) diff --git a/Lib/enum.py b/Lib/enum.py index 40ff25b9cdad37..f6c7e8b2334139 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -10,31 +10,41 @@ def _is_descriptor(obj): - """Returns True if obj is a descriptor, False otherwise.""" + """ + Returns True if obj is a descriptor, False otherwise. + """ return ( hasattr(obj, '__get__') or hasattr(obj, '__set__') or - hasattr(obj, '__delete__')) - + hasattr(obj, '__delete__') + ) def _is_dunder(name): - """Returns True if a __dunder__ name, False otherwise.""" - return (len(name) > 4 and + """ + Returns True if a __dunder__ name, False otherwise. + """ + return ( + len(name) > 4 and name[:2] == name[-2:] == '__' and name[2] != '_' and - name[-3] != '_') - + name[-3] != '_' + ) def _is_sunder(name): - """Returns True if a _sunder_ name, False otherwise.""" - return (len(name) > 2 and + """ + Returns True if a _sunder_ name, False otherwise. + """ + return ( + len(name) > 2 and name[0] == name[-1] == '_' and name[1:2] != '_' and - name[-2:-1] != '_') - + name[-2:-1] != '_' + ) def _make_class_unpicklable(cls): - """Make the given class un-picklable.""" + """ + Make the given class un-picklable. + """ def _break_on_call_reduce(self, proto): raise TypeError('%r cannot be pickled' % self) cls.__reduce_ex__ = _break_on_call_reduce @@ -49,11 +59,11 @@ class auto: class _EnumDict(dict): - """Track enum member order and ensure member names are not reused. + """ + Track enum member order and ensure member names are not reused. EnumMeta will use the names found in self._member_names as the enumeration member names. - """ def __init__(self): super().__init__() @@ -63,21 +73,23 @@ def __init__(self): self._auto_called = False def __setitem__(self, key, value): - """Changes anything not dundered or not a descriptor. + """ + Changes anything not dundered or not a descriptor. If an enum member name is used twice, an error is raised; duplicate values are not checked for. Single underscore (sunder) names are reserved. - """ if _is_sunder(key): if key not in ( '_order_', '_create_pseudo_member_', '_generate_next_value_', '_missing_', '_ignore_', ): - raise ValueError(f'_sunder_ names, such as "{key}", are ' - 'reserved for future Enum use') + raise ValueError( + '_sunder_ names, such as %r, are reserved for future Enum use' + % (key, ) + ) if key == '_generate_next_value_': # check if members already defined as auto() if self._auto_called: @@ -91,7 +103,10 @@ def __setitem__(self, key, value): self._ignore = value already = set(value) & set(self._member_names) if already: - raise ValueError('_ignore_ cannot specify already set names: %r' % (already, )) + raise ValueError( + '_ignore_ cannot specify already set names: %r' + % (already, ) + ) elif _is_dunder(key): if key == '__order__': key = '_order_' @@ -106,7 +121,12 @@ def __setitem__(self, key, value): raise TypeError('%r already defined as: %r' % (key, self[key])) if isinstance(value, auto): if value.value == _auto_null: - value.value = self._generate_next_value(key, 1, len(self._member_names), self._last_values[:]) + value.value = self._generate_next_value( + key, + 1, + len(self._member_names), + self._last_values[:], + ) self._auto_called = True value = value.value self._member_names.append(key) @@ -119,9 +139,10 @@ def __setitem__(self, key, value): # This is also why there are checks in EnumMeta like `if Enum is not None` Enum = None - class EnumMeta(type): - """Metaclass for Enum""" + """ + Metaclass for Enum + """ @classmethod def __prepare__(metacls, cls, bases): # check that previous enum members do not exist @@ -131,7 +152,9 @@ def __prepare__(metacls, cls, bases): # inherit previous flags and _generate_next_value_ function member_type, first_enum = metacls._get_mixins_(cls, bases) if first_enum is not None: - enum_dict['_generate_next_value_'] = getattr(first_enum, '_generate_next_value_', None) + enum_dict['_generate_next_value_'] = getattr( + first_enum, '_generate_next_value_', None, + ) return enum_dict def __new__(metacls, cls, bases, classdict): @@ -146,8 +169,9 @@ def __new__(metacls, cls, bases, classdict): for key in ignore: classdict.pop(key, None) member_type, first_enum = metacls._get_mixins_(cls, bases) - __new__, save_new, use_args = metacls._find_new_(classdict, member_type, - first_enum) + __new__, save_new, use_args = metacls._find_new_( + classdict, member_type, first_enum, + ) # save enum items into separate mapping so they don't get baked into # the new class @@ -176,9 +200,11 @@ def __new__(metacls, cls, bases, classdict): # save DynamicClassAttribute attributes from super classes so we know # if we can take the shortcut of storing members in the class dict - dynamic_attributes = {k for c in enum_class.mro() - for k, v in c.__dict__.items() - if isinstance(v, DynamicClassAttribute)} + dynamic_attributes = { + k for c in enum_class.mro() + for k, v in c.__dict__.items() + if isinstance(v, DynamicClassAttribute) + } # Reverse value->name map for hashable values. enum_class._value2member_map_ = {} @@ -288,7 +314,8 @@ def __bool__(self): return True def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1): - """Either returns an existing member, or creates a new enum class. + """ + Either returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API @@ -310,12 +337,18 @@ def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, s not correct, unpickling will fail in some circumstances. `type`, if set, will be mixed in as the first base class. - """ if names is None: # simple value lookup return cls.__new__(cls, value) # otherwise, functional API: we're creating a new Enum type - return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) + return cls._create_( + value, + names, + module=module, + qualname=qualname, + type=type, + start=start, + ) def __contains__(cls, member): if not isinstance(member, Enum): @@ -328,22 +361,23 @@ def __delattr__(cls, attr): # nicer error message when someone tries to delete an attribute # (see issue19025). if attr in cls._member_map_: - raise AttributeError( - "%s: cannot delete Enum member." % cls.__name__) + raise AttributeError("%s: cannot delete Enum member %r." % (cls.__name__, attr)) super().__delattr__(attr) def __dir__(self): - return (['__class__', '__doc__', '__members__', '__module__'] + - self._member_names_) + return ( + ['__class__', '__doc__', '__members__', '__module__'] + + self._member_names_ + ) def __getattr__(cls, name): - """Return the enum member matching `name` + """ + Return the enum member matching `name` We use __getattr__ instead of descriptors or inserting into the enum class' __dict__ in order to support `name` and `value` being both properties for enum members (which live in the class' __dict__) and enum members themselves. - """ if _is_dunder(name): raise AttributeError(name) @@ -356,6 +390,9 @@ def __getitem__(cls, name): return cls._member_map_[name] def __iter__(cls): + """ + Returns members in definition order. + """ return (cls._member_map_[name] for name in cls._member_names_) def __len__(cls): @@ -363,11 +400,11 @@ def __len__(cls): @property def __members__(cls): - """Returns a mapping of member name->value. + """ + Returns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping. - """ return MappingProxyType(cls._member_map_) @@ -375,15 +412,18 @@ def __repr__(cls): return "" % cls.__name__ def __reversed__(cls): + """ + Returns members in reverse definition order. + """ return (cls._member_map_[name] for name in reversed(cls._member_names_)) def __setattr__(cls, name, value): - """Block attempts to reassign Enum members. + """ + Block attempts to reassign Enum members. A simple assignment to the class namespace only changes one of the several possible ways to get an Enum member from the Enum class, resulting in an inconsistent Enumeration. - """ member_map = cls.__dict__.get('_member_map_', {}) if name in member_map: @@ -391,7 +431,8 @@ def __setattr__(cls, name, value): super().__setattr__(name, value) def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, start=1): - """Convenience method to create a new Enum class. + """ + Convenience method to create a new Enum class. `names` can be: @@ -400,7 +441,6 @@ def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, s * An iterable of member names. Values are incremented by 1 from `start`. * An iterable of (member name, value) pairs. * A mapping of member name -> value pairs. - """ metacls = cls.__class__ bases = (cls, ) if type is None else (type, cls) @@ -481,15 +521,18 @@ def _check_for_existing_members(class_name, bases): for chain in bases: for base in chain.__mro__: if issubclass(base, Enum) and base._member_names_: - raise TypeError("%s: cannot extend enumeration %r" % (class_name, base.__name__)) + raise TypeError( + "%s: cannot extend enumeration %r" + % (class_name, base.__name__) + ) @staticmethod def _get_mixins_(class_name, bases): - """Returns the type for creating enum members, and the first inherited + """ + Returns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ - """ if not bases: return object, Enum @@ -501,12 +544,16 @@ def _find_data_type(bases): for base in chain.__mro__: if base is object: continue + elif issubclass(base, Enum): + if base._member_type_ is not object: + data_types.append(base._member_type_) + break elif '__new__' in base.__dict__: if issubclass(base, Enum): continue data_types.append(candidate or base) break - elif not issubclass(base, Enum): + else: candidate = base if len(data_types) > 1: raise TypeError('%r: too many data types: %r' % (class_name, data_types)) @@ -528,12 +575,12 @@ def _find_data_type(bases): @staticmethod def _find_new_(classdict, member_type, first_enum): - """Returns the __new__ to be used for creating the enum members. + """ + Returns the __new__ to be used for creating the enum members. classdict: the class dictionary given to __new__ member_type: the data type whose __new__ will be used by default first_enum: enumeration to check for an overriding __new__ - """ # now find the correct __new__, checking to see of one was defined # by the user; also check earlier enum classes in case a __new__ was @@ -573,10 +620,10 @@ def _find_new_(classdict, member_type, first_enum): class Enum(metaclass=EnumMeta): - """Generic enumeration. + """ + Generic enumeration. Derive from this class to define new enumerations. - """ def __new__(cls, value): # all enum instances are actually created during class construction @@ -619,6 +666,14 @@ def __new__(cls, value): raise exc def _generate_next_value_(name, start, count, last_values): + """ + Generate the next value when not given. + + name: the name of the member + start: the initial start value or None + count: the number of existing members + last_value: the last value assigned or None + """ for last_value in reversed(last_values): try: return last_value + 1 @@ -639,6 +694,9 @@ def __str__(self): return "%s.%s" % (self.__class__.__name__, self._name_) def __dir__(self): + """ + Returns all members and all public methods + """ added_behavior = [ m for cls in self.__class__.mro() @@ -648,12 +706,15 @@ def __dir__(self): return (['__class__', '__doc__', '__module__'] + added_behavior) def __format__(self, format_spec): + """ + Returns format using actual value type unless __str__ has been overridden. + """ # mixed-in Enums should use the mixed-in type's __format__, otherwise # we can get strange results with the Enum name showing up instead of # the value # pure Enum branch, or branch with __str__ explicitly overridden - str_overridden = type(self).__str__ != Enum.__str__ + str_overridden = type(self).__str__ not in (Enum.__str__, Flag.__str__) if self._member_type_ is object or str_overridden: cls = str val = str(self) @@ -725,7 +786,9 @@ def _reduce_ex_by_name(self, proto): return self.name class Flag(Enum): - """Support for flags""" + """ + Support for flags + """ def _generate_next_value_(name, start, count, last_values): """ @@ -748,6 +811,9 @@ def _generate_next_value_(name, start, count, last_values): @classmethod def _missing_(cls, value): + """ + Returns member (possibly creating it) if one can be found for value. + """ original_value = value if value < 0: value = ~value @@ -777,6 +843,9 @@ def _create_pseudo_member_(cls, value): return pseudo_member def __contains__(self, other): + """ + Returns True if self has at least the same flags set as other. + """ if not isinstance(other, self.__class__): raise TypeError( "unsupported operand type(s) for 'in': '%s' and '%s'" % ( @@ -784,6 +853,9 @@ def __contains__(self, other): return other._value_ & self._value_ == other._value_ def __iter__(self): + """ + Returns flags in decreasing value order. + """ members, extra_flags = _decompose(self.__class__, self.value) return (m for m in members if m._value_ != 0) @@ -839,10 +911,15 @@ def __invert__(self): class IntFlag(int, Flag): - """Support for integer-based Flags""" + """ + Support for integer-based Flags + """ @classmethod def _missing_(cls, value): + """ + Returns member (possibly creating it) if one can be found for value. + """ if not isinstance(value, int): raise ValueError("%r is not a valid %s" % (value, cls.__qualname__)) new_member = cls._create_pseudo_member_(value) @@ -850,6 +927,9 @@ def _missing_(cls, value): @classmethod def _create_pseudo_member_(cls, value): + """ + Create a composite member iff value contains only members. + """ pseudo_member = cls._value2member_map_.get(value, None) if pseudo_member is None: need_to_create = [value] @@ -904,11 +984,15 @@ def __invert__(self): def _high_bit(value): - """returns index of highest bit, or -1 if value is zero or negative""" + """ + returns index of highest bit, or -1 if value is zero or negative + """ return value.bit_length() - 1 def unique(enumeration): - """Class decorator for enumerations ensuring unique member values.""" + """ + Class decorator for enumerations ensuring unique member values. + """ duplicates = [] for name, member in enumeration.__members__.items(): if name != member.name: @@ -921,7 +1005,9 @@ def unique(enumeration): return enumeration def _decompose(flag, value): - """Extract all members from the value.""" + """ + Extract all members from the value. + """ # _decompose is only called if the value is not named not_covered = value negative = value < 0 diff --git a/Lib/filecmp.py b/Lib/filecmp.py index 7a4da6beb50500..7c47eb022cc8c0 100644 --- a/Lib/filecmp.py +++ b/Lib/filecmp.py @@ -115,7 +115,9 @@ class dircmp: same_files: list of identical files. diff_files: list of filenames which differ. funny_files: list of files which could not be compared. - subdirs: a dictionary of dircmp objects, keyed by names in common_dirs. + subdirs: a dictionary of dircmp instances (or MyDirCmp instances if this + object is of type MyDirCmp, a subclass of dircmp), keyed by names + in common_dirs. """ def __init__(self, a, b, ignore=None, hide=None): # Initialize @@ -185,14 +187,15 @@ def phase3(self): # Find out differences between common files self.same_files, self.diff_files, self.funny_files = xx def phase4(self): # Find out differences between common subdirectories - # A new dircmp object is created for each common subdirectory, + # A new dircmp (or MyDirCmp if dircmp was subclassed) object is created + # for each common subdirectory, # these are stored in a dictionary indexed by filename. # The hide and ignore properties are inherited from the parent self.subdirs = {} for x in self.common_dirs: a_x = os.path.join(self.left, x) b_x = os.path.join(self.right, x) - self.subdirs[x] = dircmp(a_x, b_x, self.ignore, self.hide) + self.subdirs[x] = self.__class__(a_x, b_x, self.ignore, self.hide) def phase4_closure(self): # Recursively call phase4() on subdirectories self.phase4() diff --git a/Lib/formatter.py b/Lib/formatter.py deleted file mode 100644 index e2394de8c29195..00000000000000 --- a/Lib/formatter.py +++ /dev/null @@ -1,452 +0,0 @@ -"""Generic output formatting. - -Formatter objects transform an abstract flow of formatting events into -specific output events on writer objects. Formatters manage several stack -structures to allow various properties of a writer object to be changed and -restored; writers need not be able to handle relative changes nor any sort -of ``change back'' operation. Specific writer properties which may be -controlled via formatter objects are horizontal alignment, font, and left -margin indentations. A mechanism is provided which supports providing -arbitrary, non-exclusive style settings to a writer as well. Additional -interfaces facilitate formatting events which are not reversible, such as -paragraph separation. - -Writer objects encapsulate device interfaces. Abstract devices, such as -file formats, are supported as well as physical devices. The provided -implementations all work with abstract devices. The interface makes -available mechanisms for setting the properties which formatter objects -manage and inserting data into the output. -""" - -import sys -import warnings -warnings.warn('the formatter module is deprecated', DeprecationWarning, - stacklevel=2) - - -AS_IS = None - - -class NullFormatter: - """A formatter which does nothing. - - If the writer parameter is omitted, a NullWriter instance is created. - No methods of the writer are called by NullFormatter instances. - - Implementations should inherit from this class if implementing a writer - interface but don't need to inherit any implementation. - - """ - - def __init__(self, writer=None): - if writer is None: - writer = NullWriter() - self.writer = writer - def end_paragraph(self, blankline): pass - def add_line_break(self): pass - def add_hor_rule(self, *args, **kw): pass - def add_label_data(self, format, counter, blankline=None): pass - def add_flowing_data(self, data): pass - def add_literal_data(self, data): pass - def flush_softspace(self): pass - def push_alignment(self, align): pass - def pop_alignment(self): pass - def push_font(self, x): pass - def pop_font(self): pass - def push_margin(self, margin): pass - def pop_margin(self): pass - def set_spacing(self, spacing): pass - def push_style(self, *styles): pass - def pop_style(self, n=1): pass - def assert_line_data(self, flag=1): pass - - -class AbstractFormatter: - """The standard formatter. - - This implementation has demonstrated wide applicability to many writers, - and may be used directly in most circumstances. It has been used to - implement a full-featured World Wide Web browser. - - """ - - # Space handling policy: blank spaces at the boundary between elements - # are handled by the outermost context. "Literal" data is not checked - # to determine context, so spaces in literal data are handled directly - # in all circumstances. - - def __init__(self, writer): - self.writer = writer # Output device - self.align = None # Current alignment - self.align_stack = [] # Alignment stack - self.font_stack = [] # Font state - self.margin_stack = [] # Margin state - self.spacing = None # Vertical spacing state - self.style_stack = [] # Other state, e.g. color - self.nospace = 1 # Should leading space be suppressed - self.softspace = 0 # Should a space be inserted - self.para_end = 1 # Just ended a paragraph - self.parskip = 0 # Skipped space between paragraphs? - self.hard_break = 1 # Have a hard break - self.have_label = 0 - - def end_paragraph(self, blankline): - if not self.hard_break: - self.writer.send_line_break() - self.have_label = 0 - if self.parskip < blankline and not self.have_label: - self.writer.send_paragraph(blankline - self.parskip) - self.parskip = blankline - self.have_label = 0 - self.hard_break = self.nospace = self.para_end = 1 - self.softspace = 0 - - def add_line_break(self): - if not (self.hard_break or self.para_end): - self.writer.send_line_break() - self.have_label = self.parskip = 0 - self.hard_break = self.nospace = 1 - self.softspace = 0 - - def add_hor_rule(self, *args, **kw): - if not self.hard_break: - self.writer.send_line_break() - self.writer.send_hor_rule(*args, **kw) - self.hard_break = self.nospace = 1 - self.have_label = self.para_end = self.softspace = self.parskip = 0 - - def add_label_data(self, format, counter, blankline = None): - if self.have_label or not self.hard_break: - self.writer.send_line_break() - if not self.para_end: - self.writer.send_paragraph((blankline and 1) or 0) - if isinstance(format, str): - self.writer.send_label_data(self.format_counter(format, counter)) - else: - self.writer.send_label_data(format) - self.nospace = self.have_label = self.hard_break = self.para_end = 1 - self.softspace = self.parskip = 0 - - def format_counter(self, format, counter): - label = '' - for c in format: - if c == '1': - label = label + ('%d' % counter) - elif c in 'aA': - if counter > 0: - label = label + self.format_letter(c, counter) - elif c in 'iI': - if counter > 0: - label = label + self.format_roman(c, counter) - else: - label = label + c - return label - - def format_letter(self, case, counter): - label = '' - while counter > 0: - counter, x = divmod(counter-1, 26) - # This makes a strong assumption that lowercase letters - # and uppercase letters form two contiguous blocks, with - # letters in order! - s = chr(ord(case) + x) - label = s + label - return label - - def format_roman(self, case, counter): - ones = ['i', 'x', 'c', 'm'] - fives = ['v', 'l', 'd'] - label, index = '', 0 - # This will die of IndexError when counter is too big - while counter > 0: - counter, x = divmod(counter, 10) - if x == 9: - label = ones[index] + ones[index+1] + label - elif x == 4: - label = ones[index] + fives[index] + label - else: - if x >= 5: - s = fives[index] - x = x-5 - else: - s = '' - s = s + ones[index]*x - label = s + label - index = index + 1 - if case == 'I': - return label.upper() - return label - - def add_flowing_data(self, data): - if not data: return - prespace = data[:1].isspace() - postspace = data[-1:].isspace() - data = " ".join(data.split()) - if self.nospace and not data: - return - elif prespace or self.softspace: - if not data: - if not self.nospace: - self.softspace = 1 - self.parskip = 0 - return - if not self.nospace: - data = ' ' + data - self.hard_break = self.nospace = self.para_end = \ - self.parskip = self.have_label = 0 - self.softspace = postspace - self.writer.send_flowing_data(data) - - def add_literal_data(self, data): - if not data: return - if self.softspace: - self.writer.send_flowing_data(" ") - self.hard_break = data[-1:] == '\n' - self.nospace = self.para_end = self.softspace = \ - self.parskip = self.have_label = 0 - self.writer.send_literal_data(data) - - def flush_softspace(self): - if self.softspace: - self.hard_break = self.para_end = self.parskip = \ - self.have_label = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - - def push_alignment(self, align): - if align and align != self.align: - self.writer.new_alignment(align) - self.align = align - self.align_stack.append(align) - else: - self.align_stack.append(self.align) - - def pop_alignment(self): - if self.align_stack: - del self.align_stack[-1] - if self.align_stack: - self.align = align = self.align_stack[-1] - self.writer.new_alignment(align) - else: - self.align = None - self.writer.new_alignment(None) - - def push_font(self, font): - size, i, b, tt = font - if self.softspace: - self.hard_break = self.para_end = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - if self.font_stack: - csize, ci, cb, ctt = self.font_stack[-1] - if size is AS_IS: size = csize - if i is AS_IS: i = ci - if b is AS_IS: b = cb - if tt is AS_IS: tt = ctt - font = (size, i, b, tt) - self.font_stack.append(font) - self.writer.new_font(font) - - def pop_font(self): - if self.font_stack: - del self.font_stack[-1] - if self.font_stack: - font = self.font_stack[-1] - else: - font = None - self.writer.new_font(font) - - def push_margin(self, margin): - self.margin_stack.append(margin) - fstack = [m for m in self.margin_stack if m] - if not margin and fstack: - margin = fstack[-1] - self.writer.new_margin(margin, len(fstack)) - - def pop_margin(self): - if self.margin_stack: - del self.margin_stack[-1] - fstack = [m for m in self.margin_stack if m] - if fstack: - margin = fstack[-1] - else: - margin = None - self.writer.new_margin(margin, len(fstack)) - - def set_spacing(self, spacing): - self.spacing = spacing - self.writer.new_spacing(spacing) - - def push_style(self, *styles): - if self.softspace: - self.hard_break = self.para_end = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - for style in styles: - self.style_stack.append(style) - self.writer.new_styles(tuple(self.style_stack)) - - def pop_style(self, n=1): - del self.style_stack[-n:] - self.writer.new_styles(tuple(self.style_stack)) - - def assert_line_data(self, flag=1): - self.nospace = self.hard_break = not flag - self.para_end = self.parskip = self.have_label = 0 - - -class NullWriter: - """Minimal writer interface to use in testing & inheritance. - - A writer which only provides the interface definition; no actions are - taken on any methods. This should be the base class for all writers - which do not need to inherit any implementation methods. - - """ - def __init__(self): pass - def flush(self): pass - def new_alignment(self, align): pass - def new_font(self, font): pass - def new_margin(self, margin, level): pass - def new_spacing(self, spacing): pass - def new_styles(self, styles): pass - def send_paragraph(self, blankline): pass - def send_line_break(self): pass - def send_hor_rule(self, *args, **kw): pass - def send_label_data(self, data): pass - def send_flowing_data(self, data): pass - def send_literal_data(self, data): pass - - -class AbstractWriter(NullWriter): - """A writer which can be used in debugging formatters, but not much else. - - Each method simply announces itself by printing its name and - arguments on standard output. - - """ - - def new_alignment(self, align): - print("new_alignment(%r)" % (align,)) - - def new_font(self, font): - print("new_font(%r)" % (font,)) - - def new_margin(self, margin, level): - print("new_margin(%r, %d)" % (margin, level)) - - def new_spacing(self, spacing): - print("new_spacing(%r)" % (spacing,)) - - def new_styles(self, styles): - print("new_styles(%r)" % (styles,)) - - def send_paragraph(self, blankline): - print("send_paragraph(%r)" % (blankline,)) - - def send_line_break(self): - print("send_line_break()") - - def send_hor_rule(self, *args, **kw): - print("send_hor_rule()") - - def send_label_data(self, data): - print("send_label_data(%r)" % (data,)) - - def send_flowing_data(self, data): - print("send_flowing_data(%r)" % (data,)) - - def send_literal_data(self, data): - print("send_literal_data(%r)" % (data,)) - - -class DumbWriter(NullWriter): - """Simple writer class which writes output on the file object passed in - as the file parameter or, if file is omitted, on standard output. The - output is simply word-wrapped to the number of columns specified by - the maxcol parameter. This class is suitable for reflowing a sequence - of paragraphs. - - """ - - def __init__(self, file=None, maxcol=72): - self.file = file or sys.stdout - self.maxcol = maxcol - NullWriter.__init__(self) - self.reset() - - def reset(self): - self.col = 0 - self.atbreak = 0 - - def send_paragraph(self, blankline): - self.file.write('\n'*blankline) - self.col = 0 - self.atbreak = 0 - - def send_line_break(self): - self.file.write('\n') - self.col = 0 - self.atbreak = 0 - - def send_hor_rule(self, *args, **kw): - self.file.write('\n') - self.file.write('-'*self.maxcol) - self.file.write('\n') - self.col = 0 - self.atbreak = 0 - - def send_literal_data(self, data): - self.file.write(data) - i = data.rfind('\n') - if i >= 0: - self.col = 0 - data = data[i+1:] - data = data.expandtabs() - self.col = self.col + len(data) - self.atbreak = 0 - - def send_flowing_data(self, data): - if not data: return - atbreak = self.atbreak or data[0].isspace() - col = self.col - maxcol = self.maxcol - write = self.file.write - for word in data.split(): - if atbreak: - if col + len(word) >= maxcol: - write('\n') - col = 0 - else: - write(' ') - col = col + 1 - write(word) - col = col + len(word) - atbreak = 1 - self.col = col - self.atbreak = data[-1].isspace() - - -def test(file = None): - w = DumbWriter() - f = AbstractFormatter(w) - if file is not None: - fp = open(file) - elif sys.argv[1:]: - fp = open(sys.argv[1]) - else: - fp = sys.stdin - try: - for line in fp: - if line == '\n': - f.end_paragraph(1) - else: - f.add_flowing_data(line) - finally: - if fp is not sys.stdin: - fp.close() - f.end_paragraph(0) - - -if __name__ == '__main__': - test() diff --git a/Lib/http/client.py b/Lib/http/client.py index 15abcfeada5915..a54679cf84d18a 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -1407,6 +1407,9 @@ def __init__(self, host, port=None, key_file=None, cert_file=None, self.cert_file = cert_file if context is None: context = ssl._create_default_https_context() + # send ALPN extension to indicate HTTP/1.1 protocol + if self._http_vsn == 11: + context.set_alpn_protocols(['http/1.1']) # enable PHA for TLS 1.3 connections if available if context.post_handshake_auth is not None: context.post_handshake_auth = True diff --git a/Lib/http/server.py b/Lib/http/server.py index fa204fbc15e3d7..94f730ed3445be 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -414,7 +414,7 @@ def handle_one_request(self): method = getattr(self, mname) method() self.wfile.flush() #actually send the response if not already done. - except socket.timeout as e: + except TimeoutError as e: #a read or a write timed out. Discard this connection self.log_error("Request timed out: %r", e) self.close_connection = True @@ -1092,8 +1092,7 @@ def run_cgi(self): env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname - if query: - env['QUERY_STRING'] = query + env['QUERY_STRING'] = query env['REMOTE_ADDR'] = self.client_address[0] authorization = self.headers.get("authorization") if authorization: @@ -1123,12 +1122,7 @@ def run_cgi(self): referer = self.headers.get('referer') if referer: env['HTTP_REFERER'] = referer - accept = [] - for line in self.headers.getallmatchingheaders('accept'): - if line[:1] in "\t\n\r ": - accept.append(line.strip()) - else: - accept = accept + line[7:].split(',') + accept = self.headers.get_all('accept', ()) env['HTTP_ACCEPT'] = ','.join(accept) ua = self.headers.get('user-agent') if ua: diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 3ece623b3aa187..7167314ca7e598 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,15 @@ Released on 2021-10-04? ====================================== +bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround +that prevented running files with shortcuts when using new universal2 +installers built on macOS 11. + +bpo-42426: Fix reporting offset of the RE error in searchengine. + +bpo-42416: Get docstrings for IDLE calltips more often +by using inspect.getdoc. + bpo-33987: Mostly finish using ttk widgets, mainly for editor, settings, and searches. Some patches by Mark Roseman. diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py index 549e224015cccb..40bc5a0ad798fe 100644 --- a/Lib/idlelib/calltip.py +++ b/Lib/idlelib/calltip.py @@ -165,6 +165,7 @@ def get_argspec(ob): ob_call = ob.__call__ except BaseException: # Buggy user object could raise anything. return '' # No popup for non-callables. + # For Get_argspecTest.test_buggy_getattr_class, CallA() & CallB(). fob = ob_call if isinstance(ob_call, types.MethodType) else ob # Initialize argspec and wrap it to get lines. @@ -185,10 +186,7 @@ def get_argspec(ob): if len(argspec) > _MAX_COLS else [argspec] if argspec else []) # Augment lines from docstring, if any, and join to get argspec. - if isinstance(ob_call, types.MethodType): - doc = ob_call.__doc__ - else: - doc = getattr(ob, "__doc__", "") + doc = inspect.getdoc(ob) if doc: for line in doc.split('\n', _MAX_LINES)[:_MAX_LINES]: line = line.strip() diff --git a/Lib/idlelib/idle_test/test_calltip.py b/Lib/idlelib/idle_test/test_calltip.py index 489b6899baf424..a76829f3656c80 100644 --- a/Lib/idlelib/idle_test/test_calltip.py +++ b/Lib/idlelib/idle_test/test_calltip.py @@ -99,7 +99,12 @@ def test_signature_wrap(self): (width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, - placeholder=' [...]')''') + placeholder=' [...]') +Object for wrapping/filling text. The public interface consists of +the wrap() and fill() methods; the other methods are just there for +subclasses to override in order to tweak the default behaviour. +If you want to completely replace the main wrapping algorithm, +you\'ll probably have to override _wrap_chunks().''') def test_properly_formated(self): @@ -241,7 +246,7 @@ class Type(type): # Type() requires 3 type args, returns class. __class__ = property({}.__getitem__, {}.__setitem__) class Object(metaclass=Type): __slots__ = '__class__' - for meth, mtip in ((Type, default_tip), (Object, default_tip), + for meth, mtip in ((Type, get_spec(type)), (Object, default_tip), (Object(), '')): with self.subTest(meth=meth, mtip=mtip): self.assertEqual(get_spec(meth), mtip) diff --git a/Lib/idlelib/idle_test/test_searchengine.py b/Lib/idlelib/idle_test/test_searchengine.py index 3d26d62a95a873..f8401ce9380f25 100644 --- a/Lib/idlelib/idle_test/test_searchengine.py +++ b/Lib/idlelib/idle_test/test_searchengine.py @@ -175,11 +175,13 @@ def test_getprog(self): engine.setpat('') Equal(engine.getprog(), None) + Equal(Mbox.showerror.message, + 'Error: Empty regular expression') engine.setpat('+') engine.revar.set(1) Equal(engine.getprog(), None) - self.assertEqual(Mbox.showerror.message, - 'Error: nothing to repeat at position 0\nPattern: +') + Equal(Mbox.showerror.message, + 'Error: nothing to repeat\nPattern: +\nOffset: 0') def test_report_error(self): showerror = Mbox.showerror diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index b69916dbe876ca..c3ecdc7b1b077c 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -463,7 +463,7 @@ def start_subprocess(self): self.rpcclt.listening_sock.settimeout(10) try: self.rpcclt.accept() - except socket.timeout: + except TimeoutError: self.display_no_subprocess_error() return None self.rpcclt.register("console", self.tkconsole) @@ -498,7 +498,7 @@ def restart_subprocess(self, with_cwd=False, filename=''): self.spawn_subprocess() try: self.rpcclt.accept() - except socket.timeout: + except TimeoutError: self.display_no_subprocess_error() return None self.transfer_path(with_cwd=with_cwd) @@ -757,7 +757,7 @@ def runcommand(self, code): def runcode(self, code): "Override base class method" if self.tkconsole.executing: - self.interp.restart_subprocess() + self.restart_subprocess() self.checklinecache() debugger = self.debugger try: diff --git a/Lib/idlelib/runscript.py b/Lib/idlelib/runscript.py index a54108794ab595..028b0dbd21dfe6 100644 --- a/Lib/idlelib/runscript.py +++ b/Lib/idlelib/runscript.py @@ -11,6 +11,7 @@ """ import os import tabnanny +import time import tokenize import tkinter.messagebox as tkMessageBox @@ -42,9 +43,7 @@ def __init__(self, editwin): self.root = self.editwin.root # cli_args is list of strings that extends sys.argv self.cli_args = [] - - if macosx.isCocoaTk(): - self.editwin.text_frame.bind('<>', self._run_module_event) + self.perf = 0.0 # Workaround for macOS 11 Uni2; see bpo-42508. def check_module_event(self, event): if isinstance(self.editwin, outwin.OutputWindow): @@ -107,24 +106,10 @@ def checksyntax(self, filename): finally: shell.set_warning_stream(saved_stream) - def run_module_event(self, event): - if macosx.isCocoaTk(): - # Tk-Cocoa in MacOSX is broken until at least - # Tk 8.5.9, and without this rather - # crude workaround IDLE would hang when a user - # tries to run a module using the keyboard shortcut - # (the menu item works fine). - self.editwin.text_frame.after(200, - lambda: self.editwin.text_frame.event_generate( - '<>')) - return 'break' - else: - return self._run_module_event(event) - def run_custom_event(self, event): - return self._run_module_event(event, customize=True) + return self.run_module_event(event, customize=True) - def _run_module_event(self, event, *, customize=False): + def run_module_event(self, event, *, customize=False): """Run the module after setting up the environment. First check the syntax. Next get customization. If OK, make @@ -133,6 +118,8 @@ def _run_module_event(self, event, *, customize=False): module being executed and also add that directory to its sys.path if not already included. """ + if macosx.isCocoaTk() and (time.perf_counter() - self.perf < .05): + return 'break' if isinstance(self.editwin, outwin.OutputWindow): self.editwin.text.bell() return 'break' @@ -218,6 +205,7 @@ def errorbox(self, title, message): # XXX This should really be a function of EditorWindow... tkMessageBox.showerror(title, message, parent=self.editwin.text) self.editwin.text.focus_set() + self.perf = time.perf_counter() if __name__ == "__main__": diff --git a/Lib/idlelib/searchengine.py b/Lib/idlelib/searchengine.py index 911e7d4691cac1..a50038e282ba6c 100644 --- a/Lib/idlelib/searchengine.py +++ b/Lib/idlelib/searchengine.py @@ -84,20 +84,17 @@ def getprog(self): flags = flags | re.IGNORECASE try: prog = re.compile(pat, flags) - except re.error as what: - args = what.args - msg = args[0] - col = args[1] if len(args) >= 2 else -1 - self.report_error(pat, msg, col) + except re.error as e: + self.report_error(pat, e.msg, e.pos) return None return prog - def report_error(self, pat, msg, col=-1): + def report_error(self, pat, msg, col=None): # Derived class could override this with something fancier msg = "Error: " + str(msg) if pat: msg = msg + "\nPattern: " + str(pat) - if col >= 0: + if col is not None: msg = msg + "\nOffset: " + str(col) tkMessageBox.showerror("Regular expression error", msg, master=self.root) diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index bea37d766262f8..03ff71489abbd6 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -34,7 +34,7 @@ import _frozen_importlib_external as _bootstrap_external except ImportError: from . import _bootstrap_external - _bootstrap_external._setup(_bootstrap) + _bootstrap_external._set_bootstrap_module(_bootstrap) _bootstrap._bootstrap_external = _bootstrap_external else: _bootstrap_external.__name__ = 'importlib._bootstrap_external' diff --git a/Lib/importlib/_abc.py b/Lib/importlib/_abc.py index fb5ec727cea6e4..7591946a4e76d3 100644 --- a/Lib/importlib/_abc.py +++ b/Lib/importlib/_abc.py @@ -35,6 +35,7 @@ def load_module(self, fullname): """ if not hasattr(self, 'exec_module'): raise ImportError + # Warning implemented in _load_module_shim(). return _bootstrap._load_module_shim(self, fullname) def module_repr(self, module): diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index e00b27ece2603e..e4f893c38c1aad 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -20,10 +20,23 @@ # reference any injected objects! This includes not only global code but also # anything specified at the class level. +def _object_name(obj): + try: + return obj.__qualname__ + except AttributeError: + return type(obj).__qualname__ + # Bootstrap-related code ###################################################### +# Modules injected manually by _setup() +_thread = None +_warnings = None +_weakref = None + +# Import done by _install_external_importers() _bootstrap_external = None + def _wrap(new, old): """Simple substitute for functools.update_wrapper.""" for replace in ['__module__', '__name__', '__qualname__', '__doc__']: @@ -265,6 +278,9 @@ def _load_module_shim(self, fullname): This method is deprecated. Use loader.exec_module instead. """ + msg = ("the load_module() method is deprecated and slated for removal in " + "Python 3.12; use exec_module() instead") + _warnings.warn(msg, DeprecationWarning) spec = spec_from_loader(fullname, self) if fullname in sys.modules: module = sys.modules[fullname] @@ -605,9 +621,9 @@ def _exec(spec, module): else: _init_module_attrs(spec, module, override=True) if not hasattr(spec.loader, 'exec_module'): - # (issue19713) Once BuiltinImporter and ExtensionFileLoader - # have exec_module() implemented, we can add a deprecation - # warning here. + msg = (f"{_object_name(spec.loader)}.exec_module() not found; " + "falling back to load_module()") + _warnings.warn(msg, ImportWarning) spec.loader.load_module(name) else: spec.loader.exec_module(module) @@ -620,9 +636,8 @@ def _exec(spec, module): def _load_backward_compatible(spec): - # (issue19713) Once BuiltinImporter and ExtensionFileLoader - # have exec_module() implemented, we can add a deprecation - # warning here. + # It is assumed that all callers have been warned about using load_module() + # appropriately before calling this function. try: spec.loader.load_module(spec.name) except: @@ -661,6 +676,9 @@ def _load_unlocked(spec): if spec.loader is not None: # Not a namespace package. if not hasattr(spec.loader, 'exec_module'): + msg = (f"{_object_name(spec.loader)}.exec_module() not found; " + "falling back to load_module()") + _warnings.warn(msg, ImportWarning) return _load_backward_compatible(spec) module = module_from_spec(spec) @@ -754,16 +772,16 @@ def find_module(cls, fullname, path=None): spec = cls.find_spec(fullname, path) return spec.loader if spec is not None else None - @classmethod - def create_module(self, spec): + @staticmethod + def create_module(spec): """Create a built-in module""" if spec.name not in sys.builtin_module_names: raise ImportError('{!r} is not a built-in module'.format(spec.name), name=spec.name) return _call_with_frames_removed(_imp.create_builtin, spec) - @classmethod - def exec_module(self, module): + @staticmethod + def exec_module(module): """Exec a built-in module""" _call_with_frames_removed(_imp.exec_builtin, module) @@ -824,8 +842,8 @@ def find_module(cls, fullname, path=None): """ return cls if _imp.is_frozen(fullname) else None - @classmethod - def create_module(cls, spec): + @staticmethod + def create_module(spec): """Use default semantics for module creation.""" @staticmethod @@ -844,6 +862,7 @@ def load_module(cls, fullname): This method is deprecated. Use exec_module() instead. """ + # Warning about deprecation implemented in _load_module_shim(). return _load_module_shim(cls, fullname) @classmethod diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 378b7a27558556..919d487c78c7dd 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -19,6 +19,36 @@ # reference any injected objects! This includes not only global code but also # anything specified at the class level. +# Module injected manually by _set_bootstrap_module() +_bootstrap = None + +# Import builtin modules +import _imp +import _io +import sys +import _warnings +import marshal + + +_MS_WINDOWS = (sys.platform == 'win32') +if _MS_WINDOWS: + import nt as _os + import winreg +else: + import posix as _os + + +if _MS_WINDOWS: + path_separators = ['\\', '/'] +else: + path_separators = ['/'] +# Assumption made in _path_join() +assert all(len(sep) == 1 for sep in path_separators) +path_sep = path_separators[0] +path_separators = ''.join(path_separators) +_pathseps_with_colon = {f':{s}' for s in path_separators} + + # Bootstrap-related code ###################################################### _CASE_INSENSITIVE_PLATFORMS_STR_KEY = 'win', _CASE_INSENSITIVE_PLATFORMS_BYTES_KEY = 'cygwin', 'darwin' @@ -42,6 +72,8 @@ def _relax_case(): return False return _relax_case +_relax_case = _make_relax_case() + def _pack_uint32(x): """Convert a 32-bit integer to little-endian.""" @@ -279,7 +311,8 @@ def _write_atomic(path, data, mode=0o666): # Python 3.9a2 3425 (simplify bytecodes for **value unpacking) # Python 3.10a1 3430 (Make 'annotations' future by default) # Python 3.10a1 3431 (New line number table format -- PEP 626) -# Python 3.10a2 3432 (PEP 634: Structural Pattern Matching) +# Python 3.10a2 3432 (Function annotation for MAKE_FUNCTION is changed from dict to tuple bpo-42202) +# Python 3.10aX 3433 (PEP 634: Structural Pattern Matching) # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -289,13 +322,17 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3432).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3433).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' _OPT = 'opt-' -SOURCE_SUFFIXES = ['.py'] # _setup() adds .pyw as needed. +SOURCE_SUFFIXES = ['.py'] +if _MS_WINDOWS: + SOURCE_SUFFIXES.append('.pyw') + +EXTENSION_SUFFIXES = _imp.extension_suffixes() BYTECODE_SUFFIXES = ['.pyc'] # Deprecated. @@ -470,15 +507,18 @@ def _check_name_wrapper(self, name=None, *args, **kwargs): raise ImportError('loader for %s cannot handle %s' % (self.name, name), name=name) return method(self, name, *args, **kwargs) - try: + + # FIXME: @_check_name is used to define class methods before the + # _bootstrap module is set by _set_bootstrap_module(). + if _bootstrap is not None: _wrap = _bootstrap._wrap - except NameError: - # XXX yuck + else: def _wrap(new, old): for replace in ['__module__', '__name__', '__qualname__', '__doc__']: if hasattr(old, replace): setattr(new, replace, getattr(old, replace)) new.__dict__.update(old.__dict__) + _wrap(_check_name_wrapper, method) return _check_name_wrapper @@ -714,10 +754,10 @@ class WindowsRegistryFinder: REGISTRY_KEY_DEBUG = ( 'Software\\Python\\PythonCore\\{sys_version}' '\\Modules\\{fullname}\\Debug') - DEBUG_BUILD = False # Changed in _setup() + DEBUG_BUILD = (_MS_WINDOWS and '_d.pyd' in EXTENSION_SUFFIXES) - @classmethod - def _open_registry(cls, key): + @staticmethod + def _open_registry(key): try: return winreg.OpenKey(winreg.HKEY_CURRENT_USER, key) except OSError: @@ -793,7 +833,8 @@ def exec_module(self, module): _bootstrap._call_with_frames_removed(exec, code, module.__dict__) def load_module(self, fullname): - """This module is deprecated.""" + """This method is deprecated.""" + # Warning implemented in _load_module_shim(). return _bootstrap._load_module_shim(self, fullname) @@ -968,7 +1009,7 @@ def load_module(self, fullname): """ # The only reason for this method is for the name check. # Issue #14857: Avoid the zero-argument form of super so the implementation - # of that form can be updated without breaking the frozen module + # of that form can be updated without breaking the frozen module. return super(FileLoader, self).load_module(fullname) @_check_name @@ -1061,10 +1102,6 @@ def get_source(self, fullname): return None -# Filled in by _setup(). -EXTENSION_SUFFIXES = [] - - class ExtensionFileLoader(FileLoader, _LoaderBasics): """Loader for extension modules. @@ -1185,8 +1222,8 @@ class _NamespaceLoader: def __init__(self, name, path, path_finder): self._path = _NamespacePath(name, path, path_finder) - @classmethod - def module_repr(cls, module): + @staticmethod + def module_repr(module): """Return repr for the module. The method is deprecated. The import machinery does the job itself. @@ -1218,6 +1255,7 @@ def load_module(self, fullname): # The import system never calls this method. _bootstrap._verbose_message('namespace module loaded with path {!r}', self._path) + # Warning implemented in _load_module_shim(). return _bootstrap._load_module_shim(self, fullname) @@ -1227,8 +1265,8 @@ class PathFinder: """Meta path finder for sys.path and package __path__ attributes.""" - @classmethod - def invalidate_caches(cls): + @staticmethod + def invalidate_caches(): """Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).""" for name, finder in list(sys.path_importer_cache.items()): @@ -1237,8 +1275,8 @@ def invalidate_caches(cls): elif hasattr(finder, 'invalidate_caches'): finder.invalidate_caches() - @classmethod - def _path_hooks(cls, path): + @staticmethod + def _path_hooks(path): """Search sys.path_hooks for a finder for 'path'.""" if sys.path_hooks is not None and not sys.path_hooks: _warnings.warn('sys.path_hooks is empty', ImportWarning) @@ -1356,8 +1394,8 @@ def find_module(cls, fullname, path=None): return None return spec.loader - @classmethod - def find_distributions(cls, *args, **kwargs): + @staticmethod + def find_distributions(*args, **kwargs): """ Find distributions. @@ -1553,66 +1591,14 @@ def _get_supported_file_loaders(): return [extensions, source, bytecode] -def _setup(_bootstrap_module): - """Setup the path-based importers for importlib by importing needed - built-in modules and injecting them into the global namespace. - - Other components are extracted from the core bootstrap module. - - """ - global sys, _imp, _bootstrap +def _set_bootstrap_module(_bootstrap_module): + global _bootstrap _bootstrap = _bootstrap_module - sys = _bootstrap.sys - _imp = _bootstrap._imp - - self_module = sys.modules[__name__] - - # Directly load the os module (needed during bootstrap). - os_details = ('posix', ['/']), ('nt', ['\\', '/']) - for builtin_os, path_separators in os_details: - # Assumption made in _path_join() - assert all(len(sep) == 1 for sep in path_separators) - path_sep = path_separators[0] - if builtin_os in sys.modules: - os_module = sys.modules[builtin_os] - break - else: - try: - os_module = _bootstrap._builtin_from_name(builtin_os) - break - except ImportError: - continue - else: - raise ImportError('importlib requires posix or nt') - - setattr(self_module, '_os', os_module) - setattr(self_module, 'path_sep', path_sep) - setattr(self_module, 'path_separators', ''.join(path_separators)) - setattr(self_module, '_pathseps_with_colon', {f':{s}' for s in path_separators}) - - # Directly load built-in modules needed during bootstrap. - builtin_names = ['_io', '_warnings', 'marshal'] - if builtin_os == 'nt': - builtin_names.append('winreg') - for builtin_name in builtin_names: - if builtin_name not in sys.modules: - builtin_module = _bootstrap._builtin_from_name(builtin_name) - else: - builtin_module = sys.modules[builtin_name] - setattr(self_module, builtin_name, builtin_module) - - # Constants - setattr(self_module, '_relax_case', _make_relax_case()) - EXTENSION_SUFFIXES.extend(_imp.extension_suffixes()) - if builtin_os == 'nt': - SOURCE_SUFFIXES.append('.pyw') - if '_d.pyd' in EXTENSION_SUFFIXES: - WindowsRegistryFinder.DEBUG_BUILD = True def _install(_bootstrap_module): """Install the path-based import components.""" - _setup(_bootstrap_module) + _set_bootstrap_module(_bootstrap_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) sys.meta_path.append(PathFinder) diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py index 97d5afa3001930..55e70889f22f70 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -1,5 +1,4 @@ """Abstract base classes related to import.""" -from . import _bootstrap from . import _bootstrap_external from . import machinery try: diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py index 1b2b5c9b4f3407..9a7757fb6e4494 100644 --- a/Lib/importlib/machinery.py +++ b/Lib/importlib/machinery.py @@ -1,7 +1,5 @@ """The machinery of importlib: finders, loaders, hooks, etc.""" -import _imp - from ._bootstrap import ModuleSpec from ._bootstrap import BuiltinImporter from ._bootstrap import FrozenImporter diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py index 1e44843a687f2b..98a0fa54dfd873 100644 --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -232,7 +232,6 @@ def __getattribute__(self, attr): # Figure out exactly what attributes were mutated between the creation # of the module and now. attrs_then = self.__spec__.loader_state['__dict__'] - original_type = self.__spec__.loader_state['__class__'] attrs_now = self.__dict__ attrs_updated = {} for key, value in attrs_now.items(): diff --git a/Lib/inspect.py b/Lib/inspect.py index 7412d0e837cf14..9150ac104dcb73 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -868,7 +868,12 @@ def findsource(object): lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(\s*async\s+def\s)|(.*(? 0: - if pat.match(lines[lnum]): break + try: + line = lines[lnum] + except IndexError: + raise OSError('lineno is out of bounds') + if pat.match(line): + break lnum = lnum - 1 return lines, lnum raise OSError('could not find code object') @@ -930,6 +935,7 @@ def __init__(self): self.indecorator = False self.decoratorhasargs = False self.last = 1 + self.body_col0 = None def tokeneater(self, type, token, srowcol, erowcol, line): if not self.started and not self.indecorator: @@ -961,6 +967,8 @@ def tokeneater(self, type, token, srowcol, erowcol, line): elif self.passline: pass elif type == tokenize.INDENT: + if self.body_col0 is None and self.started: + self.body_col0 = erowcol[1] self.indent = self.indent + 1 self.passline = True elif type == tokenize.DEDENT: @@ -970,6 +978,10 @@ def tokeneater(self, type, token, srowcol, erowcol, line): # not e.g. for "if: else:" or "try: finally:" blocks) if self.indent <= 0: raise EndOfBlock + elif type == tokenize.COMMENT: + if self.body_col0 is not None and srowcol[1] >= self.body_col0: + # Include comments if indented at least as much as the block + self.last = srowcol[0] elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL): # any other token on the same indentation level end the previous # block as well, except the pseudo-tokens COMMENT and NL. diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 178c5b981d8e50..531a699a40df49 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -630,7 +630,10 @@ def __len__(self): return len(self._parts) def __getitem__(self, idx): - if idx < 0 or idx >= len(self): + if isinstance(idx, slice): + return tuple(self[i] for i in range(*idx.indices(len(self)))) + + if idx >= len(self) or idx < -len(self): raise IndexError(idx) return self._pathcls._from_parsed_parts(self._drv, self._root, self._parts[:-idx - 1]) diff --git a/Lib/pickle.py b/Lib/pickle.py index cbac5f168b45eb..e63a8b6e4dbb70 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -340,7 +340,9 @@ def whichmodule(obj, name): # Protect the iteration by using a list copy of sys.modules against dynamic # modules that trigger imports of other modules upon calls to getattr. for module_name, module in sys.modules.copy().items(): - if module_name == '__main__' or module is None: + if (module_name == '__main__' + or module_name == '__mp_main__' # bpo-42406 + or module is None): continue try: if _getattribute(module, name)[0] is obj: diff --git a/Lib/platform.py b/Lib/platform.py index 0eb5167d584f79..138a974f02bb6d 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1230,6 +1230,63 @@ def platform(aliased=0, terse=0): _platform_cache[(aliased, terse)] = platform return platform +### freedesktop.org os-release standard +# https://www.freedesktop.org/software/systemd/man/os-release.html + +# NAME=value with optional quotes (' or "). The regular expression is less +# strict than shell lexer, but that's ok. +_os_release_line = re.compile( + "^(?P[a-zA-Z0-9_]+)=(?P[\"\']?)(?P.*)(?P=quote)$" +) +# unescape five special characters mentioned in the standard +_os_release_unescape = re.compile(r"\\([\\\$\"\'`])") +# /etc takes precedence over /usr/lib +_os_release_candidates = ("/etc/os-release", "/usr/lib/os-relesase") +_os_release_cache = None + + +def _parse_os_release(lines): + # These fields are mandatory fields with well-known defaults + # in pratice all Linux distributions override NAME, ID, and PRETTY_NAME. + info = { + "NAME": "Linux", + "ID": "linux", + "PRETTY_NAME": "Linux", + } + + for line in lines: + mo = _os_release_line.match(line) + if mo is not None: + info[mo.group('name')] = _os_release_unescape.sub( + r"\1", mo.group('value') + ) + + return info + + +def freedesktop_os_release(): + """Return operation system identification from freedesktop.org os-release + """ + global _os_release_cache + + if _os_release_cache is None: + errno = None + for candidate in _os_release_candidates: + try: + with open(candidate, encoding="utf-8") as f: + _os_release_cache = _parse_os_release(f) + break + except OSError as e: + errno = e.errno + else: + raise OSError( + errno, + f"Unable to read files {', '.join(_os_release_candidates)}" + ) + + return _os_release_cache.copy() + + ### Command line interface if __name__ == '__main__': diff --git a/Lib/pprint.py b/Lib/pprint.py index 213998e3491ef7..a8af50e5a68611 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -64,15 +64,15 @@ def pp(object, *args, sort_dicts=False, **kwargs): def saferepr(object): """Version of repr() which can handle recursive data structures.""" - return _safe_repr(object, {}, None, 0, True)[0] + return PrettyPrinter()._safe_repr(object, {}, None, 0)[0] def isreadable(object): """Determine if saferepr(object) is readable by eval().""" - return _safe_repr(object, {}, None, 0, True)[1] + return PrettyPrinter()._safe_repr(object, {}, None, 0)[1] def isrecursive(object): """Determine if object requires a recursive representation.""" - return _safe_repr(object, {}, None, 0, True)[2] + return PrettyPrinter()._safe_repr(object, {}, None, 0)[2] class _safe_key: """Helper function for key functions when sorting unorderable objects. @@ -435,7 +435,7 @@ def format(self, object, context, maxlevels, level): and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. """ - return _safe_repr(object, context, maxlevels, level, self._sort_dicts) + return self._safe_repr(object, context, maxlevels, level) def _pprint_default_dict(self, object, stream, indent, allowance, context, level): if not len(object): @@ -518,77 +518,79 @@ def _pprint_user_string(self, object, stream, indent, allowance, context, level) _dispatch[_collections.UserString.__repr__] = _pprint_user_string -# Return triple (repr_string, isreadable, isrecursive). + def _safe_repr(self, object, context, maxlevels, level): + # Return triple (repr_string, isreadable, isrecursive). + typ = type(object) + if typ in _builtin_scalars: + return repr(object), True, False -def _safe_repr(object, context, maxlevels, level, sort_dicts): - typ = type(object) - if typ in _builtin_scalars: - return repr(object), True, False - - r = getattr(typ, "__repr__", None) - if issubclass(typ, dict) and r is dict.__repr__: - if not object: - return "{}", True, False - objid = id(object) - if maxlevels and level >= maxlevels: - return "{...}", False, objid in context - if objid in context: - return _recursion(object), False, True - context[objid] = 1 - readable = True - recursive = False - components = [] - append = components.append - level += 1 - if sort_dicts: - items = sorted(object.items(), key=_safe_tuple) - else: - items = object.items() - for k, v in items: - krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, level, sort_dicts) - vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, level, sort_dicts) - append("%s: %s" % (krepr, vrepr)) - readable = readable and kreadable and vreadable - if krecur or vrecur: - recursive = True - del context[objid] - return "{%s}" % ", ".join(components), readable, recursive - - if (issubclass(typ, list) and r is list.__repr__) or \ - (issubclass(typ, tuple) and r is tuple.__repr__): - if issubclass(typ, list): + r = getattr(typ, "__repr__", None) + if issubclass(typ, dict) and r is dict.__repr__: if not object: - return "[]", True, False - format = "[%s]" - elif len(object) == 1: - format = "(%s,)" - else: - if not object: - return "()", True, False - format = "(%s)" - objid = id(object) - if maxlevels and level >= maxlevels: - return format % "...", False, objid in context - if objid in context: - return _recursion(object), False, True - context[objid] = 1 - readable = True - recursive = False - components = [] - append = components.append - level += 1 - for o in object: - orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level, sort_dicts) - append(orepr) - if not oreadable: - readable = False - if orecur: - recursive = True - del context[objid] - return format % ", ".join(components), readable, recursive - - rep = repr(object) - return rep, (rep and not rep.startswith('<')), False + return "{}", True, False + objid = id(object) + if maxlevels and level >= maxlevels: + return "{...}", False, objid in context + if objid in context: + return _recursion(object), False, True + context[objid] = 1 + readable = True + recursive = False + components = [] + append = components.append + level += 1 + if self._sort_dicts: + items = sorted(object.items(), key=_safe_tuple) + else: + items = object.items() + for k, v in items: + krepr, kreadable, krecur = self.format( + k, context, maxlevels, level) + vrepr, vreadable, vrecur = self.format( + v, context, maxlevels, level) + append("%s: %s" % (krepr, vrepr)) + readable = readable and kreadable and vreadable + if krecur or vrecur: + recursive = True + del context[objid] + return "{%s}" % ", ".join(components), readable, recursive + + if (issubclass(typ, list) and r is list.__repr__) or \ + (issubclass(typ, tuple) and r is tuple.__repr__): + if issubclass(typ, list): + if not object: + return "[]", True, False + format = "[%s]" + elif len(object) == 1: + format = "(%s,)" + else: + if not object: + return "()", True, False + format = "(%s)" + objid = id(object) + if maxlevels and level >= maxlevels: + return format % "...", False, objid in context + if objid in context: + return _recursion(object), False, True + context[objid] = 1 + readable = True + recursive = False + components = [] + append = components.append + level += 1 + for o in object: + orepr, oreadable, orecur = self.format( + o, context, maxlevels, level) + append(orepr) + if not oreadable: + readable = False + if orecur: + recursive = True + del context[objid] + return format % ", ".join(components), readable, recursive + + rep = repr(object) + return rep, (rep and not rep.startswith('<')), False _builtin_scalars = frozenset({str, bytes, bytearray, int, float, complex, bool, type(None)}) @@ -604,7 +606,7 @@ def _perfcheck(object=None): object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000 p = PrettyPrinter() t1 = time.perf_counter() - _safe_repr(object, {}, None, 0, True) + p._safe_repr(object, {}, None, 0, True) t2 = time.perf_counter() p.pformat(object) t3 = time.perf_counter() diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index b424b1d0f9b224..49630bb4b81d7d 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Tue Nov 3 00:01:01 2020 +# Autogenerated by Sphinx on Mon Dec 7 19:34:00 2020 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -5301,24 +5301,23 @@ 'for the\n' 'conversion. The alternate form is defined differently for ' 'different\n' - 'types. This option is only valid for integer, float, ' - 'complex and\n' - 'Decimal types. For integers, when binary, octal, or ' - 'hexadecimal output\n' - 'is used, this option adds the prefix respective "\'0b\'", ' - '"\'0o\'", or\n' - '"\'0x\'" to the output value. For floats, complex and ' - 'Decimal the\n' - 'alternate form causes the result of the conversion to ' - 'always contain a\n' - 'decimal-point character, even if no digits follow it. ' - 'Normally, a\n' - 'decimal-point character appears in the result of these ' - 'conversions\n' - 'only if a digit follows it. In addition, for "\'g\'" and ' - '"\'G\'"\n' - 'conversions, trailing zeros are not removed from the ' - 'result.\n' + 'types. This option is only valid for integer, float and ' + 'complex\n' + 'types. For integers, when binary, octal, or hexadecimal ' + 'output is\n' + 'used, this option adds the prefix respective "\'0b\'", ' + '"\'0o\'", or "\'0x\'"\n' + 'to the output value. For float and complex the alternate ' + 'form causes\n' + 'the result of the conversion to always contain a ' + 'decimal-point\n' + 'character, even if no digits follow it. Normally, a ' + 'decimal-point\n' + 'character appears in the result of these conversions only ' + 'if a digit\n' + 'follows it. In addition, for "\'g\'" and "\'G\'" ' + 'conversions, trailing\n' + 'zeros are not removed from the result.\n' '\n' 'The "\',\'" option signals the use of a comma for a ' 'thousands separator.\n' @@ -5456,9 +5455,8 @@ 'the integer\n' 'to a floating point number before formatting.\n' '\n' - 'The available presentation types for floating point and ' - 'decimal values\n' - 'are:\n' + 'The available presentation types for "float" and "Decimal" ' + 'values are:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' @@ -5467,24 +5465,50 @@ '|\n' ' ' '|===========|============================================================|\n' - ' | "\'e\'" | Exponent notation. Prints the number in ' - 'scientific |\n' - ' | | notation using the letter ‘e’ to indicate ' - 'the exponent. |\n' - ' | | The default precision is ' - '"6". |\n' + ' | "\'e\'" | Scientific notation. For a given ' + 'precision "p", formats |\n' + ' | | the number in scientific notation with the ' + 'letter ‘e’ |\n' + ' | | separating the coefficient from the ' + 'exponent. The |\n' + ' | | coefficient has one digit before and "p" ' + 'digits after the |\n' + ' | | decimal point, for a total of "p + 1" ' + 'significant digits. |\n' + ' | | With no precision given, uses a precision ' + 'of "6" digits |\n' + ' | | after the decimal point for "float", and ' + 'shows all |\n' + ' | | coefficient digits for "Decimal". If no ' + 'digits follow the |\n' + ' | | decimal point, the decimal point is also ' + 'removed unless |\n' + ' | | the "#" option is ' + 'used. |\n' ' ' '+-----------+------------------------------------------------------------+\n' - ' | "\'E\'" | Exponent notation. Same as "\'e\'" ' - 'except it uses an upper |\n' + ' | "\'E\'" | Scientific notation. Same as "\'e\'" ' + 'except it uses an upper |\n' ' | | case ‘E’ as the separator ' 'character. |\n' ' ' '+-----------+------------------------------------------------------------+\n' - ' | "\'f\'" | Fixed-point notation. Displays the ' - 'number as a fixed-point |\n' - ' | | number. The default precision is ' - '"6". |\n' + ' | "\'f\'" | Fixed-point notation. For a given ' + 'precision "p", formats |\n' + ' | | the number as a decimal number with ' + 'exactly "p" digits |\n' + ' | | following the decimal point. With no ' + 'precision given, uses |\n' + ' | | a precision of "6" digits after the ' + 'decimal point for |\n' + ' | | "float", and uses a precision large enough ' + 'to show all |\n' + ' | | coefficient digits for "Decimal". If no ' + 'digits follow the |\n' + ' | | decimal point, the decimal point is also ' + 'removed unless |\n' + ' | | the "#" option is ' + 'used. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'F\'" | Fixed-point notation. Same as "\'f\'", ' @@ -5530,9 +5554,14 @@ ' | | regardless of the precision. A precision ' 'of "0" is |\n' ' | | treated as equivalent to a precision of ' - '"1". The default |\n' - ' | | precision is ' - '"6". |\n' + '"1". With no |\n' + ' | | precision given, uses a precision of "6" ' + 'significant |\n' + ' | | digits for "float", and shows all ' + 'coefficient digits for |\n' + ' | | ' + '"Decimal". ' + '|\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'G\'" | General format. Same as "\'g\'" except ' diff --git a/Lib/smtpd.py b/Lib/smtpd.py index 8f1a22e937871d..1e2adc87a2bf2a 100755 --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -163,7 +163,7 @@ def __init__(self, server, conn, addr, data_size_limit=DATA_SIZE_DEFAULT, # a race condition may occur if the other end is closing # before we can get the peername self.close() - if err.args[0] != errno.ENOTCONN: + if err.errno != errno.ENOTCONN: raise return print('Peer:', repr(self.peer), file=DEBUGSTREAM) diff --git a/Lib/socket.py b/Lib/socket.py index cafa573a30c052..5276cc8ba3d619 100755 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -377,7 +377,7 @@ def _sendfile_use_sendfile(self, file, offset=0, count=None): try: while True: if timeout and not selector_select(timeout): - raise _socket.timeout('timed out') + raise TimeoutError('timed out') if count: blocksize = count - total_sent if blocksize <= 0: @@ -706,7 +706,7 @@ def readinto(self, b): self._timeout_occurred = True raise except error as e: - if e.args[0] in _blocking_errnos: + if e.errno in _blocking_errnos: return None raise @@ -722,7 +722,7 @@ def write(self, b): return self._sock.send(b) except error as e: # XXX what about EINTR? - if e.args[0] in _blocking_errnos: + if e.errno in _blocking_errnos: return None raise diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 6c91df27cca70d..f001c0678e195f 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -21,3 +21,17 @@ # 3. This notice may not be removed or altered from any source distribution. from sqlite3.dbapi2 import * + + +# bpo-42264: OptimizedUnicode was deprecated in Python 3.10. It's scheduled +# for removal in Python 3.12. +def __getattr__(name): + if name == "OptimizedUnicode": + import warnings + msg = (""" + OptimizedUnicode is deprecated and will be removed in Python 3.12. + Since Python 3.3 it has simply been an alias for 'str'. + """) + warnings.warn(msg, DeprecationWarning, stacklevel=2) + return str + raise AttributeError(f"module 'sqlite3' has no attribute '{name}'") diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py index 95dd24bdfadca6..d91997333b11ca 100644 --- a/Lib/sqlite3/test/factory.py +++ b/Lib/sqlite3/test/factory.py @@ -254,9 +254,10 @@ def CheckCustom(self): self.assertTrue(row[0].endswith("reich"), "column must contain original data") def CheckOptimizedUnicode(self): - # In py3k, str objects are always returned when text_factory - # is OptimizedUnicode - self.con.text_factory = sqlite.OptimizedUnicode + # OptimizedUnicode is deprecated as of Python 3.10 + with self.assertWarns(DeprecationWarning) as cm: + self.con.text_factory = sqlite.OptimizedUnicode + self.assertIn("factory.py", cm.filename) austria = "Österreich" germany = "Deutchland" a_row = self.con.execute("select ?", (austria,)).fetchone() diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 6a6c2fc98e83f3..e259dc3a8e538a 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -2078,7 +2078,11 @@ def send_signal(self, sig): # The race condition can still happen if the race condition # described above happens between the returncode test # and the kill() call. - os.kill(self.pid, sig) + try: + os.kill(self.pid, sig) + except ProcessLookupError: + # Supress the race condition error; bpo-40550. + pass def terminate(self): """Terminate the process with SIGTERM diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 6c87b06634c457..e1b2f93f876d78 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -424,10 +424,11 @@ def _init_posix(vars): def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories + import _imp vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') - vars['EXT_SUFFIX'] = '.pyd' + vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0] vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index e42279470dac65..1d15612616f1d8 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2237,6 +2237,9 @@ def makelink(self, tarinfo, targetpath): try: # For systems that support symbolic and hard links. if tarinfo.issym(): + if os.path.lexists(targetpath): + # Avoid FileExistsError on following os.symlink. + os.unlink(targetpath) os.symlink(tarinfo.linkname, targetpath) else: # See extract(). diff --git a/Lib/test/inspect_fodder.py b/Lib/test/inspect_fodder.py index 96a0257bfdf03e..e1287a315901cf 100644 --- a/Lib/test/inspect_fodder.py +++ b/Lib/test/inspect_fodder.py @@ -91,3 +91,25 @@ def as_method_of(self, obj): custom_method = Callable().as_method_of(42) del Callable + +# line 95 +class WhichComments: + # line 97 + # before f + def f(self): + # line 100 + # start f + return 1 + # line 103 + # end f + # line 105 + # after f + + # before asyncf - line 108 + async def asyncf(self): + # start asyncf + return 2 + # end asyncf + # after asyncf - line 113 + # end of WhichComments - line 114 + # after WhichComments - line 115 diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 4ba749454c1873..5a45d78be91663 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -421,7 +421,7 @@ def requires_lzma(reason='requires lzma'): is_android = hasattr(sys, 'getandroidapilevel') -if sys.platform != 'win32': +if sys.platform not in ('win32', 'vxworks'): unix_shell = '/system/bin/sh' if is_android else '/bin/sh' else: unix_shell = None diff --git a/Lib/test/support/socket_helper.py b/Lib/test/support/socket_helper.py index 7070c12c253f6d..e78712b74b1377 100644 --- a/Lib/test/support/socket_helper.py +++ b/Lib/test/support/socket_helper.py @@ -225,7 +225,7 @@ def transient_internet(resource_name, *, timeout=_NOT_SET, errnos=()): def filter_error(err): n = getattr(err, 'errno', None) - if (isinstance(err, socket.timeout) or + if (isinstance(err, TimeoutError) or (isinstance(err, socket.gaierror) and n in gai_errnos) or (isinstance(err, urllib.error.HTTPError) and 500 <= err.code <= 599) or diff --git a/Lib/test/test_asyncio/functional.py b/Lib/test/test_asyncio/functional.py index 5cd0659387d843..74490a869de9d9 100644 --- a/Lib/test/test_asyncio/functional.py +++ b/Lib/test/test_asyncio/functional.py @@ -248,7 +248,7 @@ def _run(self): conn, addr = self._sock.accept() except BlockingIOError: continue - except socket.timeout: + except TimeoutError: if not self._active: return else: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index f74dabc2db9458..8d048c87d00507 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1160,9 +1160,7 @@ def test_create_server_stream_bittype(self): @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'no IPv6 support') def test_create_server_ipv6(self): async def main(): - with self.assertWarns(DeprecationWarning): - srv = await asyncio.start_server( - lambda: None, '::1', 0, loop=self.loop) + srv = await asyncio.start_server(lambda: None, '::1', 0) try: self.assertGreater(len(srv.sockets), 0) finally: diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index b8fe466cd53dfc..ce615606db7e3d 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -206,8 +206,8 @@ def __init__(self, loop): self.disconnects = {fd: loop.create_future() for fd in range(3)} self.data = {1: b'', 2: b''} self.returncode = None - self.got_data = {1: asyncio.Event(loop=loop), - 2: asyncio.Event(loop=loop)} + self.got_data = {1: asyncio.Event(), + 2: asyncio.Event()} def connection_made(self, transport): self.transport = transport @@ -294,11 +294,8 @@ def callback(arg): self.loop.stop() self.loop.call_later(0.1, callback, 'hello world') - t0 = time.monotonic() self.loop.run_forever() - t1 = time.monotonic() self.assertEqual(results, ['hello world']) - self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0) def test_call_soon(self): results = [] @@ -1740,20 +1737,20 @@ def test_subprocess_exec(self): connect = self.loop.subprocess_exec( functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) - self.assertEqual('CONNECTED', proto.state) - stdin = transp.get_pipe_transport(0) - stdin.write(b'Python The Winner') - self.loop.run_until_complete(proto.got_data[1].wait()) - with test_utils.disable_logger(): - transp.close() - self.loop.run_until_complete(proto.completed) - self.check_killed(proto.returncode) - self.assertEqual(b'Python The Winner', proto.data[1]) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) + self.assertEqual('CONNECTED', proto.state) + + stdin = transp.get_pipe_transport(0) + stdin.write(b'Python The Winner') + self.loop.run_until_complete(proto.got_data[1].wait()) + with test_utils.disable_logger(): + transp.close() + self.loop.run_until_complete(proto.completed) + self.check_killed(proto.returncode) + self.assertEqual(b'Python The Winner', proto.data[1]) def test_subprocess_interactive(self): prog = os.path.join(os.path.dirname(__file__), 'echo.py') @@ -1762,51 +1759,48 @@ def test_subprocess_interactive(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) - self.assertEqual('CONNECTED', proto.state) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) + self.assertEqual('CONNECTED', proto.state) - stdin = transp.get_pipe_transport(0) - stdin.write(b'Python ') - self.loop.run_until_complete(proto.got_data[1].wait()) - proto.got_data[1].clear() - self.assertEqual(b'Python ', proto.data[1]) + stdin = transp.get_pipe_transport(0) + stdin.write(b'Python ') + self.loop.run_until_complete(proto.got_data[1].wait()) + proto.got_data[1].clear() + self.assertEqual(b'Python ', proto.data[1]) - stdin.write(b'The Winner') - self.loop.run_until_complete(proto.got_data[1].wait()) - self.assertEqual(b'Python The Winner', proto.data[1]) + stdin.write(b'The Winner') + self.loop.run_until_complete(proto.got_data[1].wait()) + self.assertEqual(b'Python The Winner', proto.data[1]) - with test_utils.disable_logger(): - transp.close() - self.loop.run_until_complete(proto.completed) - self.check_killed(proto.returncode) + with test_utils.disable_logger(): + transp.close() + self.loop.run_until_complete(proto.completed) + self.check_killed(proto.returncode) def test_subprocess_shell(self): - with self.assertWarns(DeprecationWarning): - connect = self.loop.subprocess_shell( - functools.partial(MySubprocessProtocol, self.loop), - 'echo Python') - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) + connect = self.loop.subprocess_shell( + functools.partial(MySubprocessProtocol, self.loop), + 'echo Python') + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - transp.get_pipe_transport(0).close() - self.loop.run_until_complete(proto.completed) - self.assertEqual(0, proto.returncode) - self.assertTrue(all(f.done() for f in proto.disconnects.values())) - self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python') - self.assertEqual(proto.data[2], b'') - transp.close() + transp.get_pipe_transport(0).close() + self.loop.run_until_complete(proto.completed) + self.assertEqual(0, proto.returncode) + self.assertTrue(all(f.done() for f in proto.disconnects.values())) + self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python') + self.assertEqual(proto.data[2], b'') + transp.close() def test_subprocess_exitcode(self): connect = self.loop.subprocess_shell( functools.partial(MySubprocessProtocol, self.loop), 'exit 7', stdin=None, stdout=None, stderr=None) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) + transp, proto = self.loop.run_until_complete(connect) self.assertIsInstance(proto, MySubprocessProtocol) self.loop.run_until_complete(proto.completed) self.assertEqual(7, proto.returncode) @@ -1816,8 +1810,8 @@ def test_subprocess_close_after_finish(self): connect = self.loop.subprocess_shell( functools.partial(MySubprocessProtocol, self.loop), 'exit 7', stdin=None, stdout=None, stderr=None) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) + + transp, proto = self.loop.run_until_complete(connect) self.assertIsInstance(proto, MySubprocessProtocol) self.assertIsNone(transp.get_pipe_transport(0)) self.assertIsNone(transp.get_pipe_transport(1)) @@ -1833,15 +1827,14 @@ def test_subprocess_kill(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - transp.kill() - self.loop.run_until_complete(proto.completed) - self.check_killed(proto.returncode) - transp.close() + transp.kill() + self.loop.run_until_complete(proto.completed) + self.check_killed(proto.returncode) + transp.close() def test_subprocess_terminate(self): prog = os.path.join(os.path.dirname(__file__), 'echo.py') @@ -1850,15 +1843,14 @@ def test_subprocess_terminate(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - transp.terminate() - self.loop.run_until_complete(proto.completed) - self.check_terminated(proto.returncode) - transp.close() + transp.terminate() + self.loop.run_until_complete(proto.completed) + self.check_terminated(proto.returncode) + transp.close() @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP") def test_subprocess_send_signal(self): @@ -1873,15 +1865,15 @@ def test_subprocess_send_signal(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) - transp.send_signal(signal.SIGHUP) - self.loop.run_until_complete(proto.completed) - self.assertEqual(-signal.SIGHUP, proto.returncode) - transp.close() + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) + + transp.send_signal(signal.SIGHUP) + self.loop.run_until_complete(proto.completed) + self.assertEqual(-signal.SIGHUP, proto.returncode) + transp.close() finally: signal.signal(signal.SIGHUP, old_handler) @@ -1892,20 +1884,19 @@ def test_subprocess_stderr(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - stdin = transp.get_pipe_transport(0) - stdin.write(b'test') + stdin = transp.get_pipe_transport(0) + stdin.write(b'test') - self.loop.run_until_complete(proto.completed) + self.loop.run_until_complete(proto.completed) - transp.close() - self.assertEqual(b'OUT:test', proto.data[1]) - self.assertTrue(proto.data[2].startswith(b'ERR:test'), proto.data[2]) - self.assertEqual(0, proto.returncode) + transp.close() + self.assertEqual(b'OUT:test', proto.data[1]) + self.assertTrue(proto.data[2].startswith(b'ERR:test'), proto.data[2]) + self.assertEqual(0, proto.returncode) def test_subprocess_stderr_redirect_to_stdout(self): prog = os.path.join(os.path.dirname(__file__), 'echo2.py') @@ -1914,23 +1905,23 @@ def test_subprocess_stderr_redirect_to_stdout(self): functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog, stderr=subprocess.STDOUT) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) - stdin = transp.get_pipe_transport(0) - self.assertIsNotNone(transp.get_pipe_transport(1)) - self.assertIsNone(transp.get_pipe_transport(2)) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - stdin.write(b'test') - self.loop.run_until_complete(proto.completed) - self.assertTrue(proto.data[1].startswith(b'OUT:testERR:test'), - proto.data[1]) - self.assertEqual(b'', proto.data[2]) + stdin = transp.get_pipe_transport(0) + self.assertIsNotNone(transp.get_pipe_transport(1)) + self.assertIsNone(transp.get_pipe_transport(2)) - transp.close() - self.assertEqual(0, proto.returncode) + stdin.write(b'test') + self.loop.run_until_complete(proto.completed) + self.assertTrue(proto.data[1].startswith(b'OUT:testERR:test'), + proto.data[1]) + self.assertEqual(b'', proto.data[2]) + + transp.close() + self.assertEqual(0, proto.returncode) def test_subprocess_close_client_stream(self): prog = os.path.join(os.path.dirname(__file__), 'echo3.py') @@ -1938,33 +1929,33 @@ def test_subprocess_close_client_stream(self): connect = self.loop.subprocess_exec( functools.partial(MySubprocessProtocol, self.loop), sys.executable, prog) - with self.assertWarns(DeprecationWarning): - transp, proto = self.loop.run_until_complete(connect) - self.assertIsInstance(proto, MySubprocessProtocol) - self.loop.run_until_complete(proto.connected) - stdin = transp.get_pipe_transport(0) - stdout = transp.get_pipe_transport(1) - stdin.write(b'test') - self.loop.run_until_complete(proto.got_data[1].wait()) - self.assertEqual(b'OUT:test', proto.data[1]) + transp, proto = self.loop.run_until_complete(connect) + self.assertIsInstance(proto, MySubprocessProtocol) + self.loop.run_until_complete(proto.connected) - stdout.close() - self.loop.run_until_complete(proto.disconnects[1]) - stdin.write(b'xxx') - self.loop.run_until_complete(proto.got_data[2].wait()) - if sys.platform != 'win32': - self.assertEqual(b'ERR:BrokenPipeError', proto.data[2]) - else: - # After closing the read-end of a pipe, writing to the - # write-end using os.write() fails with errno==EINVAL and - # GetLastError()==ERROR_INVALID_NAME on Windows!?! (Using - # WriteFile() we get ERROR_BROKEN_PIPE as expected.) - self.assertEqual(b'ERR:OSError', proto.data[2]) - with test_utils.disable_logger(): - transp.close() - self.loop.run_until_complete(proto.completed) - self.check_killed(proto.returncode) + stdin = transp.get_pipe_transport(0) + stdout = transp.get_pipe_transport(1) + stdin.write(b'test') + self.loop.run_until_complete(proto.got_data[1].wait()) + self.assertEqual(b'OUT:test', proto.data[1]) + + stdout.close() + self.loop.run_until_complete(proto.disconnects[1]) + stdin.write(b'xxx') + self.loop.run_until_complete(proto.got_data[2].wait()) + if sys.platform != 'win32': + self.assertEqual(b'ERR:BrokenPipeError', proto.data[2]) + else: + # After closing the read-end of a pipe, writing to the + # write-end using os.write() fails with errno==EINVAL and + # GetLastError()==ERROR_INVALID_NAME on Windows!?! (Using + # WriteFile() we get ERROR_BROKEN_PIPE as expected.) + self.assertEqual(b'ERR:OSError', proto.data[2]) + with test_utils.disable_logger(): + transp.close() + self.loop.run_until_complete(proto.completed) + self.check_killed(proto.returncode) def test_subprocess_wait_no_same_group(self): # start the new process in a new session diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py index 8c93fae2b51c6c..6194cd06176dac 100644 --- a/Lib/test/test_asyncio/test_locks.py +++ b/Lib/test/test_asyncio/test_locks.py @@ -26,24 +26,8 @@ def setUp(self): super().setUp() self.loop = self.new_test_loop() - def test_ctor_loop(self): - loop = mock.Mock() - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=loop) - self.assertIs(lock._loop, loop) - - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) - self.assertIs(lock._loop, self.loop) - - def test_ctor_noloop(self): - asyncio.set_event_loop(self.loop) - lock = asyncio.Lock() - self.assertIs(lock._loop, self.loop) - def test_repr(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() self.assertTrue(repr(lock).endswith('[unlocked]>')) self.assertTrue(RGX_REPR.match(repr(lock))) @@ -52,9 +36,9 @@ def test_repr(self): self.assertTrue(RGX_REPR.match(repr(lock))) def test_lock(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() + with self.assertWarns(DeprecationWarning): @asyncio.coroutine def acquire_lock(): return (yield from lock) @@ -67,17 +51,34 @@ def acquire_lock(): self.assertFalse(lock.locked()) + def test_lock_doesnt_accept_loop_parameter(self): + primitives_cls = [ + asyncio.Lock, + asyncio.Condition, + asyncio.Event, + asyncio.Semaphore, + asyncio.BoundedSemaphore, + ] + + for cls in primitives_cls: + with self.assertRaisesRegex( + TypeError, + rf'As of 3.10, the \*loop\* parameter was removed from ' + rf'{cls.__name__}\(\) since it is no longer necessary' + ): + cls(loop=self.loop) + def test_lock_by_with_statement(self): loop = asyncio.new_event_loop() # don't use TestLoop quirks self.set_event_loop(loop) - with self.assertWarns(DeprecationWarning): - primitives = [ - asyncio.Lock(loop=loop), - asyncio.Condition(loop=loop), - asyncio.Semaphore(loop=loop), - asyncio.BoundedSemaphore(loop=loop), - ] + primitives = [ + asyncio.Lock(), + asyncio.Condition(), + asyncio.Semaphore(), + asyncio.BoundedSemaphore(), + ] + with self.assertWarns(DeprecationWarning): @asyncio.coroutine def test(lock): yield from asyncio.sleep(0.01) @@ -95,8 +96,7 @@ def test(lock): self.assertFalse(primitive.locked()) def test_acquire(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() result = [] self.assertTrue(self.loop.run_until_complete(lock.acquire())) @@ -147,8 +147,7 @@ async def c3(result): self.assertTrue(t3.result()) def test_acquire_cancel(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() self.assertTrue(self.loop.run_until_complete(lock.acquire())) task = self.loop.create_task(lock.acquire()) @@ -173,8 +172,7 @@ def test_cancel_race(self): # B's waiter; instead, it should move on to C's waiter. # Setup: A has the lock, b and c are waiting. - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() async def lockit(name, blocker): await lock.acquire() @@ -210,8 +208,7 @@ def test_cancel_release_race(self): # Issue 32734 # Acquire 4 locks, cancel second, release first # and 2 locks are taken at once. - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() lock_count = 0 call_count = 0 @@ -256,8 +253,7 @@ def trigger(): self.assertTrue(t3.cancelled()) def test_finished_waiter_cancelled(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() ta = self.loop.create_task(lock.acquire()) test_utils.run_briefly(self.loop) @@ -279,14 +275,12 @@ def test_finished_waiter_cancelled(self): self.assertTrue(tb.cancelled()) def test_release_not_acquired(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() self.assertRaises(RuntimeError, lock.release) def test_release_no_waiters(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + lock = asyncio.Lock() self.loop.run_until_complete(lock.acquire()) self.assertTrue(lock.locked()) @@ -312,24 +306,8 @@ def setUp(self): super().setUp() self.loop = self.new_test_loop() - def test_ctor_loop(self): - loop = mock.Mock() - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=loop) - self.assertIs(ev._loop, loop) - - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) - self.assertIs(ev._loop, self.loop) - - def test_ctor_noloop(self): - asyncio.set_event_loop(self.loop) - ev = asyncio.Event() - self.assertIs(ev._loop, self.loop) - def test_repr(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() self.assertTrue(repr(ev).endswith('[unset]>')) match = RGX_REPR.match(repr(ev)) self.assertEqual(match.group('extras'), 'unset') @@ -343,8 +321,7 @@ def test_repr(self): self.assertTrue(RGX_REPR.match(repr(ev))) def test_wait(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() self.assertFalse(ev.is_set()) result = [] @@ -381,16 +358,14 @@ async def c3(result): self.assertIsNone(t3.result()) def test_wait_on_set(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() ev.set() res = self.loop.run_until_complete(ev.wait()) self.assertTrue(res) def test_wait_cancel(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() wait = self.loop.create_task(ev.wait()) self.loop.call_soon(wait.cancel) @@ -400,8 +375,7 @@ def test_wait_cancel(self): self.assertFalse(ev._waiters) def test_clear(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() self.assertFalse(ev.is_set()) ev.set() @@ -411,8 +385,7 @@ def test_clear(self): self.assertFalse(ev.is_set()) def test_clear_with_waiters(self): - with self.assertWarns(DeprecationWarning): - ev = asyncio.Event(loop=self.loop) + ev = asyncio.Event() result = [] async def c1(result): @@ -446,23 +419,8 @@ def setUp(self): super().setUp() self.loop = self.new_test_loop() - def test_ctor_loop(self): - loop = mock.Mock() - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=loop) - self.assertIs(cond._loop, loop) - - cond = asyncio.Condition(loop=self.loop) - self.assertIs(cond._loop, self.loop) - - def test_ctor_noloop(self): - asyncio.set_event_loop(self.loop) - cond = asyncio.Condition() - self.assertIs(cond._loop, self.loop) - def test_wait(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() result = [] async def c1(result): @@ -525,8 +483,7 @@ async def c3(result): self.assertTrue(t3.result()) def test_wait_cancel(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.loop.run_until_complete(cond.acquire()) wait = self.loop.create_task(cond.wait()) @@ -538,8 +495,7 @@ def test_wait_cancel(self): self.assertTrue(cond.locked()) def test_wait_cancel_contested(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.loop.run_until_complete(cond.acquire()) self.assertTrue(cond.locked()) @@ -565,10 +521,11 @@ def test_wait_cancel_contested(self): def test_wait_cancel_after_notify(self): # See bpo-32841 - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) waited = False + cond = asyncio.Condition() + cond._loop = self.loop + async def wait_on_cond(): nonlocal waited async with cond: @@ -590,15 +547,13 @@ async def wait_on_cond(): self.assertTrue(waited) def test_wait_unacquired(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.assertRaises( RuntimeError, self.loop.run_until_complete, cond.wait()) def test_wait_for(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() presult = False def predicate(): @@ -635,8 +590,7 @@ async def c1(result): self.assertTrue(t.result()) def test_wait_for_unacquired(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() # predicate can return true immediately res = self.loop.run_until_complete(cond.wait_for(lambda: [1, 2, 3])) @@ -648,8 +602,7 @@ def test_wait_for_unacquired(self): cond.wait_for(lambda: False)) def test_notify(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() result = [] async def c1(result): @@ -701,8 +654,7 @@ async def c3(result): self.assertTrue(t3.result()) def test_notify_all(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() result = [] @@ -738,18 +690,15 @@ async def c2(result): self.assertTrue(t2.result()) def test_notify_unacquired(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.assertRaises(RuntimeError, cond.notify) def test_notify_all_unacquired(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.assertRaises(RuntimeError, cond.notify_all) def test_repr(self): - with self.assertWarns(DeprecationWarning): - cond = asyncio.Condition(loop=self.loop) + cond = asyncio.Condition() self.assertTrue('unlocked' in repr(cond)) self.assertTrue(RGX_REPR.match(repr(cond))) @@ -775,9 +724,8 @@ async def f(): self.loop.run_until_complete(f()) def test_explicit_lock(self): - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) - cond = asyncio.Condition(lock, loop=self.loop) + lock = asyncio.Lock() + cond = asyncio.Condition(lock) self.assertIs(cond._lock, lock) self.assertIs(cond._loop, lock._loop) @@ -785,23 +733,27 @@ def test_explicit_lock(self): def test_ambiguous_loops(self): loop = self.new_test_loop() self.addCleanup(loop.close) - with self.assertWarns(DeprecationWarning): - lock = asyncio.Lock(loop=self.loop) + + lock = asyncio.Lock() + lock._loop = loop + + async def _create_condition(): with self.assertRaises(ValueError): - asyncio.Condition(lock, loop=loop) + asyncio.Condition(lock) + + self.loop.run_until_complete(_create_condition()) def test_timeout_in_block(self): loop = asyncio.new_event_loop() self.addCleanup(loop.close) async def task_timeout(): - condition = asyncio.Condition(loop=loop) + condition = asyncio.Condition() async with condition: with self.assertRaises(asyncio.TimeoutError): await asyncio.wait_for(condition.wait(), timeout=0.5) - with self.assertWarns(DeprecationWarning): - loop.run_until_complete(task_timeout()) + loop.run_until_complete(task_timeout()) class SemaphoreTests(test_utils.TestCase): @@ -810,29 +762,12 @@ def setUp(self): super().setUp() self.loop = self.new_test_loop() - def test_ctor_loop(self): - loop = mock.Mock() - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=loop) - self.assertIs(sem._loop, loop) - - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=self.loop) - self.assertIs(sem._loop, self.loop) - - def test_ctor_noloop(self): - asyncio.set_event_loop(self.loop) - sem = asyncio.Semaphore() - self.assertIs(sem._loop, self.loop) - def test_initial_value_zero(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(0, loop=self.loop) + sem = asyncio.Semaphore(0) self.assertTrue(sem.locked()) def test_repr(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=self.loop) + sem = asyncio.Semaphore() self.assertTrue(repr(sem).endswith('[unlocked, value:1]>')) self.assertTrue(RGX_REPR.match(repr(sem))) @@ -850,8 +785,7 @@ def test_repr(self): self.assertTrue(RGX_REPR.match(repr(sem))) def test_semaphore(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=self.loop) + sem = asyncio.Semaphore() self.assertEqual(1, sem._value) with self.assertWarns(DeprecationWarning): @@ -872,8 +806,7 @@ def test_semaphore_value(self): self.assertRaises(ValueError, asyncio.Semaphore, -1) def test_acquire(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(3, loop=self.loop) + sem = asyncio.Semaphore(3) result = [] self.assertTrue(self.loop.run_until_complete(sem.acquire())) @@ -934,8 +867,7 @@ async def c4(result): self.loop.run_until_complete(asyncio.gather(*race_tasks)) def test_acquire_cancel(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=self.loop) + sem = asyncio.Semaphore() self.loop.run_until_complete(sem.acquire()) acquire = self.loop.create_task(sem.acquire()) @@ -947,8 +879,7 @@ def test_acquire_cancel(self): all(waiter.done() for waiter in sem._waiters)) def test_acquire_cancel_before_awoken(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(value=0, loop=self.loop) + sem = asyncio.Semaphore(value=0) t1 = self.loop.create_task(sem.acquire()) t2 = self.loop.create_task(sem.acquire()) @@ -970,8 +901,7 @@ def test_acquire_cancel_before_awoken(self): test_utils.run_briefly(self.loop) def test_acquire_hang(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(value=0, loop=self.loop) + sem = asyncio.Semaphore(value=0) t1 = self.loop.create_task(sem.acquire()) t2 = self.loop.create_task(sem.acquire()) @@ -985,14 +915,12 @@ def test_acquire_hang(self): self.assertTrue(sem.locked()) def test_release_not_acquired(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.BoundedSemaphore(loop=self.loop) + sem = asyncio.BoundedSemaphore() self.assertRaises(ValueError, sem.release) def test_release_no_waiters(self): - with self.assertWarns(DeprecationWarning): - sem = asyncio.Semaphore(loop=self.loop) + sem = asyncio.Semaphore() self.loop.run_until_complete(sem.acquire()) self.assertTrue(sem.locked()) diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py index c5e3a5c1483573..4bd50f4123e579 100644 --- a/Lib/test/test_asyncio/test_pep492.py +++ b/Lib/test/test_asyncio/test_pep492.py @@ -43,13 +43,12 @@ def setUp(self): class LockTests(BaseTest): def test_context_manager_async_with(self): - with self.assertWarns(DeprecationWarning): - primitives = [ - asyncio.Lock(loop=self.loop), - asyncio.Condition(loop=self.loop), - asyncio.Semaphore(loop=self.loop), - asyncio.BoundedSemaphore(loop=self.loop), - ] + primitives = [ + asyncio.Lock(), + asyncio.Condition(), + asyncio.Semaphore(), + asyncio.BoundedSemaphore(), + ] async def test(lock): await asyncio.sleep(0.01) @@ -66,13 +65,12 @@ async def test(lock): self.assertFalse(primitive.locked()) def test_context_manager_with_await(self): - with self.assertWarns(DeprecationWarning): - primitives = [ - asyncio.Lock(loop=self.loop), - asyncio.Condition(loop=self.loop), - asyncio.Semaphore(loop=self.loop), - asyncio.BoundedSemaphore(loop=self.loop), - ] + primitives = [ + asyncio.Lock(), + asyncio.Condition(), + asyncio.Semaphore(), + asyncio.BoundedSemaphore(), + ] async def test(lock): await asyncio.sleep(0.01) diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py index 5c9aaa82c311a5..0a0b529f621b26 100644 --- a/Lib/test/test_asyncio/test_queues.py +++ b/Lib/test/test_asyncio/test_queues.py @@ -35,14 +35,13 @@ def gen(): loop = self.new_test_loop(gen) - with self.assertWarns(DeprecationWarning): - q = asyncio.Queue(loop=loop) + q = asyncio.Queue() self.assertTrue(fn(q).startswith(' 1: return @@ -2771,7 +2767,7 @@ async def main(): task = loop.create_task(sub(random.randint(0, 10))) tasks.append(task) - await asyncio.gather(*tasks, loop=loop) + await asyncio.gather(*tasks) loop = asyncio.new_event_loop() try: @@ -3328,9 +3324,6 @@ def _check_empty_sequence(self, seq_or_iter): self._run_loop(self.one_loop) self.assertTrue(fut.done()) self.assertEqual(fut.result(), []) - with self.assertWarns(DeprecationWarning): - fut = asyncio.gather(*seq_or_iter, loop=self.other_loop) - self.assertIs(fut._loop, self.other_loop) def test_constructor_empty_sequence(self): self._check_empty_sequence([]) @@ -3343,8 +3336,6 @@ def test_constructor_heterogenous_futures(self): fut2 = self.other_loop.create_future() with self.assertRaises(ValueError): asyncio.gather(fut1, fut2) - with self.assertRaises(ValueError): - asyncio.gather(fut1, loop=self.other_loop) def test_constructor_homogenous_futures(self): children = [self.other_loop.create_future() for i in range(3)] @@ -3352,7 +3343,7 @@ def test_constructor_homogenous_futures(self): self.assertIs(fut._loop, self.other_loop) self._run_loop(self.other_loop) self.assertFalse(fut.done()) - fut = asyncio.gather(*children, loop=self.other_loop) + fut = asyncio.gather(*children) self.assertIs(fut._loop, self.other_loop) self._run_loop(self.other_loop) self.assertFalse(fut.done()) @@ -3423,9 +3414,10 @@ async def coro(): self.one_loop.run_until_complete(fut) self.set_event_loop(self.other_loop, cleanup=False) + asyncio.set_event_loop(self.other_loop) gen3 = coro() gen4 = coro() - fut2 = asyncio.gather(gen3, gen4, loop=self.other_loop) + fut2 = asyncio.gather(gen3, gen4) self.assertIs(fut2._loop, self.other_loop) self.other_loop.run_until_complete(fut2) @@ -3435,7 +3427,7 @@ def test_duplicate_coroutines(self): def coro(s): return s c = coro('abc') - fut = asyncio.gather(c, c, coro('def'), c, loop=self.one_loop) + fut = asyncio.gather(c, c, coro('def'), c) self._run_loop(self.one_loop) self.assertEqual(fut.result(), ['abc', 'abc', 'def', 'abc']) @@ -3455,7 +3447,7 @@ async def inner(): async def outer(): nonlocal proof, gatherer - gatherer = asyncio.gather(child1, child2, loop=self.one_loop) + gatherer = asyncio.gather(child1, child2) await gatherer proof += 100 @@ -3482,7 +3474,7 @@ async def inner(f): b = self.one_loop.create_future() async def outer(): - await asyncio.gather(inner(a), inner(b), loop=self.one_loop) + await asyncio.gather(inner(a), inner(b)) f = asyncio.ensure_future(outer(), loop=self.one_loop) test_utils.run_briefly(self.one_loop) @@ -3621,11 +3613,6 @@ async def coro(): self.loop.run_until_complete(coro()) self.assertEqual(result, 11) - def test_loop_argument_is_deprecated(self): - # Remove test when loop argument is removed in Python 3.10 - with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(asyncio.sleep(0.01, loop=self.loop)) - class WaitTests(test_utils.TestCase): def setUp(self): @@ -3638,18 +3625,6 @@ def tearDown(self): self.loop = None super().tearDown() - def test_loop_argument_is_deprecated_in_wait(self): - # Remove test when loop argument is removed in Python 3.10 - with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete( - asyncio.wait([coroutine_function()], loop=self.loop)) - - def test_loop_argument_is_deprecated_in_wait_for(self): - # Remove test when loop argument is removed in Python 3.10 - with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete( - asyncio.wait_for(coroutine_function(), 0.01, loop=self.loop)) - def test_coro_is_deprecated_in_wait(self): # Remove test when passing coros to asyncio.wait() is removed in 3.11 with self.assertWarns(DeprecationWarning): @@ -3701,7 +3676,7 @@ def coro2(): return 'ok2' async def inner(): - return await asyncio.gather(coro1(), coro2(), loop=self.loop) + return await asyncio.gather(coro1(), coro2()) result = self.loop.run_until_complete(inner()) self.assertEqual(['ok1', 'ok2'], result) diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 34da7390e1b169..67180f7eb3955a 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -541,17 +541,10 @@ def new_test_loop(self, gen=None): self.set_event_loop(loop) return loop - def unpatch_get_running_loop(self): - events._get_running_loop = self._get_running_loop - def setUp(self): - self._get_running_loop = events._get_running_loop - events._get_running_loop = lambda: None self._thread_cleanup = threading_helper.threading_setup() def tearDown(self): - self.unpatch_get_running_loop() - events.set_event_loop(None) # Detect CPython bug #23353: ensure that yield/yield-from is not used diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 06c6bc2e99dc02..3bd904d1774bc3 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -69,7 +69,7 @@ def capture_server(evt, buf, serv): try: serv.listen() conn, addr = serv.accept() - except socket.timeout: + except TimeoutError: pass else: n = 200 diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index edb4ec092e3586..8c9573731ae2ed 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -6,6 +6,7 @@ import collections import decimal import fractions +import gc import io import locale import os @@ -1756,6 +1757,18 @@ def __next__(self): l8 = self.iter_error(zip(Iter(3), "AB", strict=True), ValueError) self.assertEqual(l8, [(2, "A"), (1, "B")]) + @support.cpython_only + def test_zip_result_gc(self): + # bpo-42536: zip's tuple-reuse speed trick breaks the GC's assumptions + # about what can be untracked. Make sure we re-track result tuples + # whenever we reuse them. + it = zip([[]]) + gc.collect() + # That GC collection probably untracked the recycled internal result + # tuple, which is initialized to (None,). Make sure it's re-tracked when + # it's mutated and returned from __next__: + self.assertTrue(gc.is_tracked(next(it))) + def test_format(self): # Test the basic machinery of the format() builtin. Don't test # the specifics of the various formatters diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index 80b9aec7c2f5bc..4aa9691a4829d1 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -795,17 +795,29 @@ class ClinicExternalTest(TestCase): maxDiff = None def test_external(self): + # bpo-42398: Test that the destination file is left unchanged if the + # content does not change. Moreover, check also that the file + # modification time does not change in this case. source = support.findfile('clinic.test') with open(source, 'r', encoding='utf-8') as f: - original = f.read() - with os_helper.temp_dir() as testdir: - testfile = os.path.join(testdir, 'clinic.test.c') + orig_contents = f.read() + + with os_helper.temp_dir() as tmp_dir: + testfile = os.path.join(tmp_dir, 'clinic.test.c') with open(testfile, 'w', encoding='utf-8') as f: - f.write(original) - clinic.parse_file(testfile, force=True) + f.write(orig_contents) + old_mtime_ns = os.stat(testfile).st_mtime_ns + + clinic.parse_file(testfile) + with open(testfile, 'r', encoding='utf-8') as f: - result = f.read() - self.assertEqual(result, original) + new_contents = f.read() + new_mtime_ns = os.stat(testfile).st_mtime_ns + + self.assertEqual(new_contents, orig_contents) + # Don't change the file modification time + # if the content does not change + self.assertEqual(new_mtime_ns, old_mtime_ns) if __name__ == "__main__": diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 807fbb9f3c0efd..88102379319b90 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -196,6 +196,22 @@ def test_order_preservation(self): ('e', 55), ('f', 666), ('g', 777), ('h', 88888), ('i', 9999), ('j', 0)]) + def test_iter_not_calling_getitem_on_maps(self): + class DictWithGetItem(UserDict): + def __init__(self, *args, **kwds): + self.called = False + UserDict.__init__(self, *args, **kwds) + def __getitem__(self, item): + self.called = True + UserDict.__getitem__(self, item) + + d = DictWithGetItem(a=1) + c = ChainMap(d) + d.called = False + + set(c) # iterate over chain map + self.assertFalse(d.called, '__getitem__ was called') + def test_dict_coercion(self): d = ChainMap(dict(a=1, b=2), dict(b=20, c=30)) self.assertEqual(dict(d), dict(a=1, b=2, c=30)) @@ -1563,6 +1579,62 @@ def assertSameSet(self, s1, s2): # coerce both to a real set then check equality self.assertSetEqual(set(s1), set(s2)) + def test_Set_from_iterable(self): + """Verify _from_iterable overriden to an instance method works.""" + class SetUsingInstanceFromIterable(MutableSet): + def __init__(self, values, created_by): + if not created_by: + raise ValueError(f'created_by must be specified') + self.created_by = created_by + self._values = set(values) + + def _from_iterable(self, values): + return type(self)(values, 'from_iterable') + + def __contains__(self, value): + return value in self._values + + def __iter__(self): + yield from self._values + + def __len__(self): + return len(self._values) + + def add(self, value): + self._values.add(value) + + def discard(self, value): + self._values.discard(value) + + impl = SetUsingInstanceFromIterable([1, 2, 3], 'test') + + actual = impl - {1} + self.assertIsInstance(actual, SetUsingInstanceFromIterable) + self.assertEqual('from_iterable', actual.created_by) + self.assertEqual({2, 3}, actual) + + actual = impl | {4} + self.assertIsInstance(actual, SetUsingInstanceFromIterable) + self.assertEqual('from_iterable', actual.created_by) + self.assertEqual({1, 2, 3, 4}, actual) + + actual = impl & {2} + self.assertIsInstance(actual, SetUsingInstanceFromIterable) + self.assertEqual('from_iterable', actual.created_by) + self.assertEqual({2}, actual) + + actual = impl ^ {3, 4} + self.assertIsInstance(actual, SetUsingInstanceFromIterable) + self.assertEqual('from_iterable', actual.created_by) + self.assertEqual({1, 2, 4}, actual) + + # NOTE: ixor'ing with a list is important here: internally, __ixor__ + # only calls _from_iterable if the other value isn't already a Set. + impl ^= [3, 4] + self.assertIsInstance(impl, SetUsingInstanceFromIterable) + self.assertEqual('test', impl.created_by) + self.assertEqual({1, 2, 4}, impl) + def test_Set_interoperability_with_real_sets(self): # Issue: 8743 class ListSet(Set): diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 0e06d118a047d5..0d11ce940f81ae 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -156,7 +156,7 @@ def test_leading_newlines(self): s256 = "".join(["\n"] * 256 + ["spam"]) co = compile(s256, 'fn', 'exec') self.assertEqual(co.co_firstlineno, 1) - self.assertEqual(list(co.co_lines()), [(0, 4, 257), (4, 8, None)]) + self.assertEqual(list(co.co_lines()), [(0, 8, 257)]) def test_literals_with_leading_zeroes(self): for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", @@ -752,6 +752,81 @@ def continue_in_while(): self.assertEqual(None, opcodes[0].argval) self.assertEqual('RETURN_VALUE', opcodes[1].opname) + def test_consts_in_conditionals(self): + def and_true(x): + return True and x + + def and_false(x): + return False and x + + def or_true(x): + return True or x + + def or_false(x): + return False or x + + funcs = [and_true, and_false, or_true, or_false] + + # Check that condition is removed. + for func in funcs: + with self.subTest(func=func): + opcodes = list(dis.get_instructions(func)) + self.assertEqual(2, len(opcodes)) + self.assertIn('LOAD_', opcodes[0].opname) + self.assertEqual('RETURN_VALUE', opcodes[1].opname) + + def test_lineno_after_implicit_return(self): + TRUE = True + # Don't use constant True or False, as compiler will remove test + def if1(x): + x() + if TRUE: + pass + def if2(x): + x() + if TRUE: + pass + else: + pass + def if3(x): + x() + if TRUE: + pass + else: + return None + def if4(x): + x() + if not TRUE: + pass + funcs = [ if1, if2, if3, if4] + lastlines = [ 3, 3, 3, 2] + frame = None + def save_caller_frame(): + nonlocal frame + frame = sys._getframe(1) + for func, lastline in zip(funcs, lastlines, strict=True): + with self.subTest(func=func): + func(save_caller_frame) + self.assertEqual(frame.f_lineno-frame.f_code.co_firstlineno, lastline) + + def test_lineno_after_no_code(self): + def no_code1(): + "doc string" + + def no_code2(): + a: int + + for func in (no_code1, no_code2): + with self.subTest(func=func): + code = func.__code__ + lines = list(code.co_lines()) + self.assertEqual(len(lines), 1) + start, end, line = lines[0] + self.assertEqual(start, 0) + self.assertEqual(end, len(code.co_code)) + self.assertEqual(line, code.co_firstlineno) + + def test_big_dict_literal(self): # The compiler has a flushing point in "compiler_dict" that calls compiles # a portion of the dictionary literal when the loop that iterates over the items diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 9ff8b7d501aad6..4b31cdc79415ff 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1452,6 +1452,25 @@ def items(self): d = CustomReversedDict(pairs) self.assertEqual(pairs[::-1], list(dict(d).items())) + @support.cpython_only + def test_dict_items_result_gc(self): + # bpo-42536: dict.items's tuple-reuse speed trick breaks the GC's + # assumptions about what can be untracked. Make sure we re-track result + # tuples whenever we reuse them. + it = iter({None: []}.items()) + gc.collect() + # That GC collection probably untracked the recycled internal result + # tuple, which is initialized to (None, None). Make sure it's re-tracked + # when it's mutated and returned from __next__: + self.assertTrue(gc.is_tracked(next(it))) + + @support.cpython_only + def test_dict_items_result_gc(self): + # Same as test_dict_items_result_gc above, but reversed. + it = reversed({None: []}.items()) + gc.collect() + self.assertTrue(gc.is_tracked(next(it))) + class CAPITest(unittest.TestCase): diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index bbaddd57d29189..56d877151838f0 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -131,12 +131,14 @@ def bug708901(): 12 STORE_FAST 0 (res) %3d 14 JUMP_ABSOLUTE 10 - >> 16 LOAD_CONST 0 (None) + +%3d >> 16 LOAD_CONST 0 (None) 18 RETURN_VALUE """ % (bug708901.__code__.co_firstlineno + 1, bug708901.__code__.co_firstlineno + 2, bug708901.__code__.co_firstlineno + 1, - bug708901.__code__.co_firstlineno + 3) + bug708901.__code__.co_firstlineno + 3, + bug708901.__code__.co_firstlineno + 1) def bug1333982(x=[]): @@ -145,30 +147,38 @@ def bug1333982(x=[]): pass dis_bug1333982 = """\ -%3d 0 LOAD_CONST 1 (0) - 2 POP_JUMP_IF_TRUE 26 - 4 LOAD_ASSERTION_ERROR - 6 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) - 8 LOAD_CONST 3 ('bug1333982..') - 10 MAKE_FUNCTION 0 - 12 LOAD_FAST 0 (x) - 14 GET_ITER - 16 CALL_FUNCTION 1 - -%3d 18 LOAD_CONST 4 (1) - -%3d 20 BINARY_ADD - 22 CALL_FUNCTION 1 - 24 RAISE_VARARGS 1 - -%3d >> 26 LOAD_CONST 0 (None) - 28 RETURN_VALUE +%3d 0 LOAD_ASSERTION_ERROR + 2 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) + 4 LOAD_CONST 3 ('bug1333982..') + 6 MAKE_FUNCTION 0 + 8 LOAD_FAST 0 (x) + 10 GET_ITER + 12 CALL_FUNCTION 1 + +%3d 14 LOAD_CONST 4 (1) + +%3d 16 BINARY_ADD + 18 CALL_FUNCTION 1 + 20 RAISE_VARARGS 1 """ % (bug1333982.__code__.co_firstlineno + 1, __file__, bug1333982.__code__.co_firstlineno + 1, bug1333982.__code__.co_firstlineno + 2, - bug1333982.__code__.co_firstlineno + 1, - bug1333982.__code__.co_firstlineno + 3) + bug1333982.__code__.co_firstlineno + 1) + + +def bug42562(): + pass + + +# Set line number for 'pass' to None +bug42562.__code__ = bug42562.__code__.replace(co_linetable=b'\x04\x80\xff\x80') + + +dis_bug42562 = """\ + 0 LOAD_CONST 0 (None) + 2 RETURN_VALUE +""" _BIG_LINENO_FORMAT = """\ %3d 0 LOAD_GLOBAL 0 (spam) @@ -264,50 +274,52 @@ def bug1333982(x=[]): 8 INPLACE_ADD 10 STORE_NAME 0 (x) 12 JUMP_ABSOLUTE 4 - 14 LOAD_CONST 2 (None) - 16 RETURN_VALUE """ dis_traceback = """\ -%3d 0 SETUP_FINALLY 12 (to 14) +%3d 0 SETUP_FINALLY 14 (to 16) %3d 2 LOAD_CONST 1 (1) 4 LOAD_CONST 2 (0) --> 6 BINARY_TRUE_DIVIDE 8 POP_TOP 10 POP_BLOCK - 12 JUMP_FORWARD 42 (to 56) - -%3d >> 14 DUP_TOP - 16 LOAD_GLOBAL 0 (Exception) - 18 JUMP_IF_NOT_EXC_MATCH 54 - 20 POP_TOP - 22 STORE_FAST 0 (e) - 24 POP_TOP - 26 SETUP_FINALLY 18 (to 46) - -%3d 28 LOAD_FAST 0 (e) - 30 LOAD_ATTR 1 (__traceback__) - 32 STORE_FAST 1 (tb) - 34 POP_BLOCK - 36 POP_EXCEPT - 38 LOAD_CONST 0 (None) - 40 STORE_FAST 0 (e) - 42 DELETE_FAST 0 (e) - 44 JUMP_FORWARD 10 (to 56) - >> 46 LOAD_CONST 0 (None) - 48 STORE_FAST 0 (e) - 50 DELETE_FAST 0 (e) - 52 RERAISE - >> 54 RERAISE - -%3d >> 56 LOAD_FAST 1 (tb) - 58 RETURN_VALUE + +%3d 12 LOAD_FAST 1 (tb) + 14 RETURN_VALUE + +%3d >> 16 DUP_TOP + 18 LOAD_GLOBAL 0 (Exception) + 20 JUMP_IF_NOT_EXC_MATCH 58 + 22 POP_TOP + 24 STORE_FAST 0 (e) + 26 POP_TOP + 28 SETUP_FINALLY 20 (to 50) + +%3d 30 LOAD_FAST 0 (e) + 32 LOAD_ATTR 1 (__traceback__) + 34 STORE_FAST 1 (tb) + 36 POP_BLOCK + 38 POP_EXCEPT + 40 LOAD_CONST 0 (None) + 42 STORE_FAST 0 (e) + 44 DELETE_FAST 0 (e) + +%3d 46 LOAD_FAST 1 (tb) + 48 RETURN_VALUE + >> 50 LOAD_CONST 0 (None) + 52 STORE_FAST 0 (e) + 54 DELETE_FAST 0 (e) + 56 RERAISE + +%3d >> 58 RERAISE """ % (TRACEBACK_CODE.co_firstlineno + 1, TRACEBACK_CODE.co_firstlineno + 2, + TRACEBACK_CODE.co_firstlineno + 5, TRACEBACK_CODE.co_firstlineno + 3, TRACEBACK_CODE.co_firstlineno + 4, - TRACEBACK_CODE.co_firstlineno + 5) + TRACEBACK_CODE.co_firstlineno + 5, + TRACEBACK_CODE.co_firstlineno + 3) def _fstring(a, b, c, d): return f'{a} {b:4} {c!r} {d!r:4}' @@ -522,6 +534,9 @@ def test_bug_1333982(self): self.do_disassembly_test(bug1333982, dis_bug1333982) + def test_bug_42562(self): + self.do_disassembly_test(bug42562, dis_bug42562) + def test_big_linenos(self): def func(count): namespace = {} @@ -674,8 +689,15 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs): return output.getvalue() +if sys.flags.optimize: + code_info_consts = "0: None" +else: + code_info_consts = ( + """0: 'Formatted details of methods, functions, or code.' + 1: None""" +) -code_info_code_info = """\ +code_info_code_info = f"""\ Name: code_info Filename: (.*) Argument count: 1 @@ -685,13 +707,13 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs): Stack size: 3 Flags: OPTIMIZED, NEWLOCALS, NOFREE Constants: - 0: %r + {code_info_consts} Names: 0: _format_code_info 1: _get_code_object Variable names: - 0: x""" % (('Formatted details of methods, functions, or code.',) - if sys.flags.optimize < 2 else (None,)) + 0: x""" + @staticmethod def tricky(a, b, /, x, y, z=True, *args, c, d, e=[], **kwds): @@ -992,7 +1014,7 @@ def jumpy(): Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=2, starts_line=None, is_jump_target=False), Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=4, starts_line=None, is_jump_target=False), Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=6, starts_line=None, is_jump_target=False), - Instruction(opname='FOR_ITER', opcode=93, arg=34, argval=44, argrepr='to 44', offset=8, starts_line=None, is_jump_target=True), + Instruction(opname='FOR_ITER', opcode=93, arg=32, argval=42, argrepr='to 42', offset=8, starts_line=None, is_jump_target=True), Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=10, starts_line=None, is_jump_target=False), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=12, starts_line=4, is_jump_target=False), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=14, starts_line=None, is_jump_target=False), @@ -1008,93 +1030,90 @@ def jumpy(): Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=34, starts_line=None, is_jump_target=False), Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=8, argval=8, argrepr='', offset=36, starts_line=None, is_jump_target=False), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=38, starts_line=8, is_jump_target=False), - Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=40, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=8, argval=8, argrepr='', offset=42, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=44, starts_line=10, is_jump_target=True), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=46, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=48, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=50, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=52, starts_line=11, is_jump_target=True), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=94, argval=94, argrepr='', offset=54, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=56, starts_line=12, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=58, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=60, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=62, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=64, starts_line=13, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=66, starts_line=None, is_jump_target=False), - Instruction(opname='INPLACE_SUBTRACT', opcode=56, arg=None, argval=None, argrepr='', offset=68, starts_line=None, is_jump_target=False), - Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=70, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=72, starts_line=14, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=74, starts_line=None, is_jump_target=False), - Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=76, starts_line=None, is_jump_target=False), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=82, argval=82, argrepr='', offset=78, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=80, starts_line=15, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=82, starts_line=16, is_jump_target=True), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=84, starts_line=None, is_jump_target=False), - Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=86, starts_line=None, is_jump_target=False), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=52, argval=52, argrepr='', offset=88, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=102, argval=102, argrepr='', offset=90, starts_line=17, is_jump_target=False), - Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=92, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=94, starts_line=19, is_jump_target=True), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=96, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=98, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=100, starts_line=None, is_jump_target=False), - Instruction(opname='SETUP_FINALLY', opcode=122, arg=96, argval=200, argrepr='to 200', offset=102, starts_line=20, is_jump_target=True), - Instruction(opname='SETUP_FINALLY', opcode=122, arg=12, argval=118, argrepr='to 118', offset=104, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=106, starts_line=21, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=108, starts_line=None, is_jump_target=False), - Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, argrepr='', offset=110, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=112, starts_line=None, is_jump_target=False), - Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=26, argval=144, argrepr='to 144', offset=116, starts_line=None, is_jump_target=False), - Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=118, starts_line=22, is_jump_target=True), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=120, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_IF_NOT_EXC_MATCH', opcode=121, arg=142, argval=142, argrepr='', offset=122, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=50, argval=50, argrepr='', offset=40, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=42, starts_line=10, is_jump_target=True), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=44, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=46, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=48, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=50, starts_line=11, is_jump_target=True), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=90, argval=90, argrepr='', offset=52, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=54, starts_line=12, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=56, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=58, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=62, starts_line=13, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=64, starts_line=None, is_jump_target=False), + Instruction(opname='INPLACE_SUBTRACT', opcode=56, arg=None, argval=None, argrepr='', offset=66, starts_line=None, is_jump_target=False), + Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=68, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=70, starts_line=14, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=72, starts_line=None, is_jump_target=False), + Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=74, starts_line=None, is_jump_target=False), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=80, argval=80, argrepr='', offset=76, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=50, argval=50, argrepr='', offset=78, starts_line=15, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=80, starts_line=16, is_jump_target=True), + Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=82, starts_line=None, is_jump_target=False), + Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=84, starts_line=None, is_jump_target=False), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=50, argval=50, argrepr='', offset=86, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=98, argval=98, argrepr='', offset=88, starts_line=17, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=90, starts_line=19, is_jump_target=True), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=92, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=94, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=96, starts_line=None, is_jump_target=False), + Instruction(opname='SETUP_FINALLY', opcode=122, arg=98, argval=198, argrepr='to 198', offset=98, starts_line=20, is_jump_target=True), + Instruction(opname='SETUP_FINALLY', opcode=122, arg=12, argval=114, argrepr='to 114', offset=100, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=102, starts_line=21, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=104, starts_line=None, is_jump_target=False), + Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, argrepr='', offset=106, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=108, starts_line=None, is_jump_target=False), + Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=110, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=26, argval=140, argrepr='to 140', offset=112, starts_line=None, is_jump_target=False), + Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=114, starts_line=22, is_jump_target=True), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=116, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_IF_NOT_EXC_MATCH', opcode=121, arg=138, argval=138, argrepr='', offset=118, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=120, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=122, starts_line=None, is_jump_target=False), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=124, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=126, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=128, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=130, starts_line=23, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=132, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=134, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=136, starts_line=None, is_jump_target=False), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=46, argval=188, argrepr='to 188', offset=140, starts_line=None, is_jump_target=False), - Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=142, starts_line=None, is_jump_target=True), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=144, starts_line=25, is_jump_target=True), - Instruction(opname='SETUP_WITH', opcode=143, arg=24, argval=172, argrepr='to 172', offset=146, starts_line=None, is_jump_target=False), - Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=148, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=150, starts_line=26, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=152, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=154, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=156, starts_line=None, is_jump_target=False), - Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=160, starts_line=None, is_jump_target=False), - Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=162, starts_line=None, is_jump_target=False), - Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=3, argval=3, argrepr='', offset=166, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=168, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=188, argrepr='to 188', offset=170, starts_line=None, is_jump_target=False), - Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=172, starts_line=None, is_jump_target=True), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=178, argval=178, argrepr='', offset=174, starts_line=None, is_jump_target=False), - Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=176, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=178, starts_line=None, is_jump_target=True), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=180, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=126, starts_line=23, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=128, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=130, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=132, starts_line=None, is_jump_target=False), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=134, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=46, argval=184, argrepr='to 184', offset=136, starts_line=None, is_jump_target=False), + Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=True), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=140, starts_line=25, is_jump_target=True), + Instruction(opname='SETUP_WITH', opcode=143, arg=24, argval=168, argrepr='to 168', offset=142, starts_line=None, is_jump_target=False), + Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=144, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=146, starts_line=26, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=148, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=150, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=152, starts_line=None, is_jump_target=False), + Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=154, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=156, starts_line=None, is_jump_target=False), + Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False), + Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=160, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=3, argval=3, argrepr='', offset=162, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=184, argrepr='to 184', offset=166, starts_line=None, is_jump_target=False), + Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=168, starts_line=None, is_jump_target=True), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=174, argval=174, argrepr='', offset=170, starts_line=None, is_jump_target=False), + Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=172, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=174, starts_line=None, is_jump_target=True), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=176, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=178, starts_line=None, is_jump_target=False), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=180, starts_line=None, is_jump_target=False), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=184, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=186, starts_line=None, is_jump_target=False), - Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=188, starts_line=None, is_jump_target=True), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=190, starts_line=28, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=192, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=194, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=196, starts_line=None, is_jump_target=False), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=10, argval=210, argrepr='to 210', offset=198, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=200, starts_line=None, is_jump_target=True), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=202, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=204, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=206, starts_line=None, is_jump_target=False), - Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=208, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=210, starts_line=None, is_jump_target=True), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=212, starts_line=None, is_jump_target=False), + Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=184, starts_line=None, is_jump_target=True), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=186, starts_line=28, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=188, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=190, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=192, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=194, starts_line=None, is_jump_target=False), + Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=196, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=198, starts_line=None, is_jump_target=True), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=200, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=202, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=204, starts_line=None, is_jump_target=False), + Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=206, starts_line=None, is_jump_target=False), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index bff20f9cac9c98..6a5013f5b8afc3 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -3039,10 +3039,11 @@ def test_CLI(): r""" ... '-m', 'doctest', 'nosuchfile') >>> rc, out (1, b'') + >>> # The exact error message changes depending on the platform. >>> print(normalize(err)) # doctest: +ELLIPSIS Traceback (most recent call last): ... - FileNotFoundError: [Errno ...] No such file or directory: 'nosuchfile' + FileNotFoundError: [Errno ...] ...nosuchfile... Invalid doctest option: diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 3431040f98a726..ab4b52f7852730 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -429,7 +429,7 @@ def red(self): def test_reserved__sunder_(self): with self.assertRaisesRegex( ValueError, - '_sunder_ names, such as "_bad_", are reserved', + "_sunder_ names, such as '_bad_', are reserved", ): class Bad(Enum): _bad_ = 1 @@ -585,12 +585,15 @@ def hello(self): class Test1Enum(MyMethodEnum, int, MyStrEnum): One = 1 Two = 2 + self.assertTrue(Test1Enum._member_type_ is int) self.assertEqual(str(Test1Enum.One), 'MyStr') + self.assertEqual(format(Test1Enum.One, ''), 'MyStr') # class Test2Enum(MyStrEnum, MyMethodEnum): One = 1 Two = 2 self.assertEqual(str(Test2Enum.One), 'MyStr') + self.assertEqual(format(Test1Enum.One, ''), 'MyStr') def test_inherited_data_type(self): class HexInt(int): @@ -2021,6 +2024,32 @@ class Decision2(MyEnum): REVERT_ALL = "REVERT_ALL" RETRY = "RETRY" + def test_multiple_mixin_inherited(self): + class MyInt(int): + def __new__(cls, value): + return super().__new__(cls, value) + + class HexMixin: + def __repr__(self): + return hex(self) + + class MyIntEnum(HexMixin, MyInt, enum.Enum): + pass + + class Foo(MyIntEnum): + TEST = 1 + self.assertTrue(isinstance(Foo.TEST, MyInt)) + self.assertEqual(repr(Foo.TEST), "0x1") + + class Fee(MyIntEnum): + TEST = 1 + def __new__(cls, value): + value += 1 + member = int.__new__(cls, value) + member._value_ = value + return member + self.assertEqual(Fee.TEST, 2) + def test_empty_globals(self): # bpo-35717: sys._getframe(2).f_globals['__name__'] fails with KeyError # when using compile and exec because f_globals is empty @@ -2225,6 +2254,11 @@ def test_repr(self): self.assertEqual(repr(~(Open.RO | Open.CE)), '') self.assertEqual(repr(~(Open.WO | Open.CE)), '') + def test_format(self): + Perm = self.Perm + self.assertEqual(format(Perm.R, ''), 'Perm.R') + self.assertEqual(format(Perm.R | Perm.X, ''), 'Perm.R|X') + def test_or(self): Perm = self.Perm for i in Perm: @@ -2564,6 +2598,7 @@ class Color(IntFlag): def test_type(self): Perm = self.Perm + self.assertTrue(Perm._member_type_ is int) Open = self.Open for f in Perm: self.assertTrue(isinstance(f, Perm)) @@ -2643,6 +2678,11 @@ def test_repr(self): self.assertEqual(repr(~(Open.WO | Open.CE)), '') self.assertEqual(repr(Open(~4)), '') + def test_format(self): + Perm = self.Perm + self.assertEqual(format(Perm.R, ''), '4') + self.assertEqual(format(Perm.R | Perm.X, ''), '5') + def test_or(self): Perm = self.Perm for i in Perm: diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index 5785cb46492ef7..906bfc21a26aed 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -2,6 +2,7 @@ import operator import sys import pickle +import gc from test import support @@ -134,6 +135,18 @@ def test_tuple_reuse(self): self.assertEqual(len(set(map(id, list(enumerate(self.seq))))), len(self.seq)) self.assertEqual(len(set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) + @support.cpython_only + def test_enumerate_result_gc(self): + # bpo-42536: enumerate's tuple-reuse speed trick breaks the GC's + # assumptions about what can be untracked. Make sure we re-track result + # tuples whenever we reuse them. + it = self.enum([[]]) + gc.collect() + # That GC collection probably untracked the recycled internal result + # tuple, which is initialized to (None, None). Make sure it's re-tracked + # when it's mutated and returned from __next__: + self.assertTrue(gc.is_tracked(next(it))) + class MyEnum(enumerate): pass diff --git a/Lib/test/test_exception_hierarchy.py b/Lib/test/test_exception_hierarchy.py index 43b4af84039c0c..89fe9ddcefba3e 100644 --- a/Lib/test/test_exception_hierarchy.py +++ b/Lib/test/test_exception_hierarchy.py @@ -40,10 +40,10 @@ def test_builtin_errors(self): self.assertIs(EnvironmentError, OSError) def test_socket_errors(self): - self.assertIs(socket.error, IOError) + self.assertIs(socket.error, OSError) self.assertIs(socket.gaierror.__base__, OSError) self.assertIs(socket.herror.__base__, OSError) - self.assertIs(socket.timeout.__base__, OSError) + self.assertIs(socket.timeout, TimeoutError) def test_select_error(self): self.assertIs(select.error, OSError) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 4dbf5fe5d5bc3a..1bdd3f2ce59934 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1046,7 +1046,7 @@ def gen(): # tstate->recursion_depth is equal to (recursion_limit - 1) # and is equal to recursion_limit when _gen_throw() calls # PyErr_NormalizeException(). - recurse(setrecursionlimit(depth + 2) - depth - 1) + recurse(setrecursionlimit(depth + 2) - depth) finally: sys.setrecursionlimit(recursionlimit) print('Done.') @@ -1076,6 +1076,54 @@ def test_recursion_normalizing_infinite_exception(self): b'while normalizing an exception', err) self.assertIn(b'Done.', out) + + def test_recursion_in_except_handler(self): + + def set_relative_recursion_limit(n): + depth = 1 + while True: + try: + sys.setrecursionlimit(depth) + except RecursionError: + depth += 1 + else: + break + sys.setrecursionlimit(depth+n) + + def recurse_in_except(): + try: + 1/0 + except: + recurse_in_except() + + def recurse_after_except(): + try: + 1/0 + except: + pass + recurse_after_except() + + def recurse_in_body_and_except(): + try: + recurse_in_body_and_except() + except: + recurse_in_body_and_except() + + recursionlimit = sys.getrecursionlimit() + try: + set_relative_recursion_limit(10) + for func in (recurse_in_except, recurse_after_except, recurse_in_body_and_except): + with self.subTest(func=func): + try: + func() + except RecursionError: + pass + else: + self.fail("Should have raised a RecursionError") + finally: + sys.setrecursionlimit(recursionlimit) + + @cpython_only def test_recursion_normalizing_with_no_memory(self): # Issue #30697. Test that in the abort that occurs when there is no @@ -1112,7 +1160,7 @@ def raiseMemError(): except MemoryError as e: tb = e.__traceback__ else: - self.fail("Should have raises a MemoryError") + self.fail("Should have raised a MemoryError") return traceback.format_tb(tb) tb1 = raiseMemError() diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py index ca9b4f354a5c0c..fa4f67b6eb5f92 100644 --- a/Lib/test/test_filecmp.py +++ b/Lib/test/test_filecmp.py @@ -66,6 +66,8 @@ def setUp(self): for dir in (self.dir, self.dir_same, self.dir_diff, self.dir_ignored): shutil.rmtree(dir, True) os.mkdir(dir) + subdir_path = os.path.join(dir, 'subdir') + os.mkdir(subdir_path) if self.caseinsensitive and dir is self.dir_same: fn = 'FiLe' # Verify case-insensitive comparison else: @@ -110,6 +112,11 @@ def test_cmpfiles(self): "Comparing mismatched directories fails") + def _assert_lists(self, actual, expected): + """Assert that two lists are equal, up to ordering.""" + self.assertEqual(sorted(actual), sorted(expected)) + + def test_dircmp(self): # Check attributes for comparison of two identical directories left_dir, right_dir = self.dir, self.dir_same @@ -117,10 +124,13 @@ def test_dircmp(self): self.assertEqual(d.left, left_dir) self.assertEqual(d.right, right_dir) if self.caseinsensitive: - self.assertEqual([d.left_list, d.right_list],[['file'], ['FiLe']]) + self._assert_lists(d.left_list, ['file', 'subdir']) + self._assert_lists(d.right_list, ['FiLe', 'subdir']) else: - self.assertEqual([d.left_list, d.right_list],[['file'], ['file']]) - self.assertEqual(d.common, ['file']) + self._assert_lists(d.left_list, ['file', 'subdir']) + self._assert_lists(d.right_list, ['file', 'subdir']) + self._assert_lists(d.common, ['file', 'subdir']) + self._assert_lists(d.common_dirs, ['subdir']) self.assertEqual(d.left_only, []) self.assertEqual(d.right_only, []) self.assertEqual(d.same_files, ['file']) @@ -128,6 +138,7 @@ def test_dircmp(self): expected_report = [ "diff {} {}".format(self.dir, self.dir_same), "Identical files : ['file']", + "Common subdirectories : ['subdir']", ] self._assert_report(d.report, expected_report) @@ -136,9 +147,10 @@ def test_dircmp(self): d = filecmp.dircmp(left_dir, right_dir) self.assertEqual(d.left, left_dir) self.assertEqual(d.right, right_dir) - self.assertEqual(d.left_list, ['file']) - self.assertEqual(d.right_list, ['file', 'file2']) - self.assertEqual(d.common, ['file']) + self._assert_lists(d.left_list, ['file', 'subdir']) + self._assert_lists(d.right_list, ['file', 'file2', 'subdir']) + self._assert_lists(d.common, ['file', 'subdir']) + self._assert_lists(d.common_dirs, ['subdir']) self.assertEqual(d.left_only, []) self.assertEqual(d.right_only, ['file2']) self.assertEqual(d.same_files, ['file']) @@ -147,6 +159,7 @@ def test_dircmp(self): "diff {} {}".format(self.dir, self.dir_diff), "Only in {} : ['file2']".format(self.dir_diff), "Identical files : ['file']", + "Common subdirectories : ['subdir']", ] self._assert_report(d.report, expected_report) @@ -159,9 +172,9 @@ def test_dircmp(self): d = filecmp.dircmp(left_dir, right_dir) self.assertEqual(d.left, left_dir) self.assertEqual(d.right, right_dir) - self.assertEqual(d.left_list, ['file', 'file2']) - self.assertEqual(d.right_list, ['file']) - self.assertEqual(d.common, ['file']) + self._assert_lists(d.left_list, ['file', 'file2', 'subdir']) + self._assert_lists(d.right_list, ['file', 'subdir']) + self._assert_lists(d.common, ['file', 'subdir']) self.assertEqual(d.left_only, ['file2']) self.assertEqual(d.right_only, []) self.assertEqual(d.same_files, ['file']) @@ -170,6 +183,7 @@ def test_dircmp(self): "diff {} {}".format(self.dir, self.dir_diff), "Only in {} : ['file2']".format(self.dir), "Identical files : ['file']", + "Common subdirectories : ['subdir']", ] self._assert_report(d.report, expected_report) @@ -183,24 +197,45 @@ def test_dircmp(self): "diff {} {}".format(self.dir, self.dir_diff), "Identical files : ['file']", "Differing files : ['file2']", + "Common subdirectories : ['subdir']", ] self._assert_report(d.report, expected_report) + def test_dircmp_subdirs_type(self): + """Check that dircmp.subdirs respects subclassing.""" + class MyDirCmp(filecmp.dircmp): + pass + d = MyDirCmp(self.dir, self.dir_diff) + sub_dirs = d.subdirs + self.assertEqual(list(sub_dirs.keys()), ['subdir']) + sub_dcmp = sub_dirs['subdir'] + self.assertEqual(type(sub_dcmp), MyDirCmp) + def test_report_partial_closure(self): left_dir, right_dir = self.dir, self.dir_same d = filecmp.dircmp(left_dir, right_dir) + left_subdir = os.path.join(left_dir, 'subdir') + right_subdir = os.path.join(right_dir, 'subdir') expected_report = [ "diff {} {}".format(self.dir, self.dir_same), "Identical files : ['file']", + "Common subdirectories : ['subdir']", + '', + "diff {} {}".format(left_subdir, right_subdir), ] self._assert_report(d.report_partial_closure, expected_report) def test_report_full_closure(self): left_dir, right_dir = self.dir, self.dir_same d = filecmp.dircmp(left_dir, right_dir) + left_subdir = os.path.join(left_dir, 'subdir') + right_subdir = os.path.join(right_dir, 'subdir') expected_report = [ "diff {} {}".format(self.dir, self.dir_same), "Identical files : ['file']", + "Common subdirectories : ['subdir']", + '', + "diff {} {}".format(left_subdir, right_subdir), ] self._assert_report(d.report_full_closure, expected_report) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 9653e46ecc52d8..6679bd3d8899cd 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -275,9 +275,9 @@ def test_common_format(self): test_exc_common('% %s', 1, ValueError, "unsupported format character '%' (0x25) at index 2") test_exc_common('%d', '1', TypeError, - "%d format: a number is required, not str") + "%d format: a real number is required, not str") test_exc_common('%d', b'1', TypeError, - "%d format: a number is required, not bytes") + "%d format: a real number is required, not bytes") test_exc_common('%x', '1', TypeError, "%x format: an integer is required, not str") test_exc_common('%x', 3.14, TypeError, diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 39658f22aa18c3..2424911c7ac5e9 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -1036,7 +1036,7 @@ def server(self): self.evt.set() try: conn, addr = self.sock.accept() - except socket.timeout: + except TimeoutError: pass else: conn.sendall(b"1 Hola mundo\n") diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 44cb9a0f07b75d..22c75bae987219 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -51,11 +51,6 @@ def get_gdb_version(): "embedding. Saw %s.%s:\n%s" % (gdb_major_version, gdb_minor_version, gdb_version)) -if (gdb_major_version, gdb_minor_version) >= (9, 2): - # gdb 9.2 on Fedora Rawhide is not reliable, see: - # * https://bugs.python.org/issue41473 - # * https://bugzilla.redhat.com/show_bug.cgi?id=1866884 - raise unittest.SkipTest("https://bugzilla.redhat.com/show_bug.cgi?id=1866884") if not sysconfig.is_python_build(): raise unittest.SkipTest("test_gdb only works on source builds at the moment.") diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py index 2979cfb55083cb..c113e538248e9c 100644 --- a/Lib/test/test_genericalias.py +++ b/Lib/test/test_genericalias.py @@ -47,46 +47,46 @@ class BaseTest(unittest.TestCase): """Test basics.""" + generic_types = [type, tuple, list, dict, set, frozenset, enumerate, + defaultdict, deque, + SequenceMatcher, + dircmp, + FileInput, + OrderedDict, Counter, UserDict, UserList, + Pattern, Match, + partial, partialmethod, cached_property, + AbstractContextManager, AbstractAsyncContextManager, + Awaitable, Coroutine, + AsyncIterable, AsyncIterator, + AsyncGenerator, Generator, + Iterable, Iterator, + Reversible, + Container, Collection, + Callable, + Mailbox, _PartialFile, + ContextVar, Token, + Field, + Set, MutableSet, + Mapping, MutableMapping, MappingView, + KeysView, ItemsView, ValuesView, + Sequence, MutableSequence, + MappingProxyType, AsyncGeneratorType, + DirEntry, + chain, + TemporaryDirectory, SpooledTemporaryFile, + Queue, SimpleQueue, + _AssertRaisesContext, + SplitResult, ParseResult, + ValueProxy, ApplyResult, + WeakSet, ReferenceType, ref, + ShareableList, MPSimpleQueue, + Future, _WorkItem, + Morsel] + if ctypes is not None: + generic_types.extend((ctypes.Array, ctypes.LibraryLoader)) def test_subscriptable(self): - types = [type, tuple, list, dict, set, frozenset, enumerate, - defaultdict, deque, - SequenceMatcher, - dircmp, - FileInput, - OrderedDict, Counter, UserDict, UserList, - Pattern, Match, - partial, partialmethod, cached_property, - AbstractContextManager, AbstractAsyncContextManager, - Awaitable, Coroutine, - AsyncIterable, AsyncIterator, - AsyncGenerator, Generator, - Iterable, Iterator, - Reversible, - Container, Collection, - Callable, - Mailbox, _PartialFile, - ContextVar, Token, - Field, - Set, MutableSet, - Mapping, MutableMapping, MappingView, - KeysView, ItemsView, ValuesView, - Sequence, MutableSequence, - MappingProxyType, AsyncGeneratorType, - DirEntry, - chain, - TemporaryDirectory, SpooledTemporaryFile, - Queue, SimpleQueue, - _AssertRaisesContext, - SplitResult, ParseResult, - ValueProxy, ApplyResult, - WeakSet, ReferenceType, ref, - ShareableList, MPSimpleQueue, - Future, _WorkItem, - Morsel] - if ctypes is not None: - types.extend((ctypes.Array, ctypes.LibraryLoader)) - for t in types: + for t in self.generic_types: if t is None: continue tname = t.__name__ @@ -293,5 +293,20 @@ def test_dir(self): for generic_alias_property in ("__origin__", "__args__", "__parameters__"): self.assertIn(generic_alias_property, dir_of_gen_alias) + def test_weakref(self): + for t in self.generic_types: + if t is None: + continue + tname = t.__name__ + with self.subTest(f"Testing {tname}"): + alias = t[int] + self.assertEqual(ref(alias)(), alias) + + def test_no_kwargs(self): + # bpo-42576 + with self.assertRaises(TypeError): + GenericAlias(bad=float) + + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index 4551011f5ca9ef..f50a4559269d78 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -26,17 +26,26 @@ # Were we compiled --with-pydebug or with #define Py_DEBUG? COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') -c_hashlib = import_fresh_module('hashlib', fresh=['_hashlib']) -py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib']) - +# default builtin hash module +default_builtin_hashes = {'md5', 'sha1', 'sha256', 'sha512', 'sha3', 'blake2'} +# --with-builtin-hashlib-hashes override builtin_hashes = sysconfig.get_config_var("PY_BUILTIN_HASHLIB_HASHES") if builtin_hashes is None: - builtin_hashes = {'md5', 'sha1', 'sha256', 'sha512', 'sha3', 'blake2'} + builtin_hashes = default_builtin_hashes else: builtin_hashes = { m.strip() for m in builtin_hashes.strip('"').lower().split(",") } +# hashlib with and without OpenSSL backend for PBKDF2 +# only import builtin_hashlib when all builtin hashes are available. +# Otherwise import prints noise on stderr +openssl_hashlib = import_fresh_module('hashlib', fresh=['_hashlib']) +if builtin_hashes == default_builtin_hashes: + builtin_hashlib = import_fresh_module('hashlib', blocked=['_hashlib']) +else: + builtin_hashlib = None + try: from _hashlib import HASH, HASHXOF, openssl_md_meth_names except ImportError: @@ -1032,16 +1041,16 @@ def _test_pbkdf2_hmac(self, pbkdf2, supported): iterations=1, dklen=None) self.assertEqual(out, self.pbkdf2_results['sha1'][0][0]) + @unittest.skipIf(builtin_hashlib is None, "test requires builtin_hashlib") def test_pbkdf2_hmac_py(self): - self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac, builtin_hashes) + self._test_pbkdf2_hmac(builtin_hashlib.pbkdf2_hmac, builtin_hashes) - @unittest.skipUnless(hasattr(c_hashlib, 'pbkdf2_hmac'), + @unittest.skipUnless(hasattr(openssl_hashlib, 'pbkdf2_hmac'), ' test requires OpenSSL > 1.0') def test_pbkdf2_hmac_c(self): - self._test_pbkdf2_hmac(c_hashlib.pbkdf2_hmac, openssl_md_meth_names) - + self._test_pbkdf2_hmac(openssl_hashlib.pbkdf2_hmac, openssl_md_meth_names) - @unittest.skipUnless(hasattr(c_hashlib, 'scrypt'), + @unittest.skipUnless(hasattr(hashlib, 'scrypt'), ' test requires OpenSSL > 1.1') def test_scrypt(self): for password, salt, n, r, p, expected in self.scrypt_test_vectors: diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 2859abb21fc9f5..c3d7c8feb1ec0d 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -3,7 +3,7 @@ Written by Cody A.W. Somerville , Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest. """ - +from collections import OrderedDict from http.server import BaseHTTPRequestHandler, HTTPServer, \ SimpleHTTPRequestHandler, CGIHTTPRequestHandler from http import server, HTTPStatus @@ -19,7 +19,7 @@ import email.message import email.utils import html -import http.client +import http, http.client import urllib.parse import tempfile import time @@ -588,6 +588,15 @@ def test_html_escape_filename(self): print(os.environ["%s"]) """ +cgi_file6 = """\ +#!%s +import os + +print("Content-type: text/plain") +print() +print(repr(os.environ)) +""" + @unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "This test can't be run reliably as root (issue #13308).") @@ -666,6 +675,11 @@ def setUp(self): file5.write(cgi_file1 % self.pythonexe) os.chmod(self.file5_path, 0o777) + self.file6_path = os.path.join(self.cgi_dir, 'file6.py') + with open(self.file6_path, 'w', encoding='utf-8') as file6: + file6.write(cgi_file6 % self.pythonexe) + os.chmod(self.file6_path, 0o777) + os.chdir(self.parent_dir) def tearDown(self): @@ -685,6 +699,8 @@ def tearDown(self): os.remove(self.file4_path) if self.file5_path: os.remove(self.file5_path) + if self.file6_path: + os.remove(self.file6_path) os.rmdir(self.cgi_child_dir) os.rmdir(self.cgi_dir) os.rmdir(self.cgi_dir_in_sub_dir) @@ -818,6 +834,23 @@ def test_cgi_path_in_sub_directories(self): finally: CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin') + def test_accept(self): + browser_accept = \ + 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' + tests = ( + ((('Accept', browser_accept),), browser_accept), + ((), ''), + # Hack case to get two values for the one header + ((('Accept', 'text/html'), ('ACCEPT', 'text/plain')), + 'text/html,text/plain'), + ) + for headers, expected in tests: + headers = OrderedDict(headers) + with self.subTest(headers): + res = self.request('/cgi-bin/file6.py', 'GET', headers=headers) + self.assertEqual(http.HTTPStatus.OK, res.status) + expected = f"'HTTP_ACCEPT': {expected!r}" + self.assertIn(expected.encode('ascii'), res.read()) class SocketlessRequestHandler(SimpleHTTPRequestHandler): diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 96bcb09261e9e7..0cab7897a96dcb 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -476,7 +476,7 @@ def handle(self): _, server = self._setup(TimeoutHandler) addr = server.server_address[1] - with self.assertRaises(socket.timeout): + with self.assertRaises(TimeoutError): client = self.imap_class("localhost", addr, timeout=0.001) def test_with_statement(self): diff --git a/Lib/test/test_importlib/builtin/test_loader.py b/Lib/test/test_importlib/builtin/test_loader.py index b1349ec5da4678..f6b6d97cd5bcea 100644 --- a/Lib/test/test_importlib/builtin/test_loader.py +++ b/Lib/test/test_importlib/builtin/test_loader.py @@ -6,6 +6,7 @@ import sys import types import unittest +import warnings @unittest.skipIf(util.BUILTINS.good_name is None, 'no reasonable builtin module') class LoaderTests(abc.LoaderTests): @@ -24,7 +25,9 @@ def verify(self, module): self.assertIn(module.__name__, sys.modules) def load_module(self, name): - return self.machinery.BuiltinImporter.load_module(name) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + return self.machinery.BuiltinImporter.load_module(name) def test_module(self): # Common case. diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py index abd612fcd9bec1..22cf2dac5f8685 100644 --- a/Lib/test/test_importlib/extension/test_loader.py +++ b/Lib/test/test_importlib/extension/test_loader.py @@ -1,3 +1,4 @@ +from warnings import catch_warnings from .. import abc from .. import util @@ -7,6 +8,7 @@ import sys import types import unittest +import warnings import importlib.util import importlib from test.support.script_helper import assert_python_failure @@ -20,14 +22,18 @@ def setUp(self): util.EXTENSIONS.file_path) def load_module(self, fullname): - return self.loader.load_module(fullname) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + return self.loader.load_module(fullname) def test_load_module_API(self): # Test the default argument for load_module(). - self.loader.load_module() - self.loader.load_module(None) - with self.assertRaises(ImportError): - self.load_module('XXX') + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + self.loader.load_module() + self.loader.load_module(None) + with self.assertRaises(ImportError): + self.load_module('XXX') def test_equality(self): other = self.machinery.ExtensionFileLoader(util.EXTENSIONS.name, @@ -94,6 +100,21 @@ def setUp(self): self.loader = self.machinery.ExtensionFileLoader( self.name, self.spec.origin) + def load_module(self): + '''Load the module from the test extension''' + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + return self.loader.load_module(self.name) + + def load_module_by_name(self, fullname): + '''Load a module from the test extension by name''' + origin = self.spec.origin + loader = self.machinery.ExtensionFileLoader(fullname, origin) + spec = importlib.util.spec_from_loader(fullname, loader) + module = importlib.util.module_from_spec(spec) + loader.exec_module(module) + return module + # No extension module as __init__ available for testing. test_package = None @@ -157,19 +178,6 @@ def test_try_registration(self): with self.assertRaises(SystemError): module.call_state_registration_func(2) - def load_module(self): - '''Load the module from the test extension''' - return self.loader.load_module(self.name) - - def load_module_by_name(self, fullname): - '''Load a module from the test extension by name''' - origin = self.spec.origin - loader = self.machinery.ExtensionFileLoader(fullname, origin) - spec = importlib.util.spec_from_loader(fullname, loader) - module = importlib.util.module_from_spec(spec) - loader.exec_module(module) - return module - def test_load_submodule(self): '''Test loading a simulated submodule''' module = self.load_module_by_name('pkg.' + self.name) diff --git a/Lib/test/test_importlib/frozen/test_loader.py b/Lib/test/test_importlib/frozen/test_loader.py index 29ecff17740210..8eaffa798a5b7a 100644 --- a/Lib/test/test_importlib/frozen/test_loader.py +++ b/Lib/test/test_importlib/frozen/test_loader.py @@ -161,19 +161,23 @@ def test_module_repr(self): "") def test_module_repr_indirect(self): - with util.uncache('__hello__'), captured_stdout(): - module = self.machinery.FrozenImporter.load_module('__hello__') - self.assertEqual(repr(module), - "") + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + with util.uncache('__hello__'), captured_stdout(): + module = self.machinery.FrozenImporter.load_module('__hello__') + self.assertEqual(repr(module), + "") # No way to trigger an error in a frozen module. test_state_after_failure = None def test_unloadable(self): - assert self.machinery.FrozenImporter.find_module('_not_real') is None - with self.assertRaises(ImportError) as cm: - self.machinery.FrozenImporter.load_module('_not_real') - self.assertEqual(cm.exception.name, '_not_real') + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + assert self.machinery.FrozenImporter.find_module('_not_real') is None + with self.assertRaises(ImportError) as cm: + self.machinery.FrozenImporter.load_module('_not_real') + self.assertEqual(cm.exception.name, '_not_real') (Frozen_LoaderTests, diff --git a/Lib/test/test_importlib/import_/test___loader__.py b/Lib/test/test_importlib/import_/test___loader__.py index 4b18093cf903fa..ecd83c6567e709 100644 --- a/Lib/test/test_importlib/import_/test___loader__.py +++ b/Lib/test/test_importlib/import_/test___loader__.py @@ -2,6 +2,7 @@ import sys import types import unittest +import warnings from .. import util @@ -45,25 +46,29 @@ def load_module(self, fullname): class LoaderAttributeTests: def test___loader___missing(self): - module = types.ModuleType('blah') - try: - del module.__loader__ - except AttributeError: - pass - loader = LoaderMock() - loader.module = module - with util.uncache('blah'), util.import_state(meta_path=[loader]): - module = self.__import__('blah') - self.assertEqual(loader, module.__loader__) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + module = types.ModuleType('blah') + try: + del module.__loader__ + except AttributeError: + pass + loader = LoaderMock() + loader.module = module + with util.uncache('blah'), util.import_state(meta_path=[loader]): + module = self.__import__('blah') + self.assertEqual(loader, module.__loader__) def test___loader___is_None(self): - module = types.ModuleType('blah') - module.__loader__ = None - loader = LoaderMock() - loader.module = module - with util.uncache('blah'), util.import_state(meta_path=[loader]): - returned_module = self.__import__('blah') - self.assertEqual(loader, module.__loader__) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + module = types.ModuleType('blah') + module.__loader__ = None + loader = LoaderMock() + loader.module = module + with util.uncache('blah'), util.import_state(meta_path=[loader]): + returned_module = self.__import__('blah') + self.assertEqual(loader, module.__loader__) (Frozen_Tests, diff --git a/Lib/test/test_importlib/import_/test___package__.py b/Lib/test/test_importlib/import_/test___package__.py index 761b256b387885..4a2b34e5f67f2c 100644 --- a/Lib/test/test_importlib/import_/test___package__.py +++ b/Lib/test/test_importlib/import_/test___package__.py @@ -98,6 +98,16 @@ def __init__(self, parent): class Using__package__PEP302(Using__package__): mock_modules = util.mock_modules + def test_using___package__(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_using___package__() + + def test_spec_fallback(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_spec_fallback() + (Frozen_UsingPackagePEP302, Source_UsingPackagePEP302 @@ -155,6 +165,21 @@ def test_submodule(self): class Setting__package__PEP302(Setting__package__, unittest.TestCase): mock_modules = util.mock_modules + def test_top_level(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_top_level() + + def test_package(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_package() + + def test_submodule(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_submodule() + class Setting__package__PEP451(Setting__package__, unittest.TestCase): mock_modules = util.mock_spec diff --git a/Lib/test/test_importlib/import_/test_api.py b/Lib/test/test_importlib/import_/test_api.py index 0cd9de4daff752..35c26977ea3156 100644 --- a/Lib/test/test_importlib/import_/test_api.py +++ b/Lib/test/test_importlib/import_/test_api.py @@ -4,6 +4,7 @@ import sys import types import unittest +import warnings PKG_NAME = 'fine' SUBMOD_NAME = 'fine.bogus' @@ -100,6 +101,36 @@ def test_blocked_fromlist(self): class OldAPITests(APITest): bad_finder_loader = BadLoaderFinder + def test_raises_ModuleNotFoundError(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_raises_ModuleNotFoundError() + + def test_name_requires_rparition(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_name_requires_rparition() + + def test_negative_level(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_negative_level() + + def test_nonexistent_fromlist_entry(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_nonexistent_fromlist_entry() + + def test_fromlist_load_error_propagates(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_fromlist_load_error_propagates + + def test_blocked_fromlist(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_blocked_fromlist() + (Frozen_OldAPITests, Source_OldAPITests diff --git a/Lib/test/test_importlib/import_/test_caching.py b/Lib/test/test_importlib/import_/test_caching.py index 8079add5b2147d..0f987b22100c91 100644 --- a/Lib/test/test_importlib/import_/test_caching.py +++ b/Lib/test/test_importlib/import_/test_caching.py @@ -3,6 +3,7 @@ import sys from types import MethodType import unittest +import warnings class UseCache: @@ -63,30 +64,36 @@ def load_module(self, fullname): # to when to use the module in sys.modules and when not to. def test_using_cache_after_loader(self): # [from cache on return] - with self.create_mock('module') as mock: - with util.import_state(meta_path=[mock]): - module = self.__import__('module') - self.assertEqual(id(module), id(sys.modules['module'])) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + with self.create_mock('module') as mock: + with util.import_state(meta_path=[mock]): + module = self.__import__('module') + self.assertEqual(id(module), id(sys.modules['module'])) # See test_using_cache_after_loader() for reasoning. def test_using_cache_for_assigning_to_attribute(self): # [from cache to attribute] - with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with util.import_state(meta_path=[importer]): - module = self.__import__('pkg.module') - self.assertTrue(hasattr(module, 'module')) - self.assertEqual(id(module.module), - id(sys.modules['pkg.module'])) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + with self.create_mock('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = self.__import__('pkg.module') + self.assertTrue(hasattr(module, 'module')) + self.assertEqual(id(module.module), + id(sys.modules['pkg.module'])) # See test_using_cache_after_loader() for reasoning. def test_using_cache_for_fromlist(self): # [from cache for fromlist] - with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with util.import_state(meta_path=[importer]): - module = self.__import__('pkg', fromlist=['module']) - self.assertTrue(hasattr(module, 'module')) - self.assertEqual(id(module.module), - id(sys.modules['pkg.module'])) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + with self.create_mock('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = self.__import__('pkg', fromlist=['module']) + self.assertTrue(hasattr(module, 'module')) + self.assertEqual(id(module.module), + id(sys.modules['pkg.module'])) if __name__ == '__main__': diff --git a/Lib/test/test_importlib/import_/test_fromlist.py b/Lib/test/test_importlib/import_/test_fromlist.py index 018c1721761904..deb21710a61fae 100644 --- a/Lib/test/test_importlib/import_/test_fromlist.py +++ b/Lib/test/test_importlib/import_/test_fromlist.py @@ -24,7 +24,7 @@ def test_return_from_import(self): def test_return_from_from_import(self): # [from return] - with util.mock_modules('pkg.__init__', 'pkg.module')as importer: + with util.mock_spec('pkg.__init__', 'pkg.module')as importer: with util.import_state(meta_path=[importer]): module = self.__import__('pkg.module', fromlist=['attr']) self.assertEqual(module.__name__, 'pkg.module') @@ -52,14 +52,14 @@ class HandlingFromlist: def test_object(self): # [object case] - with util.mock_modules('module') as importer: + with util.mock_spec('module') as importer: with util.import_state(meta_path=[importer]): module = self.__import__('module', fromlist=['attr']) self.assertEqual(module.__name__, 'module') def test_nonexistent_object(self): # [bad object] - with util.mock_modules('module') as importer: + with util.mock_spec('module') as importer: with util.import_state(meta_path=[importer]): module = self.__import__('module', fromlist=['non_existent']) self.assertEqual(module.__name__, 'module') @@ -67,7 +67,7 @@ def test_nonexistent_object(self): def test_module_from_package(self): # [module] - with util.mock_modules('pkg.__init__', 'pkg.module') as importer: + with util.mock_spec('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): module = self.__import__('pkg', fromlist=['module']) self.assertEqual(module.__name__, 'pkg') @@ -75,7 +75,7 @@ def test_module_from_package(self): self.assertEqual(module.module.__name__, 'pkg.module') def test_nonexistent_from_package(self): - with util.mock_modules('pkg.__init__') as importer: + with util.mock_spec('pkg.__init__') as importer: with util.import_state(meta_path=[importer]): module = self.__import__('pkg', fromlist=['non_existent']) self.assertEqual(module.__name__, 'pkg') @@ -87,7 +87,7 @@ def test_module_from_package_triggers_ModuleNotFoundError(self): # ModuleNotFoundError propagate. def module_code(): import i_do_not_exist - with util.mock_modules('pkg.__init__', 'pkg.mod', + with util.mock_spec('pkg.__init__', 'pkg.mod', module_code={'pkg.mod': module_code}) as importer: with util.import_state(meta_path=[importer]): with self.assertRaises(ModuleNotFoundError) as exc: @@ -95,14 +95,14 @@ def module_code(): self.assertEqual('i_do_not_exist', exc.exception.name) def test_empty_string(self): - with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: + with util.mock_spec('pkg.__init__', 'pkg.mod') as importer: with util.import_state(meta_path=[importer]): module = self.__import__('pkg.mod', fromlist=['']) self.assertEqual(module.__name__, 'pkg.mod') def basic_star_test(self, fromlist=['*']): # [using *] - with util.mock_modules('pkg.__init__', 'pkg.module') as mock: + with util.mock_spec('pkg.__init__', 'pkg.module') as mock: with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module'] module = self.__import__('pkg', fromlist=fromlist) @@ -119,7 +119,7 @@ def test_fromlist_as_tuple(self): def test_star_with_others(self): # [using * with others] - context = util.mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2') + context = util.mock_spec('pkg.__init__', 'pkg.module1', 'pkg.module2') with context as mock: with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module1'] @@ -131,7 +131,7 @@ def test_star_with_others(self): self.assertEqual(module.module2.__name__, 'pkg.module2') def test_nonexistent_in_all(self): - with util.mock_modules('pkg.__init__') as importer: + with util.mock_spec('pkg.__init__') as importer: with util.import_state(meta_path=[importer]): importer['pkg'].__all__ = ['non_existent'] module = self.__import__('pkg', fromlist=['*']) @@ -139,7 +139,7 @@ def test_nonexistent_in_all(self): self.assertFalse(hasattr(module, 'non_existent')) def test_star_in_all(self): - with util.mock_modules('pkg.__init__') as importer: + with util.mock_spec('pkg.__init__') as importer: with util.import_state(meta_path=[importer]): importer['pkg'].__all__ = ['*'] module = self.__import__('pkg', fromlist=['*']) @@ -147,7 +147,7 @@ def test_star_in_all(self): self.assertFalse(hasattr(module, '*')) def test_invalid_type(self): - with util.mock_modules('pkg.__init__') as importer: + with util.mock_spec('pkg.__init__') as importer: with util.import_state(meta_path=[importer]), \ warnings.catch_warnings(): warnings.simplefilter('error', BytesWarning) @@ -157,7 +157,7 @@ def test_invalid_type(self): self.__import__('pkg', fromlist=iter([b'attr'])) def test_invalid_type_in_all(self): - with util.mock_modules('pkg.__init__') as importer: + with util.mock_spec('pkg.__init__') as importer: with util.import_state(meta_path=[importer]), \ warnings.catch_warnings(): warnings.simplefilter('error', BytesWarning) diff --git a/Lib/test/test_importlib/import_/test_meta_path.py b/Lib/test/test_importlib/import_/test_meta_path.py index 5a41e8968a21fc..5730119fe9933b 100644 --- a/Lib/test/test_importlib/import_/test_meta_path.py +++ b/Lib/test/test_importlib/import_/test_meta_path.py @@ -100,8 +100,20 @@ def test_with_path(self): self.assertEqual(args[0], mod_name) self.assertIs(args[1], path) +class CallSignoreSuppressImportWarning(CallSignature): -class CallSignaturePEP302(CallSignature): + def test_no_path(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_no_path() + + def test_with_path(self): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + super().test_no_path() + + +class CallSignaturePEP302(CallSignoreSuppressImportWarning): mock_modules = util.mock_modules finder_name = 'find_module' diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py index 605738fae2e378..d8b9fc89f29aa6 100644 --- a/Lib/test/test_importlib/test_abc.py +++ b/Lib/test/test_importlib/test_abc.py @@ -458,32 +458,36 @@ def is_package(self, fullname): return SpecLoader() def test_fresh(self): - loader = self.loader() - name = 'blah' - with test_util.uncache(name): - loader.load_module(name) - module = loader.found - self.assertIs(sys.modules[name], module) - self.assertEqual(loader, module.__loader__) - self.assertEqual(loader, module.__spec__.loader) - self.assertEqual(name, module.__name__) - self.assertEqual(name, module.__spec__.name) - self.assertIsNotNone(module.__path__) - self.assertIsNotNone(module.__path__, - module.__spec__.submodule_search_locations) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + loader = self.loader() + name = 'blah' + with test_util.uncache(name): + loader.load_module(name) + module = loader.found + self.assertIs(sys.modules[name], module) + self.assertEqual(loader, module.__loader__) + self.assertEqual(loader, module.__spec__.loader) + self.assertEqual(name, module.__name__) + self.assertEqual(name, module.__spec__.name) + self.assertIsNotNone(module.__path__) + self.assertIsNotNone(module.__path__, + module.__spec__.submodule_search_locations) def test_reload(self): - name = 'blah' - loader = self.loader() - module = types.ModuleType(name) - module.__spec__ = self.util.spec_from_loader(name, loader) - module.__loader__ = loader - with test_util.uncache(name): - sys.modules[name] = module - loader.load_module(name) - found = loader.found - self.assertIs(found, sys.modules[name]) - self.assertIs(module, sys.modules[name]) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + name = 'blah' + loader = self.loader() + module = types.ModuleType(name) + module.__spec__ = self.util.spec_from_loader(name, loader) + module.__loader__ = loader + with test_util.uncache(name): + sys.modules[name] = module + loader.load_module(name) + found = loader.found + self.assertIs(found, sys.modules[name]) + self.assertIs(module, sys.modules[name]) (Frozen_LoaderLoadModuleTests, @@ -837,25 +841,29 @@ def test_load_module(self): # Loading a module should set __name__, __loader__, __package__, # __path__ (for packages), __file__, and __cached__. # The module should also be put into sys.modules. - with test_util.uncache(self.name): - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - module = self.loader.load_module(self.name) - self.verify_module(module) - self.assertEqual(module.__path__, [os.path.dirname(self.path)]) - self.assertIn(self.name, sys.modules) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + with test_util.uncache(self.name): + with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + module = self.loader.load_module(self.name) + self.verify_module(module) + self.assertEqual(module.__path__, [os.path.dirname(self.path)]) + self.assertIn(self.name, sys.modules) def test_package_settings(self): # __package__ needs to be set, while __path__ is set on if the module # is a package. # Testing the values for a package are covered by test_load_module. - self.setUp(is_package=False) - with test_util.uncache(self.name): - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - module = self.loader.load_module(self.name) - self.verify_module(module) - self.assertFalse(hasattr(module, '__path__')) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + self.setUp(is_package=False) + with test_util.uncache(self.name): + with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + module = self.loader.load_module(self.name) + self.verify_module(module) + self.assertFalse(hasattr(module, '__path__')) def test_get_source_encoding(self): # Source is considered encoded in UTF-8 by default unless otherwise diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index fd60634e093339..3f06a10ba9c5ed 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -20,7 +20,7 @@ class ImportModuleTests: def test_module_import(self): # Test importing a top-level module. - with test_util.mock_modules('top_level') as mock: + with test_util.mock_spec('top_level') as mock: with test_util.import_state(meta_path=[mock]): module = self.init.import_module('top_level') self.assertEqual(module.__name__, 'top_level') @@ -30,7 +30,7 @@ def test_absolute_package_import(self): pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with test_util.mock_modules(pkg_long_name, name) as mock: + with test_util.mock_spec(pkg_long_name, name) as mock: with test_util.import_state(meta_path=[mock]): module = self.init.import_module(name) self.assertEqual(module.__name__, name) @@ -42,7 +42,7 @@ def test_shallow_relative_package_import(self): module_name = 'mod' absolute_name = '{0}.{1}'.format(pkg_name, module_name) relative_name = '.{0}'.format(module_name) - with test_util.mock_modules(pkg_long_name, absolute_name) as mock: + with test_util.mock_spec(pkg_long_name, absolute_name) as mock: with test_util.import_state(meta_path=[mock]): self.init.import_module(pkg_name) module = self.init.import_module(relative_name, pkg_name) @@ -50,7 +50,7 @@ def test_shallow_relative_package_import(self): def test_deep_relative_package_import(self): modules = ['a.__init__', 'a.b.__init__', 'a.c'] - with test_util.mock_modules(*modules) as mock: + with test_util.mock_spec(*modules) as mock: with test_util.import_state(meta_path=[mock]): self.init.import_module('a') self.init.import_module('a.b') @@ -63,7 +63,7 @@ def test_absolute_import_with_package(self): pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with test_util.mock_modules(pkg_long_name, name) as mock: + with test_util.mock_spec(pkg_long_name, name) as mock: with test_util.import_state(meta_path=[mock]): self.init.import_module(pkg_name) module = self.init.import_module(name, pkg_name) @@ -88,7 +88,7 @@ def load_b(): b_load_count += 1 code = {'a': load_a, 'a.b': load_b} modules = ['a.__init__', 'a.b'] - with test_util.mock_modules(*modules, module_code=code) as mock: + with test_util.mock_spec(*modules, module_code=code) as mock: with test_util.import_state(meta_path=[mock]): self.init.import_module('a.b') self.assertEqual(b_load_count, 1) @@ -212,8 +212,8 @@ def code(): module = type(sys)('top_level') module.spam = 3 sys.modules['top_level'] = module - mock = test_util.mock_modules('top_level', - module_code={'top_level': code}) + mock = test_util.mock_spec('top_level', + module_code={'top_level': code}) with mock: with test_util.import_state(meta_path=[mock]): module = self.init.import_module('top_level') diff --git a/Lib/test/test_importlib/test_spec.py b/Lib/test/test_importlib/test_spec.py index eed90f29f9286c..b57eb6c0ff3974 100644 --- a/Lib/test/test_importlib/test_spec.py +++ b/Lib/test/test_importlib/test_spec.py @@ -303,32 +303,38 @@ def exec_module(self, module): self.assertNotIn(self.spec.name, sys.modules) def test_load_legacy(self): - self.spec.loader = LegacyLoader() - with CleanImport(self.spec.name): - loaded = self.bootstrap._load(self.spec) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + self.spec.loader = LegacyLoader() + with CleanImport(self.spec.name): + loaded = self.bootstrap._load(self.spec) - self.assertEqual(loaded.ham, -1) + self.assertEqual(loaded.ham, -1) def test_load_legacy_attributes(self): - self.spec.loader = LegacyLoader() - with CleanImport(self.spec.name): - loaded = self.bootstrap._load(self.spec) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + self.spec.loader = LegacyLoader() + with CleanImport(self.spec.name): + loaded = self.bootstrap._load(self.spec) - self.assertIs(loaded.__loader__, self.spec.loader) - self.assertEqual(loaded.__package__, self.spec.parent) - self.assertIs(loaded.__spec__, self.spec) + self.assertIs(loaded.__loader__, self.spec.loader) + self.assertEqual(loaded.__package__, self.spec.parent) + self.assertIs(loaded.__spec__, self.spec) def test_load_legacy_attributes_immutable(self): module = object() - class ImmutableLoader(TestLoader): - def load_module(self, name): - sys.modules[name] = module - return module - self.spec.loader = ImmutableLoader() - with CleanImport(self.spec.name): - loaded = self.bootstrap._load(self.spec) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + class ImmutableLoader(TestLoader): + def load_module(self, name): + sys.modules[name] = module + return module + self.spec.loader = ImmutableLoader() + with CleanImport(self.spec.name): + loaded = self.bootstrap._load(self.spec) - self.assertIs(sys.modules[self.spec.name], module) + self.assertIs(sys.modules[self.spec.name], module) # reload() @@ -382,11 +388,13 @@ def test_reload_init_module_attrs(self): self.assertFalse(hasattr(loaded, '__cached__')) def test_reload_legacy(self): - self.spec.loader = LegacyLoader() - with CleanImport(self.spec.name): - loaded = self.bootstrap._load(self.spec) - reloaded = self.bootstrap._exec(self.spec, loaded) - installed = sys.modules[self.spec.name] + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ImportWarning) + self.spec.loader = LegacyLoader() + with CleanImport(self.spec.name): + loaded = self.bootstrap._load(self.spec) + reloaded = self.bootstrap._exec(self.spec, loaded) + installed = sys.modules[self.spec.name] self.assertEqual(loaded.ham, -1) self.assertIs(reloaded, loaded) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 71c4f27d27b982..c81d828b57ece9 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -390,6 +390,7 @@ def test_getclasses(self): ('ParrotDroppings', mod.ParrotDroppings), ('StupidGit', mod.StupidGit), ('Tit', mod.MalodorousPervert), + ('WhichComments', mod.WhichComments), ]) tree = inspect.getclasstree([cls[1] for cls in classes]) self.assertEqual(tree, @@ -403,7 +404,8 @@ def test_getclasses(self): [(mod.FesteringGob, (mod.MalodorousPervert, mod.ParrotDroppings)) ] - ] + ], + (mod.WhichComments, (object,),) ] ]) tree = inspect.getclasstree([cls[1] for cls in classes], True) @@ -415,7 +417,8 @@ def test_getclasses(self): [(mod.FesteringGob, (mod.MalodorousPervert, mod.ParrotDroppings)) ] - ] + ], + (mod.WhichComments, (object,),) ] ]) @@ -646,6 +649,18 @@ def test_anonymous(self): # as argument to another function. self.assertSourceEqual(mod2.anonymous, 55, 55) +class TestBlockComments(GetSourceBase): + fodderModule = mod + + def test_toplevel_class(self): + self.assertSourceEqual(mod.WhichComments, 96, 114) + + def test_class_method(self): + self.assertSourceEqual(mod.WhichComments.f, 99, 104) + + def test_class_async_method(self): + self.assertSourceEqual(mod.WhichComments.asyncf, 109, 112) + class TestBuggyCases(GetSourceBase): fodderModule = mod2 @@ -697,6 +712,17 @@ def test_findsource_without_filename(self): self.assertRaises(IOError, inspect.findsource, co) self.assertRaises(IOError, inspect.getsource, co) + def test_findsource_with_out_of_bounds_lineno(self): + mod_len = len(inspect.getsource(mod)) + src = '\n' * 2* mod_len + "def f(): pass" + co = compile(src, mod.__file__, "exec") + g, l = {}, {} + eval(co, g, l) + func = l['f'] + self.assertEqual(func.__code__.co_firstlineno, 1+2*mod_len) + with self.assertRaisesRegex(IOError, "lineno is out of bounds"): + inspect.findsource(func) + def test_getsource_on_method(self): self.assertSourceEqual(mod2.ClassWithMethod.method, 118, 119) @@ -4014,8 +4040,8 @@ def test_getsource_reload(self): def test_main(): run_unittest( - TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBuggyCases, - TestInterpreterStack, TestClassesAndFunctions, TestPredicates, + TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBlockComments, + TestBuggyCases, TestInterpreterStack, TestClassesAndFunctions, TestPredicates, TestGetcallargsFunctions, TestGetcallargsMethods, TestGetcallargsUnboundMethods, TestGetattrStatic, TestGetGeneratorState, TestNoEOL, TestSignatureObject, TestSignatureBind, TestParameterObject, diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index eaa6197bec395c..a99b5e2bb71db9 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -12,6 +12,8 @@ import sys import struct import threading +import gc + maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 @@ -1024,6 +1026,25 @@ def run(r1, r2): self.assertEqual(next(it), (1, 2)) self.assertRaises(RuntimeError, next, it) + def test_pairwise(self): + self.assertEqual(list(pairwise('')), []) + self.assertEqual(list(pairwise('a')), []) + self.assertEqual(list(pairwise('ab')), + [('a', 'b')]), + self.assertEqual(list(pairwise('abcde')), + [('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'e')]) + self.assertEqual(list(pairwise(range(10_000))), + list(zip(range(10_000), range(1, 10_000)))) + + with self.assertRaises(TypeError): + pairwise() # too few arguments + with self.assertRaises(TypeError): + pairwise('abc', 10) # too many arguments + with self.assertRaises(TypeError): + pairwise(iterable='abc') # keyword arguments + with self.assertRaises(TypeError): + pairwise(None) # non-iterable argument + def test_product(self): for args, result in [ ([], [()]), # zero iterables @@ -1554,6 +1575,51 @@ def test_StopIteration(self): self.assertRaises(StopIteration, next, f(lambda x:x, [])) self.assertRaises(StopIteration, next, f(lambda x:x, StopNow())) + @support.cpython_only + def test_combinations_result_gc(self): + # bpo-42536: combinations's tuple-reuse speed trick breaks the GC's + # assumptions about what can be untracked. Make sure we re-track result + # tuples whenever we reuse them. + it = combinations([None, []], 1) + next(it) + gc.collect() + # That GC collection probably untracked the recycled internal result + # tuple, which has the value (None,). Make sure it's re-tracked when + # it's mutated and returned from __next__: + self.assertTrue(gc.is_tracked(next(it))) + + @support.cpython_only + def test_combinations_with_replacement_result_gc(self): + # Ditto for combinations_with_replacement. + it = combinations_with_replacement([None, []], 1) + next(it) + gc.collect() + self.assertTrue(gc.is_tracked(next(it))) + + @support.cpython_only + def test_permutations_result_gc(self): + # Ditto for permutations. + it = permutations([None, []], 1) + next(it) + gc.collect() + self.assertTrue(gc.is_tracked(next(it))) + + @support.cpython_only + def test_product_result_gc(self): + # Ditto for product. + it = product([None, []]) + next(it) + gc.collect() + self.assertTrue(gc.is_tracked(next(it))) + + @support.cpython_only + def test_zip_longest_result_gc(self): + # Ditto for zip_longest. + it = zip_longest([[]]) + gc.collect() + self.assertTrue(gc.is_tracked(next(it))) + + class TestExamples(unittest.TestCase): def test_accumulate(self): @@ -1787,6 +1853,10 @@ def test_islice(self): a = [] self.makecycle(islice([a]*2, None), a) + def test_pairwise(self): + a = [] + self.makecycle(pairwise([a]*5), a) + def test_permutations(self): a = [] self.makecycle(permutations([1,2,a,3], 3), a) @@ -1995,6 +2065,17 @@ def test_islice(self): self.assertRaises(TypeError, islice, N(s), 10) self.assertRaises(ZeroDivisionError, list, islice(E(s), 10)) + def test_pairwise(self): + for s in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5)): + for g in (G, I, Ig, S, L, R): + seq = list(g(s)) + expected = list(zip(seq, seq[1:])) + actual = list(pairwise(g(s))) + self.assertEqual(actual, expected) + self.assertRaises(TypeError, pairwise, X(s)) + self.assertRaises(TypeError, pairwise, N(s)) + self.assertRaises(ZeroDivisionError, list, pairwise(E(s))) + def test_starmap(self): for s in (range(10), range(0), range(100), (7,11), range(20,50,5)): for g in (G, I, Ig, S, L, R): @@ -2290,7 +2371,7 @@ def test_permutations_sizeof(self): ... "Count how many times the predicate is true" ... return sum(map(pred, iterable)) ->>> def padnone(iterable): +>>> def pad_none(iterable): ... "Returns the sequence elements and then returns None indefinitely" ... return chain(iterable, repeat(None)) @@ -2312,15 +2393,6 @@ def test_permutations_sizeof(self): ... else: ... return starmap(func, repeat(args, times)) ->>> def pairwise(iterable): -... "s -> (s0,s1), (s1,s2), (s2, s3), ..." -... a, b = tee(iterable) -... try: -... next(b) -... except StopIteration: -... pass -... return zip(a, b) - >>> def grouper(n, iterable, fillvalue=None): ... "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" ... args = [iter(iterable)] * n @@ -2451,16 +2523,7 @@ def test_permutations_sizeof(self): >>> take(5, map(int, repeatfunc(random.random))) [0, 0, 0, 0, 0] ->>> list(pairwise('abcd')) -[('a', 'b'), ('b', 'c'), ('c', 'd')] - ->>> list(pairwise([])) -[] - ->>> list(pairwise('a')) -[] - ->>> list(islice(padnone('abc'), 0, 6)) +>>> list(islice(pad_none('abc'), 0, 6)) ['a', 'b', 'c', None, None, None] >>> list(ncycles('abc', 3)) diff --git a/Lib/test/test_mailcap.py b/Lib/test/test_mailcap.py index 51a0c7da8bb6bd..ef9cad498a75c2 100644 --- a/Lib/test/test_mailcap.py +++ b/Lib/test/test_mailcap.py @@ -4,6 +4,7 @@ import test.support from test.support import os_helper import unittest +import sys # Location of mailcap file MAILCAPFILE = test.support.findfile("mailcap.txt") @@ -214,6 +215,7 @@ def test_findmatch(self): self._run_cases(cases) @unittest.skipUnless(os.name == "posix", "Requires 'test' command on system") + @unittest.skipIf(sys.platform == "vxworks", "'test' command is not supported on VxWorks") def test_test(self): # findmatch() will automatically check any "test" conditions and skip # the entry if the check fails. diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py index c813830ce6d3cf..5908f1210857a3 100644 --- a/Lib/test/test_named_expressions.py +++ b/Lib/test/test_named_expressions.py @@ -113,7 +113,7 @@ def test_named_expression_invalid_in_class_body(self): "assignment expression within a comprehension cannot be used in a class body"): exec(code, {}, {}) - def test_named_expression_invalid_rebinding_comprehension_iteration_variable(self): + def test_named_expression_invalid_rebinding_list_comprehension_iteration_variable(self): cases = [ ("Local reuse", 'i', "[i := 0 for i in range(5)]"), ("Nested reuse", 'j', "[[(j := 0) for i in range(5)] for j in range(5)]"), @@ -130,7 +130,7 @@ def test_named_expression_invalid_rebinding_comprehension_iteration_variable(sel with self.assertRaisesRegex(SyntaxError, msg): exec(code, {}, {}) - def test_named_expression_invalid_rebinding_comprehension_inner_loop(self): + def test_named_expression_invalid_rebinding_list_comprehension_inner_loop(self): cases = [ ("Inner reuse", 'j', "[i for i in range(5) if (j := 0) for j in range(5)]"), ("Inner unpacking reuse", 'j', "[i for i in range(5) if (j := 0) for j, k in [(0, 1)]]"), @@ -145,7 +145,7 @@ def test_named_expression_invalid_rebinding_comprehension_inner_loop(self): with self.assertRaisesRegex(SyntaxError, msg): exec(f"lambda: {code}", {}) # Function scope - def test_named_expression_invalid_comprehension_iterable_expression(self): + def test_named_expression_invalid_list_comprehension_iterable_expression(self): cases = [ ("Top level", "[i for i in (i := range(5))]"), ("Inside tuple", "[i for i in (2, 3, i := range(5))]"), @@ -167,6 +167,60 @@ def test_named_expression_invalid_comprehension_iterable_expression(self): with self.assertRaisesRegex(SyntaxError, msg): exec(f"lambda: {code}", {}) # Function scope + def test_named_expression_invalid_rebinding_set_comprehension_iteration_variable(self): + cases = [ + ("Local reuse", 'i', "{i := 0 for i in range(5)}"), + ("Nested reuse", 'j', "{{(j := 0) for i in range(5)} for j in range(5)}"), + ("Reuse inner loop target", 'j', "{(j := 0) for i in range(5) for j in range(5)}"), + ("Unpacking reuse", 'i', "{i := 0 for i, j in {(0, 1)}}"), + ("Reuse in loop condition", 'i', "{i+1 for i in range(5) if (i := 0)}"), + ("Unreachable reuse", 'i', "{False or (i:=0) for i in range(5)}"), + ("Unreachable nested reuse", 'i', + "{(i, j) for i in range(5) for j in range(5) if True or (i:=10)}"), + ] + for case, target, code in cases: + msg = f"assignment expression cannot rebind comprehension iteration variable '{target}'" + with self.subTest(case=case): + with self.assertRaisesRegex(SyntaxError, msg): + exec(code, {}, {}) + + def test_named_expression_invalid_rebinding_set_comprehension_inner_loop(self): + cases = [ + ("Inner reuse", 'j', "{i for i in range(5) if (j := 0) for j in range(5)}"), + ("Inner unpacking reuse", 'j', "{i for i in range(5) if (j := 0) for j, k in {(0, 1)}}"), + ] + for case, target, code in cases: + msg = f"comprehension inner loop cannot rebind assignment expression target '{target}'" + with self.subTest(case=case): + with self.assertRaisesRegex(SyntaxError, msg): + exec(code, {}) # Module scope + with self.assertRaisesRegex(SyntaxError, msg): + exec(code, {}, {}) # Class scope + with self.assertRaisesRegex(SyntaxError, msg): + exec(f"lambda: {code}", {}) # Function scope + + def test_named_expression_invalid_set_comprehension_iterable_expression(self): + cases = [ + ("Top level", "{i for i in (i := range(5))}"), + ("Inside tuple", "{i for i in (2, 3, i := range(5))}"), + ("Inside list", "{i for i in {2, 3, i := range(5)}}"), + ("Different name", "{i for i in (j := range(5))}"), + ("Lambda expression", "{i for i in (lambda:(j := range(5)))()}"), + ("Inner loop", "{i for i in range(5) for j in (i := range(5))}"), + ("Nested comprehension", "{i for i in {j for j in (k := range(5))}}"), + ("Nested comprehension condition", "{i for i in {j for j in range(5) if (j := True)}}"), + ("Nested comprehension body", "{i for i in {(j := True) for j in range(5)}}"), + ] + msg = "assignment expression cannot be used in a comprehension iterable expression" + for case, code in cases: + with self.subTest(case=case): + with self.assertRaisesRegex(SyntaxError, msg): + exec(code, {}) # Module scope + with self.assertRaisesRegex(SyntaxError, msg): + exec(code, {}, {}) # Class scope + with self.assertRaisesRegex(SyntaxError, msg): + exec(f"lambda: {code}", {}) # Function scope + class NamedExpressionAssignmentTest(unittest.TestCase): @@ -271,6 +325,27 @@ def test_named_expression_assignment_16(self): fib = {(c := a): (a := b) + (b := a + c) - b for __ in range(6)} self.assertEqual(fib, {1: 2, 2: 3, 3: 5, 5: 8, 8: 13, 13: 21}) + def test_named_expression_assignment_17(self): + a = [1] + element = a[b:=0] + self.assertEqual(b, 0) + self.assertEqual(element, a[0]) + + def test_named_expression_assignment_18(self): + class TwoDimensionalList: + def __init__(self, two_dimensional_list): + self.two_dimensional_list = two_dimensional_list + + def __getitem__(self, index): + return self.two_dimensional_list[index[0]][index[1]] + + a = TwoDimensionalList([[1], [2]]) + element = a[b:=0, c:=0] + self.assertEqual(b, 0) + self.assertEqual(c, 0) + self.assertEqual(element, a.two_dimensional_list[b][c]) + + class NamedExpressionScopeTest(unittest.TestCase): @@ -513,6 +588,15 @@ def g(): self.assertEqual(nonlocal_var, None) f() + def test_named_expression_scope_in_genexp(self): + a = 1 + b = [1, 2, 3, 4] + genexp = (c := i + a for i in b) + + self.assertNotIn("c", locals()) + for idx, elem in enumerate(genexp): + self.assertEqual(elem, b[idx] + a) + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py index 2bd46aa745ff23..90ef5cd363b3fb 100644 --- a/Lib/test/test_netrc.py +++ b/Lib/test/test_netrc.py @@ -109,62 +109,56 @@ def test_comment_at_end_of_machine_line_pass_has_hash(self): def test_security(self): # This test is incomplete since we are normally not run as root and # therefore can't test the file ownership being wrong. - d = os_helper.TESTFN - os.mkdir(d) - self.addCleanup(os_helper.rmtree, d) - fn = os.path.join(d, '.netrc') - with open(fn, 'wt') as f: - f.write("""\ - machine foo.domain.com login bar password pass - default login foo password pass - """) - with os_helper.EnvironmentVarGuard() as environ: - environ.set('HOME', d) - os.chmod(fn, 0o600) - nrc = netrc.netrc() - self.assertEqual(nrc.hosts['foo.domain.com'], - ('bar', None, 'pass')) - os.chmod(fn, 0o622) - self.assertRaises(netrc.NetrcParseError, netrc.netrc) + with os_helper.temp_cwd(None) as d: + fn = os.path.join(d, '.netrc') + with open(fn, 'wt') as f: + f.write("""\ + machine foo.domain.com login bar password pass + default login foo password pass + """) + with os_helper.EnvironmentVarGuard() as environ: + environ.set('HOME', d) + os.chmod(fn, 0o600) + nrc = netrc.netrc() + self.assertEqual(nrc.hosts['foo.domain.com'], + ('bar', None, 'pass')) + os.chmod(fn, 0o622) + self.assertRaises(netrc.NetrcParseError, netrc.netrc) def test_file_not_found_in_home(self): - d = os_helper.TESTFN - os.mkdir(d) - self.addCleanup(os_helper.rmtree, d) - with os_helper.EnvironmentVarGuard() as environ: - environ.set('HOME', d) - self.assertRaises(FileNotFoundError, netrc.netrc) + with os_helper.temp_cwd(None) as d: + with os_helper.EnvironmentVarGuard() as environ: + environ.set('HOME', d) + self.assertRaises(FileNotFoundError, netrc.netrc) def test_file_not_found_explicit(self): self.assertRaises(FileNotFoundError, netrc.netrc, file='unlikely_netrc') def test_home_not_set(self): - fake_home = os_helper.TESTFN - os.mkdir(fake_home) - self.addCleanup(os_helper.rmtree, fake_home) - fake_netrc_path = os.path.join(fake_home, '.netrc') - with open(fake_netrc_path, 'w') as f: - f.write('machine foo.domain.com login bar password pass') - os.chmod(fake_netrc_path, 0o600) - - orig_expanduser = os.path.expanduser - called = [] - - def fake_expanduser(s): - called.append(s) - with os_helper.EnvironmentVarGuard() as environ: - environ.set('HOME', fake_home) - environ.set('USERPROFILE', fake_home) - result = orig_expanduser(s) - return result - - with support.swap_attr(os.path, 'expanduser', fake_expanduser): - nrc = netrc.netrc() - login, account, password = nrc.authenticators('foo.domain.com') - self.assertEqual(login, 'bar') - - self.assertTrue(called) + with os_helper.temp_cwd(None) as fake_home: + fake_netrc_path = os.path.join(fake_home, '.netrc') + with open(fake_netrc_path, 'w') as f: + f.write('machine foo.domain.com login bar password pass') + os.chmod(fake_netrc_path, 0o600) + + orig_expanduser = os.path.expanduser + called = [] + + def fake_expanduser(s): + called.append(s) + with os_helper.EnvironmentVarGuard() as environ: + environ.set('HOME', fake_home) + environ.set('USERPROFILE', fake_home) + result = orig_expanduser(s) + return result + + with support.swap_attr(os.path, 'expanduser', fake_expanduser): + nrc = netrc.netrc() + login, account, password = nrc.authenticators('foo.domain.com') + self.assertEqual(login, 'bar') + + self.assertTrue(called) if __name__ == "__main__": diff --git a/Lib/test/test_ordered_dict.py b/Lib/test/test_ordered_dict.py index 31759f20d28349..eb404463e92550 100644 --- a/Lib/test/test_ordered_dict.py +++ b/Lib/test/test_ordered_dict.py @@ -700,6 +700,17 @@ def test_merge_operator(self): with self.assertRaises(ValueError): a |= "BAD" + @support.cpython_only + def test_ordered_dict_items_result_gc(self): + # bpo-42536: OrderedDict.items's tuple-reuse speed trick breaks the GC's + # assumptions about what can be untracked. Make sure we re-track result + # tuples whenever we reuse them. + it = iter(self.OrderedDict({None: []}).items()) + gc.collect() + # That GC collection probably untracked the recycled internal result + # tuple, which is initialized to (None, None). Make sure it's re-tracked + # when it's mutated and returned from __next__: + self.assertTrue(gc.is_tracked(next(it))) class PurePythonOrderedDictTests(OrderedDictTests, unittest.TestCase): diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5126c84cf30c68..dbb2975c0eee49 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -15,10 +15,12 @@ import mmap import os import pickle +import select import shutil import signal import socket import stat +import struct import subprocess import sys import sysconfig @@ -59,6 +61,7 @@ except ImportError: INT_MAX = PY_SSIZE_T_MAX = sys.maxsize + from test.support.script_helper import assert_python_ok from test.support import unix_shell from test.support.os_helper import FakePath @@ -90,6 +93,11 @@ def create_file(filename, content=b'content'): fp.write(content) +# bpo-41625: On AIX, splice() only works with a socket, not with a pipe. +requires_splice_pipe = unittest.skipIf(sys.platform.startswith("aix"), + 'on AIX, splice() only accepts sockets') + + class MiscTests(unittest.TestCase): def test_getcwd(self): cwd = os.getcwd() @@ -108,6 +116,10 @@ def test_getcwd_long_path(self): # than MAX_PATH if long paths support is disabled: # see RtlAreLongPathsEnabled(). min_len = 2000 # characters + # On VxWorks, PATH_MAX is defined as 1024 bytes. Creating a path + # longer than PATH_MAX will fail. + if sys.platform == 'vxworks': + min_len = 1000 dirlen = 200 # characters dirname = 'python_test_dir_' dirname = dirname + ('a' * (dirlen - len(dirname))) @@ -378,6 +390,126 @@ def test_copy_file_range_offset(self): self.assertEqual(read[out_seek:], data[in_skip:in_skip+i]) + @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()') + def test_splice_invalid_values(self): + with self.assertRaises(ValueError): + os.splice(0, 1, -10) + + @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()') + @requires_splice_pipe + def test_splice(self): + TESTFN2 = os_helper.TESTFN + ".3" + data = b'0123456789' + + create_file(os_helper.TESTFN, data) + self.addCleanup(os_helper.unlink, os_helper.TESTFN) + + in_file = open(os_helper.TESTFN, 'rb') + self.addCleanup(in_file.close) + in_fd = in_file.fileno() + + read_fd, write_fd = os.pipe() + self.addCleanup(lambda: os.close(read_fd)) + self.addCleanup(lambda: os.close(write_fd)) + + try: + i = os.splice(in_fd, write_fd, 5) + except OSError as e: + # Handle the case in which Python was compiled + # in a system with the syscall but without support + # in the kernel. + if e.errno != errno.ENOSYS: + raise + self.skipTest(e) + else: + # The number of copied bytes can be less than + # the number of bytes originally requested. + self.assertIn(i, range(0, 6)); + + self.assertEqual(os.read(read_fd, 100), data[:i]) + + @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()') + @requires_splice_pipe + def test_splice_offset_in(self): + TESTFN4 = os_helper.TESTFN + ".4" + data = b'0123456789' + bytes_to_copy = 6 + in_skip = 3 + + create_file(os_helper.TESTFN, data) + self.addCleanup(os_helper.unlink, os_helper.TESTFN) + + in_file = open(os_helper.TESTFN, 'rb') + self.addCleanup(in_file.close) + in_fd = in_file.fileno() + + read_fd, write_fd = os.pipe() + self.addCleanup(lambda: os.close(read_fd)) + self.addCleanup(lambda: os.close(write_fd)) + + try: + i = os.splice(in_fd, write_fd, bytes_to_copy, offset_src=in_skip) + except OSError as e: + # Handle the case in which Python was compiled + # in a system with the syscall but without support + # in the kernel. + if e.errno != errno.ENOSYS: + raise + self.skipTest(e) + else: + # The number of copied bytes can be less than + # the number of bytes originally requested. + self.assertIn(i, range(0, bytes_to_copy+1)); + + read = os.read(read_fd, 100) + # 012 are skipped (in_skip) + # 345678 are copied in the file (in_skip + bytes_to_copy) + self.assertEqual(read, data[in_skip:in_skip+i]) + + @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()') + @requires_splice_pipe + def test_splice_offset_out(self): + TESTFN4 = os_helper.TESTFN + ".4" + data = b'0123456789' + bytes_to_copy = 6 + out_seek = 3 + + create_file(os_helper.TESTFN, data) + self.addCleanup(os_helper.unlink, os_helper.TESTFN) + + read_fd, write_fd = os.pipe() + self.addCleanup(lambda: os.close(read_fd)) + self.addCleanup(lambda: os.close(write_fd)) + os.write(write_fd, data) + + out_file = open(TESTFN4, 'w+b') + self.addCleanup(os_helper.unlink, TESTFN4) + self.addCleanup(out_file.close) + out_fd = out_file.fileno() + + try: + i = os.splice(read_fd, out_fd, bytes_to_copy, offset_dst=out_seek) + except OSError as e: + # Handle the case in which Python was compiled + # in a system with the syscall but without support + # in the kernel. + if e.errno != errno.ENOSYS: + raise + self.skipTest(e) + else: + # The number of copied bytes can be less than + # the number of bytes originally requested. + self.assertIn(i, range(0, bytes_to_copy+1)); + + with open(TESTFN4, 'rb') as in_file: + read = in_file.read() + # seeked bytes (5) are zero'ed + self.assertEqual(read[:out_seek], b'\x00'*out_seek) + # 012 are skipped (in_skip) + # 345678 are copied in the file (in_skip + bytes_to_copy) + self.assertEqual(read[out_seek:], data[:i]) + + # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): def setUp(self): @@ -3528,6 +3660,89 @@ def test_memfd_create(self): self.assertFalse(os.get_inheritable(fd2)) +@unittest.skipUnless(hasattr(os, 'eventfd'), 'requires os.eventfd') +@support.requires_linux_version(2, 6, 30) +class EventfdTests(unittest.TestCase): + def test_eventfd_initval(self): + def pack(value): + """Pack as native uint64_t + """ + return struct.pack("@Q", value) + size = 8 # read/write 8 bytes + initval = 42 + fd = os.eventfd(initval) + self.assertNotEqual(fd, -1) + self.addCleanup(os.close, fd) + self.assertFalse(os.get_inheritable(fd)) + + # test with raw read/write + res = os.read(fd, size) + self.assertEqual(res, pack(initval)) + + os.write(fd, pack(23)) + res = os.read(fd, size) + self.assertEqual(res, pack(23)) + + os.write(fd, pack(40)) + os.write(fd, pack(2)) + res = os.read(fd, size) + self.assertEqual(res, pack(42)) + + # test with eventfd_read/eventfd_write + os.eventfd_write(fd, 20) + os.eventfd_write(fd, 3) + res = os.eventfd_read(fd) + self.assertEqual(res, 23) + + def test_eventfd_semaphore(self): + initval = 2 + flags = os.EFD_CLOEXEC | os.EFD_SEMAPHORE | os.EFD_NONBLOCK + fd = os.eventfd(initval, flags) + self.assertNotEqual(fd, -1) + self.addCleanup(os.close, fd) + + # semaphore starts has initval 2, two reads return '1' + res = os.eventfd_read(fd) + self.assertEqual(res, 1) + res = os.eventfd_read(fd) + self.assertEqual(res, 1) + # third read would block + with self.assertRaises(BlockingIOError): + os.eventfd_read(fd) + with self.assertRaises(BlockingIOError): + os.read(fd, 8) + + # increase semaphore counter, read one + os.eventfd_write(fd, 1) + res = os.eventfd_read(fd) + self.assertEqual(res, 1) + # next read would block, too + with self.assertRaises(BlockingIOError): + os.eventfd_read(fd) + + def test_eventfd_select(self): + flags = os.EFD_CLOEXEC | os.EFD_NONBLOCK + fd = os.eventfd(0, flags) + self.assertNotEqual(fd, -1) + self.addCleanup(os.close, fd) + + # counter is zero, only writeable + rfd, wfd, xfd = select.select([fd], [fd], [fd], 0) + self.assertEqual((rfd, wfd, xfd), ([], [fd], [])) + + # counter is non-zero, read and writeable + os.eventfd_write(fd, 23) + rfd, wfd, xfd = select.select([fd], [fd], [fd], 0) + self.assertEqual((rfd, wfd, xfd), ([fd], [fd], [])) + self.assertEqual(os.eventfd_read(fd), 23) + + # counter at max, only readable + os.eventfd_write(fd, (2**64) - 2) + rfd, wfd, xfd = select.select([fd], [fd], [fd], 0) + self.assertEqual((rfd, wfd, xfd), ([fd], [], [])) + os.eventfd_read(fd) + + class OSErrorTests(unittest.TestCase): def setUp(self): class Str(str): diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 17292dc1abf73f..7f7f72c625806f 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -440,9 +440,18 @@ def test_parents_common(self): self.assertEqual(par[0], P('a/b')) self.assertEqual(par[1], P('a')) self.assertEqual(par[2], P('.')) + self.assertEqual(par[-1], P('.')) + self.assertEqual(par[-2], P('a')) + self.assertEqual(par[-3], P('a/b')) + self.assertEqual(par[0:1], (P('a/b'),)) + self.assertEqual(par[:2], (P('a/b'), P('a'))) + self.assertEqual(par[:-1], (P('a/b'), P('a'))) + self.assertEqual(par[1:], (P('a'), P('.'))) + self.assertEqual(par[::2], (P('a/b'), P('.'))) + self.assertEqual(par[::-1], (P('.'), P('a'), P('a/b'))) self.assertEqual(list(par), [P('a/b'), P('a'), P('.')]) with self.assertRaises(IndexError): - par[-1] + par[-4] with self.assertRaises(IndexError): par[3] with self.assertRaises(TypeError): @@ -454,6 +463,12 @@ def test_parents_common(self): self.assertEqual(par[0], P('/a/b')) self.assertEqual(par[1], P('/a')) self.assertEqual(par[2], P('/')) + self.assertEqual(par[0:1], (P('/a/b'),)) + self.assertEqual(par[:2], (P('/a/b'), P('/a'))) + self.assertEqual(par[:-1], (P('/a/b'), P('/a'))) + self.assertEqual(par[1:], (P('/a'), P('/'))) + self.assertEqual(par[::2], (P('/a/b'), P('/'))) + self.assertEqual(par[::-1], (P('/'), P('/a'), P('/a/b'))) self.assertEqual(list(par), [P('/a/b'), P('/a'), P('/')]) with self.assertRaises(IndexError): par[3] @@ -905,6 +920,12 @@ def test_parents(self): self.assertEqual(len(par), 2) self.assertEqual(par[0], P('z:a')) self.assertEqual(par[1], P('z:')) + self.assertEqual(par[0:1], (P('z:a'),)) + self.assertEqual(par[:-1], (P('z:a'),)) + self.assertEqual(par[:2], (P('z:a'), P('z:'))) + self.assertEqual(par[1:], (P('z:'),)) + self.assertEqual(par[::2], (P('z:a'),)) + self.assertEqual(par[::-1], (P('z:'), P('z:a'))) self.assertEqual(list(par), [P('z:a'), P('z:')]) with self.assertRaises(IndexError): par[2] @@ -913,6 +934,12 @@ def test_parents(self): self.assertEqual(len(par), 2) self.assertEqual(par[0], P('z:/a')) self.assertEqual(par[1], P('z:/')) + self.assertEqual(par[0:1], (P('z:/a'),)) + self.assertEqual(par[0:-1], (P('z:/a'),)) + self.assertEqual(par[:2], (P('z:/a'), P('z:/'))) + self.assertEqual(par[1:], (P('z:/'),)) + self.assertEqual(par[::2], (P('z:/a'),)) + self.assertEqual(par[::-1], (P('z:/'), P('z:/a'),)) self.assertEqual(list(par), [P('z:/a'), P('z:/')]) with self.assertRaises(IndexError): par[2] @@ -921,6 +948,12 @@ def test_parents(self): self.assertEqual(len(par), 2) self.assertEqual(par[0], P('//a/b/c')) self.assertEqual(par[1], P('//a/b')) + self.assertEqual(par[0:1], (P('//a/b/c'),)) + self.assertEqual(par[0:-1], (P('//a/b/c'),)) + self.assertEqual(par[:2], (P('//a/b/c'), P('//a/b'))) + self.assertEqual(par[1:], (P('//a/b'),)) + self.assertEqual(par[::2], (P('//a/b/c'),)) + self.assertEqual(par[::-1], (P('//a/b'), P('//a/b/c'))) self.assertEqual(list(par), [P('//a/b/c'), P('//a/b')]) with self.assertRaises(IndexError): par[2] @@ -2186,6 +2219,8 @@ def test_is_fifo_false(self): self.assertIs((P / 'fileA\x00').is_fifo(), False) @unittest.skipUnless(hasattr(os, "mkfifo"), "os.mkfifo() required") + @unittest.skipIf(sys.platform == "vxworks", + "fifo requires special path on VxWorks") def test_is_fifo_true(self): P = self.cls(BASE, 'myfifo') try: diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py index 7d8cd54ba0e5b3..6a13b36d1cb70e 100644 --- a/Lib/test/test_pipes.py +++ b/Lib/test/test_pipes.py @@ -3,13 +3,16 @@ import string import unittest import shutil -from test.support import run_unittest, reap_children +from test.support import run_unittest, reap_children, unix_shell from test.support.os_helper import TESTFN, unlink if os.name != 'posix': raise unittest.SkipTest('pipes module only works on posix') +if not (unix_shell and os.path.exists(unix_shell)): + raise unittest.SkipTest('pipes module requires a shell') + TESTFN2 = TESTFN + "2" # tr a-z A-Z is not portable, so make the ranges explicit diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 9b6d93cb5fcda4..2c6fbee8b6ffb5 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -8,12 +8,70 @@ from test import support from test.support import os_helper +FEDORA_OS_RELEASE = """\ +NAME=Fedora +VERSION="32 (Thirty Two)" +ID=fedora +VERSION_ID=32 +VERSION_CODENAME="" +PLATFORM_ID="platform:f32" +PRETTY_NAME="Fedora 32 (Thirty Two)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:32" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=32 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=32 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +""" + +UBUNTU_OS_RELEASE = """\ +NAME="Ubuntu" +VERSION="20.04.1 LTS (Focal Fossa)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 20.04.1 LTS" +VERSION_ID="20.04" +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +VERSION_CODENAME=focal +UBUNTU_CODENAME=focal +""" + +TEST_OS_RELEASE = r""" +# test data +ID_LIKE="egg spam viking" +EMPTY= +# comments and empty lines are ignored + +SINGLE_QUOTE='single' +EMPTY_SINGLE='' +DOUBLE_QUOTE="double" +EMPTY_DOUBLE="" +QUOTES="double\'s" +SPECIALS="\$\`\\\'\"" +# invalid lines +=invalid += +INVALID +IN-VALID=value +IN VALID=value +""" + class PlatformTest(unittest.TestCase): def clear_caches(self): platform._platform_cache.clear() platform._sys_version_cache.clear() platform._uname_cache = None + platform._os_release_cache = None def test_architecture(self): res = platform.architecture() @@ -238,7 +296,10 @@ def test_mac_ver(self): # On Snow Leopard, sw_vers reports 10.6.0 as 10.6 if len_diff > 0: expect_list.extend(['0'] * len_diff) - self.assertEqual(result_list, expect_list) + # For compatibility with older binaries, macOS 11.x may report + # itself as '10.16' rather than '11.x.y'. + if result_list != ['10', '16']: + self.assertEqual(result_list, expect_list) # res[1] claims to contain # (version, dev_stage, non_release_version) @@ -379,6 +440,54 @@ def test_macos(self): self.assertEqual(platform.platform(terse=1), expected_terse) self.assertEqual(platform.platform(), expected) + def test_freedesktop_os_release(self): + self.addCleanup(self.clear_caches) + self.clear_caches() + + if any(os.path.isfile(fn) for fn in platform._os_release_candidates): + info = platform.freedesktop_os_release() + self.assertIn("NAME", info) + self.assertIn("ID", info) + + info["CPYTHON_TEST"] = "test" + self.assertNotIn( + "CPYTHON_TEST", + platform.freedesktop_os_release() + ) + else: + with self.assertRaises(OSError): + platform.freedesktop_os_release() + + def test_parse_os_release(self): + info = platform._parse_os_release(FEDORA_OS_RELEASE.splitlines()) + self.assertEqual(info["NAME"], "Fedora") + self.assertEqual(info["ID"], "fedora") + self.assertNotIn("ID_LIKE", info) + self.assertEqual(info["VERSION_CODENAME"], "") + + info = platform._parse_os_release(UBUNTU_OS_RELEASE.splitlines()) + self.assertEqual(info["NAME"], "Ubuntu") + self.assertEqual(info["ID"], "ubuntu") + self.assertEqual(info["ID_LIKE"], "debian") + self.assertEqual(info["VERSION_CODENAME"], "focal") + + info = platform._parse_os_release(TEST_OS_RELEASE.splitlines()) + expected = { + "ID": "linux", + "NAME": "Linux", + "PRETTY_NAME": "Linux", + "ID_LIKE": "egg spam viking", + "EMPTY": "", + "DOUBLE_QUOTE": "double", + "EMPTY_DOUBLE": "", + "SINGLE_QUOTE": "single", + "EMPTY_SINGLE": "", + "QUOTES": "double's", + "SPECIALS": "$`\\'\"", + } + self.assertEqual(info, expected) + self.assertEqual(len(info["SPECIALS"]), 5) + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 2ac345ddd68a95..548868362a397f 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -501,7 +501,7 @@ def server(self, evt, serv): conn, addr = serv.accept() conn.send(b"+ Hola mundo\n") conn.close() - except socket.timeout: + except TimeoutError: pass finally: serv.close() diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index a522717751ac17..185b293b070469 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -642,12 +642,17 @@ def test_stat(self): @unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()") def test_mkfifo(self): - os_helper.unlink(os_helper.TESTFN) + if sys.platform == "vxworks": + fifo_path = os.path.join("/fifos/", os_helper.TESTFN) + else: + fifo_path = os_helper.TESTFN + os_helper.unlink(fifo_path) + self.addCleanup(os_helper.unlink, fifo_path) try: - posix.mkfifo(os_helper.TESTFN, stat.S_IRUSR | stat.S_IWUSR) + posix.mkfifo(fifo_path, stat.S_IRUSR | stat.S_IWUSR) except PermissionError as e: self.skipTest('posix.mkfifo(): %s' % e) - self.assertTrue(stat.S_ISFIFO(posix.stat(os_helper.TESTFN).st_mode)) + self.assertTrue(stat.S_ISFIFO(posix.stat(fifo_path).st_mode)) @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'), "don't have mknod()/S_IFIFO") @@ -1056,7 +1061,7 @@ def test_getgroups(self): if sys.platform == 'darwin': import sysconfig dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0' - if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6): + if tuple(int(n) for n in str(dt).split('.')[0:2]) < (10, 6): raise unittest.SkipTest("getgroups(2) is broken prior to 10.6") # 'id -G' and 'os.getgroups()' should return the same @@ -1089,7 +1094,8 @@ def test_chmod_dir_fd(self): finally: posix.close(f) - @unittest.skipUnless(os.chown in os.supports_dir_fd, "test needs dir_fd support in os.chown()") + @unittest.skipUnless(hasattr(os, 'chown') and (os.chown in os.supports_dir_fd), + "test needs dir_fd support in os.chown()") def test_chown_dir_fd(self): os_helper.unlink(os_helper.TESTFN) os_helper.create_empty_file(os_helper.TESTFN) @@ -1184,7 +1190,9 @@ def test_mkdir_dir_fd(self): posix.close(f) os_helper.rmtree(os_helper.TESTFN + 'dir') - @unittest.skipUnless((os.mknod in os.supports_dir_fd) and hasattr(stat, 'S_IFIFO'), + @unittest.skipUnless(hasattr(os, 'mknod') + and (os.mknod in os.supports_dir_fd) + and hasattr(stat, 'S_IFIFO'), "test requires both stat.S_IFIFO and dir_fd support for os.mknod()") def test_mknod_dir_fd(self): # Test using mknodat() to create a FIFO (the only use specified @@ -1217,7 +1225,8 @@ def test_open_dir_fd(self): posix.close(a) posix.close(b) - @unittest.skipUnless(os.readlink in os.supports_dir_fd, "test needs dir_fd support in os.readlink()") + @unittest.skipUnless(hasattr(os, 'readlink') and (os.readlink in os.supports_dir_fd), + "test needs dir_fd support in os.readlink()") def test_readlink_dir_fd(self): os.symlink(os_helper.TESTFN, os_helper.TESTFN + 'link') f = posix.open(posix.getcwd(), posix.O_RDONLY) @@ -1929,7 +1938,7 @@ def test_posix_spawnp(self): class TestPosixWeaklinking(unittest.TestCase): # These test cases verify that weak linking support on macOS works # as expected. These cases only test new behaviour introduced by weak linking, - # regular behaviour is tested by the normal test cases. + # regular behaviour is tested by the normal test cases. # # See the section on Weak Linking in Mac/README.txt for more information. def setUp(self): diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index 8ee18e8fef84f7..c4a8578a9fc8fb 100644 --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -453,12 +453,23 @@ class AdvancedNamespace(types.SimpleNamespace): pass dog=8)""") def test_subclassing(self): + # length(repr(obj)) > width o = {'names with spaces': 'should be presented using repr()', 'others.should.not.be': 'like.this'} exp = """\ {'names with spaces': 'should be presented using repr()', others.should.not.be: like.this}""" - self.assertEqual(DottedPrettyPrinter().pformat(o), exp) + + dotted_printer = DottedPrettyPrinter() + self.assertEqual(dotted_printer.pformat(o), exp) + + # length(repr(obj)) < width + o1 = ['with space'] + exp1 = "['with space']" + self.assertEqual(dotted_printer.pformat(o1), exp1) + o2 = ['without.space'] + exp2 = "[without.space]" + self.assertEqual(dotted_printer.pformat(o2), exp2) def test_set_reprs(self): self.assertEqual(pprint.pformat(set()), 'set()') diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 7ca0557800b6d8..190d8d787a2cc9 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -14,9 +14,21 @@ import io # readline import unittest +import struct +import tty +import fcntl +import warnings + TEST_STRING_1 = b"I wish to buy a fish license.\n" TEST_STRING_2 = b"For my pet fish, Eric.\n" +try: + _TIOCGWINSZ = tty.TIOCGWINSZ + _TIOCSWINSZ = tty.TIOCSWINSZ + _HAVE_WINSZ = True +except AttributeError: + _HAVE_WINSZ = False + if verbose: def debug(msg): print(msg) @@ -60,6 +72,21 @@ def _readline(fd): reader = io.FileIO(fd, mode='rb', closefd=False) return reader.readline() +def expectedFailureIfStdinIsTTY(fun): + # avoid isatty() + try: + tty.tcgetattr(pty.STDIN_FILENO) + return unittest.expectedFailure(fun) + except tty.error: + pass + return fun + +def _get_term_winsz(fd): + s = struct.pack("HHHH", 0, 0, 0, 0) + return fcntl.ioctl(fd, _TIOCGWINSZ, s) + +def _set_term_winsz(fd, winsz): + fcntl.ioctl(fd, _TIOCSWINSZ, winsz) # Marginal testing of pty suite. Cannot do extensive 'do or fail' testing @@ -78,6 +105,20 @@ def setUp(self): self.addCleanup(signal.alarm, 0) signal.alarm(10) + # Save original stdin window size + self.stdin_rows = None + self.stdin_cols = None + if _HAVE_WINSZ: + try: + stdin_dim = os.get_terminal_size(pty.STDIN_FILENO) + self.stdin_rows = stdin_dim.lines + self.stdin_cols = stdin_dim.columns + old_stdin_winsz = struct.pack("HHHH", self.stdin_rows, + self.stdin_cols, 0, 0) + self.addCleanup(_set_term_winsz, pty.STDIN_FILENO, old_stdin_winsz) + except OSError: + pass + def handle_sig(self, sig, frame): self.fail("isatty hung") @@ -86,26 +127,70 @@ def handle_sighup(signum, frame): # bpo-38547: if the process is the session leader, os.close(master_fd) # of "master_fd, slave_name = pty.master_open()" raises SIGHUP # signal: just ignore the signal. + # + # NOTE: the above comment is from an older version of the test; + # master_open() is not being used anymore. pass - def test_basic(self): + @expectedFailureIfStdinIsTTY + def test_openpty(self): try: - debug("Calling master_open()") - master_fd, slave_name = pty.master_open() - debug("Got master_fd '%d', slave_name '%s'" % - (master_fd, slave_name)) - debug("Calling slave_open(%r)" % (slave_name,)) - slave_fd = pty.slave_open(slave_name) - debug("Got slave_fd '%d'" % slave_fd) + mode = tty.tcgetattr(pty.STDIN_FILENO) + except tty.error: + # not a tty or bad/closed fd + debug("tty.tcgetattr(pty.STDIN_FILENO) failed") + mode = None + + new_stdin_winsz = None + if self.stdin_rows != None and self.stdin_cols != None: + try: + # Modify pty.STDIN_FILENO window size; we need to + # check if pty.openpty() is able to set pty slave + # window size accordingly. + debug("Setting pty.STDIN_FILENO window size") + debug(f"original size: (rows={self.stdin_rows}, cols={self.stdin_cols})") + target_stdin_rows = self.stdin_rows + 1 + target_stdin_cols = self.stdin_cols + 1 + debug(f"target size: (rows={target_stdin_rows}, cols={target_stdin_cols})") + target_stdin_winsz = struct.pack("HHHH", target_stdin_rows, + target_stdin_cols, 0, 0) + _set_term_winsz(pty.STDIN_FILENO, target_stdin_winsz) + + # Were we able to set the window size + # of pty.STDIN_FILENO successfully? + new_stdin_winsz = _get_term_winsz(pty.STDIN_FILENO) + self.assertEqual(new_stdin_winsz, target_stdin_winsz, + "pty.STDIN_FILENO window size unchanged") + except OSError: + warnings.warn("Failed to set pty.STDIN_FILENO window size") + pass + + try: + debug("Calling pty.openpty()") + try: + master_fd, slave_fd = pty.openpty(mode, new_stdin_winsz) + except TypeError: + master_fd, slave_fd = pty.openpty() + debug(f"Got master_fd '{master_fd}', slave_fd '{slave_fd}'") except OSError: # " An optional feature could not be imported " ... ? raise unittest.SkipTest("Pseudo-terminals (seemingly) not functional.") - self.assertTrue(os.isatty(slave_fd), 'slave_fd is not a tty') + self.assertTrue(os.isatty(slave_fd), "slave_fd is not a tty") + + if mode: + self.assertEqual(tty.tcgetattr(slave_fd), mode, + "openpty() failed to set slave termios") + if new_stdin_winsz: + self.assertEqual(_get_term_winsz(slave_fd), new_stdin_winsz, + "openpty() failed to set slave window size") # Solaris requires reading the fd before anything is returned. # My guess is that since we open and close the slave fd # in master_open(), we need to read the EOF. + # + # NOTE: the above comment is from an older version of the test; + # master_open() is not being used anymore. # Ensure the fd is non-blocking in case there's nothing to read. blocking = os.get_blocking(master_fd) @@ -222,8 +307,22 @@ def test_fork(self): os.close(master_fd) - # pty.fork() passed. + def test_master_read(self): + debug("Calling pty.openpty()") + master_fd, slave_fd = pty.openpty() + debug(f"Got master_fd '{master_fd}', slave_fd '{slave_fd}'") + debug("Closing slave_fd") + os.close(slave_fd) + + debug("Reading from master_fd") + try: + data = os.read(master_fd, 1) + except OSError: # Linux + data = b"" + + os.close(master_fd) + self.assertEqual(data, b"") class SmallPtyTests(unittest.TestCase): """These tests don't spawn children or hang.""" @@ -262,8 +361,9 @@ def _socketpair(self): self.files.extend(socketpair) return socketpair - def _mock_select(self, rfds, wfds, xfds): + def _mock_select(self, rfds, wfds, xfds, timeout=0): # This will raise IndexError when no more expected calls exist. + # This ignores the timeout self.assertEqual(self.select_rfds_lengths.pop(0), len(rfds)) return self.select_rfds_results.pop(0), [], [] diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 1bfbcb853c4ed1..c1d02cfaf0dcb6 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2197,6 +2197,10 @@ def test_overlap_table(self): self.assertEqual(f("ababba"), [0, 0, 1, 2, 0, 1]) self.assertEqual(f("abcabdac"), [0, 0, 0, 1, 2, 0, 1, 0]) + def test_signedness(self): + self.assertGreaterEqual(sre_compile.MAXREPEAT, 0) + self.assertGreaterEqual(sre_compile.MAXGROUPS, 0) + class ExternalTests(unittest.TestCase): diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 890f2c7d406c24..df7fbedf24a7c2 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -683,6 +683,8 @@ def custom_cpfun(a, b): # Issue #3002: copyfile and copytree block indefinitely on named pipes @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') @os_helper.skip_unless_symlink + @unittest.skipIf(sys.platform == "vxworks", + "fifo requires special path on VxWorks") def test_copytree_named_pipe(self): os.mkdir(TESTFN) try: @@ -1206,6 +1208,8 @@ def test_dont_copy_file_onto_symlink_to_itself(self): # Issue #3002: copyfile and copytree block indefinitely on named pipes @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') + @unittest.skipIf(sys.platform == "vxworks", + "fifo requires special path on VxWorks") def test_copyfile_named_pipe(self): try: os.mkfifo(TESTFN) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index c6567906321fe1..6a43fe70372c55 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -519,16 +519,20 @@ def handler(signum, frame): else: write.setblocking(False) - # Start with large chunk size to reduce the - # number of send needed to fill the buffer. written = 0 - for chunk_size in (2 ** 16, 2 ** 8, 1): + if sys.platform == "vxworks": + CHUNK_SIZES = (1,) + else: + # Start with large chunk size to reduce the + # number of send needed to fill the buffer. + CHUNK_SIZES = (2 ** 16, 2 ** 8, 1) + for chunk_size in CHUNK_SIZES: chunk = b"x" * chunk_size try: while True: write.send(chunk) written += chunk_size - except (BlockingIOError, socket.timeout): + except (BlockingIOError, TimeoutError): pass print(f"%s bytes written into the socketpair" % written, flush=True) @@ -595,6 +599,7 @@ def handler(signum, frame): @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +@unittest.skipUnless(hasattr(signal, 'siginterrupt'), "needs signal.siginterrupt()") class SiginterruptTest(unittest.TestCase): def readpipe_interrupted(self, interrupt): @@ -680,6 +685,8 @@ def test_siginterrupt_off(self): @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") +@unittest.skipUnless(hasattr(signal, 'getitimer') and hasattr(signal, 'setitimer'), + "needs signal.getitimer() and signal.setitimer()") class ItimerTest(unittest.TestCase): def setUp(self): self.hndl_called = False diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 7816ed34886e95..91985384ec7ff9 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -40,7 +40,7 @@ def server(evt, buf, serv): evt.set() try: conn, addr = serv.accept() - except socket.timeout: + except TimeoutError: pass else: n = 500 @@ -193,7 +193,7 @@ def debugging_server(serv, serv_evt, client_evt): n -= 1 - except socket.timeout: + except TimeoutError: pass finally: if not client_evt.is_set(): diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 80638325ba3a05..e4af713b4c5bf7 100755 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1611,7 +1611,7 @@ def raising_handler(*args): if with_timeout: signal.signal(signal.SIGALRM, ok_handler) signal.alarm(1) - self.assertRaises(socket.timeout, c.sendall, + self.assertRaises(TimeoutError, c.sendall, b"x" * support.SOCK_MAX_SIZE) finally: signal.alarm(0) @@ -1738,6 +1738,7 @@ def test_getaddrinfo_ipv6_basic(self): @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'IPv6 required for this test.') @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows') @unittest.skipIf(AIX, 'Symbolic scope id does not work') + @unittest.skipUnless(hasattr(socket, 'if_nameindex'), "test needs socket.if_nameindex()") def test_getaddrinfo_ipv6_scopeid_symbolic(self): # Just pick up any network interface (Linux, Mac OS X) (ifindex, test_interface) = socket.if_nameindex()[0] @@ -1770,6 +1771,7 @@ def test_getaddrinfo_ipv6_scopeid_numeric(self): @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'IPv6 required for this test.') @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows') @unittest.skipIf(AIX, 'Symbolic scope id does not work') + @unittest.skipUnless(hasattr(socket, 'if_nameindex'), "test needs socket.if_nameindex()") def test_getnameinfo_ipv6_scopeid_symbolic(self): # Just pick up any network interface. (ifindex, test_interface) = socket.if_nameindex()[0] @@ -2966,7 +2968,7 @@ def _testSendmsgTimeout(self): try: while True: self.sendmsgToServer([b"a"*512]) - except socket.timeout: + except TimeoutError: pass except OSError as exc: if exc.errno != errno.ENOMEM: @@ -2974,7 +2976,7 @@ def _testSendmsgTimeout(self): # bpo-33937 the test randomly fails on Travis CI with # "OSError: [Errno 12] Cannot allocate memory" else: - self.fail("socket.timeout not raised") + self.fail("TimeoutError not raised") finally: self.misc_event.set() @@ -3109,7 +3111,7 @@ def testRecvmsgTimeout(self): # Check that timeout works. try: self.serv_sock.settimeout(0.03) - self.assertRaises(socket.timeout, + self.assertRaises(TimeoutError, self.doRecvmsg, self.serv_sock, len(MSG)) finally: self.misc_event.set() @@ -4827,7 +4829,7 @@ def testReadAfterTimeout(self): self.cli_conn.settimeout(1) self.read_file.read(3) # First read raises a timeout - self.assertRaises(socket.timeout, self.read_file.read, 1) + self.assertRaises(TimeoutError, self.read_file.read, 1) # Second read is disallowed with self.assertRaises(OSError) as ctx: self.read_file.read(1) @@ -5092,7 +5094,7 @@ class NetworkConnectionNoServer(unittest.TestCase): class MockSocket(socket.socket): def connect(self, *args): - raise socket.timeout('timed out') + raise TimeoutError('timed out') @contextlib.contextmanager def mocked_socket_module(self): @@ -5142,13 +5144,13 @@ def test_create_connection_timeout(self): with self.mocked_socket_module(): try: socket.create_connection((HOST, 1234)) - except socket.timeout: + except TimeoutError: pass except OSError as exc: if socket_helper.IPV6_ENABLED or exc.errno != errno.EAFNOSUPPORT: raise else: - self.fail('socket.timeout not raised') + self.fail('TimeoutError not raised') class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): @@ -5250,7 +5252,7 @@ def _testInsideTimeout(self): def _testOutsideTimeout(self): self.cli = sock = socket.create_connection((HOST, self.port), timeout=1) - self.assertRaises(socket.timeout, lambda: sock.recv(5)) + self.assertRaises(TimeoutError, lambda: sock.recv(5)) class TCPTimeoutTest(SocketTCPTest): @@ -5259,7 +5261,7 @@ def testTCPTimeout(self): def raise_timeout(*args, **kwargs): self.serv.settimeout(1.0) self.serv.accept() - self.assertRaises(socket.timeout, raise_timeout, + self.assertRaises(TimeoutError, raise_timeout, "Error generating a timeout exception (TCP)") def testTimeoutZero(self): @@ -5267,7 +5269,7 @@ def testTimeoutZero(self): try: self.serv.settimeout(0.0) foo = self.serv.accept() - except socket.timeout: + except TimeoutError: self.fail("caught timeout instead of error (TCP)") except OSError: ok = True @@ -5292,7 +5294,7 @@ def alarm_handler(signal, frame): try: signal.alarm(2) # POSIX allows alarm to be up to 1 second early foo = self.serv.accept() - except socket.timeout: + except TimeoutError: self.fail("caught timeout instead of Alarm") except Alarm: pass @@ -5316,7 +5318,7 @@ def testUDPTimeout(self): def raise_timeout(*args, **kwargs): self.serv.settimeout(1.0) self.serv.recv(1024) - self.assertRaises(socket.timeout, raise_timeout, + self.assertRaises(TimeoutError, raise_timeout, "Error generating a timeout exception (UDP)") def testTimeoutZero(self): @@ -5324,7 +5326,7 @@ def testTimeoutZero(self): try: self.serv.settimeout(0.0) foo = self.serv.recv(1024) - except socket.timeout: + except TimeoutError: self.fail("caught timeout instead of error (UDP)") except OSError: ok = True @@ -5341,7 +5343,7 @@ def testUDPLITETimeout(self): def raise_timeout(*args, **kwargs): self.serv.settimeout(1.0) self.serv.recv(1024) - self.assertRaises(socket.timeout, raise_timeout, + self.assertRaises(TimeoutError, raise_timeout, "Error generating a timeout exception (UDPLITE)") def testTimeoutZero(self): @@ -5349,7 +5351,7 @@ def testTimeoutZero(self): try: self.serv.settimeout(0.0) foo = self.serv.recv(1024) - except socket.timeout: + except TimeoutError: self.fail("caught timeout instead of error (UDPLITE)") except OSError: ok = True @@ -5365,6 +5367,8 @@ def testExceptionTree(self): self.assertTrue(issubclass(socket.herror, OSError)) self.assertTrue(issubclass(socket.gaierror, OSError)) self.assertTrue(issubclass(socket.timeout, OSError)) + self.assertIs(socket.error, OSError) + self.assertIs(socket.timeout, TimeoutError) def test_setblocking_invalidfd(self): # Regression test for issue #28471 @@ -6167,7 +6171,7 @@ def _testWithTimeoutTriggeredSend(self): with socket.create_connection(address) as sock: sock.settimeout(0.01) meth = self.meth_from_sock(sock) - self.assertRaises(socket.timeout, meth, file) + self.assertRaises(TimeoutError, meth, file) def testWithTimeoutTriggeredSend(self): conn = self.accept_conn() diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 26eec969a82e0d..67850c34e00c20 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -391,7 +391,7 @@ def test_random(self): ssl.RAND_add(b"this is a random bytes object", 75.0) ssl.RAND_add(bytearray(b"this is a random bytearray object"), 75.0) - @unittest.skipUnless(os.name == 'posix', 'requires posix') + @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork') def test_random_fork(self): status = ssl.RAND_status() if not status: @@ -2574,7 +2574,7 @@ def run(self): handler = self.ConnectionHandler(self, newconn, connaddr) handler.start() handler.join() - except socket.timeout: + except TimeoutError: pass except KeyboardInterrupt: self.stop() @@ -3691,7 +3691,7 @@ def serve(): c.settimeout(0.2) c.connect((host, port)) # Will attempt handshake and time out - self.assertRaisesRegex(socket.timeout, "timed out", + self.assertRaisesRegex(TimeoutError, "timed out", test_wrap_socket, c) finally: c.close() @@ -3700,7 +3700,7 @@ def serve(): c = test_wrap_socket(c) c.settimeout(0.2) # Will attempt handshake and time out - self.assertRaisesRegex(socket.timeout, "timed out", + self.assertRaisesRegex(TimeoutError, "timed out", c.connect, (host, port)) finally: c.close() @@ -3854,6 +3854,7 @@ def test_min_max_version_tlsv1_1(self): @requires_minimum_version @requires_tls_version('TLSv1_2') + @requires_tls_version('TLSv1') def test_min_max_version_mismatch(self): client_context, server_context, hostname = testing_context() # client 1.0, server 1.2 (mismatch) diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py index 83d09e17f93c56..2e1e2c349c8d09 100644 --- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -2,6 +2,7 @@ import os import socket import sys +from test.support import os_helper from test.support import socket_helper from test.support.import_helper import import_fresh_module from test.support.os_helper import TESTFN @@ -173,11 +174,16 @@ def test_link(self): @unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available') def test_fifo(self): + if sys.platform == "vxworks": + fifo_path = os.path.join("/fifos/", TESTFN) + else: + fifo_path = TESTFN + self.addCleanup(os_helper.unlink, fifo_path) try: - os.mkfifo(TESTFN, 0o700) + os.mkfifo(fifo_path, 0o700) except PermissionError as e: self.skipTest('os.mkfifo(): %s' % e) - st_mode, modestr = self.get_mode() + st_mode, modestr = self.get_mode(fifo_path) self.assertEqual(modestr, 'prwx------') self.assertS_IS("FIFO", st_mode) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index e25474abed4b78..2a4c47530e6a1b 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -3229,6 +3229,19 @@ def test_send_signal_race(self): # so Popen failed to read it and uses a default returncode instead. self.assertIsNotNone(proc.returncode) + def test_send_signal_race2(self): + # bpo-40550: the process might exist between the returncode check and + # the kill operation + p = subprocess.Popen([sys.executable, '-c', 'exit(1)']) + + # wait for process to exit + while not p.returncode: + p.poll() + + with mock.patch.object(p, 'poll', new=lambda: None): + p.returncode = None + p.send_signal(signal.SIGTERM) + def test_communicate_repeated_call_after_stdout_close(self): proc = subprocess.Popen([sys.executable, '-c', 'import os, time; os.close(1), time.sleep(2)'], diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py index 04e572c00a1969..aab074b8a9b277 100644 --- a/Lib/test/test_sundry.py +++ b/Lib/test/test_sundry.py @@ -9,7 +9,7 @@ class TestUntestedModules(unittest.TestCase): def test_untested_modules_can_be_imported(self): - untested = ('encodings', 'formatter') + untested = ('encodings',) with warnings_helper.check_warnings(quiet=True): for name in untested: try: diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 173ef9ebb4c195..3860656c181c2b 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -221,7 +221,7 @@ def test_recursionlimit_recovery(self): def f(): f() try: - for depth in (10, 25, 50, 75, 100, 250, 1000): + for depth in (50, 75, 100, 250, 1000): try: sys.setrecursionlimit(depth) except RecursionError: @@ -231,17 +231,17 @@ def f(): # Issue #5392: test stack overflow after hitting recursion # limit twice - self.assertRaises(RecursionError, f) - self.assertRaises(RecursionError, f) + with self.assertRaises(RecursionError): + f() + with self.assertRaises(RecursionError): + f() finally: sys.setrecursionlimit(oldlimit) @test.support.cpython_only def test_setrecursionlimit_recursion_depth(self): # Issue #25274: Setting a low recursion limit must be blocked if the - # current recursion depth is already higher than the "lower-water - # mark". Otherwise, it may not be possible anymore to - # reset the overflowed flag to 0. + # current recursion depth is already higher than limit. from _testinternalcapi import get_recursion_depth @@ -262,42 +262,10 @@ def set_recursion_limit_at_depth(depth, limit): sys.setrecursionlimit(1000) for limit in (10, 25, 50, 75, 100, 150, 200): - # formula extracted from _Py_RecursionLimitLowerWaterMark() - if limit > 200: - depth = limit - 50 - else: - depth = limit * 3 // 4 - set_recursion_limit_at_depth(depth, limit) + set_recursion_limit_at_depth(limit, limit) finally: sys.setrecursionlimit(oldlimit) - # The error message is specific to CPython - @test.support.cpython_only - def test_recursionlimit_fatalerror(self): - # A fatal error occurs if a second recursion limit is hit when recovering - # from a first one. - code = textwrap.dedent(""" - import sys - - def f(): - try: - f() - except RecursionError: - f() - - sys.setrecursionlimit(%d) - f()""") - with test.support.SuppressCrashReport(): - for i in (50, 1000): - sub = subprocess.Popen([sys.executable, '-c', code % i], - stderr=subprocess.PIPE) - err = sub.communicate()[1] - self.assertTrue(sub.returncode, sub.returncode) - self.assertIn( - b"Fatal Python error: _Py_CheckRecursiveCall: " - b"Cannot recover from stack overflow", - err) - def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute test.support.get_attribute(sys, "getwindowsversion") diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 66b1b360bec1db..ccdb5c2c51a0fe 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -990,7 +990,7 @@ def test_no_jump_over_return_try_finally_in_finally_block(output): pass output.append(12) - @jump_test(3, 4, [1], (ValueError, 'unreachable')) + @jump_test(3, 4, [1], (ValueError, 'after')) def test_no_jump_infinite_while_loop(output): output.append(1) while True: diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index d07d28df607ce7..352dbdea817e63 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -360,10 +360,12 @@ def test_SO_value(self): @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None, 'EXT_SUFFIX required for this test') - def test_SO_in_vars(self): + def test_EXT_SUFFIX_in_vars(self): + import _imp vars = sysconfig.get_config_vars() self.assertIsNotNone(vars['SO']) self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) + self.assertEqual(vars['EXT_SUFFIX'], _imp.extension_suffixes()[0]) @unittest.skipUnless(sys.platform == 'linux' and hasattr(sys.implementation, '_multiarch'), diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 7b34d53d216013..77ad8305c3107a 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1347,10 +1347,10 @@ def test_extractall_symlinks(self): f.write('something\n') os.symlink(source_file, target_file) with tarfile.open(temparchive, 'w') as tar: - tar.add(source_file) - tar.add(target_file) + tar.add(source_file, arcname="source") + tar.add(target_file, arcname="symlink") # Let's extract it to the location which contains the symlink - with tarfile.open(temparchive) as tar: + with tarfile.open(temparchive, errorlevel=2) as tar: # this should not raise OSError: [Errno 17] File exists try: tar.extractall(path=tempdir) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index cd2a30e533ae03..d104eb89104215 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -1,4 +1,5 @@ import unittest +import locale import re import subprocess import sys @@ -61,6 +62,10 @@ def test_eval_null_in_result(self): tcl = self.interp self.assertEqual(tcl.eval('set a "a\\0b"'), 'a\x00b') + def test_eval_surrogates_in_result(self): + tcl = self.interp + self.assertIn(tcl.eval(r'set a "<\ud83d\udcbb>"'), '<\U0001f4bb>') + def testEvalException(self): tcl = self.interp self.assertRaises(TclError,tcl.eval,'set a') @@ -193,29 +198,48 @@ def test_getboolean(self): def testEvalFile(self): tcl = self.interp - with open(os_helper.TESTFN, 'w') as f: - self.addCleanup(os_helper.unlink, os_helper.TESTFN) + filename = os_helper.TESTFN_ASCII + self.addCleanup(os_helper.unlink, filename) + with open(filename, 'w') as f: f.write("""set a 1 set b 2 set c [ expr $a + $b ] """) - tcl.evalfile(os_helper.TESTFN) + tcl.evalfile(filename) self.assertEqual(tcl.eval('set a'),'1') self.assertEqual(tcl.eval('set b'),'2') self.assertEqual(tcl.eval('set c'),'3') def test_evalfile_null_in_result(self): tcl = self.interp - with open(os_helper.TESTFN, 'w') as f: - self.addCleanup(os_helper.unlink, os_helper.TESTFN) + filename = os_helper.TESTFN_ASCII + self.addCleanup(os_helper.unlink, filename) + with open(filename, 'w') as f: f.write(""" set a "a\0b" set b "a\\0b" """) - tcl.evalfile(os_helper.TESTFN) + tcl.evalfile(filename) self.assertEqual(tcl.eval('set a'), 'a\x00b') self.assertEqual(tcl.eval('set b'), 'a\x00b') + def test_evalfile_surrogates_in_result(self): + tcl = self.interp + encoding = tcl.call('encoding', 'system') + self.addCleanup(tcl.call, 'encoding', 'system', encoding) + tcl.call('encoding', 'system', 'utf-8') + + filename = os_helper.TESTFN_ASCII + self.addCleanup(os_helper.unlink, filename) + with open(filename, 'wb') as f: + f.write(b""" + set a "<\xed\xa0\xbd\xed\xb2\xbb>" + set b "<\\ud83d\\udcbb>" + """) + tcl.evalfile(filename) + self.assertEqual(tcl.eval('set a'), '<\U0001f4bb>') + self.assertEqual(tcl.eval('set b'), '<\U0001f4bb>') + def testEvalFileException(self): tcl = self.interp filename = "doesnotexists" @@ -438,6 +462,11 @@ def passValue(value): self.assertEqual(passValue('str\x00ing\u20ac'), 'str\x00ing\u20ac') self.assertEqual(passValue('str\x00ing\U0001f4bb'), 'str\x00ing\U0001f4bb') + if sys.platform != 'win32': + self.assertEqual(passValue('<\udce2\udc82\udcac>'), + '<\u20ac>') + self.assertEqual(passValue('<\udced\udca0\udcbd\udced\udcb2\udcbb>'), + '<\U0001f4bb>') self.assertEqual(passValue(b'str\x00ing'), b'str\x00ing' if self.wantobjects else 'str\x00ing') self.assertEqual(passValue(b'str\xc0\x80ing'), @@ -497,6 +526,9 @@ def float_eq(actual, expected): check('string\xbd') check('string\u20ac') check('string\U0001f4bb') + if sys.platform != 'win32': + check('<\udce2\udc82\udcac>', '<\u20ac>') + check('<\udced\udca0\udcbd\udced\udcb2\udcbb>', '<\U0001f4bb>') check('') check(b'string', 'string') check(b'string\xe2\x82\xac', 'string\xe2\x82\xac') @@ -540,6 +572,8 @@ def test_splitlist(self): ('a \u20ac', ('a', '\u20ac')), ('a \U0001f4bb', ('a', '\U0001f4bb')), (b'a \xe2\x82\xac', ('a', '\u20ac')), + (b'a \xf0\x9f\x92\xbb', ('a', '\U0001f4bb')), + (b'a \xed\xa0\xbd\xed\xb2\xbb', ('a', '\U0001f4bb')), (b'a\xc0\x80b c\xc0\x80d', ('a\x00b', 'c\x00d')), ('a {b c}', ('a', 'b c')), (r'a b\ c', ('a', 'b c')), diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py index 7633901c96c84e..8e36051cd095ba 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -16,7 +16,7 @@ def server(evt, serv): try: conn, addr = serv.accept() conn.close() - except socket.timeout: + except TimeoutError: pass finally: serv.close() diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index e0e5406ac26a1e..864cea313aea52 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -469,6 +469,35 @@ def test_daemon_param(self): t = threading.Thread(daemon=True) self.assertTrue(t.daemon) + @unittest.skipUnless(hasattr(os, 'fork'), 'needs os.fork()') + def test_fork_at_exit(self): + # bpo-42350: Calling os.fork() after threading._shutdown() must + # not log an error. + code = textwrap.dedent(""" + import atexit + import os + import sys + from test.support import wait_process + + # Import the threading module to register its "at fork" callback + import threading + + def exit_handler(): + pid = os.fork() + if not pid: + print("child process ok", file=sys.stderr, flush=True) + # child process + sys.exit() + else: + wait_process(pid, exitcode=0) + + # exit_handler() will be called after threading._shutdown() + atexit.register(exit_handler) + """) + _, out, err = assert_python_ok("-c", code) + self.assertEqual(out, b'') + self.assertEqual(err.rstrip(), b'child process ok') + @unittest.skipUnless(hasattr(os, 'fork'), 'test needs fork()') def test_dummy_thread_after_fork(self): # Issue #14308: a dummy thread in the active list doesn't mess up @@ -1352,6 +1381,27 @@ def sys_hook(exc_type, exc_value, exc_traceback): 'Exception in threading.excepthook:\n') self.assertEqual(err_str, 'threading_hook failed') + def test_original_excepthook(self): + def run_thread(): + with support.captured_output("stderr") as output: + thread = ThreadRunFail(name="excepthook thread") + thread.start() + thread.join() + return output.getvalue() + + def threading_hook(args): + print("Running a thread failed", file=sys.stderr) + + default_output = run_thread() + with support.swap_attr(threading, 'excepthook', threading_hook): + custom_hook_output = run_thread() + threading.excepthook = threading.__excepthook__ + recovered_output = run_thread() + + self.assertEqual(default_output, recovered_output) + self.assertNotEqual(default_output, custom_hook_output) + self.assertEqual(custom_hook_output, "Running a thread failed\n") + class TimerTests(BaseTestCase): diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py index ac803f5d638237..823d5c3e1767e4 100644 --- a/Lib/test/test_timeout.py +++ b/Lib/test/test_timeout.py @@ -122,7 +122,7 @@ def _sock_operation(self, count, timeout, method, *args): """ Test the specified socket method. - The method is run at most `count` times and must raise a socket.timeout + The method is run at most `count` times and must raise a TimeoutError within `timeout` + self.fuzz seconds. """ self.sock.settimeout(timeout) @@ -131,11 +131,11 @@ def _sock_operation(self, count, timeout, method, *args): t1 = time.monotonic() try: method(*args) - except socket.timeout as e: + except TimeoutError as e: delta = time.monotonic() - t1 break else: - self.fail('socket.timeout was not raised') + self.fail('TimeoutError was not raised') # These checks should account for timing unprecision self.assertLess(delta, timeout + self.fuzz) self.assertGreater(delta, timeout - 1.0) @@ -204,7 +204,7 @@ def testConnectTimeout(self): sock.settimeout(timeout) try: sock.connect((whitehole)) - except socket.timeout: + except TimeoutError: pass except OSError as err: if err.errno == errno.ECONNREFUSED: diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 91688ff72bbea1..5df701caf0f01e 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -1123,7 +1123,19 @@ def test_context(self): self.assertEqual(exc_info[0], exc.exc_type) self.assertEqual(str(exc_info[1]), str(exc)) - def test_comparison(self): + def test_no_refs_to_exception_and_traceback_objects(self): + try: + 1/0 + except Exception: + exc_info = sys.exc_info() + + refcnt1 = sys.getrefcount(exc_info[1]) + refcnt2 = sys.getrefcount(exc_info[2]) + exc = traceback.TracebackException(*exc_info) + self.assertEqual(sys.getrefcount(exc_info[1]), refcnt1) + self.assertEqual(sys.getrefcount(exc_info[2]), refcnt2) + + def test_comparison_basic(self): try: 1/0 except Exception: @@ -1135,6 +1147,53 @@ def test_comparison(self): self.assertNotEqual(exc, object()) self.assertEqual(exc, ALWAYS_EQ) + def test_comparison_params_variations(self): + def raise_exc(): + try: + raise ValueError('bad value') + except: + raise + + def raise_with_locals(): + x, y = 1, 2 + raise_exc() + + try: + raise_with_locals() + except Exception: + exc_info = sys.exc_info() + + exc = traceback.TracebackException(*exc_info) + exc1 = traceback.TracebackException(*exc_info, limit=10) + exc2 = traceback.TracebackException(*exc_info, limit=2) + + self.assertEqual(exc, exc1) # limit=10 gets all frames + self.assertNotEqual(exc, exc2) # limit=2 truncates the output + + # locals change the output + exc3 = traceback.TracebackException(*exc_info, capture_locals=True) + self.assertNotEqual(exc, exc3) + + # there are no locals in the innermost frame + exc4 = traceback.TracebackException(*exc_info, limit=-1) + exc5 = traceback.TracebackException(*exc_info, limit=-1, capture_locals=True) + self.assertEqual(exc4, exc5) + + # there are locals in the next-to-innermost frame + exc6 = traceback.TracebackException(*exc_info, limit=-2) + exc7 = traceback.TracebackException(*exc_info, limit=-2, capture_locals=True) + self.assertNotEqual(exc6, exc7) + + def test_comparison_equivalent_exceptions_are_equal(self): + excs = [] + for _ in range(2): + try: + 1/0 + except: + excs.append(traceback.TracebackException(*sys.exc_info())) + self.assertEqual(excs[0], excs[1]) + self.assertEqual(list(excs[0].format()), list(excs[1].format())) + def test_unhashable(self): class UnhashableException(Exception): def __eq__(self, other): @@ -1176,7 +1235,7 @@ def test_lookup_lines(self): f = test_frame(c, None, None) tb = test_tb(f, 6, None) exc = traceback.TracebackException(Exception, e, tb, lookup_lines=False) - self.assertEqual({}, linecache.cache) + self.assertEqual(linecache.cache, {}) linecache.updatecache('/foo.py', globals()) self.assertEqual(exc.stack[0].line, "import sys") diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 2ab8be49b2875a..8ffc7f40cebdd2 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -528,6 +528,7 @@ def test_repr(self): self.assertEqual(repr(Literal[int]), "typing.Literal[int]") self.assertEqual(repr(Literal), "typing.Literal") self.assertEqual(repr(Literal[None]), "typing.Literal[None]") + self.assertEqual(repr(Literal[1, 2, 3, 3]), "typing.Literal[1, 2, 3]") def test_cannot_init(self): with self.assertRaises(TypeError): @@ -559,6 +560,35 @@ def test_no_multiple_subscripts(self): with self.assertRaises(TypeError): Literal[1][1] + def test_equal(self): + self.assertNotEqual(Literal[0], Literal[False]) + self.assertNotEqual(Literal[True], Literal[1]) + self.assertNotEqual(Literal[1], Literal[2]) + self.assertNotEqual(Literal[1, True], Literal[1]) + self.assertEqual(Literal[1], Literal[1]) + self.assertEqual(Literal[1, 2], Literal[2, 1]) + self.assertEqual(Literal[1, 2, 3], Literal[1, 2, 3, 3]) + + def test_hash(self): + self.assertEqual(hash(Literal[1]), hash(Literal[1])) + self.assertEqual(hash(Literal[1, 2]), hash(Literal[2, 1])) + self.assertEqual(hash(Literal[1, 2, 3]), hash(Literal[1, 2, 3, 3])) + + def test_args(self): + self.assertEqual(Literal[1, 2, 3].__args__, (1, 2, 3)) + self.assertEqual(Literal[1, 2, 3, 3].__args__, (1, 2, 3)) + self.assertEqual(Literal[1, Literal[2], Literal[3, 4]].__args__, (1, 2, 3, 4)) + # Mutable arguments will not be deduplicated + self.assertEqual(Literal[[], []].__args__, ([], [])) + + def test_flatten(self): + l1 = Literal[Literal[1], Literal[2], Literal[3]] + l2 = Literal[Literal[1, 2], 3] + l3 = Literal[Literal[1, 2, 3]] + for l in l1, l2, l3: + self.assertEqual(l, Literal[1, 2, 3]) + self.assertEqual(l.__args__, (1, 2, 3)) + XK = TypeVar('XK', str, bytes) XV = TypeVar('XV') diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 532aa3a6390414..c7c8613ea2793f 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -152,6 +152,18 @@ def test_fstrings(self): # See issue 25180 self.check_ast_roundtrip(r"""f'{f"{0}"*3}'""") self.check_ast_roundtrip(r"""f'{f"{y}"*3}'""") + self.check_ast_roundtrip("""f''""") + self.check_ast_roundtrip('''f"""'end' "quote\\""""''') + + def test_fstrings_complicated(self): + # See issue 28002 + self.check_ast_roundtrip("""f'''{"'"}'''""") + self.check_ast_roundtrip('''f\'\'\'-{f"""*{f"+{f'.{x}.'}+"}*"""}-\'\'\'''') + self.check_ast_roundtrip('''f\'\'\'-{f"""*{f"+{f'.{x}.'}+"}*"""}-'single quote\\'\'\'\'''') + self.check_ast_roundtrip('f"""{\'\'\'\n\'\'\'}"""') + self.check_ast_roundtrip('f"""{g(\'\'\'\n\'\'\')}"""') + self.check_ast_roundtrip('''f"a\\r\\nb"''') + self.check_ast_roundtrip('''f"\\u2028{'x'}"''') def test_strings(self): self.check_ast_roundtrip("u'foo'") @@ -311,6 +323,9 @@ def test_invalid_fstring_conversion(self): ) ) + def test_invalid_fstring_backslash(self): + self.check_invalid(ast.FormattedValue(value=ast.Constant(value="\\\\"))) + def test_invalid_set(self): self.check_invalid(ast.Set(elts=[])) @@ -330,8 +345,8 @@ def test_docstrings(self): '\r\\r\t\\t\n\\n', '""">>> content = \"\"\"blabla\"\"\" <<<"""', r'foo\n\x00', - 'ðŸâ›Žð©¸½Ã¼Ã©ÅŸ^\N{LONG RIGHTWARDS SQUIGGLE ARROW}' - + "' \\'\\'\\'\"\"\" \"\"\\'\\' \\'", + 'ðŸâ›Žð©¸½Ã¼Ã©ÅŸ^\\\\X\\\\BB\N{LONG RIGHTWARDS SQUIGGLE ARROW}' ) for docstring in docstrings: # check as Module docstrings for easy testing @@ -416,7 +431,6 @@ def test_simple_expressions_parens(self): self.check_src_roundtrip("call((yield x))") self.check_src_roundtrip("return x + (yield x)") - def test_class_bases_and_keywords(self): self.check_src_roundtrip("class X:\n pass") self.check_src_roundtrip("class X(A):\n pass") @@ -429,6 +443,13 @@ def test_class_bases_and_keywords(self): self.check_src_roundtrip("class X(*args):\n pass") self.check_src_roundtrip("class X(*args, **kwargs):\n pass") + def test_fstrings(self): + self.check_src_roundtrip('''f\'\'\'-{f"""*{f"+{f'.{x}.'}+"}*"""}-\'\'\'''') + self.check_src_roundtrip('''f"\\u2028{'x'}"''') + self.check_src_roundtrip(r"f'{x}\n'") + self.check_src_roundtrip('''f''\'{"""\n"""}\\n''\'''') + self.check_src_roundtrip('''f''\'{f"""{x}\n"""}\\n''\'''') + def test_docstrings(self): docstrings = ( '"""simple doc string"""', @@ -443,6 +464,10 @@ def test_docstrings(self): '""""""', '"""\'\'\'"""', '"""\'\'\'\'\'\'"""', + '"""ðŸâ›Žð©¸½Ã¼Ã©ÅŸ^\\\\X\\\\BB⟿"""', + '"""end in single \'quote\'"""', + "'''end in double \"quote\"'''", + '"""almost end in double "quote"."""', ) for prefix in docstring_prefixes: @@ -483,9 +508,8 @@ class DirectoryTestCase(ASTTestCase): lib_dir = pathlib.Path(__file__).parent / ".." test_directories = (lib_dir, lib_dir / "test") - skip_files = {"test_fstring.py"} run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py", - "test_ast.py", "test_asdl_parser.py"} + "test_ast.py", "test_asdl_parser.py", "test_fstring.py"} _files_to_test = None @@ -525,14 +549,6 @@ def test_files(self): if test.support.verbose: print(f"Testing {item.absolute()}") - # Some f-strings are not correctly round-tripped by - # Tools/parser/unparse.py. See issue 28002 for details. - # We need to skip files that contain such f-strings. - if item.name in self.skip_files: - if test.support.verbose: - print(f"Skipping {item.absolute()}: see issue 28002") - continue - with self.subTest(filename=item): source = read_pyfile(item) self.check_ast_roundtrip(source) diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index c1d55ee8b29b34..4750ad9600cc3e 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -277,7 +277,7 @@ def _test_urls(self, urls, handlers, retry=True): ioerror_peer_reset: buf = f.read() debug("read %d bytes" % len(buf)) - except socket.timeout: + except TimeoutError: print("" % url, file=sys.stderr) f.close() time.sleep(0.1) diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py old mode 100644 new mode 100755 index 718113d6e1bb2d..d6a8333427a4a2 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -639,7 +639,7 @@ def test_uuid5(self): equal(u, self.uuid.UUID(v)) equal(str(u), v) - @unittest.skipUnless(os.name == 'posix', 'requires Posix') + @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork') def testIssue8621(self): # On at least some versions of OSX self.uuid.uuid4 generates # the same sequence of UUIDs in the parent and any diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index 5bb62cdb374024..098ba17af59758 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -446,7 +446,7 @@ def do_test_with_pip(self, system_site_packages): # pip's cross-version compatibility may trigger deprecation # warnings in current versions of Python. Ensure related # environment settings don't cause venv to fail. - envvars["PYTHONWARNINGS"] = "e" + envvars["PYTHONWARNINGS"] = "ignore" # ensurepip is different enough from a normal pip invocation # that we want to ensure it ignores the normal pip environment # variable settings. We set PIP_NO_INSTALL here specifically @@ -485,7 +485,8 @@ def do_test_with_pip(self, system_site_packages): # Ensure pip is available in the virtual environment envpy = os.path.join(os.path.realpath(self.env_dir), self.bindir, self.exe) # Ignore DeprecationWarning since pip code is not part of Python - out, err = check_output([envpy, '-W', 'ignore::DeprecationWarning', '-I', + out, err = check_output([envpy, '-W', 'ignore::DeprecationWarning', + '-W', 'ignore::ImportWarning', '-I', '-m', 'pip', '--version']) # We force everything to text, so unittest gives the detailed diff # if we get unexpected results @@ -501,8 +502,12 @@ def do_test_with_pip(self, system_site_packages): # Check the private uninstall command provided for the Windows # installers works (at least in a virtual environment) with EnvironmentVarGuard() as envvars: + # It seems ensurepip._uninstall calls subprocesses which do not + # inherit the interpreter settings. + envvars["PYTHONWARNINGS"] = "ignore" out, err = check_output([envpy, - '-W', 'ignore::DeprecationWarning', '-I', + '-W', 'ignore::DeprecationWarning', + '-W', 'ignore::ImportWarning', '-I', '-m', 'ensurepip._uninstall']) # We force everything to text, so unittest gives the detailed diff # if we get unexpected results diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 3dfa84bf77db01..c54aeb109450db 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -648,7 +648,7 @@ def _(x, y): serv.handle_request() numrequests -= 1 - except socket.timeout: + except TimeoutError: pass finally: serv.socket.close() @@ -713,7 +713,7 @@ def _marshaled_dispatch(self, data, dispatch_method=None, path=None): serv.handle_request() numrequests -= 1 - except socket.timeout: + except TimeoutError: pass finally: serv.socket.close() diff --git a/Lib/test/test_xxlimited.py b/Lib/test/test_xxlimited.py new file mode 100644 index 00000000000000..e3f521d9b040dc --- /dev/null +++ b/Lib/test/test_xxlimited.py @@ -0,0 +1,79 @@ +import unittest +from test.support import import_helper +import types + +xxlimited = import_helper.import_module('xxlimited') +xxlimited_35 = import_helper.import_module('xxlimited_35') + + +class CommonTests: + module: types.ModuleType + + def test_xxo_new(self): + xxo = self.module.Xxo() + + def test_xxo_attributes(self): + xxo = self.module.Xxo() + with self.assertRaises(AttributeError): + xxo.foo + with self.assertRaises(AttributeError): + del xxo.foo + + xxo.foo = 1234 + self.assertEqual(xxo.foo, 1234) + + del xxo.foo + with self.assertRaises(AttributeError): + xxo.foo + + def test_foo(self): + # the foo function adds 2 numbers + self.assertEqual(self.module.foo(1, 2), 3) + + def test_str(self): + self.assertTrue(issubclass(self.module.Str, str)) + self.assertIsNot(self.module.Str, str) + + custom_string = self.module.Str("abcd") + self.assertEqual(custom_string, "abcd") + self.assertEqual(custom_string.upper(), "ABCD") + + def test_new(self): + xxo = self.module.new() + self.assertEqual(xxo.demo("abc"), "abc") + + +class TestXXLimited(CommonTests, unittest.TestCase): + module = xxlimited + + def test_xxo_demo(self): + xxo = self.module.Xxo() + other = self.module.Xxo() + self.assertEqual(xxo.demo("abc"), "abc") + self.assertEqual(xxo.demo(xxo), xxo) + self.assertEqual(xxo.demo(other), other) + self.assertEqual(xxo.demo(0), None) + + def test_error(self): + with self.assertRaises(self.module.Error): + raise self.module.Error + + +class TestXXLimited35(CommonTests, unittest.TestCase): + module = xxlimited_35 + + def test_xxo_demo(self): + xxo = self.module.Xxo() + other = self.module.Xxo() + self.assertEqual(xxo.demo("abc"), "abc") + self.assertEqual(xxo.demo(0), None) + + def test_roj(self): + # the roj function always fails + with self.assertRaises(SystemError): + self.module.roj(0) + + def test_null(self): + null1 = self.module.Null() + null2 = self.module.Null() + self.assertNotEqual(null1, null2) diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 8df7489f754d3f..6dea2b16287ad4 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -7,6 +7,7 @@ import time import unittest import unittest.mock +import warnings from test import support from test.support import import_helper @@ -450,37 +451,54 @@ def testZipImporterMethods(self): zi = zipimport.zipimporter(TEMP_ZIP) self.assertEqual(zi.archive, TEMP_ZIP) - self.assertEqual(zi.is_package(TESTPACK), True) - - find_mod = zi.find_module('spam') - self.assertIsNotNone(find_mod) - self.assertIsInstance(find_mod, zipimport.zipimporter) - self.assertFalse(find_mod.is_package('spam')) - load_mod = find_mod.load_module('spam') - self.assertEqual(find_mod.get_filename('spam'), load_mod.__file__) - - mod = zi.load_module(TESTPACK) + self.assertTrue(zi.is_package(TESTPACK)) + + # PEP 302 + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + find_mod = zi.find_module('spam') + self.assertIsNotNone(find_mod) + self.assertIsInstance(find_mod, zipimport.zipimporter) + self.assertFalse(find_mod.is_package('spam')) + load_mod = find_mod.load_module('spam') + self.assertEqual(find_mod.get_filename('spam'), load_mod.__file__) + + mod = zi.load_module(TESTPACK) + self.assertEqual(zi.get_filename(TESTPACK), mod.__file__) + + # PEP 451 + spec = zi.find_spec('spam') + self.assertIsNotNone(spec) + self.assertIsInstance(spec.loader, zipimport.zipimporter) + self.assertFalse(spec.loader.is_package('spam')) + exec_mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(exec_mod) + self.assertEqual(spec.loader.get_filename('spam'), exec_mod.__file__) + + spec = zi.find_spec(TESTPACK) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) self.assertEqual(zi.get_filename(TESTPACK), mod.__file__) existing_pack_path = importlib.import_module(TESTPACK).__path__[0] expected_path_path = os.path.join(TEMP_ZIP, TESTPACK) self.assertEqual(existing_pack_path, expected_path_path) - self.assertEqual(zi.is_package(packdir + '__init__'), False) - self.assertEqual(zi.is_package(packdir + TESTPACK2), True) - self.assertEqual(zi.is_package(packdir2 + TESTMOD), False) + self.assertFalse(zi.is_package(packdir + '__init__')) + self.assertTrue(zi.is_package(packdir + TESTPACK2)) + self.assertFalse(zi.is_package(packdir2 + TESTMOD)) mod_path = packdir2 + TESTMOD mod_name = module_path_to_dotted_name(mod_path) mod = importlib.import_module(mod_name) self.assertTrue(mod_name in sys.modules) - self.assertEqual(zi.get_source(TESTPACK), None) - self.assertEqual(zi.get_source(mod_path), None) + self.assertIsNone(zi.get_source(TESTPACK)) + self.assertIsNone(zi.get_source(mod_path)) self.assertEqual(zi.get_filename(mod_path), mod.__file__) # To pass in the module name instead of the path, we must use the # right importer - loader = mod.__loader__ - self.assertEqual(loader.get_source(mod_name), None) + loader = mod.__spec__.loader + self.assertIsNone(loader.get_source(mod_name)) self.assertEqual(loader.get_filename(mod_name), mod.__file__) # test prefix and archivepath members @@ -505,36 +523,55 @@ def testZipImporterMethodsInSubDirectory(self): zi = zipimport.zipimporter(TEMP_ZIP + os.sep + packdir) self.assertEqual(zi.archive, TEMP_ZIP) self.assertEqual(zi.prefix, packdir) - self.assertEqual(zi.is_package(TESTPACK2), True) - mod = zi.load_module(TESTPACK2) - self.assertEqual(zi.get_filename(TESTPACK2), mod.__file__) - - self.assertEqual( - zi.is_package(TESTPACK2 + os.sep + '__init__'), False) - self.assertEqual( - zi.is_package(TESTPACK2 + os.sep + TESTMOD), False) + self.assertTrue(zi.is_package(TESTPACK2)) + # PEP 302 + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + mod = zi.load_module(TESTPACK2) + self.assertEqual(zi.get_filename(TESTPACK2), mod.__file__) + # PEP 451 + spec = zi.find_spec(TESTPACK2) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + self.assertEqual(spec.loader.get_filename(TESTPACK2), mod.__file__) + + self.assertFalse(zi.is_package(TESTPACK2 + os.sep + '__init__')) + self.assertFalse(zi.is_package(TESTPACK2 + os.sep + TESTMOD)) pkg_path = TEMP_ZIP + os.sep + packdir + TESTPACK2 zi2 = zipimport.zipimporter(pkg_path) - find_mod_dotted = zi2.find_module(TESTMOD) - self.assertIsNotNone(find_mod_dotted) - self.assertIsInstance(find_mod_dotted, zipimport.zipimporter) - self.assertFalse(zi2.is_package(TESTMOD)) - load_mod = find_mod_dotted.load_module(TESTMOD) + # PEP 302 + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + find_mod_dotted = zi2.find_module(TESTMOD) + self.assertIsNotNone(find_mod_dotted) + self.assertIsInstance(find_mod_dotted, zipimport.zipimporter) + self.assertFalse(zi2.is_package(TESTMOD)) + load_mod = find_mod_dotted.load_module(TESTMOD) + self.assertEqual( + find_mod_dotted.get_filename(TESTMOD), load_mod.__file__) + + # PEP 451 + spec = zi2.find_spec(TESTMOD) + self.assertIsNotNone(spec) + self.assertIsInstance(spec.loader, zipimport.zipimporter) + self.assertFalse(spec.loader.is_package(TESTMOD)) + load_mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(load_mod) self.assertEqual( - find_mod_dotted.get_filename(TESTMOD), load_mod.__file__) + spec.loader.get_filename(TESTMOD), load_mod.__file__) mod_path = TESTPACK2 + os.sep + TESTMOD mod_name = module_path_to_dotted_name(mod_path) mod = importlib.import_module(mod_name) self.assertTrue(mod_name in sys.modules) - self.assertEqual(zi.get_source(TESTPACK2), None) - self.assertEqual(zi.get_source(mod_path), None) + self.assertIsNone(zi.get_source(TESTPACK2)) + self.assertIsNone(zi.get_source(mod_path)) self.assertEqual(zi.get_filename(mod_path), mod.__file__) # To pass in the module name instead of the path, we must use the # right importer. loader = mod.__loader__ - self.assertEqual(loader.get_source(mod_name), None) + self.assertIsNone(loader.get_source(mod_name)) self.assertEqual(loader.get_filename(mod_name), mod.__file__) def testGetData(self): @@ -655,7 +692,9 @@ def testUnencodable(self): zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW)) zinfo.compress_type = self.compression z.writestr(zinfo, test_src) - zipimport.zipimporter(filename).load_module(TESTMOD) + spec = zipimport.zipimporter(filename).find_spec(TESTMOD) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) def testBytesPath(self): filename = os_helper.TESTFN + ".zip" @@ -746,17 +785,24 @@ def _testBogusZipFile(self): z = zipimport.zipimporter(TESTMOD) try: + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + self.assertRaises(TypeError, z.load_module, None) self.assertRaises(TypeError, z.find_module, None) - self.assertRaises(TypeError, z.load_module, None) + self.assertRaises(TypeError, z.find_spec, None) + self.assertRaises(TypeError, z.exec_module, None) self.assertRaises(TypeError, z.is_package, None) self.assertRaises(TypeError, z.get_code, None) self.assertRaises(TypeError, z.get_data, None) self.assertRaises(TypeError, z.get_source, None) error = zipimport.ZipImportError - self.assertEqual(z.find_module('abc'), None) + self.assertIsNone(z.find_module('abc')) + self.assertIsNone(z.find_spec('abc')) - self.assertRaises(error, z.load_module, 'abc') + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + self.assertRaises(error, z.load_module, 'abc') self.assertRaises(error, z.get_code, 'abc') self.assertRaises(OSError, z.get_data, 'abc') self.assertRaises(error, z.get_source, 'abc') diff --git a/Lib/threading.py b/Lib/threading.py index d4fe649e4f04b5..7b3d63dd211ea4 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -844,8 +844,12 @@ def _reset_internal_locks(self, is_alive): # they may be in an invalid state leading to a deadlock or crash. self._started._at_fork_reinit() if is_alive: - self._tstate_lock._at_fork_reinit() - self._tstate_lock.acquire() + # bpo-42350: If the fork happens when the thread is already stopped + # (ex: after threading._shutdown() has been called), _tstate_lock + # is None. Do nothing in this case. + if self._tstate_lock is not None: + self._tstate_lock._at_fork_reinit() + self._tstate_lock.acquire() else: # The thread isn't alive after fork: it doesn't have a tstate # anymore. @@ -1200,6 +1204,10 @@ def excepthook(args, /): stderr.flush() +# Original value of threading.excepthook +__excepthook__ = excepthook + + def _make_invoke_excepthook(): # Create a local namespace to ensure that variables remain alive # when _invoke_excepthook() is called, even if it is called late during diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py index a45f882bb00d48..6937ba1ca9be41 100644 --- a/Lib/tkinter/test/test_ttk/test_extensions.py +++ b/Lib/tkinter/test/test_ttk/test_extensions.py @@ -114,7 +114,6 @@ def check_positions(scale, scale_pos, label, label_pos): def test_horizontal_range(self): lscale = ttk.LabeledScale(self.root, from_=0, to=10) lscale.pack() - lscale.wait_visibility() lscale.update() linfo_1 = lscale.label.place_info() @@ -144,7 +143,6 @@ def test_horizontal_range(self): def test_variable_change(self): x = ttk.LabeledScale(self.root) x.pack() - x.wait_visibility() x.update() curr_xcoord = x.scale.coords()[0] @@ -187,7 +185,6 @@ def test_variable_change(self): def test_resize(self): x = ttk.LabeledScale(self.root) x.pack(expand=True, fill='both') - x.wait_visibility() x.update() width, height = x.master.winfo_width(), x.master.winfo_height() @@ -268,7 +265,6 @@ def test_menu(self): # check that variable is updated correctly optmenu.pack() - optmenu.wait_visibility() optmenu['menu'].invoke(0) self.assertEqual(optmenu._variable.get(), items[0]) @@ -299,9 +295,7 @@ def test_unique_radiobuttons(self): textvar2 = tkinter.StringVar(self.root) optmenu2 = ttk.OptionMenu(self.root, textvar2, default, *items) optmenu.pack() - optmenu.wait_visibility() optmenu2.pack() - optmenu2.wait_visibility() optmenu['menu'].invoke(1) optmenu2['menu'].invoke(2) optmenu_stringvar_name = optmenu['menu'].entrycget(0, 'variable') diff --git a/Lib/tkinter/test/test_ttk/test_functions.py b/Lib/tkinter/test/test_ttk/test_functions.py index f8e69a9f4165d6..5c23d6fecf8b42 100644 --- a/Lib/tkinter/test/test_ttk/test_functions.py +++ b/Lib/tkinter/test/test_ttk/test_functions.py @@ -137,6 +137,9 @@ def test_format_mapdict(self): result = ttk._format_mapdict(opts) self.assertEqual(result, ('-üñíćódè', 'á vãl')) + self.assertEqual(ttk._format_mapdict({'opt': [('value',)]}), + ('-opt', '{} value')) + # empty states valid = {'opt': [('', '', 'hi')]} self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{ } hi')) @@ -159,10 +162,6 @@ def test_format_mapdict(self): opts = {'a': None} self.assertRaises(TypeError, ttk._format_mapdict, opts) - # items in the value must have size >= 2 - self.assertRaises(IndexError, ttk._format_mapdict, - {'a': [('invalid', )]}) - def test_format_elemcreate(self): self.assertTrue(ttk._format_elemcreate(None), (None, ())) diff --git a/Lib/tkinter/test/test_ttk/test_style.py b/Lib/tkinter/test/test_ttk/test_style.py index 3537536d81bc56..38d70d7a89077d 100644 --- a/Lib/tkinter/test/test_ttk/test_style.py +++ b/Lib/tkinter/test/test_ttk/test_style.py @@ -1,11 +1,23 @@ import unittest +import sys import tkinter from tkinter import ttk +from test import support from test.support import requires, run_unittest from tkinter.test.support import AbstractTkTest requires('gui') +CLASS_NAMES = [ + '.', 'ComboboxPopdownFrame', 'Heading', + 'Horizontal.TProgressbar', 'Horizontal.TScale', 'Item', 'Sash', + 'TButton', 'TCheckbutton', 'TCombobox', 'TEntry', + 'TLabelframe', 'TLabelframe.Label', 'TMenubutton', + 'TNotebook', 'TNotebook.Tab', 'Toolbutton', 'TProgressbar', + 'TRadiobutton', 'Treeview', 'TScale', 'TScrollbar', 'TSpinbox', + 'Vertical.TProgressbar', 'Vertical.TScale' +] + class StyleTest(AbstractTkTest, unittest.TestCase): def setUp(self): @@ -23,11 +35,36 @@ def test_configure(self): def test_map(self): style = self.style - style.map('TButton', background=[('active', 'background', 'blue')]) - self.assertEqual(style.map('TButton', 'background'), - [('active', 'background', 'blue')] if self.wantobjects else - [('active background', 'blue')]) - self.assertIsInstance(style.map('TButton'), dict) + + # Single state + for states in ['active'], [('active',)]: + with self.subTest(states=states): + style.map('TButton', background=[(*states, 'white')]) + expected = [('active', 'white')] + self.assertEqual(style.map('TButton', 'background'), expected) + m = style.map('TButton') + self.assertIsInstance(m, dict) + self.assertEqual(m['background'], expected) + + # Multiple states + for states in ['pressed', '!disabled'], ['pressed !disabled'], [('pressed', '!disabled')]: + with self.subTest(states=states): + style.map('TButton', background=[(*states, 'black')]) + expected = [('pressed', '!disabled', 'black')] + self.assertEqual(style.map('TButton', 'background'), expected) + m = style.map('TButton') + self.assertIsInstance(m, dict) + self.assertEqual(m['background'], expected) + + # Default state + for states in [], [''], [()]: + with self.subTest(states=states): + style.map('TButton', background=[(*states, 'grey')]) + expected = [('grey',)] + self.assertEqual(style.map('TButton', 'background'), expected) + m = style.map('TButton') + self.assertIsInstance(m, dict) + self.assertEqual(m['background'], expected) def test_lookup(self): @@ -86,6 +123,58 @@ def test_theme_use(self): self.style.theme_use(curr_theme) + def test_configure_custom_copy(self): + style = self.style + + curr_theme = self.style.theme_use() + self.addCleanup(self.style.theme_use, curr_theme) + for theme in self.style.theme_names(): + self.style.theme_use(theme) + for name in CLASS_NAMES: + default = style.configure(name) + if not default: + continue + with self.subTest(theme=theme, name=name): + if support.verbose >= 2: + print('configure', theme, name, default) + if (theme in ('vista', 'xpnative') + and sys.getwindowsversion()[:2] == (6, 1)): + # Fails on the Windows 7 buildbot + continue + newname = f'C.{name}' + self.assertEqual(style.configure(newname), None) + style.configure(newname, **default) + self.assertEqual(style.configure(newname), default) + for key, value in default.items(): + self.assertEqual(style.configure(newname, key), value) + + + def test_map_custom_copy(self): + style = self.style + + curr_theme = self.style.theme_use() + self.addCleanup(self.style.theme_use, curr_theme) + for theme in self.style.theme_names(): + self.style.theme_use(theme) + for name in CLASS_NAMES: + default = style.map(name) + if not default: + continue + with self.subTest(theme=theme, name=name): + if support.verbose >= 2: + print('map', theme, name, default) + if (theme in ('vista', 'xpnative') + and sys.getwindowsversion()[:2] == (6, 1)): + # Fails on the Windows 7 buildbot + continue + newname = f'C.{name}' + self.assertEqual(style.map(newname), {}) + style.map(newname, **default) + self.assertEqual(style.map(newname), default) + for key, value in default.items(): + self.assertEqual(style.map(newname, key), value) + + tests_gui = (StyleTest, ) if __name__ == "__main__": diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py index 2598bc67652075..157ef0e8f87bb5 100644 --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -60,11 +60,10 @@ def setUp(self): super().setUp() self.widget = ttk.Button(self.root, width=0, text="Text") self.widget.pack() - self.widget.wait_visibility() def test_identify(self): - self.widget.update_idletasks() + self.widget.update() self.assertEqual(self.widget.identify( int(self.widget.winfo_width() / 2), int(self.widget.winfo_height() / 2) @@ -326,8 +325,7 @@ def test_bbox(self): def test_identify(self): self.entry.pack() - self.entry.wait_visibility() - self.entry.update_idletasks() + self.entry.update() # bpo-27313: macOS Cocoa widget differs from X, allow either if sys.platform == 'darwin': @@ -437,11 +435,12 @@ def test_height(self): def _show_drop_down_listbox(self): width = self.combo.winfo_width() - self.combo.event_generate('', x=width - 5, y=5) - self.combo.event_generate('', x=width - 5, y=5) + x, y = width - 5, 5 + self.assertRegex(self.combo.identify(x, y), r'.*downarrow\Z') + self.combo.event_generate('', x=x, y=y) + self.combo.event_generate('', x=x, y=y) self.combo.update_idletasks() - def test_virtual_event(self): success = [] @@ -449,7 +448,7 @@ def test_virtual_event(self): self.combo.bind('<>', lambda evt: success.append(True)) self.combo.pack() - self.combo.wait_visibility() + self.combo.update() height = self.combo.winfo_height() self._show_drop_down_listbox() @@ -465,7 +464,7 @@ def test_postcommand(self): self.combo['postcommand'] = lambda: success.append(True) self.combo.pack() - self.combo.wait_visibility() + self.combo.update() self._show_drop_down_listbox() self.assertTrue(success) @@ -665,7 +664,6 @@ def test_sashpos(self): self.assertRaises(tkinter.TclError, self.paned.sashpos, 1) self.paned.pack(expand=True, fill='both') - self.paned.wait_visibility() curr_pos = self.paned.sashpos(0) self.paned.sashpos(0, 1000) @@ -933,7 +931,7 @@ def test_tab_identifiers(self): self.nb.add(self.child1, text='a') self.nb.pack() - self.nb.wait_visibility() + self.nb.update() if sys.platform == 'darwin': tb_idx = "@20,5" else: @@ -1041,7 +1039,7 @@ def test_insert(self): def test_select(self): self.nb.pack() - self.nb.wait_visibility() + self.nb.update() success = [] tab_changed = [] @@ -1084,10 +1082,11 @@ def test_tabs(self): def test_traversal(self): self.nb.pack() - self.nb.wait_visibility() + self.nb.update() self.nb.select(0) + self.assertEqual(self.nb.identify(5, 5), 'focus') simulate_mouse_click(self.nb, 5, 5) self.nb.focus_force() self.nb.event_generate('') @@ -1102,6 +1101,7 @@ def test_traversal(self): self.nb.tab(self.child1, text='a', underline=0) self.nb.enable_traversal() self.nb.focus_force() + self.assertEqual(self.nb.identify(5, 5), 'focus') simulate_mouse_click(self.nb, 5, 5) if sys.platform == 'darwin': self.nb.event_generate('') @@ -1132,6 +1132,7 @@ def _click_increment_arrow(self): height = self.spin.winfo_height() x = width - 5 y = height//2 - 5 + self.assertRegex(self.spin.identify(x, y), r'.*uparrow\Z') self.spin.event_generate('', x=x, y=y) self.spin.event_generate('', x=x, y=y) self.spin.update_idletasks() @@ -1141,6 +1142,7 @@ def _click_decrement_arrow(self): height = self.spin.winfo_height() x = width - 5 y = height//2 + 4 + self.assertRegex(self.spin.identify(x, y), r'.*downarrow\Z') self.spin.event_generate('', x=x, y=y) self.spin.event_generate('', x=x, y=y) self.spin.update_idletasks() @@ -1342,7 +1344,6 @@ def test_show(self): def test_bbox(self): self.tv.pack() self.assertEqual(self.tv.bbox(''), '') - self.tv.wait_visibility() self.tv.update() item_id = self.tv.insert('', 'end') @@ -1530,13 +1531,15 @@ def test_heading(self): def test_heading_callback(self): def simulate_heading_click(x, y): + if tcl_version >= (8, 6): + self.assertEqual(self.tv.identify_column(x), '#0') + self.assertEqual(self.tv.identify_region(x, y), 'heading') simulate_mouse_click(self.tv, x, y) self.tv.update() success = [] # no success for now self.tv.pack() - self.tv.wait_visibility() self.tv.heading('#0', command=lambda: success.append(True)) self.tv.column('#0', width=100) self.tv.update() @@ -1784,7 +1787,6 @@ def test_tag_bind(self): lambda evt: events.append(2)) self.tv.pack() - self.tv.wait_visibility() self.tv.update() pos_y = set() diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py index c7c71cd5a559cf..968fd54dce1ee0 100644 --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -81,8 +81,6 @@ def _mapdict_values(items): # ['active selected', 'grey', 'focus', [1, 2, 3, 4]] opt_val = [] for *state, val in items: - # hacks for backward compatibility - state[0] # raise IndexError if empty if len(state) == 1: # if it is empty (something that evaluates to False), then # format it to Tcl code to denote the "normal" state @@ -243,19 +241,22 @@ def _script_from_settings(settings): def _list_from_statespec(stuple): """Construct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict.""" - nval = [] - for val in stuple: - typename = getattr(val, 'typename', None) - if typename is None: - nval.append(val) - else: # this is a Tcl object + if isinstance(stuple, str): + return stuple + result = [] + it = iter(stuple) + for state, val in zip(it, it): + if hasattr(state, 'typename'): # this is a Tcl object + state = str(state).split() + elif isinstance(state, str): + state = state.split() + elif not isinstance(state, (tuple, list)): + state = (state,) + if hasattr(val, 'typename'): val = str(val) - if typename == 'StateSpec': - val = val.split() - nval.append(val) + result.append((*state, val)) - it = iter(nval) - return [_flatten(spec) for spec in zip(it, it)] + return result def _list_from_layouttuple(tk, ltuple): """Construct a list from the tuple returned by ttk::layout, this is @@ -395,13 +396,12 @@ def map(self, style, query_opt=None, **kw): or something else of your preference. A statespec is compound of one or more states and then a value.""" if query_opt is not None: - return _list_from_statespec(self.tk.splitlist( - self.tk.call(self._name, "map", style, '-%s' % query_opt))) + result = self.tk.call(self._name, "map", style, '-%s' % query_opt) + return _list_from_statespec(self.tk.splitlist(result)) - return _splitdict( - self.tk, - self.tk.call(self._name, "map", style, *_format_mapdict(kw)), - conv=_tclobj_to_py) + result = self.tk.call(self._name, "map", style, *_format_mapdict(kw)) + return {k: _list_from_statespec(self.tk.splitlist(v)) + for k, v in _splitdict(self.tk, result).items()} def lookup(self, style, option, state=None, default=None): diff --git a/Lib/traceback.py b/Lib/traceback.py index d2d93c8a32ac29..457d92511af051 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -510,7 +510,6 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, _seen=_seen) else: context = None - self.exc_traceback = exc_traceback self.__cause__ = cause self.__context__ = context self.__suppress_context__ = \ @@ -627,7 +626,7 @@ def format(self, *, chain=True): not self.__suppress_context__): yield from self.__context__.format(chain=chain) yield _context_message - if self.exc_traceback is not None: + if self.stack: yield 'Traceback (most recent call last):\n' - yield from self.stack.format() + yield from self.stack.format() yield from self.format_exception_only() diff --git a/Lib/typing.py b/Lib/typing.py index 3fa97a4a15f954..46c54c406992f7 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -202,6 +202,20 @@ def _check_generic(cls, parameters, elen): f" actual {alen}, expected {elen}") +def _deduplicate(params): + # Weed out strict duplicates, preserving the first of each occurrence. + all_params = set(params) + if len(all_params) < len(params): + new_params = [] + for t in params: + if t in all_params: + new_params.append(t) + all_params.remove(t) + params = new_params + assert not all_params, all_params + return params + + def _remove_dups_flatten(parameters): """An internal helper for Union creation and substitution: flatten Unions among parameters, then remove duplicates. @@ -215,38 +229,45 @@ def _remove_dups_flatten(parameters): params.extend(p[1:]) else: params.append(p) - # Weed out strict duplicates, preserving the first of each occurrence. - all_params = set(params) - if len(all_params) < len(params): - new_params = [] - for t in params: - if t in all_params: - new_params.append(t) - all_params.remove(t) - params = new_params - assert not all_params, all_params + + return tuple(_deduplicate(params)) + + +def _flatten_literal_params(parameters): + """An internal helper for Literal creation: flatten Literals among parameters""" + params = [] + for p in parameters: + if isinstance(p, _LiteralGenericAlias): + params.extend(p.__args__) + else: + params.append(p) return tuple(params) _cleanups = [] -def _tp_cache(func): +def _tp_cache(func=None, /, *, typed=False): """Internal wrapper caching __getitem__ of generic types with a fallback to original function for non-hashable arguments. """ - cached = functools.lru_cache()(func) - _cleanups.append(cached.cache_clear) + def decorator(func): + cached = functools.lru_cache(typed=typed)(func) + _cleanups.append(cached.cache_clear) - @functools.wraps(func) - def inner(*args, **kwds): - try: - return cached(*args, **kwds) - except TypeError: - pass # All real errors (not unhashable args) are raised below. - return func(*args, **kwds) - return inner + @functools.wraps(func) + def inner(*args, **kwds): + try: + return cached(*args, **kwds) + except TypeError: + pass # All real errors (not unhashable args) are raised below. + return func(*args, **kwds) + return inner + if func is not None: + return decorator(func) + + return decorator def _eval_type(t, globalns, localns, recursive_guard=frozenset()): """Evaluate all forward references in the given type t. @@ -319,6 +340,13 @@ def __subclasscheck__(self, cls): def __getitem__(self, parameters): return self._getitem(self, parameters) + +class _LiteralSpecialForm(_SpecialForm, _root=True): + @_tp_cache(typed=True) + def __getitem__(self, parameters): + return self._getitem(self, parameters) + + @_SpecialForm def Any(self, parameters): """Special type indicating an unconstrained type. @@ -436,7 +464,7 @@ def Optional(self, parameters): arg = _type_check(parameters, f"{self} requires a single type.") return Union[arg, type(None)] -@_SpecialForm +@_LiteralSpecialForm def Literal(self, parameters): """Special typing form to define literal types (a.k.a. value types). @@ -460,7 +488,17 @@ def open_helper(file: str, mode: MODE) -> str: """ # There is no '_type_check' call because arguments to Literal[...] are # values, not types. - return _GenericAlias(self, parameters) + if not isinstance(parameters, tuple): + parameters = (parameters,) + + parameters = _flatten_literal_params(parameters) + + try: + parameters = tuple(p for p, _ in _deduplicate(list(_value_and_type_iter(parameters)))) + except TypeError: # unhashable parameters + pass + + return _LiteralGenericAlias(self, parameters) @_SpecialForm @@ -930,6 +968,21 @@ def __subclasscheck__(self, cls): return True +def _value_and_type_iter(parameters): + return ((p, type(p)) for p in parameters) + + +class _LiteralGenericAlias(_GenericAlias, _root=True): + + def __eq__(self, other): + if not isinstance(other, _LiteralGenericAlias): + return NotImplemented + + return set(_value_and_type_iter(self.__args__)) == set(_value_and_type_iter(other.__args__)) + + def __hash__(self): + return hash(frozenset(_value_and_type_iter(self.__args__))) + class Generic: """Abstract base class for generic types. diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index f5f502f257244c..4db1bacf4b10cf 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -406,7 +406,7 @@ def __new__(cls, /, *args, **kw): # Check if spec is an async object or function bound_args = _MOCK_SIG.bind_partial(cls, *args, **kw).arguments spec_arg = bound_args.get('spec_set', bound_args.get('spec')) - if spec_arg and _is_async_obj(spec_arg): + if spec_arg is not None and _is_async_obj(spec_arg): bases = (AsyncMockMixin, cls) new = type(cls.__name__, bases, {'__doc__': cls.__doc__}) instance = _safe_super(NonCallableMock, cls).__new__(new) diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py index 194ce3f61bbfdd..dfcf1ef2ee0302 100644 --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -2165,6 +2165,16 @@ def trace(frame, event, arg): # pragma: no cover obj = mock(spec=Something) self.assertIsInstance(obj, Something) + def test_bool_not_called_when_passing_spec_arg(self): + class Something: + def __init__(self): + self.obj_with_bool_func = unittest.mock.MagicMock() + + obj = Something() + with unittest.mock.patch.object(obj, 'obj_with_bool_func', autospec=True): pass + + self.assertEqual(obj.obj_with_bool_func.__bool__.call_count, 0) + if __name__ == '__main__': unittest.main() diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index a8c870b9778eba..39974d975ee1e0 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -202,6 +202,8 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=cafile, capath=capath) + # send ALPN extension to indicate HTTP/1.1 protocol + context.set_alpn_protocols(['http/1.1']) https_handler = HTTPSHandler(context=context) opener = build_opener(https_handler) elif context: diff --git a/Lib/zipimport.py b/Lib/zipimport.py index 080e0c4d986d63..02e4fd38d0e2a2 100644 --- a/Lib/zipimport.py +++ b/Lib/zipimport.py @@ -22,6 +22,7 @@ import marshal # for loads import sys # for modules import time # for mktime +import _warnings # For warn() __all__ = ['ZipImportError', 'zipimporter'] @@ -42,7 +43,7 @@ class ZipImportError(ImportError): STRING_END_ARCHIVE = b'PK\x05\x06' MAX_COMMENT_LEN = (1 << 16) - 1 -class zipimporter: +class zipimporter(_bootstrap_external._LoaderBasics): """zipimporter(archivepath) -> zipimporter object Create a new zipimporter instance. 'archivepath' must be a path to @@ -115,6 +116,8 @@ def find_loader(self, fullname, path=None): full path name if it's possibly a portion of a namespace package, or None otherwise. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. + + Deprecated since Python 3.10. Use find_spec() instead. """ mi = _get_module_info(self, fullname) if mi is not None: @@ -146,9 +149,37 @@ def find_module(self, fullname, path=None): instance itself if the module was found, or None if it wasn't. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. + + Deprecated since Python 3.10. Use find_spec() instead. """ return self.find_loader(fullname, path)[0] + def find_spec(self, fullname, target=None): + """Create a ModuleSpec for the specified module. + + Returns None if the module cannot be found. + """ + module_info = _get_module_info(self, fullname) + if module_info is not None: + return _bootstrap.spec_from_loader(fullname, self, is_package=module_info) + else: + # Not a module or regular package. See if this is a directory, and + # therefore possibly a portion of a namespace package. + + # We're only interested in the last path component of fullname + # earlier components are recorded in self.prefix. + modpath = _get_module_path(self, fullname) + if _is_dir(self, modpath): + # This is possibly a portion of a namespace + # package. Return the string representing its path, + # without a trailing separator. + path = f'{self.archive}{path_sep}{modpath}' + spec = _bootstrap.ModuleSpec(name=fullname, loader=None, + is_package=True) + spec.submodule_search_locations.append(path) + return spec + else: + return None def get_code(self, fullname): """get_code(fullname) -> code object. @@ -237,7 +268,12 @@ def load_module(self, fullname): Load the module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the imported module, or raises ZipImportError if it wasn't found. + + Deprecated since Python 3.10. Use exec_module() instead. """ + msg = ("zipimport.zipimporter.load_module() is deprecated and slated for " + "removal in Python 3.12; use exec_module() instead") + _warnings.warn(msg, DeprecationWarning) code, ispackage, modpath = _get_module_code(self, fullname) mod = sys.modules.get(fullname) if mod is None or not isinstance(mod, _module_type): diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 0e76d3ca5bbc2e..16816d1cf86a44 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -153,6 +153,9 @@ def getFullVersion(): def getDeptargetTuple(): return tuple([int(n) for n in DEPTARGET.split('.')[0:2]]) +def getBuildTuple(): + return tuple([int(n) for n in platform.mac_ver()[0].split('.')[0:2]]) + def getTargetCompilers(): target_cc_map = { '10.4': ('gcc-4.0', 'g++-4.0'), @@ -192,6 +195,13 @@ def getTargetCompilers(): def internalTk(): return getDeptargetTuple() >= (10, 6) +# Do we use 8.6.8 when building our own copy +# of Tcl/Tk or a modern version. +# We use the old version when buildin on +# old versions of macOS due to build issues. +def useOldTk(): + return getBuildTuple() < (10, 15) + def tweak_tcl_build(basedir, archList): with open("Makefile", "r") as fp: @@ -245,11 +255,26 @@ def library_recipes(): ]) if internalTk(): + if useOldTk(): + tcl_tk_ver='8.6.8' + tcl_checksum='81656d3367af032e0ae6157eff134f89' + + tk_checksum='5e0faecba458ee1386078fb228d008ba' + tk_patches = ['tk868_on_10_8_10_9.patch'] + + else: + tcl_tk_ver='8.6.10' + tcl_checksum='97c55573f8520bcab74e21bfd8d0aadc' + + tk_checksum='602a47ad9ecac7bf655ada729d140a94' + tk_patches = [ ] + + result.extend([ dict( - name="Tcl 8.6.8", - url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tcl8.6.8-src.tar.gz", - checksum='81656d3367af032e0ae6157eff134f89', + name="Tcl %s"%(tcl_tk_ver,), + url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tcl%s-src.tar.gz"%(tcl_tk_ver,), + checksum=tcl_checksum, buildDir="unix", configure_pre=[ '--enable-shared', @@ -264,12 +289,10 @@ def library_recipes(): }, ), dict( - name="Tk 8.6.8", - url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tk8.6.8-src.tar.gz", - checksum='5e0faecba458ee1386078fb228d008ba', - patches=[ - "tk868_on_10_8_10_9.patch", - ], + name="Tk %s"%(tcl_tk_ver,), + url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tk%s-src.tar.gz"%(tcl_tk_ver,), + checksum=tk_checksum, + patches=tk_patches, buildDir="unix", configure_pre=[ '--enable-aqua', @@ -564,8 +587,8 @@ def checkEnvironment(): Check that we're running on a supported system. """ - if sys.version_info[0:2] < (2, 5): - fatal("This script must be run with Python 2.5 (or later)") + if sys.version_info[0:2] < (2, 7): + fatal("This script must be run with Python 2.7 (or later)") if platform.system() != 'Darwin': fatal("This script should be run on a macOS 10.5 (or later) system") @@ -633,9 +656,6 @@ def checkEnvironment(): base_path = base_path + ':' + OLD_DEVELOPER_TOOLS os.environ['PATH'] = base_path print("Setting default PATH: %s"%(os.environ['PATH'])) - # Ensure we have access to sphinx-build. - # You may have to create a link in /usr/bin for it. - runCommand('sphinx-build --version') def parseOptions(args=None): """ @@ -1595,8 +1615,17 @@ def buildDMG(): if os.path.exists(outdir): shutil.rmtree(outdir) + # We used to use the deployment target as the last characters of the + # installer file name. With the introduction of weaklinked installer + # variants, we may have two variants with the same file name, i.e. + # both ending in '10.9'. To avoid this, we now use the major/minor + # version numbers of the macOS version we are building on, i.e. + # '10.9' as before for 10.9+ variant, '11.0' for universal2 11.0-. + # it's not ideal but should cause the least disruption to packaging + # workflows. + build_system_version = '.'.join(platform.mac_ver()[0].split('.')[0:2]) imagepath = os.path.join(outdir, - 'python-%s-macosx%s'%(getFullVersion(),DEPTARGET)) + 'python-%s-macosx%s'%(getFullVersion(),build_system_version)) if INCLUDE_TIMESTAMP: imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3]) imagepath = imagepath + '.dmg' diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf index a4dd8b5ee41029..c82e4b6303a52b 100644 --- a/Mac/BuildScript/resources/ReadMe.rtf +++ b/Mac/BuildScript/resources/ReadMe.rtf @@ -3,7 +3,7 @@ \f3\fmodern\fcharset0 CourierNewPSMT;} {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} -\margl1440\margr1440\vieww13380\viewh14600\viewkind0 +\margl1440\margr1440\vieww13380\viewh14580\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\fs24 \cf0 This package will install Python $FULL_VERSION for macOS $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): $ARCHITECTURES.\ @@ -56,7 +56,15 @@ Due to new security checks on macOS 10.15 Catalina, when launching IDLE macOS ma \f0\b0 button to proceed.\ \ -\f1\b \ul Other changes\ +\f1\b \ul macOS 11.0 (Big Sur) and Apple Silicon Mac support [new in 3.10.0a3]\ + +\f0\b0 \ulnone \ +As of 2020-11, macOS 11.0 (Big Sur) is the latest release of macOS and one of its major features is the support of new Apple Silicon Macs that are based on the ARM64 CPU architecture specification rather than the Intel 64 (x86_64) architecture used previously. There are other changes in Big Sur that affect Python operation regardless of CPU architecture.\ +\ +Beginning with 3.10.0a3, we provide a new "universal2" installer variant that provides universal binaries for both ARM64 and Intel 64 architectures and is also supported on all Macs that support macOS 10.9 or later. Some of the advantages of the new installer variant: native ARM64 code on Apple Silicon Macs should run significantly faster than Rosetta2-emulated code; some operating system functions and options introduced in macOS releases since 10.9 are now exposed when available (primarily in the os module); the new installer variant includes Tcl/Tk 8.6.10 rather than 8.6.8.\ + +\f1\b \ul \ +Other changes\ \f0\b0 \ulnone \ For other changes in this release, see the diff --git a/Makefile.pre.in b/Makefile.pre.in index 47253f2fa8dd77..9e29f590f23d10 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -744,6 +744,13 @@ regen-importlib: Programs/_freeze_importlib $(UPDATE_FILE) $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/importlib_zipimport.h.new +regen-limited-abi: all + @$(MKDIR_P) $(srcdir)/Doc/data/ + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py generate $(srcdir)/Doc/data/stable_abi.dat.new + $(UPDATE_FILE) $(srcdir)/Doc/data/stable_abi.dat \ + $(srcdir)/Doc/data/stable_abi.dat.new + + ############################################################################ # Regenerate all generated files @@ -1095,6 +1102,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/pylifecycle.h \ $(srcdir)/Include/cpython/pymem.h \ $(srcdir)/Include/cpython/pystate.h \ + $(srcdir)/Include/cpython/pythonrun.h \ $(srcdir)/Include/cpython/sysmodule.h \ $(srcdir)/Include/cpython/traceback.h \ $(srcdir)/Include/cpython/tupleobject.h \ @@ -1112,6 +1120,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/internal/pycore_context.h \ $(srcdir)/Include/internal/pycore_dtoa.h \ $(srcdir)/Include/internal/pycore_fileutils.h \ + $(srcdir)/Include/internal/pycore_format.h \ $(srcdir)/Include/internal/pycore_getopt.h \ $(srcdir)/Include/internal/pycore_gil.h \ $(srcdir)/Include/internal/pycore_hamt.h \ @@ -1639,7 +1648,7 @@ libainstall: @DEF_MAKE_RULE@ python-config $(INSTALL_SCRIPT) Modules/ld_so_aix \ $(DESTDIR)$(LIBPL)/ld_so_aix; \ echo "$(LIBPL)/ld_so_aix"; \ - echo; echo "See Misc/AIX-NOTES for details."; \ + echo; echo "See Misc/README.AIX for details."; \ else true; \ fi @@ -1899,6 +1908,9 @@ funny: patchcheck: @DEF_MAKE_RULE@ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py +check-limited-abi: all + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py check $(srcdir)/Doc/data/stable_abi.dat + # Dependencies Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h diff --git a/Misc/ACKS b/Misc/ACKS index 35a87ae6b965da..253349017c5cdc 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -270,6 +270,7 @@ Daniel Calvelo Tony Campbell Giovanni Cappellotto Brett Cannon +Joshua Cannon Tristan Carel Mike Carlton Pierre Carrier @@ -367,6 +368,7 @@ Ryan Coyner Christopher A. Craig Jeremy Craven Laura Creighton +Nick Crews Tyler Crompton Simon Cross Felipe Cruz @@ -861,6 +863,7 @@ Jan Kanis Rafe Kaplan Jacob Kaplan-Moss Allison Kaptur +Yurii Karabas Janne Karila Per Øyvind Karlsen Anton Kasyanov @@ -1280,6 +1283,7 @@ Michael Otteneder Richard Oudkerk Russel Owen Joonas Paalasmaa +Yaroslav Pankovych Martin Packman Elisha Paine Shriphani Palakodety diff --git a/Misc/NEWS.d/3.10.0a2.rst b/Misc/NEWS.d/3.10.0a2.rst index a3c909df866dba..b7ed61986adfec 100644 --- a/Misc/NEWS.d/3.10.0a2.rst +++ b/Misc/NEWS.d/3.10.0a2.rst @@ -116,15 +116,6 @@ failure, run the parser a second time with those enabled. .. -.. bpo: 41910 -.. date: 2020-10-21-14-40-54 -.. nonce: CzBMit -.. section: Core and Builtins - -Document the default implementation of `object.__eq__`. - -.. - .. bpo: 42093 .. date: 2020-10-20-04-24-07 .. nonce: ooZZNh @@ -653,6 +644,15 @@ Document __format__ functionality for IP addresses. .. +.. bpo: 41910 +.. date: 2020-10-21-14-40-54 +.. nonce: CzBMit +.. section: Documentation + +Document the default implementation of `object.__eq__`. + +.. + .. bpo: 42010 .. date: 2020-10-21-02-21-14 .. nonce: 76vJ0u diff --git a/Misc/NEWS.d/3.10.0a3.rst b/Misc/NEWS.d/3.10.0a3.rst new file mode 100644 index 00000000000000..0b76367f944451 --- /dev/null +++ b/Misc/NEWS.d/3.10.0a3.rst @@ -0,0 +1,1504 @@ +.. bpo: 40791 +.. date: 2020-05-28-06-06-47 +.. nonce: QGZClX +.. release date: 2020-12-07 +.. section: Security + +Add ``volatile`` to the accumulator variable in ``hmac.compare_digest``, +making constant-time-defeating optimizations less likely. + +.. + +.. bpo: 42576 +.. date: 2020-12-05-22-34-47 +.. nonce: lEeEl7 +.. section: Core and Builtins + +``types.GenericAlias`` will now raise a ``TypeError`` when attempting to +initialize with a keyword argument. Previously, this would cause the +interpreter to crash if the interpreter was compiled with debug symbols. +This does not affect interpreters compiled for release. Patch by Ken Jin. + +.. + +.. bpo: 42536 +.. date: 2020-12-02-20-23-31 +.. nonce: Kx3ZOu +.. section: Core and Builtins + +Several built-in and standard library types now ensure that their internal +result tuples are always tracked by the :term:`garbage collector `: + +- :meth:`collections.OrderedDict.items() ` + +- :meth:`dict.items` + +- :func:`enumerate` + +- :func:`functools.reduce` + +- :func:`itertools.combinations` + +- :func:`itertools.combinations_with_replacement` + +- :func:`itertools.permutations` + +- :func:`itertools.product` + +- :func:`itertools.zip_longest` + +- :func:`zip` + +Previously, they could have become untracked by a prior garbage collection. +Patch by Brandt Bucher. + +.. + +.. bpo: 42500 +.. date: 2020-11-30-14-27-29 +.. nonce: excVKU +.. section: Core and Builtins + +Improve handling of exceptions near recursion limit. Converts a number of +Fatal Errors in RecursionErrors. + +.. + +.. bpo: 42246 +.. date: 2020-11-24-14-01-43 +.. nonce: c9k9hj +.. section: Core and Builtins + +PEP 626: After a return, the f_lineno attribute of a frame is always the +last line executed. + +.. + +.. bpo: 42435 +.. date: 2020-11-22-14-34-55 +.. nonce: uwlB2W +.. section: Core and Builtins + +Speed up comparison of bytes objects with non-bytes objects when option +:option:`-b` is specified. Speed up comparison of bytarray objects with +non-buffer object. + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-23-46-31 +.. nonce: GVOQ-m +.. section: Core and Builtins + +Port the ``_warnings`` extension module to the multi-phase initialization +API (:pep:`489`). Patch by Victor Stinner. + +.. + +.. bpo: 41686 +.. date: 2020-11-17-16-25-50 +.. nonce: hX77kL +.. section: Core and Builtins + +On Windows, the ``SIGINT`` event, ``_PyOS_SigintEvent()``, is now created +even if Python is configured to not install signal handlers (if +:c:member:`PyConfig.install_signal_handlers` equals to 0, or +``Py_InitializeEx(0)``). + +.. + +.. bpo: 42381 +.. date: 2020-11-16-23-45-56 +.. nonce: G4AWxL +.. section: Core and Builtins + +Allow assignment expressions in set literals and set comprehensions as per +PEP 572. Patch by Pablo Galindo. + +.. + +.. bpo: 42202 +.. date: 2020-11-16-18-13-07 +.. nonce: ZxenYD +.. section: Core and Builtins + +Change function parameters annotations internal representation to tuple of +strings. Patch provided by Yurii Karabas. + +.. + +.. bpo: 42374 +.. date: 2020-11-16-17-57-09 +.. nonce: t7np1E +.. section: Core and Builtins + +Fix a regression introduced by the new parser, where an unparenthesized +walrus operator was not allowed within generator expressions. + +.. + +.. bpo: 42316 +.. date: 2020-11-16-17-30-03 +.. nonce: _DdmpQ +.. section: Core and Builtins + +Allow an unparenthesized walrus in subscript indexes. + +.. + +.. bpo: 42349 +.. date: 2020-11-13-17-25-44 +.. nonce: JdWxez +.. section: Core and Builtins + +Make sure that the compiler front-end produces a well-formed control flow +graph. Be be more aggressive in the compiler back-end, as it is now safe to +do so. + +.. + +.. bpo: 42296 +.. date: 2020-11-13-13-53-11 +.. nonce: DuGrLJ +.. section: Core and Builtins + +On Windows, fix a regression in signal handling which prevented to interrupt +a program using CTRL+C. The signal handler can be run in a thread different +than the Python thread, in which case the test deciding if the thread can +handle signals is wrong. + +.. + +.. bpo: 42332 +.. date: 2020-11-12-23-16-14 +.. nonce: fEQIdk +.. section: Core and Builtins + +:class:`types.GenericAlias` objects can now be the targets of weakrefs. + +.. + +.. bpo: 42282 +.. date: 2020-11-07-21-02-05 +.. nonce: M1W4Wj +.. section: Core and Builtins + +Optimise constant subexpressions that appear as part of named expressions +(previously the AST optimiser did not descend into named expressions). Patch +by Nick Coghlan. + +.. + +.. bpo: 42266 +.. date: 2020-11-04-23-03-25 +.. nonce: G4hGDe +.. section: Core and Builtins + +Fixed a bug with the LOAD_ATTR opcode cache that was not respecting +monkey-patching a class-level attribute to make it a descriptor. Patch by +Pablo Galindo. + +.. + +.. bpo: 40077 +.. date: 2020-11-03-21-58-27 +.. nonce: a9qM1j +.. section: Core and Builtins + +Convert :mod:`queue` to use heap types. + +.. + +.. bpo: 42246 +.. date: 2020-11-02-15-48-17 +.. nonce: 3CNQEX +.. section: Core and Builtins + +Improved accuracy of line tracing events and f_lineno attribute of Frame +objects. See PEP 626 for details. + +.. + +.. bpo: 40077 +.. date: 2020-11-02-14-39-48 +.. nonce: grY9TG +.. section: Core and Builtins + +Convert :mod:`mmap` to use heap types. + +.. + +.. bpo: 42233 +.. date: 2020-11-01-23-34-56 +.. nonce: zOSzja +.. section: Core and Builtins + +Allow ``GenericAlias`` objects to use :ref:`union type expressions +`. This allows expressions like ``list[int] | dict[float, +str]`` where previously a ``TypeError`` would have been thrown. This also +fixes union type expressions not de-duplicating ``GenericAlias`` objects. +(Contributed by Ken Jin in :issue:`42233`.) + +.. + +.. bpo: 26131 +.. date: 2020-10-22-17-27-08 +.. nonce: B-Veg7 +.. section: Core and Builtins + +The import system triggers a `ImportWarning` when it falls back to using +`load_module()`. + +.. + +.. bpo: 5054 +.. date: 2020-12-04-03-51-12 +.. nonce: 53StYZ +.. section: Library + +CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed. Replace the +special purpose getallmatchingheaders with generic get_all method and add +relevant tests. + +Original Patch by Martin Panter. Modified by Senthil Kumaran. + +.. + +.. bpo: 42562 +.. date: 2020-12-03-22-42-03 +.. nonce: 2hPmhi +.. section: Library + +Fix issue when dis failed to parse function that has no line numbers. Patch +provided by Yurii Karabas. + +.. + +.. bpo: 17735 +.. date: 2020-12-03-22-22-24 +.. nonce: Qsaaue +.. section: Library + +:func:`inspect.findsource` now raises :exc:`OSError` instead of +:exc:`IndexError` when :attr:`co_lineno` of a code object is greater than +the file length. This can happen, for example, when a file is edited after +it was imported. PR by Irit Katriel. + +.. + +.. bpo: 42116 +.. date: 2020-12-03-15-42-32 +.. nonce: yIwroP +.. section: Library + +Fix handling of trailing comments by :func:`inspect.getsource`. + +.. + +.. bpo: 42532 +.. date: 2020-12-02-07-37-59 +.. nonce: ObNep_ +.. section: Library + +Remove unexpected call of ``__bool__`` when passing a ``spec_arg`` argument +to a Mock. + +.. + +.. bpo: 38200 +.. date: 2020-11-28-22-52-57 +.. nonce: DuWGlW +.. section: Library + +Added itertools.pairwise() + +.. + +.. bpo: 41818 +.. date: 2020-11-28-06-34-53 +.. nonce: mFSMc2 +.. section: Library + +Fix test_master_read() so that it succeeds on all platforms that either +raise OSError or return b"" upon reading from master. + +.. + +.. bpo: 42487 +.. date: 2020-11-28-04-31-20 +.. nonce: iqtC4L +.. section: Library + +ChainMap.__iter__ no longer calls __getitem__ on underlying maps + +.. + +.. bpo: 42482 +.. date: 2020-11-27-16-46-58 +.. nonce: EJC3sd +.. section: Library + +:class:`~traceback.TracebackException` no longer holds a reference to the +exception's traceback object. Consequently, instances of TracebackException +for equivalent but non-equal exceptions now compare as equal. + +.. + +.. bpo: 41818 +.. date: 2020-11-27-09-19-43 +.. nonce: KWYUbL +.. section: Library + +Make test_openpty() avoid unexpected success due to number of rows and/or +number of columns being == 0. + +.. + +.. bpo: 42392 +.. date: 2020-11-26-12-40-16 +.. nonce: GbmdHE +.. section: Library + +Remove loop parameter from ``asyncio.subprocess`` and ``asyncio.tasks`` +functions. Patch provided by Yurii Karabas. + +.. + +.. bpo: 42392 +.. date: 2020-11-25-22-44-59 +.. nonce: T_DAEl +.. section: Library + +Remove loop parameter from ``asyncio.open_connection`` and +``asyncio.start_server`` functions. Patch provided by Yurii Karabas. + +.. + +.. bpo: 28468 +.. date: 2020-11-24-13-18-05 +.. nonce: 8Gh2d4 +.. section: Library + +Add :func:`platform.freedesktop_os_release` function to parse +freedesktop.org ``os-release`` files. + +.. + +.. bpo: 42299 +.. date: 2020-11-23-23-42-08 +.. nonce: Fdn4Wf +.. section: Library + +Removed the ``formatter`` module, which was deprecated in Python 3.4. It is +somewhat obsolete, little used, and not tested. It was originally scheduled +to be removed in Python 3.6, but such removals were delayed until after +Python 2.7 EOL. Existing users should copy whatever classes they use into +their code. Patch by Dong-hee Na and and Terry J. Reedy. + +.. + +.. bpo: 26131 +.. date: 2020-11-22-12-30-26 +.. nonce: -HsFPG +.. section: Library + +Deprecate zipimport.zipimporter.load_module() in favour of exec_module(). + +.. + +.. bpo: 41818 +.. date: 2020-11-20-14-44-07 +.. nonce: 33soAw +.. section: Library + +Updated tests for the pty library. test_basic() has been changed to +test_openpty(); this additionally checks if slave termios and slave winsize +are being set properly by pty.openpty(). In order to add support for +FreeBSD, NetBSD, OpenBSD, and Darwin, this also adds test_master_read(), +which demonstrates that pty.spawn() should not depend on an OSError to exit +from its copy loop. + +.. + +.. bpo: 42392 +.. date: 2020-11-20-14-01-29 +.. nonce: -OUzvl +.. section: Library + +Remove loop parameter from ``__init__`` in all ``asyncio.locks`` and +``asyncio.Queue`` classes. Patch provided by Yurii Karabas. + +.. + +.. bpo: 15450 +.. date: 2020-11-20-10-38-34 +.. nonce: E-y9PA +.. section: Library + +Make :class:`filecmp.dircmp` respect subclassing. Now the +:attr:`filecmp.dircmp.subdirs` behaves as expected when subclassing dircmp. + +.. + +.. bpo: 42413 +.. date: 2020-11-19-20-27-51 +.. nonce: fjHrHx +.. section: Library + +The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`. + +.. + +.. bpo: 31904 +.. date: 2020-11-19-16-14-36 +.. nonce: 83kf9d +.. section: Library + +Support signal module on VxWorks. + +.. + +.. bpo: 42406 +.. date: 2020-11-19-10-44-41 +.. nonce: r9rNCj +.. section: Library + +We fixed an issue in `pickle.whichmodule` in which importing +`multiprocessing` could change the how pickle identifies which module an +object belongs to, potentially breaking the unpickling of those objects. + +.. + +.. bpo: 42403 +.. date: 2020-11-19-10-12-39 +.. nonce: t7q5AX +.. section: Library + +Simplify the :mod:`importlib` external bootstrap code: +``importlib._bootstrap_external`` now uses regular imports to import builtin +modules. When it is imported, the builtin :func:`__import__()` function is +already fully working and so can be used to import builtin modules like +:mod:`sys`. Patch by Victor Stinner. + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-09-59-07 +.. nonce: 7cMypH +.. section: Library + +Convert _sre module types to heap types (PEP 384). Patch by Erlend E. +Aasland. + +.. + +.. bpo: 42375 +.. date: 2020-11-19-04-13-53 +.. nonce: U8bp4s +.. section: Library + +subprocess module update for DragonFlyBSD support. + +.. + +.. bpo: 41713 +.. date: 2020-11-17-23-00-27 +.. nonce: -Us0tf +.. section: Library + +Port the ``_signal`` extension module to the multi-phase initialization API +(:pep:`489`). Patch by Victor Stinner and Mohamed Koubaa. + +.. + +.. bpo: 37205 +.. date: 2020-11-16-15-08-12 +.. nonce: Wh5svI +.. section: Library + +:func:`time.time()`, :func:`time.perf_counter()` and +:func:`time.monotonic()` functions can no longer fail with a Python fatal +error, instead raise a regular Python exception on failure. + +.. + +.. bpo: 42328 +.. date: 2020-11-15-17-02-00 +.. nonce: bqpPlR +.. section: Library + +Fixed :meth:`tkinter.ttk.Style.map`. The function accepts now the +representation of the default state as empty sequence (as returned by +``Style.map()``). The structure of the result is now the same on all +platform and does not depend on the value of ``wantobjects``. + +.. + +.. bpo: 42345 +.. date: 2020-11-15-15-23-34 +.. nonce: hiIR7x +.. section: Library + +Fix various issues with ``typing.Literal`` parameter handling (flatten, +deduplicate, use type to cache key). Patch provided by Yurii Karabas. + +.. + +.. bpo: 37205 +.. date: 2020-11-14-14-34-32 +.. nonce: iDbHrw +.. section: Library + +:func:`time.perf_counter()` on Windows and :func:`time.monotonic()` on macOS +are now system-wide. Previously, they used an offset computed at startup to +reduce the precision loss caused by the float type. Use +:func:`time.perf_counter_ns()` and :func:`time.monotonic_ns()` added in +Python 3.7 to avoid this precision loss. + +.. + +.. bpo: 42318 +.. date: 2020-11-14-13-46-27 +.. nonce: wYAcBD +.. section: Library + +Fixed support of non-BMP characters in :mod:`tkinter` on macOS. + +.. + +.. bpo: 42350 +.. date: 2020-11-13-18-53-50 +.. nonce: rsql7V +.. section: Library + +Fix the :class:`threading.Thread` class at fork: do nothing if the thread is +already stopped (ex: fork called at Python exit). Previously, an error was +logged in the child process. + +.. + +.. bpo: 42333 +.. date: 2020-11-12-18-21-15 +.. nonce: J9vFmV +.. section: Library + +Port _ssl extension module to heap types. + +.. + +.. bpo: 42014 +.. date: 2020-11-10-15-40-56 +.. nonce: ShM37l +.. section: Library + +The ``onerror`` callback from ``shutil.rmtree`` now receives correct +function when ``os.open`` fails. + +.. + +.. bpo: 42237 +.. date: 2020-11-10-14-27-49 +.. nonce: F363jO +.. section: Library + +Fix `os.sendfile()` on illumos. + +.. + +.. bpo: 42308 +.. date: 2020-11-10-12-09-13 +.. nonce: yaJHH9 +.. section: Library + +Add :data:`threading.__excepthook__` to allow retrieving the original value +of :func:`threading.excepthook` in case it is set to a broken or a different +value. Patch by Mario Corchero. + +.. + +.. bpo: 42131 +.. date: 2020-11-06-18-20-47 +.. nonce: l2rjjG +.. section: Library + +Implement PEP 451/spec methods on zipimport.zipimporter: find_spec(), +create_module(), and exec_module(). + +This also allows for the documented deprecation of find_loader(), +find_module(), and load_module(). + +.. + +.. bpo: 41877 +.. date: 2020-11-05-16-00-03 +.. nonce: FHbngM +.. section: Library + +Mock objects which are not unsafe will now raise an AttributeError if an +attribute with the prefix asert, aseert, or assrt is accessed, in addition +to this already happening for the prefixes assert or assret. + +.. + +.. bpo: 42264 +.. date: 2020-11-05-13-32-41 +.. nonce: r4KYUU +.. section: Library + +``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python +3.3, when it was made an alias to :class:`str`. It is now deprecated, +scheduled for removal in Python 3.12. + +.. + +.. bpo: 42251 +.. date: 2020-11-03-14-15-35 +.. nonce: 6TC32V +.. section: Library + +Added :func:`threading.gettrace` and :func:`threading.getprofile` to +retrieve the functions set by :func:`threading.settrace` and +:func:`threading.setprofile` respectively. Patch by Mario Corchero. + +.. + +.. bpo: 42249 +.. date: 2020-11-03-09-22-56 +.. nonce: vfNO2u +.. section: Library + +Fixed writing binary Plist files larger than 4 GiB. + +.. + +.. bpo: 42236 +.. date: 2020-11-02-23-05-17 +.. nonce: aJ6ZBR +.. section: Library + +On Unix, the :func:`os.device_encoding` function now returns ``'UTF-8'`` +rather than the device encoding if the :ref:`Python UTF-8 Mode ` +is enabled. + +.. + +.. bpo: 41754 +.. date: 2020-11-01-15-07-20 +.. nonce: DraSZh +.. section: Library + +webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``. + +.. + +.. bpo: 42183 +.. date: 2020-10-29-11-17-35 +.. nonce: 50ZcIi +.. section: Library + +Fix a stack overflow error for asyncio Task or Future repr(). + +The overflow occurs under some circumstances when a Task or Future +recursively returns itself. + +.. + +.. bpo: 42140 +.. date: 2020-10-24-04-02-36 +.. nonce: miLqvb +.. section: Library + +Improve asyncio.wait function to create the futures set just one time. + +.. + +.. bpo: 42133 +.. date: 2020-10-23-15-47-47 +.. nonce: BzizYV +.. section: Library + +Update various modules in the stdlib to fall back on `__spec__.loader` when +`__loader__` isn't defined on a module. + +.. + +.. bpo: 26131 +.. date: 2020-10-22-17-26-35 +.. nonce: CAsI3O +.. section: Library + +The `load_module()` methods found in importlib now trigger a +DeprecationWarning. + +.. + +.. bpo: 39825 +.. date: 2020-10-20-08-28-26 +.. nonce: n6KnG0 +.. section: Library + +Windows: Change ``sysconfig.get_config_var('EXT_SUFFIX')`` to the expected +full ``platform_tag.extension`` format. Previously it was hard-coded to +``.pyd``, now it is compatible with ``distutils.sysconfig`` and will result +in something like ``.cp38-win_amd64.pyd``. This brings windows into +conformance with the other platforms. + +.. + +.. bpo: 26389 +.. date: 2020-10-08-23-51-55 +.. nonce: uga44e +.. section: Library + +The :func:`traceback.format_exception`, +:func:`traceback.format_exception_only`, and +:func:`traceback.print_exception` functions can now take an exception object +as a positional-only argument. + +.. + +.. bpo: 41889 +.. date: 2020-10-01-16-17-11 +.. nonce: qLkNh8 +.. section: Library + +Enum: fix regression involving inheriting a multiply-inherited enum + +.. + +.. bpo: 41861 +.. date: 2020-10-01-15-44-52 +.. nonce: YTqJ7z +.. section: Library + +Convert :mod:`sqlite3` to use heap types (PEP 384). Patch by Erlend E. +Aasland. + +.. + +.. bpo: 40624 +.. date: 2020-09-08-03-19-04 +.. nonce: 0-gYfx +.. section: Library + +Added support for the XPath ``!=`` operator in xml.etree + +.. + +.. bpo: 28850 +.. date: 2020-09-06-21-55-44 +.. nonce: HJNggD +.. section: Library + +Fix :meth:`pprint.PrettyPrinter.format` overrides being ignored for contents +of small containers. The :func:`pprint._safe_repr` function was removed. + +.. + +.. bpo: 41625 +.. date: 2020-08-24-16-59-04 +.. nonce: Cc967V +.. section: Library + +Expose the :c:func:`splice` as :func:`os.splice` in the :mod:`os` module. +Patch by Pablo Galindo + +.. + +.. bpo: 34215 +.. date: 2020-08-19-20-17-51 +.. nonce: _Cv8c- +.. section: Library + +Clarify the error message for :exc:`asyncio.IncompleteReadError` when +``expected`` is ``None``. + +.. + +.. bpo: 41543 +.. date: 2020-08-14-00-39-04 +.. nonce: RpcRjb +.. section: Library + +Add async context manager support for contextlib.nullcontext. + +.. + +.. bpo: 21041 +.. date: 2020-08-10-15-06-55 +.. nonce: cYz1eL +.. section: Library + +:attr:`pathlib.PurePath.parents` now supports negative indexing. Patch +contributed by Yaroslav Pankovych. + +.. + +.. bpo: 41332 +.. date: 2020-07-18-17-39-28 +.. nonce: QRGmA5 +.. section: Library + +Added missing connect_accepted_socket() method to +``asyncio.AbstractEventLoop``. + +.. + +.. bpo: 12800 +.. date: 2020-07-09-11-32-28 +.. nonce: fNgWwx +.. section: Library + +Extracting a symlink from a tarball should succeed and overwrite the symlink +if it already exists. The fix is to remove the existing file or symlink +before extraction. Based on patch by Chris AtLee, Jeffrey Kintscher, and +Senthil Kumaran. + +.. + +.. bpo: 40968 +.. date: 2020-06-18-11-35-16 +.. nonce: R8Edbv +.. section: Library + +:mod:`urllib.request` and :mod:`http.client` now send ``http/1.1`` ALPN +extension during TLS handshake when no custom context is supplied. + +.. + +.. bpo: 41001 +.. date: 2020-06-17-12-24-26 +.. nonce: 5mi7b0 +.. section: Library + +Add func:`os.eventfd` to provide a low level interface for Linux's event +notification file descriptor. + +.. + +.. bpo: 40816 +.. date: 2020-05-29-15-25-41 +.. nonce: w61Pob +.. section: Library + +Add AsyncContextDecorator to contextlib to support async context manager as +a decorator. + +.. + +.. bpo: 40550 +.. date: 2020-05-08-21-30-54 +.. nonce: i7GWkb +.. section: Library + +Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal. + +.. + +.. bpo: 39411 +.. date: 2020-01-21-16-38-25 +.. nonce: 9uHFqT +.. section: Library + +Add an ``is_async`` identifier to :mod:`pyclbr`'s ``Function`` objects. +Patch by Batuhan Taskaya + +.. + +.. bpo: 35498 +.. date: 2018-12-14-13-29-17 +.. nonce: LEJHl7 +.. section: Library + +Add slice support to :attr:`pathlib.PurePath.parents`. + +.. + +.. bpo: 42238 +.. date: 2020-11-24-22-54-49 +.. nonce: 62EOTu +.. section: Documentation + +Tentative to deprecate ``make suspicious`` by first removing it from the CI +and documentation builds, but keeping it around for manual uses. + +.. + +.. bpo: 42153 +.. date: 2020-11-15-13-46-31 +.. nonce: KjBhx3 +.. section: Documentation + +Fix the URL for the IMAP protocol documents. + +.. + +.. bpo: 41028 +.. date: 2020-06-18-23-37-03 +.. nonce: vM8bC8 +.. section: Documentation + +Language and version switchers, previously maintained in every cpython +branches, are now handled by docsbuild-script. + +.. + +.. bpo: 41473 +.. date: 2020-12-04-11-47-09 +.. nonce: W_updK +.. section: Tests + +Reenable test_gdb on gdb 9.2 and newer: +https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb +10.1. + +.. + +.. bpo: 42553 +.. date: 2020-12-03-13-32-44 +.. nonce: 2TRE2N +.. section: Tests + +Fix ``test_asyncio.test_call_later()`` race condition: don't measure asyncio +performance in the ``call_later()`` unit test. The test failed randomly on +the CI. + +.. + +.. bpo: 31904 +.. date: 2020-12-01-15-51-19 +.. nonce: iwetj4 +.. section: Tests + +Fix test_netrc on VxWorks: create temporary directories using temp_cwd(). + +.. + +.. bpo: 31904 +.. date: 2020-11-26-11-13-13 +.. nonce: ay4g89 +.. section: Tests + +skip test_getaddrinfo_ipv6_scopeid_symbolic and +test_getnameinfo_ipv6_scopeid_symbolic on VxWorks + +.. + +.. bpo: 31904 +.. date: 2020-11-25-17-00-53 +.. nonce: ue4hd9 +.. section: Tests + +skip test_test of test_mailcap on VxWorks + +.. + +.. bpo: 31904 +.. date: 2020-11-24-17-26-41 +.. nonce: eug834 +.. section: Tests + +add shell requirement for test_pipes + +.. + +.. bpo: 31904 +.. date: 2020-11-23-11-11-29 +.. nonce: V3sUZk +.. section: Tests + +skip some tests related to fifo on VxWorks + +.. + +.. bpo: 31904 +.. date: 2020-11-20-15-07-18 +.. nonce: EBJXjJ +.. section: Tests + +Fix test_doctest.py failures for VxWorks. + +.. + +.. bpo: 40754 +.. date: 2020-11-13-21-51-34 +.. nonce: Ekoxkg +.. section: Tests + +Include ``_testinternalcapi`` module in Windows installer for test suite + +.. + +.. bpo: 41561 +.. date: 2020-09-18-16-14-03 +.. nonce: uPnwrW +.. section: Tests + +test_ssl: skip test_min_max_version_mismatch when TLS 1.0 is not available + +.. + +.. bpo: 31904 +.. date: 2020-05-20-17-28-46 +.. nonce: yt83Ge +.. section: Tests + +Fix os module failures for VxWorks RTOS. + +.. + +.. bpo: 31904 +.. date: 2020-05-20-14-28-48 +.. nonce: yJik6k +.. section: Tests + +Fix fifo test cases for VxWorks RTOS. + +.. + +.. bpo: 31904 +.. date: 2020-11-19-17-01-50 +.. nonce: 894dk2 +.. section: Build + +remove libnet dependency from detect_socket() for VxWorks + +.. + +.. bpo: 42398 +.. date: 2020-11-18-11-58-44 +.. nonce: Yt5wO8 +.. section: Build + +Fix a race condition in "make regen-all" when make -jN option is used to run +jobs in parallel. The clinic.py script now only use atomic write to write +files. Moveover, generated files are now left unchanged if the content does +not change, to not change the file modification time. + +.. + +.. bpo: 41617 +.. date: 2020-11-13-15-04-53 +.. nonce: 98_oaE +.. section: Build + +Fix building ``pycore_bitutils.h`` internal header on old clang version +without ``__builtin_bswap16()`` (ex: Xcode 4.6.3 on Mac OS X 10.7). Patch by +Joshua Root and Victor Stinner. + +.. + +.. bpo: 38823 +.. date: 2020-11-12-13-45-15 +.. nonce: C0z_Fe +.. section: Build + +It is no longer possible to build the ``_ctypes`` extension module without +:c:type:`wchar_t` type: remove ``CTYPES_UNICODE`` macro. Anyway, the +:c:type:`wchar_t` type is required to build Python. Patch by Victor Stinner. + +.. + +.. bpo: 42087 +.. date: 2020-10-19-15-41-05 +.. nonce: 2AhRFP +.. section: Build + +Support was removed for AIX 5.3 and below. See :issue:`40680`. + +.. + +.. bpo: 40998 +.. date: 2020-06-17-09-05-02 +.. nonce: sgqmg9 +.. section: Build + +Addressed three compiler warnings found by undefined behavior sanitizer +(ubsan). + +.. + +.. bpo: 42120 +.. date: 2020-11-16-22-41-02 +.. nonce: 9scgko +.. section: Windows + +Remove macro definition of ``copysign`` (to ``_copysign``) in headers. + +.. + +.. bpo: 38506 +.. date: 2020-11-15-23-01-14 +.. nonce: hhdnuP +.. section: Windows + +The Windows launcher now properly handles Python 3.10 when listing installed +Python versions. + +.. + +.. bpo: 42504 +.. date: 2020-12-02-15-48-40 +.. nonce: RQmMOR +.. section: macOS + +Fix build on macOS Big Sur when MACOSX_DEPLOYMENT_TARGET=11 + +.. + +.. bpo: 41116 +.. date: 2020-11-15-16-43-45 +.. nonce: oCkbrF +.. section: macOS + +Ensure distutils.unixxcompiler.find_library_file can find system provided +libraries on macOS 11. + +.. + +.. bpo: 41100 +.. date: 2020-11-01-16-40-23 +.. nonce: BApztP +.. section: macOS + +Add support for macOS 11 and Apple Silicon systems. + +It is now possible to build "Universal 2" binaries using +"--enable-universalsdk --with-universal-archs=universal2". + +Binaries build on later macOS versions can be deployed back to older +versions (tested up to macOS 10.9), when using the correct deployment +target. This is tested using Xcode 11 and later. + +.. + +.. bpo: 42232 +.. date: 2020-11-01-15-10-28 +.. nonce: 2zI1GN +.. section: macOS + +Added Darwin specific madvise options to mmap module. + +.. + +.. bpo: 38443 +.. date: 2020-10-23-10-26-53 +.. nonce: vu64tl +.. section: macOS + +The ``--enable-universalsdk`` and ``--with-universal-archs`` options for the +configure script now check that the specified architectures can be used. + +.. + +.. bpo: 42508 +.. date: 2020-11-30-19-46-05 +.. nonce: fE7w4M +.. section: IDLE + +Keep IDLE running on macOS. Remove obsolete workaround that prevented +running files with shortcuts when using new universal2 installers built on +macOS 11. + +.. + +.. bpo: 42426 +.. date: 2020-11-21-17-21-21 +.. nonce: kNnPoC +.. section: IDLE + +Fix reporting offset of the RE error in searchengine. + +.. + +.. bpo: 42415 +.. date: 2020-11-20-01-30-27 +.. nonce: CyD-va +.. section: IDLE + +Get docstrings for IDLE calltips more often by using inspect.getdoc. + +.. + +.. bpo: 42212 +.. date: 2020-11-20-15-11-05 +.. nonce: sjzgOf +.. section: Tools/Demos + +The smelly.py script now also checks the Python dynamic library and +extension modules, not only the Python static library. Make also the script +more verbose: explain what it does. + +.. + +.. bpo: 36310 +.. date: 2020-05-03-01-30-46 +.. nonce: xDxxwY +.. section: Tools/Demos + +Allow :file:`Tools/i18n/pygettext.py` to detect calls to ``gettext`` in +f-strings. + +.. + +.. bpo: 42423 +.. date: 2020-11-21-12-27-19 +.. nonce: ByJHhY +.. section: C API + +The :c:func:`PyType_FromSpecWithBases` and +:c:func:`PyType_FromModuleAndSpec` functions now accept a single class as +the *bases* argument. + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-17-44-36 +.. nonce: qBZc3o +.. section: C API + +Port :mod:`select` extension module to multiphase initialization +(:pep:`489`). + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-16-54-16 +.. nonce: 9tVsZt +.. section: C API + +Port _posixsubprocess extension module to multiphase initialization +(:pep:`489`). + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-15-33-42 +.. nonce: 9tVsZt +.. section: C API + +Port _posixshmem extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-12-06-43 +.. nonce: KEfZpn +.. section: C API + +Port _struct extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-19-09-17-01 +.. nonce: 6F9o6L +.. section: C API + +Port :mod:`spwd` extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-20-33-35 +.. nonce: B4ztSk +.. section: C API + +Port :mod:`gc` extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-20-11-13 +.. nonce: fe3iRb +.. section: C API + +Port _queue extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 39573 +.. date: 2020-11-18-15-21-59 +.. nonce: VB3G2y +.. section: C API + +Convert :c:func:`Py_TYPE` and :c:func:`Py_SIZE` back to macros to allow +using them as an l-value. Many third party C extension modules rely on the +ability of using Py_TYPE() and Py_SIZE() to set an object type and size: +``Py_TYPE(obj) = type;`` and ``Py_SIZE(obj) = size;``. + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-10-52-38 +.. nonce: FrWAwJ +.. section: C API + +Port :mod:`symtable` extension module to multiphase initialization +(:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-09-46-35 +.. nonce: SH8OIT +.. section: C API + +Port :mod:`grp` and :mod:`pwd` extension modules to multiphase +initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-09-16-23 +.. nonce: gkoI7Y +.. section: C API + +Port _random extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 1635741 +.. date: 2020-11-18-08-45-36 +.. nonce: VLZfiY +.. section: C API + +Port _hashlib extension module to multiphase initialization (:pep:`489`) + +.. + +.. bpo: 41713 +.. date: 2020-11-17-15-39-10 +.. nonce: Rq99Vc +.. section: C API + +Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing +Python already implicitly installs signal handlers: see +:c:member:`PyConfig.install_signal_handlers`. Patch by Victor Stinner. + +.. + +.. bpo: 40170 +.. date: 2020-11-13-01-40-28 +.. nonce: uh8lEf +.. section: C API + +The ``Py_TRASHCAN_BEGIN`` macro no longer accesses PyTypeObject attributes, +but now can get the condition by calling the new private +:c:func:`_PyTrash_cond()` function which hides implementation details. + +.. + +.. bpo: 42260 +.. date: 2020-11-10-14-27-39 +.. nonce: -Br3Co +.. section: C API + +:c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, +:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and +:c:func:`Py_GetProgramName` functions now return ``NULL`` if called before +:c:func:`Py_Initialize` (before Python is initialized). Use the new +:ref:`Python Initialization Configuration API ` to get the +:ref:`Python Path Configuration. `. Patch by Victor +Stinner. + +.. + +.. bpo: 42260 +.. date: 2020-11-05-18-02-07 +.. nonce: pAeaNR +.. section: C API + +The :c:func:`PyConfig_Read` function now only parses +:c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv` is +set to ``2`` after arguments are parsed. Since Python arguments are +strippped from :c:member:`PyConfig.argv`, parsing arguments twice would +parse the application options as Python options. + +.. + +.. bpo: 42262 +.. date: 2020-11-04-17-22-36 +.. nonce: fCWzBb +.. section: C API + +Added :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment +the reference count of an object and return the object. Patch by Victor +Stinner. + +.. + +.. bpo: 42260 +.. date: 2020-11-04-16-31-55 +.. nonce: CmgHtF +.. section: C API + +When :c:func:`Py_Initialize` is called twice, the second call now updates +more :mod:`sys` attributes for the configuration, rather than only +:data:`sys.argv`. Patch by Victor Stinner. + +.. + +.. bpo: 41832 +.. date: 2020-11-03-19-47-06 +.. nonce: dL1VJJ +.. section: C API + +The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` +slot. + +.. + +.. bpo: 1635741 +.. date: 2020-11-03-11-52-27 +.. nonce: aDYJKB +.. section: C API + +Added :c:func:`PyModule_AddObjectRef` function: similar to +:c:func:`PyModule_AddObject` but don't steal a reference to the value on +success. Patch by Victor Stinner. + +.. + +.. bpo: 42171 +.. date: 2020-10-27-21-10-14 +.. nonce: S3FWTP +.. section: C API + +The :c:data:`METH_FASTCALL` calling convention is added to the limited API. +The functions :c:func:`PyModule_AddType`, +:c:func:`PyType_FromModuleAndSpec`, :c:func:`PyType_GetModule` and +:c:func:`PyType_GetModuleState` are added to the limited API on Windows. + +.. + +.. bpo: 42085 +.. date: 2020-10-19-15-58-16 +.. nonce: NhEf3W +.. section: C API + +Add dedicated entry to PyAsyncMethods for sending values + +.. + +.. bpo: 41073 +.. date: 2020-07-08-21-01-49 +.. nonce: VqQZON +.. section: C API + +:c:func:`PyType_GetSlot()` can now accept static types. + +.. + +.. bpo: 30459 +.. date: 2020-05-06-23-54-57 +.. nonce: N9_Jai +.. section: C API + +:c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and +:c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. For +example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = +x`` now fail with a compiler error. It prevents bugs like ``if +(PyList_SET_ITEM (a, b, c) < 0) ...`` test. Patch by Zackery Spytz and +Victor Stinner. diff --git a/Misc/NEWS.d/next/Build/2020-11-12-13-45-15.bpo-38823.C0z_Fe.rst b/Misc/NEWS.d/next/Build/2020-11-12-13-45-15.bpo-38823.C0z_Fe.rst deleted file mode 100644 index 4a0f11de5e420d..00000000000000 --- a/Misc/NEWS.d/next/Build/2020-11-12-13-45-15.bpo-38823.C0z_Fe.rst +++ /dev/null @@ -1,3 +0,0 @@ -It is no longer possible to build the ``_ctypes`` extension module without -:c:type:`wchar_t` type: remove ``CTYPES_UNICODE`` macro. Anyway, the -:c:type:`wchar_t` type is required to build Python. Patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/C API/2020-07-08-21-01-49.bpo-41073.VqQZON.rst b/Misc/NEWS.d/next/C API/2020-07-08-21-01-49.bpo-41073.VqQZON.rst deleted file mode 100644 index 1bec2f1a197e1a..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-07-08-21-01-49.bpo-41073.VqQZON.rst +++ /dev/null @@ -1 +0,0 @@ -:c:func:`PyType_GetSlot()` can now accept static types. diff --git a/Misc/NEWS.d/next/C API/2020-10-19-15-58-16.bpo-42085.NhEf3W.rst b/Misc/NEWS.d/next/C API/2020-10-19-15-58-16.bpo-42085.NhEf3W.rst deleted file mode 100644 index 53338fb4f446e1..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-10-19-15-58-16.bpo-42085.NhEf3W.rst +++ /dev/null @@ -1 +0,0 @@ -Add dedicated entry to PyAsyncMethods for sending values diff --git a/Misc/NEWS.d/next/C API/2020-10-21-18-43-06.bpo-42111.9pvtrc.rst b/Misc/NEWS.d/next/C API/2020-10-21-18-43-06.bpo-42111.9pvtrc.rst new file mode 100644 index 00000000000000..3fb718cc45d42c --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-10-21-18-43-06.bpo-42111.9pvtrc.rst @@ -0,0 +1,2 @@ +Update the ``xxlimited`` module to be a better example of how to use the +limited C API. diff --git a/Misc/NEWS.d/next/C API/2020-10-27-21-10-14.bpo-42171.S3FWTP.rst b/Misc/NEWS.d/next/C API/2020-10-27-21-10-14.bpo-42171.S3FWTP.rst deleted file mode 100644 index 5dfbb23a6a39a4..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-10-27-21-10-14.bpo-42171.S3FWTP.rst +++ /dev/null @@ -1,4 +0,0 @@ -The :c:data:`METH_FASTCALL` calling convention is added to the limited API. -The functions :c:func:`PyModule_AddType`, :c:func:`PyType_FromModuleAndSpec`, -:c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` are added to -the limited API on Windows. diff --git a/Misc/NEWS.d/next/C API/2020-11-03-11-52-27.bpo-1635741.aDYJKB.rst b/Misc/NEWS.d/next/C API/2020-11-03-11-52-27.bpo-1635741.aDYJKB.rst deleted file mode 100644 index 2c118129dbf104..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-03-11-52-27.bpo-1635741.aDYJKB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added :c:func:`PyModule_AddObjectRef` function: similar to -:c:func:`PyModule_AddObject` but don't steal a reference to the value on -success. Patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/C API/2020-11-03-19-47-06.bpo-41832.dL1VJJ.rst b/Misc/NEWS.d/next/C API/2020-11-03-19-47-06.bpo-41832.dL1VJJ.rst deleted file mode 100644 index e0bce54eb93648..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-03-19-47-06.bpo-41832.dL1VJJ.rst +++ /dev/null @@ -1,2 +0,0 @@ -The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` -slot. diff --git a/Misc/NEWS.d/next/C API/2020-11-04-16-31-55.bpo-42260.CmgHtF.rst b/Misc/NEWS.d/next/C API/2020-11-04-16-31-55.bpo-42260.CmgHtF.rst deleted file mode 100644 index 694dd550a8e18d..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-04-16-31-55.bpo-42260.CmgHtF.rst +++ /dev/null @@ -1,3 +0,0 @@ -When :c:func:`Py_Initialize` is called twice, the second call now updates -more :mod:`sys` attributes for the configuration, rather than only -:data:`sys.argv`. Patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/C API/2020-11-04-17-22-36.bpo-42262.fCWzBb.rst b/Misc/NEWS.d/next/C API/2020-11-04-17-22-36.bpo-42262.fCWzBb.rst deleted file mode 100644 index 8c1e4f418443be..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-04-17-22-36.bpo-42262.fCWzBb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the -reference count of an object and return the object. Patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/C API/2020-11-05-18-02-07.bpo-42260.pAeaNR.rst b/Misc/NEWS.d/next/C API/2020-11-05-18-02-07.bpo-42260.pAeaNR.rst deleted file mode 100644 index 0d6a277db88d45..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-05-18-02-07.bpo-42260.pAeaNR.rst +++ /dev/null @@ -1,5 +0,0 @@ -The :c:func:`PyConfig_Read` function now only parses :c:member:`PyConfig.argv` -arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments -are parsed. Since Python arguments are strippped from -:c:member:`PyConfig.argv`, parsing arguments twice would parse the application -options as Python options. diff --git a/Misc/NEWS.d/next/C API/2020-11-10-14-27-39.bpo-42260.-Br3Co.rst b/Misc/NEWS.d/next/C API/2020-11-10-14-27-39.bpo-42260.-Br3Co.rst deleted file mode 100644 index e7b5a558fd4c58..00000000000000 --- a/Misc/NEWS.d/next/C API/2020-11-10-14-27-39.bpo-42260.-Br3Co.rst +++ /dev/null @@ -1,7 +0,0 @@ -:c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, -:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and -:c:func:`Py_GetProgramName` functions now return ``NULL`` if called before -:c:func:`Py_Initialize` (before Python is initialized). Use the new -:ref:`Python Initialization Configuration API ` to get the -:ref:`Python Path Configuration. `. Patch by Victor -Stinner. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-01-23-34-56.bpo-42233.zOSzja.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-01-23-34-56.bpo-42233.zOSzja.rst deleted file mode 100644 index 499bb324fb935e..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-01-23-34-56.bpo-42233.zOSzja.rst +++ /dev/null @@ -1,5 +0,0 @@ -Allow ``GenericAlias`` objects to use :ref:`union type expressions `. -This allows expressions like ``list[int] | dict[float, str]`` where previously a -``TypeError`` would have been thrown. This also fixes union type expressions -not de-duplicating ``GenericAlias`` objects. (Contributed by Ken Jin in -:issue:`42233`.) diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-02-14-39-48.bpo-40077.grY9TG.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-02-14-39-48.bpo-40077.grY9TG.rst deleted file mode 100644 index 48565a5a0daefe..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-02-14-39-48.bpo-40077.grY9TG.rst +++ /dev/null @@ -1 +0,0 @@ -Convert :mod:`mmap` to use heap types. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-02-15-48-17.bpo-42246.3CNQEX.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-02-15-48-17.bpo-42246.3CNQEX.rst deleted file mode 100644 index 358454ce40a7f1..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-02-15-48-17.bpo-42246.3CNQEX.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improved accuracy of line tracing events and f_lineno attribute of Frame -objects. See PEP 626 for details. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-03-21-58-27.bpo-40077.a9qM1j.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-03-21-58-27.bpo-40077.a9qM1j.rst deleted file mode 100644 index 369ba6b63ce2b9..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-03-21-58-27.bpo-40077.a9qM1j.rst +++ /dev/null @@ -1 +0,0 @@ -Convert :mod:`queue` to use heap types. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-04-23-03-25.bpo-42266.G4hGDe.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-04-23-03-25.bpo-42266.G4hGDe.rst deleted file mode 100644 index a8598cfde04205..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-04-23-03-25.bpo-42266.G4hGDe.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a bug with the LOAD_ATTR opcode cache that was not respecting -monkey-patching a class-level attribute to make it a descriptor. Patch by -Pablo Galindo. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-07-21-02-05.bpo-42282.M1W4Wj.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-07-21-02-05.bpo-42282.M1W4Wj.rst deleted file mode 100644 index 74f5c3362385c9..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-11-07-21-02-05.bpo-42282.M1W4Wj.rst +++ /dev/null @@ -1,3 +0,0 @@ -Optimise constant subexpressions that appear as part of named expressions -(previously the AST optimiser did not descend into named expressions). -Patch by Nick Coghlan. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-12-04-17-17-44.bpo-32381.NY5t2S.rst b/Misc/NEWS.d/next/Core and Builtins/2020-12-04-17-17-44.bpo-32381.NY5t2S.rst new file mode 100644 index 00000000000000..f4d84f9d848d4f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-12-04-17-17-44.bpo-32381.NY5t2S.rst @@ -0,0 +1,3 @@ +Fix encoding name when running a ``.pyc`` file on Windows: +:c:func:`PyRun_SimpleFileExFlags()` now uses the correct encoding to decode +the filename. diff --git a/Misc/NEWS.d/next/Documentation/2020-06-18-23-37-03.bpo-41028.vM8bC8.rst b/Misc/NEWS.d/next/Documentation/2020-06-18-23-37-03.bpo-41028.vM8bC8.rst deleted file mode 100644 index 5fc4155b55346b..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2020-06-18-23-37-03.bpo-41028.vM8bC8.rst +++ /dev/null @@ -1,2 +0,0 @@ -Language and version switchers, previously maintained in every cpython -branches, are now handled by docsbuild-script. diff --git a/Misc/NEWS.d/next/Library/2020-01-21-16-38-25.bpo-39411.9uHFqT.rst b/Misc/NEWS.d/next/Library/2020-01-21-16-38-25.bpo-39411.9uHFqT.rst deleted file mode 100644 index 2377eef4b9f717..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-01-21-16-38-25.bpo-39411.9uHFqT.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add an ``is_async`` identifier to :mod:`pyclbr`'s ``Function`` objects. -Patch by Batuhan Taskaya diff --git a/Misc/NEWS.d/next/Library/2020-05-29-15-25-41.bpo-40816.w61Pob.rst b/Misc/NEWS.d/next/Library/2020-05-29-15-25-41.bpo-40816.w61Pob.rst deleted file mode 100644 index 66b75779784655..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-05-29-15-25-41.bpo-40816.w61Pob.rst +++ /dev/null @@ -1 +0,0 @@ -Add AsyncContextDecorator to contextlib to support async context manager as a decorator. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2020-08-03-17-54-32.bpo-41462.ek38d_.rst b/Misc/NEWS.d/next/Library/2020-08-03-17-54-32.bpo-41462.ek38d_.rst new file mode 100644 index 00000000000000..ca5da1b17b4363 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-08-03-17-54-32.bpo-41462.ek38d_.rst @@ -0,0 +1 @@ +Add :func:`os.set_blocking()` support for VxWorks RTOS. diff --git a/Misc/NEWS.d/next/Library/2020-08-14-00-39-04.bpo-41543.RpcRjb.rst b/Misc/NEWS.d/next/Library/2020-08-14-00-39-04.bpo-41543.RpcRjb.rst deleted file mode 100644 index 753dc763f217c4..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-08-14-00-39-04.bpo-41543.RpcRjb.rst +++ /dev/null @@ -1 +0,0 @@ -Add async context manager support for contextlib.nullcontext. diff --git a/Misc/NEWS.d/next/Library/2020-09-08-03-19-04.bpo-40624.0-gYfx.rst b/Misc/NEWS.d/next/Library/2020-09-08-03-19-04.bpo-40624.0-gYfx.rst deleted file mode 100644 index 78bad6e4686bee..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-09-08-03-19-04.bpo-40624.0-gYfx.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for the XPath ``!=`` operator in xml.etree diff --git a/Misc/NEWS.d/next/Library/2020-10-02-10-19-49.bpo-41907.wiIEsz.rst b/Misc/NEWS.d/next/Library/2020-10-02-10-19-49.bpo-41907.wiIEsz.rst new file mode 100644 index 00000000000000..aa337b38046e61 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-10-02-10-19-49.bpo-41907.wiIEsz.rst @@ -0,0 +1 @@ +fix `format()` behavior for `IntFlag` diff --git a/Misc/NEWS.d/next/Library/2020-10-08-23-51-55.bpo-26389.uga44e.rst b/Misc/NEWS.d/next/Library/2020-10-08-23-51-55.bpo-26389.uga44e.rst deleted file mode 100644 index a721a0d7cd0e80..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-10-08-23-51-55.bpo-26389.uga44e.rst +++ /dev/null @@ -1,4 +0,0 @@ -The :func:`traceback.format_exception`, -:func:`traceback.format_exception_only`, and -:func:`traceback.print_exception` functions can now take an exception object -as a positional-only argument. diff --git a/Misc/NEWS.d/next/Library/2020-10-23-15-47-47.bpo-42133.BzizYV.rst b/Misc/NEWS.d/next/Library/2020-10-23-15-47-47.bpo-42133.BzizYV.rst deleted file mode 100644 index f3cfa1a8dce338..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-10-23-15-47-47.bpo-42133.BzizYV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update various modules in the stdlib to fall back on `__spec__.loader` when -`__loader__` isn't defined on a module. diff --git a/Misc/NEWS.d/next/Library/2020-10-24-04-02-36.bpo-42140.miLqvb.rst b/Misc/NEWS.d/next/Library/2020-10-24-04-02-36.bpo-42140.miLqvb.rst deleted file mode 100644 index 4160234b5ec685..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-10-24-04-02-36.bpo-42140.miLqvb.rst +++ /dev/null @@ -1 +0,0 @@ -Improve asyncio.wait function to create the futures set just one time. diff --git a/Misc/NEWS.d/next/Library/2020-10-29-11-17-35.bpo-42183.50ZcIi.rst b/Misc/NEWS.d/next/Library/2020-10-29-11-17-35.bpo-42183.50ZcIi.rst deleted file mode 100644 index f6d7653f2cf09f..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-10-29-11-17-35.bpo-42183.50ZcIi.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix a stack overflow error for asyncio Task or Future repr(). - -The overflow occurs under some circumstances when a Task or Future -recursively returns itself. diff --git a/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst b/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst deleted file mode 100644 index 181c2d9650a14c..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst +++ /dev/null @@ -1 +0,0 @@ -webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``. diff --git a/Misc/NEWS.d/next/Library/2020-11-02-23-05-17.bpo-42236.aJ6ZBR.rst b/Misc/NEWS.d/next/Library/2020-11-02-23-05-17.bpo-42236.aJ6ZBR.rst deleted file mode 100644 index 15e2620366556b..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-02-23-05-17.bpo-42236.aJ6ZBR.rst +++ /dev/null @@ -1,3 +0,0 @@ -On Unix, the :func:`os.device_encoding` function now returns ``'UTF-8'`` rather -than the device encoding if the :ref:`Python UTF-8 Mode ` is -enabled. diff --git a/Misc/NEWS.d/next/Library/2020-11-03-09-22-56.bpo-42249.vfNO2u.rst b/Misc/NEWS.d/next/Library/2020-11-03-09-22-56.bpo-42249.vfNO2u.rst deleted file mode 100644 index 071a0fdda1ff80..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-03-09-22-56.bpo-42249.vfNO2u.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed writing binary Plist files larger than 4 GiB. diff --git a/Misc/NEWS.d/next/Library/2020-11-03-14-15-35.bpo-42251.6TC32V.rst b/Misc/NEWS.d/next/Library/2020-11-03-14-15-35.bpo-42251.6TC32V.rst deleted file mode 100644 index 7435c837a2cbe1..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-03-14-15-35.bpo-42251.6TC32V.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added :func:`threading.gettrace` and :func:`threading.getprofile` to -retrieve the functions set by :func:`threading.settrace` and -:func:`threading.setprofile` respectively. Patch by Mario Corchero. diff --git a/Misc/NEWS.d/next/Library/2020-11-05-16-00-03.bpo-41877.FHbngM.rst b/Misc/NEWS.d/next/Library/2020-11-05-16-00-03.bpo-41877.FHbngM.rst deleted file mode 100644 index 6f6fccb1d4cd18..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-05-16-00-03.bpo-41877.FHbngM.rst +++ /dev/null @@ -1,2 +0,0 @@ -Mock objects which are not unsafe will now raise an AttributeError if an attribute with the prefix asert, aseert, -or assrt is accessed, in addition to this already happening for the prefixes assert or assret. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2020-11-10-14-27-49.bpo-42237.F363jO.rst b/Misc/NEWS.d/next/Library/2020-11-10-14-27-49.bpo-42237.F363jO.rst deleted file mode 100644 index 50cab6e1f11f84..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-10-14-27-49.bpo-42237.F363jO.rst +++ /dev/null @@ -1 +0,0 @@ -Fix `os.sendfile()` on illumos. diff --git a/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst b/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst deleted file mode 100644 index d3e1abcd84c1e8..00000000000000 --- a/Misc/NEWS.d/next/Library/2020-11-10-15-40-56.bpo-42014.ShM37l.rst +++ /dev/null @@ -1 +0,0 @@ -The ``onerror`` callback from ``shutil.rmtree`` now receives correct function when ``os.open`` fails. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2020-07-30-14-08-58.bpo-41439.yhteoi.rst b/Misc/NEWS.d/next/Tests/2020-07-30-14-08-58.bpo-41439.yhteoi.rst new file mode 100644 index 00000000000000..0451503a52e93a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-07-30-14-08-58.bpo-41439.yhteoi.rst @@ -0,0 +1 @@ +Port test_ssl and test_uuid to VxWorks RTOS. diff --git a/Misc/NEWS.d/next/Tests/2020-07-30-18-43-05.bpo-41443.834gyg.rst b/Misc/NEWS.d/next/Tests/2020-07-30-18-43-05.bpo-41443.834gyg.rst new file mode 100644 index 00000000000000..439f3e36470150 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-07-30-18-43-05.bpo-41443.834gyg.rst @@ -0,0 +1 @@ +Add more attribute checking in test_posix.py diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-05-03-01-30-46.bpo-36310.xDxxwY.rst b/Misc/NEWS.d/next/Tools-Demos/2020-05-03-01-30-46.bpo-36310.xDxxwY.rst deleted file mode 100644 index 16749a8fc9665b..00000000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2020-05-03-01-30-46.bpo-36310.xDxxwY.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow :file:`Tools/i18n/pygettext.py` to detect calls to ``gettext`` in -f-strings. \ No newline at end of file diff --git a/Misc/NEWS.d/next/macOS/2020-11-01-16-40-23.bpo-41100.BApztP.rst b/Misc/NEWS.d/next/macOS/2020-11-01-16-40-23.bpo-41100.BApztP.rst deleted file mode 100644 index 6cbb279e7625ea..00000000000000 --- a/Misc/NEWS.d/next/macOS/2020-11-01-16-40-23.bpo-41100.BApztP.rst +++ /dev/null @@ -1,8 +0,0 @@ -Add support for macOS 11 and Apple Silicon systems. - -It is now possible to build "Universal 2" binaries using -"--enable-universalsdk --with-universal-archs=universal2". - -Binaries build on later macOS versions can be deployed back to older -versions (tested up to macOS 10.9), when using the correct deployment -target. This is tested using Xcode 11 and later. diff --git a/Misc/README.AIX b/Misc/README.AIX index 92ad0293e65850..6903a8146f0479 100644 --- a/Misc/README.AIX +++ b/Misc/README.AIX @@ -37,11 +37,6 @@ cd Python-3.2 CC=xlc_r OPT="-O2 -qmaxmem=70000" ./configure --without-computed-gotos --enable-shared make -Note: -On AIX 5.3 and earlier, you will also need to specify the -"--disable-ipv6" flag to configure. This has been corrected in AIX -6.1. - ====================================================================== Memory Limitations diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c index 8e1acce56b1d29..5d108ed008a8a1 100644 --- a/Modules/_blake2/blake2b_impl.c +++ b/Modules/_blake2/blake2b_impl.c @@ -393,7 +393,7 @@ py_blake2b_dealloc(PyObject *self) } PyTypeObject *type = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(type); } diff --git a/Modules/_blake2/blake2s_impl.c b/Modules/_blake2/blake2s_impl.c index e1de5df37d0988..85c2d4edad7eee 100644 --- a/Modules/_blake2/blake2s_impl.c +++ b/Modules/_blake2/blake2s_impl.c @@ -392,7 +392,7 @@ py_blake2s_dealloc(PyObject *self) } PyTypeObject *type = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(type); } diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 8bb34877c53903..5f8a723f6373ae 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -5745,7 +5745,7 @@ _ctypes_add_types(PyObject *mod) TYPE_READY(&StructParam_Type); #ifdef MS_WIN32 - TYPE_READY_BASE(&PyComError_Type, PyExc_Exception); + TYPE_READY_BASE(&PyComError_Type, (PyTypeObject*)PyExc_Exception); #endif #undef TYPE_READY diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 3686287e45ac3a..654cb93dcf7776 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -427,15 +427,22 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing"); goto error; #else -#ifdef MACOSX +#if defined(__clang__) || defined(MACOSX) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif +#if defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p); -#ifdef MACOSX +#if defined(__clang__) || defined(MACOSX) #pragma clang diagnostic pop #endif +#if defined(__GNUC__) + #pragma GCC diagnostic pop +#endif #endif } diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 9b629877a8a53a..40a05a44edd4c1 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -475,7 +475,7 @@ static void PyCArg_dealloc(PyCArgObject *self) { Py_XDECREF(self->obj); - PyObject_Del(self); + PyObject_Free(self); } static int diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 1a8f0b636821ff..7d252244e24054 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -282,7 +282,7 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po) Py_DECREF(po->wo); remove_lop(po); } - PyObject_DEL(po); + PyObject_Free(po); Py_DECREF(tp); } diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index a59858632e76f2..1f4789baf7a68e 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -689,7 +689,7 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo) if (wo->win != stdscr) delwin(wo->win); if (wo->encoding != NULL) PyMem_Free(wo->encoding); - PyObject_DEL(wo); + PyObject_Free(wo); } /* Addch, Addstr, Addnstr */ diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index e59f89b3d10fb0..c3e0b52baa6fac 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -6494,32 +6494,9 @@ static PyDateTime_CAPI CAPI = { new_time_ex2 }; - - -static struct PyModuleDef datetimemodule = { - PyModuleDef_HEAD_INIT, - "_datetime", - "Fast implementation of the datetime type.", - -1, - module_methods, - NULL, - NULL, - NULL, - NULL -}; - -PyMODINIT_FUNC -PyInit__datetime(void) +static int +_datetime_exec(PyObject *module) { - PyObject *m; /* a module object */ - PyObject *d; /* its dict */ - PyObject *x; - PyObject *delta; - - m = PyModule_Create(&datetimemodule); - if (m == NULL) - return NULL; - // `&...` is not a constant expression according to a strict reading // of C standards. Fill tp_base at run-time rather than statically. // See https://bugs.python.org/issue40777 @@ -6537,98 +6514,72 @@ PyInit__datetime(void) }; for (size_t i = 0; i < Py_ARRAY_LENGTH(types); i++) { - if (PyModule_AddType(m, types[i]) < 0) { - return NULL; + if (PyModule_AddType(module, types[i]) < 0) { + return -1; } } if (PyType_Ready(&PyDateTime_IsoCalendarDateType) < 0) { - return NULL; + return -1; } - Py_INCREF(&PyDateTime_IsoCalendarDateType); - - /* timedelta values */ - d = PyDateTime_DeltaType.tp_dict; - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return NULL; - Py_DECREF(x); - x = new_delta(-MAX_DELTA_DAYS, 0, 0, 0); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return NULL; - Py_DECREF(x); +#define DATETIME_ADD_MACRO(dict, c, value_expr) \ + do { \ + PyObject *value = (value_expr); \ + if (value == NULL) { \ + return -1; \ + } \ + if (PyDict_SetItemString(dict, c, value) < 0) { \ + Py_DECREF(value); \ + return -1; \ + } \ + Py_DECREF(value); \ + } while(0) - x = new_delta(MAX_DELTA_DAYS, 24*3600-1, 1000000-1, 0); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return NULL; - Py_DECREF(x); + /* timedelta values */ + PyObject *d = PyDateTime_DeltaType.tp_dict; + DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0)); + DATETIME_ADD_MACRO(d, "min", new_delta(-MAX_DELTA_DAYS, 0, 0, 0)); + DATETIME_ADD_MACRO(d, "max", + new_delta(MAX_DELTA_DAYS, 24*3600-1, 1000000-1, 0)); /* date values */ d = PyDateTime_DateType.tp_dict; - - x = new_date(1, 1, 1); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_date(MAXYEAR, 12, 31); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_delta(1, 0, 0, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return NULL; - Py_DECREF(x); + DATETIME_ADD_MACRO(d, "min", new_date(1, 1, 1)); + DATETIME_ADD_MACRO(d, "max", new_date(MAXYEAR, 12, 31)); + DATETIME_ADD_MACRO(d, "resolution", new_delta(1, 0, 0, 0)); /* time values */ d = PyDateTime_TimeType.tp_dict; - - x = new_time(0, 0, 0, 0, Py_None, 0); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_time(23, 59, 59, 999999, Py_None, 0); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return NULL; - Py_DECREF(x); + DATETIME_ADD_MACRO(d, "min", new_time(0, 0, 0, 0, Py_None, 0)); + DATETIME_ADD_MACRO(d, "max", new_time(23, 59, 59, 999999, Py_None, 0)); + DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0)); /* datetime values */ d = PyDateTime_DateTimeType.tp_dict; - - x = new_datetime(1, 1, 1, 0, 0, 0, 0, Py_None, 0); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, Py_None, 0); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return NULL; - Py_DECREF(x); - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return NULL; - Py_DECREF(x); + DATETIME_ADD_MACRO(d, "min", + new_datetime(1, 1, 1, 0, 0, 0, 0, Py_None, 0)); + DATETIME_ADD_MACRO(d, "max", new_datetime(MAXYEAR, 12, 31, 23, 59, 59, + 999999, Py_None, 0)); + DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0)); /* timezone values */ d = PyDateTime_TimeZoneType.tp_dict; + PyObject *delta = new_delta(0, 0, 0, 0); + if (delta == NULL) { + return -1; + } - delta = new_delta(0, 0, 0, 0); - if (delta == NULL) - return NULL; - x = create_timezone(delta, NULL); + PyObject *x = create_timezone(delta, NULL); Py_DECREF(delta); - if (x == NULL || PyDict_SetItemString(d, "utc", x) < 0) - return NULL; + if (x == NULL) { + return -1; + } + if (PyDict_SetItemString(d, "utc", x) < 0) { + Py_DECREF(x); + return -1; + } + PyDateTime_TimeZone_UTC = x; CAPI.TimeZone_UTC = PyDateTime_TimeZone_UTC; @@ -6636,37 +6587,47 @@ PyInit__datetime(void) * compatibility, even though the constructor will accept a wider range of * values. This may change in the future.*/ delta = new_delta(-1, 60, 0, 1); /* -23:59 */ - if (delta == NULL) - return NULL; + if (delta == NULL) { + return -1; + } + x = create_timezone(delta, NULL); Py_DECREF(delta); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return NULL; - Py_DECREF(x); + DATETIME_ADD_MACRO(d, "min", x); delta = new_delta(0, (23 * 60 + 59) * 60, 0, 0); /* +23:59 */ - if (delta == NULL) - return NULL; + if (delta == NULL) { + return -1; + } + x = create_timezone(delta, NULL); Py_DECREF(delta); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return NULL; - Py_DECREF(x); + DATETIME_ADD_MACRO(d, "max", x); /* Epoch */ PyDateTime_Epoch = new_datetime(1970, 1, 1, 0, 0, 0, 0, PyDateTime_TimeZone_UTC, 0); - if (PyDateTime_Epoch == NULL) - return NULL; + if (PyDateTime_Epoch == NULL) { + return -1; + } /* module initialization */ - PyModule_AddIntMacro(m, MINYEAR); - PyModule_AddIntMacro(m, MAXYEAR); + if (PyModule_AddIntMacro(module, MINYEAR) < 0) { + return -1; + } + if (PyModule_AddIntMacro(module, MAXYEAR) < 0) { + return -1; + } x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL); - if (x == NULL) - return NULL; - PyModule_AddObject(m, "datetime_CAPI", x); + if (x == NULL) { + return -1; + } + + if (PyModule_AddObject(module, "datetime_CAPI", x) < 0) { + Py_DECREF(x); + return -1; + } /* A 4-year cycle has an extra leap day over what we'd get from * pasting together 4 single years. @@ -6691,8 +6652,9 @@ PyInit__datetime(void) us_per_minute = PyLong_FromLong(60000000); seconds_per_day = PyLong_FromLong(24 * 3600); if (us_per_ms == NULL || us_per_second == NULL || - us_per_minute == NULL || seconds_per_day == NULL) - return NULL; + us_per_minute == NULL || seconds_per_day == NULL) { + return -1; + } /* The rest are too big for 32-bit ints, but even * us_per_week fits in 40 bits, so doubles should be exact. @@ -6700,9 +6662,33 @@ PyInit__datetime(void) us_per_hour = PyLong_FromDouble(3600000000.0); us_per_day = PyLong_FromDouble(86400000000.0); us_per_week = PyLong_FromDouble(604800000000.0); - if (us_per_hour == NULL || us_per_day == NULL || us_per_week == NULL) + if (us_per_hour == NULL || us_per_day == NULL || us_per_week == NULL) { + return -1; + } + return 0; +} + +static struct PyModuleDef datetimemodule = { + PyModuleDef_HEAD_INIT, + .m_name = "_datetime", + .m_doc = "Fast implementation of the datetime type.", + .m_size = -1, + .m_methods = module_methods, +}; + +PyMODINIT_FUNC +PyInit__datetime(void) +{ + PyObject *mod = PyModule_Create(&datetimemodule); + if (mod == NULL) return NULL; - return m; + + if (_datetime_exec(mod) < 0) { + Py_DECREF(mod); + return NULL; + } + + return mod; } /* --------------------------------------------------------------------------- diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index ea16c5a6cd9cdc..9c85d76c6b5b8a 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -1765,7 +1765,7 @@ ctxmanager_dealloc(PyDecContextManagerObject *self) { Py_XDECREF(self->local); Py_XDECREF(self->global); - PyObject_Del(self); + PyObject_Free(self); } static PyObject * diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 9fad21fc33213c..621b721d011df7 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -1,5 +1,6 @@ #include "Python.h" #include "pycore_long.h" // _PyLong_GetZero() +#include "pycore_object.h" // _PyObject_GC_TRACK #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef @@ -478,7 +479,7 @@ keyobject_dealloc(keyobject *ko) { Py_DECREF(ko->cmp); Py_XDECREF(ko->object); - PyObject_FREE(ko); + PyObject_Free(ko); } static int @@ -673,6 +674,11 @@ functools_reduce(PyObject *self, PyObject *args) if ((result = PyObject_Call(func, args, NULL)) == NULL) { goto Fail; } + // bpo-42536: The GC may have untracked this args tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(args)) { + _PyObject_GC_TRACK(args); + } } } @@ -742,7 +748,7 @@ lru_list_elem_dealloc(lru_list_elem *link) { Py_XDECREF(link->key); Py_XDECREF(link->result); - PyObject_Del(link); + PyObject_Free(link); } static PyTypeObject lru_list_elem_type = { diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index adc86537732502..d4295d7c3638d6 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -341,7 +341,7 @@ EVP_dealloc(EVPobject *self) if (self->lock != NULL) PyThread_free_lock(self->lock); EVP_MD_CTX_free(self->ctx); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -1453,7 +1453,7 @@ _hashlib_hmac_new_impl(PyObject *module, Py_buffer *key, PyObject *msg_obj, error: if (ctx) HMAC_CTX_free(ctx); - if (self) PyObject_Del(self); + if (self) PyObject_Free(self); return NULL; } @@ -1546,7 +1546,7 @@ _hmac_dealloc(HMACobject *self) PyThread_free_lock(self->lock); } HMAC_CTX_free(self->ctx); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -2038,21 +2038,14 @@ hashlib_init_evpxoftype(PyObject *module) { #ifdef PY_OPENSSL_HAS_SHAKE _hashlibstate *state = get_hashlib_state(module); - PyObject *bases; if (state->EVPtype == NULL) { return -1; } - bases = PyTuple_Pack(1, state->EVPtype); - if (bases == NULL) { - return -1; - } - state->EVPXOFtype = (PyTypeObject *)PyType_FromSpecWithBases( - &EVPXOFtype_spec, bases + &EVPXOFtype_spec, (PyObject *)state->EVPtype ); - Py_DECREF(bases); if (state->EVPXOFtype == NULL) { return -1; } @@ -2078,7 +2071,6 @@ hashlib_init_hmactype(PyObject *module) return 0; } -#if 0 static PyModuleDef_Slot hashlib_slots[] = { /* OpenSSL 1.0.2 and LibreSSL */ {Py_mod_exec, hashlib_openssl_legacy_init}, @@ -2088,7 +2080,6 @@ static PyModuleDef_Slot hashlib_slots[] = { {Py_mod_exec, hashlib_md_meth_names}, {0, NULL} }; -#endif static struct PyModuleDef _hashlibmodule = { PyModuleDef_HEAD_INIT, @@ -2096,7 +2087,7 @@ static struct PyModuleDef _hashlibmodule = { .m_doc = "OpenSSL interface for hashlib module", .m_size = sizeof(_hashlibstate), .m_methods = EVP_functions, - .m_slots = NULL, + .m_slots = hashlib_slots, .m_traverse = hashlib_traverse, .m_clear = hashlib_clear, .m_free = hashlib_free @@ -2105,37 +2096,5 @@ static struct PyModuleDef _hashlibmodule = { PyMODINIT_FUNC PyInit__hashlib(void) { - PyObject *m = PyState_FindModule(&_hashlibmodule); - if (m != NULL) { - Py_INCREF(m); - return m; - } - - m = PyModule_Create(&_hashlibmodule); - if (m == NULL) { - return NULL; - } - - if (hashlib_openssl_legacy_init(m) < 0) { - Py_DECREF(m); - return NULL; - } - if (hashlib_init_evptype(m) < 0) { - Py_DECREF(m); - return NULL; - } - if (hashlib_init_evpxoftype(m) < 0) { - Py_DECREF(m); - return NULL; - } - if (hashlib_init_hmactype(m) < 0) { - Py_DECREF(m); - return NULL; - } - if (hashlib_md_meth_names(m) == -1) { - Py_DECREF(m); - return NULL; - } - - return m; + return PyModuleDef_Init(&_hashlibmodule); } diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 7b3597e06064b9..564f5598edcc66 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -370,8 +370,8 @@ _locale_strcoll_impl(PyObject *module, PyObject *os1, PyObject *os2) result = PyLong_FromLong(wcscoll(ws1, ws2)); done: /* Deallocate everything. */ - if (ws1) PyMem_FREE(ws1); - if (ws2) PyMem_FREE(ws2); + if (ws1) PyMem_Free(ws1); + if (ws2) PyMem_Free(ws2); return result; } #endif @@ -556,7 +556,6 @@ static struct langinfo_constant{ LANGINFO(PM_STR), /* The following constants are available only with XPG4, but... - AIX 3.2. only has CODESET. OpenBSD doesn't have CODESET but has T_FMT_AMPM, and doesn't have a few of the others. Solution: ifdef-test them all. */ diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c index 436ac6d6b39f49..d64ded4168228f 100644 --- a/Modules/_multiprocessing/posixshmem.c +++ b/Modules/_multiprocessing/posixshmem.c @@ -110,21 +110,17 @@ static PyMethodDef module_methods[ ] = { }; -static struct PyModuleDef this_module = { - PyModuleDef_HEAD_INIT, // m_base - "_posixshmem", // m_name - "POSIX shared memory module", // m_doc - -1, // m_size (space allocated for module globals) - module_methods, // m_methods +static struct PyModuleDef _posixshmemmodule = { + PyModuleDef_HEAD_INIT, + .m_name = "_posixshmem", + .m_doc = "POSIX shared memory module", + .m_size = 0, + .m_methods = module_methods, }; /* Module init function */ PyMODINIT_FUNC -PyInit__posixshmem(void) { - PyObject *module; - module = PyModule_Create(&this_module); - if (!module) { - return NULL; - } - return module; +PyInit__posixshmem(void) +{ + return PyModuleDef_Init(&_posixshmemmodule); } diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index 8732750e11be8c..9a2d1f85c92fa2 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -571,7 +571,7 @@ semlock_dealloc(SemLockObject* self) if (self->handle != SEM_FAILED) SEM_CLOSE(self->handle); PyMem_Free(self->name); - PyObject_Del(self); + PyObject_Free(self); } /*[clinic input] diff --git a/Modules/_operator.c b/Modules/_operator.c index c9d38aa3423667..da1e43158ee0ac 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -749,7 +749,7 @@ _tscmp(const unsigned char *a, const unsigned char *b, volatile const unsigned char *left; volatile const unsigned char *right; Py_ssize_t i; - unsigned char result; + volatile unsigned char result; /* loop count depends on length of b */ length = len_b; diff --git a/Modules/_pickle.c b/Modules/_pickle.c index ed8afefe4c74c8..5a8aad9de7679d 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -442,8 +442,8 @@ Pdata_dealloc(Pdata *self) while (--i >= 0) { Py_DECREF(self->data[i]); } - PyMem_FREE(self->data); - PyObject_Del(self); + PyMem_Free(self->data); + PyObject_Free(self); } static PyTypeObject Pdata_Type = { @@ -465,7 +465,7 @@ Pdata_New(void) self->mark_set = 0; self->fence = 0; self->allocated = 8; - self->data = PyMem_MALLOC(self->allocated * sizeof(PyObject *)); + self->data = PyMem_Malloc(self->allocated * sizeof(PyObject *)); if (self->data) return (PyObject *)self; Py_DECREF(self); @@ -726,7 +726,7 @@ static PyTypeObject Unpickler_Type; static PyMemoTable * PyMemoTable_New(void) { - PyMemoTable *memo = PyMem_MALLOC(sizeof(PyMemoTable)); + PyMemoTable *memo = PyMem_Malloc(sizeof(PyMemoTable)); if (memo == NULL) { PyErr_NoMemory(); return NULL; @@ -735,9 +735,9 @@ PyMemoTable_New(void) memo->mt_used = 0; memo->mt_allocated = MT_MINSIZE; memo->mt_mask = MT_MINSIZE - 1; - memo->mt_table = PyMem_MALLOC(MT_MINSIZE * sizeof(PyMemoEntry)); + memo->mt_table = PyMem_Malloc(MT_MINSIZE * sizeof(PyMemoEntry)); if (memo->mt_table == NULL) { - PyMem_FREE(memo); + PyMem_Free(memo); PyErr_NoMemory(); return NULL; } @@ -758,10 +758,10 @@ PyMemoTable_Copy(PyMemoTable *self) new->mt_mask = self->mt_mask; /* The table we get from _New() is probably smaller than we wanted. Free it and allocate one that's the right size. */ - PyMem_FREE(new->mt_table); + PyMem_Free(new->mt_table); new->mt_table = PyMem_NEW(PyMemoEntry, self->mt_allocated); if (new->mt_table == NULL) { - PyMem_FREE(new); + PyMem_Free(new); PyErr_NoMemory(); return NULL; } @@ -800,8 +800,8 @@ PyMemoTable_Del(PyMemoTable *self) return; PyMemoTable_Clear(self); - PyMem_FREE(self->mt_table); - PyMem_FREE(self); + PyMem_Free(self->mt_table); + PyMem_Free(self); } /* Since entries cannot be deleted from this hashtable, _PyMemoTable_Lookup() @@ -880,7 +880,7 @@ _PyMemoTable_ResizeTable(PyMemoTable *self, size_t min_size) } /* Deallocate the old table. */ - PyMem_FREE(oldtable); + PyMem_Free(oldtable); return 0; } @@ -1582,7 +1582,7 @@ _Unpickler_MemoCleanup(UnpicklerObject *self) while (--i >= 0) { Py_XDECREF(memo[i]); } - PyMem_FREE(memo); + PyMem_Free(memo); } static UnpicklerObject * @@ -7544,7 +7544,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj, void *Py_UNUSED(ignored for (size_t i = new_memo_size - 1; i != SIZE_MAX; i--) { Py_XDECREF(new_memo[i]); } - PyMem_FREE(new_memo); + PyMem_Free(new_memo); } return -1; } diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index a00e13739aca4f..46c41d3c20a146 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -55,7 +55,7 @@ # endif #endif -#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) +#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__DragonFly__) # define FD_DIR "/dev/fd" #else # define FD_DIR "/proc/self/fd" @@ -85,11 +85,9 @@ get_posixsubprocess_state(PyObject *module) return (_posixsubprocessstate *)state; } -#define _posixsubprocessstate_global get_posixsubprocess_state(PyState_FindModule(&_posixsubprocessmodule)) - /* If gc was disabled, call gc.enable(). Ignore errors. */ static void -_enable_gc(int need_to_reenable_gc, PyObject *gc_module) +_enable_gc(int need_to_reenable_gc, PyObject *gc_module, _posixsubprocessstate *state) { PyObject *result; PyObject *exctype, *val, *tb; @@ -97,7 +95,7 @@ _enable_gc(int need_to_reenable_gc, PyObject *gc_module) if (need_to_reenable_gc) { PyErr_Fetch(&exctype, &val, &tb); result = PyObject_CallMethodNoArgs( - gc_module, _posixsubprocessstate_global->enable); + gc_module, state->enable); if (result == NULL) { /* We might have created a child process at this point, we * we have no good way to handle a failure to reenable GC @@ -127,9 +125,9 @@ _pos_int_from_ascii(const char *name) } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__DragonFly__) /* When /dev/fd isn't mounted it is often a static directory populated - * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD and OpenBSD. + * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD, OpenBSD and DragonFlyBSD. * NetBSD and OpenBSD have a /proc fs available (though not necessarily * mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs * that properly supports /dev/fd. @@ -377,7 +375,7 @@ _close_open_fds_maybe_unsafe(long start_fd, PyObject* py_fds_to_keep) ++start_fd; #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__DragonFly__) if (!_is_fdescfs_mounted_on_dev_fd()) proc_fd_dir = NULL; else @@ -758,7 +756,7 @@ do_fork_exec(char *const exec_array[], static PyObject * -subprocess_fork_exec(PyObject* self, PyObject *args) +subprocess_fork_exec(PyObject *module, PyObject *args) { PyObject *gc_module = NULL; PyObject *executable_list, *py_fds_to_keep; @@ -782,6 +780,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args) Py_ssize_t arg_num, num_groups = 0; int need_after_fork = 0; int saved_errno = 0; + _posixsubprocessstate *state = get_posixsubprocess_state(module); if (!PyArg_ParseTuple( args, "OOpO!OOiiiiiiiiiiOOOiO:fork_exec", @@ -827,7 +826,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args) if (gc_module == NULL) return NULL; result = PyObject_CallMethodNoArgs( - gc_module, _posixsubprocessstate_global->isenabled); + gc_module, state->isenabled); if (result == NULL) { Py_DECREF(gc_module); return NULL; @@ -839,7 +838,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args) return NULL; } result = PyObject_CallMethodNoArgs( - gc_module, _posixsubprocessstate_global->disable); + gc_module, state->disable); if (result == NULL) { Py_DECREF(gc_module); return NULL; @@ -1073,7 +1072,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args) if (exec_array) _Py_FreeCharPArray(exec_array); - _enable_gc(need_to_reenable_gc, gc_module); + _enable_gc(need_to_reenable_gc, gc_module, state); Py_XDECREF(gc_module); return pid == -1 ? NULL : PyLong_FromPid(pid); @@ -1113,12 +1112,38 @@ Raises: Only on an error in the parent process.\n\ PyDoc_STRVAR(module_doc, "A POSIX helper for the subprocess module."); +static int +_posixsubprocess_exec(PyObject *module) +{ + _posixsubprocessstate *state = get_posixsubprocess_state(module); + + state->disable = PyUnicode_InternFromString("disable"); + if (state->disable == NULL) { + return -1; + } + + state->enable = PyUnicode_InternFromString("enable"); + if (state->enable == NULL) { + return -1; + } + + state->isenabled = PyUnicode_InternFromString("isenabled"); + if (state->isenabled == NULL) { + return -1; + } + + return 0; +} static PyMethodDef module_methods[] = { {"fork_exec", subprocess_fork_exec, METH_VARARGS, subprocess_fork_exec_doc}, {NULL, NULL} /* sentinel */ }; +static PyModuleDef_Slot _posixsubprocess_slots[] = { + {Py_mod_exec, _posixsubprocess_exec}, + {0, NULL} +}; static int _posixsubprocess_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(get_posixsubprocess_state(m)->disable); @@ -1140,36 +1165,18 @@ static void _posixsubprocess_free(void *m) { static struct PyModuleDef _posixsubprocessmodule = { PyModuleDef_HEAD_INIT, - "_posixsubprocess", - module_doc, - sizeof(_posixsubprocessstate), - module_methods, - NULL, - _posixsubprocess_traverse, - _posixsubprocess_clear, - _posixsubprocess_free, + .m_name = "_posixsubprocess", + .m_doc = module_doc, + .m_size = sizeof(_posixsubprocessstate), + .m_methods = module_methods, + .m_slots = _posixsubprocess_slots, + .m_traverse = _posixsubprocess_traverse, + .m_clear = _posixsubprocess_clear, + .m_free = _posixsubprocess_free, }; PyMODINIT_FUNC PyInit__posixsubprocess(void) { - PyObject* m; - - m = PyState_FindModule(&_posixsubprocessmodule); - if (m != NULL) { - Py_INCREF(m); - return m; - } - - m = PyModule_Create(&_posixsubprocessmodule); - if (m == NULL) { - return NULL; - } - - get_posixsubprocess_state(m)->disable = PyUnicode_InternFromString("disable"); - get_posixsubprocess_state(m)->enable = PyUnicode_InternFromString("enable"); - get_posixsubprocess_state(m)->isenabled = PyUnicode_InternFromString("isenabled"); - - PyState_AddModule(m, &_posixsubprocessmodule); - return m; + return PyModuleDef_Init(&_posixsubprocessmodule); } diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c index 7cf73992795c6b..a2b6ac87a72ebf 100644 --- a/Modules/_queuemodule.c +++ b/Modules/_queuemodule.c @@ -381,11 +381,46 @@ PyDoc_STRVAR(queue_module_doc, "C implementation of the Python queue module.\n\ This module is an implementation detail, please do not use it directly."); +static int +queuemodule_exec(PyObject *module) +{ + simplequeue_state *state = simplequeue_get_state(module); + + state->EmptyError = PyErr_NewExceptionWithDoc( + "_queue.Empty", + "Exception raised by Queue.get(block=0)/get_nowait().", + NULL, NULL); + if (state->EmptyError == NULL) { + return -1; + } + if (PyModule_AddObjectRef(module, "Empty", state->EmptyError) < 0) { + return -1; + } + + state->SimpleQueueType = (PyTypeObject *)PyType_FromModuleAndSpec( + module, &simplequeue_spec, NULL); + if (state->SimpleQueueType == NULL) { + return -1; + } + if (PyModule_AddType(module, state->SimpleQueueType) < 0) { + return -1; + } + + return 0; +} + +static PyModuleDef_Slot queuemodule_slots[] = { + {Py_mod_exec, queuemodule_exec}, + {0, NULL} +}; + + static struct PyModuleDef queuemodule = { .m_base = PyModuleDef_HEAD_INIT, .m_name = "_queue", .m_doc = queue_module_doc, .m_size = sizeof(simplequeue_state), + .m_slots = queuemodule_slots, .m_traverse = queue_traverse, .m_clear = queue_clear, .m_free = queue_free, @@ -395,41 +430,5 @@ static struct PyModuleDef queuemodule = { PyMODINIT_FUNC PyInit__queue(void) { - PyObject *m; - simplequeue_state *state; - - /* Create the module */ - m = PyModule_Create(&queuemodule); - if (m == NULL) - return NULL; - - state = simplequeue_get_state(m); - state->EmptyError = PyErr_NewExceptionWithDoc( - "_queue.Empty", - "Exception raised by Queue.get(block=0)/get_nowait().", - NULL, NULL); - if (state->EmptyError == NULL) - goto error; - - Py_INCREF(state->EmptyError); - if (PyModule_AddObject(m, "Empty", state->EmptyError) < 0) { - Py_DECREF(state->EmptyError); - goto error; - } - - state->SimpleQueueType = (PyTypeObject *)PyType_FromModuleAndSpec(m, - &simplequeue_spec, - NULL); - if (state->SimpleQueueType == NULL) { - goto error; - } - if (PyModule_AddType(m, state->SimpleQueueType) < 0) { - goto error; - } - - return m; - -error: - Py_DECREF(m); - return NULL; + return PyModuleDef_Init(&queuemodule); } diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index d33870808622fa..ad4fd474428d4b 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -93,7 +93,8 @@ get_random_state(PyObject *module) static struct PyModuleDef _randommodule; -#define _randomstate_global get_random_state(PyState_FindModule(&_randommodule)) +#define _randomstate_type(type) \ + (get_random_state(_PyType_GetModuleByDef(type, &_randommodule))) typedef struct { PyObject_HEAD @@ -106,9 +107,9 @@ typedef struct { /*[clinic input] module _random -class _random.Random "RandomObject *" "&Random_Type" +class _random.Random "RandomObject *" "_randomstate_type(type)->Random_Type" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f79898ae7847c321]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=70a2c99619474983]*/ /* Random methods */ @@ -290,7 +291,8 @@ random_seed(RandomObject *self, PyObject *arg) } else if (PyLong_Check(arg)) { /* Calling int.__abs__() prevents calling arg.__abs__(), which might return an invalid value. See issue #31478. */ - n = PyObject_CallOneArg(_randomstate_global->Long___abs__, arg); + _randomstate *state = _randomstate_type(Py_TYPE(self)); + n = PyObject_CallOneArg(state->Long___abs__, arg); } else { Py_hash_t hash = PyObject_Hash(arg); @@ -517,8 +519,9 @@ random_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { RandomObject *self; PyObject *tmp; + _randomstate *state = _randomstate_type(type); - if (type == (PyTypeObject*)_randomstate_global->Random_Type && + if (type == (PyTypeObject*)state->Random_Type && !_PyArg_NoKeywords("Random()", kwds)) { return NULL; } @@ -567,6 +570,45 @@ static PyType_Spec Random_Type_spec = { PyDoc_STRVAR(module_doc, "Module implements the Mersenne Twister random number generator."); +static int +_random_exec(PyObject *module) +{ + _randomstate *state = get_random_state(module); + + state->Random_Type = PyType_FromModuleAndSpec( + module, &Random_Type_spec, NULL); + if (state->Random_Type == NULL) { + return -1; + } + if (PyModule_AddType(module, (PyTypeObject *)state->Random_Type) < 0) { + return -1; + } + + /* Look up and save int.__abs__, which is needed in random_seed(). */ + PyObject *longval = longval = PyLong_FromLong(0); + if (longval == NULL) { + return -1; + } + + PyObject *longtype = PyObject_Type(longval); + Py_DECREF(longval); + if (longtype == NULL) { + return -1; + } + + state->Long___abs__ = PyObject_GetAttrString(longtype, "__abs__"); + Py_DECREF(longtype); + if (state->Long___abs__ == NULL) { + return -1; + } + return 0; +} + +static PyModuleDef_Slot _random_slots[] = { + {Py_mod_exec, _random_exec}, + {0, NULL} +}; + static int _random_traverse(PyObject *module, visitproc visit, void *arg) { @@ -594,7 +636,7 @@ static struct PyModuleDef _randommodule = { module_doc, sizeof(_randomstate), NULL, - NULL, + _random_slots, _random_traverse, _random_clear, _random_free, @@ -603,43 +645,5 @@ static struct PyModuleDef _randommodule = { PyMODINIT_FUNC PyInit__random(void) { - PyObject *m; - - PyObject *Random_Type = PyType_FromSpec(&Random_Type_spec); - if (Random_Type == NULL) { - return NULL; - } - - m = PyModule_Create(&_randommodule); - if (m == NULL) { - Py_DECREF(Random_Type); - return NULL; - } - get_random_state(m)->Random_Type = Random_Type; - - Py_INCREF(Random_Type); - PyModule_AddObject(m, "Random", Random_Type); - - /* Look up and save int.__abs__, which is needed in random_seed(). */ - PyObject *longval = NULL, *longtype = NULL; - longval = PyLong_FromLong(0); - if (longval == NULL) goto fail; - - longtype = PyObject_Type(longval); - if (longtype == NULL) goto fail; - - PyObject *abs = PyObject_GetAttrString(longtype, "__abs__"); - if (abs == NULL) goto fail; - - Py_DECREF(longtype); - Py_DECREF(longval); - get_random_state(m)->Long___abs__ = abs; - - return m; - -fail: - Py_XDECREF(longtype); - Py_XDECREF(longval); - Py_DECREF(m); - return NULL; + return PyModuleDef_Init(&_randommodule); } diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c index da6dde6812f264..cae10f99d5b8df 100644 --- a/Modules/_sha3/sha3module.c +++ b/Modules/_sha3/sha3module.c @@ -274,7 +274,7 @@ SHA3_dealloc(SHA3object *self) } PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c index 0b02be4f0bec98..8cedd07b4596df 100644 --- a/Modules/_sqlite/cache.c +++ b/Modules/_sqlite/cache.c @@ -258,17 +258,17 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args) Py_RETURN_NONE; } -static PyType_Slot pysqlite_NodeType_slots[] = { +static PyType_Slot node_slots[] = { {Py_tp_dealloc, pysqlite_node_dealloc}, {Py_tp_new, PyType_GenericNew}, {0, NULL}, }; -static PyType_Spec pysqlite_NodeType_spec = { +static PyType_Spec node_spec = { .name = MODULE_NAME ".Node", .basicsize = sizeof(pysqlite_Node), .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - .slots = pysqlite_NodeType_slots, + .slots = node_slots, }; PyTypeObject *pysqlite_NodeType = NULL; @@ -280,7 +280,7 @@ static PyMethodDef cache_methods[] = { {NULL, NULL} }; -static PyType_Slot pysqlite_CacheType_slots[] = { +static PyType_Slot cache_slots[] = { {Py_tp_dealloc, pysqlite_cache_dealloc}, {Py_tp_methods, cache_methods}, {Py_tp_new, PyType_GenericNew}, @@ -288,22 +288,22 @@ static PyType_Slot pysqlite_CacheType_slots[] = { {0, NULL}, }; -static PyType_Spec pysqlite_CacheType_spec = { +static PyType_Spec cache_spec = { .name = MODULE_NAME ".Cache", .basicsize = sizeof(pysqlite_Cache), .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - .slots = pysqlite_CacheType_slots, + .slots = cache_slots, }; PyTypeObject *pysqlite_CacheType = NULL; extern int pysqlite_cache_setup_types(PyObject *mod) { - pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &pysqlite_NodeType_spec, NULL); + pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &node_spec, NULL); if (pysqlite_NodeType == NULL) { return -1; } - pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &pysqlite_CacheType_spec, NULL); + pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &cache_spec, NULL); if (pysqlite_CacheType == NULL) { return -1; } diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 9fdf51417ed883..372f3dda4cbee4 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -412,15 +412,6 @@ PyMODINIT_FUNC PyInit__sqlite3(void) ADD_EXCEPTION(module, "DataError", pysqlite_DataError, pysqlite_DatabaseError); ADD_EXCEPTION(module, "NotSupportedError", pysqlite_NotSupportedError, pysqlite_DatabaseError); - /* In Python 2.x, setting Connection.text_factory to - OptimizedUnicode caused Unicode objects to be returned for - non-ASCII data and bytestrings to be returned for ASCII data. - Now OptimizedUnicode is an alias for str, so it has no - effect. */ - if (PyModule_AddObjectRef(module, "OptimizedUnicode", (PyObject*)&PyUnicode_Type) < 0) { - goto error; - } - /* Set integer constants */ if (add_integer_constants(module) < 0) { goto error; diff --git a/Modules/_sre.c b/Modules/_sre.c index fbabeb7c9f3054..57faf7bdaae4e6 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -197,7 +197,7 @@ static void data_stack_dealloc(SRE_STATE* state) { if (state->data_stack) { - PyMem_FREE(state->data_stack); + PyMem_Free(state->data_stack); state->data_stack = NULL; } state->data_stack_size = state->data_stack_base = 0; @@ -213,7 +213,7 @@ data_stack_grow(SRE_STATE* state, Py_ssize_t size) void* stack; cursize = minsize+minsize/4+1024; TRACE(("allocate/grow stack %zd\n", cursize)); - stack = PyMem_REALLOC(state->data_stack, cursize); + stack = PyMem_Realloc(state->data_stack, cursize); if (!stack) { data_stack_dealloc(state); return SRE_ERROR_MEMORY; @@ -248,22 +248,36 @@ data_stack_grow(SRE_STATE* state, Py_ssize_t size) /* -------------------------------------------------------------------- */ /* factories and destructors */ -/* see sre.h for object declarations */ -static PyObject*pattern_new_match(PatternObject*, SRE_STATE*, Py_ssize_t); -static PyObject *pattern_scanner(PatternObject *, PyObject *, Py_ssize_t, Py_ssize_t); +/* module state */ +typedef struct { + PyTypeObject *Pattern_Type; + PyTypeObject *Match_Type; + PyTypeObject *Scanner_Type; +} _sremodulestate; + +static _sremodulestate * +get_sre_module_state(PyObject *m) +{ + _sremodulestate *state = (_sremodulestate *)PyModule_GetState(m); + assert(state); + return state; +} +static struct PyModuleDef sremodule; +#define get_sre_module_state_by_class(cls) \ + (get_sre_module_state(PyType_GetModule(cls))) + +/* see sre.h for object declarations */ +static PyObject*pattern_new_match(_sremodulestate *, PatternObject*, SRE_STATE*, Py_ssize_t); +static PyObject *pattern_scanner(_sremodulestate *, PatternObject *, PyObject *, Py_ssize_t, Py_ssize_t); /*[clinic input] module _sre -class _sre.SRE_Pattern "PatternObject *" "&Pattern_Type" -class _sre.SRE_Match "MatchObject *" "&Match_Type" -class _sre.SRE_Scanner "ScannerObject *" "&Scanner_Type" +class _sre.SRE_Pattern "PatternObject *" "get_sre_module_state_by_class(tp)->Pattern_Type" +class _sre.SRE_Match "MatchObject *" "get_sre_module_state_by_class(tp)->Match_Type" +class _sre.SRE_Scanner "ScannerObject *" "get_sre_module_state_by_class(tp)->Scanner_Type" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b0230ec19a0deac8]*/ - -static PyTypeObject Pattern_Type; -static PyTypeObject Match_Type; -static PyTypeObject Scanner_Type; +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=fe2966e32b66a231]*/ /*[clinic input] _sre.getcodesize -> int @@ -458,7 +472,7 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string, /* We add an explicit cast here because MSVC has a bug when compiling C code where it believes that `const void**` cannot be safely casted to `void*`, see bpo-39943 for details. */ - PyMem_Del((void*) state->mark); + PyMem_Free((void*) state->mark); state->mark = NULL; if (state->buffer.buf) PyBuffer_Release(&state->buffer); @@ -473,7 +487,7 @@ state_fini(SRE_STATE* state) Py_XDECREF(state->string); data_stack_dealloc(state); /* See above PyMem_Del for why we explicitly cast here. */ - PyMem_Del((void*) state->mark); + PyMem_Free((void*) state->mark); state->mark = NULL; } @@ -550,12 +564,15 @@ pattern_error(Py_ssize_t status) static void pattern_dealloc(PatternObject* self) { + PyTypeObject *tp = Py_TYPE(self); + if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); Py_XDECREF(self->pattern); Py_XDECREF(self->groupindex); Py_XDECREF(self->indexgroup); - PyObject_DEL(self); + PyObject_Free(self); + Py_DECREF(tp); } LOCAL(Py_ssize_t) @@ -583,6 +600,8 @@ sre_search(SRE_STATE* state, SRE_CODE* pattern) /*[clinic input] _sre.SRE_Pattern.match + cls: defining_class + / string: object pos: Py_ssize_t = 0 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize @@ -591,10 +610,12 @@ Matches zero or more characters at the beginning of the string. [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos) -/*[clinic end generated code: output=ea2d838888510661 input=a2ba191647abebe5]*/ +_sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos) +/*[clinic end generated code: output=ec6208ea58a0cca0 input=4bdb9c3e564d13ac]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); SRE_STATE state; Py_ssize_t status; PyObject *match; @@ -614,7 +635,7 @@ _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, return NULL; } - match = pattern_new_match(self, &state, status); + match = pattern_new_match(module_state, self, &state, status); state_fini(&state); return match; } @@ -622,6 +643,8 @@ _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, /*[clinic input] _sre.SRE_Pattern.fullmatch + cls: defining_class + / string: object pos: Py_ssize_t = 0 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize @@ -630,10 +653,12 @@ Matches against all of the string. [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos) -/*[clinic end generated code: output=5833c47782a35f4a input=d9fb03a7625b5828]*/ +_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos) +/*[clinic end generated code: output=625b75b027ef94da input=50981172ab0fcfdd]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); SRE_STATE state; Py_ssize_t status; PyObject *match; @@ -654,7 +679,7 @@ _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, return NULL; } - match = pattern_new_match(self, &state, status); + match = pattern_new_match(module_state, self, &state, status); state_fini(&state); return match; } @@ -662,6 +687,8 @@ _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, /*[clinic input] _sre.SRE_Pattern.search + cls: defining_class + / string: object pos: Py_ssize_t = 0 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize @@ -672,10 +699,12 @@ Return None if no position in the string matches. [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos) -/*[clinic end generated code: output=25f302a644e951e8 input=4ae5cb7dc38fed1b]*/ +_sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos) +/*[clinic end generated code: output=bd7f2d9d583e1463 input=afa9afb66a74a4b3]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); SRE_STATE state; Py_ssize_t status; PyObject *match; @@ -694,7 +723,7 @@ _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, return NULL; } - match = pattern_new_match(self, &state, status); + match = pattern_new_match(module_state, self, &state, status); state_fini(&state); return match; } @@ -826,6 +855,8 @@ _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string, /*[clinic input] _sre.SRE_Pattern.finditer + cls: defining_class + / string: object pos: Py_ssize_t = 0 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize @@ -836,15 +867,17 @@ For each match, the iterator returns a match object. [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos) -/*[clinic end generated code: output=0bbb1a0aeb38bb14 input=612aab69e9fe08e4]*/ +_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos) +/*[clinic end generated code: output=1791dbf3618ade56 input=812e332a4848cbaf]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); PyObject* scanner; PyObject* search; PyObject* iterator; - scanner = pattern_scanner(self, string, pos, endpos); + scanner = pattern_scanner(module_state, self, string, pos, endpos); if (!scanner) return NULL; @@ -862,6 +895,8 @@ _sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string, /*[clinic input] _sre.SRE_Pattern.scanner + cls: defining_class + / string: object pos: Py_ssize_t = 0 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize @@ -869,11 +904,14 @@ _sre.SRE_Pattern.scanner [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos) -/*[clinic end generated code: output=54ea548aed33890b input=3aacdbde77a3a637]*/ +_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos) +/*[clinic end generated code: output=f70cd506112f1bd9 input=2e487e5151bcee4c]*/ { - return pattern_scanner(self, string, pos, endpos); + _sremodulestate *module_state = get_sre_module_state_by_class(cls); + + return pattern_scanner(module_state, self, string, pos, endpos); } /*[clinic input] @@ -980,8 +1018,12 @@ _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string, } static PyObject* -pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, - Py_ssize_t count, Py_ssize_t subn) +pattern_subx(_sremodulestate* module_state, + PatternObject* self, + PyObject* ptemplate, + PyObject* string, + Py_ssize_t count, + Py_ssize_t subn) { SRE_STATE state; PyObject* list; @@ -1083,7 +1125,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, if (filter_is_callable) { /* pass match object through filter */ - match = pattern_new_match(self, &state, 1); + match = pattern_new_match(module_state, self, &state, 1); if (!match) goto error; item = PyObject_CallOneArg(filter, match); @@ -1163,6 +1205,8 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, /*[clinic input] _sre.SRE_Pattern.sub + cls: defining_class + / repl: object string: object count: Py_ssize_t = 0 @@ -1171,16 +1215,20 @@ Return the string obtained by replacing the leftmost non-overlapping occurrences [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl, - PyObject *string, Py_ssize_t count) -/*[clinic end generated code: output=1dbf2ec3479cba00 input=c53d70be0b3caf86]*/ +_sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls, + PyObject *repl, PyObject *string, Py_ssize_t count) +/*[clinic end generated code: output=4be141ab04bca60d input=d8d1d4ac2311a07c]*/ { - return pattern_subx(self, repl, string, count, 0); + _sremodulestate *module_state = get_sre_module_state_by_class(cls); + + return pattern_subx(module_state, self, repl, string, count, 0); } /*[clinic input] _sre.SRE_Pattern.subn + cls: defining_class + / repl: object string: object count: Py_ssize_t = 0 @@ -1189,11 +1237,14 @@ Return the tuple (new_string, number_of_subs_made) found by replacing the leftmo [clinic start generated code]*/ static PyObject * -_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl, - PyObject *string, Py_ssize_t count) -/*[clinic end generated code: output=0d9522cd529e9728 input=e7342d7ce6083577]*/ +_sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls, + PyObject *repl, PyObject *string, + Py_ssize_t count) +/*[clinic end generated code: output=da02fd85258b1e1f input=8b78a65b8302e58d]*/ { - return pattern_subx(self, repl, string, count, 1); + _sremodulestate *module_state = get_sre_module_state_by_class(cls); + + return pattern_subx(module_state, self, repl, string, count, 1); } /*[clinic input] @@ -1338,12 +1389,13 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags, { /* "compile" pattern descriptor to pattern object */ + _sremodulestate *module_state = get_sre_module_state(module); PatternObject* self; Py_ssize_t i, n; n = PyList_GET_SIZE(code); /* coverity[ampersand_in_size] */ - self = PyObject_NewVar(PatternObject, &Pattern_Type, n); + self = PyObject_NewVar(PatternObject, module_state->Pattern_Type, n); if (!self) return NULL; self->weakreflist = NULL; @@ -1887,10 +1939,13 @@ _validate(PatternObject *self) static void match_dealloc(MatchObject* self) { + PyTypeObject *tp = Py_TYPE(self); + Py_XDECREF(self->regs); Py_XDECREF(self->string); Py_DECREF(self->pattern); - PyObject_DEL(self); + PyObject_Free(self); + Py_DECREF(tp); } static PyObject* @@ -2319,7 +2374,10 @@ match_repr(MatchObject *self) static PyObject* -pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status) +pattern_new_match(_sremodulestate* module_state, + PatternObject* pattern, + SRE_STATE* state, + Py_ssize_t status) { /* create match object (from state object) */ @@ -2332,7 +2390,8 @@ pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status) /* create match object (with room for extra group marks) */ /* coverity[ampersand_in_size] */ - match = PyObject_NewVar(MatchObject, &Match_Type, + match = PyObject_NewVar(MatchObject, + module_state->Match_Type, 2*(pattern->groups+1)); if (!match) return NULL; @@ -2387,20 +2446,27 @@ pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status) static void scanner_dealloc(ScannerObject* self) { + PyTypeObject *tp = Py_TYPE(self); + state_fini(&self->state); Py_XDECREF(self->pattern); - PyObject_DEL(self); + PyObject_Free(self); + Py_DECREF(tp); } /*[clinic input] _sre.SRE_Scanner.match + cls: defining_class + / + [clinic start generated code]*/ static PyObject * -_sre_SRE_Scanner_match_impl(ScannerObject *self) -/*[clinic end generated code: output=936b30c63d4b81eb input=881a0154f8c13d9a]*/ +_sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls) +/*[clinic end generated code: output=6e22c149dc0f0325 input=b5146e1f30278cb7]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); SRE_STATE* state = &self->state; PyObject* match; Py_ssize_t status; @@ -2416,8 +2482,8 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self) if (PyErr_Occurred()) return NULL; - match = pattern_new_match((PatternObject*) self->pattern, - state, status); + match = pattern_new_match(module_state, (PatternObject*) self->pattern, + state, status); if (status == 0) state->start = NULL; @@ -2433,12 +2499,16 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self) /*[clinic input] _sre.SRE_Scanner.search + cls: defining_class + / + [clinic start generated code]*/ static PyObject * -_sre_SRE_Scanner_search_impl(ScannerObject *self) -/*[clinic end generated code: output=7dc211986088f025 input=161223ee92ef9270]*/ +_sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls) +/*[clinic end generated code: output=23e8fc78013f9161 input=056c2d37171d0bf2]*/ { + _sremodulestate *module_state = get_sre_module_state_by_class(cls); SRE_STATE* state = &self->state; PyObject* match; Py_ssize_t status; @@ -2454,8 +2524,8 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self) if (PyErr_Occurred()) return NULL; - match = pattern_new_match((PatternObject*) self->pattern, - state, status); + match = pattern_new_match(module_state, (PatternObject*) self->pattern, + state, status); if (status == 0) state->start = NULL; @@ -2468,12 +2538,16 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self) } static PyObject * -pattern_scanner(PatternObject *self, PyObject *string, Py_ssize_t pos, Py_ssize_t endpos) +pattern_scanner(_sremodulestate *module_state, + PatternObject *self, + PyObject *string, + Py_ssize_t pos, + Py_ssize_t endpos) { ScannerObject* scanner; /* create scanner object */ - scanner = PyObject_New(ScannerObject, &Scanner_Type); + scanner = PyObject_New(ScannerObject, module_state->Scanner_Type); if (!scanner) return NULL; scanner->pattern = NULL; @@ -2516,6 +2590,8 @@ pattern_hash(PatternObject *self) static PyObject* pattern_richcompare(PyObject *lefto, PyObject *righto, int op) { + PyTypeObject *tp = Py_TYPE(lefto); + _sremodulestate *module_state = get_sre_module_state_by_class(tp); PatternObject *left, *right; int cmp; @@ -2523,7 +2599,8 @@ pattern_richcompare(PyObject *lefto, PyObject *righto, int op) Py_RETURN_NOTIMPLEMENTED; } - if (!Py_IS_TYPE(lefto, &Pattern_Type) || !Py_IS_TYPE(righto, &Pattern_Type)) { + if (!Py_IS_TYPE(righto, module_state->Pattern_Type)) + { Py_RETURN_NOTIMPLEMENTED; } @@ -2592,47 +2669,28 @@ static PyMemberDef pattern_members[] = { "The regex matching flags."}, {"groups", T_PYSSIZET, PAT_OFF(groups), READONLY, "The number of capturing groups in the pattern."}, + {"__weaklistoffset__", T_PYSSIZET, offsetof(PatternObject, weakreflist), READONLY}, {NULL} /* Sentinel */ }; -static PyTypeObject Pattern_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "re.Pattern", - sizeof(PatternObject), sizeof(SRE_CODE), - (destructor)pattern_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_as_async */ - (reprfunc)pattern_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)pattern_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - pattern_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - pattern_richcompare, /* tp_richcompare */ - offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - pattern_methods, /* tp_methods */ - pattern_members, /* tp_members */ - pattern_getset, /* tp_getset */ +static PyType_Slot pattern_slots[] = { + {Py_tp_dealloc, (destructor)pattern_dealloc}, + {Py_tp_repr, (reprfunc)pattern_repr}, + {Py_tp_hash, (hashfunc)pattern_hash}, + {Py_tp_doc, (void *)pattern_doc}, + {Py_tp_richcompare, pattern_richcompare}, + {Py_tp_methods, pattern_methods}, + {Py_tp_members, pattern_members}, + {Py_tp_getset, pattern_getset}, + {0, NULL}, }; -/* Match objects do not support length or assignment, but do support - __getitem__. */ -static PyMappingMethods match_as_mapping = { - NULL, - (binaryfunc)match_getitem, - NULL +static PyType_Spec pattern_spec = { + .name = "re.Pattern", + .basicsize = sizeof(PatternObject), + .itemsize = sizeof(SRE_CODE), + .flags = Py_TPFLAGS_DEFAULT, + .slots = pattern_slots, }; static PyMethodDef match_methods[] = { @@ -2674,37 +2732,30 @@ static PyMemberDef match_members[] = { /* FIXME: implement setattr("string", None) as a special case (to detach the associated string, if any */ +static PyType_Slot match_slots[] = { + {Py_tp_dealloc, match_dealloc}, + {Py_tp_repr, match_repr}, + {Py_tp_doc, (void *)match_doc}, + {Py_tp_methods, match_methods}, + {Py_tp_members, match_members}, + {Py_tp_getset, match_getset}, + + /* As mapping. + * + * Match objects do not support length or assignment, but do support + * __getitem__. + */ + {Py_mp_subscript, match_getitem}, + + {0, NULL}, +}; -static PyTypeObject Match_Type = { - PyVarObject_HEAD_INIT(NULL,0) - "re.Match", - sizeof(MatchObject), sizeof(Py_ssize_t), - (destructor)match_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_as_async */ - (reprfunc)match_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - &match_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - match_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - match_methods, /* tp_methods */ - match_members, /* tp_members */ - match_getset, /* tp_getset */ +static PyType_Spec match_spec = { + .name = "re.Match", + .basicsize = sizeof(MatchObject), + .itemsize = sizeof(Py_ssize_t), + .flags = Py_TPFLAGS_DEFAULT, + .slots = match_slots, }; static PyMethodDef scanner_methods[] = { @@ -2719,36 +2770,18 @@ static PyMemberDef scanner_members[] = { {NULL} /* Sentinel */ }; -static PyTypeObject Scanner_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_" SRE_MODULE ".SRE_Scanner", - sizeof(ScannerObject), 0, - (destructor)scanner_dealloc,/* tp_dealloc */ - 0, /* tp_vectorcall_offset */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_as_async */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - scanner_methods, /* tp_methods */ - scanner_members, /* tp_members */ - 0, /* tp_getset */ +static PyType_Slot scanner_slots[] = { + {Py_tp_dealloc, scanner_dealloc}, + {Py_tp_methods, scanner_methods}, + {Py_tp_members, scanner_members}, + {0, NULL}, +}; + +static PyType_Spec scanner_spec = { + .name = "_" SRE_MODULE ".SRE_Scanner", + .basicsize = sizeof(ScannerObject), + .flags = Py_TPFLAGS_DEFAULT, + .slots = scanner_slots, }; static PyMethodDef _functions[] = { @@ -2761,64 +2794,108 @@ static PyMethodDef _functions[] = { {NULL, NULL} }; -static struct PyModuleDef sremodule = { - PyModuleDef_HEAD_INIT, - "_" SRE_MODULE, - NULL, - -1, - _functions, - NULL, - NULL, - NULL, - NULL -}; +static int +sre_traverse(PyObject *module, visitproc visit, void *arg) +{ + _sremodulestate *state = get_sre_module_state(module); + + Py_VISIT(state->Pattern_Type); + Py_VISIT(state->Match_Type); + Py_VISIT(state->Scanner_Type); + + return 0; +} -PyMODINIT_FUNC PyInit__sre(void) +static int +sre_clear(PyObject *module) { - PyObject* m; - PyObject* d; - PyObject* x; + _sremodulestate *state = get_sre_module_state(module); - /* Patch object types */ - if (PyType_Ready(&Pattern_Type) || PyType_Ready(&Match_Type) || - PyType_Ready(&Scanner_Type)) - return NULL; + Py_CLEAR(state->Pattern_Type); + Py_CLEAR(state->Match_Type); + Py_CLEAR(state->Scanner_Type); - m = PyModule_Create(&sremodule); - if (m == NULL) - return NULL; - d = PyModule_GetDict(m); + return 0; +} - x = PyLong_FromLong(SRE_MAGIC); - if (x) { - PyDict_SetItemString(d, "MAGIC", x); - Py_DECREF(x); - } +static void +sre_free(void *module) +{ + sre_clear((PyObject *)module); +} + +#define CREATE_TYPE(m, type, spec) \ +do { \ + type = (PyTypeObject *)PyType_FromModuleAndSpec(m, spec, NULL); \ + if (type == NULL) { \ + goto error; \ + } \ +} while (0) + +#define ADD_ULONG_CONSTANT(module, name, value) \ + do { \ + PyObject *o = PyLong_FromUnsignedLong(value); \ + if (!o) \ + goto error; \ + int res = PyModule_AddObjectRef(module, name, o); \ + Py_DECREF(o); \ + if (res < 0) { \ + goto error; \ + } \ +} while (0) - x = PyLong_FromLong(sizeof(SRE_CODE)); - if (x) { - PyDict_SetItemString(d, "CODESIZE", x); - Py_DECREF(x); - } +static int +sre_exec(PyObject *m) +{ + _sremodulestate *state; + + /* Create heap types */ + state = get_sre_module_state(m); + CREATE_TYPE(m, state->Pattern_Type, &pattern_spec); + CREATE_TYPE(m, state->Match_Type, &match_spec); + CREATE_TYPE(m, state->Scanner_Type, &scanner_spec); - x = PyLong_FromUnsignedLong(SRE_MAXREPEAT); - if (x) { - PyDict_SetItemString(d, "MAXREPEAT", x); - Py_DECREF(x); + if (PyModule_AddIntConstant(m, "MAGIC", SRE_MAGIC) < 0) { + goto error; } - x = PyLong_FromUnsignedLong(SRE_MAXGROUPS); - if (x) { - PyDict_SetItemString(d, "MAXGROUPS", x); - Py_DECREF(x); + if (PyModule_AddIntConstant(m, "CODESIZE", sizeof(SRE_CODE)) < 0) { + goto error; } - x = PyUnicode_FromString(copyright); - if (x) { - PyDict_SetItemString(d, "copyright", x); - Py_DECREF(x); + ADD_ULONG_CONSTANT(m, "MAXREPEAT", SRE_MAXREPEAT); + ADD_ULONG_CONSTANT(m, "MAXGROUPS", SRE_MAXGROUPS); + + if (PyModule_AddStringConstant(m, "copyright", copyright) < 0) { + goto error; } - return m; + + return 0; + +error: + return -1; +} + +static PyModuleDef_Slot sre_slots[] = { + {Py_mod_exec, sre_exec}, + {0, NULL}, +}; + +static struct PyModuleDef sremodule = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_" SRE_MODULE, + .m_size = sizeof(_sremodulestate), + .m_methods = _functions, + .m_slots = sre_slots, + .m_traverse = sre_traverse, + .m_free = sre_free, + .m_clear = sre_clear, +}; + +PyMODINIT_FUNC +PyInit__sre(void) +{ + return PyModuleDef_Init(&sremodule); } /* vim:ts=4:sw=4:et diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 54c365b88e6951..96d2796fcfad48 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -487,10 +487,10 @@ typedef struct { PySSLContext *ctx; } PySSLSession; -static PyTypeObject PySSLContext_Type; -static PyTypeObject PySSLSocket_Type; -static PyTypeObject PySSLMemoryBIO_Type; -static PyTypeObject PySSLSession_Type; +static PyTypeObject *PySSLContext_Type; +static PyTypeObject *PySSLSocket_Type; +static PyTypeObject *PySSLMemoryBIO_Type; +static PyTypeObject *PySSLSession_Type; static inline _PySSLError _PySSL_errno(int failed, const SSL *ssl, int retcode) { @@ -508,12 +508,12 @@ static inline _PySSLError _PySSL_errno(int failed, const SSL *ssl, int retcode) /*[clinic input] module _ssl -class _ssl._SSLContext "PySSLContext *" "&PySSLContext_Type" -class _ssl._SSLSocket "PySSLSocket *" "&PySSLSocket_Type" -class _ssl.MemoryBIO "PySSLMemoryBIO *" "&PySSLMemoryBIO_Type" -class _ssl.SSLSession "PySSLSession *" "&PySSLSession_Type" +class _ssl._SSLContext "PySSLContext *" "PySSLContext_Type" +class _ssl._SSLSocket "PySSLSocket *" "PySSLSocket_Type" +class _ssl.MemoryBIO "PySSLMemoryBIO *" "PySSLMemoryBIO_Type" +class _ssl.SSLSession "PySSLSession *" "PySSLSession_Type" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=bdc67fafeeaa8109]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=cc4883756da17954]*/ #include "clinic/_ssl.c.h" @@ -521,9 +521,9 @@ static int PySSL_select(PySocketSockObject *s, int writing, _PyTime_t timeout); static int PySSL_set_owner(PySSLSocket *, PyObject *, void *); static int PySSL_set_session(PySSLSocket *, PyObject *, void *); -#define PySSLSocket_Check(v) Py_IS_TYPE(v, &PySSLSocket_Type) -#define PySSLMemoryBIO_Check(v) Py_IS_TYPE(v, &PySSLMemoryBIO_Type) -#define PySSLSession_Check(v) Py_IS_TYPE(v, &PySSLSession_Type) +#define PySSLSocket_Check(v) Py_IS_TYPE(v, PySSLSocket_Type) +#define PySSLMemoryBIO_Check(v) Py_IS_TYPE(v, PySSLMemoryBIO_Type) +#define PySSLSession_Check(v) Py_IS_TYPE(v, PySSLSession_Type) typedef enum { SOCKET_IS_NONBLOCKING, @@ -587,7 +587,6 @@ SSLError_str(PyOSErrorObject *self) } static PyType_Slot sslerror_type_slots[] = { - {Py_tp_base, NULL}, /* Filled out in module init as it's not a constant */ {Py_tp_doc, (void*)SSLError_doc}, {Py_tp_str, SSLError_str}, {0, 0}, @@ -937,7 +936,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, SSL_CTX *ctx = sslctx->ctx; _PySSLError err = { 0 }; - self = PyObject_New(PySSLSocket, &PySSLSocket_Type); + self = PyObject_New(PySSLSocket, PySSLSocket_Type); if (self == NULL) return NULL; @@ -1102,7 +1101,7 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) } if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, ERRSTR("The handshake operation timed out")); goto error; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { @@ -2194,7 +2193,7 @@ static PySSLContext *PySSL_get_context(PySSLSocket *self, void *closure) { static int PySSL_set_context(PySSLSocket *self, PyObject *value, void *closure) { - if (PyObject_TypeCheck(value, &PySSLContext_Type)) { + if (PyObject_TypeCheck(value, PySSLContext_Type)) { #if !HAVE_SNI PyErr_SetString(PyExc_NotImplementedError, "setting a socket's " "context is not supported by your OpenSSL library"); @@ -2289,13 +2288,15 @@ PySSL_clear(PySSLSocket *self) static void PySSL_dealloc(PySSLSocket *self) { + PyTypeObject *tp = Py_TYPE(self); if (self->ssl) SSL_free(self->ssl); Py_XDECREF(self->Socket); Py_XDECREF(self->ctx); Py_XDECREF(self->server_hostname); Py_XDECREF(self->owner); - PyObject_Del(self); + PyObject_Free(self); + Py_DECREF(tp); } /* If the socket has a timeout, do a select()/poll() on the socket. @@ -2419,7 +2420,7 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b) sockstate = PySSL_select(sock, 1, timeout); if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, "The write operation timed out"); goto error; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { @@ -2454,7 +2455,7 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b) } if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, "The write operation timed out"); goto error; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { @@ -2609,7 +2610,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, sockstate = SOCKET_OPERATION_OK; if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, "The read operation timed out"); goto error; } else if (sockstate == SOCKET_IS_NONBLOCKING) { @@ -2724,10 +2725,10 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) if (sockstate == SOCKET_HAS_TIMED_OUT) { if (err.ssl == SSL_ERROR_WANT_READ) - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, "The read operation timed out"); else - PyErr_SetString(PySocketModule.timeout_error, + PyErr_SetString(PyExc_TimeoutError, "The write operation timed out"); goto error; } @@ -2895,7 +2896,7 @@ PySSL_get_session(PySSLSocket *self, void *closure) { Py_RETURN_NONE; } #endif - pysess = PyObject_GC_New(PySSLSession, &PySSLSession_Type); + pysess = PyObject_GC_New(PySSLSession, PySSLSession_Type); if (pysess == NULL) { SSL_SESSION_free(session); return NULL; @@ -3008,38 +3009,21 @@ static PyMethodDef PySSLMethods[] = { {NULL, NULL} }; -static PyTypeObject PySSLSocket_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_ssl._SSLSocket", /*tp_name*/ - sizeof(PySSLSocket), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PySSL_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_as_async*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - (traverseproc) PySSL_traverse, /*tp_traverse*/ - (inquiry) PySSL_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - PySSLMethods, /*tp_methods*/ - 0, /*tp_members*/ - ssl_getsetlist, /*tp_getset*/ +static PyType_Slot PySSLSocket_slots[] = { + {Py_tp_methods, PySSLMethods}, + {Py_tp_getset, ssl_getsetlist}, + {Py_tp_dealloc, PySSL_dealloc}, + {Py_tp_traverse, PySSL_traverse}, + {Py_tp_clear, PySSL_clear}, + {0, 0}, +}; + +static PyType_Spec PySSLSocket_spec = { + "_ssl._SSLSocket", + sizeof(PySSLSocket), + 0, + Py_TPFLAGS_DEFAULT, + PySSLSocket_slots, }; @@ -3316,17 +3300,19 @@ context_clear(PySSLContext *self) static void context_dealloc(PySSLContext *self) { + PyTypeObject *tp = Py_TYPE(self); /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); #if HAVE_NPN - PyMem_FREE(self->npn_protocols); + PyMem_Free(self->npn_protocols); #endif #if HAVE_ALPN - PyMem_FREE(self->alpn_protocols); + PyMem_Free(self->alpn_protocols); #endif Py_TYPE(self)->tp_free(self); + Py_DECREF(tp); } /*[clinic input] @@ -3524,7 +3510,7 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, return NULL; } - PyMem_FREE(self->alpn_protocols); + PyMem_Free(self->alpn_protocols); self->alpn_protocols = PyMem_Malloc(protos->len); if (!self->alpn_protocols) return PyErr_NoMemory(); @@ -4366,8 +4352,8 @@ _ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock, /*[clinic input] _ssl._SSLContext._wrap_bio - incoming: object(subclass_of="&PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") - outgoing: object(subclass_of="&PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") + incoming: object(subclass_of="PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") + outgoing: object(subclass_of="PySSLMemoryBIO_Type", type="PySSLMemoryBIO *") server_side: int server_hostname as hostname_obj: object = None * @@ -4381,7 +4367,7 @@ _ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming, PySSLMemoryBIO *outgoing, int server_side, PyObject *hostname_obj, PyObject *owner, PyObject *session) -/*[clinic end generated code: output=5c5d6d9b41f99332 input=8cf22f4d586ac56a]*/ +/*[clinic end generated code: output=5c5d6d9b41f99332 input=63867b8f3e1a1aa3]*/ { char *hostname = NULL; PyObject *res; @@ -4829,45 +4815,22 @@ static struct PyMethodDef context_methods[] = { {NULL, NULL} /* sentinel */ }; -static PyTypeObject PySSLContext_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_ssl._SSLContext", /*tp_name*/ - sizeof(PySSLContext), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)context_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_as_async*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - (traverseproc) context_traverse, /*tp_traverse*/ - (inquiry) context_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - context_methods, /*tp_methods*/ - 0, /*tp_members*/ - context_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - _ssl__SSLContext, /*tp_new*/ +static PyType_Slot PySSLContext_slots[] = { + {Py_tp_methods, context_methods}, + {Py_tp_getset, context_getsetlist}, + {Py_tp_new, _ssl__SSLContext}, + {Py_tp_dealloc, context_dealloc}, + {Py_tp_traverse, context_traverse}, + {Py_tp_clear, context_clear}, + {0, 0}, +}; + +static PyType_Spec PySSLContext_spec = { + "_ssl._SSLContext", + sizeof(PySSLContext), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + PySSLContext_slots, }; @@ -4915,8 +4878,10 @@ _ssl_MemoryBIO_impl(PyTypeObject *type) static void memory_bio_dealloc(PySSLMemoryBIO *self) { + PyTypeObject *tp = Py_TYPE(self); BIO_free(self->bio); Py_TYPE(self)->tp_free(self); + Py_DECREF(tp); } static PyObject * @@ -5054,47 +5019,21 @@ static struct PyMethodDef memory_bio_methods[] = { {NULL, NULL} /* sentinel */ }; -static PyTypeObject PySSLMemoryBIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_ssl.MemoryBIO", /*tp_name*/ - sizeof(PySSLMemoryBIO), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)memory_bio_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_as_async*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - memory_bio_methods, /*tp_methods*/ - 0, /*tp_members*/ - memory_bio_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - _ssl_MemoryBIO, /*tp_new*/ +static PyType_Slot PySSLMemoryBIO_slots[] = { + {Py_tp_methods, memory_bio_methods}, + {Py_tp_getset, memory_bio_getsetlist}, + {Py_tp_new, _ssl_MemoryBIO}, + {Py_tp_dealloc, memory_bio_dealloc}, + {0, 0}, }; +static PyType_Spec PySSLMemoryBIO_spec = { + "_ssl.MemoryBIO", + sizeof(PySSLMemoryBIO), + 0, + Py_TPFLAGS_DEFAULT, + PySSLMemoryBIO_slots, +}; /* * SSL Session object @@ -5103,6 +5042,7 @@ static PyTypeObject PySSLMemoryBIO_Type = { static void PySSLSession_dealloc(PySSLSession *self) { + PyTypeObject *tp = Py_TYPE(self); /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(self); Py_XDECREF(self->ctx); @@ -5110,6 +5050,7 @@ PySSLSession_dealloc(PySSLSession *self) SSL_SESSION_free(self->session); } PyObject_GC_Del(self); + Py_DECREF(tp); } static PyObject * @@ -5251,37 +5192,21 @@ static PyGetSetDef PySSLSession_getsetlist[] = { {NULL}, /* sentinel */ }; -static PyTypeObject PySSLSession_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_ssl.Session", /*tp_name*/ - sizeof(PySSLSession), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)PySSLSession_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_as_async*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - (traverseproc)PySSLSession_traverse, /*tp_traverse*/ - (inquiry)PySSLSession_clear, /*tp_clear*/ - PySSLSession_richcompare, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - PySSLSession_getsetlist, /*tp_getset*/ +static PyType_Slot PySSLSession_slots[] = { + {Py_tp_getset,PySSLSession_getsetlist}, + {Py_tp_richcompare, PySSLSession_richcompare}, + {Py_tp_dealloc, PySSLSession_dealloc}, + {Py_tp_traverse, PySSLSession_traverse}, + {Py_tp_clear, PySSLSession_clear}, + {0, 0}, +}; + +static PyType_Spec PySSLSession_spec = { + "_ssl.SSLSession", + sizeof(PySSLSession), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + PySSLSession_slots, }; @@ -5979,23 +5904,190 @@ static int _setup_ssl_threads(void) { #endif /* HAVE_OPENSSL_CRYPTO_LOCK for OpenSSL < 1.1.0 */ -PyDoc_STRVAR(module_doc, -"Implementation module for SSL socket operations. See the socket module\n\ -for documentation."); +static int +sslmodule_init_types(PyObject *module) +{ + PySSLContext_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + module, &PySSLContext_spec, NULL + ); + if (PySSLContext_Type == NULL) + return -1; + PySSLSocket_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + module, &PySSLSocket_spec, NULL + ); + if (PySSLSocket_Type == NULL) + return -1; -static struct PyModuleDef _sslmodule = { - PyModuleDef_HEAD_INIT, - "_ssl", - module_doc, - -1, - PySSL_methods, - NULL, - NULL, - NULL, - NULL -}; + PySSLMemoryBIO_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + module, &PySSLMemoryBIO_spec, NULL + ); + if (PySSLMemoryBIO_Type == NULL) + return -1; + + PySSLSession_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + module, &PySSLSession_spec, NULL + ); + if (PySSLSession_Type == NULL) + return -1; + + if (PyModule_AddType(module, PySSLContext_Type)) + return -1; + if (PyModule_AddType(module, PySSLSocket_Type)) + return -1; + if (PyModule_AddType(module, PySSLMemoryBIO_Type)) + return -1; + if (PyModule_AddType(module, PySSLSession_Type)) + return -1; + + return 0; +} + +static int +sslmodule_init_exceptions(PyObject *module) +{ + PyObject *bases = NULL; + +#define add_exception(exc, name, doc, base) \ +do { \ + (exc) = PyErr_NewExceptionWithDoc("ssl." name, (doc), (base), NULL); \ + if ((exc) == NULL) goto error; \ + if (PyModule_AddObjectRef(module, name, exc) < 0) goto error; \ +} while(0) + + PySSLErrorObject = PyType_FromSpecWithBases(&sslerror_type_spec, PyExc_OSError); + if (PySSLErrorObject == NULL) { + goto error; + } + if (PyModule_AddObjectRef(module, "SSLError", PySSLErrorObject) < 0) { + goto error; + } + + /* ssl.CertificateError used to be a subclass of ValueError */ + bases = PyTuple_Pack(2, PySSLErrorObject, PyExc_ValueError); + if (bases == NULL) { + goto error; + } + add_exception( + PySSLCertVerificationErrorObject, + "SSLCertVerificationError", + SSLCertVerificationError_doc, + bases + ); + Py_CLEAR(bases); + + add_exception( + PySSLZeroReturnErrorObject, + "SSLZeroReturnError", + SSLZeroReturnError_doc, + PySSLErrorObject + ); + + add_exception( + PySSLWantWriteErrorObject, + "SSLWantWriteError", + SSLWantWriteError_doc, + PySSLErrorObject + ); + + add_exception( + PySSLWantReadErrorObject, + "SSLWantReadError", + SSLWantReadError_doc, + PySSLErrorObject + ); + + add_exception( + PySSLSyscallErrorObject, + "SSLSyscallError", + SSLSyscallError_doc, + PySSLErrorObject + ); + + add_exception( + PySSLEOFErrorObject, + "SSLEOFError", + SSLEOFError_doc, + PySSLErrorObject + ); +#undef add_exception + + return 0; + error: + Py_XDECREF(bases); + return -1; +} + +static int +sslmodule_init_socketapi(PyObject *module) +{ + PySocketModule_APIObject *socket_api; + + /* Load _socket module and its C API */ + socket_api = PySocketModule_ImportModuleAndAPI(); + if (socket_api == NULL) + return -1; + PySocketModule = *socket_api; + + return 0; +} +static int +sslmodule_init_errorcodes(PyObject *module) +{ + struct py_ssl_error_code *errcode; + struct py_ssl_library_code *libcode; + + /* Mappings for error codes */ + err_codes_to_names = PyDict_New(); + if (err_codes_to_names == NULL) + return -1; + err_names_to_codes = PyDict_New(); + if (err_names_to_codes == NULL) + return -1; + lib_codes_to_names = PyDict_New(); + if (lib_codes_to_names == NULL) + return -1; + + errcode = error_codes; + while (errcode->mnemonic != NULL) { + PyObject *mnemo, *key; + mnemo = PyUnicode_FromString(errcode->mnemonic); + key = Py_BuildValue("ii", errcode->library, errcode->reason); + if (mnemo == NULL || key == NULL) + return -1; + if (PyDict_SetItem(err_codes_to_names, key, mnemo)) + return -1; + if (PyDict_SetItem(err_names_to_codes, mnemo, key)) + return -1; + Py_DECREF(key); + Py_DECREF(mnemo); + errcode++; + } + + libcode = library_codes; + while (libcode->library != NULL) { + PyObject *mnemo, *key; + key = PyLong_FromLong(libcode->code); + mnemo = PyUnicode_FromString(libcode->library); + if (key == NULL || mnemo == NULL) + return -1; + if (PyDict_SetItem(lib_codes_to_names, key, mnemo)) + return -1; + Py_DECREF(key); + Py_DECREF(mnemo); + libcode++; + } + + if (PyModule_AddObject(module, "err_codes_to_names", err_codes_to_names)) + return -1; + if (PyModule_AddObject(module, "err_names_to_codes", err_names_to_codes)) + return -1; + if (PyModule_AddObject(module, "lib_codes_to_names", lib_codes_to_names)) + return -1; + + return 0; +} static void parse_openssl_version(unsigned long libver, @@ -6014,113 +6106,43 @@ parse_openssl_version(unsigned long libver, *major = libver & 0xFF; } -PyMODINIT_FUNC -PyInit__ssl(void) +static int +sslmodule_init_versioninfo(PyObject *m) { - PyObject *m, *d, *r, *bases; + PyObject *r; unsigned long libver; unsigned int major, minor, fix, patch, status; - PySocketModule_APIObject *socket_api; - struct py_ssl_error_code *errcode; - struct py_ssl_library_code *libcode; - - if (PyType_Ready(&PySSLContext_Type) < 0) - return NULL; - if (PyType_Ready(&PySSLSocket_Type) < 0) - return NULL; - if (PyType_Ready(&PySSLMemoryBIO_Type) < 0) - return NULL; - if (PyType_Ready(&PySSLSession_Type) < 0) - return NULL; - - m = PyModule_Create(&_sslmodule); - if (m == NULL) - return NULL; - d = PyModule_GetDict(m); - - /* Load _socket module and its C API */ - socket_api = PySocketModule_ImportModuleAndAPI(); - if (!socket_api) - return NULL; - PySocketModule = *socket_api; + /* OpenSSL version */ + /* SSLeay() gives us the version of the library linked against, + which could be different from the headers version. + */ + libver = OpenSSL_version_num(); + r = PyLong_FromUnsignedLong(libver); + if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r)) + return -1; -#ifndef OPENSSL_VERSION_1_1 - /* Load all algorithms and initialize cpuid */ - OPENSSL_add_all_algorithms_noconf(); - /* Init OpenSSL */ - SSL_load_error_strings(); - SSL_library_init(); -#endif + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); + r = Py_BuildValue("IIIII", major, minor, fix, patch, status); + if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r)) + return -1; -#ifdef HAVE_OPENSSL_CRYPTO_LOCK - /* note that this will start threading if not already started */ - if (!_setup_ssl_threads()) { - return NULL; - } -#elif OPENSSL_VERSION_1_1 - /* OpenSSL 1.1.0 builtin thread support is enabled */ - _ssl_locks_count++; -#endif + r = PyUnicode_FromString(OpenSSL_version(OPENSSL_VERSION)); + if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r)) + return -1; - /* Add symbols to module dict */ - sslerror_type_slots[0].pfunc = PyExc_OSError; - PySSLErrorObject = PyType_FromSpec(&sslerror_type_spec); - if (PySSLErrorObject == NULL) - return NULL; + libver = OPENSSL_VERSION_NUMBER; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); + r = Py_BuildValue("IIIII", major, minor, fix, patch, status); + if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) + return -1; - /* ssl.CertificateError used to be a subclass of ValueError */ - bases = Py_BuildValue("OO", PySSLErrorObject, PyExc_ValueError); - if (bases == NULL) - return NULL; - PySSLCertVerificationErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLCertVerificationError", SSLCertVerificationError_doc, - bases, NULL); - Py_DECREF(bases); - PySSLZeroReturnErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLZeroReturnError", SSLZeroReturnError_doc, - PySSLErrorObject, NULL); - PySSLWantReadErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLWantReadError", SSLWantReadError_doc, - PySSLErrorObject, NULL); - PySSLWantWriteErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLWantWriteError", SSLWantWriteError_doc, - PySSLErrorObject, NULL); - PySSLSyscallErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLSyscallError", SSLSyscallError_doc, - PySSLErrorObject, NULL); - PySSLEOFErrorObject = PyErr_NewExceptionWithDoc( - "ssl.SSLEOFError", SSLEOFError_doc, - PySSLErrorObject, NULL); - if (PySSLCertVerificationErrorObject == NULL - || PySSLZeroReturnErrorObject == NULL - || PySSLWantReadErrorObject == NULL - || PySSLWantWriteErrorObject == NULL - || PySSLSyscallErrorObject == NULL - || PySSLEOFErrorObject == NULL) - return NULL; - if (PyDict_SetItemString(d, "SSLError", PySSLErrorObject) != 0 - || PyDict_SetItemString(d, "SSLCertVerificationError", - PySSLCertVerificationErrorObject) != 0 - || PyDict_SetItemString(d, "SSLZeroReturnError", PySSLZeroReturnErrorObject) != 0 - || PyDict_SetItemString(d, "SSLWantReadError", PySSLWantReadErrorObject) != 0 - || PyDict_SetItemString(d, "SSLWantWriteError", PySSLWantWriteErrorObject) != 0 - || PyDict_SetItemString(d, "SSLSyscallError", PySSLSyscallErrorObject) != 0 - || PyDict_SetItemString(d, "SSLEOFError", PySSLEOFErrorObject) != 0) - return NULL; - if (PyDict_SetItemString(d, "_SSLContext", - (PyObject *)&PySSLContext_Type) != 0) - return NULL; - if (PyDict_SetItemString(d, "_SSLSocket", - (PyObject *)&PySSLSocket_Type) != 0) - return NULL; - if (PyDict_SetItemString(d, "MemoryBIO", - (PyObject *)&PySSLMemoryBIO_Type) != 0) - return NULL; - if (PyDict_SetItemString(d, "SSLSession", - (PyObject *)&PySSLSession_Type) != 0) - return NULL; + return 0; +} +static int +sslmodule_init_constants(PyObject *m) +{ PyModule_AddStringConstant(m, "_DEFAULT_CIPHERS", PY_SSL_DEFAULT_CIPHER_STRING); @@ -6377,72 +6399,71 @@ PyInit__ssl(void) addbool(m, "HAS_TLSv1_3", 0); #endif - /* Mappings for error codes */ - err_codes_to_names = PyDict_New(); - err_names_to_codes = PyDict_New(); - if (err_codes_to_names == NULL || err_names_to_codes == NULL) - return NULL; - errcode = error_codes; - while (errcode->mnemonic != NULL) { - PyObject *mnemo, *key; - mnemo = PyUnicode_FromString(errcode->mnemonic); - key = Py_BuildValue("ii", errcode->library, errcode->reason); - if (mnemo == NULL || key == NULL) - return NULL; - if (PyDict_SetItem(err_codes_to_names, key, mnemo)) - return NULL; - if (PyDict_SetItem(err_names_to_codes, mnemo, key)) - return NULL; - Py_DECREF(key); - Py_DECREF(mnemo); - errcode++; + return 0; +} + +static int +sslmodule_legacy(PyObject *module) +{ +#ifndef OPENSSL_VERSION_1_1 + /* Load all algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); + /* Init OpenSSL */ + SSL_load_error_strings(); + SSL_library_init(); +#endif + +#ifdef HAVE_OPENSSL_CRYPTO_LOCK + /* note that this will start threading if not already started */ + if (!_setup_ssl_threads()) { + return 0; } - if (PyModule_AddObject(m, "err_codes_to_names", err_codes_to_names)) - return NULL; - if (PyModule_AddObject(m, "err_names_to_codes", err_names_to_codes)) +#elif OPENSSL_VERSION_1_1 + /* OpenSSL 1.1.0 builtin thread support is enabled */ + _ssl_locks_count++; +#endif + return 0; +} + +PyDoc_STRVAR(module_doc, +"Implementation module for SSL socket operations. See the socket module\n\ +for documentation."); + + +static struct PyModuleDef _sslmodule = { + PyModuleDef_HEAD_INIT, + "_ssl", + module_doc, + -1, + PySSL_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC +PyInit__ssl(void) +{ + PyObject *m; + + m = PyModule_Create(&_sslmodule); + if (m == NULL) return NULL; - lib_codes_to_names = PyDict_New(); - if (lib_codes_to_names == NULL) + if (sslmodule_init_types(m) != 0) return NULL; - libcode = library_codes; - while (libcode->library != NULL) { - PyObject *mnemo, *key; - key = PyLong_FromLong(libcode->code); - mnemo = PyUnicode_FromString(libcode->library); - if (key == NULL || mnemo == NULL) - return NULL; - if (PyDict_SetItem(lib_codes_to_names, key, mnemo)) - return NULL; - Py_DECREF(key); - Py_DECREF(mnemo); - libcode++; - } - if (PyModule_AddObject(m, "lib_codes_to_names", lib_codes_to_names)) + if (sslmodule_init_exceptions(m) != 0) return NULL; - - /* OpenSSL version */ - /* SSLeay() gives us the version of the library linked against, - which could be different from the headers version. - */ - libver = OpenSSL_version_num(); - r = PyLong_FromUnsignedLong(libver); - if (r == NULL) + if (sslmodule_init_socketapi(m) != 0) return NULL; - if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r)) + if (sslmodule_init_errorcodes(m) != 0) return NULL; - parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); - r = Py_BuildValue("IIIII", major, minor, fix, patch, status); - if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r)) + if (sslmodule_init_constants(m) != 0) return NULL; - r = PyUnicode_FromString(OpenSSL_version(OPENSSL_VERSION)); - if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r)) + if (sslmodule_init_versioninfo(m) != 0) return NULL; - - libver = OPENSSL_VERSION_NUMBER; - parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); - r = Py_BuildValue("IIIII", major, minor, fix, patch, status); - if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) + if (sslmodule_legacy(m) != 0) return NULL; return m; diff --git a/Modules/_struct.c b/Modules/_struct.c index 81cdbb9b817d31..c95c76f8ae039e 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -15,6 +15,7 @@ class Struct "PyStructObject *" "&PyStructType" /*[clinic end generated code: output=da39a3ee5e6b4b0d input=9b032058a83ed7c3]*/ typedef struct { + PyObject *cache; PyObject *PyStructType; PyObject *unpackiter_type; PyObject *StructError; @@ -30,16 +31,19 @@ get_struct_state(PyObject *module) static struct PyModuleDef _structmodule; -#define _structmodulestate_global get_struct_state(PyState_FindModule(&_structmodule)) +#define get_struct_state_structinst(self) \ + (get_struct_state(_PyType_GetModuleByDef(Py_TYPE(self), &_structmodule))) +#define get_struct_state_iterinst(self) \ + (get_struct_state(PyType_GetModule(Py_TYPE(self)))) /* The translation function for each format character is table driven */ typedef struct _formatdef { char format; Py_ssize_t size; Py_ssize_t alignment; - PyObject* (*unpack)(const char *, + PyObject* (*unpack)(_structmodulestate *, const char *, const struct _formatdef *); - int (*pack)(char *, PyObject *, + int (*pack)(_structmodulestate *, char *, PyObject *, const struct _formatdef *); } formatdef; @@ -61,10 +65,7 @@ typedef struct { PyObject *weakreflist; /* List of weak references */ } PyStructObject; - -#define PyStruct_Check(op) PyObject_TypeCheck(op, (PyTypeObject *)_structmodulestate_global->PyStructType) -#define PyStruct_CheckExact(op) Py_IS_TYPE(op, (PyTypeObject *)_structmodulestate_global->PyStructType) - +#define PyStruct_Check(op, state) PyObject_TypeCheck(op, (PyTypeObject *)(state)->PyStructType) /* Define various structs to figure out the alignments of types */ @@ -102,12 +103,20 @@ class cache_struct_converter(CConverter): converter = 'cache_struct_converter' c_default = "NULL" + def parse_arg(self, argname, displayname): + return """ + if (!{converter}(module, {argname}, &{paramname})) {{{{ + goto exit; + }}}} + """.format(argname=argname, paramname=self.name, + converter=self.converter) + def cleanup(self): return "Py_XDECREF(%s);\n" % self.name [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=49957cca130ffb63]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=d6746621c2fb1a7d]*/ -static int cache_struct_converter(PyObject *, PyStructObject **); +static int cache_struct_converter(PyObject *, PyObject *, PyStructObject **); #include "clinic/_struct.c.h" @@ -115,7 +124,7 @@ static int cache_struct_converter(PyObject *, PyStructObject **); PyLongObject if possible, otherwise fails. Caller should decref. */ static PyObject * -get_pylong(PyObject *v) +get_pylong(_structmodulestate *state, PyObject *v) { assert(v != NULL); if (!PyLong_Check(v)) { @@ -126,7 +135,7 @@ get_pylong(PyObject *v) return NULL; } else { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not an integer"); return NULL; } @@ -142,11 +151,11 @@ get_pylong(PyObject *v) one */ static int -get_long(PyObject *v, long *p) +get_long(_structmodulestate *state, PyObject *v, long *p) { long x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -154,7 +163,7 @@ get_long(PyObject *v, long *p) Py_DECREF(v); if (x == (long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -166,11 +175,11 @@ get_long(PyObject *v, long *p) /* Same, but handling unsigned long */ static int -get_ulong(PyObject *v, unsigned long *p) +get_ulong(_structmodulestate *state, PyObject *v, unsigned long *p) { unsigned long x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -178,7 +187,7 @@ get_ulong(PyObject *v, unsigned long *p) Py_DECREF(v); if (x == (unsigned long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -189,11 +198,11 @@ get_ulong(PyObject *v, unsigned long *p) /* Same, but handling native long long. */ static int -get_longlong(PyObject *v, long long *p) +get_longlong(_structmodulestate *state, PyObject *v, long long *p) { long long x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -201,7 +210,7 @@ get_longlong(PyObject *v, long long *p) Py_DECREF(v); if (x == (long long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -212,11 +221,11 @@ get_longlong(PyObject *v, long long *p) /* Same, but handling native unsigned long long. */ static int -get_ulonglong(PyObject *v, unsigned long long *p) +get_ulonglong(_structmodulestate *state, PyObject *v, unsigned long long *p) { unsigned long long x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -224,7 +233,7 @@ get_ulonglong(PyObject *v, unsigned long long *p) Py_DECREF(v); if (x == (unsigned long long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -235,11 +244,11 @@ get_ulonglong(PyObject *v, unsigned long long *p) /* Same, but handling Py_ssize_t */ static int -get_ssize_t(PyObject *v, Py_ssize_t *p) +get_ssize_t(_structmodulestate *state, PyObject *v, Py_ssize_t *p) { Py_ssize_t x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -247,7 +256,7 @@ get_ssize_t(PyObject *v, Py_ssize_t *p) Py_DECREF(v); if (x == (Py_ssize_t)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -258,11 +267,11 @@ get_ssize_t(PyObject *v, Py_ssize_t *p) /* Same, but handling size_t */ static int -get_size_t(PyObject *v, size_t *p) +get_size_t(_structmodulestate *state, PyObject *v, size_t *p) { size_t x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -270,7 +279,7 @@ get_size_t(PyObject *v, size_t *p) Py_DECREF(v); if (x == (size_t)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument out of range"); return -1; } @@ -279,7 +288,7 @@ get_size_t(PyObject *v, size_t *p) } -#define RANGE_ERROR(x, f, flag, mask) return _range_error(f, flag) +#define RANGE_ERROR(state, x, f, flag, mask) return _range_error(state, f, flag) /* Floating point helpers */ @@ -298,13 +307,14 @@ unpack_halffloat(const char *p, /* start of 2-byte string */ } static int -pack_halffloat(char *p, /* start of 2-byte string */ +pack_halffloat(_structmodulestate *state, + char *p, /* start of 2-byte string */ PyObject *v, /* value to pack */ int le) /* true for little-endian, false for big-endian */ { double x = PyFloat_AsDouble(v); if (x == -1.0 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -337,7 +347,7 @@ unpack_double(const char *p, /* start of 8-byte string */ /* Helper to format the range error exceptions */ static int -_range_error(const formatdef *f, int is_unsigned) +_range_error(_structmodulestate *state, const formatdef *f, int is_unsigned) { /* ulargest is the largest unsigned value with f->size bytes. * Note that the simpler: @@ -350,13 +360,13 @@ _range_error(const formatdef *f, int is_unsigned) const size_t ulargest = (size_t)-1 >> ((SIZEOF_SIZE_T - f->size)*8); assert(f->size >= 1 && f->size <= SIZEOF_SIZE_T); if (is_unsigned) - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "'%c' format requires 0 <= number <= %zu", f->format, ulargest); else { const Py_ssize_t largest = (Py_ssize_t)(ulargest >> 1); - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "'%c' format requires %zd <= number <= %zd", f->format, ~ largest, @@ -388,25 +398,25 @@ _range_error(const formatdef *f, int is_unsigned) does this). */ static PyObject * -nu_char(const char *p, const formatdef *f) +nu_char(_structmodulestate *state, const char *p, const formatdef *f) { return PyBytes_FromStringAndSize(p, 1); } static PyObject * -nu_byte(const char *p, const formatdef *f) +nu_byte(_structmodulestate *state, const char *p, const formatdef *f) { return PyLong_FromLong((long) *(signed char *)p); } static PyObject * -nu_ubyte(const char *p, const formatdef *f) +nu_ubyte(_structmodulestate *state, const char *p, const formatdef *f) { return PyLong_FromLong((long) *(unsigned char *)p); } static PyObject * -nu_short(const char *p, const formatdef *f) +nu_short(_structmodulestate *state, const char *p, const formatdef *f) { short x; memcpy((char *)&x, p, sizeof x); @@ -414,7 +424,7 @@ nu_short(const char *p, const formatdef *f) } static PyObject * -nu_ushort(const char *p, const formatdef *f) +nu_ushort(_structmodulestate *state, const char *p, const formatdef *f) { unsigned short x; memcpy((char *)&x, p, sizeof x); @@ -422,7 +432,7 @@ nu_ushort(const char *p, const formatdef *f) } static PyObject * -nu_int(const char *p, const formatdef *f) +nu_int(_structmodulestate *state, const char *p, const formatdef *f) { int x; memcpy((char *)&x, p, sizeof x); @@ -430,7 +440,7 @@ nu_int(const char *p, const formatdef *f) } static PyObject * -nu_uint(const char *p, const formatdef *f) +nu_uint(_structmodulestate *state, const char *p, const formatdef *f) { unsigned int x; memcpy((char *)&x, p, sizeof x); @@ -438,7 +448,7 @@ nu_uint(const char *p, const formatdef *f) } static PyObject * -nu_long(const char *p, const formatdef *f) +nu_long(_structmodulestate *state, const char *p, const formatdef *f) { long x; memcpy((char *)&x, p, sizeof x); @@ -446,7 +456,7 @@ nu_long(const char *p, const formatdef *f) } static PyObject * -nu_ulong(const char *p, const formatdef *f) +nu_ulong(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long x; memcpy((char *)&x, p, sizeof x); @@ -454,7 +464,7 @@ nu_ulong(const char *p, const formatdef *f) } static PyObject * -nu_ssize_t(const char *p, const formatdef *f) +nu_ssize_t(_structmodulestate *state, const char *p, const formatdef *f) { Py_ssize_t x; memcpy((char *)&x, p, sizeof x); @@ -462,7 +472,7 @@ nu_ssize_t(const char *p, const formatdef *f) } static PyObject * -nu_size_t(const char *p, const formatdef *f) +nu_size_t(_structmodulestate *state, const char *p, const formatdef *f) { size_t x; memcpy((char *)&x, p, sizeof x); @@ -470,7 +480,7 @@ nu_size_t(const char *p, const formatdef *f) } static PyObject * -nu_longlong(const char *p, const formatdef *f) +nu_longlong(_structmodulestate *state, const char *p, const formatdef *f) { long long x; memcpy((char *)&x, p, sizeof x); @@ -478,7 +488,7 @@ nu_longlong(const char *p, const formatdef *f) } static PyObject * -nu_ulonglong(const char *p, const formatdef *f) +nu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long long x; memcpy((char *)&x, p, sizeof x); @@ -486,7 +496,7 @@ nu_ulonglong(const char *p, const formatdef *f) } static PyObject * -nu_bool(const char *p, const formatdef *f) +nu_bool(_structmodulestate *state, const char *p, const formatdef *f) { _Bool x; memcpy((char *)&x, p, sizeof x); @@ -495,7 +505,7 @@ nu_bool(const char *p, const formatdef *f) static PyObject * -nu_halffloat(const char *p, const formatdef *f) +nu_halffloat(_structmodulestate *state, const char *p, const formatdef *f) { #if PY_LITTLE_ENDIAN return unpack_halffloat(p, 1); @@ -505,7 +515,7 @@ nu_halffloat(const char *p, const formatdef *f) } static PyObject * -nu_float(const char *p, const formatdef *f) +nu_float(_structmodulestate *state, const char *p, const formatdef *f) { float x; memcpy((char *)&x, p, sizeof x); @@ -513,7 +523,7 @@ nu_float(const char *p, const formatdef *f) } static PyObject * -nu_double(const char *p, const formatdef *f) +nu_double(_structmodulestate *state, const char *p, const formatdef *f) { double x; memcpy((char *)&x, p, sizeof x); @@ -521,7 +531,7 @@ nu_double(const char *p, const formatdef *f) } static PyObject * -nu_void_p(const char *p, const formatdef *f) +nu_void_p(_structmodulestate *state, const char *p, const formatdef *f) { void *x; memcpy((char *)&x, p, sizeof x); @@ -529,13 +539,13 @@ nu_void_p(const char *p, const formatdef *f) } static int -np_byte(char *p, PyObject *v, const formatdef *f) +np_byte(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; if (x < -128 || x > 127) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "byte format requires -128 <= number <= 127"); return -1; } @@ -544,13 +554,13 @@ np_byte(char *p, PyObject *v, const formatdef *f) } static int -np_ubyte(char *p, PyObject *v, const formatdef *f) +np_ubyte(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; if (x < 0 || x > 255) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "ubyte format requires 0 <= number <= 255"); return -1; } @@ -559,10 +569,10 @@ np_ubyte(char *p, PyObject *v, const formatdef *f) } static int -np_char(char *p, PyObject *v, const formatdef *f) +np_char(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "char format requires a bytes object of length 1"); return -1; } @@ -571,14 +581,14 @@ np_char(char *p, PyObject *v, const formatdef *f) } static int -np_short(char *p, PyObject *v, const formatdef *f) +np_short(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; short y; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; if (x < SHRT_MIN || x > SHRT_MAX) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "short format requires " Py_STRINGIFY(SHRT_MIN) " <= number <= " Py_STRINGIFY(SHRT_MAX)); return -1; @@ -589,14 +599,14 @@ np_short(char *p, PyObject *v, const formatdef *f) } static int -np_ushort(char *p, PyObject *v, const formatdef *f) +np_ushort(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; unsigned short y; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; if (x < 0 || x > USHRT_MAX) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "ushort format requires 0 <= number <= " Py_STRINGIFY(USHRT_MAX)); return -1; @@ -607,15 +617,15 @@ np_ushort(char *p, PyObject *v, const formatdef *f) } static int -np_int(char *p, PyObject *v, const formatdef *f) +np_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; int y; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; #if (SIZEOF_LONG > SIZEOF_INT) if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX))) - RANGE_ERROR(x, f, 0, -1); + RANGE_ERROR(state, x, f, 0, -1); #endif y = (int)x; memcpy(p, (char *)&y, sizeof y); @@ -623,76 +633,76 @@ np_int(char *p, PyObject *v, const formatdef *f) } static int -np_uint(char *p, PyObject *v, const formatdef *f) +np_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { unsigned long x; unsigned int y; - if (get_ulong(v, &x) < 0) + if (get_ulong(state, v, &x) < 0) return -1; y = (unsigned int)x; #if (SIZEOF_LONG > SIZEOF_INT) if (x > ((unsigned long)UINT_MAX)) - RANGE_ERROR(y, f, 1, -1); + RANGE_ERROR(state, y, f, 1, -1); #endif memcpy(p, (char *)&y, sizeof y); return 0; } static int -np_long(char *p, PyObject *v, const formatdef *f) +np_long(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; } static int -np_ulong(char *p, PyObject *v, const formatdef *f) +np_ulong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { unsigned long x; - if (get_ulong(v, &x) < 0) + if (get_ulong(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; } static int -np_ssize_t(char *p, PyObject *v, const formatdef *f) +np_ssize_t(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { Py_ssize_t x; - if (get_ssize_t(v, &x) < 0) + if (get_ssize_t(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; } static int -np_size_t(char *p, PyObject *v, const formatdef *f) +np_size_t(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { size_t x; - if (get_size_t(v, &x) < 0) + if (get_size_t(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; } static int -np_longlong(char *p, PyObject *v, const formatdef *f) +np_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long long x; - if (get_longlong(v, &x) < 0) + if (get_longlong(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; } static int -np_ulonglong(char *p, PyObject *v, const formatdef *f) +np_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { unsigned long long x; - if (get_ulonglong(v, &x) < 0) + if (get_ulonglong(state, v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); return 0; @@ -700,7 +710,7 @@ np_ulonglong(char *p, PyObject *v, const formatdef *f) static int -np_bool(char *p, PyObject *v, const formatdef *f) +np_bool(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int y; _Bool x; @@ -713,21 +723,21 @@ np_bool(char *p, PyObject *v, const formatdef *f) } static int -np_halffloat(char *p, PyObject *v, const formatdef *f) +np_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { #if PY_LITTLE_ENDIAN - return pack_halffloat(p, v, 1); + return pack_halffloat(state, p, v, 1); #else - return pack_halffloat(p, v, 0); + return pack_halffloat(state, p, v, 0); #endif } static int -np_float(char *p, PyObject *v, const formatdef *f) +np_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { float x = (float)PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -736,11 +746,11 @@ np_float(char *p, PyObject *v, const formatdef *f) } static int -np_double(char *p, PyObject *v, const formatdef *f) +np_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { double x = PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -749,11 +759,11 @@ np_double(char *p, PyObject *v, const formatdef *f) } static int -np_void_p(char *p, PyObject *v, const formatdef *f) +np_void_p(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { void *x; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; assert(PyLong_Check(v)); @@ -793,7 +803,7 @@ static const formatdef native_table[] = { /* Big-endian routines. *****************************************************/ static PyObject * -bu_int(const char *p, const formatdef *f) +bu_int(_structmodulestate *state, const char *p, const formatdef *f) { long x = 0; Py_ssize_t i = f->size; @@ -808,7 +818,7 @@ bu_int(const char *p, const formatdef *f) } static PyObject * -bu_uint(const char *p, const formatdef *f) +bu_uint(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long x = 0; Py_ssize_t i = f->size; @@ -820,7 +830,7 @@ bu_uint(const char *p, const formatdef *f) } static PyObject * -bu_longlong(const char *p, const formatdef *f) +bu_longlong(_structmodulestate *state, const char *p, const formatdef *f) { long long x = 0; Py_ssize_t i = f->size; @@ -835,7 +845,7 @@ bu_longlong(const char *p, const formatdef *f) } static PyObject * -bu_ulonglong(const char *p, const formatdef *f) +bu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long long x = 0; Py_ssize_t i = f->size; @@ -847,44 +857,44 @@ bu_ulonglong(const char *p, const formatdef *f) } static PyObject * -bu_halffloat(const char *p, const formatdef *f) +bu_halffloat(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_halffloat(p, 0); } static PyObject * -bu_float(const char *p, const formatdef *f) +bu_float(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_float(p, 0); } static PyObject * -bu_double(const char *p, const formatdef *f) +bu_double(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_double(p, 0); } static PyObject * -bu_bool(const char *p, const formatdef *f) +bu_bool(_structmodulestate *state, const char *p, const formatdef *f) { return PyBool_FromLong(*p != 0); } static int -bp_int(char *p, PyObject *v, const formatdef *f) +bp_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; Py_ssize_t i; unsigned char *q = (unsigned char *)p; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; i = f->size; if (i != SIZEOF_LONG) { if ((i == 2) && (x < -32768 || x > 32767)) - RANGE_ERROR(x, f, 0, 0xffffL); + RANGE_ERROR(state, x, f, 0, 0xffffL); #if (SIZEOF_LONG != 4) else if ((i == 4) && (x < -2147483648L || x > 2147483647L)) - RANGE_ERROR(x, f, 0, 0xffffffffL); + RANGE_ERROR(state, x, f, 0, 0xffffffffL); #endif } do { @@ -895,19 +905,19 @@ bp_int(char *p, PyObject *v, const formatdef *f) } static int -bp_uint(char *p, PyObject *v, const formatdef *f) +bp_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { unsigned long x; Py_ssize_t i; unsigned char *q = (unsigned char *)p; - if (get_ulong(v, &x) < 0) + if (get_ulong(state, v, &x) < 0) return -1; i = f->size; if (i != SIZEOF_LONG) { unsigned long maxint = 1; maxint <<= (unsigned long)(i * 8); if (x >= maxint) - RANGE_ERROR(x, f, 1, maxint - 1); + RANGE_ERROR(state, x, f, 1, maxint - 1); } do { q[--i] = (unsigned char)(x & 0xffUL); @@ -917,10 +927,10 @@ bp_uint(char *p, PyObject *v, const formatdef *f) } static int -bp_longlong(char *p, PyObject *v, const formatdef *f) +bp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int res; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; res = _PyLong_AsByteArray((PyLongObject *)v, @@ -933,10 +943,10 @@ bp_longlong(char *p, PyObject *v, const formatdef *f) } static int -bp_ulonglong(char *p, PyObject *v, const formatdef *f) +bp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int res; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; res = _PyLong_AsByteArray((PyLongObject *)v, @@ -949,17 +959,17 @@ bp_ulonglong(char *p, PyObject *v, const formatdef *f) } static int -bp_halffloat(char *p, PyObject *v, const formatdef *f) +bp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { - return pack_halffloat(p, v, 0); + return pack_halffloat(state, p, v, 0); } static int -bp_float(char *p, PyObject *v, const formatdef *f) +bp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { double x = PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -967,11 +977,11 @@ bp_float(char *p, PyObject *v, const formatdef *f) } static int -bp_double(char *p, PyObject *v, const formatdef *f) +bp_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { double x = PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -979,7 +989,7 @@ bp_double(char *p, PyObject *v, const formatdef *f) } static int -bp_bool(char *p, PyObject *v, const formatdef *f) +bp_bool(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int y; y = PyObject_IsTrue(v); @@ -1014,7 +1024,7 @@ static formatdef bigendian_table[] = { /* Little-endian routines. *****************************************************/ static PyObject * -lu_int(const char *p, const formatdef *f) +lu_int(_structmodulestate *state, const char *p, const formatdef *f) { long x = 0; Py_ssize_t i = f->size; @@ -1029,7 +1039,7 @@ lu_int(const char *p, const formatdef *f) } static PyObject * -lu_uint(const char *p, const formatdef *f) +lu_uint(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long x = 0; Py_ssize_t i = f->size; @@ -1041,7 +1051,7 @@ lu_uint(const char *p, const formatdef *f) } static PyObject * -lu_longlong(const char *p, const formatdef *f) +lu_longlong(_structmodulestate *state, const char *p, const formatdef *f) { long long x = 0; Py_ssize_t i = f->size; @@ -1056,7 +1066,7 @@ lu_longlong(const char *p, const formatdef *f) } static PyObject * -lu_ulonglong(const char *p, const formatdef *f) +lu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f) { unsigned long long x = 0; Py_ssize_t i = f->size; @@ -1068,38 +1078,38 @@ lu_ulonglong(const char *p, const formatdef *f) } static PyObject * -lu_halffloat(const char *p, const formatdef *f) +lu_halffloat(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_halffloat(p, 1); } static PyObject * -lu_float(const char *p, const formatdef *f) +lu_float(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_float(p, 1); } static PyObject * -lu_double(const char *p, const formatdef *f) +lu_double(_structmodulestate *state, const char *p, const formatdef *f) { return unpack_double(p, 1); } static int -lp_int(char *p, PyObject *v, const formatdef *f) +lp_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { long x; Py_ssize_t i; unsigned char *q = (unsigned char *)p; - if (get_long(v, &x) < 0) + if (get_long(state, v, &x) < 0) return -1; i = f->size; if (i != SIZEOF_LONG) { if ((i == 2) && (x < -32768 || x > 32767)) - RANGE_ERROR(x, f, 0, 0xffffL); + RANGE_ERROR(state, x, f, 0, 0xffffL); #if (SIZEOF_LONG != 4) else if ((i == 4) && (x < -2147483648L || x > 2147483647L)) - RANGE_ERROR(x, f, 0, 0xffffffffL); + RANGE_ERROR(state, x, f, 0, 0xffffffffL); #endif } do { @@ -1110,19 +1120,19 @@ lp_int(char *p, PyObject *v, const formatdef *f) } static int -lp_uint(char *p, PyObject *v, const formatdef *f) +lp_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { unsigned long x; Py_ssize_t i; unsigned char *q = (unsigned char *)p; - if (get_ulong(v, &x) < 0) + if (get_ulong(state, v, &x) < 0) return -1; i = f->size; if (i != SIZEOF_LONG) { unsigned long maxint = 1; maxint <<= (unsigned long)(i * 8); if (x >= maxint) - RANGE_ERROR(x, f, 1, maxint - 1); + RANGE_ERROR(state, x, f, 1, maxint - 1); } do { *q++ = (unsigned char)(x & 0xffUL); @@ -1132,10 +1142,10 @@ lp_uint(char *p, PyObject *v, const formatdef *f) } static int -lp_longlong(char *p, PyObject *v, const formatdef *f) +lp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int res; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; res = _PyLong_AsByteArray((PyLongObject*)v, @@ -1148,10 +1158,10 @@ lp_longlong(char *p, PyObject *v, const formatdef *f) } static int -lp_ulonglong(char *p, PyObject *v, const formatdef *f) +lp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { int res; - v = get_pylong(v); + v = get_pylong(state, v); if (v == NULL) return -1; res = _PyLong_AsByteArray((PyLongObject*)v, @@ -1164,17 +1174,17 @@ lp_ulonglong(char *p, PyObject *v, const formatdef *f) } static int -lp_halffloat(char *p, PyObject *v, const formatdef *f) +lp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { - return pack_halffloat(p, v, 1); + return pack_halffloat(state, p, v, 1); } static int -lp_float(char *p, PyObject *v, const formatdef *f) +lp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { double x = PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -1182,11 +1192,11 @@ lp_float(char *p, PyObject *v, const formatdef *f) } static int -lp_double(char *p, PyObject *v, const formatdef *f) +lp_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f) { double x = PyFloat_AsDouble(v); if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "required argument is not a float"); return -1; } @@ -1246,14 +1256,14 @@ whichtable(const char **pfmt) /* Get the table entry for a format code */ static const formatdef * -getentry(int c, const formatdef *f) +getentry(_structmodulestate *state, int c, const formatdef *f) { for (; f->format != '\0'; f++) { if (f->format == c) { return f; } } - PyErr_SetString(_structmodulestate_global->StructError, "bad char in struct format"); + PyErr_SetString(state->StructError, "bad char in struct format"); return NULL; } @@ -1295,9 +1305,11 @@ prepare_s(PyStructObject *self) Py_ssize_t size, len, num, itemsize; size_t ncodes; + _structmodulestate *state = get_struct_state_structinst(self); + fmt = PyBytes_AS_STRING(self->s_format); if (strlen(fmt) != (size_t)PyBytes_GET_SIZE(self->s_format)) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "embedded null character"); return -1; } @@ -1323,7 +1335,7 @@ prepare_s(PyStructObject *self) num = num*10 + (c - '0'); } if (c == '\0') { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "repeat count given without format specifier"); return -1; } @@ -1331,7 +1343,7 @@ prepare_s(PyStructObject *self) else num = 1; - e = getentry(c, f); + e = getentry(state, c, f); if (e == NULL) return -1; @@ -1361,14 +1373,14 @@ prepare_s(PyStructObject *self) self->s_size = size; self->s_len = len; - codes = PyMem_MALLOC((ncodes + 1) * sizeof(formatcode)); + codes = PyMem_Malloc((ncodes + 1) * sizeof(formatcode)); if (codes == NULL) { PyErr_NoMemory(); return -1; } /* Free any s_codes value left over from a previous initialization. */ if (self->s_codes != NULL) - PyMem_FREE(self->s_codes); + PyMem_Free(self->s_codes); self->s_codes = codes; s = fmt; @@ -1384,7 +1396,7 @@ prepare_s(PyStructObject *self) else num = 1; - e = getentry(c, f); + e = getentry(state, c, f); size = align(size, c, e); if (c == 's' || c == 'p') { @@ -1413,7 +1425,7 @@ prepare_s(PyStructObject *self) return 0; overflow: - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "total struct size too long"); return -1; } @@ -1490,7 +1502,7 @@ s_dealloc(PyStructObject *s) if (s->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *)s); if (s->s_codes != NULL) { - PyMem_FREE(s->s_codes); + PyMem_Free(s->s_codes); } Py_XDECREF(s->s_format); freefunc free_func = PyType_GetSlot(Py_TYPE(s), Py_tp_free); @@ -1499,7 +1511,8 @@ s_dealloc(PyStructObject *s) } static PyObject * -s_unpack_internal(PyStructObject *soself, const char *startfrom) { +s_unpack_internal(PyStructObject *soself, const char *startfrom, + _structmodulestate *state) { formatcode *code; Py_ssize_t i = 0; PyObject *result = PyTuple_New(soself->s_len); @@ -1520,7 +1533,7 @@ s_unpack_internal(PyStructObject *soself, const char *startfrom) { n = code->size - 1; v = PyBytes_FromStringAndSize(res + 1, n); } else { - v = e->unpack(res, e); + v = e->unpack(state, res, e); } if (v == NULL) goto fail; @@ -1554,14 +1567,15 @@ static PyObject * Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer) /*[clinic end generated code: output=873a24faf02e848a input=3113f8e7038b2f6c]*/ { + _structmodulestate *state = get_struct_state_structinst(self); assert(self->s_codes != NULL); if (buffer->len != self->s_size) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "unpack requires a buffer of %zd bytes", self->s_size); return NULL; } - return s_unpack_internal(self, buffer->buf); + return s_unpack_internal(self, buffer->buf, state); } /*[clinic input] @@ -1585,11 +1599,12 @@ Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, Py_ssize_t offset) /*[clinic end generated code: output=57fac875e0977316 input=cafd4851d473c894]*/ { + _structmodulestate *state = get_struct_state_structinst(self); assert(self->s_codes != NULL); if (offset < 0) { if (offset + self->s_size > 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "not enough data to unpack %zd bytes at offset %zd", self->s_size, offset); @@ -1597,7 +1612,7 @@ Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, } if (offset + buffer->len < 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "offset %zd out of range for %zd-byte buffer", offset, buffer->len); @@ -1607,7 +1622,7 @@ Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, } if ((buffer->len - offset) < self->s_size) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "unpack_from requires a buffer of at least %zu bytes for " "unpacking %zd bytes at offset %zd " "(actual buffer size is %zd)", @@ -1617,7 +1632,7 @@ Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, buffer->len); return NULL; } - return s_unpack_internal(self, (char*)buffer->buf + offset); + return s_unpack_internal(self, (char*)buffer->buf + offset, state); } @@ -1671,6 +1686,7 @@ static PyMethodDef unpackiter_methods[] = { static PyObject * unpackiter_iternext(unpackiterobject *self) { + _structmodulestate *state = get_struct_state_iterinst(self); PyObject *result; if (self->so == NULL) return NULL; @@ -1682,7 +1698,8 @@ unpackiter_iternext(unpackiterobject *self) } assert(self->index + self->so->s_size <= self->buf.len); result = s_unpack_internal(self->so, - (char*) self->buf.buf + self->index); + (char*) self->buf.buf + self->index, + state); self->index += self->so->s_size; return result; } @@ -1729,17 +1746,18 @@ static PyObject * Struct_iter_unpack(PyStructObject *self, PyObject *buffer) /*[clinic end generated code: output=172d83d0cd15dbab input=6d65b3f3107dbc99]*/ { + _structmodulestate *state = get_struct_state_structinst(self); unpackiterobject *iter; assert(self->s_codes != NULL); if (self->s_size == 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "cannot iteratively unpack with a struct of length 0"); return NULL; } - iter = (unpackiterobject *) PyType_GenericAlloc((PyTypeObject *)_structmodulestate_global->unpackiter_type, 0); + iter = (unpackiterobject *) PyType_GenericAlloc((PyTypeObject *)state->unpackiter_type, 0); if (iter == NULL) return NULL; @@ -1748,7 +1766,7 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer) return NULL; } if (iter->buf.len % self->s_size != 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "iterative unpacking requires a buffer of " "a multiple of %zd bytes", self->s_size); @@ -1773,7 +1791,8 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer) * */ static int -s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, char* buf) +s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, + char* buf, _structmodulestate *state) { formatcode *code; /* XXX(nnorwitz): why does i need to be a local? can we use @@ -1794,7 +1813,7 @@ s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, char* const void *p; isstring = PyBytes_Check(v); if (!isstring && !PyByteArray_Check(v)) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument for 's' must be a bytes object"); return -1; } @@ -1816,7 +1835,7 @@ s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, char* const void *p; isstring = PyBytes_Check(v); if (!isstring && !PyByteArray_Check(v)) { - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "argument for 'p' must be a bytes object"); return -1; } @@ -1836,9 +1855,9 @@ s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, char* n = 255; *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); } else { - if (e->pack(res, v, e) < 0) { + if (e->pack(state, res, v, e) < 0) { if (PyLong_Check(v) && PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_SetString(_structmodulestate_global->StructError, + PyErr_SetString(state->StructError, "int too large to convert"); return -1; } @@ -1864,14 +1883,15 @@ s_pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { char *buf; PyStructObject *soself; + _structmodulestate *state = get_struct_state_structinst(self); /* Validate arguments. */ soself = (PyStructObject *)self; - assert(PyStruct_Check(self)); + assert(PyStruct_Check(self, state)); assert(soself->s_codes != NULL); if (nargs != soself->s_len) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "pack expected %zd items for packing (got %zd)", soself->s_len, nargs); return NULL; } @@ -1886,7 +1906,7 @@ s_pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs) } /* Call the guts */ - if ( s_pack_internal(soself, args, 0, buf) != 0 ) { + if ( s_pack_internal(soself, args, 0, buf, state) != 0 ) { _PyBytesWriter_Dealloc(&writer); return NULL; } @@ -1908,23 +1928,24 @@ s_pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) PyStructObject *soself; Py_buffer buffer; Py_ssize_t offset; + _structmodulestate *state = get_struct_state_structinst(self); /* Validate arguments. +1 is for the first arg as buffer. */ soself = (PyStructObject *)self; - assert(PyStruct_Check(self)); + assert(PyStruct_Check(self, state)); assert(soself->s_codes != NULL); if (nargs != (soself->s_len + 2)) { if (nargs == 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "pack_into expected buffer argument"); } else if (nargs == 1) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "pack_into expected offset argument"); } else { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "pack_into expected %zd items for packing (got %zd)", soself->s_len, (nargs - 2)); } @@ -1947,7 +1968,7 @@ s_pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) if (offset < 0) { /* Check that negative offset is low enough to fit data */ if (offset + soself->s_size > 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "no space to pack %zd bytes at offset %zd", soself->s_size, offset); @@ -1957,7 +1978,7 @@ s_pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) /* Check that negative offset is not crossing buffer boundary */ if (offset + buffer.len < 0) { - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "offset %zd out of range for %zd-byte buffer", offset, buffer.len); @@ -1973,7 +1994,7 @@ s_pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) assert(offset >= 0); assert(soself->s_size >= 0); - PyErr_Format(_structmodulestate_global->StructError, + PyErr_Format(state->StructError, "pack_into requires a buffer of at least %zu bytes for " "packing %zd bytes at offset %zd " "(actual buffer size is %zd)", @@ -1986,7 +2007,7 @@ s_pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) } /* Call the guts */ - if (s_pack_internal(soself, args, 2, (char*)buffer.buf + offset) != 0) { + if (s_pack_internal(soself, args, 2, (char*)buffer.buf + offset, state) != 0) { PyBuffer_Release(&buffer); return NULL; } @@ -2080,12 +2101,12 @@ static PyType_Spec PyStructType_spec = { /* ---- Standalone functions ---- */ #define MAXCACHE 100 -static PyObject *cache = NULL; static int -cache_struct_converter(PyObject *fmt, PyStructObject **ptr) +cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr) { PyObject * s_object; + _structmodulestate *state = get_struct_state(module); if (fmt == NULL) { Py_DECREF(*ptr); @@ -2093,13 +2114,13 @@ cache_struct_converter(PyObject *fmt, PyStructObject **ptr) return 1; } - if (cache == NULL) { - cache = PyDict_New(); - if (cache == NULL) + if (state->cache == NULL) { + state->cache = PyDict_New(); + if (state->cache == NULL) return 0; } - s_object = PyDict_GetItemWithError(cache, fmt); + s_object = PyDict_GetItemWithError(state->cache, fmt); if (s_object != NULL) { Py_INCREF(s_object); *ptr = (PyStructObject *)s_object; @@ -2109,12 +2130,12 @@ cache_struct_converter(PyObject *fmt, PyStructObject **ptr) return 0; } - s_object = PyObject_CallOneArg(_structmodulestate_global->PyStructType, fmt); + s_object = PyObject_CallOneArg(state->PyStructType, fmt); if (s_object != NULL) { - if (PyDict_GET_SIZE(cache) >= MAXCACHE) - PyDict_Clear(cache); + if (PyDict_GET_SIZE(state->cache) >= MAXCACHE) + PyDict_Clear(state->cache); /* Attempt to cache the result */ - if (PyDict_SetItem(cache, fmt, s_object) == -1) + if (PyDict_SetItem(state->cache, fmt, s_object) == -1) PyErr_Clear(); *ptr = (PyStructObject *)s_object; return Py_CLEANUP_SUPPORTED; @@ -2132,7 +2153,7 @@ static PyObject * _clearcache_impl(PyObject *module) /*[clinic end generated code: output=ce4fb8a7bf7cb523 input=463eaae04bab3211]*/ { - Py_CLEAR(cache); + Py_CLEAR(get_struct_state(module)->cache); Py_RETURN_NONE; } @@ -2160,7 +2181,7 @@ Return a bytes object containing the values v1, v2, ... packed according\n\ to the format string. See help(struct) for more on format strings."); static PyObject * -pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs) +pack(PyObject *module, PyObject *const *args, Py_ssize_t nargs) { PyObject *s_object = NULL; PyObject *format, *result; @@ -2171,7 +2192,7 @@ pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs) } format = args[0]; - if (!cache_struct_converter(format, (PyStructObject **)&s_object)) { + if (!cache_struct_converter(module, format, (PyStructObject **)&s_object)) { return NULL; } result = s_pack(s_object, args + 1, nargs - 1); @@ -2188,7 +2209,7 @@ that the offset is a required argument. See help(struct) for more\n\ on format strings."); static PyObject * -pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) +pack_into(PyObject *module, PyObject *const *args, Py_ssize_t nargs) { PyObject *s_object = NULL; PyObject *format, *result; @@ -2199,7 +2220,7 @@ pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs) } format = args[0]; - if (!cache_struct_converter(format, (PyStructObject **)&s_object)) { + if (!cache_struct_converter(module, format, (PyStructObject **)&s_object)) { return NULL; } result = s_pack_into(s_object, args + 1, nargs - 1); @@ -2322,8 +2343,9 @@ The variable struct.error is an exception raised on errors.\n"); static int _structmodule_traverse(PyObject *module, visitproc visit, void *arg) { - _structmodulestate *state = (_structmodulestate *)PyModule_GetState(module); + _structmodulestate *state = get_struct_state(module); if (state) { + Py_VISIT(state->cache); Py_VISIT(state->PyStructType); Py_VISIT(state->unpackiter_type); Py_VISIT(state->StructError); @@ -2334,8 +2356,9 @@ _structmodule_traverse(PyObject *module, visitproc visit, void *arg) static int _structmodule_clear(PyObject *module) { - _structmodulestate *state = (_structmodulestate *)PyModule_GetState(module); + _structmodulestate *state = get_struct_state(module); if (state) { + Py_CLEAR(state->cache); Py_CLEAR(state->PyStructType); Py_CLEAR(state->unpackiter_type); Py_CLEAR(state->StructError); @@ -2349,40 +2372,25 @@ _structmodule_free(void *module) _structmodule_clear((PyObject *)module); } -static struct PyModuleDef _structmodule = { - PyModuleDef_HEAD_INIT, - "_struct", - module_doc, - sizeof(_structmodulestate), - module_functions, - NULL, - _structmodule_traverse, - _structmodule_clear, - _structmodule_free, -}; - -PyMODINIT_FUNC -PyInit__struct(void) +static int +_structmodule_exec(PyObject *m) { - PyObject *m; + _structmodulestate *state = get_struct_state(m); - m = PyModule_Create(&_structmodule); - if (m == NULL) - return NULL; - - PyObject *PyStructType = PyType_FromSpec(&PyStructType_spec); - if (PyStructType == NULL) { - return NULL; + state->PyStructType = PyType_FromModuleAndSpec( + m, &PyStructType_spec, NULL); + if (state->PyStructType == NULL) { + return -1; + } + if (PyModule_AddType(m, (PyTypeObject *)state->PyStructType) < 0) { + return -1; } - Py_INCREF(PyStructType); - PyModule_AddObject(m, "Struct", PyStructType); - get_struct_state(m)->PyStructType = PyStructType; - PyObject *unpackiter_type = PyType_FromSpec(&unpackiter_type_spec); - if (unpackiter_type == NULL) { - return NULL; + state->unpackiter_type = PyType_FromModuleAndSpec( + m, &unpackiter_type_spec, NULL); + if (state->unpackiter_type == NULL) { + return -1; } - get_struct_state(m)->unpackiter_type = unpackiter_type; /* Check endian and swap in faster functions */ { @@ -2427,12 +2435,36 @@ PyInit__struct(void) } /* Add some symbolic constants to the module */ - PyObject *StructError = PyErr_NewException("struct.error", NULL, NULL); - if (StructError == NULL) - return NULL; - Py_INCREF(StructError); - PyModule_AddObject(m, "error", StructError); - get_struct_state(m)->StructError = StructError; + state->StructError = PyErr_NewException("struct.error", NULL, NULL); + if (state->StructError == NULL) { + return -1; + } + if (PyModule_AddObjectRef(m, "error", state->StructError) < 0) { + return -1; + } + + return 0; +} - return m; +static PyModuleDef_Slot _structmodule_slots[] = { + {Py_mod_exec, _structmodule_exec}, + {0, NULL} +}; + +static struct PyModuleDef _structmodule = { + PyModuleDef_HEAD_INIT, + .m_name = "_struct", + .m_doc = module_doc, + .m_size = sizeof(_structmodulestate), + .m_methods = module_functions, + .m_slots = _structmodule_slots, + .m_traverse = _structmodule_traverse, + .m_clear = _structmodule_clear, + .m_free = _structmodule_free, +}; + +PyMODINIT_FUNC +PyInit__struct(void) +{ + return PyModuleDef_Init(&_structmodule); } diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index d8321768bc9729..1b4fb09fb8fbca 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -236,7 +236,7 @@ ndarray_dealloc(NDArrayObject *self) ndbuf_pop(self); } } - PyObject_Del(self); + PyObject_Free(self); } static int @@ -2734,7 +2734,7 @@ staticarray_init(PyObject *self, PyObject *args, PyObject *kwds) static void staticarray_dealloc(StaticArrayObject *self) { - PyObject_Del(self); + PyObject_Free(self); } /* Return a buffer for a PyBUF_FULL_RO request. Flags are not checked, diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 7b6da1e4c90559..4f97927fa23229 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1988,12 +1988,12 @@ unicode_asucs4(PyObject *self, PyObject *args) buffer[str_len] = 0xffffU; if (!PyUnicode_AsUCS4(unicode, buffer, buf_len, copy_null)) { - PyMem_FREE(buffer); + PyMem_Free(buffer); return NULL; } result = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer, buf_len); - PyMem_FREE(buffer); + PyMem_Free(buffer); return result; } @@ -5612,6 +5612,59 @@ pynumber_tobase(PyObject *module, PyObject *args) static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *); + +static PyObject* +test_set_type_size(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *obj = PyList_New(0); + if (obj == NULL) { + return NULL; + } + + // Ensure that following tests don't modify the object, + // to ensure that Py_DECREF() will not crash. + assert(Py_TYPE(obj) == &PyList_Type); + assert(Py_SIZE(obj) == 0); + + // bpo-39573: Check that Py_TYPE() and Py_SIZE() can be used + // as l-values to set an object type and size. + Py_TYPE(obj) = &PyList_Type; + Py_SIZE(obj) = 0; + + Py_DECREF(obj); + Py_RETURN_NONE; +} + + +// Test Py_NewRef() and Py_XNewRef() functions +static PyObject* +test_refcount(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *obj = PyList_New(0); + if (obj == NULL) { + return NULL; + } + assert(Py_REFCNT(obj) == 1); + + // Test Py_NewRef() + PyObject *ref = Py_NewRef(obj); + assert(ref == obj); + assert(Py_REFCNT(obj) == 2); + Py_DECREF(ref); + + // Test Py_XNewRef() + PyObject *xref = Py_XNewRef(obj); + assert(xref == obj); + assert(Py_REFCNT(obj) == 2); + Py_DECREF(xref); + + assert(Py_XNewRef(NULL) == NULL); + + Py_DECREF(obj); + Py_RETURN_NONE; +} + + static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, {"raise_memoryerror", raise_memoryerror, METH_NOARGS}, @@ -5883,6 +5936,8 @@ static PyMethodDef TestMethods[] = { {"meth_fastcall_keywords", (PyCFunction)(void(*)(void))meth_fastcall_keywords, METH_FASTCALL|METH_KEYWORDS}, {"pynumber_tobase", pynumber_tobase, METH_VARARGS}, {"without_gc", without_gc, METH_O}, + {"test_set_type_size", test_set_type_size, METH_NOARGS}, + {"test_refcount", test_refcount, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; @@ -5985,7 +6040,7 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) static void test_structmembers_free(PyObject *ob) { - PyObject_FREE(ob); + PyObject_Free(ob); } static PyTypeObject test_structmembersType = { @@ -6639,7 +6694,7 @@ static void heapctype_dealloc(HeapCTypeObject *self) { PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -6829,7 +6884,7 @@ heapctypewithdict_dealloc(HeapCTypeWithDictObject* self) PyTypeObject *tp = Py_TYPE(self); Py_XDECREF(self->dict); - PyObject_DEL(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -6900,7 +6955,7 @@ heapctypewithweakref_dealloc(HeapCTypeWithWeakrefObject* self) if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); Py_XDECREF(self->weakreflist); - PyObject_DEL(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -6943,7 +6998,7 @@ static void heapctypesetattr_dealloc(HeapCTypeSetattrObject *self) { PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 56ed8a2e2d3f14..86d5f544fcf0fa 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -34,7 +34,7 @@ lock_dealloc(lockobject *self) PyThread_release_lock(self->lock_lock); PyThread_free_lock(self->lock_lock); } - PyObject_Del(self); + PyObject_Free(self); } /* Helper to acquire an interruptible lock with a timeout. If the lock acquire @@ -1056,7 +1056,7 @@ t_bootstrap(void *boot_raw) Py_DECREF(boot->func); Py_DECREF(boot->args); Py_XDECREF(boot->keyw); - PyMem_DEL(boot_raw); + PyMem_Free(boot_raw); tstate->interp->num_threads--; PyThreadState_Clear(tstate); _PyThreadState_DeleteCurrent(tstate); @@ -1107,7 +1107,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) boot->tstate = _PyThreadState_Prealloc(boot->interp); boot->runtime = runtime; if (boot->tstate == NULL) { - PyMem_DEL(boot); + PyMem_Free(boot); return PyErr_NoMemory(); } Py_INCREF(func); @@ -1121,7 +1121,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) Py_DECREF(args); Py_XDECREF(keyw); PyThreadState_Clear(boot->tstate); - PyMem_DEL(boot); + PyMem_Free(boot); return NULL; } return PyLong_FromUnsignedLong(ident); diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 793c5e71548846..46d6a6e0954f51 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -395,7 +395,8 @@ unicodeFromTclStringAndSize(const char *s, Py_ssize_t size) char *buf = NULL; PyErr_Clear(); - /* Tcl encodes null character as \xc0\x80 */ + /* Tcl encodes null character as \xc0\x80. + https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 */ if (memchr(s, '\xc0', size)) { char *q; const char *e = s + size; @@ -419,6 +420,57 @@ unicodeFromTclStringAndSize(const char *s, Py_ssize_t size) if (buf != NULL) { PyMem_Free(buf); } + if (r == NULL || PyUnicode_KIND(r) == PyUnicode_1BYTE_KIND) { + return r; + } + + /* In CESU-8 non-BMP characters are represented as a surrogate pair, + like in UTF-16, and then each surrogate code point is encoded in UTF-8. + https://en.wikipedia.org/wiki/CESU-8 */ + Py_ssize_t len = PyUnicode_GET_LENGTH(r); + Py_ssize_t i, j; + /* All encoded surrogate characters start with \xED. */ + i = PyUnicode_FindChar(r, 0xdcED, 0, len, 1); + if (i == -2) { + Py_DECREF(r); + return NULL; + } + if (i == -1) { + return r; + } + Py_UCS4 *u = PyUnicode_AsUCS4Copy(r); + Py_DECREF(r); + if (u == NULL) { + return NULL; + } + Py_UCS4 ch; + for (j = i; i < len; i++, u[j++] = ch) { + Py_UCS4 ch1, ch2, ch3, high, low; + /* Low surrogates U+D800 - U+DBFF are encoded as + \xED\xA0\x80 - \xED\xAF\xBF. */ + ch1 = ch = u[i]; + if (ch1 != 0xdcED) continue; + ch2 = u[i + 1]; + if (!(0xdcA0 <= ch2 && ch2 <= 0xdcAF)) continue; + ch3 = u[i + 2]; + if (!(0xdc80 <= ch3 && ch3 <= 0xdcBF)) continue; + high = 0xD000 | ((ch2 & 0x3F) << 6) | (ch3 & 0x3F); + assert(Py_UNICODE_IS_HIGH_SURROGATE(high)); + /* High surrogates U+DC00 - U+DFFF are encoded as + \xED\xB0\x80 - \xED\xBF\xBF. */ + ch1 = u[i + 3]; + if (ch1 != 0xdcED) continue; + ch2 = u[i + 4]; + if (!(0xdcB0 <= ch2 && ch2 <= 0xdcBF)) continue; + ch3 = u[i + 5]; + if (!(0xdc80 <= ch3 && ch3 <= 0xdcBF)) continue; + low = 0xD000 | ((ch2 & 0x3F) << 6) | (ch3 & 0x3F); + assert(Py_UNICODE_IS_HIGH_SURROGATE(high)); + ch = Py_UNICODE_JOIN_SURROGATES(high, low); + i += 5; + } + r = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, u, j); + PyMem_Free(u); return r; } @@ -852,7 +904,7 @@ PyTclObject_dealloc(PyTclObject *self) PyObject *tp = (PyObject *) Py_TYPE(self); Tcl_DecrRefCount(self->value); Py_XDECREF(self->string); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -2420,7 +2472,7 @@ PythonCmdDelete(ClientData clientData) ENTER_PYTHON Py_XDECREF(data->self); Py_XDECREF(data->func); - PyMem_DEL(data); + PyMem_Free(data); LEAVE_PYTHON } @@ -2493,7 +2545,7 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, CommandEvent *ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent)); if (ev == NULL) { PyErr_NoMemory(); - PyMem_DEL(data); + PyMem_Free(data); return NULL; } ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc; @@ -2516,7 +2568,7 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, } if (err) { PyErr_SetString(Tkinter_TclError, "can't create Tcl command"); - PyMem_DEL(data); + PyMem_Free(data); return NULL; } @@ -2614,7 +2666,7 @@ DeleteFHCD(int id) *pp = p->next; Py_XDECREF(p->func); Py_XDECREF(p->file); - PyMem_DEL(p); + PyMem_Free(p); } else pp = &p->next; @@ -2771,7 +2823,7 @@ Tktt_Dealloc(PyObject *self) Py_XDECREF(func); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } @@ -3044,7 +3096,7 @@ Tkapp_Dealloc(PyObject *self) ENTER_TCL Tcl_DeleteInterp(Tkapp_Interp(self)); LEAVE_TCL - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); DisableEventHook(); } diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 2ba2ff43aa8b8a..6583e666119590 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -133,7 +133,7 @@ array_resize(arrayobject *self, Py_ssize_t newsize) } if (newsize == 0) { - PyMem_FREE(self->ob_item); + PyMem_Free(self->ob_item); self->ob_item = NULL; Py_SET_SIZE(self, 0); self->allocated = 0; @@ -652,7 +652,7 @@ array_dealloc(arrayobject *op) if (op->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) op); if (op->ob_item != NULL) - PyMem_DEL(op->ob_item); + PyMem_Free(op->ob_item); Py_TYPE(op)->tp_free((PyObject *)op); } diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 86402768b6ee67..9208b86b0c9055 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -691,7 +691,7 @@ static struct PyMethodDef multibytecodec_methods[] = { static void multibytecodec_dealloc(MultibyteCodecObject *self) { - PyObject_Del(self); + PyObject_Free(self); } static PyTypeObject MultibyteCodec_Type = { @@ -1191,13 +1191,13 @@ _multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDeco goto errorexit; if (wdata != data) - PyMem_Del(wdata); + PyMem_Free(wdata); Py_XDECREF(buf.excobj); return res; errorexit: if (wdata != NULL && wdata != data) - PyMem_Del(wdata); + PyMem_Free(wdata); Py_XDECREF(buf.excobj); _PyUnicodeWriter_Dealloc(&buf.writer); return NULL; diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 2314114a1bc805..72d772c289ae8b 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -164,63 +164,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, "Matches zero or more characters at the beginning of the string."); #define _SRE_SRE_PATTERN_MATCH_METHODDEF \ - {"match", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_match, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__}, + {"match", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_match, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__}, static PyObject * -_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos); +_sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos); static PyObject * -_sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_match(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "match", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - string = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - pos = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - endpos = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos); + return_value = _sre_SRE_Pattern_match_impl(self, cls, string, pos, endpos); exit: return return_value; @@ -233,63 +198,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, "Matches against all of the string."); #define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF \ - {"fullmatch", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_fullmatch, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__}, + {"fullmatch", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_fullmatch, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__}, static PyObject * -_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos); +_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos); static PyObject * -_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_fullmatch(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "fullmatch", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - string = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - pos = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - endpos = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos); + return_value = _sre_SRE_Pattern_fullmatch_impl(self, cls, string, pos, endpos); exit: return return_value; @@ -304,63 +234,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, "Return None if no position in the string matches."); #define _SRE_SRE_PATTERN_SEARCH_METHODDEF \ - {"search", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_search, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__}, + {"search", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_search, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__}, static PyObject * -_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos); +_sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos); static PyObject * -_sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_search(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "search", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - string = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - pos = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - endpos = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos); + return_value = _sre_SRE_Pattern_search_impl(self, cls, string, pos, endpos); exit: return return_value; @@ -444,63 +339,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__, "For each match, the iterator returns a match object."); #define _SRE_SRE_PATTERN_FINDITER_METHODDEF \ - {"finditer", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_finditer, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__}, + {"finditer", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_finditer, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__}, static PyObject * -_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos); +_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos); static PyObject * -_sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_finditer(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "finditer", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - string = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - pos = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - endpos = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos); + return_value = _sre_SRE_Pattern_finditer_impl(self, cls, string, pos, endpos); exit: return return_value; @@ -512,63 +372,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__, "\n"); #define _SRE_SRE_PATTERN_SCANNER_METHODDEF \ - {"scanner", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_scanner, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__}, + {"scanner", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_scanner, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__}, static PyObject * -_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos); +_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls, + PyObject *string, Py_ssize_t pos, + Py_ssize_t endpos); static PyObject * -_sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_scanner(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "scanner", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - string = args[0]; - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - pos = ival; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - endpos = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos); + return_value = _sre_SRE_Pattern_scanner_impl(self, cls, string, pos, endpos); exit: return return_value; @@ -632,47 +457,27 @@ PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__, "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl."); #define _SRE_SRE_PATTERN_SUB_METHODDEF \ - {"sub", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_sub, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__}, + {"sub", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_sub, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__}, static PyObject * -_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl, - PyObject *string, Py_ssize_t count); +_sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls, + PyObject *repl, PyObject *string, Py_ssize_t count); static PyObject * -_sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_sub(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"repl", "string", "count", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "sub", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; + static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0}; PyObject *repl; PyObject *string; Py_ssize_t count = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &repl, &string, &count)) { goto exit; } - repl = args[0]; - string = args[1]; - if (!noptargs) { - goto skip_optional_pos; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - count = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count); + return_value = _sre_SRE_Pattern_sub_impl(self, cls, repl, string, count); exit: return return_value; @@ -685,47 +490,28 @@ PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__, "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl."); #define _SRE_SRE_PATTERN_SUBN_METHODDEF \ - {"subn", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_subn, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__}, + {"subn", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_subn, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__}, static PyObject * -_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl, - PyObject *string, Py_ssize_t count); +_sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls, + PyObject *repl, PyObject *string, + Py_ssize_t count); static PyObject * -_sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +_sre_SRE_Pattern_subn(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"repl", "string", "count", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "subn", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; + static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0}; PyObject *repl; PyObject *string; Py_ssize_t count = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf); - if (!args) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &repl, &string, &count)) { goto exit; } - repl = args[0]; - string = args[1]; - if (!noptargs) { - goto skip_optional_pos; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = _PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - count = ival; - } -skip_optional_pos: - return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count); + return_value = _sre_SRE_Pattern_subn_impl(self, cls, repl, string, count); exit: return return_value; @@ -1075,15 +861,26 @@ PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__, "\n"); #define _SRE_SRE_SCANNER_MATCH_METHODDEF \ - {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__}, + {"match", (PyCFunction)(void(*)(void))_sre_SRE_Scanner_match, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_match__doc__}, static PyObject * -_sre_SRE_Scanner_match_impl(ScannerObject *self); +_sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls); static PyObject * -_sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored)) +_sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { - return _sre_SRE_Scanner_match_impl(self); + PyObject *return_value = NULL; + static const char * const _keywords[] = { NULL}; + static _PyArg_Parser _parser = {":match", _keywords, 0}; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser + )) { + goto exit; + } + return_value = _sre_SRE_Scanner_match_impl(self, cls); + +exit: + return return_value; } PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__, @@ -1092,14 +889,25 @@ PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__, "\n"); #define _SRE_SRE_SCANNER_SEARCH_METHODDEF \ - {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__}, + {"search", (PyCFunction)(void(*)(void))_sre_SRE_Scanner_search, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_search__doc__}, static PyObject * -_sre_SRE_Scanner_search_impl(ScannerObject *self); +_sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls); static PyObject * -_sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) +_sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { - return _sre_SRE_Scanner_search_impl(self); + PyObject *return_value = NULL; + static const char * const _keywords[] = { NULL}; + static _PyArg_Parser _parser = {":search", _keywords, 0}; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser + )) { + goto exit; + } + return_value = _sre_SRE_Scanner_search_impl(self, cls); + +exit: + return return_value; } -/*[clinic end generated code: output=0e27915b1eb7c0e4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=518f7bb775c1184f input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 2375f83b325c7f..43469d3c358242 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -399,7 +399,7 @@ _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs) PyObject *return_value = NULL; int proto_version; - if ((type == &PySSLContext_Type) && + if ((type == PySSLContext_Type) && !_PyArg_NoKeywords("_SSLContext", kwargs)) { goto exit; } @@ -754,13 +754,13 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t if (!args) { goto exit; } - if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) { - _PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (&PySSLMemoryBIO_Type)->tp_name, args[0]); + if (!PyObject_TypeCheck(args[0], PySSLMemoryBIO_Type)) { + _PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (PySSLMemoryBIO_Type)->tp_name, args[0]); goto exit; } incoming = (PySSLMemoryBIO *)args[0]; - if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) { - _PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (&PySSLMemoryBIO_Type)->tp_name, args[1]); + if (!PyObject_TypeCheck(args[1], PySSLMemoryBIO_Type)) { + _PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (PySSLMemoryBIO_Type)->tp_name, args[1]); goto exit; } outgoing = (PySSLMemoryBIO *)args[1]; @@ -919,11 +919,11 @@ _ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - if ((type == &PySSLMemoryBIO_Type) && + if ((type == PySSLMemoryBIO_Type) && !_PyArg_NoPositional("MemoryBIO", args)) { goto exit; } - if ((type == &PySSLMemoryBIO_Type) && + if ((type == PySSLMemoryBIO_Type) && !_PyArg_NoKeywords("MemoryBIO", kwargs)) { goto exit; } @@ -1447,4 +1447,4 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=d4e4f9cdd08819f4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2bb53a80040c9b35 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h index 1cfaef3b7131e9..b0c1eb4587ae23 100644 --- a/Modules/clinic/_struct.c.h +++ b/Modules/clinic/_struct.c.h @@ -199,7 +199,7 @@ calcsize(PyObject *module, PyObject *arg) PyStructObject *s_object = NULL; Py_ssize_t _return_value; - if (!cache_struct_converter(arg, &s_object)) { + if (!cache_struct_converter(module, arg, &s_object)) { goto exit; } _return_value = calcsize_impl(module, s_object); @@ -241,7 +241,7 @@ unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs) if (!_PyArg_CheckPositional("unpack", nargs, 2, 2)) { goto exit; } - if (!cache_struct_converter(args[0], &s_object)) { + if (!cache_struct_converter(module, args[0], &s_object)) { goto exit; } if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) { @@ -297,7 +297,7 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject if (!args) { goto exit; } - if (!cache_struct_converter(args[0], &s_object)) { + if (!cache_struct_converter(module, args[0], &s_object)) { goto exit; } if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) { @@ -364,7 +364,7 @@ iter_unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs) if (!_PyArg_CheckPositional("iter_unpack", nargs, 2, 2)) { goto exit; } - if (!cache_struct_converter(args[0], &s_object)) { + if (!cache_struct_converter(module, args[0], &s_object)) { goto exit; } buffer = args[1]; @@ -376,4 +376,4 @@ iter_unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs) return return_value; } -/*[clinic end generated code: output=8089792d8ed0c1be input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a3d3cd900091cb1c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h index c1192bbcb0d797..82729eeb56bce9 100644 --- a/Modules/clinic/itertoolsmodule.c.h +++ b/Modules/clinic/itertoolsmodule.c.h @@ -2,6 +2,37 @@ preserve [clinic start generated code]*/ +PyDoc_STRVAR(pairwise_new__doc__, +"pairwise(iterable, /)\n" +"--\n" +"\n" +"Return an iterator of overlapping pairs taken from the input iterator.\n" +"\n" +" s -> (s0,s1), (s1,s2), (s2, s3), ..."); + +static PyObject * +pairwise_new_impl(PyTypeObject *type, PyObject *iterable); + +static PyObject * +pairwise_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + PyObject *iterable; + + if ((type == &pairwise_type) && + !_PyArg_NoKeywords("pairwise", kwargs)) { + goto exit; + } + if (!_PyArg_CheckPositional("pairwise", PyTuple_GET_SIZE(args), 1, 1)) { + goto exit; + } + iterable = PyTuple_GET_ITEM(args, 0); + return_value = pairwise_new_impl(type, iterable); + +exit: + return return_value; +} + PyDoc_STRVAR(itertools_groupby__doc__, "groupby(iterable, key=None)\n" "--\n" @@ -627,4 +658,4 @@ itertools_count(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=d7f58dc477814b45 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=889c4afc3b13574f input=a9049054013a1b77]*/ diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index df680d5738c8e8..4a72ea0dd56f43 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5674,6 +5674,106 @@ os_copy_file_range(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py #endif /* defined(HAVE_COPY_FILE_RANGE) */ +#if ((defined(HAVE_SPLICE) && !defined(_AIX))) + +PyDoc_STRVAR(os_splice__doc__, +"splice($module, /, src, dst, count, offset_src=None, offset_dst=None,\n" +" flags=0)\n" +"--\n" +"\n" +"Transfer count bytes from one pipe to a descriptor or vice versa.\n" +"\n" +" src\n" +" Source file descriptor.\n" +" dst\n" +" Destination file descriptor.\n" +" count\n" +" Number of bytes to copy.\n" +" offset_src\n" +" Starting offset in src.\n" +" offset_dst\n" +" Starting offset in dst.\n" +" flags\n" +" Flags to modify the semantics of the call.\n" +"\n" +"If offset_src is None, then src is read from the current position;\n" +"respectively for offset_dst. The offset associated to the file\n" +"descriptor that refers to a pipe must be None."); + +#define OS_SPLICE_METHODDEF \ + {"splice", (PyCFunction)(void(*)(void))os_splice, METH_FASTCALL|METH_KEYWORDS, os_splice__doc__}, + +static PyObject * +os_splice_impl(PyObject *module, int src, int dst, Py_ssize_t count, + PyObject *offset_src, PyObject *offset_dst, + unsigned int flags); + +static PyObject * +os_splice(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"src", "dst", "count", "offset_src", "offset_dst", "flags", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "splice", 0}; + PyObject *argsbuf[6]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; + int src; + int dst; + Py_ssize_t count; + PyObject *offset_src = Py_None; + PyObject *offset_dst = Py_None; + unsigned int flags = 0; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 6, 0, argsbuf); + if (!args) { + goto exit; + } + src = _PyLong_AsInt(args[0]); + if (src == -1 && PyErr_Occurred()) { + goto exit; + } + dst = _PyLong_AsInt(args[1]); + if (dst == -1 && PyErr_Occurred()) { + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = _PyNumber_Index(args[2]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + count = ival; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[3]) { + offset_src = args[3]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[4]) { + offset_dst = args[4]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (!_PyLong_UnsignedInt_Converter(args[5], &flags)) { + goto exit; + } +skip_optional_pos: + return_value = os_splice_impl(module, src, dst, count, offset_src, offset_dst, flags); + +exit: + return return_value; +} + +#endif /* ((defined(HAVE_SPLICE) && !defined(_AIX))) */ + #if defined(HAVE_MKFIFO) PyDoc_STRVAR(os_mkfifo__doc__, @@ -7620,6 +7720,134 @@ os_memfd_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj #endif /* defined(HAVE_MEMFD_CREATE) */ +#if defined(HAVE_EVENTFD) + +PyDoc_STRVAR(os_eventfd__doc__, +"eventfd($module, /, initval, flags=EFD_CLOEXEC)\n" +"--\n" +"\n" +"Creates and returns an event notification file descriptor."); + +#define OS_EVENTFD_METHODDEF \ + {"eventfd", (PyCFunction)(void(*)(void))os_eventfd, METH_FASTCALL|METH_KEYWORDS, os_eventfd__doc__}, + +static PyObject * +os_eventfd_impl(PyObject *module, unsigned int initval, int flags); + +static PyObject * +os_eventfd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"initval", "flags", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "eventfd", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + unsigned int initval; + int flags = EFD_CLOEXEC; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { + goto exit; + } + if (!_PyLong_UnsignedInt_Converter(args[0], &initval)) { + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + flags = _PyLong_AsInt(args[1]); + if (flags == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: + return_value = os_eventfd_impl(module, initval, flags); + +exit: + return return_value; +} + +#endif /* defined(HAVE_EVENTFD) */ + +#if defined(HAVE_EVENTFD) + +PyDoc_STRVAR(os_eventfd_read__doc__, +"eventfd_read($module, /, fd)\n" +"--\n" +"\n" +"Read eventfd value"); + +#define OS_EVENTFD_READ_METHODDEF \ + {"eventfd_read", (PyCFunction)(void(*)(void))os_eventfd_read, METH_FASTCALL|METH_KEYWORDS, os_eventfd_read__doc__}, + +static PyObject * +os_eventfd_read_impl(PyObject *module, int fd); + +static PyObject * +os_eventfd_read(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "eventfd_read", 0}; + PyObject *argsbuf[1]; + int fd; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { + goto exit; + } + if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { + goto exit; + } + return_value = os_eventfd_read_impl(module, fd); + +exit: + return return_value; +} + +#endif /* defined(HAVE_EVENTFD) */ + +#if defined(HAVE_EVENTFD) + +PyDoc_STRVAR(os_eventfd_write__doc__, +"eventfd_write($module, /, fd, value)\n" +"--\n" +"\n" +"Write eventfd value."); + +#define OS_EVENTFD_WRITE_METHODDEF \ + {"eventfd_write", (PyCFunction)(void(*)(void))os_eventfd_write, METH_FASTCALL|METH_KEYWORDS, os_eventfd_write__doc__}, + +static PyObject * +os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value); + +static PyObject * +os_eventfd_write(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"fd", "value", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "eventfd_write", 0}; + PyObject *argsbuf[2]; + int fd; + unsigned long long value; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); + if (!args) { + goto exit; + } + if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { + goto exit; + } + if (!_PyLong_UnsignedLongLong_Converter(args[1], &value)) { + goto exit; + } + return_value = os_eventfd_write_impl(module, fd, value); + +exit: + return return_value; +} + +#endif /* defined(HAVE_EVENTFD) */ + #if (defined(TERMSIZE_USE_CONIO) || defined(TERMSIZE_USE_IOCTL)) PyDoc_STRVAR(os_get_terminal_size__doc__, @@ -8736,6 +8964,10 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #define OS_COPY_FILE_RANGE_METHODDEF #endif /* !defined(OS_COPY_FILE_RANGE_METHODDEF) */ +#ifndef OS_SPLICE_METHODDEF + #define OS_SPLICE_METHODDEF +#endif /* !defined(OS_SPLICE_METHODDEF) */ + #ifndef OS_MKFIFO_METHODDEF #define OS_MKFIFO_METHODDEF #endif /* !defined(OS_MKFIFO_METHODDEF) */ @@ -8884,6 +9116,18 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #define OS_MEMFD_CREATE_METHODDEF #endif /* !defined(OS_MEMFD_CREATE_METHODDEF) */ +#ifndef OS_EVENTFD_METHODDEF + #define OS_EVENTFD_METHODDEF +#endif /* !defined(OS_EVENTFD_METHODDEF) */ + +#ifndef OS_EVENTFD_READ_METHODDEF + #define OS_EVENTFD_READ_METHODDEF +#endif /* !defined(OS_EVENTFD_READ_METHODDEF) */ + +#ifndef OS_EVENTFD_WRITE_METHODDEF + #define OS_EVENTFD_WRITE_METHODDEF +#endif /* !defined(OS_EVENTFD_WRITE_METHODDEF) */ + #ifndef OS_GET_TERMINAL_SIZE_METHODDEF #define OS_GET_TERMINAL_SIZE_METHODDEF #endif /* !defined(OS_GET_TERMINAL_SIZE_METHODDEF) */ @@ -8919,4 +9163,4 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ -/*[clinic end generated code: output=936f33448cd66ccb input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f3ec08afcd6cd8f8 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h index 00a78c48477b41..d7095dfb00ead9 100644 --- a/Modules/clinic/selectmodule.c.h +++ b/Modules/clinic/selectmodule.c.h @@ -933,11 +933,11 @@ select_kqueue(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - if ((type == _selectstate_global->kqueue_queue_Type) && + if ((type == _selectstate_by_type(type)->kqueue_queue_Type) && !_PyArg_NoPositional("kqueue", args)) { goto exit; } - if ((type == _selectstate_global->kqueue_queue_Type) && + if ((type == _selectstate_by_type(type)->kqueue_queue_Type) && !_PyArg_NoKeywords("kqueue", kwargs)) { goto exit; } @@ -1179,4 +1179,4 @@ select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize #ifndef SELECT_KQUEUE_CONTROL_METHODDEF #define SELECT_KQUEUE_CONTROL_METHODDEF #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */ -/*[clinic end generated code: output=162f4f4efa850416 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=cd2062a787e13b35 input=a9049054013a1b77]*/ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index e6ad0f2dd42227..fdbba6a7afc29d 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -165,12 +165,17 @@ PyStatus _PyGC_Init(PyThreadState *tstate) { GCState *gcstate = &tstate->interp->gc; + + gcstate->garbage = PyList_New(0); if (gcstate->garbage == NULL) { - gcstate->garbage = PyList_New(0); - if (gcstate->garbage == NULL) { - return _PyStatus_NO_MEMORY(); - } + return _PyStatus_NO_MEMORY(); + } + + gcstate->callbacks = PyList_New(0); + if (gcstate->callbacks == NULL) { + return _PyStatus_NO_MEMORY(); } + return _PyStatus_OK(); } @@ -1992,59 +1997,50 @@ static PyMethodDef GcMethods[] = { {NULL, NULL} /* Sentinel */ }; -static struct PyModuleDef gcmodule = { - PyModuleDef_HEAD_INIT, - "gc", /* m_name */ - gc__doc__, /* m_doc */ - -1, /* m_size */ - GcMethods, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; - -PyMODINIT_FUNC -PyInit_gc(void) +static int +gcmodule_exec(PyObject *module) { GCState *gcstate = get_gc_state(); - PyObject *m = PyModule_Create(&gcmodule); - - if (m == NULL) { - return NULL; - } - - if (gcstate->garbage == NULL) { - gcstate->garbage = PyList_New(0); - if (gcstate->garbage == NULL) { - return NULL; - } - } - Py_INCREF(gcstate->garbage); - if (PyModule_AddObject(m, "garbage", gcstate->garbage) < 0) { - return NULL; - } - - if (gcstate->callbacks == NULL) { - gcstate->callbacks = PyList_New(0); - if (gcstate->callbacks == NULL) { - return NULL; - } + /* garbage and callbacks are initialized by _PyGC_Init() early in + * interpreter lifecycle. */ + assert(gcstate->garbage != NULL); + if (PyModule_AddObjectRef(module, "garbage", gcstate->garbage) < 0) { + return -1; } - Py_INCREF(gcstate->callbacks); - if (PyModule_AddObject(m, "callbacks", gcstate->callbacks) < 0) { - return NULL; + assert(gcstate->callbacks != NULL); + if (PyModule_AddObjectRef(module, "callbacks", gcstate->callbacks) < 0) { + return -1; } -#define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) { return NULL; } +#define ADD_INT(NAME) if (PyModule_AddIntConstant(module, #NAME, NAME) < 0) { return -1; } ADD_INT(DEBUG_STATS); ADD_INT(DEBUG_COLLECTABLE); ADD_INT(DEBUG_UNCOLLECTABLE); ADD_INT(DEBUG_SAVEALL); ADD_INT(DEBUG_LEAK); #undef ADD_INT - return m; + return 0; +} + +static PyModuleDef_Slot gcmodule_slots[] = { + {Py_mod_exec, gcmodule_exec}, + {0, NULL} +}; + +static struct PyModuleDef gcmodule = { + PyModuleDef_HEAD_INIT, + .m_name = "gc", + .m_doc = gc__doc__, + .m_size = 0, // per interpreter state, see: get_gc_state() + .m_methods = GcMethods, + .m_slots = gcmodule_slots +}; + +PyMODINIT_FUNC +PyInit_gc(void) +{ + return PyModuleDef_Init(&gcmodule); } /* Public API to invoke gc.collect() from C */ @@ -2294,7 +2290,7 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) } PyGC_Head *g = AS_GC(op); - g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize); + g = (PyGC_Head *)PyObject_Realloc(g, sizeof(PyGC_Head) + basicsize); if (g == NULL) return (PyVarObject *)PyErr_NoMemory(); op = (PyVarObject *) FROM_GC(g); @@ -2313,7 +2309,7 @@ PyObject_GC_Del(void *op) if (gcstate->generations[0].count > 0) { gcstate->generations[0].count--; } - PyObject_FREE(g); + PyObject_Free(g); } int diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index c4d16819e487aa..f6298ca0ee84c1 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -46,20 +46,19 @@ get_grp_state(PyObject *module) return (grpmodulestate *)state; } -#define modulestate_global get_grp_state(PyState_FindModule(&grpmodule)) - static struct PyModuleDef grpmodule; #define DEFAULT_BUFFER_SIZE 1024 static PyObject * -mkgrent(struct group *p) +mkgrent(PyObject *module, struct group *p) { int setIndex = 0; PyObject *v, *w; char **member; - if ((v = PyStructSequence_New(modulestate_global->StructGrpType)) == NULL) + v = PyStructSequence_New(get_grp_state(module)->StructGrpType); + if (v == NULL) return NULL; if ((w = PyList_New(0)) == NULL) { @@ -170,7 +169,7 @@ grp_getgrgid_impl(PyObject *module, PyObject *id) Py_DECREF(gid_obj); return NULL; } - retval = mkgrent(p); + retval = mkgrent(module, p); #ifdef HAVE_GETGRGID_R PyMem_RawFree(buf); #endif @@ -248,7 +247,7 @@ grp_getgrnam_impl(PyObject *module, PyObject *name) } goto out; } - retval = mkgrent(p); + retval = mkgrent(module, p); out: PyMem_RawFree(buf); Py_DECREF(bytes); @@ -275,7 +274,7 @@ grp_getgrall_impl(PyObject *module) return NULL; setgrent(); while ((p = getgrent()) != NULL) { - PyObject *v = mkgrent(p); + PyObject *v = mkgrent(module, p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); @@ -311,6 +310,26 @@ users are not explicitly listed as members of the groups they are in\n\ according to the password database. Check both databases to get\n\ complete membership information.)"); +static int +grpmodule_exec(PyObject *module) +{ + grpmodulestate *state = get_grp_state(module); + + state->StructGrpType = PyStructSequence_NewType(&struct_group_type_desc); + if (state->StructGrpType == NULL) { + return -1; + } + if (PyModule_AddType(module, state->StructGrpType) < 0) { + return -1; + } + return 0; +} + +static PyModuleDef_Slot grpmodule_slots[] = { + {Py_mod_exec, grpmodule_exec}, + {0, NULL} +}; + static int grpmodule_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(get_grp_state(m)->StructGrpType); return 0; @@ -326,37 +345,19 @@ static void grpmodule_free(void *m) { } static struct PyModuleDef grpmodule = { - PyModuleDef_HEAD_INIT, - "grp", - grp__doc__, - sizeof(grpmodulestate), - grp_methods, - NULL, - grpmodule_traverse, - grpmodule_clear, - grpmodule_free, + PyModuleDef_HEAD_INIT, + .m_name = "grp", + .m_doc = grp__doc__, + .m_size = sizeof(grpmodulestate), + .m_methods = grp_methods, + .m_slots = grpmodule_slots, + .m_traverse = grpmodule_traverse, + .m_clear = grpmodule_clear, + .m_free = grpmodule_free, }; PyMODINIT_FUNC PyInit_grp(void) { - PyObject *m; - if ((m = PyState_FindModule(&grpmodule)) != NULL) { - Py_INCREF(m); - return m; - } - - if ((m = PyModule_Create(&grpmodule)) == NULL) { - return NULL; - } - - grpmodulestate *state = PyModule_GetState(m); - state->StructGrpType = PyStructSequence_NewType(&struct_group_type_desc); - if (state->StructGrpType == NULL) { - return NULL; - } - - Py_INCREF(state->StructGrpType); - PyModule_AddObject(m, "struct_group", (PyObject *) state->StructGrpType); - return m; + return PyModuleDef_Init(&grpmodule); } diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index ce8b4347ef220b..293735a886428b 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -1,7 +1,9 @@ + #define PY_SSIZE_T_CLEAN #include "Python.h" #include "pycore_long.h" // _PyLong_GetZero() +#include "pycore_object.h" // _PyObject_GC_TRACK() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include // offsetof() @@ -27,8 +29,9 @@ class itertools.accumulate "accumulateobject *" "&accumulate_type" class itertools.compress "compressobject *" "&compress_type" class itertools.filterfalse "filterfalseobject *" "&filterfalse_type" class itertools.count "countobject *" "&count_type" +class itertools.pairwise "pairwiseobject *" "&pairwise_type" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ea05c93c6d94726a]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6498ed21fbe1bf94]*/ static PyTypeObject groupby_type; static PyTypeObject _grouper_type; @@ -45,9 +48,140 @@ static PyTypeObject accumulate_type; static PyTypeObject compress_type; static PyTypeObject filterfalse_type; static PyTypeObject count_type; +static PyTypeObject pairwise_type; #include "clinic/itertoolsmodule.c.h" +/* pairwise object ***********************************************************/ + +typedef struct { + PyObject_HEAD + PyObject *it; + PyObject *old; +} pairwiseobject; + +/*[clinic input] +@classmethod +itertools.pairwise.__new__ as pairwise_new + iterable: object + / +Return an iterator of overlapping pairs taken from the input iterator. + + s -> (s0,s1), (s1,s2), (s2, s3), ... + +[clinic start generated code]*/ + +static PyObject * +pairwise_new_impl(PyTypeObject *type, PyObject *iterable) +/*[clinic end generated code: output=9f0267062d384456 input=6e7c3cddb431a8d6]*/ +{ + PyObject *it; + pairwiseobject *po; + + it = PyObject_GetIter(iterable); + if (it == NULL) { + return NULL; + } + po = (pairwiseobject *)type->tp_alloc(type, 0); + if (po == NULL) { + Py_DECREF(it); + return NULL; + } + po->it = it; + po->old = NULL; + return (PyObject *)po; +} + +static void +pairwise_dealloc(pairwiseobject *po) +{ + PyObject_GC_UnTrack(po); + Py_XDECREF(po->it); + Py_XDECREF(po->old); + Py_TYPE(po)->tp_free(po); +} + +static int +pairwise_traverse(pairwiseobject *po, visitproc visit, void *arg) +{ + Py_VISIT(po->it); + Py_VISIT(po->old); + return 0; +} + +static PyObject * +pairwise_next(pairwiseobject *po) +{ + PyObject *it = po->it; + PyObject *old = po->old; + PyObject *new, *result; + + if (it == NULL) { + return NULL; + } + if (old == NULL) { + po->old = old = (*Py_TYPE(it)->tp_iternext)(it); + if (old == NULL) { + Py_CLEAR(po->it); + return NULL; + } + } + new = (*Py_TYPE(it)->tp_iternext)(it); + if (new == NULL) { + Py_CLEAR(po->it); + Py_CLEAR(po->old); + return NULL; + } + /* Future optimization: Reuse the result tuple as we do in enumerate() */ + result = PyTuple_Pack(2, old, new); + Py_SETREF(po->old, new); + return result; +} + +static PyTypeObject pairwise_type = { + PyVarObject_HEAD_INIT(&PyType_Type, 0) + "itertools.pairwise", /* tp_name */ + sizeof(pairwiseobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)pairwise_dealloc, /* tp_dealloc */ + 0, /* tp_vectorcall_offset */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_as_async */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASETYPE, /* tp_flags */ + pairwise_new__doc__, /* tp_doc */ + (traverseproc)pairwise_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)pairwise_next, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + PyType_GenericAlloc, /* tp_alloc */ + pairwise_new, /* tp_new */ + PyObject_GC_Del, /* tp_free */ +}; + /* groupby object ************************************************************/ @@ -2245,6 +2379,11 @@ product_next(productobject *lz) lz->result = result; Py_DECREF(old_result); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + else if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } /* Now, we've got the only copy so we can update it in-place */ assert (npools==0 || Py_REFCNT(result) == 1); @@ -2568,6 +2707,11 @@ combinations_next(combinationsobject *co) co->result = result; Py_DECREF(old_result); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + else if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } /* Now, we've got the only copy so we can update it in-place * CPython's empty tuple is a singleton and cached in * PyTuple's freelist. @@ -2902,6 +3046,11 @@ cwr_next(cwrobject *co) co->result = result; Py_DECREF(old_result); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + else if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } /* Now, we've got the only copy so we can update it in-place CPython's empty tuple is a singleton and cached in PyTuple's freelist. */ assert(r == 0 || Py_REFCNT(result) == 1); @@ -3246,6 +3395,11 @@ permutations_next(permutationsobject *po) po->result = result; Py_DECREF(old_result); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + else if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } /* Now, we've got the only copy so we can update it in-place */ assert(r == 0 || Py_REFCNT(result) == 1); @@ -4516,6 +4670,11 @@ zip_longest_next(ziplongestobject *lz) PyTuple_SET_ITEM(result, i, item); Py_DECREF(olditem); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } } else { result = PyTuple_New(tuplesize); if (result == NULL) @@ -4666,6 +4825,7 @@ groupby(iterable[, keyfunc]) --> sub-iterators grouped by value of keyfunc(v)\n\ filterfalse(pred, seq) --> elements of seq where pred(elem) is False\n\ islice(seq, [start,] stop [, step]) --> elements from\n\ seq[start:stop:step]\n\ +pairwise(s) --> (s[0],s[1]), (s[1],s[2]), (s[2], s[3]), ...\n\ starmap(fun, seq) --> fun(*seq[0]), fun(*seq[1]), ...\n\ tee(it, n=2) --> (it1, it2 , ... itn) splits one iterator into n\n\ takewhile(pred, seq) --> seq[0], seq[1], until pred fails\n\ @@ -4695,6 +4855,7 @@ itertoolsmodule_exec(PyObject *m) &filterfalse_type, &count_type, &ziplongest_type, + &pairwise_type, &permutations_type, &product_type, &repeat_type, diff --git a/Modules/main.c b/Modules/main.c index 2cc891f61aadd1..3aa4d91c9a3cdc 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -380,64 +380,51 @@ static int pymain_run_startup(PyConfig *config, PyCompilerFlags *cf, int *exitcode) { int ret; - PyObject *startup_obj = NULL; if (!config->use_environment) { return 0; } + PyObject *startup = NULL; #ifdef MS_WINDOWS - const wchar_t *wstartup = _wgetenv(L"PYTHONSTARTUP"); - if (wstartup == NULL || wstartup[0] == L'\0') { + const wchar_t *env = _wgetenv(L"PYTHONSTARTUP"); + if (env == NULL || env[0] == L'\0') { return 0; } - PyObject *startup_bytes = NULL; - startup_obj = PyUnicode_FromWideChar(wstartup, wcslen(wstartup)); - if (startup_obj == NULL) { - goto error; - } - startup_bytes = PyUnicode_EncodeFSDefault(startup_obj); - if (startup_bytes == NULL) { + startup = PyUnicode_FromWideChar(env, wcslen(env)); + if (startup == NULL) { goto error; } - const char *startup = PyBytes_AS_STRING(startup_bytes); #else - const char *startup = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP"); - if (startup == NULL) { + const char *env = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP"); + if (env == NULL) { return 0; } - startup_obj = PyUnicode_DecodeFSDefault(startup); - if (startup_obj == NULL) { + startup = PyUnicode_DecodeFSDefault(env); + if (startup == NULL) { goto error; } #endif - if (PySys_Audit("cpython.run_startup", "O", startup_obj) < 0) { + if (PySys_Audit("cpython.run_startup", "O", startup) < 0) { goto error; } -#ifdef MS_WINDOWS - FILE *fp = _Py_wfopen(wstartup, L"r"); -#else - FILE *fp = _Py_fopen(startup, "r"); -#endif + FILE *fp = _Py_fopen_obj(startup, "r"); if (fp == NULL) { int save_errno = errno; PyErr_Clear(); PySys_WriteStderr("Could not open PYTHONSTARTUP\n"); errno = save_errno; - PyErr_SetFromErrnoWithFilenameObjects(PyExc_OSError, startup_obj, NULL); + PyErr_SetFromErrnoWithFilenameObjects(PyExc_OSError, startup, NULL); goto error; } - (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf); + (void) _PyRun_SimpleFileObject(fp, startup, 0, cf); PyErr_Clear(); fclose(fp); ret = 0; done: -#ifdef MS_WINDOWS - Py_XDECREF(startup_bytes); -#endif - Py_XDECREF(startup_obj); + Py_XDECREF(startup); return ret; error: diff --git a/Modules/makexp_aix b/Modules/makexp_aix index cb349c28757396..b39d93b682ca1c 100755 --- a/Modules/makexp_aix +++ b/Modules/makexp_aix @@ -3,7 +3,7 @@ # =========================================================================== # FILE: makexp_aix # TYPE: standalone executable -# SYSTEM: AIX 3.2.5 and AIX 4 +# SYSTEM: AIX # # DESCRIPTION: This script creates an export list of ALL global symbols # from a list of object or archive files. @@ -48,34 +48,24 @@ echo "*" >> $expFileName echo "* $notemsg" >> $expFileName echo "*" >> $expFileName -# Extract the symbol list using 'nm' which produces quite -# different output under AIX 4 than under AIX 3.2.5. -# The following handles both versions by using a common flagset. +# Extract the symbol list using 'nm' # Here are some hidden tricks: -# 1. Use /usr/ccs/bin/nm. Relevant to AIX 3.2.5 which has -# another version under /usr/ucb/bin/nm. -# 2. Use the -B flag to have a standard BSD representation -# of the symbol list on both AIX 3.2.5 and AIX 4. The "-B" -# flag is missing in the AIX 3.2.5 online usage help of 'nm'. -# 3. Use the -x flag to have a hex representation of the symbol -# values. This fills the leading whitespaces on AIX 4, -# thus simplifying the sed statement. -# 4. Eliminate all entries except those with either "B", "D" -# or "T" key letters. We are interested only in the global -# (extern) BSS, DATA and TEXT symbols. With the same statement -# we eliminate object member lines relevant to AIX 4. -# 5. Eliminate entries containing a dot. We can have a dot only -# as a symbol prefix, but such symbols are undefined externs. -# 6. Eliminate everything including the key letter, so that we're -# left with just the symbol name. -# 7. Eliminate all entries containing two colons, like Class::method +# - Use the -B flag to have a standard BSD representation +# of the symbol list. +# - Use the -x flag to have a hex representation of the symbol +# values. This fills the leading whitespaces, thus simplifying +# the sed statement. +# - Eliminate all entries except those with either "B", "D" +# or "T" key letters. We are interested only in the global +# (extern) BSS, DATA and TEXT symbols. With the same statement +# we eliminate object member lines relevant to AIX 4. +# - Eliminate entries containing a dot. We can have a dot only +# as a symbol prefix, but such symbols are undefined externs. +# - Eliminate everything including the key letter, so that we're +# left with just the symbol name. +# - Eliminate all entries containing two colons, like Class::method # -# Use -X32_64 if it appears to be implemented in this version of 'nm'. -NM=/usr/ccs/bin/nm -xopt=-X32_64 -$NM -e $xopt $1 >/dev/null 2>&1 || xopt="" - -$NM -Bex $xopt $inputFiles \ +/usr/ccs/bin/nm -Bex -X32_64 $inputFiles \ | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ | sort | uniq >> $expFileName diff --git a/Modules/md5module.c b/Modules/md5module.c index 9bd2bd17e4fbf1..1c401e884389f3 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -342,7 +342,7 @@ static void MD5_dealloc(PyObject *ptr) { PyTypeObject *tp = Py_TYPE(ptr); - PyObject_Del(ptr); + PyObject_Free(ptr); Py_DECREF(tp); } diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 1e9684970f5d38..1e66962d37b0e0 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1667,6 +1667,14 @@ mmap_exec(PyObject *module) #ifdef MADV_PROTECT ADD_INT_MACRO(module, MADV_PROTECT); #endif + + // Darwin-specific +#ifdef MADV_FREE_REUSABLE // (As MADV_FREE but reclaims more faithful for task_info/Activity Monitor...) + ADD_INT_MACRO(module, MADV_FREE_REUSABLE); +#endif +#ifdef MADV_FREE_REUSE // (Reuse pages previously tagged as reusable) + ADD_INT_MACRO(module, MADV_FREE_REUSE); +#endif #endif // HAVE_MADVISE return 0; } diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 2a1ac10814a698..4f2d9cb8b7c9c7 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -154,7 +154,7 @@ oss_dealloc(oss_audio_t *self) /* if already closed, don't reclose it */ if (self->fd != -1) close(self->fd); - PyObject_Del(self); + PyObject_Free(self); } @@ -199,7 +199,7 @@ oss_mixer_dealloc(oss_mixer_t *self) /* if already closed, don't reclose it */ if (self->fd != -1) close(self->fd); - PyObject_Del(self); + PyObject_Free(self); } diff --git a/Modules/overlapped.c b/Modules/overlapped.c index 3829932070a961..38dd98f084849e 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -722,7 +722,7 @@ Overlapped_dealloc(OverlappedObject *self) SetLastError(olderr); PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6b51d8a848eab2..d9eb62f20e65bd 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -518,6 +518,11 @@ extern char *ctermid_r(char *); # include #endif +/* eventfd() */ +#ifdef HAVE_SYS_EVENTFD_H +# include +#endif + #ifdef _Py_MEMORY_SANITIZER # include #endif @@ -5475,7 +5480,7 @@ free_string_array(EXECV_CHAR **array, Py_ssize_t count) Py_ssize_t i; for (i = 0; i < count; i++) PyMem_Free(array[i]); - PyMem_DEL(array); + PyMem_Free(array); } static int @@ -6505,9 +6510,10 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv, res = Py_BuildValue(_Py_PARSE_INTPTR, spawnval); fail_2: - while (--envc >= 0) - PyMem_DEL(envlist[envc]); - PyMem_DEL(envlist); + while (--envc >= 0) { + PyMem_Free(envlist[envc]); + } + PyMem_Free(envlist); fail_1: free_string_array(argvlist, lastarg); fail_0: @@ -6516,7 +6522,6 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv, #endif /* HAVE_SPAWNV */ - #ifdef HAVE_FORK /* Helper function to validate arguments. @@ -7440,7 +7445,7 @@ os_getgrouplist_impl(PyObject *module, const char *user, gid_t basegid) list = PyList_New(ngroups); if (list == NULL) { - PyMem_Del(groups); + PyMem_Free(groups); return NULL; } @@ -7452,13 +7457,13 @@ os_getgrouplist_impl(PyObject *module, const char *user, gid_t basegid) #endif if (o == NULL) { Py_DECREF(list); - PyMem_Del(groups); + PyMem_Free(groups); return NULL; } PyList_SET_ITEM(list, i, o); } - PyMem_Del(groups); + PyMem_Free(groups); return list; } @@ -9403,7 +9408,7 @@ iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, Py_ssize_t cnt, in *buf = PyMem_New(Py_buffer, cnt); if (*buf == NULL) { - PyMem_Del(*iov); + PyMem_Free(*iov); PyErr_NoMemory(); return -1; } @@ -9423,11 +9428,11 @@ iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, Py_ssize_t cnt, in return 0; fail: - PyMem_Del(*iov); + PyMem_Free(*iov); for (j = 0; j < i; j++) { PyBuffer_Release(&(*buf)[j]); } - PyMem_Del(*buf); + PyMem_Free(*buf); return -1; } @@ -9435,11 +9440,11 @@ static void iov_cleanup(struct iovec *iov, Py_buffer *buf, int cnt) { int i; - PyMem_Del(iov); + PyMem_Free(iov); for (i = 0; i < cnt; i++) { PyBuffer_Release(&buf[i]); } - PyMem_Del(buf); + PyMem_Free(buf); } #endif @@ -10365,6 +10370,75 @@ os_copy_file_range_impl(PyObject *module, int src, int dst, Py_ssize_t count, } #endif /* HAVE_COPY_FILE_RANGE*/ +#if (defined(HAVE_SPLICE) && !defined(_AIX)) +/*[clinic input] + +os.splice + src: int + Source file descriptor. + dst: int + Destination file descriptor. + count: Py_ssize_t + Number of bytes to copy. + offset_src: object = None + Starting offset in src. + offset_dst: object = None + Starting offset in dst. + flags: unsigned_int = 0 + Flags to modify the semantics of the call. + +Transfer count bytes from one pipe to a descriptor or vice versa. + +If offset_src is None, then src is read from the current position; +respectively for offset_dst. The offset associated to the file +descriptor that refers to a pipe must be None. +[clinic start generated code]*/ + +static PyObject * +os_splice_impl(PyObject *module, int src, int dst, Py_ssize_t count, + PyObject *offset_src, PyObject *offset_dst, + unsigned int flags) +/*[clinic end generated code: output=d0386f25a8519dc5 input=047527c66c6d2e0a]*/ +{ + off_t offset_src_val, offset_dst_val; + off_t *p_offset_src = NULL; + off_t *p_offset_dst = NULL; + Py_ssize_t ret; + int async_err = 0; + + if (count < 0) { + PyErr_SetString(PyExc_ValueError, "negative value for 'count' not allowed"); + return NULL; + } + + if (offset_src != Py_None) { + if (!Py_off_t_converter(offset_src, &offset_src_val)) { + return NULL; + } + p_offset_src = &offset_src_val; + } + + if (offset_dst != Py_None) { + if (!Py_off_t_converter(offset_dst, &offset_dst_val)) { + return NULL; + } + p_offset_dst = &offset_dst_val; + } + + do { + Py_BEGIN_ALLOW_THREADS + ret = splice(src, p_offset_src, dst, p_offset_dst, count, flags); + Py_END_ALLOW_THREADS + } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + + if (ret < 0) { + return (!async_err) ? posix_error() : NULL; + } + + return PyLong_FromSsize_t(ret); +} +#endif /* HAVE_SPLICE*/ + #ifdef HAVE_MKFIFO /*[clinic input] os.mkfifo @@ -12742,7 +12816,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks) path_error(path); break; } - buffer = PyMem_MALLOC(buffer_size); + buffer = PyMem_Malloc(buffer_size); if (!buffer) { PyErr_NoMemory(); break; @@ -12759,7 +12833,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks) if (length < 0) { if (errno == ERANGE) { - PyMem_FREE(buffer); + PyMem_Free(buffer); buffer = NULL; continue; } @@ -12797,7 +12871,7 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks) } exit: if (buffer) - PyMem_FREE(buffer); + PyMem_Free(buffer); return result; } #endif /* USE_XATTRS */ @@ -12859,6 +12933,79 @@ os_memfd_create_impl(PyObject *module, PyObject *name, unsigned int flags) } #endif +#ifdef HAVE_EVENTFD +/*[clinic input] +os.eventfd + + initval: unsigned_int + flags: int(c_default="EFD_CLOEXEC") = EFD_CLOEXEC + +Creates and returns an event notification file descriptor. +[clinic start generated code]*/ + +static PyObject * +os_eventfd_impl(PyObject *module, unsigned int initval, int flags) +/*[clinic end generated code: output=ce9c9bbd1446f2de input=66203e3c50c4028b]*/ + +{ + /* initval is limited to uint32_t, internal counter is uint64_t */ + int fd; + Py_BEGIN_ALLOW_THREADS + fd = eventfd(initval, flags); + Py_END_ALLOW_THREADS + if (fd == -1) { + return PyErr_SetFromErrno(PyExc_OSError); + } + return PyLong_FromLong(fd); +} + +/*[clinic input] +os.eventfd_read + + fd: fildes + +Read eventfd value +[clinic start generated code]*/ + +static PyObject * +os_eventfd_read_impl(PyObject *module, int fd) +/*[clinic end generated code: output=8f2c7b59a3521fd1 input=110f8b57fa596afe]*/ +{ + eventfd_t value; + int result; + Py_BEGIN_ALLOW_THREADS + result = eventfd_read(fd, &value); + Py_END_ALLOW_THREADS + if (result == -1) { + return PyErr_SetFromErrno(PyExc_OSError); + } + return PyLong_FromUnsignedLongLong(value); +} + +/*[clinic input] +os.eventfd_write + + fd: fildes + value: unsigned_long_long + +Write eventfd value. +[clinic start generated code]*/ + +static PyObject * +os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value) +/*[clinic end generated code: output=bebd9040bbf987f5 input=156de8555be5a949]*/ +{ + int result; + Py_BEGIN_ALLOW_THREADS + result = eventfd_write(fd, value); + Py_END_ALLOW_THREADS + if (result == -1) { + return PyErr_SetFromErrno(PyExc_OSError); + } + Py_RETURN_NONE; +} +#endif /* HAVE_EVENTFD */ + /* Terminal size querying */ PyDoc_STRVAR(TerminalSize_docstring, @@ -14355,7 +14502,7 @@ os__remove_dll_directory_impl(PyObject *module, PyObject *cookie) os.waitstatus_to_exitcode() is implemented in C and not in Python, so subprocess can safely call it during late Python finalization without - risking that used os attributes were set to None by _PyImport_Cleanup(). */ + risking that used os attributes were set to None by finalize_modules(). */ #if defined(WIFEXITED) || defined(MS_WINDOWS) /*[clinic input] os.waitstatus_to_exitcode @@ -14472,6 +14619,7 @@ static PyMethodDef posix_methods[] = { OS_POSIX_SPAWNP_METHODDEF OS_READLINK_METHODDEF OS_COPY_FILE_RANGE_METHODDEF + OS_SPLICE_METHODDEF OS_RENAME_METHODDEF OS_REPLACE_METHODDEF OS_RMDIR_METHODDEF @@ -14619,6 +14767,9 @@ static PyMethodDef posix_methods[] = { OS_FSPATH_METHODDEF OS_GETRANDOM_METHODDEF OS_MEMFD_CREATE_METHODDEF + OS_EVENTFD_METHODDEF + OS_EVENTFD_READ_METHODDEF + OS_EVENTFD_WRITE_METHODDEF OS__ADD_DLL_DIRECTORY_METHODDEF OS__REMOVE_DLL_DIRECTORY_METHODDEF OS_WAITSTATUS_TO_EXITCODE_METHODDEF @@ -14991,6 +15142,13 @@ all_ins(PyObject *m) if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1; #endif +/* constants for splice */ +#if defined(HAVE_SPLICE) && defined(__linux__) + if (PyModule_AddIntConstant(m, "SPLICE_F_MOVE", SPLICE_F_MOVE)) return -1; + if (PyModule_AddIntConstant(m, "SPLICE_F_NONBLOCK", SPLICE_F_NONBLOCK)) return -1; + if (PyModule_AddIntConstant(m, "SPLICE_F_MORE", SPLICE_F_MORE)) return -1; +#endif + /* constants for posix_spawn */ #ifdef HAVE_POSIX_SPAWN if (PyModule_AddIntConstant(m, "POSIX_SPAWN_OPEN", POSIX_SPAWN_OPEN)) return -1; @@ -15127,6 +15285,12 @@ all_ins(PyObject *m) #ifdef MFD_HUGE_16GB if (PyModule_AddIntMacro(m, MFD_HUGE_16GB)) return -1; #endif +#endif /* HAVE_MEMFD_CREATE */ + +#ifdef HAVE_EVENTFD + if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1; + if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1; + if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1; #endif #if defined(__APPLE__) @@ -15220,6 +15384,10 @@ static const struct have_function { int (*probe)(void); } have_functions[] = { +#ifdef HAVE_EVENTFD + {"HAVE_EVENTFD", NULL}, +#endif + #ifdef HAVE_FACCESSAT { "HAVE_FACCESSAT", probe_faccessat }, #endif diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 901a3ed9a2e378..14d3f9dcb1c60f 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -59,8 +59,6 @@ get_pwd_state(PyObject *module) return (pwdmodulestate *)state; } -#define modulestate_global get_pwd_state(PyState_FindModule(&pwdmodule)) - static struct PyModuleDef pwdmodule; #define DEFAULT_BUFFER_SIZE 1024 @@ -79,10 +77,10 @@ sets(PyObject *v, int i, const char* val) } static PyObject * -mkpwent(struct passwd *p) +mkpwent(PyObject *module, struct passwd *p) { int setIndex = 0; - PyObject *v = PyStructSequence_New(modulestate_global->StructPwdType); + PyObject *v = PyStructSequence_New(get_pwd_state(module)->StructPwdType); if (v == NULL) return NULL; @@ -194,7 +192,7 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj) Py_DECREF(uid_obj); return NULL; } - retval = mkpwent(p); + retval = mkpwent(module, p); #ifdef HAVE_GETPWUID_R PyMem_RawFree(buf); #endif @@ -274,7 +272,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name) } goto out; } - retval = mkpwent(p); + retval = mkpwent(module, p); out: PyMem_RawFree(buf); Py_DECREF(bytes); @@ -300,7 +298,7 @@ pwd_getpwall_impl(PyObject *module) return NULL; setpwent(); while ((p = getpwent()) != NULL) { - PyObject *v = mkpwent(p); + PyObject *v = mkpwent(module, p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); @@ -323,6 +321,26 @@ static PyMethodDef pwd_methods[] = { {NULL, NULL} /* sentinel */ }; +static int +pwdmodule_exec(PyObject *module) +{ + pwdmodulestate *state = get_pwd_state(module); + + state->StructPwdType = PyStructSequence_NewType(&struct_pwd_type_desc); + if (state->StructPwdType == NULL) { + return -1; + } + if (PyModule_AddType(module, state->StructPwdType) < 0) { + return -1; + } + return 0; +} + +static PyModuleDef_Slot pwdmodule_slots[] = { + {Py_mod_exec, pwdmodule_exec}, + {0, NULL} +}; + static int pwdmodule_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(get_pwd_state(m)->StructPwdType); return 0; @@ -337,34 +355,19 @@ static void pwdmodule_free(void *m) { static struct PyModuleDef pwdmodule = { PyModuleDef_HEAD_INIT, - "pwd", - pwd__doc__, - sizeof(pwdmodulestate), - pwd_methods, - NULL, - pwdmodule_traverse, - pwdmodule_clear, - pwdmodule_free, + .m_name = "pwd", + .m_doc = pwd__doc__, + .m_size = sizeof(pwdmodulestate), + .m_methods = pwd_methods, + .m_slots = pwdmodule_slots, + .m_traverse = pwdmodule_traverse, + .m_clear = pwdmodule_clear, + .m_free = pwdmodule_free, }; PyMODINIT_FUNC PyInit_pwd(void) { - PyObject *m; - if ((m = PyState_FindModule(&pwdmodule)) != NULL) { - Py_INCREF(m); - return m; - } - if ((m = PyModule_Create(&pwdmodule)) == NULL) - return NULL; - - pwdmodulestate *state = PyModule_GetState(m); - state->StructPwdType = PyStructSequence_NewType(&struct_pwd_type_desc); - if (state->StructPwdType == NULL) { - return NULL; - } - Py_INCREF(state->StructPwdType); - PyModule_AddObject(m, "struct_passwd", (PyObject *) state->StructPwdType); - return m; + return PyModuleDef_Init(&pwdmodule); } diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index d02e3905f57e5f..f80da5895401fe 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -77,16 +77,16 @@ get_select_state(PyObject *module) return (_selectstate *)state; } -#define _selectstate_global get_select_state(PyState_FindModule(&selectmodule)) +#define _selectstate_by_type(type) get_select_state(PyType_GetModule(type)) /*[clinic input] module select -class select.poll "pollObject *" "&poll_Type" -class select.devpoll "devpollObject *" "&devpoll_Type" -class select.epoll "pyEpoll_Object *" "&pyEpoll_Type" -class select.kqueue "kqueue_queue_Object *" "_selectstate_global->kqueue_queue_Type" +class select.poll "pollObject *" "_selectstate_by_type(type)->poll_Type" +class select.devpoll "devpollObject *" "_selectstate_by_type(type)->devpoll_Type" +class select.epoll "pyEpoll_Object *" "_selectstate_by_type(type)->pyEpoll_Type" +class select.kqueue "kqueue_queue_Object *" "_selectstate_by_type(type)->kqueue_queue_Type" [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=41071028e0ede093]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8072de35824aa327]*/ /* list of Python objects and their file descriptor */ typedef struct { @@ -294,9 +294,9 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, wfd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1); efd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1); if (rfd2obj == NULL || wfd2obj == NULL || efd2obj == NULL) { - if (rfd2obj) PyMem_DEL(rfd2obj); - if (wfd2obj) PyMem_DEL(wfd2obj); - if (efd2obj) PyMem_DEL(efd2obj); + if (rfd2obj) PyMem_Free(rfd2obj); + if (wfd2obj) PyMem_Free(wfd2obj); + if (efd2obj) PyMem_Free(efd2obj); return PyErr_NoMemory(); } #endif /* SELECT_USES_HEAP */ @@ -381,9 +381,9 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, reap_obj(wfd2obj); reap_obj(efd2obj); #ifdef SELECT_USES_HEAP - PyMem_DEL(rfd2obj); - PyMem_DEL(wfd2obj); - PyMem_DEL(efd2obj); + PyMem_Free(rfd2obj); + PyMem_Free(wfd2obj); + PyMem_Free(efd2obj); #endif /* SELECT_USES_HEAP */ return ret; } @@ -709,10 +709,10 @@ select_poll_poll_impl(pollObject *self, PyObject *timeout_obj) } static pollObject * -newPollObject(void) +newPollObject(PyObject *module) { pollObject *self; - self = PyObject_New(pollObject, _selectstate_global->poll_Type); + self = PyObject_New(pollObject, get_select_state(module)->poll_Type); if (self == NULL) return NULL; /* ufd_uptodate is a Boolean, denoting whether the @@ -740,9 +740,9 @@ poll_dealloc(pollObject *self) { PyObject* type = (PyObject *)Py_TYPE(self); if (self->ufds != NULL) - PyMem_DEL(self->ufds); + PyMem_Free(self->ufds); Py_XDECREF(self->dict); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(type); } @@ -1073,7 +1073,7 @@ static PyGetSetDef devpoll_getsetlist[] = { }; static devpollObject * -newDevPollObject(void) +newDevPollObject(PyObject *module) { devpollObject *self; int fd_devpoll, limit_result; @@ -1103,10 +1103,10 @@ newDevPollObject(void) return NULL; } - self = PyObject_New(devpollObject, _selectstate_global->devpoll_Type); + self = PyObject_New(devpollObject, get_select_state(module)->devpoll_Type); if (self == NULL) { close(fd_devpoll); - PyMem_DEL(fds); + PyMem_Free(fds); return NULL; } self->fd_devpoll = fd_devpoll; @@ -1129,8 +1129,8 @@ devpoll_dealloc(devpollObject *self) { PyObject *type = (PyObject *)Py_TYPE(self); (void)devpoll_internal_close(self); - PyMem_DEL(self->fds); - PyObject_Del(self); + PyMem_Free(self->fds); + PyObject_Free(self); Py_DECREF(type); } @@ -1166,7 +1166,7 @@ static PyObject * select_poll_impl(PyObject *module) /*[clinic end generated code: output=16a665a4e1d228c5 input=3f877909d5696bbf]*/ { - return (PyObject *)newPollObject(); + return (PyObject *)newPollObject(module); } #ifdef HAVE_SYS_DEVPOLL_H @@ -1184,7 +1184,7 @@ static PyObject * select_devpoll_impl(PyObject *module) /*[clinic end generated code: output=ea9213cc87fd9581 input=53a1af94564f00a3]*/ { - return (PyObject *)newDevPollObject(); + return (PyObject *)newDevPollObject(module); } #endif @@ -1238,8 +1238,6 @@ typedef struct { SOCKET epfd; /* epoll control file descriptor */ } pyEpoll_Object; -#define pyepoll_CHECK(op) (PyObject_TypeCheck((op), _selectstate_global->pyEpoll_Type)) - static PyObject * pyepoll_err_closed(void) { @@ -1667,7 +1665,8 @@ select_epoll___exit___impl(pyEpoll_Object *self, PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb) /*[clinic end generated code: output=c480f38ce361748e input=7ae81a5a4c1a98d8]*/ { - return PyObject_CallMethodObjArgs((PyObject *)self, _selectstate_global->close, NULL); + _selectstate *state = _selectstate_by_type(Py_TYPE(self)); + return PyObject_CallMethodObjArgs((PyObject *)self, state->close, NULL); } static PyGetSetDef pyepoll_getsetlist[] = { @@ -1741,15 +1740,13 @@ typedef struct { struct kevent e; } kqueue_event_Object; -#define kqueue_event_Check(op) (PyObject_TypeCheck((op), _selectstate_global->kqueue_event_Type)) +#define kqueue_event_Check(op, state) (PyObject_TypeCheck((op), state->kqueue_event_Type)) typedef struct { PyObject_HEAD SOCKET kqfd; /* kqueue control fd */ } kqueue_queue_Object; -#define kqueue_queue_Check(op) (PyObject_TypeCheck((op), _selectstate_global->kqueue_queue_Type)) - #if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P) # error uintptr_t does not match void *! #elif (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG) @@ -1890,8 +1887,9 @@ kqueue_event_richcompare(kqueue_event_Object *s, kqueue_event_Object *o, int op) { int result; + _selectstate *state = _selectstate_by_type(Py_TYPE(s)); - if (!kqueue_event_Check(o)) { + if (!kqueue_event_Check(o, state)) { Py_RETURN_NOTIMPLEMENTED; } @@ -2113,6 +2111,7 @@ select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist, struct timespec timeoutspec; struct timespec *ptimeoutspec; _PyTime_t timeout, deadline = 0; + _selectstate *state = _selectstate_by_type(Py_TYPE(self)); if (self->kqfd < 0) return kqueue_queue_err_closed(); @@ -2165,9 +2164,10 @@ select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist, PyErr_NoMemory(); goto error; } + _selectstate *state = _selectstate_by_type(Py_TYPE(self)); for (i = 0; i < nchanges; ++i) { ei = PySequence_Fast_GET_ITEM(seq, i); - if (!kqueue_event_Check(ei)) { + if (!kqueue_event_Check(ei, state)) { PyErr_SetString(PyExc_TypeError, "changelist must be an iterable of " "select.kevent objects"); @@ -2229,7 +2229,7 @@ select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist, for (i = 0; i < gotevents; i++) { kqueue_event_Object *ch; - ch = PyObject_New(kqueue_event_Object, _selectstate_global->kqueue_event_Type); + ch = PyObject_New(kqueue_event_Object, state->kqueue_event_Type); if (ch == NULL) { goto error; } @@ -2392,24 +2392,28 @@ On Windows, only sockets are supported; on Unix, all file descriptors."); static int _select_traverse(PyObject *module, visitproc visit, void *arg) { - Py_VISIT(get_select_state(module)->close); - Py_VISIT(get_select_state(module)->poll_Type); - Py_VISIT(get_select_state(module)->devpoll_Type); - Py_VISIT(get_select_state(module)->pyEpoll_Type); - Py_VISIT(get_select_state(module)->kqueue_event_Type); - Py_VISIT(get_select_state(module)->kqueue_queue_Type); + _selectstate *state = get_select_state(module); + + Py_VISIT(state->close); + Py_VISIT(state->poll_Type); + Py_VISIT(state->devpoll_Type); + Py_VISIT(state->pyEpoll_Type); + Py_VISIT(state->kqueue_event_Type); + Py_VISIT(state->kqueue_queue_Type); return 0; } static int _select_clear(PyObject *module) { - Py_CLEAR(get_select_state(module)->close); - Py_CLEAR(get_select_state(module)->poll_Type); - Py_CLEAR(get_select_state(module)->devpoll_Type); - Py_CLEAR(get_select_state(module)->pyEpoll_Type); - Py_CLEAR(get_select_state(module)->kqueue_event_Type); - Py_CLEAR(get_select_state(module)->kqueue_queue_Type); + _selectstate *state = get_select_state(module); + + Py_CLEAR(state->close); + Py_CLEAR(state->poll_Type); + Py_CLEAR(state->devpoll_Type); + Py_CLEAR(state->pyEpoll_Type); + Py_CLEAR(state->kqueue_event_Type); + Py_CLEAR(state->kqueue_queue_Type); return 0; } @@ -2419,30 +2423,18 @@ _select_free(void *module) _select_clear((PyObject *)module); } -static struct PyModuleDef selectmodule = { - PyModuleDef_HEAD_INIT, - "select", - module_doc, - sizeof(_selectstate), - select_methods, - NULL, - _select_traverse, - _select_clear, - _select_free, -}; - -PyMODINIT_FUNC -PyInit_select(void) +int +_select_exec(PyObject *m) { - PyObject *m; - m = PyModule_Create(&selectmodule); - if (m == NULL) - return NULL; + _selectstate *state = get_select_state(m); - get_select_state(m)->close = PyUnicode_InternFromString("close"); - - Py_INCREF(PyExc_OSError); - PyModule_AddObject(m, "error", PyExc_OSError); + state->close = PyUnicode_InternFromString("close"); + if (state->close == NULL) { + return -1; + } + if (PyModule_AddObjectRef(m, "error", PyExc_OSError) < 0) { + return -1; + } #ifdef PIPE_BUF #ifdef HAVE_BROKEN_PIPE_BUF @@ -2462,10 +2454,11 @@ PyInit_select(void) #else { #endif - PyObject *poll_Type = PyType_FromSpec(&poll_Type_spec); - if (poll_Type == NULL) - return NULL; - get_select_state(m)->poll_Type = (PyTypeObject *)poll_Type; + state->poll_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + m, &poll_Type_spec, NULL); + if (state->poll_Type == NULL) { + return -1; + } PyModule_AddIntMacro(m, POLLIN); PyModule_AddIntMacro(m, POLLPRI); @@ -2497,19 +2490,22 @@ PyInit_select(void) #endif /* HAVE_POLL */ #ifdef HAVE_SYS_DEVPOLL_H - PyObject *devpoll_Type = PyType_FromSpec(&devpoll_Type_spec); - if (devpoll_Type == NULL) - return NULL; - get_select_state(m)->devpoll_Type = (PyTypeObject *)devpoll_Type; + state->devpoll_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + m, &devpoll_Type_spec, NULL); + if (state->devpoll_Type == NULL) { + return -1; + } #endif #ifdef HAVE_EPOLL - PyObject *pyEpoll_Type = PyType_FromSpec(&pyEpoll_Type_spec); - if (pyEpoll_Type == NULL) - return NULL; - get_select_state(m)->pyEpoll_Type = (PyTypeObject *)pyEpoll_Type; - Py_INCREF(pyEpoll_Type); - PyModule_AddObject(m, "epoll", (PyObject *)get_select_state(m)->pyEpoll_Type); + state->pyEpoll_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + m, &pyEpoll_Type_spec, NULL); + if (state->pyEpoll_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, state->pyEpoll_Type) < 0) { + return -1; + } PyModule_AddIntMacro(m, EPOLLIN); PyModule_AddIntMacro(m, EPOLLOUT); @@ -2551,19 +2547,23 @@ PyInit_select(void) #endif /* HAVE_EPOLL */ #ifdef HAVE_KQUEUE - PyObject *kqueue_event_Type = PyType_FromSpec(&kqueue_event_Type_spec); - if (kqueue_event_Type == NULL) - return NULL; - get_select_state(m)->kqueue_event_Type = (PyTypeObject *)kqueue_event_Type; - Py_INCREF(get_select_state(m)->kqueue_event_Type); - PyModule_AddObject(m, "kevent", kqueue_event_Type); + state->kqueue_event_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + m, &kqueue_event_Type_spec, NULL); + if (state->kqueue_event_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, state->kqueue_event_Type) < 0) { + return -1; + } - PyObject *kqueue_queue_Type = PyType_FromSpec(&kqueue_queue_Type_spec); - if (kqueue_queue_Type == NULL) - return NULL; - get_select_state(m)->kqueue_queue_Type = (PyTypeObject *)kqueue_queue_Type; - Py_INCREF(get_select_state(m)->kqueue_queue_Type); - PyModule_AddObject(m, "kqueue", kqueue_queue_Type); + state->kqueue_queue_Type = (PyTypeObject *)PyType_FromModuleAndSpec( + m, &kqueue_queue_Type_spec, NULL); + if (state->kqueue_queue_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, state->kqueue_queue_Type) < 0) { + return -1; + } /* event filters */ PyModule_AddIntConstant(m, "KQ_FILTER_READ", EVFILT_READ); @@ -2640,5 +2640,28 @@ PyInit_select(void) #endif #endif /* HAVE_KQUEUE */ - return m; + return 0; +} + +static PyModuleDef_Slot _select_slots[] = { + {Py_mod_exec, _select_exec}, + {0, NULL} +}; + +static struct PyModuleDef selectmodule = { + PyModuleDef_HEAD_INIT, + .m_name = "select", + .m_doc = module_doc, + .m_size = sizeof(_selectstate), + .m_methods = select_methods, + .m_slots = _select_slots, + .m_traverse = _select_traverse, + .m_clear = _select_clear, + .m_free = _select_free, +}; + +PyMODINIT_FUNC +PyInit_select(void) +{ + return PyModuleDef_Init(&selectmodule); } diff --git a/Modules/sha1module.c b/Modules/sha1module.c index c22437de256b66..5209857041d908 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -320,7 +320,7 @@ static void SHA1_dealloc(PyObject *ptr) { PyTypeObject *tp = Py_TYPE(ptr); - PyObject_Del(ptr); + PyObject_Free(ptr); Py_DECREF(tp); } diff --git a/Modules/sha256module.c b/Modules/sha256module.c index edd4d010928f38..6b8bd8f1d27fb1 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -397,7 +397,7 @@ static void SHA_dealloc(PyObject *ptr) { PyTypeObject *tp = Py_TYPE(ptr); - PyObject_Del(ptr); + PyObject_Free(ptr); Py_DECREF(tp); } diff --git a/Modules/sha512module.c b/Modules/sha512module.c index 725098def4d062..3fd9fa4c8d16f8 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -453,7 +453,7 @@ static void SHA512_dealloc(PyObject *ptr) { PyTypeObject *tp = Py_TYPE(ptr); - PyObject_Del(ptr); + PyObject_Free(ptr); Py_DECREF(tp); } diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 0ab3a71b180994..7ac797a3aa3f87 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -120,7 +120,11 @@ static volatile struct { #else #define INVALID_FD (-1) static volatile struct { +#ifdef __VXWORKS__ + int fd; +#else sig_atomic_t fd; +#endif int warn_on_full_buffer; } wakeup = {.fd = INVALID_FD, .warn_on_full_buffer = 1}; #endif @@ -130,15 +134,16 @@ static _Py_atomic_int is_tripped; static PyObject *DefaultHandler; static PyObject *IgnoreHandler; -static PyObject *IntHandler; #ifdef MS_WINDOWS static HANDLE sigint_event = NULL; #endif -#ifdef HAVE_GETITIMER +#if defined(HAVE_GETITIMER) || defined(HAVE_SETITIMER) static PyObject *ItimerError; +#endif +#ifdef HAVE_GETITIMER /* auxiliary functions for setitimer */ static int timeval_from_double(PyObject *obj, struct timeval *tv) @@ -247,10 +252,6 @@ report_wakeup_send_error(void* data) static void trip_signal(int sig_num) { - unsigned char byte; - int fd; - Py_ssize_t rc; - _Py_atomic_store_relaxed(&Handlers[sig_num].tripped, 1); /* Set is_tripped after setting .tripped, as it gets @@ -282,6 +283,7 @@ trip_signal(int sig_num) See bpo-30038 for more details. */ + int fd; #ifdef MS_WINDOWS fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int); #else @@ -289,10 +291,10 @@ trip_signal(int sig_num) #endif if (fd != INVALID_FD) { - byte = (unsigned char)sig_num; + unsigned char byte = (unsigned char)sig_num; #ifdef MS_WINDOWS if (wakeup.use_send) { - rc = send(fd, &byte, 1, 0); + Py_ssize_t rc = send(fd, &byte, 1, 0); if (rc < 0) { int last_error = GetLastError(); @@ -312,7 +314,7 @@ trip_signal(int sig_num) { /* _Py_write_noraise() retries write() if write() is interrupted by a signal (fails with EINTR). */ - rc = _Py_write_noraise(fd, &byte, 1); + Py_ssize_t rc = _Py_write_noraise(fd, &byte, 1); if (rc < 0) { if (wakeup.warn_on_full_buffer || @@ -515,8 +517,7 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler) } old_handler = Handlers[signalnum].func; - Py_INCREF(handler); - Handlers[signalnum].func = handler; + Handlers[signalnum].func = Py_NewRef(handler); if (old_handler != NULL) { return old_handler; @@ -554,8 +555,7 @@ signal_getsignal_impl(PyObject *module, int signalnum) } old_handler = Handlers[signalnum].func; if (old_handler != NULL) { - Py_INCREF(old_handler); - return old_handler; + return Py_NewRef(old_handler); } else { Py_RETURN_NONE; @@ -710,7 +710,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args, PyObject *kwds) if (sockfd == (SOCKET_T)(-1) && PyErr_Occurred()) return NULL; #else - int fd, old_fd; + int fd; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|$p:set_wakeup_fd", kwlist, &fd, &warn_on_full_buffer)) @@ -792,7 +792,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args, PyObject *kwds) } } - old_fd = wakeup.fd; + int old_fd = wakeup.fd; wakeup.fd = fd; wakeup.warn_on_full_buffer = warn_on_full_buffer; @@ -813,14 +813,14 @@ The fd must be non-blocking."); int PySignal_SetWakeupFd(int fd) { - int old_fd; - if (fd < 0) + if (fd < 0) { fd = -1; + } #ifdef MS_WINDOWS - old_fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int); + int old_fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int); #else - old_fd = wakeup.fd; + int old_fd = wakeup.fd; #endif wakeup.fd = fd; wakeup.warn_on_full_buffer = 1; @@ -851,7 +851,7 @@ signal_setitimer_impl(PyObject *module, int which, PyObject *seconds, PyObject *interval) /*[clinic end generated code: output=65f9dcbddc35527b input=de43daf194e6f66f]*/ { - struct itimerval new, old; + struct itimerval new; if (timeval_from_double(seconds, &new.it_value) < 0) { return NULL; @@ -861,6 +861,7 @@ signal_setitimer_impl(PyObject *module, int which, PyObject *seconds, } /* Let OS check "which" value */ + struct itimerval old; if (setitimer(which, &new, &old) != 0) { PyErr_SetFromErrno(ItimerError); return NULL; @@ -1074,7 +1075,6 @@ signal_valid_signals_impl(PyObject *module) #if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) -static int initialized; static PyStructSequence_Field struct_siginfo_fields[] = { {"si_signo", "signal number"}, {"si_code", "signal code"}, @@ -1380,320 +1380,279 @@ the first is the signal number, the second is the interrupted stack frame."); static int -signal_exec(PyObject *m) +signal_add_constants(PyObject *module) { - /* add the functions */ -#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) - if (!initialized) { - if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0) { - return -1; - } +#define ADD_INT_MACRO(macro) \ + if (PyModule_AddIntConstant(module, #macro, macro) < 0) { \ + return -1; \ } - if (PyModule_AddType(m, &SiginfoType) < 0) { - return -1; - } - initialized = 1; -#endif - - /* Add some symbolic constants to the module */ - PyObject *d = PyModule_GetDict(m); - - DefaultHandler = PyLong_FromVoidPtr((void *)SIG_DFL); - if (!DefaultHandler || - PyDict_SetItemString(d, "SIG_DFL", DefaultHandler) < 0) { - return -1; - } - - IgnoreHandler = PyLong_FromVoidPtr((void *)SIG_IGN); - if (!IgnoreHandler || - PyDict_SetItemString(d, "SIG_IGN", IgnoreHandler) < 0) { - return -1; - } - - if (PyModule_AddIntMacro(m, NSIG)) - return -1; + ADD_INT_MACRO(NSIG); + // SIG_xxx pthread_sigmask() constants #ifdef SIG_BLOCK - if (PyModule_AddIntMacro(m, SIG_BLOCK)) - return -1; + ADD_INT_MACRO(SIG_BLOCK); #endif #ifdef SIG_UNBLOCK - if (PyModule_AddIntMacro(m, SIG_UNBLOCK)) - return -1; + ADD_INT_MACRO(SIG_UNBLOCK); #endif #ifdef SIG_SETMASK - if (PyModule_AddIntMacro(m, SIG_SETMASK)) - return -1; + ADD_INT_MACRO(SIG_SETMASK); #endif - IntHandler = PyMapping_GetItemString(d, "default_int_handler"); - if (!IntHandler) - return -1; - - _Py_atomic_store_relaxed(&Handlers[0].tripped, 0); - for (int i = 1; i < NSIG; i++) { - void (*t)(int); - t = PyOS_getsig(i); - _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); - if (t == SIG_DFL) - Handlers[i].func = DefaultHandler; - else if (t == SIG_IGN) - Handlers[i].func = IgnoreHandler; - else - Handlers[i].func = Py_None; /* None of our business */ - Py_INCREF(Handlers[i].func); - } - if (Handlers[SIGINT].func == DefaultHandler) { - /* Install default int handler */ - Py_INCREF(IntHandler); - Py_SETREF(Handlers[SIGINT].func, IntHandler); - PyOS_setsig(SIGINT, signal_handler); - } - + // SIGxxx signal number constants #ifdef SIGHUP - if (PyModule_AddIntMacro(m, SIGHUP)) - return -1; + ADD_INT_MACRO(SIGHUP); #endif #ifdef SIGINT - if (PyModule_AddIntMacro(m, SIGINT)) - return -1; + ADD_INT_MACRO(SIGINT); #endif #ifdef SIGBREAK - if (PyModule_AddIntMacro(m, SIGBREAK)) - return -1; + ADD_INT_MACRO(SIGBREAK); #endif #ifdef SIGQUIT - if (PyModule_AddIntMacro(m, SIGQUIT)) - return -1; + ADD_INT_MACRO(SIGQUIT); #endif #ifdef SIGILL - if (PyModule_AddIntMacro(m, SIGILL)) - return -1; + ADD_INT_MACRO(SIGILL); #endif #ifdef SIGTRAP - if (PyModule_AddIntMacro(m, SIGTRAP)) - return -1; + ADD_INT_MACRO(SIGTRAP); #endif #ifdef SIGIOT - if (PyModule_AddIntMacro(m, SIGIOT)) - return -1; + ADD_INT_MACRO(SIGIOT); #endif #ifdef SIGABRT - if (PyModule_AddIntMacro(m, SIGABRT)) - return -1; + ADD_INT_MACRO(SIGABRT); #endif #ifdef SIGEMT - if (PyModule_AddIntMacro(m, SIGEMT)) - return -1; + ADD_INT_MACRO(SIGEMT); #endif #ifdef SIGFPE - if (PyModule_AddIntMacro(m, SIGFPE)) - return -1; + ADD_INT_MACRO(SIGFPE); #endif #ifdef SIGKILL - if (PyModule_AddIntMacro(m, SIGKILL)) - return -1; + ADD_INT_MACRO(SIGKILL); #endif #ifdef SIGBUS - if (PyModule_AddIntMacro(m, SIGBUS)) - return -1; + ADD_INT_MACRO(SIGBUS); #endif #ifdef SIGSEGV - if (PyModule_AddIntMacro(m, SIGSEGV)) - return -1; + ADD_INT_MACRO(SIGSEGV); #endif #ifdef SIGSYS - if (PyModule_AddIntMacro(m, SIGSYS)) - return -1; + ADD_INT_MACRO(SIGSYS); #endif #ifdef SIGPIPE - if (PyModule_AddIntMacro(m, SIGPIPE)) - return -1; + ADD_INT_MACRO(SIGPIPE); #endif #ifdef SIGALRM - if (PyModule_AddIntMacro(m, SIGALRM)) - return -1; + ADD_INT_MACRO(SIGALRM); #endif #ifdef SIGTERM - if (PyModule_AddIntMacro(m, SIGTERM)) - return -1; + ADD_INT_MACRO(SIGTERM); #endif #ifdef SIGUSR1 - if (PyModule_AddIntMacro(m, SIGUSR1)) - return -1; + ADD_INT_MACRO(SIGUSR1); #endif #ifdef SIGUSR2 - if (PyModule_AddIntMacro(m, SIGUSR2)) - return -1; + ADD_INT_MACRO(SIGUSR2); #endif #ifdef SIGCLD - if (PyModule_AddIntMacro(m, SIGCLD)) - return -1; + ADD_INT_MACRO(SIGCLD); #endif #ifdef SIGCHLD - if (PyModule_AddIntMacro(m, SIGCHLD)) - return -1; + ADD_INT_MACRO(SIGCHLD); #endif #ifdef SIGPWR - if (PyModule_AddIntMacro(m, SIGPWR)) - return -1; + ADD_INT_MACRO(SIGPWR); #endif #ifdef SIGIO - if (PyModule_AddIntMacro(m, SIGIO)) - return -1; + ADD_INT_MACRO(SIGIO); #endif #ifdef SIGURG - if (PyModule_AddIntMacro(m, SIGURG)) - return -1; + ADD_INT_MACRO(SIGURG); #endif #ifdef SIGWINCH - if (PyModule_AddIntMacro(m, SIGWINCH)) - return -1; + ADD_INT_MACRO(SIGWINCH); #endif #ifdef SIGPOLL - if (PyModule_AddIntMacro(m, SIGPOLL)) - return -1; + ADD_INT_MACRO(SIGPOLL); #endif #ifdef SIGSTOP - if (PyModule_AddIntMacro(m, SIGSTOP)) - return -1; + ADD_INT_MACRO(SIGSTOP); #endif #ifdef SIGTSTP - if (PyModule_AddIntMacro(m, SIGTSTP)) - return -1; + ADD_INT_MACRO(SIGTSTP); #endif #ifdef SIGCONT - if (PyModule_AddIntMacro(m, SIGCONT)) - return -1; + ADD_INT_MACRO(SIGCONT); #endif #ifdef SIGTTIN - if (PyModule_AddIntMacro(m, SIGTTIN)) - return -1; + ADD_INT_MACRO(SIGTTIN); #endif #ifdef SIGTTOU - if (PyModule_AddIntMacro(m, SIGTTOU)) - return -1; + ADD_INT_MACRO(SIGTTOU); #endif #ifdef SIGVTALRM - if (PyModule_AddIntMacro(m, SIGVTALRM)) - return -1; + ADD_INT_MACRO(SIGVTALRM); #endif #ifdef SIGPROF - if (PyModule_AddIntMacro(m, SIGPROF)) - return -1; + ADD_INT_MACRO(SIGPROF); #endif #ifdef SIGXCPU - if (PyModule_AddIntMacro(m, SIGXCPU)) - return -1; + ADD_INT_MACRO(SIGXCPU); #endif #ifdef SIGXFSZ - if (PyModule_AddIntMacro(m, SIGXFSZ)) - return -1; + ADD_INT_MACRO(SIGXFSZ); #endif #ifdef SIGRTMIN - if (PyModule_AddIntMacro(m, SIGRTMIN)) - return -1; + ADD_INT_MACRO(SIGRTMIN); #endif #ifdef SIGRTMAX - if (PyModule_AddIntMacro(m, SIGRTMAX)) - return -1; + ADD_INT_MACRO(SIGRTMAX); #endif #ifdef SIGINFO - if (PyModule_AddIntMacro(m, SIGINFO)) - return -1; + ADD_INT_MACRO(SIGINFO); #endif + // ITIMER_xxx constants #ifdef ITIMER_REAL - if (PyModule_AddIntMacro(m, ITIMER_REAL)) - return -1; + ADD_INT_MACRO(ITIMER_REAL); #endif #ifdef ITIMER_VIRTUAL - if (PyModule_AddIntMacro(m, ITIMER_VIRTUAL)) - return -1; + ADD_INT_MACRO(ITIMER_VIRTUAL); #endif #ifdef ITIMER_PROF - if (PyModule_AddIntMacro(m, ITIMER_PROF)) - return -1; -#endif - -#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER) - ItimerError = PyErr_NewException("signal.ItimerError", - PyExc_OSError, NULL); - if (!ItimerError || - PyDict_SetItemString(d, "ItimerError", ItimerError) < 0) { - return -1; - } + ADD_INT_MACRO(ITIMER_PROF); #endif + // CTRL_xxx Windows signals #ifdef CTRL_C_EVENT - if (PyModule_AddIntMacro(m, CTRL_C_EVENT)) - return -1; + ADD_INT_MACRO(CTRL_C_EVENT); #endif - #ifdef CTRL_BREAK_EVENT - if (PyModule_AddIntMacro(m, CTRL_BREAK_EVENT)) - return -1; + ADD_INT_MACRO(CTRL_BREAK_EVENT); #endif -#ifdef MS_WINDOWS - /* Create manual-reset event, initially unset */ - sigint_event = CreateEvent(NULL, TRUE, FALSE, FALSE); -#endif + return 0; - if (PyErr_Occurred()) { +#undef ADD_INT_MACRO +} + + +static int +signal_module_exec(PyObject *m) +{ + assert(!PyErr_Occurred()); + + if (signal_add_constants(m) < 0) { return -1; } - return 0; + /* Add some symbolic constants to the module */ + PyObject *d = PyModule_GetDict(m); + if (PyDict_SetItemString(d, "SIG_DFL", DefaultHandler) < 0) { + return -1; + } + if (PyDict_SetItemString(d, "SIG_IGN", IgnoreHandler) < 0) { + return -1; + } +#if defined(HAVE_GETITIMER) || defined(HAVE_SETITIMER) + if (PyDict_SetItemString(d, "ItimerError", ItimerError) < 0) { + return -1; + } +#endif +#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) + if (PyModule_AddType(m, &SiginfoType) < 0) { + return -1; + } +#endif + + // Get signal handlers + for (int signum = 1; signum < NSIG; signum++) { + void (*c_handler)(int) = PyOS_getsig(signum); + PyObject *func; + if (c_handler == SIG_DFL) { + func = DefaultHandler; + } + else if (c_handler == SIG_IGN) { + func = IgnoreHandler; + } + else { + func = Py_None; // None of our business + } + // If signal_module_exec() is called more than one, we must + // clear the strong reference to the previous function. + Py_XSETREF(Handlers[signum].func, Py_NewRef(func)); + } + + // Instal Python SIGINT handler which raises KeyboardInterrupt + if (Handlers[SIGINT].func == DefaultHandler) { + PyObject *int_handler = PyMapping_GetItemString(d, "default_int_handler"); + if (!int_handler) { + return -1; + } + + Py_SETREF(Handlers[SIGINT].func, int_handler); + PyOS_setsig(SIGINT, signal_handler); + } + + assert(!PyErr_Occurred()); + return 0; } -static struct PyModuleDef signalmodule = { +static PyModuleDef_Slot signal_slots[] = { + {Py_mod_exec, signal_module_exec}, + {0, NULL} +}; + +static struct PyModuleDef signal_module = { PyModuleDef_HEAD_INIT, "_signal", .m_doc = module_doc, - .m_size = -1, + .m_size = 0, .m_methods = signal_methods, + .m_slots = signal_slots, }; PyMODINIT_FUNC PyInit__signal(void) { - PyObject *mod = PyModule_Create(&signalmodule); - if (mod == NULL) { - return NULL; - } - - if (signal_exec(mod) < 0) { - Py_DECREF(mod); - return NULL; - } - return mod; + return PyModuleDef_Init(&signal_module); } -static void -finisignal(void) +void +_PySignal_Fini(void) { - int i; - PyObject *func; - - for (i = 1; i < NSIG; i++) { - func = Handlers[i].func; - _Py_atomic_store_relaxed(&Handlers[i].tripped, 0); - Handlers[i].func = NULL; - if (func != NULL && func != Py_None && - func != DefaultHandler && func != IgnoreHandler) - PyOS_setsig(i, SIG_DFL); + // Restore default signals and clear handlers + for (int signum = 1; signum < NSIG; signum++) { + PyObject *func = Handlers[signum].func; + _Py_atomic_store_relaxed(&Handlers[signum].tripped, 0); + Handlers[signum].func = NULL; + if (func != NULL + && func != Py_None + && func != DefaultHandler + && func != IgnoreHandler) + { + PyOS_setsig(signum, SIG_DFL); + } Py_XDECREF(func); } - Py_CLEAR(IntHandler); +#ifdef MS_WINDOWS + if (sigint_event != NULL) { + CloseHandle(sigint_event); + sigint_event = NULL; + } +#endif + Py_CLEAR(DefaultHandler); Py_CLEAR(IgnoreHandler); -#ifdef HAVE_GETITIMER +#if defined(HAVE_GETITIMER) || defined(HAVE_SETITIMER) Py_CLEAR(ItimerError); #endif } @@ -1792,19 +1751,102 @@ PyErr_SetInterrupt(void) } } -void -PyOS_InitInterrupts(void) +static int +signal_install_handlers(void) { - PyObject *m = PyImport_ImportModule("_signal"); - if (m) { - Py_DECREF(m); +#ifdef SIGPIPE + PyOS_setsig(SIGPIPE, SIG_IGN); +#endif +#ifdef SIGXFZ + PyOS_setsig(SIGXFZ, SIG_IGN); +#endif +#ifdef SIGXFSZ + PyOS_setsig(SIGXFSZ, SIG_IGN); +#endif + + // Import _signal to install the Python SIGINT handler + PyObject *module = PyImport_ImportModule("_signal"); + if (!module) { + return -1; } + Py_DECREF(module); + + return 0; } + +/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. + * + * All of the code in this function must only use async-signal-safe functions, + * listed at `man 7 signal` or + * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html. + * + * If this function is updated, update also _posix_spawn() of subprocess.py. + */ void -PyOS_FiniInterrupts(void) +_Py_RestoreSignals(void) { - finisignal(); +#ifdef SIGPIPE + PyOS_setsig(SIGPIPE, SIG_DFL); +#endif +#ifdef SIGXFZ + PyOS_setsig(SIGXFZ, SIG_DFL); +#endif +#ifdef SIGXFSZ + PyOS_setsig(SIGXFSZ, SIG_DFL); +#endif +} + + +int +_PySignal_Init(int install_signal_handlers) +{ + DefaultHandler = PyLong_FromVoidPtr((void *)SIG_DFL); + if (!DefaultHandler) { + return -1; + } + + IgnoreHandler = PyLong_FromVoidPtr((void *)SIG_IGN); + if (!IgnoreHandler) { + return -1; + } + +#if defined(HAVE_GETITIMER) || defined(HAVE_SETITIMER) + ItimerError = PyErr_NewException("signal.ItimerError", + PyExc_OSError, NULL); + if (!ItimerError) { + return -1; + } +#endif + +#ifdef MS_WINDOWS + /* Create manual-reset event, initially unset */ + sigint_event = CreateEvent(NULL, TRUE, FALSE, FALSE); + if (sigint_event == NULL) { + PyErr_SetFromWindowsErr(0); + return -1; + } +#endif + +#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) + if (SiginfoType.tp_name == NULL) { + if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0) { + return -1; + } + } +#endif + + for (int signum = 1; signum < NSIG; signum++) { + _Py_atomic_store_relaxed(&Handlers[signum].tripped, 0); + } + + if (install_signal_handlers) { + if (signal_install_handlers() < 0) { + return -1; + } + } + + return 0; } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index d7738367029e85..f8e4de5825f7ad 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -514,7 +514,6 @@ remove_unusable_flags(PyObject *m) by this module (but not argument type or memory errors, etc.). */ static PyObject *socket_herror; static PyObject *socket_gaierror; -static PyObject *socket_timeout; /* A forward reference to the socket type object. The sock_type variable contains pointers to various functions, @@ -886,7 +885,7 @@ sock_call_ex(PySocketSockObject *s, if (err) *err = SOCK_TIMEOUT_ERR; else - PyErr_SetString(socket_timeout, "timed out"); + PyErr_SetString(PyExc_TimeoutError, "timed out"); return -1; } @@ -2880,7 +2879,7 @@ sock_settimeout(PySocketSockObject *s, PyObject *arg) /* Blocking mode for a Python socket object means that operations like :meth:`recv` or :meth:`sendall` will block the execution of the current thread until they are complete or aborted with a - `socket.timeout` or `socket.error` errors. When timeout is `None`, + `TimeoutError` or `socket.error` errors. When timeout is `None`, the underlying FD is in a blocking mode. When timeout is a positive number, the FD is in a non-blocking mode, and socket ops are implemented with a `select()` call. @@ -4206,7 +4205,7 @@ sock_sendall(PySocketSockObject *s, PyObject *args) } if (interval <= 0) { - PyErr_SetString(socket_timeout, "timed out"); + PyErr_SetString(PyExc_TimeoutError, "timed out"); goto done; } } @@ -7123,13 +7122,10 @@ PyInit__socket(void) return NULL; Py_INCREF(socket_gaierror); PyModule_AddObject(m, "gaierror", socket_gaierror); - socket_timeout = PyErr_NewException("socket.timeout", - PyExc_OSError, NULL); - if (socket_timeout == NULL) - return NULL; - PySocketModuleAPI.timeout_error = socket_timeout; - Py_INCREF(socket_timeout); - PyModule_AddObject(m, "timeout", socket_timeout); + + PySocketModuleAPI.timeout_error = PyExc_TimeoutError; + PyModule_AddObjectRef(m, "timeout", PyExc_TimeoutError); + Py_INCREF((PyObject *)&sock_type); if (PyModule_AddObject(m, "SocketType", (PyObject *)&sock_type) != 0) diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c index 1601ec0f2fc4e7..acea30679bf5ec 100644 --- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -59,9 +59,19 @@ static PyStructSequence_Desc struct_spwd_type_desc = { 9, }; -static int initialized; -static PyTypeObject StructSpwdType; +typedef struct { + PyTypeObject *StructSpwdType; +} spwdmodulestate; +static inline spwdmodulestate* +get_spwd_state(PyObject *module) +{ + void *state = PyModule_GetState(module); + assert(state != NULL); + return (spwdmodulestate *)state; +} + +static struct PyModuleDef spwdmodule; static void sets(PyObject *v, int i, const char* val) @@ -75,10 +85,10 @@ sets(PyObject *v, int i, const char* val) } } -static PyObject *mkspent(struct spwd *p) +static PyObject *mkspent(PyObject *module, struct spwd *p) { int setIndex = 0; - PyObject *v = PyStructSequence_New(&StructSpwdType); + PyObject *v = PyStructSequence_New(get_spwd_state(module)->StructSpwdType); if (v == NULL) return NULL; @@ -144,7 +154,7 @@ spwd_getspnam_impl(PyObject *module, PyObject *arg) PyErr_SetString(PyExc_KeyError, "getspnam(): name not found"); goto out; } - retval = mkspent(p); + retval = mkspent(module, p); out: Py_DECREF(bytes); return retval; @@ -172,7 +182,7 @@ spwd_getspall_impl(PyObject *module) return NULL; setspent(); while ((p = getspent()) != NULL) { - PyObject *v = mkspent(p); + PyObject *v = mkspent(module, p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); @@ -197,34 +207,54 @@ static PyMethodDef spwd_methods[] = { {NULL, NULL} /* sentinel */ }; +static int +spwdmodule_exec(PyObject *module) +{ + spwdmodulestate *state = get_spwd_state(module); + + state->StructSpwdType = PyStructSequence_NewType(&struct_spwd_type_desc); + if (state->StructSpwdType == NULL) { + return -1; + } + if (PyModule_AddType(module, state->StructSpwdType) < 0) { + return -1; + } + return 0; +} + +static PyModuleDef_Slot spwdmodule_slots[] = { + {Py_mod_exec, spwdmodule_exec}, + {0, NULL} +}; + +static int spwdmodule_traverse(PyObject *m, visitproc visit, void *arg) { + Py_VISIT(get_spwd_state(m)->StructSpwdType); + return 0; +} +static int spwdmodule_clear(PyObject *m) { + Py_CLEAR(get_spwd_state(m)->StructSpwdType); + return 0; +} + +static void spwdmodule_free(void *m) { + spwdmodule_clear((PyObject *)m); +} static struct PyModuleDef spwdmodule = { PyModuleDef_HEAD_INIT, - "spwd", - spwd__doc__, - -1, - spwd_methods, - NULL, - NULL, - NULL, - NULL + .m_name = "spwd", + .m_doc = spwd__doc__, + .m_size = sizeof(spwdmodulestate), + .m_methods = spwd_methods, + .m_slots = spwdmodule_slots, + .m_traverse = spwdmodule_traverse, + .m_clear = spwdmodule_clear, + .m_free = spwdmodule_free, }; PyMODINIT_FUNC PyInit_spwd(void) { - PyObject *m; - m=PyModule_Create(&spwdmodule); - if (m == NULL) - return NULL; - if (!initialized) { - if (PyStructSequence_InitType2(&StructSpwdType, - &struct_spwd_type_desc) < 0) - return NULL; - } - Py_INCREF((PyObject *) &StructSpwdType); - PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType); - initialized = 1; - return m; + return PyModuleDef_Init(&spwdmodule); } diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h index cfe0a4af2c4839..322f66fb4da6c7 100644 --- a/Modules/sre_lib.h +++ b/Modules/sre_lib.h @@ -986,7 +986,7 @@ SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel) ctx->pattern[1], ctx->pattern[2])); /* install new repeat context */ - ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep)); + ctx->u.rep = (SRE_REPEAT*) PyObject_Malloc(sizeof(*ctx->u.rep)); if (!ctx->u.rep) { PyErr_NoMemory(); RETURN_FAILURE; @@ -1000,7 +1000,7 @@ SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel) state->ptr = ctx->ptr; DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]); state->repeat = ctx->u.rep->prev; - PyObject_FREE(ctx->u.rep); + PyObject_Free(ctx->u.rep); if (ret) { RETURN_ON_ERROR(ret); diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c index 9180f185e1e877..f6c378fdaedc1d 100644 --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -71,56 +71,60 @@ static PyMethodDef symtable_methods[] = { {NULL, NULL} /* sentinel */ }; +static int +symtable_init_stentry_type(PyObject *m) +{ + return PyType_Ready(&PySTEntry_Type); +} + +static int +symtable_init_constants(PyObject *m) +{ + if (PyModule_AddIntMacro(m, USE) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_GLOBAL) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_NONLOCAL) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_LOCAL) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_PARAM) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_FREE) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_FREE_CLASS) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_IMPORT) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_BOUND) < 0) return -1; + if (PyModule_AddIntMacro(m, DEF_ANNOT) < 0) return -1; + + if (PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock) < 0) + return -1; + if (PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock) < 0) return -1; + if (PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock) < 0) + return -1; + + if (PyModule_AddIntMacro(m, LOCAL) < 0) return -1; + if (PyModule_AddIntMacro(m, GLOBAL_EXPLICIT) < 0) return -1; + if (PyModule_AddIntMacro(m, GLOBAL_IMPLICIT) < 0) return -1; + if (PyModule_AddIntMacro(m, FREE) < 0) return -1; + if (PyModule_AddIntMacro(m, CELL) < 0) return -1; + + if (PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET) < 0) return -1; + if (PyModule_AddIntMacro(m, SCOPE_MASK) < 0) return -1; + + return 0; +} + +static PyModuleDef_Slot symtable_slots[] = { + {Py_mod_exec, symtable_init_stentry_type}, + {Py_mod_exec, symtable_init_constants}, + {0, NULL} +}; + static struct PyModuleDef symtablemodule = { PyModuleDef_HEAD_INIT, - "_symtable", - NULL, - -1, - symtable_methods, - NULL, - NULL, - NULL, - NULL + .m_name = "_symtable", + .m_size = 0, + .m_methods = symtable_methods, + .m_slots = symtable_slots, }; PyMODINIT_FUNC PyInit__symtable(void) { - PyObject *m; - - if (PyType_Ready(&PySTEntry_Type) < 0) - return NULL; - - m = PyModule_Create(&symtablemodule); - if (m == NULL) - return NULL; - PyModule_AddIntMacro(m, USE); - PyModule_AddIntMacro(m, DEF_GLOBAL); - PyModule_AddIntMacro(m, DEF_NONLOCAL); - PyModule_AddIntMacro(m, DEF_LOCAL); - PyModule_AddIntMacro(m, DEF_PARAM); - PyModule_AddIntMacro(m, DEF_FREE); - PyModule_AddIntMacro(m, DEF_FREE_CLASS); - PyModule_AddIntMacro(m, DEF_IMPORT); - PyModule_AddIntMacro(m, DEF_BOUND); - PyModule_AddIntMacro(m, DEF_ANNOT); - - PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock); - PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); - PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); - - PyModule_AddIntMacro(m, LOCAL); - PyModule_AddIntMacro(m, GLOBAL_EXPLICIT); - PyModule_AddIntMacro(m, GLOBAL_IMPLICIT); - PyModule_AddIntMacro(m, FREE); - PyModule_AddIntMacro(m, CELL); - - PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET); - PyModule_AddIntMacro(m, SCOPE_MASK); - - if (PyErr_Occurred()) { - Py_DECREF(m); - m = 0; - } - return m; + return PyModuleDef_Init(&symtablemodule); } diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 80eab30c95d6f0..4caacc3b64d7c8 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -51,7 +51,7 @@ #define _Py_tzname tzname #endif -#if defined(__APPLE__ ) && defined(__has_builtin) +#if defined(__APPLE__ ) && defined(__has_builtin) # if __has_builtin(__builtin_available) # define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) # endif @@ -74,10 +74,21 @@ _PyFloat_FromPyTime(_PyTime_t t) } +static int +get_system_time(_PyTime_t *t) +{ + // Avoid _PyTime_GetSystemClock() which silently ignores errors. + return _PyTime_GetSystemClockWithInfo(t, NULL); +} + + static PyObject * time_time(PyObject *self, PyObject *unused) { - _PyTime_t t = _PyTime_GetSystemClock(); + _PyTime_t t; + if (get_system_time(&t) < 0) { + return NULL; + } return _PyFloat_FromPyTime(t); } @@ -91,7 +102,10 @@ Fractions of a second may be present if the system clock provides them."); static PyObject * time_time_ns(PyObject *self, PyObject *unused) { - _PyTime_t t = _PyTime_GetSystemClock(); + _PyTime_t t; + if (get_system_time(&t) < 0) { + return NULL; + } return _PyTime_AsNanosecondsObject(t); } @@ -147,20 +161,11 @@ _PyTime_GetClockWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) } #endif /* HAVE_CLOCK */ -static PyObject* -perf_counter(_Py_clock_info_t *info) -{ - _PyTime_t t; - if (_PyTime_GetPerfCounterWithInfo(&t, info) < 0) { - return NULL; - } - return _PyFloat_FromPyTime(t); -} #ifdef HAVE_CLOCK_GETTIME #ifdef __APPLE__ -/* +/* * The clock_* functions will be removed from the module * dict entirely when the C API is not available. */ @@ -1096,10 +1101,22 @@ the local timezone used by methods such as localtime, but this behaviour\n\ should not be relied on."); #endif /* HAVE_WORKING_TZSET */ + +static int +get_monotonic(_PyTime_t *t) +{ + // Avoid _PyTime_GetMonotonicClock() which silently ignores errors. + return _PyTime_GetMonotonicClockWithInfo(t, NULL); +} + + static PyObject * time_monotonic(PyObject *self, PyObject *unused) { - _PyTime_t t = _PyTime_GetMonotonicClock(); + _PyTime_t t; + if (get_monotonic(&t) < 0) { + return NULL; + } return _PyFloat_FromPyTime(t); } @@ -1111,7 +1128,10 @@ Monotonic clock, cannot go backward."); static PyObject * time_monotonic_ns(PyObject *self, PyObject *unused) { - _PyTime_t t = _PyTime_GetMonotonicClock(); + _PyTime_t t; + if (get_monotonic(&t) < 0) { + return NULL; + } return _PyTime_AsNanosecondsObject(t); } @@ -1120,10 +1140,23 @@ PyDoc_STRVAR(monotonic_ns_doc, \n\ Monotonic clock, cannot go backward, as nanoseconds."); + +static int +get_perf_counter(_PyTime_t *t) +{ + // Avoid _PyTime_GetPerfCounter() which silently ignores errors. + return _PyTime_GetPerfCounterWithInfo(t, NULL); +} + + static PyObject * time_perf_counter(PyObject *self, PyObject *unused) { - return perf_counter(NULL); + _PyTime_t t; + if (get_perf_counter(&t) < 0) { + return NULL; + } + return _PyFloat_FromPyTime(t); } PyDoc_STRVAR(perf_counter_doc, @@ -1131,10 +1164,14 @@ PyDoc_STRVAR(perf_counter_doc, \n\ Performance counter for benchmarking."); + static PyObject * time_perf_counter_ns(PyObject *self, PyObject *unused) { - _PyTime_t t = _PyTime_GetPerfCounter(); + _PyTime_t t; + if (get_perf_counter(&t) < 0) { + return NULL; + } return _PyTime_AsNanosecondsObject(t); } @@ -1421,7 +1458,7 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) #if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability) static int -_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) +_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) __attribute__((availability(macos, introduced=10.12))) __attribute__((availability(ios, introduced=10.0))) __attribute__((availability(tvos, introduced=10.0))) @@ -1460,7 +1497,7 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) #ifdef HAVE_THREAD_TIME #ifdef __APPLE__ -/* +/* * The clock_* functions will be removed from the module * dict entirely when the C API is not available. */ @@ -2025,7 +2062,10 @@ pysleep(_PyTime_t secs) HANDLE hInterruptEvent; #endif - deadline = _PyTime_GetMonotonicClock() + secs; + if (get_monotonic(&monotonic) < 0) { + return -1; + } + deadline = monotonic + secs; do { #ifndef MS_WINDOWS @@ -2077,10 +2117,13 @@ pysleep(_PyTime_t secs) if (PyErr_CheckSignals()) return -1; - monotonic = _PyTime_GetMonotonicClock(); + if (get_monotonic(&monotonic) < 0) { + return -1; + } secs = deadline - monotonic; - if (secs < 0) + if (secs < 0) { break; + } /* retry with the recomputed delay */ } while (1); diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index fcf801dc9e4adc..4b8c46c7797665 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -1418,7 +1418,7 @@ static void ucd_dealloc(PreviousDBVersion *self) { PyTypeObject *tp = Py_TYPE(self); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(tp); } diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c index 5b05a9454a05da..883c8a9b5e1833 100644 --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -3,47 +3,103 @@ also declares object types. All occurrences of 'Xxo' should be changed to something reasonable for your objects. After that, all other occurrences of 'xx' should be changed to something reasonable for your - module. If your module is named foo your sourcefile should be named - foomodule.c. + module. If your module is named foo your source file should be named + foo.c or foomodule.c. You will probably want to delete all references to 'x_attr' and add your own types of attributes instead. Maybe you want to name your local variables other than 'self'. If your object type is needed in other files, you'll have to create a file "foobarobject.h"; see - floatobject.h for an example. */ + floatobject.h for an example. -/* Xxo objects */ + This module roughly corresponds to:: + + class Xxo: + """A class that explicitly stores attributes in an internal dict""" + + def __init__(self): + # In the C class, "_x_attr" is not accessible from Python code + self._x_attr = {} + + def __getattr__(self, name): + return self._x_attr[name] + + def __setattr__(self, name, value): + self._x_attr[name] = value + + def __delattr__(self, name): + del self._x_attr[name] + + def demo(o, /): + if isinstance(o, str): + return o + elif isinstance(o, Xxo): + return o + else: + raise Error('argument must be str or Xxo') + + class Error(Exception): + """Exception raised by the xxlimited module""" + + def foo(i: int, j: int, /): + """Return the sum of i and j.""" + # Unlike this pseudocode, the C function will *only* work with + # integers and perform C long int arithmetic + return i + j + + def new(): + return Xxo() + + def Str(str): + # A trivial subclass of a built-in type + pass + */ #include "Python.h" -static PyObject *ErrorObject; +// Module state +typedef struct { + PyObject *Xxo_Type; // Xxo class + PyObject *Error_Type; // Error class +} xx_state; + + +/* Xxo objects */ +// Instance state typedef struct { PyObject_HEAD PyObject *x_attr; /* Attributes dictionary */ } XxoObject; -static PyObject *Xxo_Type; - -#define XxoObject_Check(v) Py_IS_TYPE(v, Xxo_Type) +// XXX: no good way to do this yet +// #define XxoObject_Check(v) Py_IS_TYPE(v, Xxo_Type) static XxoObject * -newXxoObject(PyObject *arg) +newXxoObject(PyObject *module) { + xx_state *state = PyModule_GetState(module); + if (state == NULL) { + return NULL; + } XxoObject *self; - self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); - if (self == NULL) + self = PyObject_GC_New(XxoObject, (PyTypeObject*)state->Xxo_Type); + if (self == NULL) { return NULL; + } self->x_attr = NULL; return self; } -/* Xxo methods */ +/* Xxo finalization */ static int Xxo_traverse(XxoObject *self, visitproc visit, void *arg) { + // Visit the type Py_VISIT(Py_TYPE(self)); + + // Visit the attribute dict Py_VISIT(self->x_attr); return 0; } @@ -54,26 +110,18 @@ Xxo_finalize(XxoObject *self) Py_CLEAR(self->x_attr); } -static PyObject * -Xxo_demo(XxoObject *self, PyObject *args) +static void +Xxo_dealloc(XxoObject *self) { - PyObject *o = NULL; - if (!PyArg_ParseTuple(args, "|O:demo", &o)) - return NULL; - /* Test availability of fast type checks */ - if (o != NULL && PyUnicode_Check(o)) { - Py_INCREF(o); - return o; - } - Py_INCREF(Py_None); - return Py_None; + Xxo_finalize(self); + PyTypeObject *tp = Py_TYPE(self); + freefunc free = PyType_GetSlot(tp, Py_tp_free); + free(self); + Py_DECREF(tp); } -static PyMethodDef Xxo_methods[] = { - {"demo", (PyCFunction)Xxo_demo, METH_VARARGS, - PyDoc_STR("demo() -> None")}, - {NULL, NULL} /* sentinel */ -}; + +/* Xxo attribute handling */ static PyObject * Xxo_getattro(XxoObject *self, PyObject *name) @@ -92,45 +140,109 @@ Xxo_getattro(XxoObject *self, PyObject *name) } static int -Xxo_setattr(XxoObject *self, const char *name, PyObject *v) +Xxo_setattro(XxoObject *self, PyObject *name, PyObject *v) { if (self->x_attr == NULL) { + // prepare the attribute dict self->x_attr = PyDict_New(); - if (self->x_attr == NULL) + if (self->x_attr == NULL) { return -1; + } } if (v == NULL) { - int rv = PyDict_DelItemString(self->x_attr, name); - if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) + // delete an attribute + int rv = PyDict_DelItem(self->x_attr, name); + if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_SetString(PyExc_AttributeError, "delete non-existing Xxo attribute"); + return -1; + } return rv; } - else - return PyDict_SetItemString(self->x_attr, name, v); + else { + // set an attribute + return PyDict_SetItem(self->x_attr, name, v); + } +} + +/* Xxo methods */ + +static PyObject * +Xxo_demo(XxoObject *self, PyTypeObject *defining_class, + PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + if (kwnames != NULL && PyObject_Length(kwnames)) { + PyErr_SetString(PyExc_TypeError, "demo() takes no keyword arguments"); + return NULL; + } + if (nargs != 1) { + PyErr_SetString(PyExc_TypeError, "demo() takes exactly 1 argument"); + return NULL; + } + + PyObject *o = args[0]; + + /* Test if the argument is "str" */ + if (PyUnicode_Check(o)) { + Py_INCREF(o); + return o; + } + + /* test if the argument is of the Xxo class */ + if (PyObject_TypeCheck(o, defining_class)) { + Py_INCREF(o); + return o; + } + + Py_INCREF(Py_None); + return Py_None; } +static PyMethodDef Xxo_methods[] = { + {"demo", (PyCFunction)(void(*)(void))Xxo_demo, + METH_METHOD | METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("demo(o) -> o")}, + {NULL, NULL} /* sentinel */ +}; + +/* Xxo type definition */ + +PyDoc_STRVAR(Xxo_doc, + "A class that explicitly stores attributes in an internal dict"); + static PyType_Slot Xxo_Type_slots[] = { - {Py_tp_doc, "The Xxo type"}, + {Py_tp_doc, (char *)Xxo_doc}, {Py_tp_traverse, Xxo_traverse}, {Py_tp_finalize, Xxo_finalize}, + {Py_tp_dealloc, Xxo_dealloc}, {Py_tp_getattro, Xxo_getattro}, - {Py_tp_setattr, Xxo_setattr}, + {Py_tp_setattro, Xxo_setattro}, {Py_tp_methods, Xxo_methods}, - {0, 0}, + {0, 0}, /* sentinel */ }; static PyType_Spec Xxo_Type_spec = { - "xxlimited.Xxo", - sizeof(XxoObject), - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - Xxo_Type_slots + .name = "xxlimited.Xxo", + .basicsize = sizeof(XxoObject), + .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + .slots = Xxo_Type_slots, }; -/* --------------------------------------------------------------------- */ -/* Function of two integers returning integer */ +/* Str type definition*/ + +static PyType_Slot Str_Type_slots[] = { + {0, 0}, /* sentinel */ +}; + +static PyType_Spec Str_Type_spec = { + .name = "xxlimited.Str", + .basicsize = 0, + .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + .slots = Str_Type_slots, +}; + + +/* Function of two integers returning integer (with C "long int" arithmetic) */ PyDoc_STRVAR(xx_foo_doc, "foo(i,j)\n\ @@ -138,7 +250,7 @@ PyDoc_STRVAR(xx_foo_doc, Return the sum of i and j."); static PyObject * -xx_foo(PyObject *self, PyObject *args) +xx_foo(PyObject *module, PyObject *args) { long i, j; long res; @@ -152,153 +264,110 @@ xx_foo(PyObject *self, PyObject *args) /* Function of no arguments returning new Xxo object */ static PyObject * -xx_new(PyObject *self, PyObject *args) +xx_new(PyObject *module, PyObject *Py_UNUSED(unused)) { XxoObject *rv; - if (!PyArg_ParseTuple(args, ":new")) - return NULL; - rv = newXxoObject(args); + rv = newXxoObject(module); if (rv == NULL) return NULL; return (PyObject *)rv; } -/* Test bad format character */ - -static PyObject * -xx_roj(PyObject *self, PyObject *args) -{ - PyObject *a; - long b; - if (!PyArg_ParseTuple(args, "O#:roj", &a, &b)) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - - -/* ---------- */ - -static PyType_Slot Str_Type_slots[] = { - {Py_tp_base, NULL}, /* filled out in module init function */ - {0, 0}, -}; - -static PyType_Spec Str_Type_spec = { - "xxlimited.Str", - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - Str_Type_slots -}; - -/* ---------- */ - -static PyObject * -null_richcompare(PyObject *self, PyObject *other, int op) -{ - Py_RETURN_NOTIMPLEMENTED; -} - -static PyType_Slot Null_Type_slots[] = { - {Py_tp_base, NULL}, /* filled out in module init */ - {Py_tp_new, NULL}, - {Py_tp_richcompare, null_richcompare}, - {0, 0} -}; - -static PyType_Spec Null_Type_spec = { - "xxlimited.Null", - 0, /* basicsize */ - 0, /* itemsize */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - Null_Type_slots -}; -/* ---------- */ /* List of functions defined in the module */ static PyMethodDef xx_methods[] = { - {"roj", xx_roj, METH_VARARGS, - PyDoc_STR("roj(a,b) -> None")}, {"foo", xx_foo, METH_VARARGS, xx_foo_doc}, - {"new", xx_new, METH_VARARGS, + {"new", xx_new, METH_NOARGS, PyDoc_STR("new() -> new Xx object")}, {NULL, NULL} /* sentinel */ }; + +/* The module itself */ + PyDoc_STRVAR(module_doc, "This is a template module just for instruction."); static int xx_modexec(PyObject *m) { - PyObject *o; - - /* Due to cross platform compiler issues the slots must be filled - * here. It's required for portability to Windows without requiring - * C++. */ - Null_Type_slots[0].pfunc = &PyBaseObject_Type; - Null_Type_slots[1].pfunc = PyType_GenericNew; - Str_Type_slots[0].pfunc = &PyUnicode_Type; - - Xxo_Type = PyType_FromSpec(&Xxo_Type_spec); - if (Xxo_Type == NULL) - goto fail; - - /* Add some symbolic constants to the module */ - if (ErrorObject == NULL) { - ErrorObject = PyErr_NewException("xxlimited.error", NULL, NULL); - if (ErrorObject == NULL) - goto fail; + xx_state *state = PyModule_GetState(m); + + state->Error_Type = PyErr_NewException("xxlimited.Error", NULL, NULL); + if (state->Error_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, (PyTypeObject*)state->Error_Type) < 0) { + return -1; + } + + state->Xxo_Type = PyType_FromModuleAndSpec(m, &Xxo_Type_spec, NULL); + if (state->Xxo_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, (PyTypeObject*)state->Xxo_Type) < 0) { + return -1; + } + + // Add the Str type. It is not needed from C code, so it is only + // added to the module dict. + // It does not inherit from "object" (PyObject_Type), but from "str" + // (PyUnincode_Type). + PyObject *Str_Type = PyType_FromModuleAndSpec( + m, &Str_Type_spec, (PyObject *)&PyUnicode_Type); + if (Str_Type == NULL) { + return -1; + } + if (PyModule_AddType(m, (PyTypeObject*)Str_Type) < 0) { + return -1; } - Py_INCREF(ErrorObject); - PyModule_AddObject(m, "error", ErrorObject); - - /* Add Xxo */ - o = PyType_FromSpec(&Xxo_Type_spec); - if (o == NULL) - goto fail; - PyModule_AddObject(m, "Xxo", o); - - /* Add Str */ - o = PyType_FromSpec(&Str_Type_spec); - if (o == NULL) - goto fail; - PyModule_AddObject(m, "Str", o); - - /* Add Null */ - o = PyType_FromSpec(&Null_Type_spec); - if (o == NULL) - goto fail; - PyModule_AddObject(m, "Null", o); + Py_DECREF(Str_Type); + return 0; - fail: - Py_XDECREF(m); - return -1; } - static PyModuleDef_Slot xx_slots[] = { {Py_mod_exec, xx_modexec}, {0, NULL} }; +static int +xx_traverse(PyObject *module, visitproc visit, void *arg) +{ + xx_state *state = PyModule_GetState(module); + Py_VISIT(state->Xxo_Type); + Py_VISIT(state->Error_Type); + return 0; +} + +static int +xx_clear(PyObject *module) +{ + xx_state *state = PyModule_GetState(module); + Py_CLEAR(state->Xxo_Type); + Py_CLEAR(state->Error_Type); + return 0; +} + static struct PyModuleDef xxmodule = { PyModuleDef_HEAD_INIT, - "xxlimited", - module_doc, - 0, - xx_methods, - xx_slots, - NULL, - NULL, - NULL + .m_name = "xxlimited", + .m_doc = module_doc, + .m_size = sizeof(xx_state), + .m_methods = xx_methods, + .m_slots = xx_slots, + .m_traverse = xx_traverse, + .m_clear = xx_clear, + /* m_free is not necessary here: xx_clear clears all references, + * and the module state is deallocated along with the module. + */ }; + /* Export function for the module (*must* be called PyInit_xx) */ PyMODINIT_FUNC diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c new file mode 100644 index 00000000000000..ce96e8c90efd47 --- /dev/null +++ b/Modules/xxlimited_35.c @@ -0,0 +1,301 @@ + +/* This module is compiled using limited API from Python 3.5, + * making sure that it works as expected. + * + * See the xxlimited module for an extension module template. + */ + +/* Xxo objects */ + +#include "Python.h" + +static PyObject *ErrorObject; + +typedef struct { + PyObject_HEAD + PyObject *x_attr; /* Attributes dictionary */ +} XxoObject; + +static PyObject *Xxo_Type; + +#define XxoObject_Check(v) Py_IS_TYPE(v, Xxo_Type) + +static XxoObject * +newXxoObject(PyObject *arg) +{ + XxoObject *self; + self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); + if (self == NULL) + return NULL; + self->x_attr = NULL; + return self; +} + +/* Xxo methods */ + +static int +Xxo_traverse(XxoObject *self, visitproc visit, void *arg) +{ + Py_VISIT(Py_TYPE(self)); + Py_VISIT(self->x_attr); + return 0; +} + +static void +Xxo_finalize(XxoObject *self) +{ + Py_CLEAR(self->x_attr); +} + +static PyObject * +Xxo_demo(XxoObject *self, PyObject *args) +{ + PyObject *o = NULL; + if (!PyArg_ParseTuple(args, "|O:demo", &o)) + return NULL; + /* Test availability of fast type checks */ + if (o != NULL && PyUnicode_Check(o)) { + Py_INCREF(o); + return o; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef Xxo_methods[] = { + {"demo", (PyCFunction)Xxo_demo, METH_VARARGS, + PyDoc_STR("demo() -> None")}, + {NULL, NULL} /* sentinel */ +}; + +static PyObject * +Xxo_getattro(XxoObject *self, PyObject *name) +{ + if (self->x_attr != NULL) { + PyObject *v = PyDict_GetItemWithError(self->x_attr, name); + if (v != NULL) { + Py_INCREF(v); + return v; + } + else if (PyErr_Occurred()) { + return NULL; + } + } + return PyObject_GenericGetAttr((PyObject *)self, name); +} + +static int +Xxo_setattr(XxoObject *self, const char *name, PyObject *v) +{ + if (self->x_attr == NULL) { + self->x_attr = PyDict_New(); + if (self->x_attr == NULL) + return -1; + } + if (v == NULL) { + int rv = PyDict_DelItemString(self->x_attr, name); + if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) + PyErr_SetString(PyExc_AttributeError, + "delete non-existing Xxo attribute"); + return rv; + } + else + return PyDict_SetItemString(self->x_attr, name, v); +} + +static PyType_Slot Xxo_Type_slots[] = { + {Py_tp_doc, "The Xxo type"}, + {Py_tp_traverse, Xxo_traverse}, + {Py_tp_finalize, Xxo_finalize}, + {Py_tp_getattro, Xxo_getattro}, + {Py_tp_setattr, Xxo_setattr}, + {Py_tp_methods, Xxo_methods}, + {0, 0}, +}; + +static PyType_Spec Xxo_Type_spec = { + "xxlimited.Xxo", + sizeof(XxoObject), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + Xxo_Type_slots +}; + +/* --------------------------------------------------------------------- */ + +/* Function of two integers returning integer */ + +PyDoc_STRVAR(xx_foo_doc, +"foo(i,j)\n\ +\n\ +Return the sum of i and j."); + +static PyObject * +xx_foo(PyObject *self, PyObject *args) +{ + long i, j; + long res; + if (!PyArg_ParseTuple(args, "ll:foo", &i, &j)) + return NULL; + res = i+j; /* XXX Do something here */ + return PyLong_FromLong(res); +} + + +/* Function of no arguments returning new Xxo object */ + +static PyObject * +xx_new(PyObject *self, PyObject *args) +{ + XxoObject *rv; + + if (!PyArg_ParseTuple(args, ":new")) + return NULL; + rv = newXxoObject(args); + if (rv == NULL) + return NULL; + return (PyObject *)rv; +} + +/* Test bad format character */ + +static PyObject * +xx_roj(PyObject *self, PyObject *args) +{ + PyObject *a; + long b; + if (!PyArg_ParseTuple(args, "O#:roj", &a, &b)) + return NULL; + Py_INCREF(Py_None); + return Py_None; +} + + +/* ---------- */ + +static PyType_Slot Str_Type_slots[] = { + {Py_tp_base, NULL}, /* filled out in module init function */ + {0, 0}, +}; + +static PyType_Spec Str_Type_spec = { + "xxlimited.Str", + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + Str_Type_slots +}; + +/* ---------- */ + +static PyObject * +null_richcompare(PyObject *self, PyObject *other, int op) +{ + Py_RETURN_NOTIMPLEMENTED; +} + +static PyType_Slot Null_Type_slots[] = { + {Py_tp_base, NULL}, /* filled out in module init */ + {Py_tp_new, NULL}, + {Py_tp_richcompare, null_richcompare}, + {0, 0} +}; + +static PyType_Spec Null_Type_spec = { + "xxlimited.Null", + 0, /* basicsize */ + 0, /* itemsize */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + Null_Type_slots +}; + +/* ---------- */ + +/* List of functions defined in the module */ + +static PyMethodDef xx_methods[] = { + {"roj", xx_roj, METH_VARARGS, + PyDoc_STR("roj(a,b) -> None")}, + {"foo", xx_foo, METH_VARARGS, + xx_foo_doc}, + {"new", xx_new, METH_VARARGS, + PyDoc_STR("new() -> new Xx object")}, + {NULL, NULL} /* sentinel */ +}; + +PyDoc_STRVAR(module_doc, +"This is a module for testing limited API from Python 3.5."); + +static int +xx_modexec(PyObject *m) +{ + PyObject *o; + + /* Due to cross platform compiler issues the slots must be filled + * here. It's required for portability to Windows without requiring + * C++. */ + Null_Type_slots[0].pfunc = &PyBaseObject_Type; + Null_Type_slots[1].pfunc = PyType_GenericNew; + Str_Type_slots[0].pfunc = &PyUnicode_Type; + + Xxo_Type = PyType_FromSpec(&Xxo_Type_spec); + if (Xxo_Type == NULL) + goto fail; + + /* Add some symbolic constants to the module */ + if (ErrorObject == NULL) { + ErrorObject = PyErr_NewException("xxlimited.error", NULL, NULL); + if (ErrorObject == NULL) + goto fail; + } + Py_INCREF(ErrorObject); + PyModule_AddObject(m, "error", ErrorObject); + + /* Add Xxo */ + o = PyType_FromSpec(&Xxo_Type_spec); + if (o == NULL) + goto fail; + PyModule_AddObject(m, "Xxo", o); + + /* Add Str */ + o = PyType_FromSpec(&Str_Type_spec); + if (o == NULL) + goto fail; + PyModule_AddObject(m, "Str", o); + + /* Add Null */ + o = PyType_FromSpec(&Null_Type_spec); + if (o == NULL) + goto fail; + PyModule_AddObject(m, "Null", o); + return 0; + fail: + Py_XDECREF(m); + return -1; +} + + +static PyModuleDef_Slot xx_slots[] = { + {Py_mod_exec, xx_modexec}, + {0, NULL} +}; + +static struct PyModuleDef xxmodule = { + PyModuleDef_HEAD_INIT, + "xxlimited_35", + module_doc, + 0, + xx_methods, + xx_slots, + NULL, + NULL, + NULL +}; + +/* Export function for the module (*must* be called PyInit_xx) */ + +PyMODINIT_FUNC +PyInit_xxlimited_35(void) +{ + return PyModuleDef_Init(&xxmodule); +} diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 17b049c4b9a375..edcd62157c02f3 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -44,7 +44,7 @@ static void Xxo_dealloc(XxoObject *self) { Py_XDECREF(self->x_attr); - PyObject_Del(self); + PyObject_Free(self); } static PyObject * diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index def617671f18fd..a537087d19d835 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -591,7 +591,7 @@ Dealloc(compobject *self) Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); Py_XDECREF(self->zdict); - PyObject_Del(self); + PyObject_Free(self); Py_DECREF(type); } diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 2b9a79060490e5..937b44f3505524 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -13,10 +13,9 @@ class bytearray "PyByteArrayObject *" "&PyByteArray_Type" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5535b77c37a119e0]*/ +/* For PyByteArray_AS_STRING(). */ char _PyByteArray_empty_string[] = ""; -/* end nullbytes support */ - /* Helpers */ static int @@ -266,7 +265,7 @@ PyByteArray_Concat(PyObject *a, PyObject *b) result = (PyByteArrayObject *) \ PyByteArray_FromStringAndSize(NULL, va.len + vb.len); - // result->ob_bytes is NULL if result is an empty string: + // result->ob_bytes is NULL if result is an empty bytearray: // if va.len + vb.len equals zero. if (result != NULL && result->ob_bytes != NULL) { memcpy(result->ob_bytes, va.buf, va.len); @@ -1005,26 +1004,20 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op) { Py_ssize_t self_size, other_size; Py_buffer self_bytes, other_bytes; - int cmp, rc; - - /* Bytes can be compared to anything that supports the (binary) - buffer API. Except that a comparison with Unicode is always an - error, even if the comparison is for equality. */ - rc = PyObject_IsInstance(self, (PyObject*)&PyUnicode_Type); - if (!rc) - rc = PyObject_IsInstance(other, (PyObject*)&PyUnicode_Type); - if (rc < 0) - return NULL; - if (rc) { - if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) { - if (PyErr_WarnEx(PyExc_BytesWarning, - "Comparison between bytearray and string", 1)) - return NULL; + int cmp; + + if (!PyObject_CheckBuffer(self) || !PyObject_CheckBuffer(other)) { + if (PyUnicode_Check(self) || PyUnicode_Check(other)) { + if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) { + if (PyErr_WarnEx(PyExc_BytesWarning, + "Comparison between bytearray and string", 1)) + return NULL; + } } - Py_RETURN_NOTIMPLEMENTED; } + /* Bytearrays can be compared to anything that supports the buffer API. */ if (PyObject_GetBuffer(self, &self_bytes, PyBUF_SIMPLE) != 0) { PyErr_Clear(); Py_RETURN_NOTIMPLEMENTED; @@ -1332,7 +1325,7 @@ bytearray_translate_impl(PyByteArrayObject *self, PyObject *table, if (trans_table[c] != -1) *output++ = (char)trans_table[c]; } - /* Fix the size of the resulting string */ + /* Fix the size of the resulting bytearray */ if (inlen > 0) if (PyByteArray_Resize(result, output - output_start) < 0) { Py_CLEAR(result); @@ -2087,7 +2080,7 @@ bytearray.hex How many bytes between separators. Positive values count from the right, negative values count from the left. -Create a str of hexadecimal numbers from a bytearray object. +Create a string of hexadecimal numbers from a bytearray object. Example: >>> value = bytearray([0xb9, 0x01, 0xef]) @@ -2103,7 +2096,7 @@ Create a str of hexadecimal numbers from a bytearray object. static PyObject * bytearray_hex_impl(PyByteArrayObject *self, PyObject *sep, int bytes_per_sep) -/*[clinic end generated code: output=29c4e5ef72c565a0 input=814c15830ac8c4b5]*/ +/*[clinic end generated code: output=29c4e5ef72c565a0 input=808667e49bcccb54]*/ { char* argbuf = PyByteArray_AS_STRING(self); Py_ssize_t arglen = PyByteArray_GET_SIZE(self); @@ -2363,7 +2356,7 @@ PyTypeObject PyByteArray_Type = { PyObject_Del, /* tp_free */ }; -/*********************** Bytes Iterator ****************************/ +/*********************** Bytearray Iterator ****************************/ typedef struct { PyObject_HEAD diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index a9c18d5c852b79..23238e7baf5d87 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -5,6 +5,7 @@ #include "Python.h" #include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_bytes_methods.h" // _Py_bytes_startswith() +#include "pycore_format.h" // F_LJUST #include "pycore_initconfig.h" // _PyStatus_OK() #include "pycore_object.h" // _PyObject_GC_TRACK #include "pycore_pymem.h" // PYMEM_CLEANBYTE @@ -21,11 +22,11 @@ class bytes "PyBytesObject *" "&PyBytes_Type" _Py_IDENTIFIER(__bytes__); -/* PyBytesObject_SIZE gives the basic size of a string; any memory allocation - for a string of length n should request PyBytesObject_SIZE + n bytes. +/* PyBytesObject_SIZE gives the basic size of a bytes object; any memory allocation + for a bytes object of length n should request PyBytesObject_SIZE + n bytes. Using PyBytesObject_SIZE instead of sizeof(PyBytesObject) saves - 3 bytes per string allocation on a typical system. + 3 or 7 bytes per bytes object allocation on a typical system. */ #define PyBytesObject_SIZE (offsetof(PyBytesObject, ob_sval) + 1) @@ -198,7 +199,7 @@ PyBytes_FromString(const char *str) } /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size); + op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + size); if (op == NULL) { return PyErr_NoMemory(); } @@ -439,19 +440,6 @@ getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) return NULL; } -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - /* Returns a new reference to a PyBytes object, or NULL on failure. */ static char* @@ -1475,7 +1463,7 @@ bytes_repeat(PyBytesObject *a, Py_ssize_t n) "repeated bytes are too long"); return NULL; } - op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes); + op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + nbytes); if (op == NULL) { return PyErr_NoMemory(); } @@ -1538,36 +1526,19 @@ bytes_richcompare(PyBytesObject *a, PyBytesObject *b, int op) int c; Py_ssize_t len_a, len_b; Py_ssize_t min_len; - int rc; /* Make sure both arguments are strings. */ if (!(PyBytes_Check(a) && PyBytes_Check(b))) { if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) { - rc = PyObject_IsInstance((PyObject*)a, - (PyObject*)&PyUnicode_Type); - if (!rc) - rc = PyObject_IsInstance((PyObject*)b, - (PyObject*)&PyUnicode_Type); - if (rc < 0) - return NULL; - if (rc) { + if (PyUnicode_Check(a) || PyUnicode_Check(b)) { if (PyErr_WarnEx(PyExc_BytesWarning, "Comparison between bytes and string", 1)) return NULL; } - else { - rc = PyObject_IsInstance((PyObject*)a, - (PyObject*)&PyLong_Type); - if (!rc) - rc = PyObject_IsInstance((PyObject*)b, - (PyObject*)&PyLong_Type); - if (rc < 0) + if (PyLong_Check(a) || PyLong_Check(b)) { + if (PyErr_WarnEx(PyExc_BytesWarning, + "Comparison between bytes and int", 1)) return NULL; - if (rc) { - if (PyErr_WarnEx(PyExc_BytesWarning, - "Comparison between bytes and int", 1)) - return NULL; - } } } Py_RETURN_NOTIMPLEMENTED; @@ -1577,7 +1548,7 @@ bytes_richcompare(PyBytesObject *a, PyBytesObject *b, int op) case Py_EQ: case Py_LE: case Py_GE: - /* a string is equal to itself */ + /* a byte string is equal to itself */ Py_RETURN_TRUE; case Py_NE: case Py_LT: @@ -2166,7 +2137,7 @@ bytes_translate_impl(PyBytesObject *self, PyObject *table, Py_INCREF(input_obj); return input_obj; } - /* Fix the size of the resulting string */ + /* Fix the size of the resulting byte string */ if (inlen > 0) _PyBytes_Resize(&result, output - output_start); return result; @@ -2470,7 +2441,7 @@ bytes.hex How many bytes between separators. Positive values count from the right, negative values count from the left. -Create a str of hexadecimal numbers from a bytes object. +Create a string of hexadecimal numbers from a bytes object. Example: >>> value = b'\xb9\x01\xef' @@ -2486,7 +2457,7 @@ Create a str of hexadecimal numbers from a bytes object. static PyObject * bytes_hex_impl(PyBytesObject *self, PyObject *sep, int bytes_per_sep) -/*[clinic end generated code: output=1f134da504064139 input=f1238d3455990218]*/ +/*[clinic end generated code: output=1f134da504064139 input=1a21282b1f1ae595]*/ { const char *argbuf = PyBytes_AS_STRING(self); Py_ssize_t arglen = PyBytes_GET_SIZE(self); @@ -2788,7 +2759,7 @@ _PyBytes_FromIterator(PyObject *it, PyObject *x) Py_ssize_t i, size; _PyBytesWriter writer; - /* For iterator version, create a string object and resize as needed */ + /* For iterator version, create a bytes object and resize as needed */ size = PyObject_LengthHint(x, 64); if (size == -1 && PyErr_Occurred()) return NULL; @@ -3072,9 +3043,9 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize) _Py_ForgetReference(v); #endif *pv = (PyObject *) - PyObject_REALLOC(v, PyBytesObject_SIZE + newsize); + PyObject_Realloc(v, PyBytesObject_SIZE + newsize); if (*pv == NULL) { - PyObject_Del(v); + PyObject_Free(v); PyErr_NoMemory(); return -1; } diff --git a/Objects/capsule.c b/Objects/capsule.c index ed24cc1d6a2eb2..800a6c4b25c6df 100644 --- a/Objects/capsule.c +++ b/Objects/capsule.c @@ -198,7 +198,7 @@ PyCapsule_Import(const char *name, int no_block) void *return_value = NULL; char *trace; size_t name_length = (strlen(name) + 1) * sizeof(char); - char *name_dup = (char *)PyMem_MALLOC(name_length); + char *name_dup = (char *)PyMem_Malloc(name_length); if (!name_dup) { return PyErr_NoMemory(); @@ -247,7 +247,7 @@ PyCapsule_Import(const char *name, int no_block) EXIT: Py_XDECREF(object); if (name_dup) { - PyMem_FREE(name_dup); + PyMem_Free(name_dup); } return return_value; } @@ -260,7 +260,7 @@ capsule_dealloc(PyObject *o) if (capsule->destructor) { capsule->destructor(o); } - PyObject_DEL(o); + PyObject_Free(o); } diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h index 3452b241740345..1e3f197561523f 100644 --- a/Objects/clinic/bytearrayobject.c.h +++ b/Objects/clinic/bytearrayobject.c.h @@ -990,7 +990,7 @@ PyDoc_STRVAR(bytearray_hex__doc__, "hex($self, /, sep=, bytes_per_sep=1)\n" "--\n" "\n" -"Create a str of hexadecimal numbers from a bytearray object.\n" +"Create a string of hexadecimal numbers from a bytearray object.\n" "\n" " sep\n" " An optional single character or byte to separate hex bytes.\n" @@ -1120,4 +1120,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) { return bytearray_sizeof_impl(self); } -/*[clinic end generated code: output=47cd9ad3fdc3ac0c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a82659f581e55629 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h index 27ac6b106748ab..9e365ce1a088ba 100644 --- a/Objects/clinic/bytesobject.c.h +++ b/Objects/clinic/bytesobject.c.h @@ -750,7 +750,7 @@ PyDoc_STRVAR(bytes_hex__doc__, "hex($self, /, sep=, bytes_per_sep=1)\n" "--\n" "\n" -"Create a str of hexadecimal numbers from a bytes object.\n" +"Create a string of hexadecimal numbers from a bytes object.\n" "\n" " sep\n" " An optional single character or byte to separate hex bytes.\n" @@ -878,4 +878,4 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=6101b417d6a6a717 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b3f0ec2753246b9c input=a9049054013a1b77]*/ diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 7b224cc145e47f..0b0b8f98ae4f32 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -213,7 +213,7 @@ PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, PyObject *arg = PyTuple_GET_ITEM(varnames, j); int cmp = PyUnicode_Compare(cell, arg); if (cmp == -1 && PyErr_Occurred()) { - PyMem_FREE(cell2arg); + PyMem_Free(cell2arg); return NULL; } if (cmp == 0) { @@ -224,14 +224,14 @@ PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, } } if (!used_cell2arg) { - PyMem_FREE(cell2arg); + PyMem_Free(cell2arg); cell2arg = NULL; } } co = PyObject_New(PyCodeObject, &PyCode_Type); if (co == NULL) { if (cell2arg) - PyMem_FREE(cell2arg); + PyMem_Free(cell2arg); return NULL; } co->co_argcount = argcount; @@ -314,12 +314,12 @@ _PyCode_InitOpcache(PyCodeObject *co) if (opts) { co->co_opcache = (_PyOpcache *)PyMem_Calloc(opts, sizeof(_PyOpcache)); if (co->co_opcache == NULL) { - PyMem_FREE(co->co_opcache_map); + PyMem_Free(co->co_opcache_map); return -1; } } else { - PyMem_FREE(co->co_opcache_map); + PyMem_Free(co->co_opcache_map); co->co_opcache_map = NULL; co->co_opcache = NULL; } @@ -631,10 +631,10 @@ static void code_dealloc(PyCodeObject *co) { if (co->co_opcache != NULL) { - PyMem_FREE(co->co_opcache); + PyMem_Free(co->co_opcache); } if (co->co_opcache_map != NULL) { - PyMem_FREE(co->co_opcache_map); + PyMem_Free(co->co_opcache_map); } co->co_opcache_flag = 0; co->co_opcache_size = 0; @@ -664,12 +664,12 @@ code_dealloc(PyCodeObject *co) Py_XDECREF(co->co_name); Py_XDECREF(co->co_linetable); if (co->co_cell2arg != NULL) - PyMem_FREE(co->co_cell2arg); + PyMem_Free(co->co_cell2arg); if (co->co_zombieframe != NULL) PyObject_GC_Del(co->co_zombieframe); if (co->co_weakreflist != NULL) PyObject_ClearWeakRefs((PyObject*)co); - PyObject_DEL(co); + PyObject_Free(co); } static PyObject * diff --git a/Objects/complexobject.c b/Objects/complexobject.c index a481d9ad8bbaaf..a65ebdfa6cdf93 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -233,7 +233,7 @@ PyObject * PyComplex_FromCComplex(Py_complex cval) { /* Inline PyObject_New */ - PyComplexObject *op = PyObject_MALLOC(sizeof(PyComplexObject)); + PyComplexObject *op = PyObject_Malloc(sizeof(PyComplexObject)); if (op == NULL) { return PyErr_NoMemory(); } diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 8153c93e58e8a3..773ecfe777fa0c 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -269,7 +269,7 @@ _PyDict_ClearFreeList(PyThreadState *tstate) PyObject_GC_Del(op); } while (state->keys_numfree) { - PyObject_FREE(state->keys_free_list[--state->keys_numfree]); + PyObject_Free(state->keys_free_list[--state->keys_numfree]); } } @@ -597,7 +597,7 @@ new_keys_object(Py_ssize_t size) } else { - dk = PyObject_MALLOC(sizeof(PyDictKeysObject) + dk = PyObject_Malloc(sizeof(PyDictKeysObject) + es * size + sizeof(PyDictKeyEntry) * usable); if (dk == NULL) { @@ -636,11 +636,11 @@ free_keys_object(PyDictKeysObject *keys) state->keys_free_list[state->keys_numfree++] = keys; return; } - PyObject_FREE(keys); + PyObject_Free(keys); } #define new_values(size) PyMem_NEW(PyObject *, size) -#define free_values(values) PyMem_FREE(values) +#define free_values(values) PyMem_Free(values) /* Consumes a reference to the keys object */ static PyObject * @@ -1303,7 +1303,7 @@ dictresize(PyDictObject *mp, Py_ssize_t newsize) state->keys_free_list[state->keys_numfree++] = oldkeys; } else { - PyObject_FREE(oldkeys); + PyObject_Free(oldkeys); } } @@ -3990,6 +3990,11 @@ dictiter_iternextitem(dictiterobject *di) Py_INCREF(result); Py_DECREF(oldkey); Py_DECREF(oldvalue); + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } } else { result = PyTuple_New(2); @@ -4105,6 +4110,11 @@ dictreviter_iternext(dictiterobject *di) Py_INCREF(result); Py_DECREF(oldkey); Py_DECREF(oldvalue); + // bpo-42536: The GC may have untracked this result tuple. Since + // we're recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } } else { result = PyTuple_New(2); diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 8b5e7d3a3c6dd5..98ece3f13fc6fb 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -2,6 +2,7 @@ #include "Python.h" #include "pycore_long.h" // _PyLong_GetOne() +#include "pycore_object.h" // _PyObject_GC_TRACK() #include "clinic/enumobject.c.h" @@ -131,6 +132,11 @@ enum_next_long(enumobject *en, PyObject* next_item) PyTuple_SET_ITEM(result, 1, next_item); Py_DECREF(old_index); Py_DECREF(old_item); + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } return result; } result = PyTuple_New(2); @@ -176,6 +182,11 @@ enum_next(enumobject *en) PyTuple_SET_ITEM(result, 1, next_item); Py_DECREF(old_index); Py_DECREF(old_item); + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } return result; } result = PyTuple_New(2); diff --git a/Objects/exceptions.c b/Objects/exceptions.c index b14da20db0c4e7..d4824938a0f507 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2547,8 +2547,10 @@ _PyExc_Init(PyThreadState *tstate) do { \ PyObject *_code = PyLong_FromLong(CODE); \ assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \ - if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) \ + if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) { \ + Py_XDECREF(_code); \ return _PyStatus_ERR("errmap insertion problem."); \ + } \ Py_DECREF(_code); \ } while (0) diff --git a/Objects/floatobject.c b/Objects/floatobject.c index bc21ad1f46f2c8..2f932c6605b475 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -237,7 +237,7 @@ float_dealloc(PyFloatObject *op) assert(state->numfree != -1); #endif if (state->numfree >= PyFloat_MAXFREELIST) { - PyObject_FREE(op); + PyObject_Free(op); return; } state->numfree++; @@ -2033,7 +2033,7 @@ _PyFloat_ClearFreeList(PyThreadState *tstate) PyFloatObject *f = state->free_list; while (f != NULL) { PyFloatObject *next = (PyFloatObject*) Py_TYPE(f); - PyObject_FREE(f); + PyObject_Free(f); f = next; } state->free_list = NULL; diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 9b4302a13c10f8..e7961b3e6eb4b7 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -424,6 +424,25 @@ func_get_annotations(PyFunctionObject *op, void *Py_UNUSED(ignored)) if (op->func_annotations == NULL) return NULL; } + if (PyTuple_CheckExact(op->func_annotations)) { + PyObject *ann_tuple = op->func_annotations; + PyObject *ann_dict = PyDict_New(); + if (ann_dict == NULL) { + return NULL; + } + + assert(PyTuple_GET_SIZE(ann_tuple) % 2 == 0); + + for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(ann_tuple); i += 2) { + int err = PyDict_SetItem(ann_dict, + PyTuple_GET_ITEM(ann_tuple, i), + PyTuple_GET_ITEM(ann_tuple, i + 1)); + + if (err < 0) + return NULL; + } + Py_SETREF(op->func_annotations, ann_dict); + } Py_INCREF(op->func_annotations); return op->func_annotations; } diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index 28ea487a44f55f..51a12377b7e308 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -10,6 +10,7 @@ typedef struct { PyObject *origin; PyObject *args; PyObject *parameters; + PyObject* weakreflist; } gaobject; static void @@ -18,6 +19,9 @@ ga_dealloc(PyObject *self) gaobject *alias = (gaobject *)self; _PyObject_GC_UNTRACK(self); + if (alias->weakreflist != NULL) { + PyObject_ClearWeakRefs((PyObject *)alias); + } Py_XDECREF(alias->origin); Py_XDECREF(alias->args); Py_XDECREF(alias->parameters); @@ -563,7 +567,7 @@ static PyGetSetDef ga_properties[] = { static PyObject * ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - if (!_PyArg_NoKwnames("GenericAlias", kwds)) { + if (!_PyArg_NoKeywords("GenericAlias", kwds)) { return NULL; } if (!_PyArg_CheckPositional("GenericAlias", PyTuple_GET_SIZE(args), 2, 2)) { @@ -599,6 +603,7 @@ PyTypeObject Py_GenericAliasType = { .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, .tp_traverse = ga_traverse, .tp_richcompare = ga_richcompare, + .tp_weaklistoffset = offsetof(gaobject, weakreflist), .tp_methods = ga_methods, .tp_members = ga_members, .tp_alloc = PyType_GenericAlloc, @@ -630,6 +635,7 @@ Py_GenericAlias(PyObject *origin, PyObject *args) alias->origin = origin; alias->args = args; alias->parameters = NULL; + alias->weakreflist = NULL; _PyObject_GC_TRACK(alias); return (PyObject *)alias; } diff --git a/Objects/listobject.c b/Objects/listobject.c index c3aa41aac8cbba..b56646954943ea 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -341,7 +341,7 @@ list_dealloc(PyListObject *op) while (--i >= 0) { Py_XDECREF(op->ob_item[i]); } - PyMem_FREE(op->ob_item); + PyMem_Free(op->ob_item); } struct _Py_list_state *state = get_list_state(); #ifdef Py_DEBUG @@ -592,7 +592,7 @@ _list_clear(PyListObject *a) while (--i >= 0) { Py_XDECREF(item[i]); } - PyMem_FREE(item); + PyMem_Free(item); } /* Never fails; the return value can be ignored. Note that there is no guarantee that the list is actually empty @@ -668,7 +668,7 @@ list_ass_slice(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v) /* If norig == 0, item might be NULL, in which case we may not memcpy from it. */ if (s) { if (s > sizeof(recycle_on_stack)) { - recycle = (PyObject **)PyMem_MALLOC(s); + recycle = (PyObject **)PyMem_Malloc(s); if (recycle == NULL) { PyErr_NoMemory(); goto Error; @@ -706,7 +706,7 @@ list_ass_slice(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v) result = 0; Error: if (recycle != recycle_on_stack) - PyMem_FREE(recycle); + PyMem_Free(recycle); Py_XDECREF(v_as_SF); return result; #undef b @@ -2230,7 +2230,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) /* Leverage stack space we allocated but won't otherwise use */ keys = &ms.temparray[saved_ob_size+1]; else { - keys = PyMem_MALLOC(sizeof(PyObject *) * saved_ob_size); + keys = PyMem_Malloc(sizeof(PyObject *) * saved_ob_size); if (keys == NULL) { PyErr_NoMemory(); goto keyfunc_fail; @@ -2243,7 +2243,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) for (i=i-1 ; i>=0 ; i--) Py_DECREF(keys[i]); if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2) - PyMem_FREE(keys); + PyMem_Free(keys); goto keyfunc_fail; } } @@ -2414,7 +2414,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) for (i = 0; i < saved_ob_size; i++) Py_DECREF(keys[i]); if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2) - PyMem_FREE(keys); + PyMem_Free(keys); } if (self->allocated != -1 && result != NULL) { @@ -2442,7 +2442,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) while (--i >= 0) { Py_XDECREF(final_ob_item[i]); } - PyMem_FREE(final_ob_item); + PyMem_Free(final_ob_item); } Py_XINCREF(result); return result; @@ -2908,7 +2908,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) } garbage = (PyObject**) - PyMem_MALLOC(slicelength*sizeof(PyObject*)); + PyMem_Malloc(slicelength*sizeof(PyObject*)); if (!garbage) { PyErr_NoMemory(); return -1; @@ -2949,7 +2949,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) for (i = 0; i < slicelength; i++) { Py_DECREF(garbage[i]); } - PyMem_FREE(garbage); + PyMem_Free(garbage); return res; } @@ -2990,7 +2990,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) } garbage = (PyObject**) - PyMem_MALLOC(slicelength*sizeof(PyObject*)); + PyMem_Malloc(slicelength*sizeof(PyObject*)); if (!garbage) { Py_DECREF(seq); PyErr_NoMemory(); @@ -3011,7 +3011,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) Py_DECREF(garbage[i]); } - PyMem_FREE(garbage); + PyMem_Free(garbage); Py_DECREF(seq); return 0; diff --git a/Objects/longobject.c b/Objects/longobject.c index 2651873d8d70dd..2c3163ffdab156 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -131,7 +131,7 @@ _PyLong_New(Py_ssize_t size) "too many digits in integer"); return NULL; } - result = PyObject_MALLOC(offsetof(PyLongObject, ob_digit) + + result = PyObject_Malloc(offsetof(PyLongObject, ob_digit) + size*sizeof(digit)); if (!result) { PyErr_NoMemory(); diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index c3ceb788e8e690..6590387dac531b 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -211,7 +211,7 @@ _PyModule_CreateInitialized(struct PyModuleDef* module, int module_api_version) return NULL; if (module->m_size > 0) { - m->md_state = PyMem_MALLOC(module->m_size); + m->md_state = PyMem_Malloc(module->m_size); if (!m->md_state) { PyErr_NoMemory(); Py_DECREF(m); @@ -377,7 +377,7 @@ PyModule_ExecDef(PyObject *module, PyModuleDef *def) if (md->md_state == NULL) { /* Always set a state pointer; this serves as a marker to skip * multiple initialization (importlib.reload() is no-op) */ - md->md_state = PyMem_MALLOC(def->m_size); + md->md_state = PyMem_Malloc(def->m_size); if (!md->md_state) { PyErr_NoMemory(); return -1; @@ -681,7 +681,7 @@ module_dealloc(PyModuleObject *m) Py_XDECREF(m->md_dict); Py_XDECREF(m->md_name); if (m->md_state != NULL) - PyMem_FREE(m->md_state); + PyMem_Free(m->md_state); Py_TYPE(m)->tp_free((PyObject *)m); } diff --git a/Objects/object.c b/Objects/object.c index be7790eefd118f..0a8621b3503b31 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -161,7 +161,7 @@ PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size) PyObject * _PyObject_New(PyTypeObject *tp) { - PyObject *op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp)); + PyObject *op = (PyObject *) PyObject_Malloc(_PyObject_SIZE(tp)); if (op == NULL) { return PyErr_NoMemory(); } @@ -174,7 +174,7 @@ _PyObject_NewVar(PyTypeObject *tp, Py_ssize_t nitems) { PyVarObject *op; const size_t size = _PyObject_VAR_SIZE(tp, nitems); - op = (PyVarObject *) PyObject_MALLOC(size); + op = (PyVarObject *) PyObject_Malloc(size); if (op == NULL) { return (PyVarObject *)PyErr_NoMemory(); } @@ -2134,6 +2134,15 @@ _PyTrash_end(PyThreadState *tstate) } +/* bpo-40170: It's only be used in Py_TRASHCAN_BEGIN macro to hide + implementation details. */ +int +_PyTrash_cond(PyObject *op, destructor dealloc) +{ + return Py_TYPE(op)->tp_dealloc == dealloc; +} + + void _Py_NO_RETURN _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg, const char *file, int line, const char *function) diff --git a/Objects/odictobject.c b/Objects/odictobject.c index b4ac560d235815..6c7f1175cd652c 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -459,7 +459,7 @@ Potential Optimizations - implement a fuller MutableMapping API in C? - move the MutableMapping implementation to abstract.c? - optimize mutablemapping_update -- use PyObject_MALLOC (small object allocator) for odict nodes? +- use PyObject_Malloc (small object allocator) for odict nodes? - support subclasses better (e.g. in odict_richcompare) */ @@ -567,14 +567,14 @@ _odict_resize(PyODictObject *od) i = _odict_get_index_raw(od, _odictnode_KEY(node), _odictnode_HASH(node)); if (i < 0) { - PyMem_FREE(fast_nodes); + PyMem_Free(fast_nodes); return -1; } fast_nodes[i] = node; } /* Replace the old fast nodes table. */ - PyMem_FREE(od->od_fast_nodes); + PyMem_Free(od->od_fast_nodes); od->od_fast_nodes = fast_nodes; od->od_fast_nodes_size = size; od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys; @@ -683,7 +683,7 @@ _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash) } /* must not be added yet */ - node = (_ODictNode *)PyMem_MALLOC(sizeof(_ODictNode)); + node = (_ODictNode *)PyMem_Malloc(sizeof(_ODictNode)); if (node == NULL) { Py_DECREF(key); PyErr_NoMemory(); @@ -701,7 +701,7 @@ _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash) #define _odictnode_DEALLOC(node) \ do { \ Py_DECREF(_odictnode_KEY(node)); \ - PyMem_FREE((void *)node); \ + PyMem_Free((void *)node); \ } while (0) /* Repeated calls on the same node are no-ops. */ @@ -776,7 +776,7 @@ _odict_clear_nodes(PyODictObject *od) { _ODictNode *node, *next; - PyMem_FREE(od->od_fast_nodes); + PyMem_Free(od->od_fast_nodes); od->od_fast_nodes = NULL; od->od_fast_nodes_size = 0; od->od_resize_sentinel = NULL; @@ -1814,6 +1814,11 @@ odictiter_iternext(odictiterobject *di) Py_INCREF(result); Py_DECREF(PyTuple_GET_ITEM(result, 0)); /* borrowed */ Py_DECREF(PyTuple_GET_ITEM(result, 1)); /* borrowed */ + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } } else { result = PyTuple_New(2); diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 787d1138009a0c..530426c8ac9044 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -171,7 +171,7 @@ range_dealloc(rangeobject *r) Py_DECREF(r->stop); Py_DECREF(r->step); Py_DECREF(r->length); - PyObject_Del(r); + PyObject_Free(r); } /* Return number of items in range (lo, hi, step) as a PyLong object, @@ -1021,7 +1021,7 @@ longrangeiter_dealloc(longrangeiterobject *r) Py_XDECREF(r->start); Py_XDECREF(r->step); Py_XDECREF(r->len); - PyObject_Del(r); + PyObject_Free(r); } static PyObject * diff --git a/Objects/setobject.c b/Objects/setobject.c index f31dbcae8cdcfa..c9118adf754ad1 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -289,7 +289,7 @@ set_table_resize(PySetObject *so, Py_ssize_t minused) } if (is_oldtable_malloced) - PyMem_DEL(oldtable); + PyMem_Free(oldtable); return 0; } @@ -424,7 +424,7 @@ set_clear_internal(PySetObject *so) } if (table_is_malloced) - PyMem_DEL(table); + PyMem_Free(table); return 0; } @@ -484,7 +484,7 @@ set_dealloc(PySetObject *so) } } if (so->table != so->smalltable) - PyMem_DEL(so->table); + PyMem_Free(so->table); Py_TYPE(so)->tp_free(so); Py_TRASHCAN_END } diff --git a/Objects/stringlib/join.h b/Objects/stringlib/join.h index 53bcbdea7ade9d..62e4c98de7f250 100644 --- a/Objects/stringlib/join.h +++ b/Objects/stringlib/join.h @@ -155,7 +155,7 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) for (i = 0; i < nbufs; i++) PyBuffer_Release(&buffers[i]); if (buffers != static_buffers) - PyMem_FREE(buffers); + PyMem_Free(buffers); return res; } diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h index b526ad21b8205d..7152ec6ebe7128 100644 --- a/Objects/stringlib/unicode_format.h +++ b/Objects/stringlib/unicode_format.h @@ -983,7 +983,7 @@ static void formatteriter_dealloc(formatteriterobject *it) { Py_XDECREF(it->str); - PyObject_FREE(it); + PyObject_Free(it); } /* returns a tuple: @@ -1147,7 +1147,7 @@ static void fieldnameiter_dealloc(fieldnameiterobject *it) { Py_XDECREF(it->str); - PyObject_FREE(it); + PyObject_Free(it); } /* returns a tuple: diff --git a/Objects/structseq.c b/Objects/structseq.c index 5caa3bd52e4d4f..5d71fcff3461a0 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -467,14 +467,14 @@ PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc) type->tp_members = members; if (PyType_Ready(type) < 0) { - PyMem_FREE(members); + PyMem_Free(members); return -1; } Py_INCREF(type); if (initialize_structseq_dict( desc, type->tp_dict, n_members, n_unnamed_members) < 0) { - PyMem_FREE(members); + PyMem_Free(members); Py_DECREF(type); return -1; } @@ -492,7 +492,6 @@ PyTypeObject * PyStructSequence_NewType(PyStructSequence_Desc *desc) { PyMemberDef *members; - PyObject *bases; PyTypeObject *type; PyType_Slot slots[8]; PyType_Spec spec; @@ -526,14 +525,8 @@ PyStructSequence_NewType(PyStructSequence_Desc *desc) spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC; spec.slots = slots; - bases = PyTuple_Pack(1, &PyTuple_Type); - if (bases == NULL) { - PyMem_FREE(members); - return NULL; - } - type = (PyTypeObject *)PyType_FromSpecWithBases(&spec, bases); - Py_DECREF(bases); - PyMem_FREE(members); + type = (PyTypeObject *)PyType_FromSpecWithBases(&spec, (PyObject *)&PyTuple_Type); + PyMem_Free(members); if (type == NULL) { return NULL; } diff --git a/Objects/typeobject.c b/Objects/typeobject.c index cea410443bb58e..66d5ed5c0770de 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1059,7 +1059,7 @@ PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) obj = _PyObject_GC_Malloc(size); } else { - obj = (PyObject *)PyObject_MALLOC(size); + obj = (PyObject *)PyObject_Malloc(size); } if (obj == NULL) { @@ -1779,7 +1779,7 @@ pmerge(PyObject *acc, PyObject **to_merge, Py_ssize_t to_merge_size) } out: - PyMem_Del(remain); + PyMem_Free(remain); return res; } @@ -1859,7 +1859,7 @@ mro_implementation(PyTypeObject *type) result = PyList_New(1); if (result == NULL) { - PyMem_Del(to_merge); + PyMem_Free(to_merge); return NULL; } @@ -1869,7 +1869,7 @@ mro_implementation(PyTypeObject *type) Py_CLEAR(result); } - PyMem_Del(to_merge); + PyMem_Free(to_merge); return result; } @@ -2707,7 +2707,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) goto error; /* Silently truncate the docstring if it contains null bytes. */ len = strlen(doc_str); - tp_doc = (char *)PyObject_MALLOC(len + 1); + tp_doc = (char *)PyObject_Malloc(len + 1); if (tp_doc == NULL) { PyErr_NoMemory(); goto error; @@ -2977,26 +2977,41 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) base = slot->pfunc; else if (slot->slot == Py_tp_bases) { bases = slot->pfunc; - Py_INCREF(bases); } } - if (!bases) + if (!bases) { bases = PyTuple_Pack(1, base); + if (!bases) + goto fail; + } + else if (!PyTuple_Check(bases)) { + PyErr_SetString(PyExc_SystemError, "Py_tp_bases is not a tuple"); + goto fail; + } + else { + Py_INCREF(bases); + } + } + else if (!PyTuple_Check(bases)) { + bases = PyTuple_Pack(1, bases); if (!bases) goto fail; } - else + else { Py_INCREF(bases); + } /* Calculate best base, and check that all bases are type objects */ base = best_base(bases); if (base == NULL) { + Py_DECREF(bases); goto fail; } if (!_PyType_HasFeature(base, Py_TPFLAGS_BASETYPE)) { PyErr_Format(PyExc_TypeError, "type '%.100s' is not an acceptable base type", base->tp_name); + Py_DECREF(bases); goto fail; } @@ -3008,7 +3023,6 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) type->tp_as_buffer = &res->as_buffer; /* Set tp_base and tp_bases */ type->tp_bases = bases; - bases = NULL; Py_INCREF(base); type->tp_base = base; @@ -3033,7 +3047,7 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) continue; } size_t len = strlen(slot->pfunc)+1; - char *tp_doc = PyObject_MALLOC(len); + char *tp_doc = PyObject_Malloc(len); if (tp_doc == NULL) { type->tp_doc = NULL; PyErr_NoMemory(); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ab6112c82234a0..fd3ad585618b13 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -42,6 +42,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "Python.h" #include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_bytes_methods.h" // _Py_bytes_lower() +#include "pycore_format.h" // F_LJUST #include "pycore_initconfig.h" // _PyStatus_OK() #include "pycore_interp.h" // PyInterpreterState.fs_codec #include "pycore_object.h" // _PyObject_GC_TRACK() @@ -839,7 +840,11 @@ xmlcharrefreplace(_PyBytesWriter *writer, char *str, /* generate replacement */ for (i = collstart; i < collend; ++i) { - str += sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i)); + size = sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i)); + if (size < 0) { + return NULL; + } + str += size; } return str; } @@ -1057,7 +1062,7 @@ resize_compact(PyObject *unicode, Py_ssize_t length) new_size = (struct_size + (length + 1) * char_size); if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) { - PyObject_DEL(_PyUnicode_UTF8(unicode)); + PyObject_Free(_PyUnicode_UTF8(unicode)); _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; } @@ -1068,7 +1073,7 @@ resize_compact(PyObject *unicode, Py_ssize_t length) _Py_ForgetReference(unicode); #endif - new_unicode = (PyObject *)PyObject_REALLOC(unicode, new_size); + new_unicode = (PyObject *)PyObject_Realloc(unicode, new_size); if (new_unicode == NULL) { _Py_NewReference(unicode); PyErr_NoMemory(); @@ -1084,7 +1089,7 @@ resize_compact(PyObject *unicode, Py_ssize_t length) _PyUnicode_WSTR_LENGTH(unicode) = length; } else if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) { - PyObject_DEL(_PyUnicode_WSTR(unicode)); + PyObject_Free(_PyUnicode_WSTR(unicode)); _PyUnicode_WSTR(unicode) = NULL; if (!PyUnicode_IS_ASCII(unicode)) _PyUnicode_WSTR_LENGTH(unicode) = 0; @@ -1127,12 +1132,12 @@ resize_inplace(PyObject *unicode, Py_ssize_t length) if (!share_utf8 && _PyUnicode_HAS_UTF8_MEMORY(unicode)) { - PyObject_DEL(_PyUnicode_UTF8(unicode)); + PyObject_Free(_PyUnicode_UTF8(unicode)); _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; } - data = (PyObject *)PyObject_REALLOC(data, new_size); + data = (PyObject *)PyObject_Realloc(data, new_size); if (data == NULL) { PyErr_NoMemory(); return -1; @@ -1165,7 +1170,7 @@ resize_inplace(PyObject *unicode, Py_ssize_t length) } new_size = sizeof(wchar_t) * (length + 1); wstr = _PyUnicode_WSTR(unicode); - wstr = PyObject_REALLOC(wstr, new_size); + wstr = PyObject_Realloc(wstr, new_size); if (!wstr) { PyErr_NoMemory(); return -1; @@ -1255,7 +1260,7 @@ _PyUnicode_New(Py_ssize_t length) _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; - _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_MALLOC(new_size); + _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_Malloc(new_size); if (!_PyUnicode_WSTR(unicode)) { Py_DECREF(unicode); PyErr_NoMemory(); @@ -1452,7 +1457,7 @@ PyUnicode_New(Py_ssize_t size, Py_UCS4 maxchar) * PyObject_New() so we are able to allocate space for the object and * it's data buffer. */ - obj = (PyObject *) PyObject_MALLOC(struct_size + (size + 1) * char_size); + obj = (PyObject *) PyObject_Malloc(struct_size + (size + 1) * char_size); if (obj == NULL) { return PyErr_NoMemory(); } @@ -1834,7 +1839,7 @@ _PyUnicode_Ready(PyObject *unicode) return -1; if (maxchar < 256) { - _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(_PyUnicode_WSTR_LENGTH(unicode) + 1); + _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(_PyUnicode_WSTR_LENGTH(unicode) + 1); if (!_PyUnicode_DATA_ANY(unicode)) { PyErr_NoMemory(); return -1; @@ -1855,7 +1860,7 @@ _PyUnicode_Ready(PyObject *unicode) _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; } - PyObject_FREE(_PyUnicode_WSTR(unicode)); + PyObject_Free(_PyUnicode_WSTR(unicode)); _PyUnicode_WSTR(unicode) = NULL; _PyUnicode_WSTR_LENGTH(unicode) = 0; } @@ -1875,7 +1880,7 @@ _PyUnicode_Ready(PyObject *unicode) _PyUnicode_UTF8_LENGTH(unicode) = 0; #else /* sizeof(wchar_t) == 4 */ - _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC( + _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc( 2 * (_PyUnicode_WSTR_LENGTH(unicode) + 1)); if (!_PyUnicode_DATA_ANY(unicode)) { PyErr_NoMemory(); @@ -1889,7 +1894,7 @@ _PyUnicode_Ready(PyObject *unicode) _PyUnicode_STATE(unicode).kind = PyUnicode_2BYTE_KIND; _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; - PyObject_FREE(_PyUnicode_WSTR(unicode)); + PyObject_Free(_PyUnicode_WSTR(unicode)); _PyUnicode_WSTR(unicode) = NULL; _PyUnicode_WSTR_LENGTH(unicode) = 0; #endif @@ -1904,7 +1909,7 @@ _PyUnicode_Ready(PyObject *unicode) PyErr_NoMemory(); return -1; } - _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(4 * (length_wo_surrogates + 1)); + _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(4 * (length_wo_surrogates + 1)); if (!_PyUnicode_DATA_ANY(unicode)) { PyErr_NoMemory(); return -1; @@ -1916,7 +1921,7 @@ _PyUnicode_Ready(PyObject *unicode) /* unicode_convert_wchar_to_ucs4() requires a ready string */ _PyUnicode_STATE(unicode).ready = 1; unicode_convert_wchar_to_ucs4(_PyUnicode_WSTR(unicode), end, unicode); - PyObject_FREE(_PyUnicode_WSTR(unicode)); + PyObject_Free(_PyUnicode_WSTR(unicode)); _PyUnicode_WSTR(unicode) = NULL; _PyUnicode_WSTR_LENGTH(unicode) = 0; #else @@ -1969,13 +1974,13 @@ unicode_dealloc(PyObject *unicode) } if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) { - PyObject_DEL(_PyUnicode_WSTR(unicode)); + PyObject_Free(_PyUnicode_WSTR(unicode)); } if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) { - PyObject_DEL(_PyUnicode_UTF8(unicode)); + PyObject_Free(_PyUnicode_UTF8(unicode)); } if (!PyUnicode_IS_COMPACT(unicode) && _PyUnicode_DATA_ANY(unicode)) { - PyObject_DEL(_PyUnicode_DATA_ANY(unicode)); + PyObject_Free(_PyUnicode_DATA_ANY(unicode)); } Py_TYPE(unicode)->tp_free(unicode); @@ -3294,7 +3299,7 @@ PyUnicode_AsWideCharString(PyObject *unicode, *size = buflen; } else if (wcslen(buffer) != (size_t)buflen) { - PyMem_FREE(buffer); + PyMem_Free(buffer); PyErr_SetString(PyExc_ValueError, "embedded null character"); return NULL; @@ -4195,7 +4200,7 @@ PyUnicode_AsUnicodeAndSize(PyObject *unicode, Py_ssize_t *size) PyErr_NoMemory(); return NULL; } - w = (wchar_t *) PyObject_MALLOC(sizeof(wchar_t) * (wlen + 1)); + w = (wchar_t *) PyObject_Malloc(sizeof(wchar_t) * (wlen + 1)); if (w == NULL) { PyErr_NoMemory(); return NULL; @@ -5623,7 +5628,7 @@ unicode_fill_utf8(PyObject *unicode) PyBytes_AS_STRING(writer.buffer); Py_ssize_t len = end - start; - char *cache = PyObject_MALLOC(len + 1); + char *cache = PyObject_Malloc(len + 1); if (cache == NULL) { _PyBytesWriter_Dealloc(&writer); PyErr_NoMemory(); @@ -8540,7 +8545,7 @@ PyUnicode_BuildEncodingMap(PyObject* string) } /* Create a three-level trie */ - result = PyObject_MALLOC(sizeof(struct encoding_map) + + result = PyObject_Malloc(sizeof(struct encoding_map) + 16*count2 + 128*count3 - 1); if (!result) { return PyErr_NoMemory(); @@ -10207,7 +10212,7 @@ case_operation(PyObject *self, PyErr_SetString(PyExc_OverflowError, "string is too long"); return NULL; } - tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length); + tmp = PyMem_Malloc(sizeof(Py_UCS4) * 3 * length); if (tmp == NULL) return PyErr_NoMemory(); newlength = perform(kind, data, length, tmp, &maxchar); @@ -10231,7 +10236,7 @@ case_operation(PyObject *self, Py_UNREACHABLE(); } leave: - PyMem_FREE(tmp); + PyMem_Free(tmp); return res; } @@ -11046,11 +11051,11 @@ replace(PyObject *self, PyObject *str1, assert(release1 == (buf1 != PyUnicode_DATA(str1))); assert(release2 == (buf2 != PyUnicode_DATA(str2))); if (srelease) - PyMem_FREE((void *)sbuf); + PyMem_Free((void *)sbuf); if (release1) - PyMem_FREE((void *)buf1); + PyMem_Free((void *)buf1); if (release2) - PyMem_FREE((void *)buf2); + PyMem_Free((void *)buf2); assert(_PyUnicode_CheckConsistency(u, 1)); return u; @@ -11060,11 +11065,11 @@ replace(PyObject *self, PyObject *str1, assert(release1 == (buf1 != PyUnicode_DATA(str1))); assert(release2 == (buf2 != PyUnicode_DATA(str2))); if (srelease) - PyMem_FREE((void *)sbuf); + PyMem_Free((void *)sbuf); if (release1) - PyMem_FREE((void *)buf1); + PyMem_Free((void *)buf1); if (release2) - PyMem_FREE((void *)buf2); + PyMem_Free((void *)buf2); return unicode_result_unchanged(self); error: @@ -11072,11 +11077,11 @@ replace(PyObject *self, PyObject *str1, assert(release1 == (buf1 != PyUnicode_DATA(str1))); assert(release2 == (buf2 != PyUnicode_DATA(str2))); if (srelease) - PyMem_FREE((void *)sbuf); + PyMem_Free((void *)sbuf); if (release1) - PyMem_FREE((void *)buf1); + PyMem_Free((void *)buf1); if (release2) - PyMem_FREE((void *)buf2); + PyMem_Free((void *)buf2); return NULL; } @@ -15563,7 +15568,7 @@ unicode_subtype_new(PyTypeObject *type, PyObject *unicode) PyErr_NoMemory(); goto onError; } - data = PyObject_MALLOC((length + 1) * char_size); + data = PyObject_Malloc((length + 1) * char_size); if (data == NULL) { PyErr_NoMemory(); goto onError; diff --git a/PC/_msi.c b/PC/_msi.c index 504899d0757b78..01516e85ccff30 100644 --- a/PC/_msi.c +++ b/PC/_msi.c @@ -351,7 +351,7 @@ msiobj_dealloc(msiobj* msidb) { MsiCloseHandle(msidb->h); msidb->h = 0; - PyObject_Del(msidb); + PyObject_Free(msidb); } static PyObject* diff --git a/PC/launcher.c b/PC/launcher.c index 7ca2f2387801c9..cc2d35b2c4cb7c 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -425,11 +425,21 @@ compare_pythons(const void * p1, const void * p2) INSTALLED_PYTHON * ip1 = (INSTALLED_PYTHON *) p1; INSTALLED_PYTHON * ip2 = (INSTALLED_PYTHON *) p2; /* note reverse sorting on version */ - int result = wcscmp(ip2->version, ip1->version); - - if (result == 0) - result = ip2->bits - ip1->bits; /* 64 before 32 */ - return result; + int result = CompareStringW(LOCALE_INVARIANT, SORT_DIGITSASNUMBERS, + ip2->version, -1, ip1->version, -1); + switch (result) { + case 0: + error(0, L"CompareStringW failed"); + return 0; + case CSTR_LESS_THAN: + return -1; + case CSTR_EQUAL: + return ip2->bits - ip1->bits; /* 64 before 32 */ + case CSTR_GREATER_THAN: + return 1; + default: + return 0; // This should never be reached. + } } static void diff --git a/PC/layout/main.py b/PC/layout/main.py index 3eef7556299cf2..8c69c91542d246 100644 --- a/PC/layout/main.py +++ b/PC/layout/main.py @@ -36,7 +36,7 @@ BDIST_WININST_FILES_ONLY = FileNameSet("wininst-*", "bdist_wininst.py") BDIST_WININST_STUB = "PC/layout/support/distutils.command.bdist_wininst.py" -TEST_PYDS_ONLY = FileStemSet("xxlimited", "_ctypes_test", "_test*") +TEST_PYDS_ONLY = FileStemSet("xxlimited", "xxlimited_35", "_ctypes_test", "_test*") TEST_DIRS_ONLY = FileNameSet("test", "tests") IDLE_DIRS_ONLY = FileNameSet("idlelib") diff --git a/PC/pyconfig.h b/PC/pyconfig.h index b29f63c35bccb1..592b487adcb458 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -193,7 +193,6 @@ typedef int pid_t; #define Py_IS_NAN _isnan #define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X)) #define Py_IS_FINITE(X) _finite(X) -#define copysign _copysign /* define some ANSI types that are not defined in earlier Win headers */ #if _MSC_VER >= 1200 diff --git a/PC/winreg.c b/PC/winreg.c index 78c08693a8ace3..d62a7be28d3fab 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -145,7 +145,7 @@ PyHKEY_deallocFunc(PyObject *ob) PyHKEYObject *obkey = (PyHKEYObject *)ob; if (obkey->hkey) RegCloseKey((HKEY)obkey->hkey); - PyObject_DEL(ob); + PyObject_Free(ob); } static int @@ -459,7 +459,7 @@ PyObject * PyHKEY_FromHKEY(HKEY h) { /* Inline PyObject_New */ - PyHKEYObject *op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject)); + PyHKEYObject *op = (PyHKEYObject *) PyObject_Malloc(sizeof(PyHKEYObject)); if (op == NULL) { return PyErr_NoMemory(); } @@ -1818,7 +1818,7 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key, Py_BEGIN_ALLOW_THREADS rc = RegSetValueExW(key, value_name, 0, type, data, len); Py_END_ALLOW_THREADS - PyMem_DEL(data); + PyMem_Free(data); if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegSetValueEx"); diff --git a/PCbuild/build.bat b/PCbuild/build.bat index ba7154d8cb1e56..5a41ca57b12391 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -46,7 +46,7 @@ echo.Available arguments: echo. -c Release ^| Debug ^| PGInstrument ^| PGUpdate echo. Set the configuration (default: Release) echo. -p x64 ^| Win32 ^| ARM ^| ARM64 -echo. Set the platform (default: Win32) +echo. Set the platform (default: x64) echo. -t Build ^| Rebuild ^| Clean ^| CleanAll echo. Set the target manually echo. --pgo-job The job to use for PGO training; implies --pgo @@ -55,7 +55,7 @@ exit /b 127 :Run setlocal -set platf=Win32 +set platf=x64 set conf=Release set target=Build set dir=%~dp0 diff --git a/PCbuild/env.bat b/PCbuild/env.bat index 9d4c9d1c32f7a4..2820e304582cff 100644 --- a/PCbuild/env.bat +++ b/PCbuild/env.bat @@ -9,8 +9,19 @@ rem 'v110', 'v120' or 'v140') to the build script. echo Build environments: x86, amd64, x86_amd64 echo. -set VSTOOLS=%VS140COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS120COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS110COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS100COMNTOOLS% -call "%VSTOOLS%..\..\VC\vcvarsall.bat" %* +set _ARGS=%* +if NOT DEFINED _ARGS set _ARGS=amd64 + +if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere +set VSTOOLS= +for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set VSTOOLS=%%i\VC\Auxiliary\Build\vcvarsall.bat) +if not defined VSTOOLS goto :skip_vswhere +call "%VSTOOLS%" %_ARGS% +exit /B 0 + +:skip_vswhere +if not defined VSTOOLS set VSTOOLS=%VS140COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS120COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS110COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS100COMNTOOLS% +call "%VSTOOLS%..\..\VC\vcvarsall.bat" %_ARGS% diff --git a/PCbuild/env.ps1 b/PCbuild/env.ps1 new file mode 100644 index 00000000000000..19d7ada4c10798 --- /dev/null +++ b/PCbuild/env.ps1 @@ -0,0 +1,2 @@ +$pcbuild = $script:MyInvocation.MyCommand.Path | Split-Path -parent; +& cmd /K "$pcbuild\env.bat" $args diff --git a/PCbuild/idle.bat b/PCbuild/idle.bat index 1978b99f6ee19d..70f3817f09769c 100644 --- a/PCbuild/idle.bat +++ b/PCbuild/idle.bat @@ -4,12 +4,24 @@ rem Usage: idle [-d] rem -d Run Debug build (python_d.exe). Else release build. setlocal -set exe=win32\python +set PCBUILD=%~dp0 +set exedir=%PCBUILD%\amd64 +set exe=python PATH %PATH%;..\externals\tcltk\bin -if "%1"=="-d" (set exe=%exe%_d) & shift +:CheckOpts +if "%1"=="-d" (set exe=%exe%_d) & shift & goto :CheckOpts +if "%1"=="-p" (call :SetExeDir %2) & shift & shift & goto :CheckOpts -set cmd=%exe% ../Lib/idlelib/idle.py %1 %2 %3 %4 %5 %6 %7 %8 %9 +set cmd=%exedir%\%exe% %PCBUILD%\..\Lib\idlelib\idle.py %1 %2 %3 %4 %5 %6 %7 %8 %9 echo on %cmd% +exit /B %LASTERRORCODE% + +:SetExeDir +if /I %1 EQU Win32 (set exedir=%PCBUILD%\win32) +if /I %1 EQU x64 (set exedir=%PCBUILD%\amd64) +if /I %1 EQU ARM (set exedir=%PCBUILD%\arm32) +if /I %1 EQU ARM64 (set exedir=%PCBUILD%\arm64) +exit /B 0 diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index 4d416c589e4c47..8e7088d47d2aed 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -66,6 +66,7 @@ + false diff --git a/PCbuild/prepare_libffi.bat b/PCbuild/prepare_libffi.bat index f41ba83379af96..922a47565c8da5 100644 --- a/PCbuild/prepare_libffi.bat +++ b/PCbuild/prepare_libffi.bat @@ -22,10 +22,10 @@ echo Based on https://github.com/libffi/libffi/blob/master/.appveyor.yml echo. echo. echo.Available flags: -echo. -x64 build for x64 -echo. -x86 build for x86 -echo. -arm32 build for arm32 -echo. -arm64 build for arm64 +echo. -x64 enable x64 build +echo. -x86 enable x86 build +echo. -arm32 enable arm32 build +echo. -arm64 enable arm64 build echo. -? this help echo. --install-cygwin install cygwin to c:\cygwin exit /b 127 @@ -44,6 +44,7 @@ set INSTALL_CYGWIN= if "%1"=="" goto :CheckOptsDone if /I "%1"=="-x64" (set BUILD_X64=1) & shift & goto :CheckOpts if /I "%1"=="-x86" (set BUILD_X86=1) & shift & goto :CheckOpts +if /I "%1"=="-win32" (set BUILD_X86=1) & shift & goto :CheckOpts if /I "%1"=="-arm32" (set BUILD_ARM32=1) & shift & goto :CheckOpts if /I "%1"=="-arm64" (set BUILD_ARM64=1) & shift & goto :CheckOpts if /I "%1"=="-pdb" (set BUILD_PDB=-g) & shift & goto :CheckOpts @@ -67,9 +68,7 @@ setlocal if NOT DEFINED SH if exist c:\cygwin\bin\sh.exe set SH=c:\cygwin\bin\sh.exe if NOT DEFINED VCVARSALL ( - if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ( - set VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" - ) + for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set VCVARSALL="%%i\VC\Auxiliary\Build\vcvarsall.bat") ) if ^%VCVARSALL:~0,1% NEQ ^" SET VCVARSALL="%VCVARSALL%" diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 18edba855d6161..bbceb025c0c22e 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -146,6 +146,7 @@ + @@ -176,6 +177,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 281bce1c5f4986..ee1aa90bf76886 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -459,6 +459,9 @@ Include\cpython + + Include\cpython + Include\cpython @@ -510,6 +513,9 @@ Include\internal + + Include\internal + Include\internal diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 73833d54637d5f..4335c9f71d0d26 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -125,6 +125,9 @@ python3dll xxlimited builds an example module that makes use of the PEP 384 Stable ABI, see Modules\xxlimited.c +xxlimited_35 + ditto for testing the Python 3.5 stable ABI, see + Modules\xxlimited_35.c The following sub-projects are for individual modules of the standard library which are implemented in C; each one builds a DLL (renamed to diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat index 59f757c0f5888a..29813c5a87fca7 100644 --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -6,8 +6,9 @@ rem -O Run python.exe or python_d.exe (see -d) with -O. rem -q "quick" -- normally the tests are run twice, the first time rem after deleting all the .pyc files reachable from Lib/. rem -q runs the tests just once, and without deleting .pyc files. -rem -x64 Run the 64-bit build of python (or python_d if -d was specified) -rem When omitted, uses %PREFIX% if set or the 32-bit build +rem -p or -win32, -x64, -arm32, -arm64 +rem Run the specified architecture of python (or python_d if -d +rem was specified). If omitted, uses %PREFIX% if set or 64-bit. rem All leading instances of these switches are shifted off, and rem whatever remains (up to 9 arguments) is passed to regrtest.py. rem For example, @@ -38,12 +39,14 @@ set exe= if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts +if "%1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts if "%1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts if "%1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts +if "%1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts -if not defined prefix set prefix=%pcbuild%win32 +if not defined prefix set prefix=%pcbuild%amd64 set exe=%prefix%\python%suffix%.exe set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs% if defined qmode goto Qmode @@ -60,6 +63,15 @@ echo on echo About to run again without deleting .pyc first: pause +goto Qmode + +:SetPlatform +if /I %1 EQU Win32 (set prefix=%pcbuild%win32) & exit /B 0 +if /I %1 EQU x64 (set prefix=%pcbuild%amd64) & exit /B 0 +if /I %1 EQU ARM64 (set prefix=%pcbuild%arm64) & exit /B 0 +if /I %1 EQU ARM (set prefix=%pcbuild%arm32) & exit /B 0 +echo Invalid platform "%1" +exit /B 1 :Qmode echo on diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj index 776335a15cb0c4..ece169127a2860 100644 --- a/PCbuild/xxlimited.vcxproj +++ b/PCbuild/xxlimited.vcxproj @@ -94,7 +94,7 @@ - %(PreprocessorDefinitions);Py_LIMITED_API=0x03060000 + %(PreprocessorDefinitions);Py_LIMITED_API=0x03100000 wsock32.lib;%(AdditionalDependencies) @@ -111,4 +111,4 @@ - \ No newline at end of file + diff --git a/PCbuild/xxlimited_35.vcxproj b/PCbuild/xxlimited_35.vcxproj new file mode 100644 index 00000000000000..7e49eadf9037da --- /dev/null +++ b/PCbuild/xxlimited_35.vcxproj @@ -0,0 +1,114 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + ARM + + + PGInstrument + ARM64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + ARM + + + PGUpdate + ARM64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {fb868ea7-f93a-4d9b-be78-ca4e9ba14fff} + xxlimited_35 + Win32Proj + + + + + DynamicLibrary + NotSet + false + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + %(PreprocessorDefinitions);Py_LIMITED_API=0x03060000 + + + wsock32.lib;%(AdditionalDependencies) + + + + + + + + {885d4898-d08d-4091-9c40-c700cfe3fc5a} + + + + + + diff --git a/PCbuild/xxlimited_35.vcxproj.filters b/PCbuild/xxlimited_35.vcxproj.filters new file mode 100644 index 00000000000000..35bfb05c239c35 --- /dev/null +++ b/PCbuild/xxlimited_35.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {5be27194-6530-452d-8d86-3767b991fa83} + + + + + Source Files + + + diff --git a/Parser/parser.c b/Parser/parser.c index 5b318f5b75c46f..833edada75e727 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -75,8 +75,8 @@ static KeywordToken *reserved_keywords[] = { #define statements_type 1006 #define statement_type 1007 #define statement_newline_type 1008 -#define simple_stmt_type 1009 -#define small_stmt_type 1010 +#define simple_stmts_type 1009 +#define simple_stmt_type 1010 #define compound_stmt_type 1011 #define assignment_type 1012 #define augassign_type 1013 @@ -155,281 +155,278 @@ static KeywordToken *reserved_keywords[] = { #define class_def_type 1086 #define class_def_raw_type 1087 #define block_type 1088 -#define expressions_list_type 1089 -#define star_expressions_type 1090 -#define star_expression_type 1091 -#define star_named_expressions_type 1092 -#define star_named_expression_type 1093 -#define named_expression_type 1094 -#define annotated_rhs_type 1095 -#define expressions_type 1096 -#define expression_type 1097 -#define lambdef_type 1098 -#define lambda_params_type 1099 -#define lambda_parameters_type 1100 -#define lambda_slash_no_default_type 1101 -#define lambda_slash_with_default_type 1102 -#define lambda_star_etc_type 1103 -#define lambda_kwds_type 1104 -#define lambda_param_no_default_type 1105 -#define lambda_param_with_default_type 1106 -#define lambda_param_maybe_default_type 1107 -#define lambda_param_type 1108 -#define disjunction_type 1109 -#define conjunction_type 1110 -#define inversion_type 1111 -#define comparison_type 1112 -#define compare_op_bitwise_or_pair_type 1113 -#define eq_bitwise_or_type 1114 -#define noteq_bitwise_or_type 1115 -#define lte_bitwise_or_type 1116 -#define lt_bitwise_or_type 1117 -#define gte_bitwise_or_type 1118 -#define gt_bitwise_or_type 1119 -#define notin_bitwise_or_type 1120 -#define in_bitwise_or_type 1121 -#define isnot_bitwise_or_type 1122 -#define is_bitwise_or_type 1123 -#define bitwise_or_type 1124 // Left-recursive -#define bitwise_xor_type 1125 // Left-recursive -#define bitwise_and_type 1126 // Left-recursive -#define shift_expr_type 1127 // Left-recursive -#define sum_type 1128 // Left-recursive -#define term_type 1129 // Left-recursive -#define factor_type 1130 -#define power_type 1131 -#define await_primary_type 1132 -#define primary_type 1133 // Left-recursive -#define slices_type 1134 -#define slice_type 1135 -#define atom_type 1136 -#define strings_type 1137 -#define list_type 1138 -#define listcomp_type 1139 -#define tuple_type 1140 -#define group_type 1141 -#define genexp_type 1142 -#define set_type 1143 -#define setcomp_type 1144 -#define dict_type 1145 -#define dictcomp_type 1146 -#define double_starred_kvpairs_type 1147 -#define double_starred_kvpair_type 1148 -#define kvpair_type 1149 -#define for_if_clauses_type 1150 -#define for_if_clause_type 1151 -#define yield_expr_type 1152 -#define arguments_type 1153 -#define args_type 1154 -#define kwargs_type 1155 -#define starred_expression_type 1156 -#define kwarg_or_starred_type 1157 -#define kwarg_or_double_starred_type 1158 -#define star_targets_type 1159 -#define star_targets_seq_type 1160 -#define star_target_type 1161 -#define star_atom_type 1162 -#define single_target_type 1163 -#define single_subscript_attribute_target_type 1164 -#define del_targets_type 1165 -#define del_target_type 1166 -#define del_t_atom_type 1167 -#define targets_type 1168 -#define target_type 1169 -#define t_primary_type 1170 // Left-recursive -#define t_lookahead_type 1171 -#define t_atom_type 1172 -#define invalid_arguments_type 1173 -#define invalid_kwarg_type 1174 -#define invalid_named_expression_type 1175 -#define invalid_assignment_type 1176 -#define invalid_ann_assign_target_type 1177 -#define invalid_del_stmt_type 1178 -#define invalid_block_type 1179 -#define invalid_primary_type 1180 // Left-recursive -#define invalid_comprehension_type 1181 -#define invalid_dict_comprehension_type 1182 -#define invalid_parameters_type 1183 -#define invalid_lambda_parameters_type 1184 -#define invalid_star_etc_type 1185 -#define invalid_lambda_star_etc_type 1186 -#define invalid_double_type_comments_type 1187 -#define invalid_with_item_type 1188 -#define invalid_for_target_type 1189 -#define invalid_group_type 1190 -#define invalid_import_from_targets_type 1191 -#define _loop0_1_type 1192 -#define _loop0_2_type 1193 -#define _loop0_4_type 1194 -#define _gather_3_type 1195 -#define _loop0_6_type 1196 -#define _gather_5_type 1197 -#define _loop0_8_type 1198 -#define _gather_7_type 1199 -#define _loop0_10_type 1200 -#define _gather_9_type 1201 -#define _loop1_11_type 1202 -#define _loop0_13_type 1203 -#define _gather_12_type 1204 -#define _tmp_14_type 1205 -#define _tmp_15_type 1206 -#define _tmp_16_type 1207 -#define _tmp_17_type 1208 -#define _tmp_18_type 1209 -#define _tmp_19_type 1210 -#define _tmp_20_type 1211 -#define _tmp_21_type 1212 -#define _loop1_22_type 1213 -#define _tmp_23_type 1214 -#define _tmp_24_type 1215 -#define _loop0_26_type 1216 -#define _gather_25_type 1217 -#define _loop0_28_type 1218 -#define _gather_27_type 1219 -#define _tmp_29_type 1220 -#define _tmp_30_type 1221 -#define _loop0_31_type 1222 -#define _loop1_32_type 1223 -#define _loop0_34_type 1224 -#define _gather_33_type 1225 -#define _tmp_35_type 1226 -#define _loop0_37_type 1227 -#define _gather_36_type 1228 -#define _tmp_38_type 1229 -#define _loop0_40_type 1230 -#define _gather_39_type 1231 -#define _loop0_42_type 1232 -#define _gather_41_type 1233 -#define _loop0_44_type 1234 -#define _gather_43_type 1235 -#define _loop0_46_type 1236 -#define _gather_45_type 1237 -#define _tmp_47_type 1238 -#define _loop1_48_type 1239 -#define _tmp_49_type 1240 -#define _loop1_50_type 1241 -#define _loop0_52_type 1242 -#define _gather_51_type 1243 -#define _tmp_53_type 1244 -#define _tmp_54_type 1245 -#define _tmp_55_type 1246 -#define _loop0_57_type 1247 -#define _gather_56_type 1248 -#define _tmp_58_type 1249 -#define _loop0_60_type 1250 -#define _gather_59_type 1251 -#define _tmp_61_type 1252 -#define _loop0_63_type 1253 -#define _gather_62_type 1254 -#define _loop0_65_type 1255 -#define _gather_64_type 1256 -#define _tmp_66_type 1257 -#define _tmp_67_type 1258 -#define _tmp_68_type 1259 -#define _tmp_69_type 1260 -#define _loop0_70_type 1261 -#define _loop0_71_type 1262 -#define _loop0_72_type 1263 -#define _loop1_73_type 1264 -#define _loop0_74_type 1265 -#define _loop1_75_type 1266 -#define _loop1_76_type 1267 -#define _loop1_77_type 1268 -#define _loop0_78_type 1269 -#define _loop1_79_type 1270 -#define _loop0_80_type 1271 -#define _loop1_81_type 1272 -#define _loop0_82_type 1273 -#define _loop1_83_type 1274 -#define _loop1_84_type 1275 -#define _tmp_85_type 1276 -#define _loop0_87_type 1277 -#define _gather_86_type 1278 -#define _loop1_88_type 1279 +#define star_expressions_type 1089 +#define star_expression_type 1090 +#define star_named_expressions_type 1091 +#define star_named_expression_type 1092 +#define named_expression_type 1093 +#define annotated_rhs_type 1094 +#define expressions_type 1095 +#define expression_type 1096 +#define lambdef_type 1097 +#define lambda_params_type 1098 +#define lambda_parameters_type 1099 +#define lambda_slash_no_default_type 1100 +#define lambda_slash_with_default_type 1101 +#define lambda_star_etc_type 1102 +#define lambda_kwds_type 1103 +#define lambda_param_no_default_type 1104 +#define lambda_param_with_default_type 1105 +#define lambda_param_maybe_default_type 1106 +#define lambda_param_type 1107 +#define disjunction_type 1108 +#define conjunction_type 1109 +#define inversion_type 1110 +#define comparison_type 1111 +#define compare_op_bitwise_or_pair_type 1112 +#define eq_bitwise_or_type 1113 +#define noteq_bitwise_or_type 1114 +#define lte_bitwise_or_type 1115 +#define lt_bitwise_or_type 1116 +#define gte_bitwise_or_type 1117 +#define gt_bitwise_or_type 1118 +#define notin_bitwise_or_type 1119 +#define in_bitwise_or_type 1120 +#define isnot_bitwise_or_type 1121 +#define is_bitwise_or_type 1122 +#define bitwise_or_type 1123 // Left-recursive +#define bitwise_xor_type 1124 // Left-recursive +#define bitwise_and_type 1125 // Left-recursive +#define shift_expr_type 1126 // Left-recursive +#define sum_type 1127 // Left-recursive +#define term_type 1128 // Left-recursive +#define factor_type 1129 +#define power_type 1130 +#define await_primary_type 1131 +#define primary_type 1132 // Left-recursive +#define slices_type 1133 +#define slice_type 1134 +#define atom_type 1135 +#define strings_type 1136 +#define list_type 1137 +#define listcomp_type 1138 +#define tuple_type 1139 +#define group_type 1140 +#define genexp_type 1141 +#define set_type 1142 +#define setcomp_type 1143 +#define dict_type 1144 +#define dictcomp_type 1145 +#define double_starred_kvpairs_type 1146 +#define double_starred_kvpair_type 1147 +#define kvpair_type 1148 +#define for_if_clauses_type 1149 +#define for_if_clause_type 1150 +#define yield_expr_type 1151 +#define arguments_type 1152 +#define args_type 1153 +#define kwargs_type 1154 +#define starred_expression_type 1155 +#define kwarg_or_starred_type 1156 +#define kwarg_or_double_starred_type 1157 +#define star_targets_type 1158 +#define star_targets_seq_type 1159 +#define star_target_type 1160 +#define star_atom_type 1161 +#define single_target_type 1162 +#define single_subscript_attribute_target_type 1163 +#define del_targets_type 1164 +#define del_target_type 1165 +#define del_t_atom_type 1166 +#define targets_type 1167 +#define target_type 1168 +#define t_primary_type 1169 // Left-recursive +#define t_lookahead_type 1170 +#define t_atom_type 1171 +#define invalid_arguments_type 1172 +#define invalid_kwarg_type 1173 +#define invalid_named_expression_type 1174 +#define invalid_assignment_type 1175 +#define invalid_ann_assign_target_type 1176 +#define invalid_del_stmt_type 1177 +#define invalid_block_type 1178 +#define invalid_primary_type 1179 // Left-recursive +#define invalid_comprehension_type 1180 +#define invalid_dict_comprehension_type 1181 +#define invalid_parameters_type 1182 +#define invalid_lambda_parameters_type 1183 +#define invalid_star_etc_type 1184 +#define invalid_lambda_star_etc_type 1185 +#define invalid_double_type_comments_type 1186 +#define invalid_with_item_type 1187 +#define invalid_for_target_type 1188 +#define invalid_group_type 1189 +#define invalid_import_from_targets_type 1190 +#define _loop0_1_type 1191 +#define _loop0_2_type 1192 +#define _loop0_4_type 1193 +#define _gather_3_type 1194 +#define _loop0_6_type 1195 +#define _gather_5_type 1196 +#define _loop0_8_type 1197 +#define _gather_7_type 1198 +#define _loop0_10_type 1199 +#define _gather_9_type 1200 +#define _loop1_11_type 1201 +#define _loop0_13_type 1202 +#define _gather_12_type 1203 +#define _tmp_14_type 1204 +#define _tmp_15_type 1205 +#define _tmp_16_type 1206 +#define _tmp_17_type 1207 +#define _tmp_18_type 1208 +#define _tmp_19_type 1209 +#define _tmp_20_type 1210 +#define _tmp_21_type 1211 +#define _loop1_22_type 1212 +#define _tmp_23_type 1213 +#define _tmp_24_type 1214 +#define _loop0_26_type 1215 +#define _gather_25_type 1216 +#define _loop0_28_type 1217 +#define _gather_27_type 1218 +#define _tmp_29_type 1219 +#define _tmp_30_type 1220 +#define _loop0_31_type 1221 +#define _loop1_32_type 1222 +#define _loop0_34_type 1223 +#define _gather_33_type 1224 +#define _tmp_35_type 1225 +#define _loop0_37_type 1226 +#define _gather_36_type 1227 +#define _tmp_38_type 1228 +#define _loop0_40_type 1229 +#define _gather_39_type 1230 +#define _loop0_42_type 1231 +#define _gather_41_type 1232 +#define _loop0_44_type 1233 +#define _gather_43_type 1234 +#define _loop0_46_type 1235 +#define _gather_45_type 1236 +#define _tmp_47_type 1237 +#define _loop1_48_type 1238 +#define _tmp_49_type 1239 +#define _loop1_50_type 1240 +#define _loop0_52_type 1241 +#define _gather_51_type 1242 +#define _tmp_53_type 1243 +#define _tmp_54_type 1244 +#define _tmp_55_type 1245 +#define _loop0_57_type 1246 +#define _gather_56_type 1247 +#define _tmp_58_type 1248 +#define _loop0_60_type 1249 +#define _gather_59_type 1250 +#define _tmp_61_type 1251 +#define _loop0_63_type 1252 +#define _gather_62_type 1253 +#define _loop0_65_type 1254 +#define _gather_64_type 1255 +#define _tmp_66_type 1256 +#define _tmp_67_type 1257 +#define _tmp_68_type 1258 +#define _tmp_69_type 1259 +#define _loop0_70_type 1260 +#define _loop0_71_type 1261 +#define _loop0_72_type 1262 +#define _loop1_73_type 1263 +#define _loop0_74_type 1264 +#define _loop1_75_type 1265 +#define _loop1_76_type 1266 +#define _loop1_77_type 1267 +#define _loop0_78_type 1268 +#define _loop1_79_type 1269 +#define _loop0_80_type 1270 +#define _loop1_81_type 1271 +#define _loop0_82_type 1272 +#define _loop1_83_type 1273 +#define _loop1_84_type 1274 +#define _tmp_85_type 1275 +#define _loop1_86_type 1276 +#define _loop0_88_type 1277 +#define _gather_87_type 1278 +#define _loop1_89_type 1279 #define _loop0_90_type 1280 -#define _gather_89_type 1281 -#define _loop1_91_type 1282 -#define _loop0_92_type 1283 -#define _loop0_93_type 1284 -#define _loop0_94_type 1285 -#define _loop1_95_type 1286 -#define _loop0_96_type 1287 -#define _loop1_97_type 1288 -#define _loop1_98_type 1289 -#define _loop1_99_type 1290 -#define _loop0_100_type 1291 -#define _loop1_101_type 1292 -#define _loop0_102_type 1293 -#define _loop1_103_type 1294 -#define _loop0_104_type 1295 -#define _loop1_105_type 1296 -#define _loop1_106_type 1297 -#define _loop1_107_type 1298 -#define _loop1_108_type 1299 -#define _tmp_109_type 1300 -#define _loop0_111_type 1301 -#define _gather_110_type 1302 -#define _tmp_112_type 1303 -#define _tmp_113_type 1304 -#define _tmp_114_type 1305 -#define _tmp_115_type 1306 -#define _loop1_116_type 1307 -#define _tmp_117_type 1308 -#define _tmp_118_type 1309 +#define _loop0_91_type 1281 +#define _loop0_92_type 1282 +#define _loop1_93_type 1283 +#define _loop0_94_type 1284 +#define _loop1_95_type 1285 +#define _loop1_96_type 1286 +#define _loop1_97_type 1287 +#define _loop0_98_type 1288 +#define _loop1_99_type 1289 +#define _loop0_100_type 1290 +#define _loop1_101_type 1291 +#define _loop0_102_type 1292 +#define _loop1_103_type 1293 +#define _loop1_104_type 1294 +#define _loop1_105_type 1295 +#define _loop1_106_type 1296 +#define _tmp_107_type 1297 +#define _loop0_109_type 1298 +#define _gather_108_type 1299 +#define _tmp_110_type 1300 +#define _tmp_111_type 1301 +#define _tmp_112_type 1302 +#define _tmp_113_type 1303 +#define _loop1_114_type 1304 +#define _tmp_115_type 1305 +#define _tmp_116_type 1306 +#define _loop0_118_type 1307 +#define _gather_117_type 1308 +#define _loop1_119_type 1309 #define _loop0_120_type 1310 -#define _gather_119_type 1311 -#define _loop1_121_type 1312 -#define _loop0_122_type 1313 -#define _loop0_123_type 1314 -#define _loop0_125_type 1315 -#define _gather_124_type 1316 -#define _tmp_126_type 1317 -#define _loop0_128_type 1318 -#define _gather_127_type 1319 -#define _loop0_130_type 1320 -#define _gather_129_type 1321 -#define _loop0_132_type 1322 -#define _gather_131_type 1323 -#define _loop0_134_type 1324 -#define _gather_133_type 1325 -#define _loop0_135_type 1326 -#define _loop0_137_type 1327 -#define _gather_136_type 1328 -#define _tmp_138_type 1329 -#define _loop0_140_type 1330 -#define _gather_139_type 1331 +#define _loop0_121_type 1311 +#define _loop0_123_type 1312 +#define _gather_122_type 1313 +#define _tmp_124_type 1314 +#define _loop0_126_type 1315 +#define _gather_125_type 1316 +#define _loop0_128_type 1317 +#define _gather_127_type 1318 +#define _loop0_130_type 1319 +#define _gather_129_type 1320 +#define _loop0_132_type 1321 +#define _gather_131_type 1322 +#define _loop0_133_type 1323 +#define _loop0_135_type 1324 +#define _gather_134_type 1325 +#define _tmp_136_type 1326 +#define _loop0_138_type 1327 +#define _gather_137_type 1328 +#define _loop0_140_type 1329 +#define _gather_139_type 1330 +#define _tmp_141_type 1331 #define _loop0_142_type 1332 -#define _gather_141_type 1333 -#define _tmp_143_type 1334 -#define _loop0_144_type 1335 -#define _loop0_145_type 1336 -#define _loop0_146_type 1337 -#define _tmp_147_type 1338 -#define _tmp_148_type 1339 -#define _loop0_149_type 1340 -#define _tmp_150_type 1341 -#define _loop0_151_type 1342 -#define _tmp_152_type 1343 -#define _tmp_153_type 1344 -#define _tmp_154_type 1345 -#define _tmp_155_type 1346 -#define _tmp_156_type 1347 -#define _tmp_157_type 1348 -#define _tmp_158_type 1349 -#define _tmp_159_type 1350 -#define _tmp_160_type 1351 -#define _tmp_161_type 1352 -#define _tmp_162_type 1353 -#define _tmp_163_type 1354 -#define _tmp_164_type 1355 -#define _tmp_165_type 1356 -#define _tmp_166_type 1357 -#define _tmp_167_type 1358 -#define _tmp_168_type 1359 -#define _loop1_169_type 1360 -#define _loop1_170_type 1361 -#define _tmp_171_type 1362 -#define _tmp_172_type 1363 +#define _loop0_143_type 1333 +#define _loop0_144_type 1334 +#define _tmp_145_type 1335 +#define _tmp_146_type 1336 +#define _loop0_147_type 1337 +#define _tmp_148_type 1338 +#define _loop0_149_type 1339 +#define _tmp_150_type 1340 +#define _tmp_151_type 1341 +#define _tmp_152_type 1342 +#define _tmp_153_type 1343 +#define _tmp_154_type 1344 +#define _tmp_155_type 1345 +#define _tmp_156_type 1346 +#define _tmp_157_type 1347 +#define _tmp_158_type 1348 +#define _tmp_159_type 1349 +#define _tmp_160_type 1350 +#define _tmp_161_type 1351 +#define _tmp_162_type 1352 +#define _tmp_163_type 1353 +#define _tmp_164_type 1354 +#define _tmp_165_type 1355 +#define _tmp_166_type 1356 +#define _loop1_167_type 1357 +#define _loop1_168_type 1358 +#define _tmp_169_type 1359 +#define _tmp_170_type 1360 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -440,8 +437,8 @@ static asdl_expr_seq* type_expressions_rule(Parser *p); static asdl_stmt_seq* statements_rule(Parser *p); static asdl_stmt_seq* statement_rule(Parser *p); static asdl_stmt_seq* statement_newline_rule(Parser *p); -static asdl_stmt_seq* simple_stmt_rule(Parser *p); -static stmt_ty small_stmt_rule(Parser *p); +static asdl_stmt_seq* simple_stmts_rule(Parser *p); +static stmt_ty simple_stmt_rule(Parser *p); static stmt_ty compound_stmt_rule(Parser *p); static stmt_ty assignment_rule(Parser *p); static AugOperator* augassign_rule(Parser *p); @@ -520,7 +517,6 @@ static asdl_expr_seq* decorators_rule(Parser *p); static stmt_ty class_def_rule(Parser *p); static stmt_ty class_def_raw_rule(Parser *p); static asdl_stmt_seq* block_rule(Parser *p); -static asdl_expr_seq* expressions_list_rule(Parser *p); static expr_ty star_expressions_rule(Parser *p); static expr_ty star_expression_rule(Parser *p); static asdl_expr_seq* star_named_expressions_rule(Parser *p); @@ -708,72 +704,72 @@ static asdl_seq *_loop0_82_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); static asdl_seq *_loop1_84_rule(Parser *p); static void *_tmp_85_rule(Parser *p); -static asdl_seq *_loop0_87_rule(Parser *p); -static asdl_seq *_gather_86_rule(Parser *p); -static asdl_seq *_loop1_88_rule(Parser *p); +static asdl_seq *_loop1_86_rule(Parser *p); +static asdl_seq *_loop0_88_rule(Parser *p); +static asdl_seq *_gather_87_rule(Parser *p); +static asdl_seq *_loop1_89_rule(Parser *p); static asdl_seq *_loop0_90_rule(Parser *p); -static asdl_seq *_gather_89_rule(Parser *p); -static asdl_seq *_loop1_91_rule(Parser *p); +static asdl_seq *_loop0_91_rule(Parser *p); static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_loop0_93_rule(Parser *p); +static asdl_seq *_loop1_93_rule(Parser *p); static asdl_seq *_loop0_94_rule(Parser *p); static asdl_seq *_loop1_95_rule(Parser *p); -static asdl_seq *_loop0_96_rule(Parser *p); +static asdl_seq *_loop1_96_rule(Parser *p); static asdl_seq *_loop1_97_rule(Parser *p); -static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop0_98_rule(Parser *p); static asdl_seq *_loop1_99_rule(Parser *p); static asdl_seq *_loop0_100_rule(Parser *p); static asdl_seq *_loop1_101_rule(Parser *p); static asdl_seq *_loop0_102_rule(Parser *p); static asdl_seq *_loop1_103_rule(Parser *p); -static asdl_seq *_loop0_104_rule(Parser *p); +static asdl_seq *_loop1_104_rule(Parser *p); static asdl_seq *_loop1_105_rule(Parser *p); static asdl_seq *_loop1_106_rule(Parser *p); -static asdl_seq *_loop1_107_rule(Parser *p); -static asdl_seq *_loop1_108_rule(Parser *p); -static void *_tmp_109_rule(Parser *p); -static asdl_seq *_loop0_111_rule(Parser *p); -static asdl_seq *_gather_110_rule(Parser *p); +static void *_tmp_107_rule(Parser *p); +static asdl_seq *_loop0_109_rule(Parser *p); +static asdl_seq *_gather_108_rule(Parser *p); +static void *_tmp_110_rule(Parser *p); +static void *_tmp_111_rule(Parser *p); static void *_tmp_112_rule(Parser *p); static void *_tmp_113_rule(Parser *p); -static void *_tmp_114_rule(Parser *p); +static asdl_seq *_loop1_114_rule(Parser *p); static void *_tmp_115_rule(Parser *p); -static asdl_seq *_loop1_116_rule(Parser *p); -static void *_tmp_117_rule(Parser *p); -static void *_tmp_118_rule(Parser *p); +static void *_tmp_116_rule(Parser *p); +static asdl_seq *_loop0_118_rule(Parser *p); +static asdl_seq *_gather_117_rule(Parser *p); +static asdl_seq *_loop1_119_rule(Parser *p); static asdl_seq *_loop0_120_rule(Parser *p); -static asdl_seq *_gather_119_rule(Parser *p); -static asdl_seq *_loop1_121_rule(Parser *p); -static asdl_seq *_loop0_122_rule(Parser *p); +static asdl_seq *_loop0_121_rule(Parser *p); static asdl_seq *_loop0_123_rule(Parser *p); -static asdl_seq *_loop0_125_rule(Parser *p); -static asdl_seq *_gather_124_rule(Parser *p); -static void *_tmp_126_rule(Parser *p); +static asdl_seq *_gather_122_rule(Parser *p); +static void *_tmp_124_rule(Parser *p); +static asdl_seq *_loop0_126_rule(Parser *p); +static asdl_seq *_gather_125_rule(Parser *p); static asdl_seq *_loop0_128_rule(Parser *p); static asdl_seq *_gather_127_rule(Parser *p); static asdl_seq *_loop0_130_rule(Parser *p); static asdl_seq *_gather_129_rule(Parser *p); static asdl_seq *_loop0_132_rule(Parser *p); static asdl_seq *_gather_131_rule(Parser *p); -static asdl_seq *_loop0_134_rule(Parser *p); -static asdl_seq *_gather_133_rule(Parser *p); +static asdl_seq *_loop0_133_rule(Parser *p); static asdl_seq *_loop0_135_rule(Parser *p); -static asdl_seq *_loop0_137_rule(Parser *p); -static asdl_seq *_gather_136_rule(Parser *p); -static void *_tmp_138_rule(Parser *p); +static asdl_seq *_gather_134_rule(Parser *p); +static void *_tmp_136_rule(Parser *p); +static asdl_seq *_loop0_138_rule(Parser *p); +static asdl_seq *_gather_137_rule(Parser *p); static asdl_seq *_loop0_140_rule(Parser *p); static asdl_seq *_gather_139_rule(Parser *p); +static void *_tmp_141_rule(Parser *p); static asdl_seq *_loop0_142_rule(Parser *p); -static asdl_seq *_gather_141_rule(Parser *p); -static void *_tmp_143_rule(Parser *p); +static asdl_seq *_loop0_143_rule(Parser *p); static asdl_seq *_loop0_144_rule(Parser *p); -static asdl_seq *_loop0_145_rule(Parser *p); -static asdl_seq *_loop0_146_rule(Parser *p); -static void *_tmp_147_rule(Parser *p); +static void *_tmp_145_rule(Parser *p); +static void *_tmp_146_rule(Parser *p); +static asdl_seq *_loop0_147_rule(Parser *p); static void *_tmp_148_rule(Parser *p); static asdl_seq *_loop0_149_rule(Parser *p); static void *_tmp_150_rule(Parser *p); -static asdl_seq *_loop0_151_rule(Parser *p); +static void *_tmp_151_rule(Parser *p); static void *_tmp_152_rule(Parser *p); static void *_tmp_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); @@ -789,12 +785,10 @@ static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); static void *_tmp_165_rule(Parser *p); static void *_tmp_166_rule(Parser *p); -static void *_tmp_167_rule(Parser *p); -static void *_tmp_168_rule(Parser *p); -static asdl_seq *_loop1_169_rule(Parser *p); -static asdl_seq *_loop1_170_rule(Parser *p); -static void *_tmp_171_rule(Parser *p); -static void *_tmp_172_rule(Parser *p); +static asdl_seq *_loop1_167_rule(Parser *p); +static asdl_seq *_loop1_168_rule(Parser *p); +static void *_tmp_169_rule(Parser *p); +static void *_tmp_170_rule(Parser *p); // file: statements? $ @@ -1311,7 +1305,7 @@ statements_rule(Parser *p) return _res; } -// statement: compound_stmt | simple_stmt +// statement: compound_stmt | simple_stmts static asdl_stmt_seq* statement_rule(Parser *p) { @@ -1346,18 +1340,18 @@ statement_rule(Parser *p) D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); } - { // simple_stmt + { // simple_stmts if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); + D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); asdl_stmt_seq* a; if ( - (a = (asdl_stmt_seq*)simple_stmt_rule(p)) // simple_stmt + (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts ) { - D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); + D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -1368,7 +1362,7 @@ statement_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); } _res = NULL; done: @@ -1376,7 +1370,7 @@ statement_rule(Parser *p) return _res; } -// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $ +// statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $ static asdl_stmt_seq* statement_newline_rule(Parser *p) { @@ -1423,24 +1417,24 @@ statement_newline_rule(Parser *p) D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE")); } - { // simple_stmt + { // simple_stmts if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - asdl_stmt_seq* simple_stmt_var; + D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); + asdl_stmt_seq* simple_stmts_var; if ( - (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt + (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts ) { - D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - _res = simple_stmt_var; + D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); + _res = simple_stmts_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); } { // NEWLINE if (p->error_indicator) { @@ -1505,9 +1499,9 @@ statement_newline_rule(Parser *p) return _res; } -// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE +// simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE static asdl_stmt_seq* -simple_stmt_rule(Parser *p) +simple_stmts_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -1516,23 +1510,23 @@ simple_stmt_rule(Parser *p) } asdl_stmt_seq* _res = NULL; int _mark = p->mark; - { // small_stmt !';' NEWLINE + { // simple_stmt !';' NEWLINE if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE")); + D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); stmt_ty a; Token * newline_var; if ( - (a = small_stmt_rule(p)) // small_stmt + (a = simple_stmt_rule(p)) // simple_stmt && _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE")); + D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -1542,28 +1536,28 @@ simple_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE")); + D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE")); } - { // ';'.small_stmt+ ';'? NEWLINE + { // ';'.simple_stmt+ ';'? NEWLINE if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); + D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings asdl_stmt_seq* a; Token * newline_var; if ( - (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.small_stmt+ + (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.simple_stmt+ && (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); + D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -1573,8 +1567,8 @@ simple_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); + D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); } _res = NULL; done: @@ -1582,7 +1576,7 @@ simple_stmt_rule(Parser *p) return _res; } -// small_stmt: +// simple_stmt: // | assignment // | star_expressions // | &'return' return_stmt @@ -1597,7 +1591,7 @@ simple_stmt_rule(Parser *p) // | &'global' global_stmt // | &'nonlocal' nonlocal_stmt static stmt_ty -small_stmt_rule(Parser *p) +simple_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -1605,7 +1599,7 @@ small_stmt_rule(Parser *p) return NULL; } stmt_ty _res = NULL; - if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) { + if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) { D(p->level--); return _res; } @@ -1624,18 +1618,18 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment")); stmt_ty assignment_var; if ( (assignment_var = assignment_rule(p)) // assignment ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment")); _res = assignment_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); } { // star_expressions @@ -1643,13 +1637,13 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty e; if ( (e = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -1668,7 +1662,7 @@ small_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } { // &'return' return_stmt @@ -1676,7 +1670,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); stmt_ty return_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' @@ -1684,12 +1678,12 @@ small_stmt_rule(Parser *p) (return_stmt_var = return_stmt_rule(p)) // return_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); _res = return_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); } { // &('import' | 'from') import_stmt @@ -1697,7 +1691,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); stmt_ty import_stmt_var; if ( _PyPegen_lookahead(1, _tmp_14_rule, p) @@ -1705,12 +1699,12 @@ small_stmt_rule(Parser *p) (import_stmt_var = import_stmt_rule(p)) // import_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); _res = import_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); } { // &'raise' raise_stmt @@ -1718,7 +1712,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); stmt_ty raise_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' @@ -1726,12 +1720,12 @@ small_stmt_rule(Parser *p) (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); _res = raise_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); } { // 'pass' @@ -1739,13 +1733,13 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -1764,7 +1758,7 @@ small_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); } { // &'del' del_stmt @@ -1772,7 +1766,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); stmt_ty del_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' @@ -1780,12 +1774,12 @@ small_stmt_rule(Parser *p) (del_stmt_var = del_stmt_rule(p)) // del_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); _res = del_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); } { // &'yield' yield_stmt @@ -1793,7 +1787,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); stmt_ty yield_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' @@ -1801,12 +1795,12 @@ small_stmt_rule(Parser *p) (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); _res = yield_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); } { // &'assert' assert_stmt @@ -1814,7 +1808,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); stmt_ty assert_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' @@ -1822,12 +1816,12 @@ small_stmt_rule(Parser *p) (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); _res = assert_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); } { // 'break' @@ -1835,13 +1829,13 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 506)) // token='break' ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -1860,7 +1854,7 @@ small_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); } { // 'continue' @@ -1868,13 +1862,13 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -1893,7 +1887,7 @@ small_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); } { // &'global' global_stmt @@ -1901,7 +1895,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); stmt_ty global_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' @@ -1909,12 +1903,12 @@ small_stmt_rule(Parser *p) (global_stmt_var = global_stmt_rule(p)) // global_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); _res = global_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); } { // &'nonlocal' nonlocal_stmt @@ -1922,7 +1916,7 @@ small_stmt_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); + D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); stmt_ty nonlocal_stmt_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' @@ -1930,17 +1924,17 @@ small_stmt_rule(Parser *p) (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt ) { - D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); + D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); _res = nonlocal_stmt_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); } _res = NULL; done: - _PyPegen_insert_memo(p, _mark, small_stmt_type, _res); + _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res); D(p->level--); return _res; } @@ -8616,7 +8610,7 @@ class_def_raw_rule(Parser *p) return _res; } -// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block +// block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block static asdl_stmt_seq* block_rule(Parser *p) { @@ -8664,24 +8658,24 @@ block_rule(Parser *p) D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); } - { // simple_stmt + { // simple_stmts if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - asdl_stmt_seq* simple_stmt_var; + D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); + asdl_stmt_seq* simple_stmts_var; if ( - (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt + (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts ) { - D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt")); - _res = simple_stmt_var; + D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); + _res = simple_stmts_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); } if (p->call_invalid_rules) { // invalid_block if (p->error_indicator) { @@ -8709,51 +8703,6 @@ block_rule(Parser *p) return _res; } -// expressions_list: ','.star_expression+ ','? -static asdl_expr_seq* -expressions_list_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_expr_seq* _res = NULL; - int _mark = p->mark; - { // ','.star_expression+ ','? - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - asdl_expr_seq* a; - if ( - (a = (asdl_expr_seq*)_gather_86_rule(p)) // ','.star_expression+ - && - (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? - ) - { - D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?")); - _res = a; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - // star_expressions: // | star_expression ((',' star_expression))+ ','? // | star_expression ',' @@ -8790,7 +8739,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_88_rule(p)) // ((',' star_expression))+ + (b = _loop1_86_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -8985,7 +8934,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_89_rule(p)) // ','.star_named_expression+ + (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9290,7 +9239,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_91_rule(p)) // ((',' expression))+ + (b = _loop1_89_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -9644,9 +9593,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = (asdl_arg_seq*)_loop0_92_rule(p)) // lambda_param_no_default* + (b = (asdl_arg_seq*)_loop0_90_rule(p)) // lambda_param_no_default* && - (c = _loop0_93_rule(p)) // lambda_param_with_default* + (c = _loop0_91_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9676,7 +9625,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_94_rule(p)) // lambda_param_with_default* + (b = _loop0_92_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9704,9 +9653,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = (asdl_arg_seq*)_loop1_95_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_93_rule(p)) // lambda_param_no_default+ && - (b = _loop0_96_rule(p)) // lambda_param_with_default* + (b = _loop0_94_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9733,7 +9682,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_97_rule(p)) // lambda_param_with_default+ + (a = _loop1_95_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? ) @@ -9804,7 +9753,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_98_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_96_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9833,7 +9782,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_99_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9883,9 +9832,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_100_rule(p)) // lambda_param_no_default* + (a = _loop0_98_rule(p)) // lambda_param_no_default* && - (b = _loop1_101_rule(p)) // lambda_param_with_default+ + (b = _loop1_99_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9915,9 +9864,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_102_rule(p)) // lambda_param_no_default* + (a = _loop0_100_rule(p)) // lambda_param_no_default* && - (b = _loop1_103_rule(p)) // lambda_param_with_default+ + (b = _loop1_101_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -9973,7 +9922,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_104_rule(p)) // lambda_param_maybe_default* + (b = _loop0_102_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -10006,7 +9955,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_105_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_103_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), 1) // lambda_kwds? ) @@ -10433,7 +10382,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_106_rule(p)) // (('or' conjunction))+ + (b = _loop1_104_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -10519,7 +10468,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_107_rule(p)) // (('and' inversion))+ + (b = _loop1_105_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10687,7 +10636,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_108_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_106_rule(p)) // compare_op_bitwise_or_pair+ ) { D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); @@ -11015,10 +10964,10 @@ noteq_bitwise_or_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); - void *_tmp_109_var; + void *_tmp_107_var; expr_ty a; if ( - (_tmp_109_var = _tmp_109_rule(p)) // '!=' + (_tmp_107_var = _tmp_107_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12981,7 +12930,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_110_rule(p)) // ','.slice+ + (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -13014,7 +12963,7 @@ slices_rule(Parser *p) return _res; } -// slice: expression? ':' expression? [':' expression?] | expression +// slice: expression? ':' expression? [':' expression?] | named_expression static expr_ty slice_rule(Parser *p) { @@ -13051,7 +13000,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) // expression? && - (c = _tmp_112_rule(p), 1) // [':' expression?] + (c = _tmp_110_rule(p), 1) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -13076,18 +13025,18 @@ slice_rule(Parser *p) D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); } - { // expression + { // named_expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); + D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty a; if ( - (a = expression_rule(p)) // expression + (a = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); + D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = a; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -13098,7 +13047,7 @@ slice_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; done: @@ -13300,15 +13249,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - void *_tmp_113_var; + void *_tmp_111_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_113_var = _tmp_113_rule(p)) // tuple | group | genexp + (_tmp_111_var = _tmp_111_rule(p)) // tuple | group | genexp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); - _res = _tmp_113_var; + _res = _tmp_111_var; goto done; } p->mark = _mark; @@ -13321,15 +13270,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - void *_tmp_114_var; + void *_tmp_112_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_114_var = _tmp_114_rule(p)) // list | listcomp + (_tmp_112_var = _tmp_112_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_114_var; + _res = _tmp_112_var; goto done; } p->mark = _mark; @@ -13342,15 +13291,15 @@ atom_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - void *_tmp_115_var; + void *_tmp_113_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_115_var = _tmp_115_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_113_var = _tmp_113_rule(p)) // dict | set | dictcomp | setcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); - _res = _tmp_115_var; + _res = _tmp_113_var; goto done; } p->mark = _mark; @@ -13419,7 +13368,7 @@ strings_rule(Parser *p) D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+")); asdl_seq * a; if ( - (a = _loop1_116_rule(p)) // STRING+ + (a = _loop1_114_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -13633,7 +13582,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_117_rule(p), 1) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_115_rule(p), 1) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13689,7 +13638,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_118_rule(p)) // yield_expr | named_expression + (a = _tmp_116_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13732,7 +13681,7 @@ group_rule(Parser *p) return _res; } -// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension +// genexp: '(' named_expression ~ for_if_clauses ')' | invalid_comprehension static expr_ty genexp_rule(Parser *p) { @@ -13752,12 +13701,12 @@ genexp_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '(' expression ~ for_if_clauses ')' + { // '(' named_expression ~ for_if_clauses ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'")); + D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'")); int _cut_var = 0; Token * _literal; Token * _literal_1; @@ -13766,7 +13715,7 @@ genexp_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = expression_rule(p)) // expression + (a = named_expression_rule(p)) // named_expression && (_cut_var = 1) && @@ -13775,7 +13724,7 @@ genexp_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'")); + D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13795,7 +13744,7 @@ genexp_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'")); if (_cut_var) { D(p->level--); return NULL; @@ -13826,7 +13775,7 @@ genexp_rule(Parser *p) return _res; } -// set: '{' expressions_list '}' +// set: '{' star_named_expressions '}' static expr_ty set_rule(Parser *p) { @@ -13846,24 +13795,24 @@ set_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' expressions_list '}' + { // '{' star_named_expressions '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); + D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); Token * _literal; Token * _literal_1; asdl_expr_seq* a; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (a = expressions_list_rule(p)) // expressions_list + (a = star_named_expressions_rule(p)) // star_named_expressions && (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'")); + D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13883,7 +13832,7 @@ set_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'")); } _res = NULL; done: @@ -13891,7 +13840,7 @@ set_rule(Parser *p) return _res; } -// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension +// setcomp: '{' named_expression ~ for_if_clauses '}' | invalid_comprehension static expr_ty setcomp_rule(Parser *p) { @@ -13911,12 +13860,12 @@ setcomp_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '{' expression ~ for_if_clauses '}' + { // '{' named_expression ~ for_if_clauses '}' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'")); + D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'")); int _cut_var = 0; Token * _literal; Token * _literal_1; @@ -13925,7 +13874,7 @@ setcomp_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' && - (a = expression_rule(p)) // expression + (a = named_expression_rule(p)) // named_expression && (_cut_var = 1) && @@ -13934,7 +13883,7 @@ setcomp_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'")); + D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -13954,7 +13903,7 @@ setcomp_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'")); if (_cut_var) { D(p->level--); return NULL; @@ -14158,7 +14107,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_119_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_117_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -14311,7 +14260,7 @@ for_if_clauses_rule(Parser *p) D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); asdl_comprehension_seq* a; if ( - (a = (asdl_comprehension_seq*)_loop1_121_rule(p)) // for_if_clause+ + (a = (asdl_comprehension_seq*)_loop1_119_rule(p)) // for_if_clause+ ) { D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); @@ -14373,7 +14322,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_122_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_120_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14416,7 +14365,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_123_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))* ) { D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); @@ -14662,9 +14611,9 @@ args_rule(Parser *p) asdl_expr_seq* a; void *b; if ( - (a = (asdl_expr_seq*)_gather_124_rule(p)) // ','.(starred_expression | named_expression !'=')+ + (a = (asdl_expr_seq*)_gather_122_rule(p)) // ','.(starred_expression | named_expression !'=')+ && - (b = _tmp_126_rule(p), 1) // [',' kwargs] + (b = _tmp_124_rule(p), 1) // [',' kwargs] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]")); @@ -14752,11 +14701,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_127_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_125_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_129_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_127_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); @@ -14778,13 +14727,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - asdl_seq * _gather_131_var; + asdl_seq * _gather_129_var; if ( - (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_starred+ + (_gather_129_var = _gather_129_rule(p)) // ','.kwarg_or_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); - _res = _gather_131_var; + _res = _gather_129_var; goto done; } p->mark = _mark; @@ -14797,13 +14746,13 @@ kwargs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - asdl_seq * _gather_133_var; + asdl_seq * _gather_131_var; if ( - (_gather_133_var = _gather_133_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_131_var = _gather_131_rule(p)) // ','.kwarg_or_double_starred+ ) { D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); - _res = _gather_133_var; + _res = _gather_131_var; goto done; } p->mark = _mark; @@ -15165,7 +15114,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_135_rule(p)) // ((',' star_target))* + (b = _loop0_133_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15219,7 +15168,7 @@ star_targets_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_136_rule(p)) // ','.star_target+ + (a = (asdl_expr_seq*)_gather_134_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -15282,7 +15231,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_138_rule(p)) // !'*' star_target + (a = _tmp_136_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -15804,7 +15753,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.del_target+ + (a = (asdl_expr_seq*)_gather_137_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16145,7 +16094,7 @@ targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_141_rule(p)) // ','.target+ + (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.target+ && (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? ) @@ -16859,7 +16808,7 @@ invalid_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_143_rule(p), 1) // [args | expression for_if_clauses] + (_opt_var = _tmp_141_rule(p), 1) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -17117,7 +17066,7 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_144_var; + asdl_seq * _loop0_142_var; expr_ty a; expr_ty expression_var; if ( @@ -17125,7 +17074,7 @@ invalid_assignment_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_144_var = _loop0_144_rule(p)) // star_named_expressions* + (_loop0_142_var = _loop0_142_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -17182,10 +17131,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); Token * _literal; - asdl_seq * _loop0_145_var; + asdl_seq * _loop0_143_var; expr_ty a; if ( - (_loop0_145_var = _loop0_145_rule(p)) // ((star_targets '='))* + (_loop0_143_var = _loop0_143_rule(p)) // ((star_targets '='))* && (a = star_expressions_rule(p)) // star_expressions && @@ -17212,10 +17161,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); Token * _literal; - asdl_seq * _loop0_146_var; + asdl_seq * _loop0_144_var; expr_ty a; if ( - (_loop0_146_var = _loop0_146_rule(p)) // ((star_targets '='))* + (_loop0_144_var = _loop0_144_rule(p)) // ((star_targets '='))* && (a = yield_expr_rule(p)) // yield_expr && @@ -17241,7 +17190,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_147_var; + void *_tmp_145_var; expr_ty a; AugOperator* augassign_var; if ( @@ -17249,7 +17198,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_147_var = _tmp_147_rule(p)) // yield_expr | star_expressions + (_tmp_145_var = _tmp_145_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -17505,11 +17454,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_148_var; + void *_tmp_146_var; expr_ty a; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_148_var = _tmp_148_rule(p)) // '[' | '(' | '{' + (_tmp_146_var = _tmp_146_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -17606,13 +17555,13 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default")); - asdl_seq * _loop0_149_var; - void *_tmp_150_var; + asdl_seq * _loop0_147_var; + void *_tmp_148_var; arg_ty param_no_default_var; if ( - (_loop0_149_var = _loop0_149_rule(p)) // param_no_default* + (_loop0_147_var = _loop0_147_rule(p)) // param_no_default* && - (_tmp_150_var = _tmp_150_rule(p)) // slash_with_default | param_with_default+ + (_tmp_148_var = _tmp_148_rule(p)) // slash_with_default | param_with_default+ && (param_no_default_var = param_no_default_rule(p)) // param_no_default ) @@ -17654,13 +17603,13 @@ invalid_lambda_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); - asdl_seq * _loop0_151_var; - void *_tmp_152_var; + asdl_seq * _loop0_149_var; + void *_tmp_150_var; arg_ty lambda_param_no_default_var; if ( - (_loop0_151_var = _loop0_151_rule(p)) // lambda_param_no_default* + (_loop0_149_var = _loop0_149_rule(p)) // lambda_param_no_default* && - (_tmp_152_var = _tmp_152_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ + (_tmp_150_var = _tmp_150_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ && (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default ) @@ -17702,11 +17651,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_153_var; + void *_tmp_151_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_153_var = _tmp_153_rule(p)) // ')' | ',' (')' | '**') + (_tmp_151_var = _tmp_151_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -17776,11 +17725,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_154_var; + void *_tmp_152_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_154_var = _tmp_154_rule(p)) // ':' | ',' (':' | '**') + (_tmp_152_var = _tmp_152_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18700,7 +18649,7 @@ _loop1_11_rule(Parser *p) return _seq; } -// _loop0_13: ';' small_stmt +// _loop0_13: ';' simple_stmt static asdl_seq * _loop0_13_rule(Parser *p) { @@ -18721,18 +18670,18 @@ _loop0_13_rule(Parser *p) } ssize_t _children_capacity = 1; ssize_t _n = 0; - { // ';' small_stmt + { // ';' simple_stmt if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt")); + D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt")); Token * _literal; stmt_ty elem; while ( (_literal = _PyPegen_expect_token(p, 13)) // token=';' && - (elem = small_stmt_rule(p)) // small_stmt + (elem = simple_stmt_rule(p)) // simple_stmt ) { _res = elem; @@ -18758,7 +18707,7 @@ _loop0_13_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); if (!_seq) { @@ -18775,7 +18724,7 @@ _loop0_13_rule(Parser *p) return _seq; } -// _gather_12: small_stmt _loop0_13 +// _gather_12: simple_stmt _loop0_13 static asdl_seq * _gather_12_rule(Parser *p) { @@ -18786,27 +18735,27 @@ _gather_12_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // small_stmt _loop0_13 + { // simple_stmt _loop0_13 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); + D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13")); stmt_ty elem; asdl_seq * seq; if ( - (elem = small_stmt_rule(p)) // small_stmt + (elem = simple_stmt_rule(p)) // simple_stmt && (seq = _loop0_13_rule(p)) // _loop0_13 ) { - D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13")); + D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_13")); } _res = NULL; done: @@ -19289,12 +19238,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_155_var; + void *_tmp_153_var; while ( - (_tmp_155_var = _tmp_155_rule(p)) // star_targets '=' + (_tmp_153_var = _tmp_153_rule(p)) // star_targets '=' ) { - _res = _tmp_155_var; + _res = _tmp_153_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19797,12 +19746,12 @@ _loop0_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_156_var; + void *_tmp_154_var; while ( - (_tmp_156_var = _tmp_156_rule(p)) // '.' | '...' + (_tmp_154_var = _tmp_154_rule(p)) // '.' | '...' ) { - _res = _tmp_156_var; + _res = _tmp_154_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19863,12 +19812,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_157_var; + void *_tmp_155_var; while ( - (_tmp_157_var = _tmp_157_rule(p)) // '.' | '...' + (_tmp_155_var = _tmp_155_rule(p)) // '.' | '...' ) { - _res = _tmp_157_var; + _res = _tmp_155_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22979,12 +22928,12 @@ _loop1_84_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_158_var; + void *_tmp_156_var; while ( - (_tmp_158_var = _tmp_158_rule(p)) // '@' named_expression NEWLINE + (_tmp_156_var = _tmp_156_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_158_var; + _res = _tmp_156_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23070,123 +23019,9 @@ _tmp_85_rule(Parser *p) return _res; } -// _loop0_87: ',' star_expression -static asdl_seq * -_loop0_87_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void *_res = NULL; - int _mark = p->mark; - int _start_mark = p->mark; - void **_children = PyMem_Malloc(sizeof(void *)); - if (!_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - ssize_t _children_capacity = 1; - ssize_t _n = 0; - { // ',' star_expression - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _loop0_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); - Token * _literal; - expr_ty elem; - while ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (elem = star_expression_rule(p)) // star_expression - ) - { - _res = elem; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(_children); - D(p->level--); - return NULL; - } - if (_n == _children_capacity) { - _children_capacity *= 2; - void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); - if (!_new_children) { - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - _children = _new_children; - } - _children[_n++] = _res; - _mark = p->mark; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); - } - asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); - if (!_seq) { - PyMem_Free(_children); - p->error_indicator = 1; - PyErr_NoMemory(); - D(p->level--); - return NULL; - } - for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); - PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); - D(p->level--); - return _seq; -} - -// _gather_86: star_expression _loop0_87 -static asdl_seq * -_gather_86_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - asdl_seq * _res = NULL; - int _mark = p->mark; - { // star_expression _loop0_87 - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _gather_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_87")); - expr_ty elem; - asdl_seq * seq; - if ( - (elem = star_expression_rule(p)) // star_expression - && - (seq = _loop0_87_rule(p)) // _loop0_87 - ) - { - D(fprintf(stderr, "%*c+ _gather_86[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_87")); - _res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_86[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_87")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop1_88: (',' star_expression) +// _loop1_86: (',' star_expression) static asdl_seq * -_loop1_88_rule(Parser *p) +_loop1_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23210,13 +23045,13 @@ _loop1_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_159_var; + D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_157_var; while ( - (_tmp_159_var = _tmp_159_rule(p)) // ',' star_expression + (_tmp_157_var = _tmp_157_rule(p)) // ',' star_expression ) { - _res = _tmp_159_var; + _res = _tmp_157_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23232,7 +23067,7 @@ _loop1_88_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -23250,14 +23085,14 @@ _loop1_88_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); D(p->level--); return _seq; } -// _loop0_90: ',' star_named_expression +// _loop0_88: ',' star_named_expression static asdl_seq * -_loop0_90_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23281,7 +23116,7 @@ _loop0_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -23312,7 +23147,7 @@ _loop0_90_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -23325,14 +23160,14 @@ _loop0_90_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _gather_89: star_named_expression _loop0_90 +// _gather_87: star_named_expression _loop0_88 static asdl_seq * -_gather_89_rule(Parser *p) +_gather_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23341,27 +23176,27 @@ _gather_89_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_90 + { // star_named_expression _loop0_88 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_90")); + D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_90_rule(p)) // _loop0_90 + (seq = _loop0_88_rule(p)) // _loop0_88 ) { - D(fprintf(stderr, "%*c+ _gather_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_90")); + D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_89[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_90")); + D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_88")); } _res = NULL; done: @@ -23369,9 +23204,9 @@ _gather_89_rule(Parser *p) return _res; } -// _loop1_91: (',' expression) +// _loop1_89: (',' expression) static asdl_seq * -_loop1_91_rule(Parser *p) +_loop1_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23395,13 +23230,13 @@ _loop1_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_160_var; + D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_158_var; while ( - (_tmp_160_var = _tmp_160_rule(p)) // ',' expression + (_tmp_158_var = _tmp_158_rule(p)) // ',' expression ) { - _res = _tmp_160_var; + _res = _tmp_158_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23417,7 +23252,7 @@ _loop1_91_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -23435,14 +23270,14 @@ _loop1_91_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); D(p->level--); return _seq; } -// _loop0_92: lambda_param_no_default +// _loop0_90: lambda_param_no_default static asdl_seq * -_loop0_92_rule(Parser *p) +_loop0_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23466,7 +23301,7 @@ _loop0_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23488,7 +23323,7 @@ _loop0_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -23501,14 +23336,14 @@ _loop0_92_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); D(p->level--); return _seq; } -// _loop0_93: lambda_param_with_default +// _loop0_91: lambda_param_with_default static asdl_seq * -_loop0_93_rule(Parser *p) +_loop0_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23532,7 +23367,7 @@ _loop0_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23554,7 +23389,7 @@ _loop0_93_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -23567,14 +23402,14 @@ _loop0_93_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); D(p->level--); return _seq; } -// _loop0_94: lambda_param_with_default +// _loop0_92: lambda_param_with_default static asdl_seq * -_loop0_94_rule(Parser *p) +_loop0_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23598,7 +23433,7 @@ _loop0_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23620,7 +23455,7 @@ _loop0_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -23633,14 +23468,14 @@ _loop0_94_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); D(p->level--); return _seq; } -// _loop1_95: lambda_param_no_default +// _loop1_93: lambda_param_no_default static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23664,7 +23499,7 @@ _loop1_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23686,7 +23521,7 @@ _loop1_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23704,14 +23539,14 @@ _loop1_95_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); D(p->level--); return _seq; } -// _loop0_96: lambda_param_with_default +// _loop0_94: lambda_param_with_default static asdl_seq * -_loop0_96_rule(Parser *p) +_loop0_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23735,7 +23570,7 @@ _loop0_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23757,7 +23592,7 @@ _loop0_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -23770,14 +23605,14 @@ _loop0_96_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); D(p->level--); return _seq; } -// _loop1_97: lambda_param_with_default +// _loop1_95: lambda_param_with_default static asdl_seq * -_loop1_97_rule(Parser *p) +_loop1_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23801,7 +23636,7 @@ _loop1_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -23823,7 +23658,7 @@ _loop1_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -23841,14 +23676,14 @@ _loop1_97_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); D(p->level--); return _seq; } -// _loop1_98: lambda_param_no_default +// _loop1_96: lambda_param_no_default static asdl_seq * -_loop1_98_rule(Parser *p) +_loop1_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23872,7 +23707,7 @@ _loop1_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23894,7 +23729,7 @@ _loop1_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23912,14 +23747,14 @@ _loop1_98_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); D(p->level--); return _seq; } -// _loop1_99: lambda_param_no_default +// _loop1_97: lambda_param_no_default static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23943,7 +23778,7 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -23965,7 +23800,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -23983,14 +23818,14 @@ _loop1_99_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_no_default +// _loop0_98: lambda_param_no_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24014,7 +23849,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24036,7 +23871,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -24049,14 +23884,14 @@ _loop0_100_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); D(p->level--); return _seq; } -// _loop1_101: lambda_param_with_default +// _loop1_99: lambda_param_with_default static asdl_seq * -_loop1_101_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24080,7 +23915,7 @@ _loop1_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24102,7 +23937,7 @@ _loop1_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24120,14 +23955,14 @@ _loop1_101_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop0_102: lambda_param_no_default +// _loop0_100: lambda_param_no_default static asdl_seq * -_loop0_102_rule(Parser *p) +_loop0_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24151,7 +23986,7 @@ _loop0_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -24173,7 +24008,7 @@ _loop0_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -24186,14 +24021,14 @@ _loop0_102_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); D(p->level--); return _seq; } -// _loop1_103: lambda_param_with_default +// _loop1_101: lambda_param_with_default static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24217,7 +24052,7 @@ _loop1_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -24239,7 +24074,7 @@ _loop1_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24257,14 +24092,14 @@ _loop1_103_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_maybe_default +// _loop0_102: lambda_param_maybe_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24288,7 +24123,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -24310,7 +24145,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -24323,14 +24158,14 @@ _loop0_104_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_maybe_default +// _loop1_103: lambda_param_maybe_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24354,7 +24189,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -24376,7 +24211,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -24394,14 +24229,14 @@ _loop1_105_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop1_106: ('or' conjunction) +// _loop1_104: ('or' conjunction) static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24425,13 +24260,13 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_161_var; + D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_159_var; while ( - (_tmp_161_var = _tmp_161_rule(p)) // 'or' conjunction + (_tmp_159_var = _tmp_159_rule(p)) // 'or' conjunction ) { - _res = _tmp_161_var; + _res = _tmp_159_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24447,7 +24282,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -24465,14 +24300,14 @@ _loop1_106_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); D(p->level--); return _seq; } -// _loop1_107: ('and' inversion) +// _loop1_105: ('and' inversion) static asdl_seq * -_loop1_107_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24496,13 +24331,13 @@ _loop1_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_162_var; + D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_160_var; while ( - (_tmp_162_var = _tmp_162_rule(p)) // 'and' inversion + (_tmp_160_var = _tmp_160_rule(p)) // 'and' inversion ) { - _res = _tmp_162_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24518,7 +24353,7 @@ _loop1_107_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -24536,14 +24371,14 @@ _loop1_107_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop1_108: compare_op_bitwise_or_pair +// _loop1_106: compare_op_bitwise_or_pair static asdl_seq * -_loop1_108_rule(Parser *p) +_loop1_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24567,7 +24402,7 @@ _loop1_108_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -24589,7 +24424,7 @@ _loop1_108_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); } if (_n == 0 || p->error_indicator) { @@ -24607,14 +24442,14 @@ _loop1_108_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); D(p->level--); return _seq; } -// _tmp_109: '!=' +// _tmp_107: '!=' static void * -_tmp_109_rule(Parser *p) +_tmp_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24628,13 +24463,13 @@ _tmp_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24644,7 +24479,7 @@ _tmp_109_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -24653,9 +24488,9 @@ _tmp_109_rule(Parser *p) return _res; } -// _loop0_111: ',' slice +// _loop0_109: ',' slice static asdl_seq * -_loop0_111_rule(Parser *p) +_loop0_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24679,7 +24514,7 @@ _loop0_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -24710,7 +24545,7 @@ _loop0_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -24723,14 +24558,14 @@ _loop0_111_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); D(p->level--); return _seq; } -// _gather_110: slice _loop0_111 +// _gather_108: slice _loop0_109 static asdl_seq * -_gather_110_rule(Parser *p) +_gather_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24739,27 +24574,27 @@ _gather_110_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_111 + { // slice _loop0_109 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_111")); + D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_109")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_111_rule(p)) // _loop0_111 + (seq = _loop0_109_rule(p)) // _loop0_109 ) { - D(fprintf(stderr, "%*c+ _gather_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_111")); + D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_109")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_110[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_111")); + D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_109")); } _res = NULL; done: @@ -24767,9 +24602,9 @@ _gather_110_rule(Parser *p) return _res; } -// _tmp_112: ':' expression? +// _tmp_110: ':' expression? static void * -_tmp_112_rule(Parser *p) +_tmp_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24783,7 +24618,7 @@ _tmp_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -24792,7 +24627,7 @@ _tmp_112_rule(Parser *p) (d = expression_rule(p), 1) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24802,7 +24637,7 @@ _tmp_112_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -24811,9 +24646,9 @@ _tmp_112_rule(Parser *p) return _res; } -// _tmp_113: tuple | group | genexp +// _tmp_111: tuple | group | genexp static void * -_tmp_113_rule(Parser *p) +_tmp_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24827,18 +24662,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -24846,18 +24681,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); expr_ty group_var; if ( (group_var = group_rule(p)) // group ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); _res = group_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -24865,18 +24700,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -24885,9 +24720,9 @@ _tmp_113_rule(Parser *p) return _res; } -// _tmp_114: list | listcomp +// _tmp_112: list | listcomp static void * -_tmp_114_rule(Parser *p) +_tmp_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24901,18 +24736,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -24920,18 +24755,18 @@ _tmp_114_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); expr_ty listcomp_var; if ( (listcomp_var = listcomp_rule(p)) // listcomp ) { - D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); _res = listcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -24940,9 +24775,9 @@ _tmp_114_rule(Parser *p) return _res; } -// _tmp_115: dict | set | dictcomp | setcomp +// _tmp_113: dict | set | dictcomp | setcomp static void * -_tmp_115_rule(Parser *p) +_tmp_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24956,18 +24791,18 @@ _tmp_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); expr_ty dict_var; if ( (dict_var = dict_rule(p)) // dict ) { - D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); _res = dict_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -24975,18 +24810,18 @@ _tmp_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); expr_ty set_var; if ( (set_var = set_rule(p)) // set ) { - D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); _res = set_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -24994,18 +24829,18 @@ _tmp_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); expr_ty dictcomp_var; if ( (dictcomp_var = dictcomp_rule(p)) // dictcomp ) { - D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); _res = dictcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -25013,18 +24848,18 @@ _tmp_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); expr_ty setcomp_var; if ( (setcomp_var = setcomp_rule(p)) // setcomp ) { - D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); _res = setcomp_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -25033,9 +24868,9 @@ _tmp_115_rule(Parser *p) return _res; } -// _loop1_116: STRING +// _loop1_114: STRING static asdl_seq * -_loop1_116_rule(Parser *p) +_loop1_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25059,7 +24894,7 @@ _loop1_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -25081,7 +24916,7 @@ _loop1_116_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -25099,14 +24934,14 @@ _loop1_116_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_116_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); D(p->level--); return _seq; } -// _tmp_117: star_named_expression ',' star_named_expressions? +// _tmp_115: star_named_expression ',' star_named_expressions? static void * -_tmp_117_rule(Parser *p) +_tmp_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25120,7 +24955,7 @@ _tmp_117_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -25132,7 +24967,7 @@ _tmp_117_rule(Parser *p) (z = star_named_expressions_rule(p), 1) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); _res = _PyPegen_seq_insert_in_front ( p , y , z ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25142,7 +24977,7 @@ _tmp_117_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -25151,9 +24986,9 @@ _tmp_117_rule(Parser *p) return _res; } -// _tmp_118: yield_expr | named_expression +// _tmp_116: yield_expr | named_expression static void * -_tmp_118_rule(Parser *p) +_tmp_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25167,18 +25002,18 @@ _tmp_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -25186,18 +25021,18 @@ _tmp_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression ) { - D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -25206,9 +25041,9 @@ _tmp_118_rule(Parser *p) return _res; } -// _loop0_120: ',' double_starred_kvpair +// _loop0_118: ',' double_starred_kvpair static asdl_seq * -_loop0_120_rule(Parser *p) +_loop0_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25232,7 +25067,7 @@ _loop0_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -25263,7 +25098,7 @@ _loop0_120_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25276,14 +25111,14 @@ _loop0_120_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq); D(p->level--); return _seq; } -// _gather_119: double_starred_kvpair _loop0_120 +// _gather_117: double_starred_kvpair _loop0_118 static asdl_seq * -_gather_119_rule(Parser *p) +_gather_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25292,27 +25127,27 @@ _gather_119_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_120 + { // double_starred_kvpair _loop0_118 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_120")); + D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_120_rule(p)) // _loop0_120 + (seq = _loop0_118_rule(p)) // _loop0_118 ) { - D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_120")); + D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_118")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_120")); + D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_118")); } _res = NULL; done: @@ -25320,9 +25155,9 @@ _gather_119_rule(Parser *p) return _res; } -// _loop1_121: for_if_clause +// _loop1_119: for_if_clause static asdl_seq * -_loop1_121_rule(Parser *p) +_loop1_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25346,7 +25181,7 @@ _loop1_121_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); comprehension_ty for_if_clause_var; while ( (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause @@ -25368,7 +25203,7 @@ _loop1_121_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_121[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_119[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -25386,14 +25221,14 @@ _loop1_121_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_121_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_119_type, _seq); D(p->level--); return _seq; } -// _loop0_122: ('if' disjunction) +// _loop0_120: ('if' disjunction) static asdl_seq * -_loop0_122_rule(Parser *p) +_loop0_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25417,13 +25252,13 @@ _loop0_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_163_var; + D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_161_var; while ( - (_tmp_163_var = _tmp_163_rule(p)) // 'if' disjunction + (_tmp_161_var = _tmp_161_rule(p)) // 'if' disjunction ) { - _res = _tmp_163_var; + _res = _tmp_161_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25439,7 +25274,7 @@ _loop0_122_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25452,14 +25287,14 @@ _loop0_122_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); D(p->level--); return _seq; } -// _loop0_123: ('if' disjunction) +// _loop0_121: ('if' disjunction) static asdl_seq * -_loop0_123_rule(Parser *p) +_loop0_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25483,13 +25318,13 @@ _loop0_123_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_164_var; + D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_162_var; while ( - (_tmp_164_var = _tmp_164_rule(p)) // 'if' disjunction + (_tmp_162_var = _tmp_162_rule(p)) // 'if' disjunction ) { - _res = _tmp_164_var; + _res = _tmp_162_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25505,7 +25340,7 @@ _loop0_123_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25518,14 +25353,14 @@ _loop0_123_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); D(p->level--); return _seq; } -// _loop0_125: ',' (starred_expression | named_expression !'=') +// _loop0_123: ',' (starred_expression | named_expression !'=') static asdl_seq * -_loop0_125_rule(Parser *p) +_loop0_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25549,13 +25384,13 @@ _loop0_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')")); + D(fprintf(stderr, "%*c> _loop0_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_165_rule(p)) // starred_expression | named_expression !'=' + (elem = _tmp_163_rule(p)) // starred_expression | named_expression !'=' ) { _res = elem; @@ -25580,7 +25415,7 @@ _loop0_125_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_123[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25593,14 +25428,14 @@ _loop0_125_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_125_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_123_type, _seq); D(p->level--); return _seq; } -// _gather_124: (starred_expression | named_expression !'=') _loop0_125 +// _gather_122: (starred_expression | named_expression !'=') _loop0_123 static asdl_seq * -_gather_124_rule(Parser *p) +_gather_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25609,27 +25444,27 @@ _gather_124_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (starred_expression | named_expression !'=') _loop0_125 + { // (starred_expression | named_expression !'=') _loop0_123 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); + D(fprintf(stderr, "%*c> _gather_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_165_rule(p)) // starred_expression | named_expression !'=' + (elem = _tmp_163_rule(p)) // starred_expression | named_expression !'=' && - (seq = _loop0_125_rule(p)) // _loop0_125 + (seq = _loop0_123_rule(p)) // _loop0_123 ) { - D(fprintf(stderr, "%*c+ _gather_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); + D(fprintf(stderr, "%*c+ _gather_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_124[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_125")); + D(fprintf(stderr, "%*c%s _gather_122[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_123")); } _res = NULL; done: @@ -25637,9 +25472,9 @@ _gather_124_rule(Parser *p) return _res; } -// _tmp_126: ',' kwargs +// _tmp_124: ',' kwargs static void * -_tmp_126_rule(Parser *p) +_tmp_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25653,7 +25488,7 @@ _tmp_126_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); Token * _literal; asdl_seq* k; if ( @@ -25662,7 +25497,7 @@ _tmp_126_rule(Parser *p) (k = kwargs_rule(p)) // kwargs ) { - D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); _res = k; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25672,7 +25507,7 @@ _tmp_126_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); } _res = NULL; @@ -25681,9 +25516,9 @@ _tmp_126_rule(Parser *p) return _res; } -// _loop0_128: ',' kwarg_or_starred +// _loop0_126: ',' kwarg_or_starred static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25707,7 +25542,7 @@ _loop0_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25738,7 +25573,7 @@ _loop0_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25751,14 +25586,14 @@ _loop0_128_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); D(p->level--); return _seq; } -// _gather_127: kwarg_or_starred _loop0_128 +// _gather_125: kwarg_or_starred _loop0_126 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25767,27 +25602,27 @@ _gather_127_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_128 + { // kwarg_or_starred _loop0_126 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_128")); + D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_128_rule(p)) // _loop0_128 + (seq = _loop0_126_rule(p)) // _loop0_126 ) { - D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_128")); + D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_126")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_128")); + D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_126")); } _res = NULL; done: @@ -25795,9 +25630,9 @@ _gather_127_rule(Parser *p) return _res; } -// _loop0_130: ',' kwarg_or_double_starred +// _loop0_128: ',' kwarg_or_double_starred static asdl_seq * -_loop0_130_rule(Parser *p) +_loop0_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25821,7 +25656,7 @@ _loop0_130_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25852,7 +25687,7 @@ _loop0_130_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25865,14 +25700,14 @@ _loop0_130_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); D(p->level--); return _seq; } -// _gather_129: kwarg_or_double_starred _loop0_130 +// _gather_127: kwarg_or_double_starred _loop0_128 static asdl_seq * -_gather_129_rule(Parser *p) +_gather_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25881,27 +25716,27 @@ _gather_129_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_130 + { // kwarg_or_double_starred _loop0_128 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_130")); + D(fprintf(stderr, "%*c> _gather_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_130_rule(p)) // _loop0_130 + (seq = _loop0_128_rule(p)) // _loop0_128 ) { - D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_130")); + D(fprintf(stderr, "%*c+ _gather_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_128")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_130")); + D(fprintf(stderr, "%*c%s _gather_127[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_128")); } _res = NULL; done: @@ -25909,9 +25744,9 @@ _gather_129_rule(Parser *p) return _res; } -// _loop0_132: ',' kwarg_or_starred +// _loop0_130: ',' kwarg_or_starred static asdl_seq * -_loop0_132_rule(Parser *p) +_loop0_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25935,7 +25770,7 @@ _loop0_132_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -25966,7 +25801,7 @@ _loop0_132_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25979,14 +25814,14 @@ _loop0_132_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq); D(p->level--); return _seq; } -// _gather_131: kwarg_or_starred _loop0_132 +// _gather_129: kwarg_or_starred _loop0_130 static asdl_seq * -_gather_131_rule(Parser *p) +_gather_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25995,27 +25830,27 @@ _gather_131_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_132 + { // kwarg_or_starred _loop0_130 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_132")); + D(fprintf(stderr, "%*c> _gather_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_132_rule(p)) // _loop0_132 + (seq = _loop0_130_rule(p)) // _loop0_130 ) { - D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_132")); + D(fprintf(stderr, "%*c+ _gather_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_130")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_132")); + D(fprintf(stderr, "%*c%s _gather_129[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_130")); } _res = NULL; done: @@ -26023,9 +25858,9 @@ _gather_131_rule(Parser *p) return _res; } -// _loop0_134: ',' kwarg_or_double_starred +// _loop0_132: ',' kwarg_or_double_starred static asdl_seq * -_loop0_134_rule(Parser *p) +_loop0_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26049,7 +25884,7 @@ _loop0_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -26080,7 +25915,7 @@ _loop0_134_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26093,14 +25928,14 @@ _loop0_134_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); D(p->level--); return _seq; } -// _gather_133: kwarg_or_double_starred _loop0_134 +// _gather_131: kwarg_or_double_starred _loop0_132 static asdl_seq * -_gather_133_rule(Parser *p) +_gather_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26109,27 +25944,27 @@ _gather_133_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_134 + { // kwarg_or_double_starred _loop0_132 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_134_rule(p)) // _loop0_134 + (seq = _loop0_132_rule(p)) // _loop0_132 ) { - D(fprintf(stderr, "%*c+ _gather_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_132")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_133[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_134")); + D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_132")); } _res = NULL; done: @@ -26137,9 +25972,9 @@ _gather_133_rule(Parser *p) return _res; } -// _loop0_135: (',' star_target) +// _loop0_133: (',' star_target) static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26163,13 +25998,13 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_166_var; + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_164_var; while ( - (_tmp_166_var = _tmp_166_rule(p)) // ',' star_target + (_tmp_164_var = _tmp_164_rule(p)) // ',' star_target ) { - _res = _tmp_166_var; + _res = _tmp_164_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26185,7 +26020,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26198,14 +26033,14 @@ _loop0_135_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _loop0_137: ',' star_target +// _loop0_135: ',' star_target static asdl_seq * -_loop0_137_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26229,7 +26064,7 @@ _loop0_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -26260,7 +26095,7 @@ _loop0_137_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26273,14 +26108,14 @@ _loop0_137_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_136: star_target _loop0_137 +// _gather_134: star_target _loop0_135 static asdl_seq * -_gather_136_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26289,27 +26124,27 @@ _gather_136_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_137 + { // star_target _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_137")); + D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_137_rule(p)) // _loop0_137 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_137")); + D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_135")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_137")); + D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_135")); } _res = NULL; done: @@ -26317,9 +26152,9 @@ _gather_136_rule(Parser *p) return _res; } -// _tmp_138: !'*' star_target +// _tmp_136: !'*' star_target static void * -_tmp_138_rule(Parser *p) +_tmp_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26333,7 +26168,7 @@ _tmp_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -26341,12 +26176,12 @@ _tmp_138_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); _res = star_target_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -26355,9 +26190,9 @@ _tmp_138_rule(Parser *p) return _res; } -// _loop0_140: ',' del_target +// _loop0_138: ',' del_target static asdl_seq * -_loop0_140_rule(Parser *p) +_loop0_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26381,7 +26216,7 @@ _loop0_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -26412,7 +26247,7 @@ _loop0_140_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_138[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26425,14 +26260,14 @@ _loop0_140_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_138_type, _seq); D(p->level--); return _seq; } -// _gather_139: del_target _loop0_140 +// _gather_137: del_target _loop0_138 static asdl_seq * -_gather_139_rule(Parser *p) +_gather_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26441,27 +26276,27 @@ _gather_139_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_140 + { // del_target _loop0_138 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140")); + D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_140_rule(p)) // _loop0_140 + (seq = _loop0_138_rule(p)) // _loop0_138 ) { - D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140")); + D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_138")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_140")); + D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_138")); } _res = NULL; done: @@ -26469,9 +26304,9 @@ _gather_139_rule(Parser *p) return _res; } -// _loop0_142: ',' target +// _loop0_140: ',' target static asdl_seq * -_loop0_142_rule(Parser *p) +_loop0_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26495,7 +26330,7 @@ _loop0_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); + D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target")); Token * _literal; expr_ty elem; while ( @@ -26526,7 +26361,7 @@ _loop0_142_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26539,14 +26374,14 @@ _loop0_142_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); D(p->level--); return _seq; } -// _gather_141: target _loop0_142 +// _gather_139: target _loop0_140 static asdl_seq * -_gather_141_rule(Parser *p) +_gather_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26555,27 +26390,27 @@ _gather_141_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // target _loop0_142 + { // target _loop0_140 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_142")); + D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) // target && - (seq = _loop0_142_rule(p)) // _loop0_142 + (seq = _loop0_140_rule(p)) // _loop0_140 ) { - D(fprintf(stderr, "%*c+ _gather_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_142")); + D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_140")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_141[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_142")); + D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_140")); } _res = NULL; done: @@ -26583,9 +26418,9 @@ _gather_141_rule(Parser *p) return _res; } -// _tmp_143: args | expression for_if_clauses +// _tmp_141: args | expression for_if_clauses static void * -_tmp_143_rule(Parser *p) +_tmp_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26599,18 +26434,18 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -26618,7 +26453,7 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_comprehension_seq* for_if_clauses_var; if ( @@ -26627,12 +26462,12 @@ _tmp_143_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -26641,9 +26476,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _loop0_144: star_named_expressions +// _loop0_142: star_named_expressions static asdl_seq * -_loop0_144_rule(Parser *p) +_loop0_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26667,7 +26502,7 @@ _loop0_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_expr_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -26689,7 +26524,7 @@ _loop0_144_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26702,14 +26537,14 @@ _loop0_144_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_142_type, _seq); D(p->level--); return _seq; } -// _loop0_145: (star_targets '=') +// _loop0_143: (star_targets '=') static asdl_seq * -_loop0_145_rule(Parser *p) +_loop0_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26733,13 +26568,13 @@ _loop0_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_167_var; + D(fprintf(stderr, "%*c> _loop0_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_165_var; while ( - (_tmp_167_var = _tmp_167_rule(p)) // star_targets '=' + (_tmp_165_var = _tmp_165_rule(p)) // star_targets '=' ) { - _res = _tmp_167_var; + _res = _tmp_165_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26755,7 +26590,7 @@ _loop0_145_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26768,14 +26603,14 @@ _loop0_145_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_145_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_143_type, _seq); D(p->level--); return _seq; } -// _loop0_146: (star_targets '=') +// _loop0_144: (star_targets '=') static asdl_seq * -_loop0_146_rule(Parser *p) +_loop0_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26799,13 +26634,13 @@ _loop0_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_168_var; + D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_166_var; while ( - (_tmp_168_var = _tmp_168_rule(p)) // star_targets '=' + (_tmp_166_var = _tmp_166_rule(p)) // star_targets '=' ) { - _res = _tmp_168_var; + _res = _tmp_166_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26821,7 +26656,7 @@ _loop0_146_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26834,14 +26669,14 @@ _loop0_146_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_144_type, _seq); D(p->level--); return _seq; } -// _tmp_147: yield_expr | star_expressions +// _tmp_145: yield_expr | star_expressions static void * -_tmp_147_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26855,18 +26690,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -26874,18 +26709,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -26894,9 +26729,9 @@ _tmp_147_rule(Parser *p) return _res; } -// _tmp_148: '[' | '(' | '{' +// _tmp_146: '[' | '(' | '{' static void * -_tmp_148_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26910,18 +26745,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -26929,18 +26764,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -26948,18 +26783,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -26968,9 +26803,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _loop0_149: param_no_default +// _loop0_147: param_no_default static asdl_seq * -_loop0_149_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26994,7 +26829,7 @@ _loop0_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -27016,7 +26851,7 @@ _loop0_149_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -27029,14 +26864,14 @@ _loop0_149_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _tmp_150: slash_with_default | param_with_default+ +// _tmp_148: slash_with_default | param_with_default+ static void * -_tmp_150_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27050,18 +26885,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); SlashWithDefault* slash_with_default_var; if ( (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); _res = slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); } { // param_with_default+ @@ -27069,18 +26904,18 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_169_var; + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + asdl_seq * _loop1_167_var; if ( - (_loop1_169_var = _loop1_169_rule(p)) // param_with_default+ + (_loop1_167_var = _loop1_167_rule(p)) // param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_169_var; + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); + _res = _loop1_167_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); } _res = NULL; @@ -27089,9 +26924,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _loop0_151: lambda_param_no_default +// _loop0_149: lambda_param_no_default static asdl_seq * -_loop0_151_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27115,7 +26950,7 @@ _loop0_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -27137,7 +26972,7 @@ _loop0_151_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -27150,14 +26985,14 @@ _loop0_151_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _tmp_152: lambda_slash_with_default | lambda_param_with_default+ +// _tmp_150: lambda_slash_with_default | lambda_param_with_default+ static void * -_tmp_152_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27171,18 +27006,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); SlashWithDefault* lambda_slash_with_default_var; if ( (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); _res = lambda_slash_with_default_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); } { // lambda_param_with_default+ @@ -27190,18 +27025,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - asdl_seq * _loop1_170_var; + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + asdl_seq * _loop1_168_var; if ( - (_loop1_170_var = _loop1_170_rule(p)) // lambda_param_with_default+ + (_loop1_168_var = _loop1_168_rule(p)) // lambda_param_with_default+ ) { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - _res = _loop1_170_var; + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + _res = _loop1_168_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); } _res = NULL; @@ -27210,9 +27045,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: ')' | ',' (')' | '**') +// _tmp_151: ')' | ',' (')' | '**') static void * -_tmp_153_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27226,18 +27061,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -27245,21 +27080,21 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_171_var; + void *_tmp_169_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_171_var = _tmp_171_rule(p)) // ')' | '**' + (_tmp_169_var = _tmp_169_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_171_var); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_169_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -27268,9 +27103,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: ':' | ',' (':' | '**') +// _tmp_152: ':' | ',' (':' | '**') static void * -_tmp_154_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27284,18 +27119,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -27303,21 +27138,21 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_172_var; + void *_tmp_170_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_172_var = _tmp_172_rule(p)) // ':' | '**' + (_tmp_170_var = _tmp_170_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_172_var); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_170_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -27326,9 +27161,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: star_targets '=' +// _tmp_153: star_targets '=' static void * -_tmp_155_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27342,7 +27177,7 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -27351,7 +27186,7 @@ _tmp_155_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27361,7 +27196,7 @@ _tmp_155_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -27370,9 +27205,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _tmp_156: '.' | '...' +// _tmp_154: '.' | '...' static void * -_tmp_156_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27386,18 +27221,18 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -27405,18 +27240,18 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -27425,9 +27260,9 @@ _tmp_156_rule(Parser *p) return _res; } -// _tmp_157: '.' | '...' +// _tmp_155: '.' | '...' static void * -_tmp_157_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27441,18 +27276,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -27460,18 +27295,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -27480,9 +27315,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: '@' named_expression NEWLINE +// _tmp_156: '@' named_expression NEWLINE static void * -_tmp_158_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27496,7 +27331,7 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -27508,7 +27343,7 @@ _tmp_158_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27518,7 +27353,7 @@ _tmp_158_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -27527,9 +27362,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: ',' star_expression +// _tmp_157: ',' star_expression static void * -_tmp_159_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27543,7 +27378,7 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -27552,7 +27387,7 @@ _tmp_159_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27562,7 +27397,7 @@ _tmp_159_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -27571,9 +27406,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: ',' expression +// _tmp_158: ',' expression static void * -_tmp_160_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27587,7 +27422,7 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -27596,7 +27431,7 @@ _tmp_160_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27606,7 +27441,7 @@ _tmp_160_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -27615,9 +27450,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: 'or' conjunction +// _tmp_159: 'or' conjunction static void * -_tmp_161_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27631,7 +27466,7 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -27640,7 +27475,7 @@ _tmp_161_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27650,7 +27485,7 @@ _tmp_161_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -27659,9 +27494,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _tmp_162: 'and' inversion +// _tmp_160: 'and' inversion static void * -_tmp_162_rule(Parser *p) +_tmp_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27675,7 +27510,7 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -27684,7 +27519,7 @@ _tmp_162_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27694,7 +27529,7 @@ _tmp_162_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -27703,9 +27538,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _tmp_163: 'if' disjunction +// _tmp_161: 'if' disjunction static void * -_tmp_163_rule(Parser *p) +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27719,7 +27554,7 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27728,7 +27563,7 @@ _tmp_163_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27738,7 +27573,7 @@ _tmp_163_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27747,9 +27582,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: 'if' disjunction +// _tmp_162: 'if' disjunction static void * -_tmp_164_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27763,7 +27598,7 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -27772,7 +27607,7 @@ _tmp_164_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27782,7 +27617,7 @@ _tmp_164_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -27791,9 +27626,9 @@ _tmp_164_rule(Parser *p) return _res; } -// _tmp_165: starred_expression | named_expression !'=' +// _tmp_163: starred_expression | named_expression !'=' static void * -_tmp_165_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27807,18 +27642,18 @@ _tmp_165_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); expr_ty starred_expression_var; if ( (starred_expression_var = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); _res = starred_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // named_expression !'=' @@ -27826,7 +27661,7 @@ _tmp_165_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression @@ -27834,12 +27669,12 @@ _tmp_165_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='")); } _res = NULL; @@ -27848,9 +27683,9 @@ _tmp_165_rule(Parser *p) return _res; } -// _tmp_166: ',' star_target +// _tmp_164: ',' star_target static void * -_tmp_166_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27864,7 +27699,7 @@ _tmp_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -27873,7 +27708,7 @@ _tmp_166_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -27883,7 +27718,7 @@ _tmp_166_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -27892,9 +27727,9 @@ _tmp_166_rule(Parser *p) return _res; } -// _tmp_167: star_targets '=' +// _tmp_165: star_targets '=' static void * -_tmp_167_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27908,7 +27743,7 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -27917,12 +27752,12 @@ _tmp_167_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -27931,9 +27766,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _tmp_168: star_targets '=' +// _tmp_166: star_targets '=' static void * -_tmp_168_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27947,7 +27782,7 @@ _tmp_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -27956,12 +27791,12 @@ _tmp_168_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -27970,9 +27805,9 @@ _tmp_168_rule(Parser *p) return _res; } -// _loop1_169: param_with_default +// _loop1_167: param_with_default static asdl_seq * -_loop1_169_rule(Parser *p) +_loop1_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27996,7 +27831,7 @@ _loop1_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -28018,7 +27853,7 @@ _loop1_169_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_167[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28036,14 +27871,14 @@ _loop1_169_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_169_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_167_type, _seq); D(p->level--); return _seq; } -// _loop1_170: lambda_param_with_default +// _loop1_168: lambda_param_with_default static asdl_seq * -_loop1_170_rule(Parser *p) +_loop1_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28067,7 +27902,7 @@ _loop1_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -28089,7 +27924,7 @@ _loop1_170_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28107,14 +27942,14 @@ _loop1_170_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_170_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_168_type, _seq); D(p->level--); return _seq; } -// _tmp_171: ')' | '**' +// _tmp_169: ')' | '**' static void * -_tmp_171_rule(Parser *p) +_tmp_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28128,18 +27963,18 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -28147,18 +27982,18 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -28167,9 +28002,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: ':' | '**' +// _tmp_170: ':' | '**' static void * -_tmp_172_rule(Parser *p) +_tmp_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28183,18 +28018,18 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -28202,18 +28037,18 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; diff --git a/Parser/string_parser.c b/Parser/string_parser.c index 1285968b319177..09b8c35106e76a 100644 --- a/Parser/string_parser.c +++ b/Parser/string_parser.c @@ -69,6 +69,9 @@ decode_unicode_with_escapes(Parser *parser, const char *s, size_t len, Token *t) return NULL; } p = buf = PyBytes_AsString(u); + if (p == NULL) { + return NULL; + } end = s + len; while (s < end) { if (*s == '\\') { @@ -381,7 +384,7 @@ fstring_compile_expr(Parser *p, const char *expr_start, const char *expr_end, int lines, cols; if (!fstring_find_expr_location(t, str, &lines, &cols)) { - PyMem_FREE(str); + PyMem_Free(str); return NULL; } diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index f3c1d9b20ade11..96539bd556529a 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -51,7 +51,7 @@ static const char* type_comment_prefix = "# type: "; static struct tok_state * tok_new(void) { - struct tok_state *tok = (struct tok_state *)PyMem_MALLOC( + struct tok_state *tok = (struct tok_state *)PyMem_Malloc( sizeof(struct tok_state)); if (tok == NULL) return NULL; @@ -93,7 +93,7 @@ tok_new(void) static char * new_string(const char *s, Py_ssize_t len, struct tok_state *tok) { - char* result = (char *)PyMem_MALLOC(len + 1); + char* result = (char *)PyMem_Malloc(len + 1); if (!result) { tok->done = E_NOMEM; return NULL; @@ -108,7 +108,7 @@ error_ret(struct tok_state *tok) /* XXX */ { tok->decoding_erred = 1; if (tok->fp != NULL && tok->buf != NULL) /* see PyTokenizer_Free */ - PyMem_FREE(tok->buf); + PyMem_Free(tok->buf); tok->buf = tok->cur = tok->inp = NULL; tok->start = NULL; tok->end = NULL; @@ -184,7 +184,7 @@ get_coding_spec(const char *s, char **spec, Py_ssize_t size, struct tok_state *t return 0; q = get_normal_name(r); if (r != q) { - PyMem_FREE(r); + PyMem_Free(r); r = new_string(q, strlen(q), tok); if (!r) return 0; @@ -244,7 +244,7 @@ check_coding_spec(const char* line, Py_ssize_t size, struct tok_state *tok, else { PyErr_Format(PyExc_SyntaxError, "encoding problem: %s", cs); - PyMem_FREE(cs); + PyMem_Free(cs); } } } else { /* then, compare cs with BOM */ @@ -252,7 +252,7 @@ check_coding_spec(const char* line, Py_ssize_t size, struct tok_state *tok, if (!r) PyErr_Format(PyExc_SyntaxError, "encoding problem: %s with BOM", cs); - PyMem_FREE(cs); + PyMem_Free(cs); } return r; } @@ -315,7 +315,7 @@ check_bom(int get_char(struct tok_state *), return 1; } if (tok->encoding != NULL) - PyMem_FREE(tok->encoding); + PyMem_Free(tok->encoding); tok->encoding = new_string("utf-8", 5, tok); if (!tok->encoding) return 0; @@ -620,7 +620,7 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) { size_t needed_length = strlen(s) + 2, final_length; char *buf, *current; char c = '\0'; - buf = PyMem_MALLOC(needed_length); + buf = PyMem_Malloc(needed_length); if (buf == NULL) { tok->done = E_NOMEM; return NULL; @@ -651,9 +651,9 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) { final_length = current - buf + 1; if (final_length < needed_length && final_length) { /* should never fail */ - char* result = PyMem_REALLOC(buf, final_length); + char* result = PyMem_Realloc(buf, final_length); if (result == NULL) { - PyMem_FREE(buf); + PyMem_Free(buf); } buf = result; } @@ -757,7 +757,7 @@ PyTokenizer_FromUTF8(const char *str, int exec_input) tok->read_coding_spec = 1; tok->enc = NULL; tok->str = translated; - tok->encoding = (char *)PyMem_MALLOC(6); + tok->encoding = (char *)PyMem_Malloc(6); if (!tok->encoding) { PyTokenizer_Free(tok); return NULL; @@ -778,7 +778,7 @@ PyTokenizer_FromFile(FILE *fp, const char* enc, struct tok_state *tok = tok_new(); if (tok == NULL) return NULL; - if ((tok->buf = (char *)PyMem_MALLOC(BUFSIZ)) == NULL) { + if ((tok->buf = (char *)PyMem_Malloc(BUFSIZ)) == NULL) { PyTokenizer_Free(tok); return NULL; } @@ -790,7 +790,7 @@ PyTokenizer_FromFile(FILE *fp, const char* enc, if (enc != NULL) { /* Must copy encoding declaration since it gets copied into the parse tree. */ - tok->encoding = PyMem_MALLOC(strlen(enc)+1); + tok->encoding = PyMem_Malloc(strlen(enc)+1); if (!tok->encoding) { PyTokenizer_Free(tok); return NULL; @@ -808,15 +808,15 @@ void PyTokenizer_Free(struct tok_state *tok) { if (tok->encoding != NULL) - PyMem_FREE(tok->encoding); + PyMem_Free(tok->encoding); Py_XDECREF(tok->decoding_readline); Py_XDECREF(tok->decoding_buffer); Py_XDECREF(tok->filename); if (tok->fp != NULL && tok->buf != NULL) - PyMem_FREE(tok->buf); + PyMem_Free(tok->buf); if (tok->input) - PyMem_FREE(tok->input); - PyMem_FREE(tok); + PyMem_Free(tok->input); + PyMem_Free(tok); } /* Get next char, updating state; error code goes into tok->done */ @@ -852,7 +852,7 @@ tok_nextc(struct tok_state *tok) char *newtok = PyOS_Readline(stdin, stdout, tok->prompt); if (newtok != NULL) { char *translated = translate_newlines(newtok, 0, tok); - PyMem_FREE(newtok); + PyMem_Free(newtok); if (translated == NULL) return EOF; newtok = translated; @@ -862,14 +862,14 @@ tok_nextc(struct tok_state *tok) Py_ssize_t buflen; const char* buf; PyObject *u = translate_into_utf8(newtok, tok->encoding); - PyMem_FREE(newtok); + PyMem_Free(newtok); if (!u) { tok->done = E_DECODE; return EOF; } buflen = PyBytes_GET_SIZE(u); buf = PyBytes_AS_STRING(u); - newtok = PyMem_MALLOC(buflen+1); + newtok = PyMem_Malloc(buflen+1); if (newtok == NULL) { Py_DECREF(u); tok->done = E_NOMEM; @@ -883,7 +883,7 @@ tok_nextc(struct tok_state *tok) if (newtok == NULL) tok->done = E_INTR; else if (*newtok == '\0') { - PyMem_FREE(newtok); + PyMem_Free(newtok); tok->done = E_EOF; } else if (tok->start != NULL) { @@ -892,12 +892,12 @@ tok_nextc(struct tok_state *tok) size_t newlen = oldlen + strlen(newtok); Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf; char *buf = tok->buf; - buf = (char *)PyMem_REALLOC(buf, newlen+1); + buf = (char *)PyMem_Realloc(buf, newlen+1); tok->lineno++; if (buf == NULL) { - PyMem_FREE(tok->buf); + PyMem_Free(tok->buf); tok->buf = NULL; - PyMem_FREE(newtok); + PyMem_Free(newtok); tok->done = E_NOMEM; return EOF; } @@ -906,7 +906,7 @@ tok_nextc(struct tok_state *tok) tok->multi_line_start = tok->buf + cur_multi_line_start; tok->line_start = tok->cur; strcpy(tok->buf + oldlen, newtok); - PyMem_FREE(newtok); + PyMem_Free(newtok); tok->inp = tok->buf + newlen; tok->end = tok->inp + 1; tok->start = tok->buf + start; @@ -914,7 +914,7 @@ tok_nextc(struct tok_state *tok) else { tok->lineno++; if (tok->buf != NULL) - PyMem_FREE(tok->buf); + PyMem_Free(tok->buf); tok->buf = newtok; tok->cur = tok->buf; tok->line_start = tok->buf; @@ -929,7 +929,7 @@ tok_nextc(struct tok_state *tok) if (tok->start == NULL) { if (tok->buf == NULL) { tok->buf = (char *) - PyMem_MALLOC(BUFSIZ); + PyMem_Malloc(BUFSIZ); if (tok->buf == NULL) { tok->done = E_NOMEM; return EOF; @@ -966,7 +966,7 @@ tok_nextc(struct tok_state *tok) Py_ssize_t curvalid = tok->inp - tok->buf; Py_ssize_t newsize = curvalid + BUFSIZ; char *newbuf = tok->buf; - newbuf = (char *)PyMem_REALLOC(newbuf, + newbuf = (char *)PyMem_Realloc(newbuf, newsize); if (newbuf == NULL) { tok->done = E_NOMEM; @@ -1851,7 +1851,7 @@ PyTokenizer_Get(struct tok_state *tok, const char **p_start, const char **p_end) encoding in the first or second line of the file (in which case the encoding should be assumed to be UTF-8). - The char* returned is malloc'ed via PyMem_MALLOC() and thus must be freed + The char* returned is malloc'ed via PyMem_Malloc() and thus must be freed by the caller. */ char * @@ -1894,7 +1894,7 @@ PyTokenizer_FindEncodingFilename(int fd, PyObject *filename) } fclose(fp); if (tok->encoding) { - encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1); + encoding = (char *)PyMem_Malloc(strlen(tok->encoding) + 1); if (encoding) strcpy(encoding, tok->encoding); } diff --git a/Python/_warnings.c b/Python/_warnings.c index 8d33fbe0f878b8..021400f5580d6a 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -24,9 +24,6 @@ _Py_IDENTIFIER(ignore); typedef struct _warnings_runtime_state WarningsState; -/* Forward declaration of the _warnings module definition. */ -static struct PyModuleDef warningsmodule; - _Py_IDENTIFIER(__name__); /* Given a module object, get its per-module state. */ @@ -69,12 +66,14 @@ create_filter(PyObject *category, _Py_Identifier *id, const char *modname) return NULL; } } else { - modname_obj = Py_None; + modname_obj = Py_NewRef(Py_None); } /* This assumes the line number is zero for now. */ - return PyTuple_Pack(5, action_str, Py_None, - category, modname_obj, _PyLong_GetZero()); + PyObject *filter = PyTuple_Pack(5, action_str, Py_None, + category, modname_obj, _PyLong_GetZero()); + Py_DECREF(modname_obj); + return filter; } #endif @@ -1351,52 +1350,45 @@ static PyMethodDef warnings_functions[] = { }; -static struct PyModuleDef warningsmodule = { - PyModuleDef_HEAD_INIT, - MODULE_NAME, /* m_name */ - warnings__doc__, /* m_doc */ - 0, /* m_size */ - warnings_functions, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; - - -PyMODINIT_FUNC -_PyWarnings_Init(void) +static int +warnings_module_exec(PyObject *module) { - PyObject *m; - - m = PyModule_Create(&warningsmodule); - if (m == NULL) { - return NULL; - } - WarningsState *st = warnings_get_state(); if (st == NULL) { - goto error; + return -1; } - - if (PyModule_AddObjectRef(m, "filters", st->filters) < 0) { - goto error; + if (PyModule_AddObjectRef(module, "filters", st->filters) < 0) { + return -1; } - if (PyModule_AddObjectRef(m, "_onceregistry", st->once_registry) < 0) { - goto error; + if (PyModule_AddObjectRef(module, "_onceregistry", st->once_registry) < 0) { + return -1; } - if (PyModule_AddObjectRef(m, "_defaultaction", st->default_action) < 0) { - goto error; + if (PyModule_AddObjectRef(module, "_defaultaction", st->default_action) < 0) { + return -1; } + return 0; +} - return m; -error: - if (st != NULL) { - warnings_clear_state(st); - } - Py_DECREF(m); - return NULL; +static PyModuleDef_Slot warnings_slots[] = { + {Py_mod_exec, warnings_module_exec}, + {0, NULL} +}; + +static struct PyModuleDef warnings_module = { + PyModuleDef_HEAD_INIT, + .m_name = MODULE_NAME, + .m_doc = warnings__doc__, + .m_size = 0, + .m_methods = warnings_functions, + .m_slots = warnings_slots, +}; + + +PyMODINIT_FUNC +_PyWarnings_Init(void) +{ + return PyModuleDef_Init(&warnings_module); } // We need this to ensure that warnings still work until late in finalization. diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 1ce55b6ec5a1ce..352fb83d55e053 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2089,7 +2089,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt) Py_DECREF(stdin_encoding); Py_DECREF(stdin_errors); Py_XDECREF(po); - PyMem_FREE(s); + PyMem_Free(s); if (result != NULL) { if (PySys_Audit("builtins.input/result", "O", result) < 0) { @@ -2636,6 +2636,11 @@ zip_next(zipobject *lz) PyTuple_SET_ITEM(result, i, item); Py_DECREF(olditem); } + // bpo-42536: The GC may have untracked this result tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(result)) { + _PyObject_GC_TRACK(result); + } } else { result = PyTuple_New(tuplesize); if (result == NULL) diff --git a/Python/ceval.c b/Python/ceval.c index 70a49d390b9d5f..11b0fdf37cbd8c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -203,13 +203,18 @@ UNSIGNAL_PENDING_CALLS(PyInterpreterState *interp) static inline void -SIGNAL_PENDING_SIGNALS(PyInterpreterState *interp) +SIGNAL_PENDING_SIGNALS(PyInterpreterState *interp, int force) { struct _ceval_runtime_state *ceval = &interp->runtime->ceval; struct _ceval_state *ceval2 = &interp->ceval; _Py_atomic_store_relaxed(&ceval->signals_pending, 1); - /* eval_breaker is not set to 1 if thread_can_handle_signals() is false */ - COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + if (force) { + _Py_atomic_store_relaxed(&ceval2->eval_breaker, 1); + } + else { + /* eval_breaker is not set to 1 if thread_can_handle_signals() is false */ + COMPUTE_EVAL_BREAKER(interp, ceval, ceval2); + } } @@ -559,10 +564,22 @@ PyEval_RestoreThread(PyThreadState *tstate) void _PyEval_SignalReceived(PyInterpreterState *interp) { +#ifdef MS_WINDOWS + // bpo-42296: On Windows, _PyEval_SignalReceived() is called from a signal + // handler which can run in a thread different than the Python thread, in + // which case _Py_ThreadCanHandleSignals() is wrong. Ignore + // _Py_ThreadCanHandleSignals() and always set eval_breaker to 1. + // + // The next eval_frame_handle_pending() call will call + // _Py_ThreadCanHandleSignals() to recompute eval_breaker. + int force = 1; +#else + int force = 0; +#endif /* bpo-30703: Function called when the C signal handler of Python gets a signal. We cannot queue a callback using _PyEval_AddPendingCall() since that function is not async-signal-safe. */ - SIGNAL_PENDING_SIGNALS(interp); + SIGNAL_PENDING_SIGNALS(interp, force); } /* Push one item onto the queue while holding the lock. */ @@ -662,7 +679,7 @@ handle_signals(PyThreadState *tstate) UNSIGNAL_PENDING_SIGNALS(tstate->interp); if (_PyErr_CheckSignalsTstate(tstate) < 0) { /* On failure, re-schedule a call to handle_signals(). */ - SIGNAL_PENDING_SIGNALS(tstate->interp); + SIGNAL_PENDING_SIGNALS(tstate->interp, 0); return -1; } return 0; @@ -840,20 +857,22 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) return -1; } #endif - if (tstate->overflowed) { + if (tstate->recursion_headroom) { if (tstate->recursion_depth > recursion_limit + 50) { /* Overflowing while handling an overflow. Give up. */ Py_FatalError("Cannot recover from stack overflow."); } - return 0; } - if (tstate->recursion_depth > recursion_limit) { - --tstate->recursion_depth; - tstate->overflowed = 1; - _PyErr_Format(tstate, PyExc_RecursionError, - "maximum recursion depth exceeded%s", - where); - return -1; + else { + if (tstate->recursion_depth > recursion_limit) { + tstate->recursion_headroom++; + _PyErr_Format(tstate, PyExc_RecursionError, + "maximum recursion depth exceeded%s", + where); + tstate->recursion_headroom--; + --tstate->recursion_depth; + return -1; + } } return 0; } @@ -1204,6 +1223,17 @@ eval_frame_handle_pending(PyThreadState *tstate) return -1; } +#ifdef MS_WINDOWS + // bpo-42296: On Windows, _PyEval_SignalReceived() can be called in a + // different thread than the Python thread, in which case + // _Py_ThreadCanHandleSignals() is wrong. Recompute eval_breaker in the + // current Python thread with the correct _Py_ThreadCanHandleSignals() + // value. It prevents to interrupt the eval loop at every instruction if + // the current Python thread cannot handle signals (if + // _Py_ThreadCanHandleSignals() is false). + COMPUTE_EVAL_BREAKER(tstate->interp, ceval, ceval2); +#endif + return 0; } @@ -4317,7 +4347,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) func ->func_closure = POP(); } if (oparg & 0x04) { - assert(PyDict_CheckExact(TOP())); + assert(PyTuple_CheckExact(TOP())); func->func_annotations = POP(); } if (oparg & 0x02) { diff --git a/Python/compile.c b/Python/compile.c index 3d27f2cd818911..53376e41255c44 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -96,6 +96,10 @@ typedef struct basicblock_ { /* b_return is true if a RETURN_VALUE opcode is inserted. */ unsigned b_return : 1; unsigned b_reachable : 1; + /* Basic block has no fall through (it ends with a return, raise or jump) */ + unsigned b_nofallthrough : 1; + /* Basic block exits scope (it ends with a return or raise) */ + unsigned b_exit : 1; /* depth of stack upon entry of block, computed by stackdepth() */ int b_startdepth; /* instruction offset for block, computed by assemble_jump_offsets() */ @@ -816,6 +820,28 @@ compiler_use_next_block(struct compiler *c, basicblock *block) return block; } +static basicblock * +compiler_copy_block(struct compiler *c, basicblock *block) +{ + /* Cannot copy a block if it has a fallthrough, since + * a block can only have one fallthrough predecessor. + */ + assert(block->b_nofallthrough); + basicblock *result = compiler_next_block(c); + if (result == NULL) { + return NULL; + } + for (int i = 0; i < block->b_iused; i++) { + int n = compiler_next_instr(result); + if (n < 0) { + return NULL; + } + result->b_instr[n] = block->b_instr[i]; + } + result->b_exit = block->b_exit; + return result; +} + /* Returns the offset of the next instruction in the current block's b_instr array. Resizes the b_instr as necessary. Returns -1 on failure. @@ -2047,26 +2073,24 @@ compiler_visit_annexpr(struct compiler *c, expr_ty annotation) static int compiler_visit_argannotation(struct compiler *c, identifier id, - expr_ty annotation, PyObject *names) + expr_ty annotation, Py_ssize_t *annotations_len) { if (annotation) { - PyObject *mangled; - VISIT(c, annexpr, annotation); - mangled = _Py_Mangle(c->u->u_private, id); + PyObject *mangled = _Py_Mangle(c->u->u_private, id); if (!mangled) return 0; - if (PyList_Append(names, mangled) < 0) { - Py_DECREF(mangled); - return 0; - } + + ADDOP_LOAD_CONST(c, mangled); Py_DECREF(mangled); + VISIT(c, annexpr, annotation); + *annotations_len += 2; } return 1; } static int compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args, - PyObject *names) + Py_ssize_t *annotations_len) { int i; for (i = 0; i < asdl_seq_LEN(args); i++) { @@ -2075,7 +2099,7 @@ compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args, c, arg->arg, arg->annotation, - names)) + annotations_len)) return 0; } return 1; @@ -2085,58 +2109,44 @@ static int compiler_visit_annotations(struct compiler *c, arguments_ty args, expr_ty returns) { - /* Push arg annotation dict. + /* Push arg annotation names and values. The expressions are evaluated out-of-order wrt the source code. - Return 0 on error, -1 if no dict pushed, 1 if a dict is pushed. + Return 0 on error, -1 if no annotations pushed, 1 if a annotations is pushed. */ static identifier return_str; - PyObject *names; - Py_ssize_t len; - names = PyList_New(0); - if (!names) - return 0; + Py_ssize_t annotations_len = 0; - if (!compiler_visit_argannotations(c, args->args, names)) - goto error; - if (!compiler_visit_argannotations(c, args->posonlyargs, names)) - goto error; + if (!compiler_visit_argannotations(c, args->args, &annotations_len)) + return 0; + if (!compiler_visit_argannotations(c, args->posonlyargs, &annotations_len)) + return 0; if (args->vararg && args->vararg->annotation && !compiler_visit_argannotation(c, args->vararg->arg, - args->vararg->annotation, names)) - goto error; - if (!compiler_visit_argannotations(c, args->kwonlyargs, names)) - goto error; + args->vararg->annotation, &annotations_len)) + return 0; + if (!compiler_visit_argannotations(c, args->kwonlyargs, &annotations_len)) + return 0; if (args->kwarg && args->kwarg->annotation && !compiler_visit_argannotation(c, args->kwarg->arg, - args->kwarg->annotation, names)) - goto error; + args->kwarg->annotation, &annotations_len)) + return 0; if (!return_str) { return_str = PyUnicode_InternFromString("return"); if (!return_str) - goto error; + return 0; } - if (!compiler_visit_argannotation(c, return_str, returns, names)) { - goto error; + if (!compiler_visit_argannotation(c, return_str, returns, &annotations_len)) { + return 0; } - len = PyList_GET_SIZE(names); - if (len) { - PyObject *keytuple = PyList_AsTuple(names); - Py_DECREF(names); - ADDOP_LOAD_CONST_NEW(c, keytuple); - ADDOP_I(c, BUILD_CONST_KEY_MAP, len); + if (annotations_len) { + ADDOP_I(c, BUILD_TUPLE, annotations_len); return 1; } - else { - Py_DECREF(names); - return -1; - } -error: - Py_DECREF(names); - return 0; + return -1; } static int @@ -2296,7 +2306,7 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async) c->u->u_posonlyargcount = asdl_seq_LEN(args->posonlyargs); c->u->u_kwonlyargcount = asdl_seq_LEN(args->kwonlyargs); for (i = docstring ? 1 : 0; i < asdl_seq_LEN(body); i++) { - VISIT(c, stmt, (stmt_ty)asdl_seq_GET(body, i)); + VISIT_IN_SCOPE(c, stmt, (stmt_ty)asdl_seq_GET(body, i)); } co = assemble(c, 1); qualname = c->u->u_qualname; @@ -2607,6 +2617,7 @@ compiler_jump_if(struct compiler *c, expr_ty e, basicblock *next, int cond) VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n)); ADDOP_COMPARE(c, asdl_seq_GET(e->v.Compare.ops, n)); ADDOP_JUMP(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); + NEXT_BLOCK(c); basicblock *end = compiler_new_block(c); if (end == NULL) return 0; @@ -2630,6 +2641,7 @@ compiler_jump_if(struct compiler *c, expr_ty e, basicblock *next, int cond) /* general implementation */ VISIT(c, expr, e); ADDOP_JUMP(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); + NEXT_BLOCK(c); return 1; } @@ -2766,12 +2778,13 @@ compiler_if(struct compiler *c, stmt_ty s) static int compiler_for(struct compiler *c, stmt_ty s) { - basicblock *start, *cleanup, *end; + basicblock *start, *body, *cleanup, *end; start = compiler_new_block(c); + body = compiler_new_block(c); cleanup = compiler_new_block(c); end = compiler_new_block(c); - if (start == NULL || end == NULL || cleanup == NULL) { + if (start == NULL || body == NULL || end == NULL || cleanup == NULL) { return 0; } if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) { @@ -2781,6 +2794,7 @@ compiler_for(struct compiler *c, stmt_ty s) ADDOP(c, GET_ITER); compiler_use_next_block(c, start); ADDOP_JUMP(c, FOR_ITER, cleanup); + compiler_use_next_block(c, body); VISIT(c, expr, s->v.For.target); VISIT_SEQ(c, stmt, s->v.For.body); ADDOP_JUMP(c, JUMP_ABSOLUTE, start); @@ -2849,7 +2863,7 @@ compiler_async_for(struct compiler *c, stmt_ty s) static int compiler_while(struct compiler *c, stmt_ty s) { - basicblock *loop, *orelse, *end, *anchor = NULL; + basicblock *loop, *body, *end, *anchor = NULL; int constant = expr_constant(s->v.While.test); if (constant == 0) { @@ -2870,42 +2884,32 @@ compiler_while(struct compiler *c, stmt_ty s) return 1; } loop = compiler_new_block(c); + body = compiler_new_block(c); + anchor = compiler_new_block(c); end = compiler_new_block(c); - if (constant == -1) { - anchor = compiler_new_block(c); - if (anchor == NULL) - return 0; - } - if (loop == NULL || end == NULL) + if (loop == NULL || body == NULL || anchor == NULL || end == NULL) { return 0; - if (s->v.While.orelse) { - orelse = compiler_new_block(c); - if (orelse == NULL) - return 0; } - else - orelse = NULL; - compiler_use_next_block(c, loop); - if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL)) + if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL)) { return 0; + } if (constant == -1) { - if (!compiler_jump_if(c, s->v.While.test, anchor, 0)) + if (!compiler_jump_if(c, s->v.While.test, anchor, 0)) { return 0; + } } + + compiler_use_next_block(c, body); VISIT_SEQ(c, stmt, s->v.While.body); ADDOP_JUMP(c, JUMP_ABSOLUTE, loop); - /* XXX should the two POP instructions be in a separate block - if there is no else clause ? - */ - - if (constant == -1) - compiler_use_next_block(c, anchor); compiler_pop_fblock(c, WHILE_LOOP, loop); - if (orelse != NULL) /* what if orelse is just pass? */ + compiler_use_next_block(c, anchor); + if (s->v.While.orelse) { VISIT_SEQ(c, stmt, s->v.While.orelse); + } compiler_use_next_block(c, end); return 1; @@ -2936,6 +2940,7 @@ compiler_return(struct compiler *c, stmt_ty s) VISIT(c, expr, s->v.Return.value); } ADDOP(c, RETURN_VALUE); + NEXT_BLOCK(c); return 1; } @@ -2954,6 +2959,7 @@ compiler_break(struct compiler *c) return 0; } ADDOP_JUMP(c, JUMP_ABSOLUTE, loop->fb_exit); + NEXT_BLOCK(c); return 1; } @@ -2968,6 +2974,7 @@ compiler_continue(struct compiler *c) return compiler_error(c, "'continue' not properly in loop"); } ADDOP_JUMP(c, JUMP_ABSOLUTE, loop->fb_block); + NEXT_BLOCK(c) return 1; } @@ -3107,6 +3114,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) ADDOP(c, DUP_TOP); VISIT(c, expr, handler->v.ExceptHandler.type); ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except); + NEXT_BLOCK(c); } ADDOP(c, POP_TOP); if (handler->v.ExceptHandler.name) { @@ -3449,6 +3457,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s) } } ADDOP_I(c, RAISE_VARARGS, (int)n); + NEXT_BLOCK(c); break; case Try_kind: return compiler_try(c, s); @@ -4815,6 +4824,7 @@ compiler_with_except_finish(struct compiler *c) { if (exit == NULL) return 0; ADDOP_JUMP(c, POP_JUMP_IF_TRUE, exit); + NEXT_BLOCK(c); ADDOP(c, RERAISE); compiler_use_next_block(c, exit); ADDOP(c, POP_TOP); @@ -6060,28 +6070,14 @@ struct assembler { PyObject *a_bytecode; /* string containing bytecode */ int a_offset; /* offset into bytecode */ int a_nblocks; /* number of reachable blocks */ - basicblock **a_reverse_postorder; /* list of blocks in dfs postorder */ PyObject *a_lnotab; /* string containing lnotab */ int a_lnotab_off; /* offset into lnotab */ int a_prevlineno; /* lineno of last emitted line in line table */ int a_lineno; /* lineno of last emitted instruction */ int a_lineno_start; /* bytecode start offset of current lineno */ + basicblock *a_entry; }; -static void -dfs(struct compiler *c, basicblock *b, struct assembler *a, int end) -{ - - /* There is no real depth-first-search to do here because all the - * blocks are emitted in topological order already, so we just need to - * follow the b_next pointers and place them in a->a_reverse_postorder in - * reverse order and make sure that the first one starts at 0. */ - - for (a->a_nblocks = 0; b != NULL; b = b->b_next) { - a->a_reverse_postorder[a->a_nblocks++] = b; - } -} - Py_LOCAL_INLINE(void) stackdepth_push(basicblock ***sp, basicblock *b, int depth) { @@ -6157,6 +6153,7 @@ stackdepth(struct compiler *c) } } if (next != NULL) { + assert(b->b_nofallthrough == 0); stackdepth_push(&sp, next, depth); } } @@ -6169,23 +6166,24 @@ assemble_init(struct assembler *a, int nblocks, int firstlineno) { memset(a, 0, sizeof(struct assembler)); a->a_prevlineno = a->a_lineno = firstlineno; + a->a_lnotab = NULL; a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); - if (!a->a_bytecode) - return 0; + if (a->a_bytecode == NULL) { + goto error; + } a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); - if (!a->a_lnotab) - return 0; - if ((size_t)nblocks > SIZE_MAX / sizeof(basicblock *)) { - PyErr_NoMemory(); - return 0; + if (a->a_lnotab == NULL) { + goto error; } - a->a_reverse_postorder = (basicblock **)PyObject_Malloc( - sizeof(basicblock *) * nblocks); - if (!a->a_reverse_postorder) { + if ((size_t)nblocks > SIZE_MAX / sizeof(basicblock *)) { PyErr_NoMemory(); - return 0; + goto error; } return 1; +error: + Py_XDECREF(a->a_bytecode); + Py_XDECREF(a->a_lnotab); + return 0; } static void @@ -6193,8 +6191,6 @@ assemble_free(struct assembler *a) { Py_XDECREF(a->a_bytecode); Py_XDECREF(a->a_lnotab); - if (a->a_reverse_postorder) - PyObject_Free(a->a_reverse_postorder); } static int @@ -6323,8 +6319,7 @@ assemble_jump_offsets(struct assembler *a, struct compiler *c) Replace block pointer with position in bytecode. */ do { totsize = 0; - for (i = 0; i < a->a_nblocks; i++) { - b = a->a_reverse_postorder[i]; + for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) { bsize = blocksize(b); b->b_offset = totsize; totsize += bsize; @@ -6584,15 +6579,22 @@ dump_basicblock(const basicblock *b) } #endif + +static int +normalize_basic_block(basicblock *bb); + static int optimize_cfg(struct assembler *a, PyObject *consts); +static int +ensure_exits_have_lineno(struct compiler *c); + static PyCodeObject * assemble(struct compiler *c, int addNone) { basicblock *b, *entryblock; struct assembler a; - int i, j, nblocks; + int j, nblocks; PyCodeObject *co = NULL; PyObject *consts = NULL; @@ -6607,6 +6609,16 @@ assemble(struct compiler *c, int addNone) ADDOP(c, RETURN_VALUE); } + for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { + if (normalize_basic_block(b)) { + goto error; + } + } + + if (ensure_exits_have_lineno(c)) { + goto error; + } + nblocks = 0; entryblock = NULL; for (b = c->u->u_blocks; b != NULL; b = b->b_list) { @@ -6621,9 +6633,11 @@ assemble(struct compiler *c, int addNone) else c->u->u_firstlineno = 1; } + if (!assemble_init(&a, nblocks, c->u->u_firstlineno)) goto error; - dfs(c, entryblock, &a, nblocks); + a.a_entry = entryblock; + a.a_nblocks = nblocks; consts = consts_dict_keys_inorder(c->u->u_consts); if (consts == NULL) { @@ -6636,9 +6650,8 @@ assemble(struct compiler *c, int addNone) /* Can't modify the bytecode after computing jump offsets. */ assemble_jump_offsets(&a, c); - /* Emit code in reverse postorder from dfs. */ - for (i = 0; i < a.a_nblocks; i++) { - b = a.a_reverse_postorder[i]; + /* Emit code. */ + for(b = entryblock; b != NULL; b = b->b_next) { for (j = 0; j < b->b_iused; j++) if (!assemble_emit(&a, &b->b_instr[j])) goto error; @@ -6723,6 +6736,8 @@ fold_tuple_on_constants(struct instr *inst, return 0; } +/* Maximum size of basic block that should be copied in optimizer */ +#define MAX_COPY_SIZE 4 /* Optimization */ static int @@ -6732,7 +6747,6 @@ optimize_basic_block(basicblock *bb, PyObject *consts) struct instr nop; nop.i_opcode = NOP; struct instr *target; - int lineno; for (int i = 0; i < bb->b_iused; i++) { struct instr *inst = &bb->b_instr[i]; int oparg = inst->i_oparg; @@ -6748,23 +6762,50 @@ optimize_basic_block(basicblock *bb, PyObject *consts) target = &nop; } switch (inst->i_opcode) { - /* Skip over LOAD_CONST trueconst - POP_JUMP_IF_FALSE xx. This improves - "while 1" performance. */ + /* Remove LOAD_CONST const; conditional jump */ case LOAD_CONST: - if (nextop != POP_JUMP_IF_FALSE) { - break; - } - PyObject* cnt = PyList_GET_ITEM(consts, oparg); - int is_true = PyObject_IsTrue(cnt); - if (is_true == -1) { - goto error; - } - if (is_true == 1) { - inst->i_opcode = NOP; - bb->b_instr[i+1].i_opcode = NOP; + { + PyObject* cnt; + int is_true; + int jump_if_true; + switch(nextop) { + case POP_JUMP_IF_FALSE: + case POP_JUMP_IF_TRUE: + cnt = PyList_GET_ITEM(consts, oparg); + is_true = PyObject_IsTrue(cnt); + if (is_true == -1) { + goto error; + } + inst->i_opcode = NOP; + jump_if_true = nextop == POP_JUMP_IF_TRUE; + if (is_true == jump_if_true) { + bb->b_instr[i+1].i_opcode = JUMP_ABSOLUTE; + bb->b_nofallthrough = 1; + } + else { + bb->b_instr[i+1].i_opcode = NOP; + } + break; + case JUMP_IF_FALSE_OR_POP: + case JUMP_IF_TRUE_OR_POP: + cnt = PyList_GET_ITEM(consts, oparg); + is_true = PyObject_IsTrue(cnt); + if (is_true == -1) { + goto error; + } + jump_if_true = nextop == JUMP_IF_TRUE_OR_POP; + if (is_true == jump_if_true) { + bb->b_instr[i+1].i_opcode = JUMP_ABSOLUTE; + bb->b_nofallthrough = 1; + } + else { + inst->i_opcode = NOP; + bb->b_instr[i+1].i_opcode = NOP; + } + break; } break; + } /* Try to fold tuples of constants. Skip over BUILD_SEQN 1 UNPACK_SEQN 1. @@ -6812,16 +6853,21 @@ optimize_basic_block(basicblock *bb, PyObject *consts) switch(target->i_opcode) { case POP_JUMP_IF_FALSE: *inst = *target; + --i; break; case JUMP_ABSOLUTE: case JUMP_FORWARD: case JUMP_IF_FALSE_OR_POP: - inst->i_target = target->i_target; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + --i; + } break; case JUMP_IF_TRUE_OR_POP: assert (inst->i_target->b_iused == 1); inst->i_opcode = POP_JUMP_IF_FALSE; inst->i_target = inst->i_target->b_next; + --i; break; } break; @@ -6830,16 +6876,21 @@ optimize_basic_block(basicblock *bb, PyObject *consts) switch(target->i_opcode) { case POP_JUMP_IF_TRUE: *inst = *target; + --i; break; case JUMP_ABSOLUTE: case JUMP_FORWARD: case JUMP_IF_TRUE_OR_POP: - inst->i_target = target->i_target; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + --i; + } break; case JUMP_IF_FALSE_OR_POP: assert (inst->i_target->b_iused == 1); inst->i_opcode = POP_JUMP_IF_TRUE; inst->i_target = inst->i_target->b_next; + --i; break; } break; @@ -6848,7 +6899,10 @@ optimize_basic_block(basicblock *bb, PyObject *consts) switch(target->i_opcode) { case JUMP_ABSOLUTE: case JUMP_FORWARD: - inst->i_target = target->i_target; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + --i; + } break; } break; @@ -6857,26 +6911,44 @@ optimize_basic_block(basicblock *bb, PyObject *consts) switch(target->i_opcode) { case JUMP_ABSOLUTE: case JUMP_FORWARD: - inst->i_target = target->i_target; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + --i; + } break; } break; case JUMP_ABSOLUTE: case JUMP_FORWARD: + assert (i == bb->b_iused-1); switch(target->i_opcode) { case JUMP_FORWARD: - inst->i_target = target->i_target; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + --i; + } break; case JUMP_ABSOLUTE: - case RETURN_VALUE: - case RERAISE: - case RAISE_VARARGS: - lineno = inst->i_lineno; - *inst = *target; - inst->i_lineno = lineno; + if (inst->i_target != target->i_target) { + inst->i_target = target->i_target; + inst->i_opcode = target->i_opcode; + --i; + } break; } + if (inst->i_target->b_exit && inst->i_target->b_iused <= MAX_COPY_SIZE) { + basicblock *to_copy = inst->i_target; + *inst = to_copy->b_instr[0]; + for (i = 1; i < to_copy->b_iused; i++) { + int index = compiler_next_instr(bb); + if (index < 0) { + return -1; + } + bb->b_instr[index] = to_copy->b_instr[i]; + } + bb->b_exit = 1; + } break; } } @@ -6888,52 +6960,87 @@ optimize_basic_block(basicblock *bb, PyObject *consts) static void clean_basic_block(basicblock *bb) { - /* Remove NOPs and any code following a return or re-raise. */ + /* Remove NOPs. */ int dest = 0; int prev_lineno = -1; for (int src = 0; src < bb->b_iused; src++) { int lineno = bb->b_instr[src].i_lineno; - switch(bb->b_instr[src].i_opcode) { - case RETURN_VALUE: - case RERAISE: - bb->b_next = NULL; - bb->b_instr[dest] = bb->b_instr[src]; - dest++; - goto end; - case NOP: - { - /* Eliminate no-op if it doesn't have a line number, or - * if the next instruction has same line number or no line number, or - * if the previous instruction had the same line number. */ - if (lineno < 0) { - break; + if (bb->b_instr[src].i_opcode == NOP) { + /* Eliminate no-op if it doesn't have a line number */ + if (lineno < 0) { + continue; + } + /* or, if the previous instruction had the same line number. */ + if (prev_lineno == lineno) { + continue; + } + /* or, if the next instruction has same line number or no line number */ + if (src < bb->b_iused - 1) { + int next_lineno = bb->b_instr[src+1].i_lineno; + if (next_lineno < 0 || next_lineno == lineno) { + bb->b_instr[src+1].i_lineno = lineno; + continue; } - if (prev_lineno == lineno) { - break; + } + else { + basicblock* next = bb->b_next; + while (next && next->b_iused == 0) { + next = next->b_next; } - if (src < bb->b_iused - 1) { - int next_lineno = bb->b_instr[src+1].i_lineno; - if (next_lineno < 0 || next_lineno == lineno) { - bb->b_instr[src+1].i_lineno = lineno; - break; + /* or if last instruction in BB and next BB has same line number */ + if (next) { + if (lineno == next->b_instr[0].i_lineno) { + continue; } } } - /* fallthrough */ - default: - if (dest != src) { - bb->b_instr[dest] = bb->b_instr[src]; - } - dest++; - prev_lineno = lineno; - break; + } + if (dest != src) { + bb->b_instr[dest] = bb->b_instr[src]; + } + dest++; + prev_lineno = lineno; } -end: assert(dest <= bb->b_iused); bb->b_iused = dest; } +static int +normalize_basic_block(basicblock *bb) { + /* Mark blocks as exit and/or nofallthrough. + Raise SystemError if CFG is malformed. */ + for (int i = 0; i < bb->b_iused; i++) { + switch(bb->b_instr[i].i_opcode) { + case RETURN_VALUE: + case RAISE_VARARGS: + case RERAISE: + bb->b_exit = 1; + bb->b_nofallthrough = 1; + break; + case JUMP_ABSOLUTE: + case JUMP_FORWARD: + bb->b_nofallthrough = 1; + /* fall through */ + case POP_JUMP_IF_FALSE: + case POP_JUMP_IF_TRUE: + case JUMP_IF_FALSE_OR_POP: + case JUMP_IF_TRUE_OR_POP: + case FOR_ITER: + if (i != bb->b_iused-1) { + PyErr_SetString(PyExc_SystemError, "malformed control flow graph."); + return -1; + } + /* Skip over empty basic blocks. */ + while (bb->b_instr[i].i_target->b_iused == 0) { + bb->b_instr[i].i_target = bb->b_instr[i].i_target->b_next; + } + + } + } + return 0; +} + static int mark_reachable(struct assembler *a) { basicblock **stack, **sp; @@ -6941,12 +7048,11 @@ mark_reachable(struct assembler *a) { if (stack == NULL) { return -1; } - basicblock *entry = a->a_reverse_postorder[0]; - entry->b_reachable = 1; - *sp++ = entry; + a->a_entry->b_reachable = 1; + *sp++ = a->a_entry; while (sp > stack) { basicblock *b = *(--sp); - if (b->b_next && b->b_next->b_reachable == 0) { + if (b->b_next && !b->b_nofallthrough && b->b_next->b_reachable == 0) { b->b_next->b_reachable = 1; *sp++ = b->b_next; } @@ -6965,8 +7071,27 @@ mark_reachable(struct assembler *a) { return 0; } +/* If an instruction has no line number, but it's predecessor in the BB does, + * then copy the line number. This reduces the size of the line number table, + * but has no impact on the generated line number events. + */ +static void +minimize_lineno_table(struct assembler *a) { + for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) { + int prev_lineno = -1; + for (int i = 0; i < b->b_iused; i++) { + if (b->b_instr[i].i_lineno < 0) { + b->b_instr[i].i_lineno = prev_lineno; + } + else { + prev_lineno = b->b_instr[i].i_lineno; + } + } + + } +} -/* Perform basic peephole optimizations on a control flow graph. +/* Perform optimizations on a control flow graph. The consts object should still be in list form to allow new constants to be appended. @@ -6978,25 +7103,85 @@ mark_reachable(struct assembler *a) { static int optimize_cfg(struct assembler *a, PyObject *consts) { - for (int i = 0; i < a->a_nblocks; i++) { - if (optimize_basic_block(a->a_reverse_postorder[i], consts)) { + for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) { + if (optimize_basic_block(b, consts)) { return -1; } - clean_basic_block(a->a_reverse_postorder[i]); - assert(a->a_reverse_postorder[i]->b_reachable == 0); + clean_basic_block(b); + assert(b->b_reachable == 0); } if (mark_reachable(a)) { return -1; } /* Delete unreachable instructions */ - for (int i = 0; i < a->a_nblocks; i++) { - if (a->a_reverse_postorder[i]->b_reachable == 0) { - a->a_reverse_postorder[i]->b_iused = 0; + for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) { + if (b->b_reachable == 0) { + b->b_iused = 0; } } + minimize_lineno_table(a); return 0; } +static inline int +is_exit_without_lineno(basicblock *b) { + return b->b_exit && b->b_instr[0].i_lineno < 0; +} + +/* PEP 626 mandates that the f_lineno of a frame is correct + * after a frame terminates. It would be prohibitively expensive + * to continuously update the f_lineno field at runtime, + * so we make sure that all exiting instruction (raises and returns) + * have a valid line number, allowing us to compute f_lineno lazily. + * We can do this by duplicating the exit blocks without line number + * so that none have more than one predecessor. We can then safely + * copy the line number from the sole predecessor block. + */ +static int +ensure_exits_have_lineno(struct compiler *c) +{ + basicblock *entry = NULL; + /* Copy all exit blocks without line number that are targets of a jump. + */ + for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { + if (b->b_iused > 0 && is_jump(&b->b_instr[b->b_iused-1])) { + switch (b->b_instr[b->b_iused-1].i_opcode) { + /* Note: Only actual jumps, not exception handlers */ + case SETUP_ASYNC_WITH: + case SETUP_WITH: + case SETUP_FINALLY: + continue; + } + basicblock *target = b->b_instr[b->b_iused-1].i_target; + if (is_exit_without_lineno(target)) { + basicblock *new_target = compiler_copy_block(c, target); + if (new_target == NULL) { + return -1; + } + new_target->b_instr[0].i_lineno = b->b_instr[b->b_iused-1].i_lineno; + b->b_instr[b->b_iused-1].i_target = new_target; + } + } + entry = b; + } + assert(entry != NULL); + if (is_exit_without_lineno(entry)) { + entry->b_instr[0].i_lineno = c->u->u_firstlineno; + } + /* Any remaining reachable exit blocks without line number can only be reached by + * fall through, and thus can only have a single predecessor */ + for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { + if (!b->b_nofallthrough && b->b_next && b->b_iused > 0) { + if (is_exit_without_lineno(b->b_next)) { + assert(b->b_next->b_iused > 0); + b->b_next->b_instr[0].i_lineno = b->b_instr[b->b_iused-1].i_lineno; + } + } + } + return 0; +} + + /* Retained for API compatibility. * Optimization is now done in optimize_cfg */ diff --git a/Python/errors.c b/Python/errors.c index f80ae21fdde7ce..9bac7ba70f5d5e 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -290,12 +290,14 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, PyObject **val, PyObject **tb) { int recursion_depth = 0; + tstate->recursion_headroom++; PyObject *type, *value, *initial_tb; restart: type = *exc; if (type == NULL) { /* There was no exception, so nothing to do. */ + tstate->recursion_headroom--; return; } @@ -347,6 +349,7 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, } *exc = type; *val = value; + tstate->recursion_headroom--; return; error: @@ -1531,9 +1534,6 @@ PyErr_WriteUnraisable(PyObject *obj) } -extern PyObject *PyModule_GetWarningsModule(void); - - void PyErr_SyntaxLocation(const char *filename, int lineno) { @@ -1697,13 +1697,18 @@ err_programtext(PyThreadState *tstate, FILE *fp, int lineno) PyObject * PyErr_ProgramText(const char *filename, int lineno) { - FILE *fp; - if (filename == NULL || *filename == '\0' || lineno <= 0) { + if (filename == NULL) { return NULL; } - PyThreadState *tstate = _PyThreadState_GET(); - fp = _Py_fopen(filename, "r" PY_STDIOTEXTMODE); - return err_programtext(tstate, fp, lineno); + + PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename); + if (filename_obj == NULL) { + PyErr_Clear(); + return NULL; + } + PyObject *res = PyErr_ProgramTextObject(filename_obj, lineno); + Py_DECREF(filename_obj); + return res; } PyObject * diff --git a/Python/fileutils.c b/Python/fileutils.c index b589d7390d46dc..ac382821174211 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -2070,7 +2070,9 @@ _Py_get_blocking(int fd) int _Py_set_blocking(int fd, int blocking) { -#if defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO) +/* bpo-41462: On VxWorks, ioctl(FIONBIO) only works on sockets. + Use fcntl() instead. */ +#if defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO) && !defined(__VXWORKS__) int arg = !blocking; if (ioctl(fd, FIONBIO, &arg) < 0) goto error; diff --git a/Python/getargs.c b/Python/getargs.c index c85ff6d4777d2c..8839492e5ef41a 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -202,7 +202,7 @@ static int cleanup_ptr(PyObject *self, void *ptr) { if (ptr) { - PyMem_FREE(ptr); + PyMem_Free(ptr); } return 0; } @@ -246,7 +246,7 @@ cleanreturn(int retval, freelist_t *freelist) } } if (freelist->entries_malloced) - PyMem_FREE(freelist->entries); + PyMem_Free(freelist->entries); return retval; } diff --git a/Python/import.c b/Python/import.c index 51630c3486af61..1522abc705ffb2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -4,6 +4,7 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with */ +#include "pycore_import.h" // _PyImport_BootstrapImp() #include "pycore_initconfig.h" #include "pycore_pyerrors.h" #include "pycore_pyhash.h" @@ -978,84 +979,80 @@ PyImport_GetImporter(PyObject *path) return importer; } -/*[clinic input] -_imp.create_builtin - - spec: object - / - -Create an extension module. -[clinic start generated code]*/ - -static PyObject * -_imp_create_builtin(PyObject *module, PyObject *spec) -/*[clinic end generated code: output=ace7ff22271e6f39 input=37f966f890384e47]*/ +static PyObject* +create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec) { - PyThreadState *tstate = _PyThreadState_GET(); - struct _inittab *p; - PyObject *name; - const char *namestr; - PyObject *mod; - - name = PyObject_GetAttrString(spec, "name"); - if (name == NULL) { - return NULL; - } - - mod = _PyImport_FindExtensionObject(name, name); + PyObject *mod = _PyImport_FindExtensionObject(name, name); if (mod || _PyErr_Occurred(tstate)) { - Py_DECREF(name); Py_XINCREF(mod); return mod; } - namestr = PyUnicode_AsUTF8(name); - if (namestr == NULL) { - Py_DECREF(name); - return NULL; - } - PyObject *modules = tstate->interp->modules; - for (p = PyImport_Inittab; p->name != NULL; p++) { - PyModuleDef *def; + for (struct _inittab *p = PyImport_Inittab; p->name != NULL; p++) { if (_PyUnicode_EqualToASCIIString(name, p->name)) { if (p->initfunc == NULL) { /* Cannot re-init internal module ("sys" or "builtins") */ - mod = PyImport_AddModule(namestr); - Py_DECREF(name); - return mod; + return PyImport_AddModuleObject(name); } + mod = (*p->initfunc)(); if (mod == NULL) { - Py_DECREF(name); return NULL; } + if (PyObject_TypeCheck(mod, &PyModuleDef_Type)) { - Py_DECREF(name); return PyModule_FromDefAndSpec((PyModuleDef*)mod, spec); - } else { + } + else { /* Remember pointer to module init function. */ - def = PyModule_GetDef(mod); + PyModuleDef *def = PyModule_GetDef(mod); if (def == NULL) { - Py_DECREF(name); return NULL; } + def->m_base.m_init = p->initfunc; if (_PyImport_FixupExtensionObject(mod, name, name, modules) < 0) { - Py_DECREF(name); return NULL; } - Py_DECREF(name); return mod; } } } - Py_DECREF(name); + + // not found Py_RETURN_NONE; } + +/*[clinic input] +_imp.create_builtin + + spec: object + / + +Create an extension module. +[clinic start generated code]*/ + +static PyObject * +_imp_create_builtin(PyObject *module, PyObject *spec) +/*[clinic end generated code: output=ace7ff22271e6f39 input=37f966f890384e47]*/ +{ + PyThreadState *tstate = _PyThreadState_GET(); + + PyObject *name = PyObject_GetAttrString(spec, "name"); + if (name == NULL) { + return NULL; + } + + PyObject *mod = create_builtin(tstate, name, spec); + Py_DECREF(name); + return mod; +} + + /* Frozen modules */ static const struct _frozen * @@ -2127,46 +2124,88 @@ static PyMethodDef imp_methods[] = { }; -static struct PyModuleDef impmodule = { +static int +imp_module_exec(PyObject *module) +{ + const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode; + PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1); + if (pyc_mode == NULL) { + return -1; + } + if (PyModule_AddObjectRef(module, "check_hash_based_pycs", pyc_mode) < 0) { + Py_DECREF(pyc_mode); + return -1; + } + Py_DECREF(pyc_mode); + + return 0; +} + + +static PyModuleDef_Slot imp_slots[] = { + {Py_mod_exec, imp_module_exec}, + {0, NULL} +}; + +static struct PyModuleDef imp_module = { PyModuleDef_HEAD_INIT, - "_imp", - doc_imp, - 0, - imp_methods, - NULL, - NULL, - NULL, - NULL + .m_name = "_imp", + .m_doc = doc_imp, + .m_size = 0, + .m_methods = imp_methods, + .m_slots = imp_slots, }; PyMODINIT_FUNC PyInit__imp(void) { - PyObject *m, *d; + return PyModuleDef_Init(&imp_module); +} - m = PyModule_Create(&impmodule); - if (m == NULL) { - goto failure; + +// Import the _imp extension by calling manually _imp.create_builtin() and +// _imp.exec_builtin() since importlib is not initialized yet. Initializing +// importlib requires the _imp module: this function fix the bootstrap issue. +PyObject* +_PyImport_BootstrapImp(PyThreadState *tstate) +{ + PyObject *name = PyUnicode_FromString("_imp"); + if (name == NULL) { + return NULL; } - d = PyModule_GetDict(m); - if (d == NULL) { - goto failure; + + // Mock a ModuleSpec object just good enough for PyModule_FromDefAndSpec(): + // an object with just a name attribute. + // + // _imp.__spec__ is overriden by importlib._bootstrap._instal() anyway. + PyObject *attrs = Py_BuildValue("{sO}", "name", name); + if (attrs == NULL) { + goto error; + } + PyObject *spec = _PyNamespace_New(attrs); + Py_DECREF(attrs); + if (spec == NULL) { + goto error; } - const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode; - PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1); - if (pyc_mode == NULL) { - goto failure; + // Create the _imp module from its definition. + PyObject *mod = create_builtin(tstate, name, spec); + Py_CLEAR(name); + Py_DECREF(spec); + if (mod == NULL) { + goto error; } - if (PyDict_SetItemString(d, "check_hash_based_pycs", pyc_mode) < 0) { - Py_DECREF(pyc_mode); - goto failure; + assert(mod != Py_None); // not found + + // Execute the _imp module: call imp_module_exec(). + if (exec_builtin_or_dynamic(mod) < 0) { + Py_DECREF(mod); + goto error; } - Py_DECREF(pyc_mode); + return mod; - return m; - failure: - Py_XDECREF(m); +error: + Py_XDECREF(name); return NULL; } diff --git a/Python/importlib.h b/Python/importlib.h index 8778c973ef064f..6c77d775e38a7b 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -1,542 +1,561 @@ /* Auto-generated by Programs/_freeze_importlib.c */ const unsigned char _Py_M__importlib_bootstrap[] = { 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,4,0,0,0,64,0,0,0,115,194,1,0,0,100,0, - 90,0,100,1,97,1,100,2,100,3,132,0,90,2,100,4, - 100,5,132,0,90,3,105,0,90,4,105,0,90,5,71,0, - 100,6,100,7,132,0,100,7,101,6,131,3,90,7,71,0, - 100,8,100,9,132,0,100,9,131,2,90,8,71,0,100,10, - 100,11,132,0,100,11,131,2,90,9,71,0,100,12,100,13, - 132,0,100,13,131,2,90,10,100,14,100,15,132,0,90,11, - 100,16,100,17,132,0,90,12,100,18,100,19,132,0,90,13, - 100,20,100,21,156,1,100,22,100,23,132,2,90,14,100,24, - 100,25,132,0,90,15,100,26,100,27,132,0,90,16,100,28, - 100,29,132,0,90,17,100,30,100,31,132,0,90,18,71,0, - 100,32,100,33,132,0,100,33,131,2,90,19,100,1,100,1, - 100,34,156,2,100,35,100,36,132,2,90,20,100,94,100,37, - 100,38,132,1,90,21,100,39,100,40,156,1,100,41,100,42, - 132,2,90,22,100,43,100,44,132,0,90,23,100,45,100,46, - 132,0,90,24,100,47,100,48,132,0,90,25,100,49,100,50, - 132,0,90,26,100,51,100,52,132,0,90,27,100,53,100,54, - 132,0,90,28,71,0,100,55,100,56,132,0,100,56,131,2, - 90,29,71,0,100,57,100,58,132,0,100,58,131,2,90,30, - 71,0,100,59,100,60,132,0,100,60,131,2,90,31,100,61, - 100,62,132,0,90,32,100,63,100,64,132,0,90,33,100,95, - 100,65,100,66,132,1,90,34,100,67,100,68,132,0,90,35, - 100,69,90,36,101,36,100,70,23,0,90,37,100,71,100,72, - 132,0,90,38,101,39,131,0,90,40,100,73,100,74,132,0, - 90,41,100,96,100,76,100,77,132,1,90,42,100,39,100,78, - 156,1,100,79,100,80,132,2,90,43,100,81,100,82,132,0, - 90,44,100,97,100,84,100,85,132,1,90,45,100,86,100,87, - 132,0,90,46,100,88,100,89,132,0,90,47,100,90,100,91, - 132,0,90,48,100,92,100,93,132,0,90,49,100,1,83,0, - 41,98,97,83,1,0,0,67,111,114,101,32,105,109,112,108, - 101,109,101,110,116,97,116,105,111,110,32,111,102,32,105,109, - 112,111,114,116,46,10,10,84,104,105,115,32,109,111,100,117, - 108,101,32,105,115,32,78,79,84,32,109,101,97,110,116,32, - 116,111,32,98,101,32,100,105,114,101,99,116,108,121,32,105, - 109,112,111,114,116,101,100,33,32,73,116,32,104,97,115,32, - 98,101,101,110,32,100,101,115,105,103,110,101,100,32,115,117, - 99,104,10,116,104,97,116,32,105,116,32,99,97,110,32,98, - 101,32,98,111,111,116,115,116,114,97,112,112,101,100,32,105, - 110,116,111,32,80,121,116,104,111,110,32,97,115,32,116,104, - 101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110, - 32,111,102,32,105,109,112,111,114,116,46,32,65,115,10,115, - 117,99,104,32,105,116,32,114,101,113,117,105,114,101,115,32, - 116,104,101,32,105,110,106,101,99,116,105,111,110,32,111,102, - 32,115,112,101,99,105,102,105,99,32,109,111,100,117,108,101, - 115,32,97,110,100,32,97,116,116,114,105,98,117,116,101,115, - 32,105,110,32,111,114,100,101,114,32,116,111,10,119,111,114, - 107,46,32,79,110,101,32,115,104,111,117,108,100,32,117,115, - 101,32,105,109,112,111,114,116,108,105,98,32,97,115,32,116, - 104,101,32,112,117,98,108,105,99,45,102,97,99,105,110,103, - 32,118,101,114,115,105,111,110,32,111,102,32,116,104,105,115, - 32,109,111,100,117,108,101,46,10,10,78,99,2,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,7,0,0,0, - 67,0,0,0,115,56,0,0,0,100,1,68,0,93,32,125, - 2,116,0,124,1,124,2,131,2,114,4,116,1,124,0,124, - 2,116,2,124,1,124,2,131,2,131,3,1,0,113,4,124, - 0,106,3,160,4,124,1,106,3,161,1,1,0,100,2,83, - 0,41,3,122,47,83,105,109,112,108,101,32,115,117,98,115, - 116,105,116,117,116,101,32,102,111,114,32,102,117,110,99,116, - 111,111,108,115,46,117,112,100,97,116,101,95,119,114,97,112, - 112,101,114,46,41,4,218,10,95,95,109,111,100,117,108,101, - 95,95,218,8,95,95,110,97,109,101,95,95,218,12,95,95, - 113,117,97,108,110,97,109,101,95,95,218,7,95,95,100,111, - 99,95,95,78,41,5,218,7,104,97,115,97,116,116,114,218, - 7,115,101,116,97,116,116,114,218,7,103,101,116,97,116,116, - 114,218,8,95,95,100,105,99,116,95,95,218,6,117,112,100, - 97,116,101,41,3,90,3,110,101,119,90,3,111,108,100,218, - 7,114,101,112,108,97,99,101,169,0,114,10,0,0,0,250, - 29,60,102,114,111,122,101,110,32,105,109,112,111,114,116,108, - 105,98,46,95,98,111,111,116,115,116,114,97,112,62,218,5, - 95,119,114,97,112,27,0,0,0,115,12,0,0,0,8,2, - 10,1,20,1,14,1,4,128,255,128,114,12,0,0,0,99, - 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,116, - 1,131,1,124,0,131,1,83,0,169,1,78,41,2,218,4, - 116,121,112,101,218,3,115,121,115,169,1,218,4,110,97,109, - 101,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 218,11,95,110,101,119,95,109,111,100,117,108,101,35,0,0, - 0,115,4,0,0,0,12,1,255,128,114,18,0,0,0,99, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,0,0,0,64,0,0,0,115,12,0,0,0,101,0,90, - 1,100,0,90,2,100,1,83,0,41,2,218,14,95,68,101, - 97,100,108,111,99,107,69,114,114,111,114,78,41,3,114,1, - 0,0,0,114,0,0,0,0,114,2,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,19,0,0,0,48,0,0,0,115,6,0,0,0,8, - 0,4,1,255,128,114,19,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, - 0,0,0,115,56,0,0,0,101,0,90,1,100,0,90,2, - 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, - 132,0,90,5,100,6,100,7,132,0,90,6,100,8,100,9, - 132,0,90,7,100,10,100,11,132,0,90,8,100,12,83,0, - 41,13,218,11,95,77,111,100,117,108,101,76,111,99,107,122, - 169,65,32,114,101,99,117,114,115,105,118,101,32,108,111,99, - 107,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110, - 32,119,104,105,99,104,32,105,115,32,97,98,108,101,32,116, - 111,32,100,101,116,101,99,116,32,100,101,97,100,108,111,99, - 107,115,10,32,32,32,32,40,101,46,103,46,32,116,104,114, - 101,97,100,32,49,32,116,114,121,105,110,103,32,116,111,32, - 116,97,107,101,32,108,111,99,107,115,32,65,32,116,104,101, - 110,32,66,44,32,97,110,100,32,116,104,114,101,97,100,32, - 50,32,116,114,121,105,110,103,32,116,111,10,32,32,32,32, - 116,97,107,101,32,108,111,99,107,115,32,66,32,116,104,101, - 110,32,65,41,46,10,32,32,32,32,99,2,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, - 0,0,0,115,48,0,0,0,116,0,160,1,161,0,124,0, - 95,2,116,0,160,1,161,0,124,0,95,3,124,1,124,0, - 95,4,100,0,124,0,95,5,100,1,124,0,95,6,100,1, - 124,0,95,7,100,0,83,0,169,2,78,233,0,0,0,0, - 41,8,218,7,95,116,104,114,101,97,100,90,13,97,108,108, - 111,99,97,116,101,95,108,111,99,107,218,4,108,111,99,107, - 218,6,119,97,107,101,117,112,114,17,0,0,0,218,5,111, - 119,110,101,114,218,5,99,111,117,110,116,218,7,119,97,105, - 116,101,114,115,169,2,218,4,115,101,108,102,114,17,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 218,8,95,95,105,110,105,116,95,95,58,0,0,0,115,16, - 0,0,0,10,1,10,1,6,1,6,1,6,1,6,1,4, - 128,255,128,122,20,95,77,111,100,117,108,101,76,111,99,107, - 46,95,95,105,110,105,116,95,95,99,1,0,0,0,0,0, - 0,0,0,0,0,0,5,0,0,0,3,0,0,0,67,0, - 0,0,115,88,0,0,0,116,0,160,1,161,0,125,1,124, - 0,106,2,125,2,116,3,131,0,125,3,116,4,160,5,124, - 2,161,1,125,4,124,4,100,0,117,0,114,42,100,1,83, - 0,124,4,106,2,125,2,124,2,124,1,107,2,114,60,100, - 2,83,0,124,2,124,3,118,0,114,72,100,1,83,0,124, - 3,160,6,124,2,161,1,1,0,113,20,100,0,83,0,41, - 3,78,70,84,41,7,114,23,0,0,0,218,9,103,101,116, - 95,105,100,101,110,116,114,26,0,0,0,218,3,115,101,116, - 218,12,95,98,108,111,99,107,105,110,103,95,111,110,218,3, - 103,101,116,218,3,97,100,100,41,5,114,30,0,0,0,90, - 2,109,101,218,3,116,105,100,90,4,115,101,101,110,114,24, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,218,12,104,97,115,95,100,101,97,100,108,111,99,107, - 66,0,0,0,115,28,0,0,0,8,2,6,1,6,1,10, - 2,8,1,4,1,6,1,8,1,4,1,8,1,4,6,12, - 1,4,128,255,128,122,24,95,77,111,100,117,108,101,76,111, - 99,107,46,104,97,115,95,100,101,97,100,108,111,99,107,99, - 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 8,0,0,0,67,0,0,0,115,210,0,0,0,116,0,160, - 1,161,0,125,1,124,0,116,2,124,1,60,0,122,180,124, - 0,106,3,143,126,1,0,124,0,106,4,100,1,107,2,115, - 46,124,0,106,5,124,1,107,2,114,90,124,1,124,0,95, - 5,124,0,4,0,106,4,100,2,55,0,2,0,95,4,87, - 0,100,3,4,0,4,0,131,3,1,0,87,0,116,2,124, - 1,61,0,100,4,83,0,124,0,160,6,161,0,114,110,116, - 7,100,5,124,0,22,0,131,1,130,1,124,0,106,8,160, - 9,100,6,161,1,114,136,124,0,4,0,106,10,100,2,55, - 0,2,0,95,10,87,0,100,3,4,0,4,0,131,3,1, - 0,110,16,49,0,115,156,48,0,1,0,1,0,1,0,89, - 0,1,0,124,0,106,8,160,9,161,0,1,0,124,0,106, - 8,160,11,161,0,1,0,113,18,87,0,116,2,124,1,61, - 0,110,8,116,2,124,1,61,0,48,0,100,3,83,0,41, - 7,122,185,10,32,32,32,32,32,32,32,32,65,99,113,117, - 105,114,101,32,116,104,101,32,109,111,100,117,108,101,32,108, - 111,99,107,46,32,32,73,102,32,97,32,112,111,116,101,110, - 116,105,97,108,32,100,101,97,100,108,111,99,107,32,105,115, - 32,100,101,116,101,99,116,101,100,44,10,32,32,32,32,32, - 32,32,32,97,32,95,68,101,97,100,108,111,99,107,69,114, - 114,111,114,32,105,115,32,114,97,105,115,101,100,46,10,32, - 32,32,32,32,32,32,32,79,116,104,101,114,119,105,115,101, - 44,32,116,104,101,32,108,111,99,107,32,105,115,32,97,108, - 119,97,121,115,32,97,99,113,117,105,114,101,100,32,97,110, - 100,32,84,114,117,101,32,105,115,32,114,101,116,117,114,110, - 101,100,46,10,32,32,32,32,32,32,32,32,114,22,0,0, - 0,233,1,0,0,0,78,84,122,23,100,101,97,100,108,111, - 99,107,32,100,101,116,101,99,116,101,100,32,98,121,32,37, - 114,70,41,12,114,23,0,0,0,114,32,0,0,0,114,34, - 0,0,0,114,24,0,0,0,114,27,0,0,0,114,26,0, - 0,0,114,38,0,0,0,114,19,0,0,0,114,25,0,0, - 0,218,7,97,99,113,117,105,114,101,114,28,0,0,0,218, - 7,114,101,108,101,97,115,101,169,2,114,30,0,0,0,114, - 37,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,114,40,0,0,0,87,0,0,0,115,38,0,0, - 0,8,6,8,1,2,1,8,2,20,1,6,1,14,1,14, - 1,6,9,4,247,8,1,12,1,12,1,44,1,10,2,14, - 1,16,2,4,128,255,128,122,19,95,77,111,100,117,108,101, - 76,111,99,107,46,97,99,113,117,105,114,101,99,1,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,8,0,0, - 0,67,0,0,0,115,142,0,0,0,116,0,160,1,161,0, - 125,1,124,0,106,2,143,108,1,0,124,0,106,3,124,1, - 107,3,114,34,116,4,100,1,131,1,130,1,124,0,106,5, - 100,2,107,4,115,48,74,0,130,1,124,0,4,0,106,5, - 100,3,56,0,2,0,95,5,124,0,106,5,100,2,107,2, - 114,108,100,0,124,0,95,3,124,0,106,6,114,108,124,0, - 4,0,106,6,100,3,56,0,2,0,95,6,124,0,106,7, - 160,8,161,0,1,0,87,0,100,0,4,0,4,0,131,3, - 1,0,110,16,49,0,115,128,48,0,1,0,1,0,1,0, - 89,0,1,0,100,0,83,0,41,4,78,250,31,99,97,110, - 110,111,116,32,114,101,108,101,97,115,101,32,117,110,45,97, - 99,113,117,105,114,101,100,32,108,111,99,107,114,22,0,0, - 0,114,39,0,0,0,41,9,114,23,0,0,0,114,32,0, - 0,0,114,24,0,0,0,114,26,0,0,0,218,12,82,117, - 110,116,105,109,101,69,114,114,111,114,114,27,0,0,0,114, - 28,0,0,0,114,25,0,0,0,114,41,0,0,0,114,42, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,41,0,0,0,112,0,0,0,115,26,0,0,0, - 8,1,8,1,10,1,8,1,14,1,14,1,10,1,6,1, - 6,1,14,1,40,1,4,128,255,128,122,19,95,77,111,100, - 117,108,101,76,111,99,107,46,114,101,108,101,97,115,101,99, - 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 5,0,0,0,67,0,0,0,115,18,0,0,0,100,1,160, - 0,124,0,106,1,116,2,124,0,131,1,161,2,83,0,41, - 2,78,122,23,95,77,111,100,117,108,101,76,111,99,107,40, - 123,33,114,125,41,32,97,116,32,123,125,169,3,218,6,102, - 111,114,109,97,116,114,17,0,0,0,218,2,105,100,169,1, - 114,30,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,218,8,95,95,114,101,112,114,95,95,125,0, - 0,0,115,4,0,0,0,18,1,255,128,122,20,95,77,111, - 100,117,108,101,76,111,99,107,46,95,95,114,101,112,114,95, - 95,78,41,9,114,1,0,0,0,114,0,0,0,0,114,2, - 0,0,0,114,3,0,0,0,114,31,0,0,0,114,38,0, - 0,0,114,40,0,0,0,114,41,0,0,0,114,49,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,20,0,0,0,52,0,0,0,115,16, - 0,0,0,8,0,4,1,8,5,8,8,8,21,8,25,12, - 13,255,128,114,20,0,0,0,99,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0, - 0,115,48,0,0,0,101,0,90,1,100,0,90,2,100,1, - 90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0, - 90,5,100,6,100,7,132,0,90,6,100,8,100,9,132,0, - 90,7,100,10,83,0,41,11,218,16,95,68,117,109,109,121, - 77,111,100,117,108,101,76,111,99,107,122,86,65,32,115,105, - 109,112,108,101,32,95,77,111,100,117,108,101,76,111,99,107, - 32,101,113,117,105,118,97,108,101,110,116,32,102,111,114,32, - 80,121,116,104,111,110,32,98,117,105,108,100,115,32,119,105, - 116,104,111,117,116,10,32,32,32,32,109,117,108,116,105,45, - 116,104,114,101,97,100,105,110,103,32,115,117,112,112,111,114, - 116,46,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0, - 124,1,124,0,95,0,100,1,124,0,95,1,100,0,83,0, - 114,21,0,0,0,41,2,114,17,0,0,0,114,27,0,0, - 0,114,29,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,31,0,0,0,133,0,0,0,115,8, - 0,0,0,6,1,6,1,4,128,255,128,122,25,95,68,117, - 109,109,121,77,111,100,117,108,101,76,111,99,107,46,95,95, - 105,110,105,116,95,95,99,1,0,0,0,0,0,0,0,0, - 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, - 18,0,0,0,124,0,4,0,106,0,100,1,55,0,2,0, - 95,0,100,2,83,0,41,3,78,114,39,0,0,0,84,41, - 1,114,27,0,0,0,114,48,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,114,40,0,0,0,137, - 0,0,0,115,6,0,0,0,14,1,4,1,255,128,122,24, - 95,68,117,109,109,121,77,111,100,117,108,101,76,111,99,107, - 46,97,99,113,117,105,114,101,99,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, - 0,115,36,0,0,0,124,0,106,0,100,1,107,2,114,18, - 116,1,100,2,131,1,130,1,124,0,4,0,106,0,100,3, - 56,0,2,0,95,0,100,0,83,0,41,4,78,114,22,0, - 0,0,114,43,0,0,0,114,39,0,0,0,41,2,114,27, - 0,0,0,114,44,0,0,0,114,48,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,114,41,0,0, - 0,141,0,0,0,115,10,0,0,0,10,1,8,1,14,1, - 4,128,255,128,122,24,95,68,117,109,109,121,77,111,100,117, - 108,101,76,111,99,107,46,114,101,108,101,97,115,101,99,1, - 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5, - 0,0,0,67,0,0,0,115,18,0,0,0,100,1,160,0, - 124,0,106,1,116,2,124,0,131,1,161,2,83,0,41,2, - 78,122,28,95,68,117,109,109,121,77,111,100,117,108,101,76, - 111,99,107,40,123,33,114,125,41,32,97,116,32,123,125,114, - 45,0,0,0,114,48,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,114,49,0,0,0,146,0,0, - 0,115,4,0,0,0,18,1,255,128,122,25,95,68,117,109, - 109,121,77,111,100,117,108,101,76,111,99,107,46,95,95,114, - 101,112,114,95,95,78,41,8,114,1,0,0,0,114,0,0, - 0,0,114,2,0,0,0,114,3,0,0,0,114,31,0,0, - 0,114,40,0,0,0,114,41,0,0,0,114,49,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,50,0,0,0,129,0,0,0,115,14,0, - 0,0,8,0,4,1,8,3,8,4,8,4,12,5,255,128, - 114,50,0,0,0,99,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,36, - 0,0,0,101,0,90,1,100,0,90,2,100,1,100,2,132, - 0,90,3,100,3,100,4,132,0,90,4,100,5,100,6,132, - 0,90,5,100,7,83,0,41,8,218,18,95,77,111,100,117, - 108,101,76,111,99,107,77,97,110,97,103,101,114,99,2,0, + 0,4,0,0,0,64,0,0,0,115,214,1,0,0,100,0, + 90,0,100,1,100,2,132,0,90,1,100,3,90,2,100,3, + 90,3,100,3,90,4,100,3,97,5,100,4,100,5,132,0, + 90,6,100,6,100,7,132,0,90,7,105,0,90,8,105,0, + 90,9,71,0,100,8,100,9,132,0,100,9,101,10,131,3, + 90,11,71,0,100,10,100,11,132,0,100,11,131,2,90,12, + 71,0,100,12,100,13,132,0,100,13,131,2,90,13,71,0, + 100,14,100,15,132,0,100,15,131,2,90,14,100,16,100,17, + 132,0,90,15,100,18,100,19,132,0,90,16,100,20,100,21, + 132,0,90,17,100,22,100,23,156,1,100,24,100,25,132,2, + 90,18,100,26,100,27,132,0,90,19,100,28,100,29,132,0, + 90,20,100,30,100,31,132,0,90,21,100,32,100,33,132,0, + 90,22,71,0,100,34,100,35,132,0,100,35,131,2,90,23, + 100,3,100,3,100,36,156,2,100,37,100,38,132,2,90,24, + 100,96,100,39,100,40,132,1,90,25,100,41,100,42,156,1, + 100,43,100,44,132,2,90,26,100,45,100,46,132,0,90,27, + 100,47,100,48,132,0,90,28,100,49,100,50,132,0,90,29, + 100,51,100,52,132,0,90,30,100,53,100,54,132,0,90,31, + 100,55,100,56,132,0,90,32,71,0,100,57,100,58,132,0, + 100,58,131,2,90,33,71,0,100,59,100,60,132,0,100,60, + 131,2,90,34,71,0,100,61,100,62,132,0,100,62,131,2, + 90,35,100,63,100,64,132,0,90,36,100,65,100,66,132,0, + 90,37,100,97,100,67,100,68,132,1,90,38,100,69,100,70, + 132,0,90,39,100,71,90,40,101,40,100,72,23,0,90,41, + 100,73,100,74,132,0,90,42,101,43,131,0,90,44,100,75, + 100,76,132,0,90,45,100,98,100,78,100,79,132,1,90,46, + 100,41,100,80,156,1,100,81,100,82,132,2,90,47,100,83, + 100,84,132,0,90,48,100,99,100,86,100,87,132,1,90,49, + 100,88,100,89,132,0,90,50,100,90,100,91,132,0,90,51, + 100,92,100,93,132,0,90,52,100,94,100,95,132,0,90,53, + 100,3,83,0,41,100,97,83,1,0,0,67,111,114,101,32, + 105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,111, + 102,32,105,109,112,111,114,116,46,10,10,84,104,105,115,32, + 109,111,100,117,108,101,32,105,115,32,78,79,84,32,109,101, + 97,110,116,32,116,111,32,98,101,32,100,105,114,101,99,116, + 108,121,32,105,109,112,111,114,116,101,100,33,32,73,116,32, + 104,97,115,32,98,101,101,110,32,100,101,115,105,103,110,101, + 100,32,115,117,99,104,10,116,104,97,116,32,105,116,32,99, + 97,110,32,98,101,32,98,111,111,116,115,116,114,97,112,112, + 101,100,32,105,110,116,111,32,80,121,116,104,111,110,32,97, + 115,32,116,104,101,32,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,32,111,102,32,105,109,112,111,114,116,46,32, + 65,115,10,115,117,99,104,32,105,116,32,114,101,113,117,105, + 114,101,115,32,116,104,101,32,105,110,106,101,99,116,105,111, + 110,32,111,102,32,115,112,101,99,105,102,105,99,32,109,111, + 100,117,108,101,115,32,97,110,100,32,97,116,116,114,105,98, + 117,116,101,115,32,105,110,32,111,114,100,101,114,32,116,111, + 10,119,111,114,107,46,32,79,110,101,32,115,104,111,117,108, + 100,32,117,115,101,32,105,109,112,111,114,116,108,105,98,32, + 97,115,32,116,104,101,32,112,117,98,108,105,99,45,102,97, + 99,105,110,103,32,118,101,114,115,105,111,110,32,111,102,32, + 116,104,105,115,32,109,111,100,117,108,101,46,10,10,99,1, + 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8, + 0,0,0,67,0,0,0,115,38,0,0,0,122,8,124,0, + 106,0,87,0,83,0,4,0,116,1,121,36,1,0,1,0, + 1,0,116,2,124,0,131,1,106,0,6,0,89,0,83,0, + 48,0,169,1,78,41,3,218,12,95,95,113,117,97,108,110, + 97,109,101,95,95,218,14,65,116,116,114,105,98,117,116,101, + 69,114,114,111,114,218,4,116,121,112,101,41,1,218,3,111, + 98,106,169,0,114,5,0,0,0,250,29,60,102,114,111,122, + 101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,111, + 111,116,115,116,114,97,112,62,218,12,95,111,98,106,101,99, + 116,95,110,97,109,101,23,0,0,0,115,10,0,0,0,2, + 1,8,1,12,1,16,1,255,128,114,7,0,0,0,78,99, + 2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 7,0,0,0,67,0,0,0,115,56,0,0,0,100,1,68, + 0,93,32,125,2,116,0,124,1,124,2,131,2,114,4,116, + 1,124,0,124,2,116,2,124,1,124,2,131,2,131,3,1, + 0,113,4,124,0,106,3,160,4,124,1,106,3,161,1,1, + 0,100,2,83,0,41,3,122,47,83,105,109,112,108,101,32, + 115,117,98,115,116,105,116,117,116,101,32,102,111,114,32,102, + 117,110,99,116,111,111,108,115,46,117,112,100,97,116,101,95, + 119,114,97,112,112,101,114,46,41,4,218,10,95,95,109,111, + 100,117,108,101,95,95,218,8,95,95,110,97,109,101,95,95, + 114,1,0,0,0,218,7,95,95,100,111,99,95,95,78,41, + 5,218,7,104,97,115,97,116,116,114,218,7,115,101,116,97, + 116,116,114,218,7,103,101,116,97,116,116,114,218,8,95,95, + 100,105,99,116,95,95,218,6,117,112,100,97,116,101,41,3, + 90,3,110,101,119,90,3,111,108,100,218,7,114,101,112,108, + 97,99,101,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,218,5,95,119,114,97,112,40,0,0,0,115,10,0, + 0,0,8,2,10,1,20,1,18,1,255,128,114,17,0,0, + 0,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,116,1,131,1,124,0,131,1,83,0,114,0,0,0,0, + 41,2,114,3,0,0,0,218,3,115,121,115,169,1,218,4, + 110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,218,11,95,110,101,119,95,109,111,100,117,108,101, + 48,0,0,0,115,4,0,0,0,12,1,255,128,114,21,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,64,0,0,0,115,12,0,0,0, + 101,0,90,1,100,0,90,2,100,1,83,0,41,2,218,14, + 95,68,101,97,100,108,111,99,107,69,114,114,111,114,78,41, + 3,114,9,0,0,0,114,8,0,0,0,114,1,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,114,22,0,0,0,61,0,0,0,115,6,0, + 0,0,8,0,4,1,255,128,114,22,0,0,0,99,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,64,0,0,0,115,56,0,0,0,101,0,90,1,100, + 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, + 4,100,5,132,0,90,5,100,6,100,7,132,0,90,6,100, + 8,100,9,132,0,90,7,100,10,100,11,132,0,90,8,100, + 12,83,0,41,13,218,11,95,77,111,100,117,108,101,76,111, + 99,107,122,169,65,32,114,101,99,117,114,115,105,118,101,32, + 108,111,99,107,32,105,109,112,108,101,109,101,110,116,97,116, + 105,111,110,32,119,104,105,99,104,32,105,115,32,97,98,108, + 101,32,116,111,32,100,101,116,101,99,116,32,100,101,97,100, + 108,111,99,107,115,10,32,32,32,32,40,101,46,103,46,32, + 116,104,114,101,97,100,32,49,32,116,114,121,105,110,103,32, + 116,111,32,116,97,107,101,32,108,111,99,107,115,32,65,32, + 116,104,101,110,32,66,44,32,97,110,100,32,116,104,114,101, + 97,100,32,50,32,116,114,121,105,110,103,32,116,111,10,32, + 32,32,32,116,97,107,101,32,108,111,99,107,115,32,66,32, + 116,104,101,110,32,65,41,46,10,32,32,32,32,99,2,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0, + 0,0,67,0,0,0,115,48,0,0,0,116,0,160,1,161, + 0,124,0,95,2,116,0,160,1,161,0,124,0,95,3,124, + 1,124,0,95,4,100,0,124,0,95,5,100,1,124,0,95, + 6,100,1,124,0,95,7,100,0,83,0,169,2,78,233,0, + 0,0,0,41,8,218,7,95,116,104,114,101,97,100,90,13, + 97,108,108,111,99,97,116,101,95,108,111,99,107,218,4,108, + 111,99,107,218,6,119,97,107,101,117,112,114,20,0,0,0, + 218,5,111,119,110,101,114,218,5,99,111,117,110,116,218,7, + 119,97,105,116,101,114,115,169,2,218,4,115,101,108,102,114, + 20,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,218,8,95,95,105,110,105,116,95,95,71,0,0, + 0,115,14,0,0,0,10,1,10,1,6,1,6,1,6,1, + 10,1,255,128,122,20,95,77,111,100,117,108,101,76,111,99, + 107,46,95,95,105,110,105,116,95,95,99,1,0,0,0,0, + 0,0,0,0,0,0,0,5,0,0,0,3,0,0,0,67, + 0,0,0,115,84,0,0,0,116,0,160,1,161,0,125,1, + 124,0,106,2,125,2,116,3,131,0,125,3,116,4,160,5, + 124,2,161,1,125,4,124,4,100,0,117,0,114,42,100,1, + 83,0,124,4,106,2,125,2,124,2,124,1,107,2,114,60, + 100,2,83,0,124,2,124,3,118,0,114,72,100,1,83,0, + 124,3,160,6,124,2,161,1,1,0,113,20,41,3,78,70, + 84,41,7,114,26,0,0,0,218,9,103,101,116,95,105,100, + 101,110,116,114,29,0,0,0,218,3,115,101,116,218,12,95, + 98,108,111,99,107,105,110,103,95,111,110,218,3,103,101,116, + 218,3,97,100,100,41,5,114,33,0,0,0,90,2,109,101, + 218,3,116,105,100,90,4,115,101,101,110,114,27,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218, + 12,104,97,115,95,100,101,97,100,108,111,99,107,79,0,0, + 0,115,26,0,0,0,8,2,6,1,6,1,10,2,8,1, + 4,1,6,1,8,1,4,1,8,1,4,6,12,1,255,128, + 122,24,95,77,111,100,117,108,101,76,111,99,107,46,104,97, + 115,95,100,101,97,100,108,111,99,107,99,1,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,67, + 0,0,0,115,196,0,0,0,116,0,160,1,161,0,125,1, + 124,0,116,2,124,1,60,0,122,170,124,0,106,3,143,126, + 1,0,124,0,106,4,100,1,107,2,115,46,124,0,106,5, + 124,1,107,2,114,90,124,1,124,0,95,5,124,0,4,0, + 106,4,100,2,55,0,2,0,95,4,87,0,100,3,4,0, + 4,0,131,3,1,0,87,0,116,2,124,1,61,0,100,4, + 83,0,124,0,160,6,161,0,114,110,116,7,100,5,124,0, + 22,0,131,1,130,1,124,0,106,8,160,9,100,6,161,1, + 114,136,124,0,4,0,106,10,100,2,55,0,2,0,95,10, + 87,0,100,3,4,0,4,0,131,3,1,0,110,16,49,0, + 115,156,48,0,1,0,1,0,1,0,89,0,1,0,124,0, + 106,8,160,9,161,0,1,0,124,0,106,8,160,11,161,0, + 1,0,113,18,116,2,124,1,61,0,48,0,41,7,122,185, + 10,32,32,32,32,32,32,32,32,65,99,113,117,105,114,101, + 32,116,104,101,32,109,111,100,117,108,101,32,108,111,99,107, + 46,32,32,73,102,32,97,32,112,111,116,101,110,116,105,97, + 108,32,100,101,97,100,108,111,99,107,32,105,115,32,100,101, + 116,101,99,116,101,100,44,10,32,32,32,32,32,32,32,32, + 97,32,95,68,101,97,100,108,111,99,107,69,114,114,111,114, + 32,105,115,32,114,97,105,115,101,100,46,10,32,32,32,32, + 32,32,32,32,79,116,104,101,114,119,105,115,101,44,32,116, + 104,101,32,108,111,99,107,32,105,115,32,97,108,119,97,121, + 115,32,97,99,113,117,105,114,101,100,32,97,110,100,32,84, + 114,117,101,32,105,115,32,114,101,116,117,114,110,101,100,46, + 10,32,32,32,32,32,32,32,32,114,25,0,0,0,233,1, + 0,0,0,78,84,122,23,100,101,97,100,108,111,99,107,32, + 100,101,116,101,99,116,101,100,32,98,121,32,37,114,70,41, + 12,114,26,0,0,0,114,35,0,0,0,114,37,0,0,0, + 114,27,0,0,0,114,30,0,0,0,114,29,0,0,0,114, + 41,0,0,0,114,22,0,0,0,114,28,0,0,0,218,7, + 97,99,113,117,105,114,101,114,31,0,0,0,218,7,114,101, + 108,101,97,115,101,169,2,114,33,0,0,0,114,40,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,43,0,0,0,100,0,0,0,115,36,0,0,0,8,6, + 8,1,2,1,8,2,20,1,6,1,14,1,14,1,6,9, + 4,247,8,1,12,1,12,1,44,1,10,2,12,1,8,2, + 255,128,122,19,95,77,111,100,117,108,101,76,111,99,107,46, + 97,99,113,117,105,114,101,99,1,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,8,0,0,0,67,0,0,0, + 115,144,0,0,0,116,0,160,1,161,0,125,1,124,0,106, + 2,143,110,1,0,124,0,106,3,124,1,107,3,114,34,116, + 4,100,1,131,1,130,1,124,0,106,5,100,2,107,4,115, + 48,74,0,130,1,124,0,4,0,106,5,100,3,56,0,2, + 0,95,5,124,0,106,5,100,2,107,2,114,108,100,0,124, + 0,95,3,124,0,106,6,114,108,124,0,4,0,106,6,100, + 3,56,0,2,0,95,6,124,0,106,7,160,8,161,0,1, + 0,87,0,100,0,4,0,4,0,131,3,1,0,100,0,83, + 0,49,0,115,130,48,0,1,0,1,0,1,0,89,0,1, + 0,100,0,83,0,41,4,78,250,31,99,97,110,110,111,116, + 32,114,101,108,101,97,115,101,32,117,110,45,97,99,113,117, + 105,114,101,100,32,108,111,99,107,114,25,0,0,0,114,42, + 0,0,0,41,9,114,26,0,0,0,114,35,0,0,0,114, + 27,0,0,0,114,29,0,0,0,218,12,82,117,110,116,105, + 109,101,69,114,114,111,114,114,30,0,0,0,114,31,0,0, + 0,114,28,0,0,0,114,44,0,0,0,114,45,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 44,0,0,0,125,0,0,0,115,24,0,0,0,8,1,8, + 1,10,1,8,1,14,1,14,1,10,1,6,1,6,1,14, + 1,46,1,255,128,122,19,95,77,111,100,117,108,101,76,111, + 99,107,46,114,101,108,101,97,115,101,99,1,0,0,0,0, + 0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,67, + 0,0,0,115,18,0,0,0,100,1,160,0,124,0,106,1, + 116,2,124,0,131,1,161,2,83,0,41,2,78,122,23,95, + 77,111,100,117,108,101,76,111,99,107,40,123,33,114,125,41, + 32,97,116,32,123,125,169,3,218,6,102,111,114,109,97,116, + 114,20,0,0,0,218,2,105,100,169,1,114,33,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218, + 8,95,95,114,101,112,114,95,95,138,0,0,0,115,4,0, + 0,0,18,1,255,128,122,20,95,77,111,100,117,108,101,76, + 111,99,107,46,95,95,114,101,112,114,95,95,78,41,9,114, + 9,0,0,0,114,8,0,0,0,114,1,0,0,0,114,10, + 0,0,0,114,34,0,0,0,114,41,0,0,0,114,43,0, + 0,0,114,44,0,0,0,114,52,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,23,0,0,0,65,0,0,0,115,16,0,0,0,8,0, + 4,1,8,5,8,8,8,21,8,25,12,13,255,128,114,23, + 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,64,0,0,0,115,48,0,0, + 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, + 3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100, + 7,132,0,90,6,100,8,100,9,132,0,90,7,100,10,83, + 0,41,11,218,16,95,68,117,109,109,121,77,111,100,117,108, + 101,76,111,99,107,122,86,65,32,115,105,109,112,108,101,32, + 95,77,111,100,117,108,101,76,111,99,107,32,101,113,117,105, + 118,97,108,101,110,116,32,102,111,114,32,80,121,116,104,111, + 110,32,98,117,105,108,100,115,32,119,105,116,104,111,117,116, + 10,32,32,32,32,109,117,108,116,105,45,116,104,114,101,97, + 100,105,110,103,32,115,117,112,112,111,114,116,46,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0, 0,0,67,0,0,0,115,16,0,0,0,124,1,124,0,95, - 0,100,0,124,0,95,1,100,0,83,0,114,13,0,0,0, - 41,2,218,5,95,110,97,109,101,218,5,95,108,111,99,107, - 114,29,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,31,0,0,0,152,0,0,0,115,8,0, - 0,0,6,1,6,1,4,128,255,128,122,27,95,77,111,100, - 117,108,101,76,111,99,107,77,97,110,97,103,101,114,46,95, - 95,105,110,105,116,95,95,99,1,0,0,0,0,0,0,0, - 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, - 115,26,0,0,0,116,0,124,0,106,1,131,1,124,0,95, - 2,124,0,106,2,160,3,161,0,1,0,100,0,83,0,114, - 13,0,0,0,41,4,218,16,95,103,101,116,95,109,111,100, - 117,108,101,95,108,111,99,107,114,52,0,0,0,114,53,0, - 0,0,114,40,0,0,0,114,48,0,0,0,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,218,9,95,95,101, - 110,116,101,114,95,95,156,0,0,0,115,8,0,0,0,12, - 1,10,1,4,128,255,128,122,28,95,77,111,100,117,108,101, - 76,111,99,107,77,97,110,97,103,101,114,46,95,95,101,110, - 116,101,114,95,95,99,1,0,0,0,0,0,0,0,0,0, - 0,0,3,0,0,0,2,0,0,0,79,0,0,0,115,14, - 0,0,0,124,0,106,0,160,1,161,0,1,0,100,0,83, - 0,114,13,0,0,0,41,2,114,53,0,0,0,114,41,0, - 0,0,41,3,114,30,0,0,0,218,4,97,114,103,115,90, - 6,107,119,97,114,103,115,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,8,95,95,101,120,105,116,95,95, - 160,0,0,0,115,6,0,0,0,10,1,4,128,255,128,122, + 0,100,1,124,0,95,1,100,0,83,0,114,24,0,0,0, + 41,2,114,20,0,0,0,114,30,0,0,0,114,32,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,34,0,0,0,146,0,0,0,115,6,0,0,0,6,1, + 10,1,255,128,122,25,95,68,117,109,109,121,77,111,100,117, + 108,101,76,111,99,107,46,95,95,105,110,105,116,95,95,99, + 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, + 3,0,0,0,67,0,0,0,115,18,0,0,0,124,0,4, + 0,106,0,100,1,55,0,2,0,95,0,100,2,83,0,41, + 3,78,114,42,0,0,0,84,41,1,114,30,0,0,0,114, + 51,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,114,43,0,0,0,150,0,0,0,115,6,0,0, + 0,14,1,4,1,255,128,122,24,95,68,117,109,109,121,77, + 111,100,117,108,101,76,111,99,107,46,97,99,113,117,105,114, + 101,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0, + 0,0,3,0,0,0,67,0,0,0,115,36,0,0,0,124, + 0,106,0,100,1,107,2,114,18,116,1,100,2,131,1,130, + 1,124,0,4,0,106,0,100,3,56,0,2,0,95,0,100, + 0,83,0,41,4,78,114,25,0,0,0,114,46,0,0,0, + 114,42,0,0,0,41,2,114,30,0,0,0,114,47,0,0, + 0,114,51,0,0,0,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,114,44,0,0,0,154,0,0,0,115,8, + 0,0,0,10,1,8,1,18,1,255,128,122,24,95,68,117, + 109,109,121,77,111,100,117,108,101,76,111,99,107,46,114,101, + 108,101,97,115,101,99,1,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,0,5,0,0,0,67,0,0,0,115,18, + 0,0,0,100,1,160,0,124,0,106,1,116,2,124,0,131, + 1,161,2,83,0,41,2,78,122,28,95,68,117,109,109,121, + 77,111,100,117,108,101,76,111,99,107,40,123,33,114,125,41, + 32,97,116,32,123,125,114,48,0,0,0,114,51,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 52,0,0,0,159,0,0,0,115,4,0,0,0,18,1,255, + 128,122,25,95,68,117,109,109,121,77,111,100,117,108,101,76, + 111,99,107,46,95,95,114,101,112,114,95,95,78,41,8,114, + 9,0,0,0,114,8,0,0,0,114,1,0,0,0,114,10, + 0,0,0,114,34,0,0,0,114,43,0,0,0,114,44,0, + 0,0,114,52,0,0,0,114,5,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,6,0,0,0,114,53,0,0,0, + 142,0,0,0,115,14,0,0,0,8,0,4,1,8,3,8, + 4,8,4,12,5,255,128,114,53,0,0,0,99,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,64,0,0,0,115,36,0,0,0,101,0,90,1,100,0, + 90,2,100,1,100,2,132,0,90,3,100,3,100,4,132,0, + 90,4,100,5,100,6,132,0,90,5,100,7,83,0,41,8, + 218,18,95,77,111,100,117,108,101,76,111,99,107,77,97,110, + 97,103,101,114,99,2,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,2,0,0,0,67,0,0,0,115,16,0, + 0,0,124,1,124,0,95,0,100,0,124,0,95,1,100,0, + 83,0,114,0,0,0,0,41,2,218,5,95,110,97,109,101, + 218,5,95,108,111,99,107,114,32,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,6,0,0,0,114,34,0,0,0, + 165,0,0,0,115,6,0,0,0,6,1,10,1,255,128,122, 27,95,77,111,100,117,108,101,76,111,99,107,77,97,110,97, - 103,101,114,46,95,95,101,120,105,116,95,95,78,41,6,114, - 1,0,0,0,114,0,0,0,0,114,2,0,0,0,114,31, - 0,0,0,114,55,0,0,0,114,57,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,51,0,0,0,150,0,0,0,115,10,0,0,0,8, - 0,8,2,8,4,12,4,255,128,114,51,0,0,0,99,1, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,8, - 0,0,0,67,0,0,0,115,136,0,0,0,116,0,160,1, - 161,0,1,0,122,112,122,14,116,2,124,0,25,0,131,0, - 125,1,87,0,110,22,4,0,116,3,121,46,1,0,1,0, - 1,0,100,1,125,1,89,0,110,2,48,0,124,1,100,1, - 117,0,114,110,116,4,100,1,117,0,114,74,116,5,124,0, - 131,1,125,1,110,8,116,6,124,0,131,1,125,1,124,0, - 102,1,100,2,100,3,132,1,125,2,116,7,160,8,124,1, - 124,2,161,2,116,2,124,0,60,0,87,0,116,0,160,9, - 161,0,1,0,110,10,116,0,160,9,161,0,1,0,48,0, - 124,1,83,0,41,4,122,139,71,101,116,32,111,114,32,99, - 114,101,97,116,101,32,116,104,101,32,109,111,100,117,108,101, + 103,101,114,46,95,95,105,110,105,116,95,95,99,1,0,0, + 0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0, + 0,67,0,0,0,115,26,0,0,0,116,0,124,0,106,1, + 131,1,124,0,95,2,124,0,106,2,160,3,161,0,1,0, + 100,0,83,0,114,0,0,0,0,41,4,218,16,95,103,101, + 116,95,109,111,100,117,108,101,95,108,111,99,107,114,55,0, + 0,0,114,56,0,0,0,114,43,0,0,0,114,51,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 218,9,95,95,101,110,116,101,114,95,95,169,0,0,0,115, + 6,0,0,0,12,1,14,1,255,128,122,28,95,77,111,100, + 117,108,101,76,111,99,107,77,97,110,97,103,101,114,46,95, + 95,101,110,116,101,114,95,95,99,1,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,2,0,0,0,79,0,0, + 0,115,14,0,0,0,124,0,106,0,160,1,161,0,1,0, + 100,0,83,0,114,0,0,0,0,41,2,114,56,0,0,0, + 114,44,0,0,0,41,3,114,33,0,0,0,218,4,97,114, + 103,115,90,6,107,119,97,114,103,115,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,218,8,95,95,101,120,105, + 116,95,95,173,0,0,0,115,4,0,0,0,14,1,255,128, + 122,27,95,77,111,100,117,108,101,76,111,99,107,77,97,110, + 97,103,101,114,46,95,95,101,120,105,116,95,95,78,41,6, + 114,9,0,0,0,114,8,0,0,0,114,1,0,0,0,114, + 34,0,0,0,114,58,0,0,0,114,60,0,0,0,114,5, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,114,54,0,0,0,163,0,0,0,115,10,0,0,0, + 8,0,8,2,8,4,12,4,255,128,114,54,0,0,0,99, + 1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 8,0,0,0,67,0,0,0,115,134,0,0,0,116,0,160, + 1,161,0,1,0,122,114,122,14,116,2,124,0,25,0,131, + 0,125,1,87,0,110,22,4,0,116,3,121,46,1,0,1, + 0,1,0,100,1,125,1,89,0,110,2,48,0,124,1,100, + 1,117,0,114,110,116,4,100,1,117,0,114,74,116,5,124, + 0,131,1,125,1,110,8,116,6,124,0,131,1,125,1,124, + 0,102,1,100,2,100,3,132,1,125,2,116,7,160,8,124, + 1,124,2,161,2,116,2,124,0,60,0,87,0,116,0,160, + 9,161,0,1,0,124,1,83,0,116,0,160,9,161,0,1, + 0,48,0,41,4,122,139,71,101,116,32,111,114,32,99,114, + 101,97,116,101,32,116,104,101,32,109,111,100,117,108,101,32, + 108,111,99,107,32,102,111,114,32,97,32,103,105,118,101,110, + 32,109,111,100,117,108,101,32,110,97,109,101,46,10,10,32, + 32,32,32,65,99,113,117,105,114,101,47,114,101,108,101,97, + 115,101,32,105,110,116,101,114,110,97,108,108,121,32,116,104, + 101,32,103,108,111,98,97,108,32,105,109,112,111,114,116,32, + 108,111,99,107,32,116,111,32,112,114,111,116,101,99,116,10, + 32,32,32,32,95,109,111,100,117,108,101,95,108,111,99,107, + 115,46,78,99,2,0,0,0,0,0,0,0,0,0,0,0, + 2,0,0,0,8,0,0,0,83,0,0,0,115,54,0,0, + 0,116,0,160,1,161,0,1,0,122,34,116,2,160,3,124, + 1,161,1,124,0,117,0,114,30,116,2,124,1,61,0,87, + 0,116,0,160,4,161,0,1,0,100,0,83,0,116,0,160, + 4,161,0,1,0,48,0,114,0,0,0,0,41,5,218,4, + 95,105,109,112,218,12,97,99,113,117,105,114,101,95,108,111, + 99,107,218,13,95,109,111,100,117,108,101,95,108,111,99,107, + 115,114,38,0,0,0,218,12,114,101,108,101,97,115,101,95, + 108,111,99,107,41,2,218,3,114,101,102,114,20,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218, + 2,99,98,198,0,0,0,115,12,0,0,0,8,1,2,1, + 14,4,8,1,22,2,255,128,122,28,95,103,101,116,95,109, + 111,100,117,108,101,95,108,111,99,107,46,60,108,111,99,97, + 108,115,62,46,99,98,41,10,114,61,0,0,0,114,62,0, + 0,0,114,63,0,0,0,218,8,75,101,121,69,114,114,111, + 114,114,26,0,0,0,114,53,0,0,0,114,23,0,0,0, + 218,8,95,119,101,97,107,114,101,102,114,65,0,0,0,114, + 64,0,0,0,41,3,114,20,0,0,0,114,27,0,0,0, + 114,66,0,0,0,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,114,57,0,0,0,179,0,0,0,115,32,0, + 0,0,8,6,2,1,2,1,14,1,12,1,10,1,8,2, + 8,1,10,1,8,2,12,2,18,11,8,2,4,2,10,254, + 255,128,114,57,0,0,0,99,1,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,8,0,0,0,67,0,0,0, + 115,54,0,0,0,116,0,124,0,131,1,125,1,122,12,124, + 1,160,1,161,0,1,0,87,0,110,20,4,0,116,2,121, + 40,1,0,1,0,1,0,89,0,100,1,83,0,48,0,124, + 1,160,3,161,0,1,0,100,1,83,0,41,2,122,189,65, + 99,113,117,105,114,101,115,32,116,104,101,110,32,114,101,108, + 101,97,115,101,115,32,116,104,101,32,109,111,100,117,108,101, 32,108,111,99,107,32,102,111,114,32,97,32,103,105,118,101, 110,32,109,111,100,117,108,101,32,110,97,109,101,46,10,10, - 32,32,32,32,65,99,113,117,105,114,101,47,114,101,108,101, - 97,115,101,32,105,110,116,101,114,110,97,108,108,121,32,116, - 104,101,32,103,108,111,98,97,108,32,105,109,112,111,114,116, - 32,108,111,99,107,32,116,111,32,112,114,111,116,101,99,116, - 10,32,32,32,32,95,109,111,100,117,108,101,95,108,111,99, - 107,115,46,78,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,8,0,0,0,83,0,0,0,115,56,0, - 0,0,116,0,160,1,161,0,1,0,122,32,116,2,160,3, - 124,1,161,1,124,0,117,0,114,30,116,2,124,1,61,0, - 87,0,116,0,160,4,161,0,1,0,110,10,116,0,160,4, - 161,0,1,0,48,0,100,0,83,0,114,13,0,0,0,41, - 5,218,4,95,105,109,112,218,12,97,99,113,117,105,114,101, - 95,108,111,99,107,218,13,95,109,111,100,117,108,101,95,108, - 111,99,107,115,114,35,0,0,0,218,12,114,101,108,101,97, - 115,101,95,108,111,99,107,41,2,218,3,114,101,102,114,17, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,218,2,99,98,185,0,0,0,115,14,0,0,0,8, - 1,2,1,14,4,8,1,20,2,4,128,255,128,122,28,95, - 103,101,116,95,109,111,100,117,108,101,95,108,111,99,107,46, - 60,108,111,99,97,108,115,62,46,99,98,41,10,114,58,0, - 0,0,114,59,0,0,0,114,60,0,0,0,218,8,75,101, - 121,69,114,114,111,114,114,23,0,0,0,114,50,0,0,0, - 114,20,0,0,0,218,8,95,119,101,97,107,114,101,102,114, - 62,0,0,0,114,61,0,0,0,41,3,114,17,0,0,0, - 114,24,0,0,0,114,63,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,54,0,0,0,166,0, - 0,0,115,30,0,0,0,8,6,2,1,2,1,14,1,12, - 1,10,1,8,2,8,1,10,1,8,2,12,2,18,11,20, - 2,4,2,255,128,114,54,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,67, - 0,0,0,115,52,0,0,0,116,0,124,0,131,1,125,1, - 122,12,124,1,160,1,161,0,1,0,87,0,110,18,4,0, - 116,2,121,38,1,0,1,0,1,0,89,0,110,10,48,0, - 124,1,160,3,161,0,1,0,100,1,83,0,41,2,122,189, - 65,99,113,117,105,114,101,115,32,116,104,101,110,32,114,101, - 108,101,97,115,101,115,32,116,104,101,32,109,111,100,117,108, - 101,32,108,111,99,107,32,102,111,114,32,97,32,103,105,118, - 101,110,32,109,111,100,117,108,101,32,110,97,109,101,46,10, - 10,32,32,32,32,84,104,105,115,32,105,115,32,117,115,101, - 100,32,116,111,32,101,110,115,117,114,101,32,97,32,109,111, - 100,117,108,101,32,105,115,32,99,111,109,112,108,101,116,101, - 108,121,32,105,110,105,116,105,97,108,105,122,101,100,44,32, - 105,110,32,116,104,101,10,32,32,32,32,101,118,101,110,116, - 32,105,116,32,105,115,32,98,101,105,110,103,32,105,109,112, - 111,114,116,101,100,32,98,121,32,97,110,111,116,104,101,114, - 32,116,104,114,101,97,100,46,10,32,32,32,32,78,41,4, - 114,54,0,0,0,114,40,0,0,0,114,19,0,0,0,114, - 41,0,0,0,41,2,114,17,0,0,0,114,24,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, - 19,95,108,111,99,107,95,117,110,108,111,99,107,95,109,111, - 100,117,108,101,203,0,0,0,115,16,0,0,0,8,6,2, - 1,12,1,12,1,6,3,8,2,4,128,255,128,114,66,0, - 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,3, - 0,0,0,4,0,0,0,79,0,0,0,115,14,0,0,0, - 124,0,124,1,105,0,124,2,164,1,142,1,83,0,41,1, - 97,46,1,0,0,114,101,109,111,118,101,95,105,109,112,111, - 114,116,108,105,98,95,102,114,97,109,101,115,32,105,110,32, - 105,109,112,111,114,116,46,99,32,119,105,108,108,32,97,108, - 119,97,121,115,32,114,101,109,111,118,101,32,115,101,113,117, - 101,110,99,101,115,10,32,32,32,32,111,102,32,105,109,112, - 111,114,116,108,105,98,32,102,114,97,109,101,115,32,116,104, - 97,116,32,101,110,100,32,119,105,116,104,32,97,32,99,97, - 108,108,32,116,111,32,116,104,105,115,32,102,117,110,99,116, - 105,111,110,10,10,32,32,32,32,85,115,101,32,105,116,32, - 105,110,115,116,101,97,100,32,111,102,32,97,32,110,111,114, - 109,97,108,32,99,97,108,108,32,105,110,32,112,108,97,99, - 101,115,32,119,104,101,114,101,32,105,110,99,108,117,100,105, - 110,103,32,116,104,101,32,105,109,112,111,114,116,108,105,98, - 10,32,32,32,32,102,114,97,109,101,115,32,105,110,116,114, - 111,100,117,99,101,115,32,117,110,119,97,110,116,101,100,32, - 110,111,105,115,101,32,105,110,116,111,32,116,104,101,32,116, - 114,97,99,101,98,97,99,107,32,40,101,46,103,46,32,119, - 104,101,110,32,101,120,101,99,117,116,105,110,103,10,32,32, - 32,32,109,111,100,117,108,101,32,99,111,100,101,41,10,32, - 32,32,32,114,10,0,0,0,41,3,218,1,102,114,56,0, - 0,0,90,4,107,119,100,115,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,25,95,99,97,108,108,95,119, - 105,116,104,95,102,114,97,109,101,115,95,114,101,109,111,118, - 101,100,220,0,0,0,115,4,0,0,0,14,8,255,128,114, - 68,0,0,0,114,39,0,0,0,41,1,218,9,118,101,114, - 98,111,115,105,116,121,99,1,0,0,0,0,0,0,0,1, - 0,0,0,3,0,0,0,4,0,0,0,71,0,0,0,115, - 54,0,0,0,116,0,106,1,106,2,124,1,107,5,114,50, - 124,0,160,3,100,1,161,1,115,30,100,2,124,0,23,0, - 125,0,116,4,124,0,106,5,124,2,142,0,116,0,106,6, - 100,3,141,2,1,0,100,4,83,0,41,5,122,61,80,114, - 105,110,116,32,116,104,101,32,109,101,115,115,97,103,101,32, - 116,111,32,115,116,100,101,114,114,32,105,102,32,45,118,47, - 80,89,84,72,79,78,86,69,82,66,79,83,69,32,105,115, - 32,116,117,114,110,101,100,32,111,110,46,41,2,250,1,35, - 122,7,105,109,112,111,114,116,32,122,2,35,32,41,1,90, - 4,102,105,108,101,78,41,7,114,15,0,0,0,218,5,102, - 108,97,103,115,218,7,118,101,114,98,111,115,101,218,10,115, - 116,97,114,116,115,119,105,116,104,218,5,112,114,105,110,116, - 114,46,0,0,0,218,6,115,116,100,101,114,114,41,3,218, - 7,109,101,115,115,97,103,101,114,69,0,0,0,114,56,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,218,16,95,118,101,114,98,111,115,101,95,109,101,115,115, - 97,103,101,231,0,0,0,115,12,0,0,0,12,2,10,1, - 8,1,20,1,4,128,255,128,114,77,0,0,0,99,1,0, - 0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,3,0,0,0,115,26,0,0,0,135,0,102,1,100, - 1,100,2,132,8,125,1,116,0,124,1,136,0,131,2,1, - 0,124,1,83,0,41,3,122,49,68,101,99,111,114,97,116, - 111,114,32,116,111,32,118,101,114,105,102,121,32,116,104,101, - 32,110,97,109,101,100,32,109,111,100,117,108,101,32,105,115, - 32,98,117,105,108,116,45,105,110,46,99,2,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,19, - 0,0,0,115,38,0,0,0,124,1,116,0,106,1,118,1, - 114,28,116,2,100,1,160,3,124,1,161,1,124,1,100,2, - 141,2,130,1,136,0,124,0,124,1,131,2,83,0,41,3, - 78,250,29,123,33,114,125,32,105,115,32,110,111,116,32,97, - 32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101, - 114,16,0,0,0,41,4,114,15,0,0,0,218,20,98,117, - 105,108,116,105,110,95,109,111,100,117,108,101,95,110,97,109, - 101,115,218,11,73,109,112,111,114,116,69,114,114,111,114,114, - 46,0,0,0,169,2,114,30,0,0,0,218,8,102,117,108, - 108,110,97,109,101,169,1,218,3,102,120,110,114,10,0,0, - 0,114,11,0,0,0,218,25,95,114,101,113,117,105,114,101, - 115,95,98,117,105,108,116,105,110,95,119,114,97,112,112,101, - 114,241,0,0,0,115,12,0,0,0,10,1,10,1,2,1, - 6,255,10,2,255,128,122,52,95,114,101,113,117,105,114,101, - 115,95,98,117,105,108,116,105,110,46,60,108,111,99,97,108, - 115,62,46,95,114,101,113,117,105,114,101,115,95,98,117,105, - 108,116,105,110,95,119,114,97,112,112,101,114,169,1,114,12, - 0,0,0,41,2,114,84,0,0,0,114,85,0,0,0,114, - 10,0,0,0,114,83,0,0,0,114,11,0,0,0,218,17, - 95,114,101,113,117,105,114,101,115,95,98,117,105,108,116,105, - 110,239,0,0,0,115,8,0,0,0,12,2,10,5,4,1, - 255,128,114,87,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0, - 115,26,0,0,0,135,0,102,1,100,1,100,2,132,8,125, - 1,116,0,124,1,136,0,131,2,1,0,124,1,83,0,41, - 3,122,47,68,101,99,111,114,97,116,111,114,32,116,111,32, - 118,101,114,105,102,121,32,116,104,101,32,110,97,109,101,100, - 32,109,111,100,117,108,101,32,105,115,32,102,114,111,122,101, - 110,46,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,4,0,0,0,19,0,0,0,115,38,0,0,0, - 116,0,160,1,124,1,161,1,115,28,116,2,100,1,160,3, - 124,1,161,1,124,1,100,2,141,2,130,1,136,0,124,0, - 124,1,131,2,83,0,169,3,78,122,27,123,33,114,125,32, - 105,115,32,110,111,116,32,97,32,102,114,111,122,101,110,32, - 109,111,100,117,108,101,114,16,0,0,0,41,4,114,58,0, - 0,0,218,9,105,115,95,102,114,111,122,101,110,114,80,0, - 0,0,114,46,0,0,0,114,81,0,0,0,114,83,0,0, - 0,114,10,0,0,0,114,11,0,0,0,218,24,95,114,101, - 113,117,105,114,101,115,95,102,114,111,122,101,110,95,119,114, - 97,112,112,101,114,252,0,0,0,115,12,0,0,0,10,1, - 10,1,2,1,6,255,10,2,255,128,122,50,95,114,101,113, - 117,105,114,101,115,95,102,114,111,122,101,110,46,60,108,111, - 99,97,108,115,62,46,95,114,101,113,117,105,114,101,115,95, - 102,114,111,122,101,110,95,119,114,97,112,112,101,114,114,86, - 0,0,0,41,2,114,84,0,0,0,114,90,0,0,0,114, - 10,0,0,0,114,83,0,0,0,114,11,0,0,0,218,16, + 32,32,32,32,84,104,105,115,32,105,115,32,117,115,101,100, + 32,116,111,32,101,110,115,117,114,101,32,97,32,109,111,100, + 117,108,101,32,105,115,32,99,111,109,112,108,101,116,101,108, + 121,32,105,110,105,116,105,97,108,105,122,101,100,44,32,105, + 110,32,116,104,101,10,32,32,32,32,101,118,101,110,116,32, + 105,116,32,105,115,32,98,101,105,110,103,32,105,109,112,111, + 114,116,101,100,32,98,121,32,97,110,111,116,104,101,114,32, + 116,104,114,101,97,100,46,10,32,32,32,32,78,41,4,114, + 57,0,0,0,114,43,0,0,0,114,22,0,0,0,114,44, + 0,0,0,41,2,114,20,0,0,0,114,27,0,0,0,114, + 5,0,0,0,114,5,0,0,0,114,6,0,0,0,218,19, + 95,108,111,99,107,95,117,110,108,111,99,107,95,109,111,100, + 117,108,101,216,0,0,0,115,14,0,0,0,8,6,2,1, + 12,1,12,1,8,3,12,2,255,128,114,69,0,0,0,99, + 1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 4,0,0,0,79,0,0,0,115,14,0,0,0,124,0,124, + 1,105,0,124,2,164,1,142,1,83,0,41,2,97,46,1, + 0,0,114,101,109,111,118,101,95,105,109,112,111,114,116,108, + 105,98,95,102,114,97,109,101,115,32,105,110,32,105,109,112, + 111,114,116,46,99,32,119,105,108,108,32,97,108,119,97,121, + 115,32,114,101,109,111,118,101,32,115,101,113,117,101,110,99, + 101,115,10,32,32,32,32,111,102,32,105,109,112,111,114,116, + 108,105,98,32,102,114,97,109,101,115,32,116,104,97,116,32, + 101,110,100,32,119,105,116,104,32,97,32,99,97,108,108,32, + 116,111,32,116,104,105,115,32,102,117,110,99,116,105,111,110, + 10,10,32,32,32,32,85,115,101,32,105,116,32,105,110,115, + 116,101,97,100,32,111,102,32,97,32,110,111,114,109,97,108, + 32,99,97,108,108,32,105,110,32,112,108,97,99,101,115,32, + 119,104,101,114,101,32,105,110,99,108,117,100,105,110,103,32, + 116,104,101,32,105,109,112,111,114,116,108,105,98,10,32,32, + 32,32,102,114,97,109,101,115,32,105,110,116,114,111,100,117, + 99,101,115,32,117,110,119,97,110,116,101,100,32,110,111,105, + 115,101,32,105,110,116,111,32,116,104,101,32,116,114,97,99, + 101,98,97,99,107,32,40,101,46,103,46,32,119,104,101,110, + 32,101,120,101,99,117,116,105,110,103,10,32,32,32,32,109, + 111,100,117,108,101,32,99,111,100,101,41,10,32,32,32,32, + 78,114,5,0,0,0,41,3,218,1,102,114,59,0,0,0, + 90,4,107,119,100,115,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,218,25,95,99,97,108,108,95,119,105,116, + 104,95,102,114,97,109,101,115,95,114,101,109,111,118,101,100, + 233,0,0,0,115,4,0,0,0,14,8,255,128,114,71,0, + 0,0,114,42,0,0,0,41,1,218,9,118,101,114,98,111, + 115,105,116,121,99,1,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,4,0,0,0,71,0,0,0,115,58,0, + 0,0,116,0,106,1,106,2,124,1,107,5,114,54,124,0, + 160,3,100,1,161,1,115,30,100,2,124,0,23,0,125,0, + 116,4,124,0,106,5,124,2,142,0,116,0,106,6,100,3, + 141,2,1,0,100,4,83,0,100,4,83,0,41,5,122,61, + 80,114,105,110,116,32,116,104,101,32,109,101,115,115,97,103, + 101,32,116,111,32,115,116,100,101,114,114,32,105,102,32,45, + 118,47,80,89,84,72,79,78,86,69,82,66,79,83,69,32, + 105,115,32,116,117,114,110,101,100,32,111,110,46,41,2,250, + 1,35,122,7,105,109,112,111,114,116,32,122,2,35,32,41, + 1,90,4,102,105,108,101,78,41,7,114,18,0,0,0,218, + 5,102,108,97,103,115,218,7,118,101,114,98,111,115,101,218, + 10,115,116,97,114,116,115,119,105,116,104,218,5,112,114,105, + 110,116,114,49,0,0,0,218,6,115,116,100,101,114,114,41, + 3,218,7,109,101,115,115,97,103,101,114,72,0,0,0,114, + 59,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,218,16,95,118,101,114,98,111,115,101,95,109,101, + 115,115,97,103,101,244,0,0,0,115,12,0,0,0,12,2, + 10,1,8,1,24,1,4,253,255,128,114,80,0,0,0,99, + 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,3,0,0,0,115,26,0,0,0,135,0,102, + 1,100,1,100,2,132,8,125,1,116,0,124,1,136,0,131, + 2,1,0,124,1,83,0,41,4,122,49,68,101,99,111,114, + 97,116,111,114,32,116,111,32,118,101,114,105,102,121,32,116, + 104,101,32,110,97,109,101,100,32,109,111,100,117,108,101,32, + 105,115,32,98,117,105,108,116,45,105,110,46,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, + 0,19,0,0,0,115,38,0,0,0,124,1,116,0,106,1, + 118,1,114,28,116,2,100,1,160,3,124,1,161,1,124,1, + 100,2,141,2,130,1,136,0,124,0,124,1,131,2,83,0, + 41,3,78,250,29,123,33,114,125,32,105,115,32,110,111,116, + 32,97,32,98,117,105,108,116,45,105,110,32,109,111,100,117, + 108,101,114,19,0,0,0,41,4,114,18,0,0,0,218,20, + 98,117,105,108,116,105,110,95,109,111,100,117,108,101,95,110, + 97,109,101,115,218,11,73,109,112,111,114,116,69,114,114,111, + 114,114,49,0,0,0,169,2,114,33,0,0,0,218,8,102, + 117,108,108,110,97,109,101,169,1,218,3,102,120,110,114,5, + 0,0,0,114,6,0,0,0,218,25,95,114,101,113,117,105, + 114,101,115,95,98,117,105,108,116,105,110,95,119,114,97,112, + 112,101,114,254,0,0,0,115,12,0,0,0,10,1,10,1, + 2,1,6,255,10,2,255,128,122,52,95,114,101,113,117,105, + 114,101,115,95,98,117,105,108,116,105,110,46,60,108,111,99, + 97,108,115,62,46,95,114,101,113,117,105,114,101,115,95,98, + 117,105,108,116,105,110,95,119,114,97,112,112,101,114,78,169, + 1,114,17,0,0,0,41,2,114,87,0,0,0,114,88,0, + 0,0,114,5,0,0,0,114,86,0,0,0,114,6,0,0, + 0,218,17,95,114,101,113,117,105,114,101,115,95,98,117,105, + 108,116,105,110,252,0,0,0,115,8,0,0,0,12,2,10, + 5,4,1,255,128,114,90,0,0,0,99,1,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,3, + 0,0,0,115,26,0,0,0,135,0,102,1,100,1,100,2, + 132,8,125,1,116,0,124,1,136,0,131,2,1,0,124,1, + 83,0,41,4,122,47,68,101,99,111,114,97,116,111,114,32, + 116,111,32,118,101,114,105,102,121,32,116,104,101,32,110,97, + 109,101,100,32,109,111,100,117,108,101,32,105,115,32,102,114, + 111,122,101,110,46,99,2,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,4,0,0,0,19,0,0,0,115,38, + 0,0,0,116,0,160,1,124,1,161,1,115,28,116,2,100, + 1,160,3,124,1,161,1,124,1,100,2,141,2,130,1,136, + 0,124,0,124,1,131,2,83,0,169,3,78,122,27,123,33, + 114,125,32,105,115,32,110,111,116,32,97,32,102,114,111,122, + 101,110,32,109,111,100,117,108,101,114,19,0,0,0,41,4, + 114,61,0,0,0,218,9,105,115,95,102,114,111,122,101,110, + 114,83,0,0,0,114,49,0,0,0,114,84,0,0,0,114, + 86,0,0,0,114,5,0,0,0,114,6,0,0,0,218,24, 95,114,101,113,117,105,114,101,115,95,102,114,111,122,101,110, - 250,0,0,0,115,8,0,0,0,12,2,10,5,4,1,255, - 128,114,91,0,0,0,99,2,0,0,0,0,0,0,0,0, - 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, - 58,0,0,0,116,0,124,1,124,0,131,2,125,2,124,1, - 116,1,106,2,118,0,114,50,116,1,106,2,124,1,25,0, - 125,3,116,3,124,2,124,3,131,2,1,0,116,1,106,2, - 124,1,25,0,83,0,116,4,124,2,131,1,83,0,41,2, - 122,128,76,111,97,100,32,116,104,101,32,115,112,101,99,105, - 102,105,101,100,32,109,111,100,117,108,101,32,105,110,116,111, - 32,115,121,115,46,109,111,100,117,108,101,115,32,97,110,100, - 32,114,101,116,117,114,110,32,105,116,46,10,10,32,32,32, - 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, - 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, - 32,108,111,97,100,101,114,46,101,120,101,99,95,109,111,100, - 117,108,101,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,78,41,5,218,16,115,112,101,99,95,102,114,111,109, - 95,108,111,97,100,101,114,114,15,0,0,0,218,7,109,111, - 100,117,108,101,115,218,5,95,101,120,101,99,218,5,95,108, - 111,97,100,41,4,114,30,0,0,0,114,82,0,0,0,218, - 4,115,112,101,99,218,6,109,111,100,117,108,101,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,17,95,108, - 111,97,100,95,109,111,100,117,108,101,95,115,104,105,109,6, - 1,0,0,115,14,0,0,0,10,6,10,1,10,1,10,1, - 10,1,8,2,255,128,114,98,0,0,0,99,1,0,0,0, - 0,0,0,0,0,0,0,0,5,0,0,0,8,0,0,0, - 67,0,0,0,115,210,0,0,0,116,0,124,0,100,1,100, - 0,131,3,125,1,116,1,124,1,100,2,131,2,114,54,122, - 12,124,1,160,2,124,0,161,1,87,0,83,0,4,0,116, - 3,121,52,1,0,1,0,1,0,89,0,110,2,48,0,122, - 10,124,0,106,4,125,2,87,0,110,18,4,0,116,5,121, - 82,1,0,1,0,1,0,89,0,110,18,48,0,124,2,100, - 0,117,1,114,100,116,6,124,2,131,1,83,0,122,10,124, - 0,106,7,125,3,87,0,110,22,4,0,116,5,121,132,1, - 0,1,0,1,0,100,3,125,3,89,0,110,2,48,0,122, - 10,124,0,106,8,125,4,87,0,110,52,4,0,116,5,121, - 196,1,0,1,0,1,0,124,1,100,0,117,0,114,180,100, - 4,160,9,124,3,161,1,6,0,89,0,83,0,100,5,160, - 9,124,3,124,1,161,2,6,0,89,0,83,0,48,0,100, - 6,160,9,124,3,124,4,161,2,83,0,41,7,78,218,10, - 95,95,108,111,97,100,101,114,95,95,218,11,109,111,100,117, - 108,101,95,114,101,112,114,250,1,63,250,13,60,109,111,100, - 117,108,101,32,123,33,114,125,62,250,20,60,109,111,100,117, - 108,101,32,123,33,114,125,32,40,123,33,114,125,41,62,250, - 23,60,109,111,100,117,108,101,32,123,33,114,125,32,102,114, - 111,109,32,123,33,114,125,62,41,10,114,6,0,0,0,114, - 4,0,0,0,114,100,0,0,0,218,9,69,120,99,101,112, - 116,105,111,110,218,8,95,95,115,112,101,99,95,95,218,14, - 65,116,116,114,105,98,117,116,101,69,114,114,111,114,218,22, + 95,119,114,97,112,112,101,114,9,1,0,0,115,12,0,0, + 0,10,1,10,1,2,1,6,255,10,2,255,128,122,50,95, + 114,101,113,117,105,114,101,115,95,102,114,111,122,101,110,46, + 60,108,111,99,97,108,115,62,46,95,114,101,113,117,105,114, + 101,115,95,102,114,111,122,101,110,95,119,114,97,112,112,101, + 114,78,114,89,0,0,0,41,2,114,87,0,0,0,114,93, + 0,0,0,114,5,0,0,0,114,86,0,0,0,114,6,0, + 0,0,218,16,95,114,101,113,117,105,114,101,115,95,102,114, + 111,122,101,110,7,1,0,0,115,8,0,0,0,12,2,10, + 5,4,1,255,128,114,94,0,0,0,99,2,0,0,0,0, + 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, + 0,0,0,115,74,0,0,0,100,1,125,2,116,0,160,1, + 124,2,116,2,161,2,1,0,116,3,124,1,124,0,131,2, + 125,3,124,1,116,4,106,5,118,0,114,66,116,4,106,5, + 124,1,25,0,125,4,116,6,124,3,124,4,131,2,1,0, + 116,4,106,5,124,1,25,0,83,0,116,7,124,3,131,1, + 83,0,41,3,122,128,76,111,97,100,32,116,104,101,32,115, + 112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,32, + 105,110,116,111,32,115,121,115,46,109,111,100,117,108,101,115, + 32,97,110,100,32,114,101,116,117,114,110,32,105,116,46,10, + 10,32,32,32,32,84,104,105,115,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,85,115,101,32,108,111,97,100,101,114,46,101,120,101,99, + 95,109,111,100,117,108,101,32,105,110,115,116,101,97,100,46, + 10,10,32,32,32,32,122,103,116,104,101,32,108,111,97,100, + 95,109,111,100,117,108,101,40,41,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,32,97, + 110,100,32,115,108,97,116,101,100,32,102,111,114,32,114,101, + 109,111,118,97,108,32,105,110,32,80,121,116,104,111,110,32, + 51,46,49,50,59,32,117,115,101,32,101,120,101,99,95,109, + 111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,78, + 41,8,218,9,95,119,97,114,110,105,110,103,115,218,4,119, + 97,114,110,218,18,68,101,112,114,101,99,97,116,105,111,110, + 87,97,114,110,105,110,103,218,16,115,112,101,99,95,102,114, + 111,109,95,108,111,97,100,101,114,114,18,0,0,0,218,7, + 109,111,100,117,108,101,115,218,5,95,101,120,101,99,218,5, + 95,108,111,97,100,41,5,114,33,0,0,0,114,85,0,0, + 0,218,3,109,115,103,218,4,115,112,101,99,218,6,109,111, + 100,117,108,101,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, + 101,95,115,104,105,109,19,1,0,0,115,18,0,0,0,4, + 6,12,2,10,1,10,1,10,1,10,1,10,1,8,2,255, + 128,114,105,0,0,0,99,1,0,0,0,0,0,0,0,0, + 0,0,0,5,0,0,0,8,0,0,0,67,0,0,0,115, + 210,0,0,0,116,0,124,0,100,1,100,0,131,3,125,1, + 116,1,124,1,100,2,131,2,114,54,122,12,124,1,160,2, + 124,0,161,1,87,0,83,0,4,0,116,3,121,52,1,0, + 1,0,1,0,89,0,110,2,48,0,122,10,124,0,106,4, + 125,2,87,0,110,18,4,0,116,5,121,82,1,0,1,0, + 1,0,89,0,110,18,48,0,124,2,100,0,117,1,114,100, + 116,6,124,2,131,1,83,0,122,10,124,0,106,7,125,3, + 87,0,110,22,4,0,116,5,121,132,1,0,1,0,1,0, + 100,3,125,3,89,0,110,2,48,0,122,10,124,0,106,8, + 125,4,87,0,110,52,4,0,116,5,121,196,1,0,1,0, + 1,0,124,1,100,0,117,0,114,180,100,4,160,9,124,3, + 161,1,6,0,89,0,83,0,100,5,160,9,124,3,124,1, + 161,2,6,0,89,0,83,0,48,0,100,6,160,9,124,3, + 124,4,161,2,83,0,41,7,78,218,10,95,95,108,111,97, + 100,101,114,95,95,218,11,109,111,100,117,108,101,95,114,101, + 112,114,250,1,63,250,13,60,109,111,100,117,108,101,32,123, + 33,114,125,62,250,20,60,109,111,100,117,108,101,32,123,33, + 114,125,32,40,123,33,114,125,41,62,250,23,60,109,111,100, + 117,108,101,32,123,33,114,125,32,102,114,111,109,32,123,33, + 114,125,62,41,10,114,13,0,0,0,114,11,0,0,0,114, + 107,0,0,0,218,9,69,120,99,101,112,116,105,111,110,218, + 8,95,95,115,112,101,99,95,95,114,2,0,0,0,218,22, 95,109,111,100,117,108,101,95,114,101,112,114,95,102,114,111, - 109,95,115,112,101,99,114,1,0,0,0,218,8,95,95,102, - 105,108,101,95,95,114,46,0,0,0,41,5,114,97,0,0, - 0,218,6,108,111,97,100,101,114,114,96,0,0,0,114,17, - 0,0,0,218,8,102,105,108,101,110,97,109,101,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,12,95,109, - 111,100,117,108,101,95,114,101,112,114,22,1,0,0,115,48, + 109,95,115,112,101,99,114,9,0,0,0,218,8,95,95,102, + 105,108,101,95,95,114,49,0,0,0,41,5,114,104,0,0, + 0,218,6,108,111,97,100,101,114,114,103,0,0,0,114,20, + 0,0,0,218,8,102,105,108,101,110,97,109,101,114,5,0, + 0,0,114,5,0,0,0,114,6,0,0,0,218,12,95,109, + 111,100,117,108,101,95,114,101,112,114,38,1,0,0,115,48, 0,0,0,12,2,10,1,2,4,12,1,12,1,6,1,2, 1,10,1,12,1,6,1,8,2,8,1,2,4,10,1,12, 1,10,1,2,1,10,1,12,1,8,1,14,1,18,2,12, - 2,255,128,114,112,0,0,0,99,0,0,0,0,0,0,0, + 2,255,128,114,118,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, 0,115,114,0,0,0,101,0,90,1,100,0,90,2,100,1, 90,3,100,2,100,2,100,2,100,3,156,3,100,4,100,5, @@ -647,375 +666,388 @@ const unsigned char _Py_M__importlib_bootstrap[] = { 124,0,95,0,124,2,124,0,95,1,124,3,124,0,95,2, 124,4,124,0,95,3,124,5,114,32,103,0,110,2,100,0, 124,0,95,4,100,1,124,0,95,5,100,0,124,0,95,6, - 100,0,83,0,41,2,78,70,41,7,114,17,0,0,0,114, - 110,0,0,0,114,114,0,0,0,114,115,0,0,0,218,26, + 100,0,83,0,41,2,78,70,41,7,114,20,0,0,0,114, + 116,0,0,0,114,120,0,0,0,114,121,0,0,0,218,26, 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, 95,108,111,99,97,116,105,111,110,115,218,13,95,115,101,116, 95,102,105,108,101,97,116,116,114,218,7,95,99,97,99,104, - 101,100,41,6,114,30,0,0,0,114,17,0,0,0,114,110, - 0,0,0,114,114,0,0,0,114,115,0,0,0,114,116,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,31,0,0,0,95,1,0,0,115,18,0,0,0,6, - 2,6,1,6,1,6,1,14,1,6,3,6,1,4,128,255, - 128,122,19,77,111,100,117,108,101,83,112,101,99,46,95,95, - 105,110,105,116,95,95,99,1,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115, - 102,0,0,0,100,1,160,0,124,0,106,1,161,1,100,2, - 160,0,124,0,106,2,161,1,103,2,125,1,124,0,106,3, - 100,0,117,1,114,52,124,1,160,4,100,3,160,0,124,0, - 106,3,161,1,161,1,1,0,124,0,106,5,100,0,117,1, - 114,80,124,1,160,4,100,4,160,0,124,0,106,5,161,1, - 161,1,1,0,100,5,160,0,124,0,106,6,106,7,100,6, - 160,8,124,1,161,1,161,2,83,0,41,7,78,122,9,110, - 97,109,101,61,123,33,114,125,122,11,108,111,97,100,101,114, - 61,123,33,114,125,122,11,111,114,105,103,105,110,61,123,33, - 114,125,122,29,115,117,98,109,111,100,117,108,101,95,115,101, - 97,114,99,104,95,108,111,99,97,116,105,111,110,115,61,123, - 125,122,6,123,125,40,123,125,41,122,2,44,32,41,9,114, - 46,0,0,0,114,17,0,0,0,114,110,0,0,0,114,114, - 0,0,0,218,6,97,112,112,101,110,100,114,117,0,0,0, - 218,9,95,95,99,108,97,115,115,95,95,114,1,0,0,0, - 218,4,106,111,105,110,41,2,114,30,0,0,0,114,56,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,49,0,0,0,107,1,0,0,115,22,0,0,0,10, - 1,10,1,4,255,10,2,18,1,10,1,8,1,4,1,6, - 255,22,2,255,128,122,19,77,111,100,117,108,101,83,112,101, - 99,46,95,95,114,101,112,114,95,95,99,2,0,0,0,0, - 0,0,0,0,0,0,0,3,0,0,0,8,0,0,0,67, - 0,0,0,115,102,0,0,0,124,0,106,0,125,2,122,72, - 124,0,106,1,124,1,106,1,107,2,111,76,124,0,106,2, - 124,1,106,2,107,2,111,76,124,0,106,3,124,1,106,3, - 107,2,111,76,124,2,124,1,106,0,107,2,111,76,124,0, - 106,4,124,1,106,4,107,2,111,76,124,0,106,5,124,1, - 106,5,107,2,87,0,83,0,4,0,116,6,121,100,1,0, - 1,0,1,0,116,7,6,0,89,0,83,0,48,0,114,13, - 0,0,0,41,8,114,117,0,0,0,114,17,0,0,0,114, - 110,0,0,0,114,114,0,0,0,218,6,99,97,99,104,101, - 100,218,12,104,97,115,95,108,111,99,97,116,105,111,110,114, - 107,0,0,0,218,14,78,111,116,73,109,112,108,101,109,101, - 110,116,101,100,41,3,114,30,0,0,0,90,5,111,116,104, - 101,114,90,4,115,109,115,108,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,6,95,95,101,113,95,95,117, - 1,0,0,115,32,0,0,0,6,1,2,1,12,1,10,1, - 2,255,10,2,2,254,8,3,2,253,10,4,2,252,10,5, - 4,251,12,6,10,1,255,128,122,17,77,111,100,117,108,101, - 83,112,101,99,46,95,95,101,113,95,95,99,1,0,0,0, - 0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0, - 67,0,0,0,115,58,0,0,0,124,0,106,0,100,0,117, - 0,114,52,124,0,106,1,100,0,117,1,114,52,124,0,106, - 2,114,52,116,3,100,0,117,0,114,38,116,4,130,1,116, - 3,160,5,124,0,106,1,161,1,124,0,95,0,124,0,106, - 0,83,0,114,13,0,0,0,41,6,114,119,0,0,0,114, - 114,0,0,0,114,118,0,0,0,218,19,95,98,111,111,116, - 115,116,114,97,112,95,101,120,116,101,114,110,97,108,218,19, - 78,111,116,73,109,112,108,101,109,101,110,116,101,100,69,114, - 114,111,114,90,11,95,103,101,116,95,99,97,99,104,101,100, - 114,48,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,123,0,0,0,129,1,0,0,115,14,0, - 0,0,10,2,16,1,8,1,4,1,14,1,6,1,255,128, - 122,17,77,111,100,117,108,101,83,112,101,99,46,99,97,99, - 104,101,100,99,2,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,2,0,0,0,67,0,0,0,115,10,0,0, - 0,124,1,124,0,95,0,100,0,83,0,114,13,0,0,0, - 41,1,114,119,0,0,0,41,2,114,30,0,0,0,114,123, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,123,0,0,0,138,1,0,0,115,6,0,0,0, - 6,2,4,128,255,128,99,1,0,0,0,0,0,0,0,0, - 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, - 32,0,0,0,124,0,106,0,100,1,117,0,114,26,124,0, - 106,1,160,2,100,2,161,1,100,3,25,0,83,0,124,0, - 106,1,83,0,41,4,122,32,84,104,101,32,110,97,109,101, - 32,111,102,32,116,104,101,32,109,111,100,117,108,101,39,115, - 32,112,97,114,101,110,116,46,78,218,1,46,114,22,0,0, - 0,41,3,114,117,0,0,0,114,17,0,0,0,218,10,114, - 112,97,114,116,105,116,105,111,110,114,48,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,218,6,112, - 97,114,101,110,116,142,1,0,0,115,8,0,0,0,10,3, - 16,1,6,2,255,128,122,17,77,111,100,117,108,101,83,112, - 101,99,46,112,97,114,101,110,116,99,1,0,0,0,0,0, - 0,0,0,0,0,0,1,0,0,0,1,0,0,0,67,0, - 0,0,115,6,0,0,0,124,0,106,0,83,0,114,13,0, - 0,0,41,1,114,118,0,0,0,114,48,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,124,0, - 0,0,150,1,0,0,115,4,0,0,0,6,2,255,128,122, - 23,77,111,100,117,108,101,83,112,101,99,46,104,97,115,95, - 108,111,99,97,116,105,111,110,99,2,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, - 0,115,14,0,0,0,116,0,124,1,131,1,124,0,95,1, - 100,0,83,0,114,13,0,0,0,41,2,218,4,98,111,111, - 108,114,118,0,0,0,41,2,114,30,0,0,0,218,5,118, - 97,108,117,101,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,114,124,0,0,0,154,1,0,0,115,6,0,0, - 0,10,2,4,128,255,128,41,12,114,1,0,0,0,114,0, - 0,0,0,114,2,0,0,0,114,3,0,0,0,114,31,0, - 0,0,114,49,0,0,0,114,126,0,0,0,218,8,112,114, - 111,112,101,114,116,121,114,123,0,0,0,218,6,115,101,116, - 116,101,114,114,131,0,0,0,114,124,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,113,0,0,0,58,1,0,0,115,36,0,0,0,8, - 0,4,1,4,36,2,1,12,255,8,12,8,10,2,12,10, - 1,4,8,10,1,2,3,10,1,2,7,10,1,4,3,14, - 1,255,128,114,113,0,0,0,169,2,114,114,0,0,0,114, - 116,0,0,0,99,2,0,0,0,0,0,0,0,2,0,0, - 0,6,0,0,0,8,0,0,0,67,0,0,0,115,150,0, - 0,0,116,0,124,1,100,1,131,2,114,74,116,1,100,2, - 117,0,114,22,116,2,130,1,116,1,106,3,125,4,124,3, - 100,2,117,0,114,48,124,4,124,0,124,1,100,3,141,2, - 83,0,124,3,114,56,103,0,110,2,100,2,125,5,124,4, - 124,0,124,1,124,5,100,4,141,3,83,0,124,3,100,2, - 117,0,114,134,116,0,124,1,100,5,131,2,114,130,122,14, - 124,1,160,4,124,0,161,1,125,3,87,0,110,26,4,0, - 116,5,121,128,1,0,1,0,1,0,100,2,125,3,89,0, - 110,6,48,0,100,6,125,3,116,6,124,0,124,1,124,2, - 124,3,100,7,141,4,83,0,41,8,122,53,82,101,116,117, - 114,110,32,97,32,109,111,100,117,108,101,32,115,112,101,99, - 32,98,97,115,101,100,32,111,110,32,118,97,114,105,111,117, - 115,32,108,111,97,100,101,114,32,109,101,116,104,111,100,115, - 46,90,12,103,101,116,95,102,105,108,101,110,97,109,101,78, - 41,1,114,110,0,0,0,41,2,114,110,0,0,0,114,117, - 0,0,0,114,116,0,0,0,70,114,136,0,0,0,41,7, - 114,4,0,0,0,114,127,0,0,0,114,128,0,0,0,218, - 23,115,112,101,99,95,102,114,111,109,95,102,105,108,101,95, - 108,111,99,97,116,105,111,110,114,116,0,0,0,114,80,0, - 0,0,114,113,0,0,0,41,6,114,17,0,0,0,114,110, - 0,0,0,114,114,0,0,0,114,116,0,0,0,114,137,0, - 0,0,90,6,115,101,97,114,99,104,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,92,0,0,0,159,1, - 0,0,115,38,0,0,0,10,2,8,1,4,1,6,1,8, - 2,12,1,12,1,6,1,2,1,6,255,8,3,10,1,2, - 1,14,1,12,1,10,1,4,3,16,2,255,128,114,92,0, - 0,0,99,3,0,0,0,0,0,0,0,0,0,0,0,8, - 0,0,0,8,0,0,0,67,0,0,0,115,40,1,0,0, - 122,10,124,0,106,0,125,3,87,0,110,18,4,0,116,1, - 121,28,1,0,1,0,1,0,89,0,110,14,48,0,124,3, - 100,0,117,1,114,42,124,3,83,0,124,0,106,2,125,4, - 124,1,100,0,117,0,114,86,122,10,124,0,106,3,125,1, - 87,0,110,18,4,0,116,1,121,84,1,0,1,0,1,0, - 89,0,110,2,48,0,122,10,124,0,106,4,125,5,87,0, - 110,22,4,0,116,1,121,118,1,0,1,0,1,0,100,0, - 125,5,89,0,110,2,48,0,124,2,100,0,117,0,114,174, - 124,5,100,0,117,0,114,170,122,10,124,1,106,5,125,2, - 87,0,110,26,4,0,116,1,121,168,1,0,1,0,1,0, - 100,0,125,2,89,0,110,6,48,0,124,5,125,2,122,10, - 124,0,106,6,125,6,87,0,110,22,4,0,116,1,121,206, - 1,0,1,0,1,0,100,0,125,6,89,0,110,2,48,0, - 122,14,116,7,124,0,106,8,131,1,125,7,87,0,110,22, - 4,0,116,1,121,244,1,0,1,0,1,0,100,0,125,7, - 89,0,110,2,48,0,116,9,124,4,124,1,124,2,100,1, - 141,3,125,3,124,5,100,0,117,0,144,1,114,18,100,2, - 110,2,100,3,124,3,95,10,124,6,124,3,95,11,124,7, - 124,3,95,12,124,3,83,0,41,4,78,169,1,114,114,0, - 0,0,70,84,41,13,114,106,0,0,0,114,107,0,0,0, - 114,1,0,0,0,114,99,0,0,0,114,109,0,0,0,218, - 7,95,79,82,73,71,73,78,218,10,95,95,99,97,99,104, - 101,100,95,95,218,4,108,105,115,116,218,8,95,95,112,97, - 116,104,95,95,114,113,0,0,0,114,118,0,0,0,114,123, - 0,0,0,114,117,0,0,0,41,8,114,97,0,0,0,114, - 110,0,0,0,114,114,0,0,0,114,96,0,0,0,114,17, - 0,0,0,90,8,108,111,99,97,116,105,111,110,114,123,0, - 0,0,114,117,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,17,95,115,112,101,99,95,102,114, - 111,109,95,109,111,100,117,108,101,185,1,0,0,115,74,0, - 0,0,2,2,10,1,12,1,6,1,8,2,4,1,6,2, - 8,1,2,1,10,1,12,1,6,2,2,1,10,1,12,1, - 10,1,8,1,8,1,2,1,10,1,12,1,10,1,4,2, - 2,1,10,1,12,1,10,1,2,1,14,1,12,1,10,1, - 14,2,20,1,6,1,6,1,4,1,255,128,114,143,0,0, - 0,70,169,1,218,8,111,118,101,114,114,105,100,101,99,2, - 0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,8, - 0,0,0,67,0,0,0,115,210,1,0,0,124,2,115,20, - 116,0,124,1,100,1,100,0,131,3,100,0,117,0,114,52, - 122,12,124,0,106,1,124,1,95,2,87,0,110,18,4,0, - 116,3,121,50,1,0,1,0,1,0,89,0,110,2,48,0, - 124,2,115,72,116,0,124,1,100,2,100,0,131,3,100,0, - 117,0,114,174,124,0,106,4,125,3,124,3,100,0,117,0, - 114,144,124,0,106,5,100,0,117,1,114,144,116,6,100,0, - 117,0,114,108,116,7,130,1,116,6,106,8,125,4,124,4, - 160,9,124,4,161,1,125,3,124,0,106,5,124,3,95,10, - 124,3,124,0,95,4,100,0,124,1,95,11,122,10,124,3, - 124,1,95,12,87,0,110,18,4,0,116,3,121,172,1,0, - 1,0,1,0,89,0,110,2,48,0,124,2,115,194,116,0, - 124,1,100,3,100,0,131,3,100,0,117,0,114,226,122,12, - 124,0,106,13,124,1,95,14,87,0,110,18,4,0,116,3, - 121,224,1,0,1,0,1,0,89,0,110,2,48,0,122,10, - 124,0,124,1,95,15,87,0,110,18,4,0,116,3,121,254, - 1,0,1,0,1,0,89,0,110,2,48,0,124,2,144,1, - 115,24,116,0,124,1,100,4,100,0,131,3,100,0,117,0, - 144,1,114,70,124,0,106,5,100,0,117,1,144,1,114,70, - 122,12,124,0,106,5,124,1,95,16,87,0,110,20,4,0, - 116,3,144,1,121,68,1,0,1,0,1,0,89,0,110,2, - 48,0,124,0,106,17,144,1,114,206,124,2,144,1,115,102, - 116,0,124,1,100,5,100,0,131,3,100,0,117,0,144,1, - 114,136,122,12,124,0,106,18,124,1,95,11,87,0,110,20, - 4,0,116,3,144,1,121,134,1,0,1,0,1,0,89,0, - 110,2,48,0,124,2,144,1,115,160,116,0,124,1,100,6, - 100,0,131,3,100,0,117,0,144,1,114,206,124,0,106,19, - 100,0,117,1,144,1,114,206,122,12,124,0,106,19,124,1, - 95,20,87,0,110,20,4,0,116,3,144,1,121,204,1,0, - 1,0,1,0,89,0,110,2,48,0,124,1,83,0,41,7, - 78,114,1,0,0,0,114,99,0,0,0,218,11,95,95,112, - 97,99,107,97,103,101,95,95,114,142,0,0,0,114,109,0, - 0,0,114,140,0,0,0,41,21,114,6,0,0,0,114,17, - 0,0,0,114,1,0,0,0,114,107,0,0,0,114,110,0, - 0,0,114,117,0,0,0,114,127,0,0,0,114,128,0,0, - 0,218,16,95,78,97,109,101,115,112,97,99,101,76,111,97, - 100,101,114,218,7,95,95,110,101,119,95,95,90,5,95,112, - 97,116,104,114,109,0,0,0,114,99,0,0,0,114,131,0, - 0,0,114,146,0,0,0,114,106,0,0,0,114,142,0,0, - 0,114,124,0,0,0,114,114,0,0,0,114,123,0,0,0, - 114,140,0,0,0,41,5,114,96,0,0,0,114,97,0,0, - 0,114,145,0,0,0,114,110,0,0,0,114,147,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, - 18,95,105,110,105,116,95,109,111,100,117,108,101,95,97,116, - 116,114,115,230,1,0,0,115,98,0,0,0,20,4,2,1, - 12,1,12,1,6,1,20,2,6,1,8,1,10,2,8,1, - 4,1,6,1,10,2,8,1,6,1,6,11,2,1,10,1, - 12,1,6,1,20,2,2,1,12,1,12,1,6,1,2,2, - 10,1,12,1,6,1,24,2,12,1,2,1,12,1,14,1, - 6,1,8,2,24,1,2,1,12,1,14,1,6,1,24,2, - 12,1,2,1,12,1,14,1,6,1,4,1,255,128,114,149, - 0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,3,0,0,0,67,0,0,0,115,82,0,0, - 0,100,1,125,1,116,0,124,0,106,1,100,2,131,2,114, - 30,124,0,106,1,160,2,124,0,161,1,125,1,110,20,116, - 0,124,0,106,1,100,3,131,2,114,50,116,3,100,4,131, - 1,130,1,124,1,100,1,117,0,114,68,116,4,124,0,106, - 5,131,1,125,1,116,6,124,0,124,1,131,2,1,0,124, - 1,83,0,41,5,122,43,67,114,101,97,116,101,32,97,32, - 109,111,100,117,108,101,32,98,97,115,101,100,32,111,110,32, - 116,104,101,32,112,114,111,118,105,100,101,100,32,115,112,101, - 99,46,78,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,218,11,101,120,101,99,95,109,111,100,117,108,101,122, - 66,108,111,97,100,101,114,115,32,116,104,97,116,32,100,101, - 102,105,110,101,32,101,120,101,99,95,109,111,100,117,108,101, - 40,41,32,109,117,115,116,32,97,108,115,111,32,100,101,102, - 105,110,101,32,99,114,101,97,116,101,95,109,111,100,117,108, - 101,40,41,41,7,114,4,0,0,0,114,110,0,0,0,114, - 150,0,0,0,114,80,0,0,0,114,18,0,0,0,114,17, - 0,0,0,114,149,0,0,0,169,2,114,96,0,0,0,114, - 97,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,16,109,111,100,117,108,101,95,102,114,111,109, - 95,115,112,101,99,46,2,0,0,115,20,0,0,0,4,3, - 12,1,14,3,12,1,8,1,8,2,10,1,10,1,4,1, - 255,128,114,153,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, - 115,100,0,0,0,124,0,106,0,100,1,117,0,114,14,100, - 2,110,4,124,0,106,0,125,1,124,0,106,1,100,1,117, - 0,114,64,124,0,106,2,100,1,117,0,114,50,100,3,160, - 3,124,1,161,1,83,0,100,4,160,3,124,1,124,0,106, - 2,161,2,83,0,124,0,106,4,114,84,100,5,160,3,124, - 1,124,0,106,1,161,2,83,0,100,6,160,3,124,0,106, - 0,124,0,106,1,161,2,83,0,41,7,122,38,82,101,116, - 117,114,110,32,116,104,101,32,114,101,112,114,32,116,111,32, - 117,115,101,32,102,111,114,32,116,104,101,32,109,111,100,117, - 108,101,46,78,114,101,0,0,0,114,102,0,0,0,114,103, - 0,0,0,114,104,0,0,0,250,18,60,109,111,100,117,108, - 101,32,123,33,114,125,32,40,123,125,41,62,41,5,114,17, - 0,0,0,114,114,0,0,0,114,110,0,0,0,114,46,0, - 0,0,114,124,0,0,0,41,2,114,96,0,0,0,114,17, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,108,0,0,0,63,2,0,0,115,18,0,0,0, - 20,3,10,1,10,1,10,1,14,2,6,2,14,1,16,2, - 255,128,114,108,0,0,0,99,2,0,0,0,0,0,0,0, - 0,0,0,0,4,0,0,0,10,0,0,0,67,0,0,0, - 115,250,0,0,0,124,0,106,0,125,2,116,1,124,2,131, - 1,143,216,1,0,116,2,106,3,160,4,124,2,161,1,124, - 1,117,1,114,54,100,1,160,5,124,2,161,1,125,3,116, - 6,124,3,124,2,100,2,141,2,130,1,122,132,124,0,106, - 7,100,3,117,0,114,106,124,0,106,8,100,3,117,0,114, - 90,116,6,100,4,124,0,106,0,100,2,141,2,130,1,116, - 9,124,0,124,1,100,5,100,6,141,3,1,0,110,52,116, - 9,124,0,124,1,100,5,100,6,141,3,1,0,116,10,124, - 0,106,7,100,7,131,2,115,146,124,0,106,7,160,11,124, - 2,161,1,1,0,110,12,124,0,106,7,160,12,124,1,161, - 1,1,0,87,0,116,2,106,3,160,13,124,0,106,0,161, + 101,100,41,6,114,33,0,0,0,114,20,0,0,0,114,116, + 0,0,0,114,120,0,0,0,114,121,0,0,0,114,122,0, + 0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0, + 0,114,34,0,0,0,111,1,0,0,115,16,0,0,0,6, + 2,6,1,6,1,6,1,14,1,6,3,10,1,255,128,122, + 19,77,111,100,117,108,101,83,112,101,99,46,95,95,105,110, + 105,116,95,95,99,1,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,6,0,0,0,67,0,0,0,115,102,0, + 0,0,100,1,160,0,124,0,106,1,161,1,100,2,160,0, + 124,0,106,2,161,1,103,2,125,1,124,0,106,3,100,0, + 117,1,114,52,124,1,160,4,100,3,160,0,124,0,106,3, + 161,1,161,1,1,0,124,0,106,5,100,0,117,1,114,80, + 124,1,160,4,100,4,160,0,124,0,106,5,161,1,161,1, + 1,0,100,5,160,0,124,0,106,6,106,7,100,6,160,8, + 124,1,161,1,161,2,83,0,41,7,78,122,9,110,97,109, + 101,61,123,33,114,125,122,11,108,111,97,100,101,114,61,123, + 33,114,125,122,11,111,114,105,103,105,110,61,123,33,114,125, + 122,29,115,117,98,109,111,100,117,108,101,95,115,101,97,114, + 99,104,95,108,111,99,97,116,105,111,110,115,61,123,125,122, + 6,123,125,40,123,125,41,122,2,44,32,41,9,114,49,0, + 0,0,114,20,0,0,0,114,116,0,0,0,114,120,0,0, + 0,218,6,97,112,112,101,110,100,114,123,0,0,0,218,9, + 95,95,99,108,97,115,115,95,95,114,9,0,0,0,218,4, + 106,111,105,110,41,2,114,33,0,0,0,114,59,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 52,0,0,0,123,1,0,0,115,22,0,0,0,10,1,10, + 1,4,255,10,2,18,1,10,1,8,1,4,1,6,255,22, + 2,255,128,122,19,77,111,100,117,108,101,83,112,101,99,46, + 95,95,114,101,112,114,95,95,99,2,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,8,0,0,0,67,0,0, + 0,115,102,0,0,0,124,0,106,0,125,2,122,72,124,0, + 106,1,124,1,106,1,107,2,111,76,124,0,106,2,124,1, + 106,2,107,2,111,76,124,0,106,3,124,1,106,3,107,2, + 111,76,124,2,124,1,106,0,107,2,111,76,124,0,106,4, + 124,1,106,4,107,2,111,76,124,0,106,5,124,1,106,5, + 107,2,87,0,83,0,4,0,116,6,121,100,1,0,1,0, + 1,0,116,7,6,0,89,0,83,0,48,0,114,0,0,0, + 0,41,8,114,123,0,0,0,114,20,0,0,0,114,116,0, + 0,0,114,120,0,0,0,218,6,99,97,99,104,101,100,218, + 12,104,97,115,95,108,111,99,97,116,105,111,110,114,2,0, + 0,0,218,14,78,111,116,73,109,112,108,101,109,101,110,116, + 101,100,41,3,114,33,0,0,0,90,5,111,116,104,101,114, + 90,4,115,109,115,108,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,218,6,95,95,101,113,95,95,133,1,0, + 0,115,32,0,0,0,6,1,2,1,12,1,10,1,2,255, + 10,2,2,254,8,3,2,253,10,4,2,252,10,5,4,251, + 12,6,10,1,255,128,122,17,77,111,100,117,108,101,83,112, + 101,99,46,95,95,101,113,95,95,99,1,0,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, + 0,0,115,58,0,0,0,124,0,106,0,100,0,117,0,114, + 52,124,0,106,1,100,0,117,1,114,52,124,0,106,2,114, + 52,116,3,100,0,117,0,114,38,116,4,130,1,116,3,160, + 5,124,0,106,1,161,1,124,0,95,0,124,0,106,0,83, + 0,114,0,0,0,0,41,6,114,125,0,0,0,114,120,0, + 0,0,114,124,0,0,0,218,19,95,98,111,111,116,115,116, + 114,97,112,95,101,120,116,101,114,110,97,108,218,19,78,111, + 116,73,109,112,108,101,109,101,110,116,101,100,69,114,114,111, + 114,90,11,95,103,101,116,95,99,97,99,104,101,100,114,51, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,114,129,0,0,0,145,1,0,0,115,14,0,0,0, + 10,2,16,1,8,1,4,1,14,1,6,1,255,128,122,17, + 77,111,100,117,108,101,83,112,101,99,46,99,97,99,104,101, + 100,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,2,0,0,0,67,0,0,0,115,10,0,0,0,124, + 1,124,0,95,0,100,0,83,0,114,0,0,0,0,41,1, + 114,125,0,0,0,41,2,114,33,0,0,0,114,129,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,129,0,0,0,154,1,0,0,115,4,0,0,0,10,2, + 255,128,99,1,0,0,0,0,0,0,0,0,0,0,0,1, + 0,0,0,3,0,0,0,67,0,0,0,115,32,0,0,0, + 124,0,106,0,100,1,117,0,114,26,124,0,106,1,160,2, + 100,2,161,1,100,3,25,0,83,0,124,0,106,1,83,0, + 41,4,122,32,84,104,101,32,110,97,109,101,32,111,102,32, + 116,104,101,32,109,111,100,117,108,101,39,115,32,112,97,114, + 101,110,116,46,78,218,1,46,114,25,0,0,0,41,3,114, + 123,0,0,0,114,20,0,0,0,218,10,114,112,97,114,116, + 105,116,105,111,110,114,51,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,218,6,112,97,114,101,110, + 116,158,1,0,0,115,8,0,0,0,10,3,16,1,6,2, + 255,128,122,17,77,111,100,117,108,101,83,112,101,99,46,112, + 97,114,101,110,116,99,1,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,0,1,0,0,0,67,0,0,0,115,6, + 0,0,0,124,0,106,0,83,0,114,0,0,0,0,41,1, + 114,124,0,0,0,114,51,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,114,130,0,0,0,166,1, + 0,0,115,4,0,0,0,6,2,255,128,122,23,77,111,100, + 117,108,101,83,112,101,99,46,104,97,115,95,108,111,99,97, + 116,105,111,110,99,2,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,2,0,0,0,67,0,0,0,115,14,0, + 0,0,116,0,124,1,131,1,124,0,95,1,100,0,83,0, + 114,0,0,0,0,41,2,218,4,98,111,111,108,114,124,0, + 0,0,41,2,114,33,0,0,0,218,5,118,97,108,117,101, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 130,0,0,0,170,1,0,0,115,4,0,0,0,14,2,255, + 128,41,12,114,9,0,0,0,114,8,0,0,0,114,1,0, + 0,0,114,10,0,0,0,114,34,0,0,0,114,52,0,0, + 0,114,132,0,0,0,218,8,112,114,111,112,101,114,116,121, + 114,129,0,0,0,218,6,115,101,116,116,101,114,114,137,0, + 0,0,114,130,0,0,0,114,5,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,6,0,0,0,114,119,0,0,0, + 74,1,0,0,115,36,0,0,0,8,0,4,1,4,36,2, + 1,12,255,8,12,8,10,2,12,10,1,4,8,10,1,2, + 3,10,1,2,7,10,1,4,3,14,1,255,128,114,119,0, + 0,0,169,2,114,120,0,0,0,114,122,0,0,0,99,2, + 0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,8, + 0,0,0,67,0,0,0,115,150,0,0,0,116,0,124,1, + 100,1,131,2,114,74,116,1,100,2,117,0,114,22,116,2, + 130,1,116,1,106,3,125,4,124,3,100,2,117,0,114,48, + 124,4,124,0,124,1,100,3,141,2,83,0,124,3,114,56, + 103,0,110,2,100,2,125,5,124,4,124,0,124,1,124,5, + 100,4,141,3,83,0,124,3,100,2,117,0,114,134,116,0, + 124,1,100,5,131,2,114,130,122,14,124,1,160,4,124,0, + 161,1,125,3,87,0,110,26,4,0,116,5,121,128,1,0, + 1,0,1,0,100,2,125,3,89,0,110,6,48,0,100,6, + 125,3,116,6,124,0,124,1,124,2,124,3,100,7,141,4, + 83,0,41,8,122,53,82,101,116,117,114,110,32,97,32,109, + 111,100,117,108,101,32,115,112,101,99,32,98,97,115,101,100, + 32,111,110,32,118,97,114,105,111,117,115,32,108,111,97,100, + 101,114,32,109,101,116,104,111,100,115,46,90,12,103,101,116, + 95,102,105,108,101,110,97,109,101,78,41,1,114,116,0,0, + 0,41,2,114,116,0,0,0,114,123,0,0,0,114,122,0, + 0,0,70,114,142,0,0,0,41,7,114,11,0,0,0,114, + 133,0,0,0,114,134,0,0,0,218,23,115,112,101,99,95, + 102,114,111,109,95,102,105,108,101,95,108,111,99,97,116,105, + 111,110,114,122,0,0,0,114,83,0,0,0,114,119,0,0, + 0,41,6,114,20,0,0,0,114,116,0,0,0,114,120,0, + 0,0,114,122,0,0,0,114,143,0,0,0,90,6,115,101, + 97,114,99,104,114,5,0,0,0,114,5,0,0,0,114,6, + 0,0,0,114,98,0,0,0,175,1,0,0,115,38,0,0, + 0,10,2,8,1,4,1,6,1,8,2,12,1,12,1,6, + 1,2,1,6,255,8,3,10,1,2,1,14,1,12,1,10, + 1,4,3,16,2,255,128,114,98,0,0,0,99,3,0,0, + 0,0,0,0,0,0,0,0,0,8,0,0,0,8,0,0, + 0,67,0,0,0,115,40,1,0,0,122,10,124,0,106,0, + 125,3,87,0,110,18,4,0,116,1,121,28,1,0,1,0, + 1,0,89,0,110,14,48,0,124,3,100,0,117,1,114,42, + 124,3,83,0,124,0,106,2,125,4,124,1,100,0,117,0, + 114,86,122,10,124,0,106,3,125,1,87,0,110,18,4,0, + 116,1,121,84,1,0,1,0,1,0,89,0,110,2,48,0, + 122,10,124,0,106,4,125,5,87,0,110,22,4,0,116,1, + 121,118,1,0,1,0,1,0,100,0,125,5,89,0,110,2, + 48,0,124,2,100,0,117,0,114,174,124,5,100,0,117,0, + 114,170,122,10,124,1,106,5,125,2,87,0,110,26,4,0, + 116,1,121,168,1,0,1,0,1,0,100,0,125,2,89,0, + 110,6,48,0,124,5,125,2,122,10,124,0,106,6,125,6, + 87,0,110,22,4,0,116,1,121,206,1,0,1,0,1,0, + 100,0,125,6,89,0,110,2,48,0,122,14,116,7,124,0, + 106,8,131,1,125,7,87,0,110,22,4,0,116,1,121,244, + 1,0,1,0,1,0,100,0,125,7,89,0,110,2,48,0, + 116,9,124,4,124,1,124,2,100,1,141,3,125,3,124,5, + 100,0,117,0,144,1,114,18,100,2,110,2,100,3,124,3, + 95,10,124,6,124,3,95,11,124,7,124,3,95,12,124,3, + 83,0,41,4,78,169,1,114,120,0,0,0,70,84,41,13, + 114,113,0,0,0,114,2,0,0,0,114,9,0,0,0,114, + 106,0,0,0,114,115,0,0,0,218,7,95,79,82,73,71, + 73,78,218,10,95,95,99,97,99,104,101,100,95,95,218,4, + 108,105,115,116,218,8,95,95,112,97,116,104,95,95,114,119, + 0,0,0,114,124,0,0,0,114,129,0,0,0,114,123,0, + 0,0,41,8,114,104,0,0,0,114,116,0,0,0,114,120, + 0,0,0,114,103,0,0,0,114,20,0,0,0,90,8,108, + 111,99,97,116,105,111,110,114,129,0,0,0,114,123,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 218,17,95,115,112,101,99,95,102,114,111,109,95,109,111,100, + 117,108,101,201,1,0,0,115,74,0,0,0,2,2,10,1, + 12,1,6,1,8,2,4,1,6,2,8,1,2,1,10,1, + 12,1,6,2,2,1,10,1,12,1,10,1,8,1,8,1, + 2,1,10,1,12,1,10,1,4,2,2,1,10,1,12,1, + 10,1,2,1,14,1,12,1,10,1,14,2,20,1,6,1, + 6,1,4,1,255,128,114,149,0,0,0,70,169,1,218,8, + 111,118,101,114,114,105,100,101,99,2,0,0,0,0,0,0, + 0,1,0,0,0,5,0,0,0,8,0,0,0,67,0,0, + 0,115,214,1,0,0,124,2,115,20,116,0,124,1,100,1, + 100,0,131,3,100,0,117,0,114,52,122,12,124,0,106,1, + 124,1,95,2,87,0,110,18,4,0,116,3,121,50,1,0, + 1,0,1,0,89,0,110,2,48,0,124,2,115,72,116,0, + 124,1,100,2,100,0,131,3,100,0,117,0,114,174,124,0, + 106,4,125,3,124,3,100,0,117,0,114,144,124,0,106,5, + 100,0,117,1,114,144,116,6,100,0,117,0,114,108,116,7, + 130,1,116,6,106,8,125,4,124,4,160,9,124,4,161,1, + 125,3,124,0,106,5,124,3,95,10,124,3,124,0,95,4, + 100,0,124,1,95,11,122,10,124,3,124,1,95,12,87,0, + 110,18,4,0,116,3,121,172,1,0,1,0,1,0,89,0, + 110,2,48,0,124,2,115,194,116,0,124,1,100,3,100,0, + 131,3,100,0,117,0,114,226,122,12,124,0,106,13,124,1, + 95,14,87,0,110,18,4,0,116,3,121,224,1,0,1,0, + 1,0,89,0,110,2,48,0,122,10,124,0,124,1,95,15, + 87,0,110,18,4,0,116,3,121,254,1,0,1,0,1,0, + 89,0,110,2,48,0,124,2,144,1,115,24,116,0,124,1, + 100,4,100,0,131,3,100,0,117,0,144,1,114,70,124,0, + 106,5,100,0,117,1,144,1,114,70,122,12,124,0,106,5, + 124,1,95,16,87,0,110,20,4,0,116,3,144,1,121,68, + 1,0,1,0,1,0,89,0,110,2,48,0,124,0,106,17, + 144,1,114,210,124,2,144,1,115,102,116,0,124,1,100,5, + 100,0,131,3,100,0,117,0,144,1,114,136,122,12,124,0, + 106,18,124,1,95,11,87,0,110,20,4,0,116,3,144,1, + 121,134,1,0,1,0,1,0,89,0,110,2,48,0,124,2, + 144,1,115,160,116,0,124,1,100,6,100,0,131,3,100,0, + 117,0,144,1,114,210,124,0,106,19,100,0,117,1,144,1, + 114,210,122,14,124,0,106,19,124,1,95,20,87,0,124,1, + 83,0,4,0,116,3,144,1,121,208,1,0,1,0,1,0, + 89,0,124,1,83,0,48,0,124,1,83,0,41,7,78,114, + 9,0,0,0,114,106,0,0,0,218,11,95,95,112,97,99, + 107,97,103,101,95,95,114,148,0,0,0,114,115,0,0,0, + 114,146,0,0,0,41,21,114,13,0,0,0,114,20,0,0, + 0,114,9,0,0,0,114,2,0,0,0,114,116,0,0,0, + 114,123,0,0,0,114,133,0,0,0,114,134,0,0,0,218, + 16,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, + 114,218,7,95,95,110,101,119,95,95,90,5,95,112,97,116, + 104,114,115,0,0,0,114,106,0,0,0,114,137,0,0,0, + 114,152,0,0,0,114,113,0,0,0,114,148,0,0,0,114, + 130,0,0,0,114,120,0,0,0,114,129,0,0,0,114,146, + 0,0,0,41,5,114,103,0,0,0,114,104,0,0,0,114, + 151,0,0,0,114,116,0,0,0,114,153,0,0,0,114,5, + 0,0,0,114,5,0,0,0,114,6,0,0,0,218,18,95, + 105,110,105,116,95,109,111,100,117,108,101,95,97,116,116,114, + 115,246,1,0,0,115,104,0,0,0,20,4,2,1,12,1, + 12,1,6,1,20,2,6,1,8,1,10,2,8,1,4,1, + 6,1,10,2,8,1,6,1,6,11,2,1,10,1,12,1, + 6,1,20,2,2,1,12,1,12,1,6,1,2,2,10,1, + 12,1,6,1,24,2,12,1,2,1,12,1,14,1,6,1, + 8,2,24,1,2,1,12,1,14,1,6,1,24,2,12,1, + 2,1,10,1,4,3,14,254,2,1,4,1,2,255,4,1, + 255,128,114,155,0,0,0,99,1,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, + 115,82,0,0,0,100,1,125,1,116,0,124,0,106,1,100, + 2,131,2,114,30,124,0,106,1,160,2,124,0,161,1,125, + 1,110,20,116,0,124,0,106,1,100,3,131,2,114,50,116, + 3,100,4,131,1,130,1,124,1,100,1,117,0,114,68,116, + 4,124,0,106,5,131,1,125,1,116,6,124,0,124,1,131, + 2,1,0,124,1,83,0,41,5,122,43,67,114,101,97,116, + 101,32,97,32,109,111,100,117,108,101,32,98,97,115,101,100, + 32,111,110,32,116,104,101,32,112,114,111,118,105,100,101,100, + 32,115,112,101,99,46,78,218,13,99,114,101,97,116,101,95, + 109,111,100,117,108,101,218,11,101,120,101,99,95,109,111,100, + 117,108,101,122,66,108,111,97,100,101,114,115,32,116,104,97, + 116,32,100,101,102,105,110,101,32,101,120,101,99,95,109,111, + 100,117,108,101,40,41,32,109,117,115,116,32,97,108,115,111, + 32,100,101,102,105,110,101,32,99,114,101,97,116,101,95,109, + 111,100,117,108,101,40,41,41,7,114,11,0,0,0,114,116, + 0,0,0,114,156,0,0,0,114,83,0,0,0,114,21,0, + 0,0,114,20,0,0,0,114,155,0,0,0,169,2,114,103, + 0,0,0,114,104,0,0,0,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,218,16,109,111,100,117,108,101,95, + 102,114,111,109,95,115,112,101,99,62,2,0,0,115,20,0, + 0,0,4,3,12,1,14,3,12,1,8,1,8,2,10,1, + 10,1,4,1,255,128,114,159,0,0,0,99,1,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0, + 67,0,0,0,115,100,0,0,0,124,0,106,0,100,1,117, + 0,114,14,100,2,110,4,124,0,106,0,125,1,124,0,106, + 1,100,1,117,0,114,64,124,0,106,2,100,1,117,0,114, + 50,100,3,160,3,124,1,161,1,83,0,100,4,160,3,124, + 1,124,0,106,2,161,2,83,0,124,0,106,4,114,84,100, + 5,160,3,124,1,124,0,106,1,161,2,83,0,100,6,160, + 3,124,0,106,0,124,0,106,1,161,2,83,0,41,7,122, + 38,82,101,116,117,114,110,32,116,104,101,32,114,101,112,114, + 32,116,111,32,117,115,101,32,102,111,114,32,116,104,101,32, + 109,111,100,117,108,101,46,78,114,108,0,0,0,114,109,0, + 0,0,114,110,0,0,0,114,111,0,0,0,250,18,60,109, + 111,100,117,108,101,32,123,33,114,125,32,40,123,125,41,62, + 41,5,114,20,0,0,0,114,120,0,0,0,114,116,0,0, + 0,114,49,0,0,0,114,130,0,0,0,41,2,114,103,0, + 0,0,114,20,0,0,0,114,5,0,0,0,114,5,0,0, + 0,114,6,0,0,0,114,114,0,0,0,79,2,0,0,115, + 18,0,0,0,20,3,10,1,10,1,10,1,14,2,6,2, + 14,1,16,2,255,128,114,114,0,0,0,99,2,0,0,0, + 0,0,0,0,0,0,0,0,4,0,0,0,10,0,0,0, + 67,0,0,0,115,26,1,0,0,124,0,106,0,125,2,116, + 1,124,2,131,1,143,246,1,0,116,2,106,3,160,4,124, + 2,161,1,124,1,117,1,114,54,100,1,160,5,124,2,161, + 1,125,3,116,6,124,3,124,2,100,2,141,2,130,1,122, + 160,124,0,106,7,100,3,117,0,114,106,124,0,106,8,100, + 3,117,0,114,90,116,6,100,4,124,0,106,0,100,2,141, + 2,130,1,116,9,124,0,124,1,100,5,100,6,141,3,1, + 0,110,80,116,9,124,0,124,1,100,5,100,6,141,3,1, + 0,116,10,124,0,106,7,100,7,131,2,115,174,116,11,124, + 0,106,7,131,1,155,0,100,8,157,2,125,3,116,12,160, + 13,124,3,116,14,161,2,1,0,124,0,106,7,160,15,124, + 2,161,1,1,0,110,12,124,0,106,7,160,16,124,1,161, + 1,1,0,87,0,116,2,106,3,160,17,124,0,106,0,161, 1,125,1,124,1,116,2,106,3,124,0,106,0,60,0,110, - 28,116,2,106,3,160,13,124,0,106,0,161,1,125,1,124, + 28,116,2,106,3,160,17,124,0,106,0,161,1,125,1,124, 1,116,2,106,3,124,0,106,0,60,0,48,0,87,0,100, - 3,4,0,4,0,131,3,1,0,110,16,49,0,115,236,48, - 0,1,0,1,0,1,0,89,0,1,0,124,1,83,0,41, - 8,122,70,69,120,101,99,117,116,101,32,116,104,101,32,115, - 112,101,99,39,115,32,115,112,101,99,105,102,105,101,100,32, - 109,111,100,117,108,101,32,105,110,32,97,110,32,101,120,105, - 115,116,105,110,103,32,109,111,100,117,108,101,39,115,32,110, - 97,109,101,115,112,97,99,101,46,122,30,109,111,100,117,108, - 101,32,123,33,114,125,32,110,111,116,32,105,110,32,115,121, - 115,46,109,111,100,117,108,101,115,114,16,0,0,0,78,250, - 14,109,105,115,115,105,110,103,32,108,111,97,100,101,114,84, - 114,144,0,0,0,114,151,0,0,0,41,14,114,17,0,0, - 0,114,51,0,0,0,114,15,0,0,0,114,93,0,0,0, - 114,35,0,0,0,114,46,0,0,0,114,80,0,0,0,114, - 110,0,0,0,114,117,0,0,0,114,149,0,0,0,114,4, - 0,0,0,218,11,108,111,97,100,95,109,111,100,117,108,101, - 114,151,0,0,0,218,3,112,111,112,41,4,114,96,0,0, - 0,114,97,0,0,0,114,17,0,0,0,218,3,109,115,103, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, - 94,0,0,0,80,2,0,0,115,40,0,0,0,6,2,10, - 1,16,1,10,1,12,1,2,1,10,1,10,1,14,1,16, - 2,14,2,12,1,14,4,14,2,14,4,14,1,14,255,44, - 1,4,1,255,128,114,94,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,67, - 0,0,0,115,20,1,0,0,122,18,124,0,106,0,160,1, - 124,0,106,2,161,1,1,0,87,0,110,52,1,0,1,0, - 1,0,124,0,106,2,116,3,106,4,118,0,114,64,116,3, - 106,4,160,5,124,0,106,2,161,1,125,1,124,1,116,3, - 106,4,124,0,106,2,60,0,130,0,89,0,110,2,48,0, - 116,3,106,4,160,5,124,0,106,2,161,1,125,1,124,1, - 116,3,106,4,124,0,106,2,60,0,116,6,124,1,100,1, - 100,0,131,3,100,0,117,0,114,146,122,12,124,0,106,0, - 124,1,95,7,87,0,110,18,4,0,116,8,121,144,1,0, - 1,0,1,0,89,0,110,2,48,0,116,6,124,1,100,2, - 100,0,131,3,100,0,117,0,114,222,122,40,124,1,106,9, - 124,1,95,10,116,11,124,1,100,3,131,2,115,200,124,0, - 106,2,160,12,100,4,161,1,100,5,25,0,124,1,95,10, - 87,0,110,18,4,0,116,8,121,220,1,0,1,0,1,0, - 89,0,110,2,48,0,116,6,124,1,100,6,100,0,131,3, - 100,0,117,0,144,1,114,16,122,10,124,0,124,1,95,13, - 87,0,110,20,4,0,116,8,144,1,121,14,1,0,1,0, - 1,0,89,0,110,2,48,0,124,1,83,0,41,7,78,114, - 99,0,0,0,114,146,0,0,0,114,142,0,0,0,114,129, - 0,0,0,114,22,0,0,0,114,106,0,0,0,41,14,114, - 110,0,0,0,114,156,0,0,0,114,17,0,0,0,114,15, - 0,0,0,114,93,0,0,0,114,157,0,0,0,114,6,0, - 0,0,114,99,0,0,0,114,107,0,0,0,114,1,0,0, - 0,114,146,0,0,0,114,4,0,0,0,114,130,0,0,0, - 114,106,0,0,0,114,152,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,25,95,108,111,97,100, - 95,98,97,99,107,119,97,114,100,95,99,111,109,112,97,116, - 105,98,108,101,110,2,0,0,115,56,0,0,0,2,4,18, - 1,6,1,12,1,14,1,12,1,8,1,14,3,12,1,16, - 1,2,1,12,1,12,1,6,1,16,1,2,1,8,4,10, - 1,22,1,12,1,6,1,18,1,2,1,10,1,14,1,6, - 1,4,1,255,128,114,159,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,11,0,0,0,67, - 0,0,0,115,216,0,0,0,124,0,106,0,100,0,117,1, - 114,30,116,1,124,0,106,0,100,1,131,2,115,30,116,2, - 124,0,131,1,83,0,116,3,124,0,131,1,125,1,100,2, - 124,0,95,4,122,158,124,1,116,5,106,6,124,0,106,7, - 60,0,122,52,124,0,106,0,100,0,117,0,114,96,124,0, - 106,8,100,0,117,0,114,108,116,9,100,3,124,0,106,7, - 100,4,141,2,130,1,110,12,124,0,106,0,160,10,124,1, - 161,1,1,0,87,0,110,40,1,0,1,0,1,0,122,14, - 116,5,106,6,124,0,106,7,61,0,87,0,130,0,4,0, - 116,11,121,150,1,0,1,0,1,0,89,0,130,0,48,0, - 116,5,106,6,160,12,124,0,106,7,161,1,125,1,124,1, - 116,5,106,6,124,0,106,7,60,0,116,13,100,5,124,0, - 106,7,124,0,106,0,131,3,1,0,87,0,100,6,124,0, - 95,4,110,8,100,6,124,0,95,4,48,0,124,1,83,0, - 41,7,78,114,151,0,0,0,84,114,155,0,0,0,114,16, - 0,0,0,122,18,105,109,112,111,114,116,32,123,33,114,125, - 32,35,32,123,33,114,125,70,41,14,114,110,0,0,0,114, - 4,0,0,0,114,159,0,0,0,114,153,0,0,0,90,13, - 95,105,110,105,116,105,97,108,105,122,105,110,103,114,15,0, - 0,0,114,93,0,0,0,114,17,0,0,0,114,117,0,0, - 0,114,80,0,0,0,114,151,0,0,0,114,64,0,0,0, - 114,157,0,0,0,114,77,0,0,0,114,152,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,14, - 95,108,111,97,100,95,117,110,108,111,99,107,101,100,147,2, - 0,0,115,46,0,0,0,10,2,12,2,8,1,8,2,6, - 5,2,1,12,1,2,1,10,1,10,1,16,1,16,3,6, - 1,2,1,14,1,12,1,6,1,14,6,12,1,18,1,16, - 2,4,2,255,128,114,160,0,0,0,99,1,0,0,0,0, + 3,4,0,4,0,131,3,1,0,124,1,83,0,49,0,144, + 1,115,12,48,0,1,0,1,0,1,0,89,0,1,0,124, + 1,83,0,41,9,122,70,69,120,101,99,117,116,101,32,116, + 104,101,32,115,112,101,99,39,115,32,115,112,101,99,105,102, + 105,101,100,32,109,111,100,117,108,101,32,105,110,32,97,110, + 32,101,120,105,115,116,105,110,103,32,109,111,100,117,108,101, + 39,115,32,110,97,109,101,115,112,97,99,101,46,122,30,109, + 111,100,117,108,101,32,123,33,114,125,32,110,111,116,32,105, + 110,32,115,121,115,46,109,111,100,117,108,101,115,114,19,0, + 0,0,78,250,14,109,105,115,115,105,110,103,32,108,111,97, + 100,101,114,84,114,150,0,0,0,114,157,0,0,0,250,55, + 46,101,120,101,99,95,109,111,100,117,108,101,40,41,32,110, + 111,116,32,102,111,117,110,100,59,32,102,97,108,108,105,110, + 103,32,98,97,99,107,32,116,111,32,108,111,97,100,95,109, + 111,100,117,108,101,40,41,41,18,114,20,0,0,0,114,54, + 0,0,0,114,18,0,0,0,114,99,0,0,0,114,38,0, + 0,0,114,49,0,0,0,114,83,0,0,0,114,116,0,0, + 0,114,123,0,0,0,114,155,0,0,0,114,11,0,0,0, + 114,7,0,0,0,114,95,0,0,0,114,96,0,0,0,218, + 13,73,109,112,111,114,116,87,97,114,110,105,110,103,218,11, + 108,111,97,100,95,109,111,100,117,108,101,114,157,0,0,0, + 218,3,112,111,112,41,4,114,103,0,0,0,114,104,0,0, + 0,114,20,0,0,0,114,102,0,0,0,114,5,0,0,0, + 114,5,0,0,0,114,6,0,0,0,114,100,0,0,0,96, + 2,0,0,115,48,0,0,0,6,2,10,1,16,1,10,1, + 12,1,2,1,10,1,10,1,14,1,16,2,14,2,12,1, + 16,1,12,2,14,1,14,2,14,4,14,1,14,255,26,1, + 4,1,18,255,4,1,255,128,114,100,0,0,0,99,1,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,8,0, + 0,0,67,0,0,0,115,18,1,0,0,122,18,124,0,106, + 0,160,1,124,0,106,2,161,1,1,0,87,0,110,46,1, + 0,1,0,1,0,124,0,106,2,116,3,106,4,118,0,114, + 64,116,3,106,4,160,5,124,0,106,2,161,1,125,1,124, + 1,116,3,106,4,124,0,106,2,60,0,130,0,116,3,106, + 4,160,5,124,0,106,2,161,1,125,1,124,1,116,3,106, + 4,124,0,106,2,60,0,116,6,124,1,100,1,100,0,131, + 3,100,0,117,0,114,140,122,12,124,0,106,0,124,1,95, + 7,87,0,110,18,4,0,116,8,121,138,1,0,1,0,1, + 0,89,0,110,2,48,0,116,6,124,1,100,2,100,0,131, + 3,100,0,117,0,114,216,122,40,124,1,106,9,124,1,95, + 10,116,11,124,1,100,3,131,2,115,194,124,0,106,2,160, + 12,100,4,161,1,100,5,25,0,124,1,95,10,87,0,110, + 18,4,0,116,8,121,214,1,0,1,0,1,0,89,0,110, + 2,48,0,116,6,124,1,100,6,100,0,131,3,100,0,117, + 0,144,1,114,14,122,12,124,0,124,1,95,13,87,0,124, + 1,83,0,4,0,116,8,144,1,121,12,1,0,1,0,1, + 0,89,0,124,1,83,0,48,0,124,1,83,0,41,7,78, + 114,106,0,0,0,114,152,0,0,0,114,148,0,0,0,114, + 135,0,0,0,114,25,0,0,0,114,113,0,0,0,41,14, + 114,116,0,0,0,114,164,0,0,0,114,20,0,0,0,114, + 18,0,0,0,114,99,0,0,0,114,165,0,0,0,114,13, + 0,0,0,114,106,0,0,0,114,2,0,0,0,114,9,0, + 0,0,114,152,0,0,0,114,11,0,0,0,114,136,0,0, + 0,114,113,0,0,0,114,158,0,0,0,114,5,0,0,0, + 114,5,0,0,0,114,6,0,0,0,218,25,95,108,111,97, + 100,95,98,97,99,107,119,97,114,100,95,99,111,109,112,97, + 116,105,98,108,101,126,2,0,0,115,62,0,0,0,2,3, + 18,1,6,1,12,1,14,1,12,1,2,1,14,3,12,1, + 16,1,2,1,12,1,12,1,6,1,16,1,2,1,8,4, + 10,1,22,1,12,1,6,1,18,1,2,1,8,1,4,3, + 14,254,2,1,4,1,2,255,4,1,255,128,114,166,0,0, + 0,99,1,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,11,0,0,0,67,0,0,0,115,240,0,0,0,124, + 0,106,0,100,0,117,1,114,58,116,1,124,0,106,0,100, + 1,131,2,115,58,116,2,124,0,106,0,131,1,155,0,100, + 2,157,2,125,1,116,3,160,4,124,1,116,5,161,2,1, + 0,116,6,124,0,131,1,83,0,116,7,124,0,131,1,125, + 2,100,3,124,0,95,8,122,158,124,2,116,9,106,10,124, + 0,106,11,60,0,122,50,124,0,106,0,100,0,117,0,114, + 122,124,0,106,12,100,0,117,0,114,134,116,13,100,4,124, + 0,106,11,100,5,141,2,130,1,124,0,106,0,160,14,124, + 2,161,1,1,0,87,0,110,40,1,0,1,0,1,0,122, + 14,116,9,106,10,124,0,106,11,61,0,87,0,130,0,4, + 0,116,15,121,176,1,0,1,0,1,0,89,0,130,0,48, + 0,116,9,106,10,160,16,124,0,106,11,161,1,125,2,124, + 2,116,9,106,10,124,0,106,11,60,0,116,17,100,6,124, + 0,106,11,124,0,106,0,131,3,1,0,87,0,100,7,124, + 0,95,8,124,2,83,0,100,7,124,0,95,8,48,0,41, + 8,78,114,157,0,0,0,114,162,0,0,0,84,114,161,0, + 0,0,114,19,0,0,0,122,18,105,109,112,111,114,116,32, + 123,33,114,125,32,35,32,123,33,114,125,70,41,18,114,116, + 0,0,0,114,11,0,0,0,114,7,0,0,0,114,95,0, + 0,0,114,96,0,0,0,114,163,0,0,0,114,166,0,0, + 0,114,159,0,0,0,90,13,95,105,110,105,116,105,97,108, + 105,122,105,110,103,114,18,0,0,0,114,99,0,0,0,114, + 20,0,0,0,114,123,0,0,0,114,83,0,0,0,114,157, + 0,0,0,114,67,0,0,0,114,165,0,0,0,114,80,0, + 0,0,41,3,114,103,0,0,0,114,102,0,0,0,114,104, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,218,14,95,108,111,97,100,95,117,110,108,111,99,107, + 101,100,162,2,0,0,115,58,0,0,0,10,2,12,2,16, + 1,12,2,8,1,8,2,6,5,2,1,12,1,2,1,10, + 1,10,1,14,1,16,3,6,1,2,1,12,1,2,3,12, + 254,2,1,2,1,2,255,14,6,12,1,18,1,6,2,4, + 2,8,254,255,128,114,167,0,0,0,99,1,0,0,0,0, 0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,67, 0,0,0,115,54,0,0,0,116,0,124,0,106,1,131,1, 143,24,1,0,116,2,124,0,131,1,87,0,2,0,100,1, @@ -1033,109 +1065,108 @@ const unsigned char _Py_M__importlib_bootstrap[] = { 115,44,32,116,104,97,116,32,101,120,105,115,116,105,110,103, 32,109,111,100,117,108,101,32,103,101,116,115,10,32,32,32, 32,99,108,111,98,98,101,114,101,100,46,10,10,32,32,32, - 32,78,41,3,114,51,0,0,0,114,17,0,0,0,114,160, - 0,0,0,41,1,114,96,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,95,0,0,0,189,2, - 0,0,115,8,0,0,0,12,9,38,1,4,128,255,128,114, - 95,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,0,0,0,64,0,0,0,115,140,0, - 0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2, - 90,4,101,5,100,3,100,4,132,0,131,1,90,6,101,7, - 100,20,100,6,100,7,132,1,131,1,90,8,101,7,100,21, - 100,8,100,9,132,1,131,1,90,9,101,7,100,10,100,11, - 132,0,131,1,90,10,101,7,100,12,100,13,132,0,131,1, - 90,11,101,7,101,12,100,14,100,15,132,0,131,1,131,1, - 90,13,101,7,101,12,100,16,100,17,132,0,131,1,131,1, - 90,14,101,7,101,12,100,18,100,19,132,0,131,1,131,1, - 90,15,101,7,101,16,131,1,90,17,100,5,83,0,41,22, - 218,15,66,117,105,108,116,105,110,73,109,112,111,114,116,101, - 114,122,144,77,101,116,97,32,112,97,116,104,32,105,109,112, - 111,114,116,32,102,111,114,32,98,117,105,108,116,45,105,110, - 32,109,111,100,117,108,101,115,46,10,10,32,32,32,32,65, - 108,108,32,109,101,116,104,111,100,115,32,97,114,101,32,101, - 105,116,104,101,114,32,99,108,97,115,115,32,111,114,32,115, - 116,97,116,105,99,32,109,101,116,104,111,100,115,32,116,111, - 32,97,118,111,105,100,32,116,104,101,32,110,101,101,100,32, - 116,111,10,32,32,32,32,105,110,115,116,97,110,116,105,97, - 116,101,32,116,104,101,32,99,108,97,115,115,46,10,10,32, - 32,32,32,122,8,98,117,105,108,116,45,105,110,99,1,0, - 0,0,0,0,0,0,0,0,0,0,1,0,0,0,5,0, - 0,0,67,0,0,0,115,22,0,0,0,100,1,124,0,106, - 0,155,2,100,2,116,1,106,2,155,0,100,3,157,5,83, - 0,41,4,250,115,82,101,116,117,114,110,32,114,101,112,114, - 32,102,111,114,32,116,104,101,32,109,111,100,117,108,101,46, - 10,10,32,32,32,32,32,32,32,32,84,104,101,32,109,101, - 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,84,104,101,32,105,109,112,111,114,116,32, - 109,97,99,104,105,110,101,114,121,32,100,111,101,115,32,116, - 104,101,32,106,111,98,32,105,116,115,101,108,102,46,10,10, - 32,32,32,32,32,32,32,32,122,8,60,109,111,100,117,108, - 101,32,122,2,32,40,122,2,41,62,41,3,114,1,0,0, - 0,114,161,0,0,0,114,139,0,0,0,41,1,114,97,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,100,0,0,0,215,2,0,0,115,4,0,0,0,22, - 7,255,128,122,27,66,117,105,108,116,105,110,73,109,112,111, - 114,116,101,114,46,109,111,100,117,108,101,95,114,101,112,114, - 78,99,4,0,0,0,0,0,0,0,0,0,0,0,4,0, - 0,0,5,0,0,0,67,0,0,0,115,42,0,0,0,124, - 2,100,0,117,1,114,12,100,0,83,0,116,0,160,1,124, - 1,161,1,114,38,116,2,124,1,124,0,124,0,106,3,100, - 1,141,3,83,0,100,0,83,0,169,2,78,114,138,0,0, - 0,41,4,114,58,0,0,0,90,10,105,115,95,98,117,105, - 108,116,105,110,114,92,0,0,0,114,139,0,0,0,169,4, - 218,3,99,108,115,114,82,0,0,0,218,4,112,97,116,104, - 218,6,116,97,114,103,101,116,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,9,102,105,110,100,95,115,112, - 101,99,224,2,0,0,115,12,0,0,0,8,2,4,1,10, - 1,16,1,4,2,255,128,122,25,66,117,105,108,116,105,110, - 73,109,112,111,114,116,101,114,46,102,105,110,100,95,115,112, - 101,99,99,3,0,0,0,0,0,0,0,0,0,0,0,4, - 0,0,0,4,0,0,0,67,0,0,0,115,30,0,0,0, - 124,0,160,0,124,1,124,2,161,2,125,3,124,3,100,1, - 117,1,114,26,124,3,106,1,83,0,100,1,83,0,41,2, - 122,175,70,105,110,100,32,116,104,101,32,98,117,105,108,116, - 45,105,110,32,109,111,100,117,108,101,46,10,10,32,32,32, - 32,32,32,32,32,73,102,32,39,112,97,116,104,39,32,105, - 115,32,101,118,101,114,32,115,112,101,99,105,102,105,101,100, - 32,116,104,101,110,32,116,104,101,32,115,101,97,114,99,104, - 32,105,115,32,99,111,110,115,105,100,101,114,101,100,32,97, - 32,102,97,105,108,117,114,101,46,10,10,32,32,32,32,32, - 32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,105, - 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,85, - 115,101,32,102,105,110,100,95,115,112,101,99,40,41,32,105, - 110,115,116,101,97,100,46,10,10,32,32,32,32,32,32,32, - 32,78,41,2,114,168,0,0,0,114,110,0,0,0,41,4, - 114,165,0,0,0,114,82,0,0,0,114,166,0,0,0,114, - 96,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,11,102,105,110,100,95,109,111,100,117,108,101, - 233,2,0,0,115,6,0,0,0,12,9,18,1,255,128,122, - 27,66,117,105,108,116,105,110,73,109,112,111,114,116,101,114, - 46,102,105,110,100,95,109,111,100,117,108,101,99,2,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, - 0,67,0,0,0,115,46,0,0,0,124,1,106,0,116,1, - 106,2,118,1,114,34,116,3,100,1,160,4,124,1,106,0, - 161,1,124,1,106,0,100,2,141,2,130,1,116,5,116,6, - 106,7,124,1,131,2,83,0,41,3,122,24,67,114,101,97, - 116,101,32,97,32,98,117,105,108,116,45,105,110,32,109,111, - 100,117,108,101,114,78,0,0,0,114,16,0,0,0,41,8, - 114,17,0,0,0,114,15,0,0,0,114,79,0,0,0,114, - 80,0,0,0,114,46,0,0,0,114,68,0,0,0,114,58, + 32,78,41,3,114,54,0,0,0,114,20,0,0,0,114,167, + 0,0,0,169,1,114,103,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,114,101,0,0,0,207,2, + 0,0,115,6,0,0,0,12,9,42,1,255,128,114,101,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,4,0,0,0,64,0,0,0,115,140,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,90,4, + 101,5,100,3,100,4,132,0,131,1,90,6,101,7,100,20, + 100,6,100,7,132,1,131,1,90,8,101,7,100,21,100,8, + 100,9,132,1,131,1,90,9,101,5,100,10,100,11,132,0, + 131,1,90,10,101,5,100,12,100,13,132,0,131,1,90,11, + 101,7,101,12,100,14,100,15,132,0,131,1,131,1,90,13, + 101,7,101,12,100,16,100,17,132,0,131,1,131,1,90,14, + 101,7,101,12,100,18,100,19,132,0,131,1,131,1,90,15, + 101,7,101,16,131,1,90,17,100,5,83,0,41,22,218,15, + 66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,122, + 144,77,101,116,97,32,112,97,116,104,32,105,109,112,111,114, + 116,32,102,111,114,32,98,117,105,108,116,45,105,110,32,109, + 111,100,117,108,101,115,46,10,10,32,32,32,32,65,108,108, + 32,109,101,116,104,111,100,115,32,97,114,101,32,101,105,116, + 104,101,114,32,99,108,97,115,115,32,111,114,32,115,116,97, + 116,105,99,32,109,101,116,104,111,100,115,32,116,111,32,97, + 118,111,105,100,32,116,104,101,32,110,101,101,100,32,116,111, + 10,32,32,32,32,105,110,115,116,97,110,116,105,97,116,101, + 32,116,104,101,32,99,108,97,115,115,46,10,10,32,32,32, + 32,122,8,98,117,105,108,116,45,105,110,99,1,0,0,0, + 0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0, + 67,0,0,0,115,22,0,0,0,100,1,124,0,106,0,155, + 2,100,2,116,1,106,2,155,0,100,3,157,5,83,0,41, + 5,250,115,82,101,116,117,114,110,32,114,101,112,114,32,102, + 111,114,32,116,104,101,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,32,32,32,32,84,104,101,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,84,104,101,32,105,109,112,111,114,116,32,109,97, + 99,104,105,110,101,114,121,32,100,111,101,115,32,116,104,101, + 32,106,111,98,32,105,116,115,101,108,102,46,10,10,32,32, + 32,32,32,32,32,32,122,8,60,109,111,100,117,108,101,32, + 122,2,32,40,122,2,41,62,78,41,3,114,9,0,0,0, + 114,169,0,0,0,114,145,0,0,0,169,1,114,104,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,107,0,0,0,233,2,0,0,115,4,0,0,0,22,7, + 255,128,122,27,66,117,105,108,116,105,110,73,109,112,111,114, + 116,101,114,46,109,111,100,117,108,101,95,114,101,112,114,78, + 99,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,5,0,0,0,67,0,0,0,115,42,0,0,0,124,2, + 100,0,117,1,114,12,100,0,83,0,116,0,160,1,124,1, + 161,1,114,38,116,2,124,1,124,0,124,0,106,3,100,1, + 141,3,83,0,100,0,83,0,169,2,78,114,144,0,0,0, + 41,4,114,61,0,0,0,90,10,105,115,95,98,117,105,108, + 116,105,110,114,98,0,0,0,114,145,0,0,0,169,4,218, + 3,99,108,115,114,85,0,0,0,218,4,112,97,116,104,218, + 6,116,97,114,103,101,116,114,5,0,0,0,114,5,0,0, + 0,114,6,0,0,0,218,9,102,105,110,100,95,115,112,101, + 99,242,2,0,0,115,12,0,0,0,8,2,4,1,10,1, + 16,1,4,2,255,128,122,25,66,117,105,108,116,105,110,73, + 109,112,111,114,116,101,114,46,102,105,110,100,95,115,112,101, + 99,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,4,0,0,0,67,0,0,0,115,30,0,0,0,124, + 0,160,0,124,1,124,2,161,2,125,3,124,3,100,1,117, + 1,114,26,124,3,106,1,83,0,100,1,83,0,41,2,122, + 175,70,105,110,100,32,116,104,101,32,98,117,105,108,116,45, + 105,110,32,109,111,100,117,108,101,46,10,10,32,32,32,32, + 32,32,32,32,73,102,32,39,112,97,116,104,39,32,105,115, + 32,101,118,101,114,32,115,112,101,99,105,102,105,101,100,32, + 116,104,101,110,32,116,104,101,32,115,101,97,114,99,104,32, + 105,115,32,99,111,110,115,105,100,101,114,101,100,32,97,32, + 102,97,105,108,117,114,101,46,10,10,32,32,32,32,32,32, + 32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115, + 32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115, + 101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110, + 115,116,101,97,100,46,10,10,32,32,32,32,32,32,32,32, + 78,41,2,114,177,0,0,0,114,116,0,0,0,41,4,114, + 174,0,0,0,114,85,0,0,0,114,175,0,0,0,114,103, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,218,11,102,105,110,100,95,109,111,100,117,108,101,251, + 2,0,0,115,6,0,0,0,12,9,18,1,255,128,122,27, + 66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,46, + 102,105,110,100,95,109,111,100,117,108,101,99,1,0,0,0, + 0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0, + 67,0,0,0,115,46,0,0,0,124,0,106,0,116,1,106, + 2,118,1,114,34,116,3,100,1,160,4,124,0,106,0,161, + 1,124,0,106,0,100,2,141,2,130,1,116,5,116,6,106, + 7,124,0,131,2,83,0,41,4,122,24,67,114,101,97,116, + 101,32,97,32,98,117,105,108,116,45,105,110,32,109,111,100, + 117,108,101,114,81,0,0,0,114,19,0,0,0,78,41,8, + 114,20,0,0,0,114,18,0,0,0,114,82,0,0,0,114, + 83,0,0,0,114,49,0,0,0,114,71,0,0,0,114,61, 0,0,0,90,14,99,114,101,97,116,101,95,98,117,105,108, - 116,105,110,41,2,114,30,0,0,0,114,96,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,150, - 0,0,0,245,2,0,0,115,12,0,0,0,12,3,12,1, - 4,1,6,255,12,2,255,128,122,29,66,117,105,108,116,105, - 110,73,109,112,111,114,116,101,114,46,99,114,101,97,116,101, - 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,16,0,0,0,116,0,116,1,106,2,124,1,131,2,1, - 0,100,1,83,0,41,2,122,22,69,120,101,99,32,97,32, - 98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,78, - 41,3,114,68,0,0,0,114,58,0,0,0,90,12,101,120, - 101,99,95,98,117,105,108,116,105,110,41,2,114,30,0,0, - 0,114,97,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,151,0,0,0,253,2,0,0,115,6, - 0,0,0,12,3,4,128,255,128,122,27,66,117,105,108,116, + 116,105,110,114,168,0,0,0,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,114,156,0,0,0,7,3,0,0, + 115,12,0,0,0,12,3,12,1,4,1,6,255,12,2,255, + 128,122,29,66,117,105,108,116,105,110,73,109,112,111,114,116, + 101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,101, + 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,67,0,0,0,115,16,0,0,0,116,0, + 116,1,106,2,124,0,131,2,1,0,100,1,83,0,41,2, + 122,22,69,120,101,99,32,97,32,98,117,105,108,116,45,105, + 110,32,109,111,100,117,108,101,78,41,3,114,71,0,0,0, + 114,61,0,0,0,90,12,101,120,101,99,95,98,117,105,108, + 116,105,110,114,171,0,0,0,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,114,157,0,0,0,15,3,0,0, + 115,4,0,0,0,16,3,255,128,122,27,66,117,105,108,116, 105,110,73,109,112,111,114,116,101,114,46,101,120,101,99,95, 109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, @@ -1143,10 +1174,10 @@ const unsigned char _Py_M__importlib_bootstrap[] = { 114,110,32,78,111,110,101,32,97,115,32,98,117,105,108,116, 45,105,110,32,109,111,100,117,108,101,115,32,100,111,32,110, 111,116,32,104,97,118,101,32,99,111,100,101,32,111,98,106, - 101,99,116,115,46,78,114,10,0,0,0,169,2,114,165,0, - 0,0,114,82,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,8,103,101,116,95,99,111,100,101, - 2,3,0,0,115,4,0,0,0,4,4,255,128,122,24,66, + 101,99,116,115,46,78,114,5,0,0,0,169,2,114,174,0, + 0,0,114,85,0,0,0,114,5,0,0,0,114,5,0,0, + 0,114,6,0,0,0,218,8,103,101,116,95,99,111,100,101, + 20,3,0,0,115,4,0,0,0,4,4,255,128,122,24,66, 117,105,108,116,105,110,73,109,112,111,114,116,101,114,46,103, 101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, @@ -1154,670 +1185,670 @@ const unsigned char _Py_M__importlib_bootstrap[] = { 117,114,110,32,78,111,110,101,32,97,115,32,98,117,105,108, 116,45,105,110,32,109,111,100,117,108,101,115,32,100,111,32, 110,111,116,32,104,97,118,101,32,115,111,117,114,99,101,32, - 99,111,100,101,46,78,114,10,0,0,0,114,170,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, - 10,103,101,116,95,115,111,117,114,99,101,8,3,0,0,115, + 99,111,100,101,46,78,114,5,0,0,0,114,179,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218, + 10,103,101,116,95,115,111,117,114,99,101,26,3,0,0,115, 4,0,0,0,4,4,255,128,122,26,66,117,105,108,116,105, 110,73,109,112,111,114,116,101,114,46,103,101,116,95,115,111, 117,114,99,101,99,2,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, - 0,0,100,1,83,0,41,2,122,52,82,101,116,117,114,110, + 0,0,100,1,83,0,41,3,122,52,82,101,116,117,114,110, 32,70,97,108,115,101,32,97,115,32,98,117,105,108,116,45, 105,110,32,109,111,100,117,108,101,115,32,97,114,101,32,110, - 101,118,101,114,32,112,97,99,107,97,103,101,115,46,70,114, - 10,0,0,0,114,170,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,114,116,0,0,0,14,3,0, - 0,115,4,0,0,0,4,4,255,128,122,26,66,117,105,108, - 116,105,110,73,109,112,111,114,116,101,114,46,105,115,95,112, - 97,99,107,97,103,101,41,2,78,78,41,1,78,41,18,114, - 1,0,0,0,114,0,0,0,0,114,2,0,0,0,114,3, - 0,0,0,114,139,0,0,0,218,12,115,116,97,116,105,99, - 109,101,116,104,111,100,114,100,0,0,0,218,11,99,108,97, - 115,115,109,101,116,104,111,100,114,168,0,0,0,114,169,0, - 0,0,114,150,0,0,0,114,151,0,0,0,114,87,0,0, - 0,114,171,0,0,0,114,172,0,0,0,114,116,0,0,0, - 114,98,0,0,0,114,156,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,161, - 0,0,0,204,2,0,0,115,48,0,0,0,8,0,4,2, - 4,7,2,2,10,1,2,8,12,1,2,8,12,1,2,11, - 10,1,2,7,10,1,2,4,2,1,12,1,2,4,2,1, - 12,1,2,4,2,1,12,1,12,4,255,128,114,161,0,0, - 0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,4,0,0,0,64,0,0,0,115,144,0,0,0,101, - 0,90,1,100,0,90,2,100,1,90,3,100,2,90,4,101, - 5,100,3,100,4,132,0,131,1,90,6,101,7,100,22,100, - 6,100,7,132,1,131,1,90,8,101,7,100,23,100,8,100, - 9,132,1,131,1,90,9,101,7,100,10,100,11,132,0,131, - 1,90,10,101,5,100,12,100,13,132,0,131,1,90,11,101, - 7,100,14,100,15,132,0,131,1,90,12,101,7,101,13,100, - 16,100,17,132,0,131,1,131,1,90,14,101,7,101,13,100, - 18,100,19,132,0,131,1,131,1,90,15,101,7,101,13,100, - 20,100,21,132,0,131,1,131,1,90,16,100,5,83,0,41, - 24,218,14,70,114,111,122,101,110,73,109,112,111,114,116,101, - 114,122,142,77,101,116,97,32,112,97,116,104,32,105,109,112, - 111,114,116,32,102,111,114,32,102,114,111,122,101,110,32,109, - 111,100,117,108,101,115,46,10,10,32,32,32,32,65,108,108, - 32,109,101,116,104,111,100,115,32,97,114,101,32,101,105,116, - 104,101,114,32,99,108,97,115,115,32,111,114,32,115,116,97, - 116,105,99,32,109,101,116,104,111,100,115,32,116,111,32,97, - 118,111,105,100,32,116,104,101,32,110,101,101,100,32,116,111, - 10,32,32,32,32,105,110,115,116,97,110,116,105,97,116,101, - 32,116,104,101,32,99,108,97,115,115,46,10,10,32,32,32, - 32,90,6,102,114,111,122,101,110,99,1,0,0,0,0,0, - 0,0,0,0,0,0,1,0,0,0,4,0,0,0,67,0, - 0,0,115,16,0,0,0,100,1,160,0,124,0,106,1,116, - 2,106,3,161,2,83,0,41,2,114,162,0,0,0,114,154, - 0,0,0,41,4,114,46,0,0,0,114,1,0,0,0,114, - 175,0,0,0,114,139,0,0,0,41,1,218,1,109,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,100,0, - 0,0,34,3,0,0,115,4,0,0,0,16,7,255,128,122, - 26,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46, - 109,111,100,117,108,101,95,114,101,112,114,78,99,4,0,0, - 0,0,0,0,0,0,0,0,0,4,0,0,0,5,0,0, - 0,67,0,0,0,115,30,0,0,0,116,0,160,1,124,1, - 161,1,114,26,116,2,124,1,124,0,124,0,106,3,100,1, - 141,3,83,0,100,0,83,0,114,163,0,0,0,41,4,114, - 58,0,0,0,114,89,0,0,0,114,92,0,0,0,114,139, - 0,0,0,114,164,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,114,168,0,0,0,43,3,0,0, - 115,8,0,0,0,10,2,16,1,4,2,255,128,122,24,70, - 114,111,122,101,110,73,109,112,111,114,116,101,114,46,102,105, - 110,100,95,115,112,101,99,99,3,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, - 115,18,0,0,0,116,0,160,1,124,1,161,1,114,14,124, - 0,83,0,100,1,83,0,41,2,122,93,70,105,110,100,32, - 97,32,102,114,111,122,101,110,32,109,111,100,117,108,101,46, - 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, - 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, - 116,101,100,46,32,32,85,115,101,32,102,105,110,100,95,115, - 112,101,99,40,41,32,105,110,115,116,101,97,100,46,10,10, - 32,32,32,32,32,32,32,32,78,41,2,114,58,0,0,0, - 114,89,0,0,0,41,3,114,165,0,0,0,114,82,0,0, - 0,114,166,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,169,0,0,0,50,3,0,0,115,4, - 0,0,0,18,7,255,128,122,26,70,114,111,122,101,110,73, - 109,112,111,114,116,101,114,46,102,105,110,100,95,109,111,100, - 117,108,101,99,2,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, - 0,100,1,83,0,41,2,122,42,85,115,101,32,100,101,102, - 97,117,108,116,32,115,101,109,97,110,116,105,99,115,32,102, - 111,114,32,109,111,100,117,108,101,32,99,114,101,97,116,105, - 111,110,46,78,114,10,0,0,0,41,2,114,165,0,0,0, - 114,96,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,150,0,0,0,59,3,0,0,115,4,0, - 0,0,4,128,255,128,122,28,70,114,111,122,101,110,73,109, - 112,111,114,116,101,114,46,99,114,101,97,116,101,95,109,111, - 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,4,0,0,0,67,0,0,0,115,64,0, - 0,0,124,0,106,0,106,1,125,1,116,2,160,3,124,1, - 161,1,115,36,116,4,100,1,160,5,124,1,161,1,124,1, - 100,2,141,2,130,1,116,6,116,2,106,7,124,1,131,2, - 125,2,116,8,124,2,124,0,106,9,131,2,1,0,100,0, - 83,0,114,88,0,0,0,41,10,114,106,0,0,0,114,17, - 0,0,0,114,58,0,0,0,114,89,0,0,0,114,80,0, - 0,0,114,46,0,0,0,114,68,0,0,0,218,17,103,101, - 116,95,102,114,111,122,101,110,95,111,98,106,101,99,116,218, - 4,101,120,101,99,114,7,0,0,0,41,3,114,97,0,0, - 0,114,17,0,0,0,218,4,99,111,100,101,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,114,151,0,0,0, - 63,3,0,0,115,18,0,0,0,8,2,10,1,10,1,2, - 1,6,255,12,2,12,1,4,128,255,128,122,26,70,114,111, - 122,101,110,73,109,112,111,114,116,101,114,46,101,120,101,99, - 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,10,0,0,0,116,0,124,0,124,1,131,2,83,0,41, - 1,122,95,76,111,97,100,32,97,32,102,114,111,122,101,110, - 32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,32, - 32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115, - 101,32,101,120,101,99,95,109,111,100,117,108,101,40,41,32, - 105,110,115,116,101,97,100,46,10,10,32,32,32,32,32,32, - 32,32,41,1,114,98,0,0,0,114,170,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,156,0, - 0,0,72,3,0,0,115,4,0,0,0,10,7,255,128,122, - 26,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46, - 108,111,97,100,95,109,111,100,117,108,101,99,2,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, - 67,0,0,0,115,10,0,0,0,116,0,160,1,124,1,161, - 1,83,0,41,1,122,45,82,101,116,117,114,110,32,116,104, - 101,32,99,111,100,101,32,111,98,106,101,99,116,32,102,111, - 114,32,116,104,101,32,102,114,111,122,101,110,32,109,111,100, - 117,108,101,46,41,2,114,58,0,0,0,114,177,0,0,0, - 114,170,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,171,0,0,0,81,3,0,0,115,4,0, - 0,0,10,4,255,128,122,23,70,114,111,122,101,110,73,109, - 112,111,114,116,101,114,46,103,101,116,95,99,111,100,101,99, - 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,83, - 0,41,2,122,54,82,101,116,117,114,110,32,78,111,110,101, - 32,97,115,32,102,114,111,122,101,110,32,109,111,100,117,108, - 101,115,32,100,111,32,110,111,116,32,104,97,118,101,32,115, - 111,117,114,99,101,32,99,111,100,101,46,78,114,10,0,0, - 0,114,170,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,172,0,0,0,87,3,0,0,115,4, - 0,0,0,4,4,255,128,122,25,70,114,111,122,101,110,73, - 109,112,111,114,116,101,114,46,103,101,116,95,115,111,117,114, - 99,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,3,0,0,0,67,0,0,0,115,10,0,0,0, - 116,0,160,1,124,1,161,1,83,0,41,1,122,46,82,101, - 116,117,114,110,32,84,114,117,101,32,105,102,32,116,104,101, - 32,102,114,111,122,101,110,32,109,111,100,117,108,101,32,105, - 115,32,97,32,112,97,99,107,97,103,101,46,41,2,114,58, - 0,0,0,90,17,105,115,95,102,114,111,122,101,110,95,112, - 97,99,107,97,103,101,114,170,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,114,116,0,0,0,93, - 3,0,0,115,4,0,0,0,10,4,255,128,122,25,70,114, - 111,122,101,110,73,109,112,111,114,116,101,114,46,105,115,95, - 112,97,99,107,97,103,101,41,2,78,78,41,1,78,41,17, - 114,1,0,0,0,114,0,0,0,0,114,2,0,0,0,114, - 3,0,0,0,114,139,0,0,0,114,173,0,0,0,114,100, - 0,0,0,114,174,0,0,0,114,168,0,0,0,114,169,0, - 0,0,114,150,0,0,0,114,151,0,0,0,114,156,0,0, - 0,114,91,0,0,0,114,171,0,0,0,114,172,0,0,0, - 114,116,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,175,0,0,0,23,3, - 0,0,115,50,0,0,0,8,0,4,2,4,7,2,2,10, - 1,2,8,12,1,2,6,12,1,2,8,10,1,2,3,10, - 1,2,8,10,1,2,8,2,1,12,1,2,4,2,1,12, - 1,2,4,2,1,16,1,255,128,114,175,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,64,0,0,0,115,32,0,0,0,101,0,90,1, - 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, - 100,4,100,5,132,0,90,5,100,6,83,0,41,7,218,18, - 95,73,109,112,111,114,116,76,111,99,107,67,111,110,116,101, - 120,116,122,36,67,111,110,116,101,120,116,32,109,97,110,97, - 103,101,114,32,102,111,114,32,116,104,101,32,105,109,112,111, - 114,116,32,108,111,99,107,46,99,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,12,0,0,0,116,0,160,1,161,0,1,0,100,1, - 83,0,41,2,122,24,65,99,113,117,105,114,101,32,116,104, - 101,32,105,109,112,111,114,116,32,108,111,99,107,46,78,41, - 2,114,58,0,0,0,114,59,0,0,0,114,48,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, - 55,0,0,0,106,3,0,0,115,6,0,0,0,8,2,4, - 128,255,128,122,28,95,73,109,112,111,114,116,76,111,99,107, - 67,111,110,116,101,120,116,46,95,95,101,110,116,101,114,95, - 95,99,4,0,0,0,0,0,0,0,0,0,0,0,4,0, - 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, - 0,160,1,161,0,1,0,100,1,83,0,41,2,122,60,82, - 101,108,101,97,115,101,32,116,104,101,32,105,109,112,111,114, - 116,32,108,111,99,107,32,114,101,103,97,114,100,108,101,115, - 115,32,111,102,32,97,110,121,32,114,97,105,115,101,100,32, - 101,120,99,101,112,116,105,111,110,115,46,78,41,2,114,58, - 0,0,0,114,61,0,0,0,41,4,114,30,0,0,0,218, - 8,101,120,99,95,116,121,112,101,218,9,101,120,99,95,118, - 97,108,117,101,218,13,101,120,99,95,116,114,97,99,101,98, - 97,99,107,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,57,0,0,0,110,3,0,0,115,6,0,0,0, - 8,2,4,128,255,128,122,27,95,73,109,112,111,114,116,76, - 111,99,107,67,111,110,116,101,120,116,46,95,95,101,120,105, - 116,95,95,78,41,6,114,1,0,0,0,114,0,0,0,0, - 114,2,0,0,0,114,3,0,0,0,114,55,0,0,0,114, - 57,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,114,180,0,0,0,102,3,0, - 0,115,10,0,0,0,8,0,4,2,8,2,12,4,255,128, - 114,180,0,0,0,99,3,0,0,0,0,0,0,0,0,0, - 0,0,5,0,0,0,5,0,0,0,67,0,0,0,115,64, - 0,0,0,124,1,160,0,100,1,124,2,100,2,24,0,161, - 2,125,3,116,1,124,3,131,1,124,2,107,0,114,36,116, - 2,100,3,131,1,130,1,124,3,100,4,25,0,125,4,124, - 0,114,60,100,5,160,3,124,4,124,0,161,2,83,0,124, - 4,83,0,41,6,122,50,82,101,115,111,108,118,101,32,97, - 32,114,101,108,97,116,105,118,101,32,109,111,100,117,108,101, - 32,110,97,109,101,32,116,111,32,97,110,32,97,98,115,111, - 108,117,116,101,32,111,110,101,46,114,129,0,0,0,114,39, - 0,0,0,122,50,97,116,116,101,109,112,116,101,100,32,114, - 101,108,97,116,105,118,101,32,105,109,112,111,114,116,32,98, - 101,121,111,110,100,32,116,111,112,45,108,101,118,101,108,32, - 112,97,99,107,97,103,101,114,22,0,0,0,250,5,123,125, - 46,123,125,41,4,218,6,114,115,112,108,105,116,218,3,108, - 101,110,114,80,0,0,0,114,46,0,0,0,41,5,114,17, - 0,0,0,218,7,112,97,99,107,97,103,101,218,5,108,101, - 118,101,108,90,4,98,105,116,115,90,4,98,97,115,101,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,13, - 95,114,101,115,111,108,118,101,95,110,97,109,101,115,3,0, - 0,115,12,0,0,0,16,2,12,1,8,1,8,1,20,1, - 255,128,114,189,0,0,0,99,3,0,0,0,0,0,0,0, - 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, - 115,34,0,0,0,124,0,160,0,124,1,124,2,161,2,125, - 3,124,3,100,0,117,0,114,24,100,0,83,0,116,1,124, - 1,124,3,131,2,83,0,114,13,0,0,0,41,2,114,169, - 0,0,0,114,92,0,0,0,41,4,218,6,102,105,110,100, - 101,114,114,17,0,0,0,114,166,0,0,0,114,110,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 218,17,95,102,105,110,100,95,115,112,101,99,95,108,101,103, - 97,99,121,124,3,0,0,115,10,0,0,0,12,3,8,1, - 4,1,10,1,255,128,114,191,0,0,0,99,3,0,0,0, - 0,0,0,0,0,0,0,0,10,0,0,0,10,0,0,0, - 67,0,0,0,115,28,1,0,0,116,0,106,1,125,3,124, - 3,100,1,117,0,114,22,116,2,100,2,131,1,130,1,124, - 3,115,38,116,3,160,4,100,3,116,5,161,2,1,0,124, - 0,116,0,106,6,118,0,125,4,124,3,68,0,93,226,125, - 5,116,7,131,0,143,94,1,0,122,10,124,5,106,8,125, - 6,87,0,110,54,4,0,116,9,121,128,1,0,1,0,1, - 0,116,10,124,5,124,0,124,1,131,3,125,7,124,7,100, - 1,117,0,114,124,89,0,87,0,100,1,4,0,4,0,131, - 3,1,0,113,52,89,0,110,14,48,0,124,6,124,0,124, - 1,124,2,131,3,125,7,87,0,100,1,4,0,4,0,131, - 3,1,0,110,16,49,0,115,162,48,0,1,0,1,0,1, - 0,89,0,1,0,124,7,100,1,117,1,114,52,124,4,144, - 1,115,16,124,0,116,0,106,6,118,0,144,1,114,16,116, - 0,106,6,124,0,25,0,125,8,122,10,124,8,106,11,125, - 9,87,0,110,26,4,0,116,9,121,244,1,0,1,0,1, - 0,124,7,6,0,89,0,2,0,1,0,83,0,48,0,124, - 9,100,1,117,0,144,1,114,8,124,7,2,0,1,0,83, - 0,124,9,2,0,1,0,83,0,124,7,2,0,1,0,83, - 0,100,1,83,0,41,4,122,21,70,105,110,100,32,97,32, - 109,111,100,117,108,101,39,115,32,115,112,101,99,46,78,122, - 53,115,121,115,46,109,101,116,97,95,112,97,116,104,32,105, - 115,32,78,111,110,101,44,32,80,121,116,104,111,110,32,105, - 115,32,108,105,107,101,108,121,32,115,104,117,116,116,105,110, - 103,32,100,111,119,110,122,22,115,121,115,46,109,101,116,97, - 95,112,97,116,104,32,105,115,32,101,109,112,116,121,41,12, - 114,15,0,0,0,218,9,109,101,116,97,95,112,97,116,104, - 114,80,0,0,0,218,9,95,119,97,114,110,105,110,103,115, - 218,4,119,97,114,110,218,13,73,109,112,111,114,116,87,97, - 114,110,105,110,103,114,93,0,0,0,114,180,0,0,0,114, - 168,0,0,0,114,107,0,0,0,114,191,0,0,0,114,106, - 0,0,0,41,10,114,17,0,0,0,114,166,0,0,0,114, - 167,0,0,0,114,192,0,0,0,90,9,105,115,95,114,101, - 108,111,97,100,114,190,0,0,0,114,168,0,0,0,114,96, - 0,0,0,114,97,0,0,0,114,106,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,10,95,102, - 105,110,100,95,115,112,101,99,133,3,0,0,115,56,0,0, - 0,6,2,8,1,8,2,4,3,12,1,10,5,8,1,8, - 1,2,1,10,1,12,1,12,1,8,1,22,1,42,2,8, - 1,18,2,10,1,2,1,10,1,12,1,14,4,10,2,8, - 1,8,2,8,2,4,2,255,128,114,196,0,0,0,99,3, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,5, - 0,0,0,67,0,0,0,115,108,0,0,0,116,0,124,0, - 116,1,131,2,115,28,116,2,100,1,160,3,116,4,124,0, - 131,1,161,1,131,1,130,1,124,2,100,2,107,0,114,44, - 116,5,100,3,131,1,130,1,124,2,100,2,107,4,114,84, - 116,0,124,1,116,1,131,2,115,72,116,2,100,4,131,1, - 130,1,110,12,124,1,115,84,116,6,100,5,131,1,130,1, - 124,0,115,104,124,2,100,2,107,2,114,104,116,5,100,6, - 131,1,130,1,100,7,83,0,41,8,122,28,86,101,114,105, - 102,121,32,97,114,103,117,109,101,110,116,115,32,97,114,101, - 32,34,115,97,110,101,34,46,122,31,109,111,100,117,108,101, - 32,110,97,109,101,32,109,117,115,116,32,98,101,32,115,116, - 114,44,32,110,111,116,32,123,125,114,22,0,0,0,122,18, - 108,101,118,101,108,32,109,117,115,116,32,98,101,32,62,61, - 32,48,122,31,95,95,112,97,99,107,97,103,101,95,95,32, - 110,111,116,32,115,101,116,32,116,111,32,97,32,115,116,114, - 105,110,103,122,54,97,116,116,101,109,112,116,101,100,32,114, - 101,108,97,116,105,118,101,32,105,109,112,111,114,116,32,119, - 105,116,104,32,110,111,32,107,110,111,119,110,32,112,97,114, - 101,110,116,32,112,97,99,107,97,103,101,122,17,69,109,112, - 116,121,32,109,111,100,117,108,101,32,110,97,109,101,78,41, - 7,218,10,105,115,105,110,115,116,97,110,99,101,218,3,115, - 116,114,218,9,84,121,112,101,69,114,114,111,114,114,46,0, - 0,0,114,14,0,0,0,218,10,86,97,108,117,101,69,114, - 114,111,114,114,80,0,0,0,169,3,114,17,0,0,0,114, - 187,0,0,0,114,188,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,218,13,95,115,97,110,105,116, - 121,95,99,104,101,99,107,180,3,0,0,115,26,0,0,0, - 10,2,18,1,8,1,8,1,8,1,10,1,10,1,4,1, - 8,1,12,2,8,1,4,128,255,128,114,202,0,0,0,122, - 16,78,111,32,109,111,100,117,108,101,32,110,97,109,101,100, - 32,122,4,123,33,114,125,99,2,0,0,0,0,0,0,0, - 0,0,0,0,9,0,0,0,8,0,0,0,67,0,0,0, - 115,22,1,0,0,100,0,125,2,124,0,160,0,100,1,161, - 1,100,2,25,0,125,3,124,3,114,132,124,3,116,1,106, - 2,118,1,114,42,116,3,124,1,124,3,131,2,1,0,124, - 0,116,1,106,2,118,0,114,62,116,1,106,2,124,0,25, - 0,83,0,116,1,106,2,124,3,25,0,125,4,122,10,124, - 4,106,4,125,2,87,0,110,48,4,0,116,5,121,130,1, - 0,1,0,1,0,116,6,100,3,23,0,160,7,124,0,124, - 3,161,2,125,5,116,8,124,5,124,0,100,4,141,2,100, - 0,130,2,89,0,110,2,48,0,116,9,124,0,124,2,131, - 2,125,6,124,6,100,0,117,0,114,170,116,8,116,6,160, - 7,124,0,161,1,124,0,100,4,141,2,130,1,110,8,116, - 10,124,6,131,1,125,7,124,3,144,1,114,18,116,1,106, - 2,124,3,25,0,125,4,124,0,160,0,100,1,161,1,100, - 5,25,0,125,8,122,16,116,11,124,4,124,8,124,7,131, - 3,1,0,87,0,110,48,4,0,116,5,144,1,121,16,1, - 0,1,0,1,0,100,6,124,3,155,2,100,7,124,8,155, - 2,157,4,125,5,116,12,160,13,124,5,116,14,161,2,1, - 0,89,0,110,2,48,0,124,7,83,0,41,8,78,114,129, - 0,0,0,114,22,0,0,0,122,23,59,32,123,33,114,125, - 32,105,115,32,110,111,116,32,97,32,112,97,99,107,97,103, - 101,114,16,0,0,0,233,2,0,0,0,122,27,67,97,110, - 110,111,116,32,115,101,116,32,97,110,32,97,116,116,114,105, - 98,117,116,101,32,111,110,32,122,18,32,102,111,114,32,99, - 104,105,108,100,32,109,111,100,117,108,101,32,41,15,114,130, - 0,0,0,114,15,0,0,0,114,93,0,0,0,114,68,0, - 0,0,114,142,0,0,0,114,107,0,0,0,218,8,95,69, - 82,82,95,77,83,71,114,46,0,0,0,218,19,77,111,100, - 117,108,101,78,111,116,70,111,117,110,100,69,114,114,111,114, - 114,196,0,0,0,114,160,0,0,0,114,5,0,0,0,114, - 193,0,0,0,114,194,0,0,0,114,195,0,0,0,41,9, - 114,17,0,0,0,218,7,105,109,112,111,114,116,95,114,166, - 0,0,0,114,131,0,0,0,90,13,112,97,114,101,110,116, - 95,109,111,100,117,108,101,114,158,0,0,0,114,96,0,0, - 0,114,97,0,0,0,90,5,99,104,105,108,100,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,23,95,102, - 105,110,100,95,97,110,100,95,108,111,97,100,95,117,110,108, - 111,99,107,101,100,199,3,0,0,115,54,0,0,0,4,1, - 14,1,4,1,10,1,10,1,10,2,10,1,10,1,2,1, - 10,1,12,1,16,1,20,1,10,1,8,1,20,1,8,2, - 6,1,10,2,14,1,2,1,16,1,14,1,16,1,18,1, - 4,1,255,128,114,207,0,0,0,99,2,0,0,0,0,0, - 0,0,0,0,0,0,4,0,0,0,8,0,0,0,67,0, - 0,0,115,128,0,0,0,116,0,124,0,131,1,143,62,1, - 0,116,1,106,2,160,3,124,0,116,4,161,2,125,2,124, - 2,116,4,117,0,114,56,116,5,124,0,124,1,131,2,87, - 0,2,0,100,1,4,0,4,0,131,3,1,0,83,0,87, - 0,100,1,4,0,4,0,131,3,1,0,110,16,49,0,115, - 76,48,0,1,0,1,0,1,0,89,0,1,0,124,2,100, - 1,117,0,114,116,100,2,160,6,124,0,161,1,125,3,116, - 7,124,3,124,0,100,3,141,2,130,1,116,8,124,0,131, - 1,1,0,124,2,83,0,41,4,122,25,70,105,110,100,32, - 97,110,100,32,108,111,97,100,32,116,104,101,32,109,111,100, - 117,108,101,46,78,122,40,105,109,112,111,114,116,32,111,102, - 32,123,125,32,104,97,108,116,101,100,59,32,78,111,110,101, - 32,105,110,32,115,121,115,46,109,111,100,117,108,101,115,114, - 16,0,0,0,41,9,114,51,0,0,0,114,15,0,0,0, - 114,93,0,0,0,114,35,0,0,0,218,14,95,78,69,69, - 68,83,95,76,79,65,68,73,78,71,114,207,0,0,0,114, - 46,0,0,0,114,205,0,0,0,114,66,0,0,0,41,4, - 114,17,0,0,0,114,206,0,0,0,114,97,0,0,0,114, - 76,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,14,95,102,105,110,100,95,97,110,100,95,108, - 111,97,100,234,3,0,0,115,24,0,0,0,10,2,14,1, - 8,1,54,1,8,2,4,1,2,1,4,255,12,2,8,2, - 4,1,255,128,114,209,0,0,0,114,22,0,0,0,99,3, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4, - 0,0,0,67,0,0,0,115,42,0,0,0,116,0,124,0, - 124,1,124,2,131,3,1,0,124,2,100,1,107,4,114,32, - 116,1,124,0,124,1,124,2,131,3,125,0,116,2,124,0, - 116,3,131,2,83,0,41,2,97,50,1,0,0,73,109,112, - 111,114,116,32,97,110,100,32,114,101,116,117,114,110,32,116, - 104,101,32,109,111,100,117,108,101,32,98,97,115,101,100,32, - 111,110,32,105,116,115,32,110,97,109,101,44,32,116,104,101, - 32,112,97,99,107,97,103,101,32,116,104,101,32,99,97,108, - 108,32,105,115,10,32,32,32,32,98,101,105,110,103,32,109, - 97,100,101,32,102,114,111,109,44,32,97,110,100,32,116,104, - 101,32,108,101,118,101,108,32,97,100,106,117,115,116,109,101, - 110,116,46,10,10,32,32,32,32,84,104,105,115,32,102,117, - 110,99,116,105,111,110,32,114,101,112,114,101,115,101,110,116, - 115,32,116,104,101,32,103,114,101,97,116,101,115,116,32,99, - 111,109,109,111,110,32,100,101,110,111,109,105,110,97,116,111, - 114,32,111,102,32,102,117,110,99,116,105,111,110,97,108,105, - 116,121,10,32,32,32,32,98,101,116,119,101,101,110,32,105, - 109,112,111,114,116,95,109,111,100,117,108,101,32,97,110,100, - 32,95,95,105,109,112,111,114,116,95,95,46,32,84,104,105, - 115,32,105,110,99,108,117,100,101,115,32,115,101,116,116,105, - 110,103,32,95,95,112,97,99,107,97,103,101,95,95,32,105, - 102,10,32,32,32,32,116,104,101,32,108,111,97,100,101,114, - 32,100,105,100,32,110,111,116,46,10,10,32,32,32,32,114, - 22,0,0,0,41,4,114,202,0,0,0,114,189,0,0,0, - 114,209,0,0,0,218,11,95,103,99,100,95,105,109,112,111, - 114,116,114,201,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,210,0,0,0,250,3,0,0,115, - 10,0,0,0,12,9,8,1,12,1,10,1,255,128,114,210, - 0,0,0,169,1,218,9,114,101,99,117,114,115,105,118,101, - 99,3,0,0,0,0,0,0,0,1,0,0,0,8,0,0, - 0,11,0,0,0,67,0,0,0,115,232,0,0,0,124,1, - 68,0,93,222,125,4,116,0,124,4,116,1,131,2,115,66, - 124,3,114,34,124,0,106,2,100,1,23,0,125,5,110,4, - 100,2,125,5,116,3,100,3,124,5,155,0,100,4,116,4, - 124,4,131,1,106,2,155,0,157,4,131,1,130,1,113,4, - 124,4,100,5,107,2,114,108,124,3,115,226,116,5,124,0, - 100,6,131,2,114,226,116,6,124,0,124,0,106,7,124,2, - 100,7,100,8,141,4,1,0,113,4,116,5,124,0,124,4, - 131,2,115,4,100,9,160,8,124,0,106,2,124,4,161,2, - 125,6,122,14,116,9,124,2,124,6,131,2,1,0,87,0, - 113,4,4,0,116,10,121,224,1,0,125,7,1,0,122,54, - 124,7,106,11,124,6,107,2,114,202,116,12,106,13,160,14, - 124,6,116,15,161,2,100,10,117,1,114,202,87,0,89,0, - 100,10,125,7,126,7,113,4,130,0,87,0,89,0,100,10, - 125,7,126,7,113,4,100,10,125,7,126,7,48,0,48,0, - 113,4,124,0,83,0,41,11,122,238,70,105,103,117,114,101, - 32,111,117,116,32,119,104,97,116,32,95,95,105,109,112,111, - 114,116,95,95,32,115,104,111,117,108,100,32,114,101,116,117, - 114,110,46,10,10,32,32,32,32,84,104,101,32,105,109,112, - 111,114,116,95,32,112,97,114,97,109,101,116,101,114,32,105, - 115,32,97,32,99,97,108,108,97,98,108,101,32,119,104,105, - 99,104,32,116,97,107,101,115,32,116,104,101,32,110,97,109, - 101,32,111,102,32,109,111,100,117,108,101,32,116,111,10,32, - 32,32,32,105,109,112,111,114,116,46,32,73,116,32,105,115, - 32,114,101,113,117,105,114,101,100,32,116,111,32,100,101,99, - 111,117,112,108,101,32,116,104,101,32,102,117,110,99,116,105, - 111,110,32,102,114,111,109,32,97,115,115,117,109,105,110,103, - 32,105,109,112,111,114,116,108,105,98,39,115,10,32,32,32, - 32,105,109,112,111,114,116,32,105,109,112,108,101,109,101,110, - 116,97,116,105,111,110,32,105,115,32,100,101,115,105,114,101, - 100,46,10,10,32,32,32,32,122,8,46,95,95,97,108,108, - 95,95,122,13,96,96,102,114,111,109,32,108,105,115,116,39, - 39,122,8,73,116,101,109,32,105,110,32,122,18,32,109,117, - 115,116,32,98,101,32,115,116,114,44,32,110,111,116,32,250, - 1,42,218,7,95,95,97,108,108,95,95,84,114,211,0,0, - 0,114,184,0,0,0,78,41,16,114,197,0,0,0,114,198, - 0,0,0,114,1,0,0,0,114,199,0,0,0,114,14,0, - 0,0,114,4,0,0,0,218,16,95,104,97,110,100,108,101, - 95,102,114,111,109,108,105,115,116,114,214,0,0,0,114,46, - 0,0,0,114,68,0,0,0,114,205,0,0,0,114,17,0, - 0,0,114,15,0,0,0,114,93,0,0,0,114,35,0,0, - 0,114,208,0,0,0,41,8,114,97,0,0,0,218,8,102, - 114,111,109,108,105,115,116,114,206,0,0,0,114,212,0,0, - 0,218,1,120,90,5,119,104,101,114,101,90,9,102,114,111, - 109,95,110,97,109,101,90,3,101,120,99,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,114,215,0,0,0,9, - 4,0,0,115,52,0,0,0,8,10,10,1,4,1,12,1, - 4,2,10,1,8,1,10,255,8,2,14,1,10,1,2,1, - 8,255,10,2,14,1,2,1,14,1,14,1,10,4,16,1, - 2,255,12,2,6,1,20,128,4,1,255,128,114,215,0,0, - 0,99,1,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,6,0,0,0,67,0,0,0,115,146,0,0,0,124, - 0,160,0,100,1,161,1,125,1,124,0,160,0,100,2,161, - 1,125,2,124,1,100,3,117,1,114,82,124,2,100,3,117, - 1,114,78,124,1,124,2,106,1,107,3,114,78,116,2,106, - 3,100,4,124,1,155,2,100,5,124,2,106,1,155,2,100, - 6,157,5,116,4,100,7,100,8,141,3,1,0,124,1,83, - 0,124,2,100,3,117,1,114,96,124,2,106,1,83,0,116, - 2,106,3,100,9,116,4,100,7,100,8,141,3,1,0,124, - 0,100,10,25,0,125,1,100,11,124,0,118,1,114,142,124, - 1,160,5,100,12,161,1,100,13,25,0,125,1,124,1,83, - 0,41,14,122,167,67,97,108,99,117,108,97,116,101,32,119, - 104,97,116,32,95,95,112,97,99,107,97,103,101,95,95,32, - 115,104,111,117,108,100,32,98,101,46,10,10,32,32,32,32, - 95,95,112,97,99,107,97,103,101,95,95,32,105,115,32,110, - 111,116,32,103,117,97,114,97,110,116,101,101,100,32,116,111, - 32,98,101,32,100,101,102,105,110,101,100,32,111,114,32,99, - 111,117,108,100,32,98,101,32,115,101,116,32,116,111,32,78, - 111,110,101,10,32,32,32,32,116,111,32,114,101,112,114,101, - 115,101,110,116,32,116,104,97,116,32,105,116,115,32,112,114, - 111,112,101,114,32,118,97,108,117,101,32,105,115,32,117,110, - 107,110,111,119,110,46,10,10,32,32,32,32,114,146,0,0, - 0,114,106,0,0,0,78,122,32,95,95,112,97,99,107,97, - 103,101,95,95,32,33,61,32,95,95,115,112,101,99,95,95, - 46,112,97,114,101,110,116,32,40,122,4,32,33,61,32,250, - 1,41,233,3,0,0,0,41,1,90,10,115,116,97,99,107, - 108,101,118,101,108,122,89,99,97,110,39,116,32,114,101,115, - 111,108,118,101,32,112,97,99,107,97,103,101,32,102,114,111, - 109,32,95,95,115,112,101,99,95,95,32,111,114,32,95,95, - 112,97,99,107,97,103,101,95,95,44,32,102,97,108,108,105, - 110,103,32,98,97,99,107,32,111,110,32,95,95,110,97,109, - 101,95,95,32,97,110,100,32,95,95,112,97,116,104,95,95, - 114,1,0,0,0,114,142,0,0,0,114,129,0,0,0,114, - 22,0,0,0,41,6,114,35,0,0,0,114,131,0,0,0, - 114,193,0,0,0,114,194,0,0,0,114,195,0,0,0,114, - 130,0,0,0,41,3,218,7,103,108,111,98,97,108,115,114, - 187,0,0,0,114,96,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,218,17,95,99,97,108,99,95, - 95,95,112,97,99,107,97,103,101,95,95,46,4,0,0,115, - 44,0,0,0,10,7,10,1,8,1,18,1,6,1,2,1, - 4,255,4,1,6,255,4,2,6,254,4,3,8,1,6,1, - 6,2,4,2,6,254,8,3,8,1,14,1,4,1,255,128, - 114,221,0,0,0,114,10,0,0,0,99,5,0,0,0,0, - 0,0,0,0,0,0,0,9,0,0,0,5,0,0,0,67, - 0,0,0,115,174,0,0,0,124,4,100,1,107,2,114,18, - 116,0,124,0,131,1,125,5,110,36,124,1,100,2,117,1, - 114,30,124,1,110,2,105,0,125,6,116,1,124,6,131,1, - 125,7,116,0,124,0,124,7,124,4,131,3,125,5,124,3, - 115,148,124,4,100,1,107,2,114,84,116,0,124,0,160,2, - 100,3,161,1,100,1,25,0,131,1,83,0,124,0,115,92, - 124,5,83,0,116,3,124,0,131,1,116,3,124,0,160,2, - 100,3,161,1,100,1,25,0,131,1,24,0,125,8,116,4, - 106,5,124,5,106,6,100,2,116,3,124,5,106,6,131,1, - 124,8,24,0,133,2,25,0,25,0,83,0,116,7,124,5, - 100,4,131,2,114,170,116,8,124,5,124,3,116,0,131,3, - 83,0,124,5,83,0,41,5,97,215,1,0,0,73,109,112, - 111,114,116,32,97,32,109,111,100,117,108,101,46,10,10,32, - 32,32,32,84,104,101,32,39,103,108,111,98,97,108,115,39, - 32,97,114,103,117,109,101,110,116,32,105,115,32,117,115,101, - 100,32,116,111,32,105,110,102,101,114,32,119,104,101,114,101, - 32,116,104,101,32,105,109,112,111,114,116,32,105,115,32,111, - 99,99,117,114,114,105,110,103,32,102,114,111,109,10,32,32, - 32,32,116,111,32,104,97,110,100,108,101,32,114,101,108,97, - 116,105,118,101,32,105,109,112,111,114,116,115,46,32,84,104, - 101,32,39,108,111,99,97,108,115,39,32,97,114,103,117,109, - 101,110,116,32,105,115,32,105,103,110,111,114,101,100,46,32, - 84,104,101,10,32,32,32,32,39,102,114,111,109,108,105,115, - 116,39,32,97,114,103,117,109,101,110,116,32,115,112,101,99, - 105,102,105,101,115,32,119,104,97,116,32,115,104,111,117,108, - 100,32,101,120,105,115,116,32,97,115,32,97,116,116,114,105, - 98,117,116,101,115,32,111,110,32,116,104,101,32,109,111,100, - 117,108,101,10,32,32,32,32,98,101,105,110,103,32,105,109, - 112,111,114,116,101,100,32,40,101,46,103,46,32,96,96,102, - 114,111,109,32,109,111,100,117,108,101,32,105,109,112,111,114, - 116,32,60,102,114,111,109,108,105,115,116,62,96,96,41,46, - 32,32,84,104,101,32,39,108,101,118,101,108,39,10,32,32, - 32,32,97,114,103,117,109,101,110,116,32,114,101,112,114,101, - 115,101,110,116,115,32,116,104,101,32,112,97,99,107,97,103, - 101,32,108,111,99,97,116,105,111,110,32,116,111,32,105,109, - 112,111,114,116,32,102,114,111,109,32,105,110,32,97,32,114, - 101,108,97,116,105,118,101,10,32,32,32,32,105,109,112,111, - 114,116,32,40,101,46,103,46,32,96,96,102,114,111,109,32, - 46,46,112,107,103,32,105,109,112,111,114,116,32,109,111,100, - 96,96,32,119,111,117,108,100,32,104,97,118,101,32,97,32, - 39,108,101,118,101,108,39,32,111,102,32,50,41,46,10,10, - 32,32,32,32,114,22,0,0,0,78,114,129,0,0,0,114, - 142,0,0,0,41,9,114,210,0,0,0,114,221,0,0,0, - 218,9,112,97,114,116,105,116,105,111,110,114,186,0,0,0, - 114,15,0,0,0,114,93,0,0,0,114,1,0,0,0,114, - 4,0,0,0,114,215,0,0,0,41,9,114,17,0,0,0, - 114,220,0,0,0,218,6,108,111,99,97,108,115,114,216,0, - 0,0,114,188,0,0,0,114,97,0,0,0,90,8,103,108, - 111,98,97,108,115,95,114,187,0,0,0,90,7,99,117,116, - 95,111,102,102,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,10,95,95,105,109,112,111,114,116,95,95,73, - 4,0,0,115,32,0,0,0,8,11,10,1,16,2,8,1, - 12,1,4,1,8,3,18,1,4,1,4,1,26,4,30,3, - 10,1,12,1,4,2,255,128,114,224,0,0,0,99,1,0, + 101,118,101,114,32,112,97,99,107,97,103,101,115,46,70,78, + 114,5,0,0,0,114,179,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,114,122,0,0,0,32,3, + 0,0,115,4,0,0,0,4,4,255,128,122,26,66,117,105, + 108,116,105,110,73,109,112,111,114,116,101,114,46,105,115,95, + 112,97,99,107,97,103,101,41,2,78,78,41,1,78,41,18, + 114,9,0,0,0,114,8,0,0,0,114,1,0,0,0,114, + 10,0,0,0,114,145,0,0,0,218,12,115,116,97,116,105, + 99,109,101,116,104,111,100,114,107,0,0,0,218,11,99,108, + 97,115,115,109,101,116,104,111,100,114,177,0,0,0,114,178, + 0,0,0,114,156,0,0,0,114,157,0,0,0,114,90,0, + 0,0,114,180,0,0,0,114,181,0,0,0,114,122,0,0, + 0,114,105,0,0,0,114,164,0,0,0,114,5,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 169,0,0,0,222,2,0,0,115,48,0,0,0,8,0,4, + 2,4,7,2,2,10,1,2,8,12,1,2,8,12,1,2, + 11,10,1,2,7,10,1,2,4,2,1,12,1,2,4,2, + 1,12,1,2,4,2,1,12,1,12,4,255,128,114,169,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,4,0,0,0,64,0,0,0,115,144,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,90,4, + 101,5,100,3,100,4,132,0,131,1,90,6,101,7,100,22, + 100,6,100,7,132,1,131,1,90,8,101,7,100,23,100,8, + 100,9,132,1,131,1,90,9,101,5,100,10,100,11,132,0, + 131,1,90,10,101,5,100,12,100,13,132,0,131,1,90,11, + 101,7,100,14,100,15,132,0,131,1,90,12,101,7,101,13, + 100,16,100,17,132,0,131,1,131,1,90,14,101,7,101,13, + 100,18,100,19,132,0,131,1,131,1,90,15,101,7,101,13, + 100,20,100,21,132,0,131,1,131,1,90,16,100,5,83,0, + 41,24,218,14,70,114,111,122,101,110,73,109,112,111,114,116, + 101,114,122,142,77,101,116,97,32,112,97,116,104,32,105,109, + 112,111,114,116,32,102,111,114,32,102,114,111,122,101,110,32, + 109,111,100,117,108,101,115,46,10,10,32,32,32,32,65,108, + 108,32,109,101,116,104,111,100,115,32,97,114,101,32,101,105, + 116,104,101,114,32,99,108,97,115,115,32,111,114,32,115,116, + 97,116,105,99,32,109,101,116,104,111,100,115,32,116,111,32, + 97,118,111,105,100,32,116,104,101,32,110,101,101,100,32,116, + 111,10,32,32,32,32,105,110,115,116,97,110,116,105,97,116, + 101,32,116,104,101,32,99,108,97,115,115,46,10,10,32,32, + 32,32,90,6,102,114,111,122,101,110,99,1,0,0,0,0, + 0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,67, + 0,0,0,115,16,0,0,0,100,1,160,0,124,0,106,1, + 116,2,106,3,161,2,83,0,41,3,114,170,0,0,0,114, + 160,0,0,0,78,41,4,114,49,0,0,0,114,9,0,0, + 0,114,184,0,0,0,114,145,0,0,0,41,1,218,1,109, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 107,0,0,0,52,3,0,0,115,4,0,0,0,16,7,255, + 128,122,26,70,114,111,122,101,110,73,109,112,111,114,116,101, + 114,46,109,111,100,117,108,101,95,114,101,112,114,78,99,4, + 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,5, + 0,0,0,67,0,0,0,115,30,0,0,0,116,0,160,1, + 124,1,161,1,114,26,116,2,124,1,124,0,124,0,106,3, + 100,1,141,3,83,0,100,0,83,0,114,172,0,0,0,41, + 4,114,61,0,0,0,114,92,0,0,0,114,98,0,0,0, + 114,145,0,0,0,114,173,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,114,177,0,0,0,61,3, + 0,0,115,8,0,0,0,10,2,16,1,4,2,255,128,122, + 24,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46, + 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,18,0,0,0,116,0,160,1,124,1,161,1,114, + 14,124,0,83,0,100,1,83,0,41,2,122,93,70,105,110, + 100,32,97,32,102,114,111,122,101,110,32,109,111,100,117,108, + 101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115, + 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101, + 99,97,116,101,100,46,32,32,85,115,101,32,102,105,110,100, + 95,115,112,101,99,40,41,32,105,110,115,116,101,97,100,46, + 10,10,32,32,32,32,32,32,32,32,78,41,2,114,61,0, + 0,0,114,92,0,0,0,41,3,114,174,0,0,0,114,85, + 0,0,0,114,175,0,0,0,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,114,178,0,0,0,68,3,0,0, + 115,4,0,0,0,18,7,255,128,122,26,70,114,111,122,101, + 110,73,109,112,111,114,116,101,114,46,102,105,110,100,95,109, + 111,100,117,108,101,99,1,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,122,42,85,115,101,32,100, + 101,102,97,117,108,116,32,115,101,109,97,110,116,105,99,115, + 32,102,111,114,32,109,111,100,117,108,101,32,99,114,101,97, + 116,105,111,110,46,78,114,5,0,0,0,114,168,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 156,0,0,0,77,3,0,0,115,4,0,0,0,4,0,255, + 128,122,28,70,114,111,122,101,110,73,109,112,111,114,116,101, + 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, + 1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 4,0,0,0,67,0,0,0,115,64,0,0,0,124,0,106, + 0,106,1,125,1,116,2,160,3,124,1,161,1,115,36,116, + 4,100,1,160,5,124,1,161,1,124,1,100,2,141,2,130, + 1,116,6,116,2,106,7,124,1,131,2,125,2,116,8,124, + 2,124,0,106,9,131,2,1,0,100,0,83,0,114,91,0, + 0,0,41,10,114,113,0,0,0,114,20,0,0,0,114,61, + 0,0,0,114,92,0,0,0,114,83,0,0,0,114,49,0, + 0,0,114,71,0,0,0,218,17,103,101,116,95,102,114,111, + 122,101,110,95,111,98,106,101,99,116,218,4,101,120,101,99, + 114,14,0,0,0,41,3,114,104,0,0,0,114,20,0,0, + 0,218,4,99,111,100,101,114,5,0,0,0,114,5,0,0, + 0,114,6,0,0,0,114,157,0,0,0,81,3,0,0,115, + 16,0,0,0,8,2,10,1,10,1,2,1,6,255,12,2, + 16,1,255,128,122,26,70,114,111,122,101,110,73,109,112,111, + 114,116,101,114,46,101,120,101,99,95,109,111,100,117,108,101, + 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,3,0,0,0,67,0,0,0,115,10,0,0,0,116,0, + 124,0,124,1,131,2,83,0,41,2,122,95,76,111,97,100, + 32,97,32,102,114,111,122,101,110,32,109,111,100,117,108,101, + 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, + 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, + 97,116,101,100,46,32,32,85,115,101,32,101,120,101,99,95, + 109,111,100,117,108,101,40,41,32,105,110,115,116,101,97,100, + 46,10,10,32,32,32,32,32,32,32,32,78,41,1,114,105, + 0,0,0,114,179,0,0,0,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,114,164,0,0,0,90,3,0,0, + 115,4,0,0,0,10,8,255,128,122,26,70,114,111,122,101, + 110,73,109,112,111,114,116,101,114,46,108,111,97,100,95,109, + 111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,10, + 0,0,0,116,0,160,1,124,1,161,1,83,0,41,2,122, + 45,82,101,116,117,114,110,32,116,104,101,32,99,111,100,101, + 32,111,98,106,101,99,116,32,102,111,114,32,116,104,101,32, + 102,114,111,122,101,110,32,109,111,100,117,108,101,46,78,41, + 2,114,61,0,0,0,114,186,0,0,0,114,179,0,0,0, + 114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114, + 180,0,0,0,100,3,0,0,115,4,0,0,0,10,4,255, + 128,122,23,70,114,111,122,101,110,73,109,112,111,114,116,101, + 114,46,103,101,116,95,99,111,100,101,99,2,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67, + 0,0,0,115,4,0,0,0,100,1,83,0,41,2,122,54, + 82,101,116,117,114,110,32,78,111,110,101,32,97,115,32,102, + 114,111,122,101,110,32,109,111,100,117,108,101,115,32,100,111, + 32,110,111,116,32,104,97,118,101,32,115,111,117,114,99,101, + 32,99,111,100,101,46,78,114,5,0,0,0,114,179,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,181,0,0,0,106,3,0,0,115,4,0,0,0,4,4, + 255,128,122,25,70,114,111,122,101,110,73,109,112,111,114,116, + 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,67,0,0,0,115,38,0,0,0,116,0,160,1,124, - 0,161,1,125,1,124,1,100,0,117,0,114,30,116,2,100, - 1,124,0,23,0,131,1,130,1,116,3,124,1,131,1,83, - 0,41,2,78,122,25,110,111,32,98,117,105,108,116,45,105, - 110,32,109,111,100,117,108,101,32,110,97,109,101,100,32,41, - 4,114,161,0,0,0,114,168,0,0,0,114,80,0,0,0, - 114,160,0,0,0,41,2,114,17,0,0,0,114,96,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 218,18,95,98,117,105,108,116,105,110,95,102,114,111,109,95, - 110,97,109,101,110,4,0,0,115,10,0,0,0,10,1,8, - 1,12,1,8,1,255,128,114,225,0,0,0,99,2,0,0, - 0,0,0,0,0,0,0,0,0,10,0,0,0,5,0,0, - 0,67,0,0,0,115,166,0,0,0,124,1,97,0,124,0, - 97,1,116,2,116,1,131,1,125,2,116,1,106,3,160,4, - 161,0,68,0,93,72,92,2,125,3,125,4,116,5,124,4, - 124,2,131,2,114,26,124,3,116,1,106,6,118,0,114,60, - 116,7,125,5,110,18,116,0,160,8,124,3,161,1,114,26, - 116,9,125,5,110,2,113,26,116,10,124,4,124,5,131,2, - 125,6,116,11,124,6,124,4,131,2,1,0,113,26,116,1, - 106,3,116,12,25,0,125,7,100,1,68,0,93,46,125,8, - 124,8,116,1,106,3,118,1,114,138,116,13,124,8,131,1, - 125,9,110,10,116,1,106,3,124,8,25,0,125,9,116,14, - 124,7,124,8,124,9,131,3,1,0,113,114,100,2,83,0, - 41,3,122,250,83,101,116,117,112,32,105,109,112,111,114,116, - 108,105,98,32,98,121,32,105,109,112,111,114,116,105,110,103, - 32,110,101,101,100,101,100,32,98,117,105,108,116,45,105,110, - 32,109,111,100,117,108,101,115,32,97,110,100,32,105,110,106, - 101,99,116,105,110,103,32,116,104,101,109,10,32,32,32,32, - 105,110,116,111,32,116,104,101,32,103,108,111,98,97,108,32, - 110,97,109,101,115,112,97,99,101,46,10,10,32,32,32,32, - 65,115,32,115,121,115,32,105,115,32,110,101,101,100,101,100, - 32,102,111,114,32,115,121,115,46,109,111,100,117,108,101,115, - 32,97,99,99,101,115,115,32,97,110,100,32,95,105,109,112, - 32,105,115,32,110,101,101,100,101,100,32,116,111,32,108,111, - 97,100,32,98,117,105,108,116,45,105,110,10,32,32,32,32, - 109,111,100,117,108,101,115,44,32,116,104,111,115,101,32,116, - 119,111,32,109,111,100,117,108,101,115,32,109,117,115,116,32, - 98,101,32,101,120,112,108,105,99,105,116,108,121,32,112,97, - 115,115,101,100,32,105,110,46,10,10,32,32,32,32,41,3, - 114,23,0,0,0,114,193,0,0,0,114,65,0,0,0,78, - 41,15,114,58,0,0,0,114,15,0,0,0,114,14,0,0, - 0,114,93,0,0,0,218,5,105,116,101,109,115,114,197,0, - 0,0,114,79,0,0,0,114,161,0,0,0,114,89,0,0, - 0,114,175,0,0,0,114,143,0,0,0,114,149,0,0,0, - 114,1,0,0,0,114,225,0,0,0,114,5,0,0,0,41, - 10,218,10,115,121,115,95,109,111,100,117,108,101,218,11,95, - 105,109,112,95,109,111,100,117,108,101,90,11,109,111,100,117, - 108,101,95,116,121,112,101,114,17,0,0,0,114,97,0,0, - 0,114,110,0,0,0,114,96,0,0,0,90,11,115,101,108, - 102,95,109,111,100,117,108,101,90,12,98,117,105,108,116,105, - 110,95,110,97,109,101,90,14,98,117,105,108,116,105,110,95, - 109,111,100,117,108,101,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,218,6,95,115,101,116,117,112,117,4,0, - 0,115,40,0,0,0,4,9,4,1,8,3,18,1,10,1, - 10,1,6,1,10,1,6,1,2,2,10,1,12,1,10,3, - 8,1,10,1,10,1,10,2,14,1,4,128,255,128,114,229, - 0,0,0,99,2,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,3,0,0,0,67,0,0,0,115,38,0,0, - 0,116,0,124,0,124,1,131,2,1,0,116,1,106,2,160, - 3,116,4,161,1,1,0,116,1,106,2,160,3,116,5,161, - 1,1,0,100,1,83,0,41,2,122,48,73,110,115,116,97, - 108,108,32,105,109,112,111,114,116,101,114,115,32,102,111,114, - 32,98,117,105,108,116,105,110,32,97,110,100,32,102,114,111, - 122,101,110,32,109,111,100,117,108,101,115,78,41,6,114,229, - 0,0,0,114,15,0,0,0,114,192,0,0,0,114,120,0, - 0,0,114,161,0,0,0,114,175,0,0,0,41,2,114,227, - 0,0,0,114,228,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,8,95,105,110,115,116,97,108, - 108,152,4,0,0,115,10,0,0,0,10,2,12,2,12,1, - 4,128,255,128,114,230,0,0,0,99,0,0,0,0,0,0, - 0,0,0,0,0,0,1,0,0,0,4,0,0,0,67,0, - 0,0,115,32,0,0,0,100,1,100,2,108,0,125,0,124, - 0,97,1,124,0,160,2,116,3,106,4,116,5,25,0,161, - 1,1,0,100,2,83,0,41,3,122,57,73,110,115,116,97, - 108,108,32,105,109,112,111,114,116,101,114,115,32,116,104,97, - 116,32,114,101,113,117,105,114,101,32,101,120,116,101,114,110, - 97,108,32,102,105,108,101,115,121,115,116,101,109,32,97,99, - 99,101,115,115,114,22,0,0,0,78,41,6,218,26,95,102, - 114,111,122,101,110,95,105,109,112,111,114,116,108,105,98,95, - 101,120,116,101,114,110,97,108,114,127,0,0,0,114,230,0, - 0,0,114,15,0,0,0,114,93,0,0,0,114,1,0,0, - 0,41,1,114,231,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,27,95,105,110,115,116,97,108, - 108,95,101,120,116,101,114,110,97,108,95,105,109,112,111,114, - 116,101,114,115,160,4,0,0,115,10,0,0,0,8,3,4, - 1,16,1,4,128,255,128,114,232,0,0,0,41,2,78,78, - 41,1,78,41,2,78,114,22,0,0,0,41,4,78,78,114, - 10,0,0,0,114,22,0,0,0,41,50,114,3,0,0,0, - 114,127,0,0,0,114,12,0,0,0,114,18,0,0,0,114, - 60,0,0,0,114,34,0,0,0,114,44,0,0,0,114,19, - 0,0,0,114,20,0,0,0,114,50,0,0,0,114,51,0, - 0,0,114,54,0,0,0,114,66,0,0,0,114,68,0,0, - 0,114,77,0,0,0,114,87,0,0,0,114,91,0,0,0, - 114,98,0,0,0,114,112,0,0,0,114,113,0,0,0,114, - 92,0,0,0,114,143,0,0,0,114,149,0,0,0,114,153, - 0,0,0,114,108,0,0,0,114,94,0,0,0,114,159,0, - 0,0,114,160,0,0,0,114,95,0,0,0,114,161,0,0, - 0,114,175,0,0,0,114,180,0,0,0,114,189,0,0,0, - 114,191,0,0,0,114,196,0,0,0,114,202,0,0,0,90, - 15,95,69,82,82,95,77,83,71,95,80,82,69,70,73,88, - 114,204,0,0,0,114,207,0,0,0,218,6,111,98,106,101, - 99,116,114,208,0,0,0,114,209,0,0,0,114,210,0,0, - 0,114,215,0,0,0,114,221,0,0,0,114,224,0,0,0, - 114,225,0,0,0,114,229,0,0,0,114,230,0,0,0,114, - 232,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,218,8,60,109,111,100,117,108, - 101,62,1,0,0,0,115,100,0,0,0,4,0,4,24,8, - 2,8,8,4,8,4,2,16,3,14,4,14,77,14,21,8, - 16,8,37,8,17,14,11,8,8,8,11,8,12,8,16,14, - 36,16,101,10,26,14,45,8,72,8,17,8,17,8,30,8, - 37,8,42,14,15,14,75,14,79,8,13,8,9,10,9,8, - 47,4,16,8,1,8,2,6,32,8,3,10,16,14,15,8, - 37,10,27,8,37,8,7,8,35,8,8,4,128,255,128, + 0,0,67,0,0,0,115,10,0,0,0,116,0,160,1,124, + 1,161,1,83,0,41,2,122,46,82,101,116,117,114,110,32, + 84,114,117,101,32,105,102,32,116,104,101,32,102,114,111,122, + 101,110,32,109,111,100,117,108,101,32,105,115,32,97,32,112, + 97,99,107,97,103,101,46,78,41,2,114,61,0,0,0,90, + 17,105,115,95,102,114,111,122,101,110,95,112,97,99,107,97, + 103,101,114,179,0,0,0,114,5,0,0,0,114,5,0,0, + 0,114,6,0,0,0,114,122,0,0,0,112,3,0,0,115, + 4,0,0,0,10,4,255,128,122,25,70,114,111,122,101,110, + 73,109,112,111,114,116,101,114,46,105,115,95,112,97,99,107, + 97,103,101,41,2,78,78,41,1,78,41,17,114,9,0,0, + 0,114,8,0,0,0,114,1,0,0,0,114,10,0,0,0, + 114,145,0,0,0,114,182,0,0,0,114,107,0,0,0,114, + 183,0,0,0,114,177,0,0,0,114,178,0,0,0,114,156, + 0,0,0,114,157,0,0,0,114,164,0,0,0,114,94,0, + 0,0,114,180,0,0,0,114,181,0,0,0,114,122,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,114,184,0,0,0,41,3,0,0,115,50, + 0,0,0,8,0,4,2,4,7,2,2,10,1,2,8,12, + 1,2,6,12,1,2,8,10,1,2,3,10,1,2,8,10, + 1,2,9,2,1,12,1,2,4,2,1,12,1,2,4,2, + 1,16,1,255,128,114,184,0,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, + 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, + 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, + 132,0,90,5,100,6,83,0,41,7,218,18,95,73,109,112, + 111,114,116,76,111,99,107,67,111,110,116,101,120,116,122,36, + 67,111,110,116,101,120,116,32,109,97,110,97,103,101,114,32, + 102,111,114,32,116,104,101,32,105,109,112,111,114,116,32,108, + 111,99,107,46,99,1,0,0,0,0,0,0,0,0,0,0, + 0,1,0,0,0,2,0,0,0,67,0,0,0,115,12,0, + 0,0,116,0,160,1,161,0,1,0,100,1,83,0,41,2, + 122,24,65,99,113,117,105,114,101,32,116,104,101,32,105,109, + 112,111,114,116,32,108,111,99,107,46,78,41,2,114,61,0, + 0,0,114,62,0,0,0,114,51,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,6,0,0,0,114,58,0,0,0, + 125,3,0,0,115,4,0,0,0,12,2,255,128,122,28,95, + 73,109,112,111,114,116,76,111,99,107,67,111,110,116,101,120, + 116,46,95,95,101,110,116,101,114,95,95,99,4,0,0,0, + 0,0,0,0,0,0,0,0,4,0,0,0,2,0,0,0, + 67,0,0,0,115,12,0,0,0,116,0,160,1,161,0,1, + 0,100,1,83,0,41,2,122,60,82,101,108,101,97,115,101, + 32,116,104,101,32,105,109,112,111,114,116,32,108,111,99,107, + 32,114,101,103,97,114,100,108,101,115,115,32,111,102,32,97, + 110,121,32,114,97,105,115,101,100,32,101,120,99,101,112,116, + 105,111,110,115,46,78,41,2,114,61,0,0,0,114,64,0, + 0,0,41,4,114,33,0,0,0,218,8,101,120,99,95,116, + 121,112,101,218,9,101,120,99,95,118,97,108,117,101,218,13, + 101,120,99,95,116,114,97,99,101,98,97,99,107,114,5,0, + 0,0,114,5,0,0,0,114,6,0,0,0,114,60,0,0, + 0,129,3,0,0,115,4,0,0,0,12,2,255,128,122,27, + 95,73,109,112,111,114,116,76,111,99,107,67,111,110,116,101, + 120,116,46,95,95,101,120,105,116,95,95,78,41,6,114,9, + 0,0,0,114,8,0,0,0,114,1,0,0,0,114,10,0, + 0,0,114,58,0,0,0,114,60,0,0,0,114,5,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0, + 114,189,0,0,0,121,3,0,0,115,10,0,0,0,8,0, + 4,2,8,2,12,4,255,128,114,189,0,0,0,99,3,0, + 0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,0, + 0,0,67,0,0,0,115,64,0,0,0,124,1,160,0,100, + 1,124,2,100,2,24,0,161,2,125,3,116,1,124,3,131, + 1,124,2,107,0,114,36,116,2,100,3,131,1,130,1,124, + 3,100,4,25,0,125,4,124,0,114,60,100,5,160,3,124, + 4,124,0,161,2,83,0,124,4,83,0,41,7,122,50,82, + 101,115,111,108,118,101,32,97,32,114,101,108,97,116,105,118, + 101,32,109,111,100,117,108,101,32,110,97,109,101,32,116,111, + 32,97,110,32,97,98,115,111,108,117,116,101,32,111,110,101, + 46,114,135,0,0,0,114,42,0,0,0,122,50,97,116,116, + 101,109,112,116,101,100,32,114,101,108,97,116,105,118,101,32, + 105,109,112,111,114,116,32,98,101,121,111,110,100,32,116,111, + 112,45,108,101,118,101,108,32,112,97,99,107,97,103,101,114, + 25,0,0,0,250,5,123,125,46,123,125,78,41,4,218,6, + 114,115,112,108,105,116,218,3,108,101,110,114,83,0,0,0, + 114,49,0,0,0,41,5,114,20,0,0,0,218,7,112,97, + 99,107,97,103,101,218,5,108,101,118,101,108,90,4,98,105, + 116,115,90,4,98,97,115,101,114,5,0,0,0,114,5,0, + 0,0,114,6,0,0,0,218,13,95,114,101,115,111,108,118, + 101,95,110,97,109,101,134,3,0,0,115,12,0,0,0,16, + 2,12,1,8,1,8,1,20,1,255,128,114,198,0,0,0, + 99,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,4,0,0,0,67,0,0,0,115,34,0,0,0,124,0, + 160,0,124,1,124,2,161,2,125,3,124,3,100,0,117,0, + 114,24,100,0,83,0,116,1,124,1,124,3,131,2,83,0, + 114,0,0,0,0,41,2,114,178,0,0,0,114,98,0,0, + 0,41,4,218,6,102,105,110,100,101,114,114,20,0,0,0, + 114,175,0,0,0,114,116,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,218,17,95,102,105,110,100, + 95,115,112,101,99,95,108,101,103,97,99,121,143,3,0,0, + 115,10,0,0,0,12,3,8,1,4,1,10,1,255,128,114, + 200,0,0,0,99,3,0,0,0,0,0,0,0,0,0,0, + 0,10,0,0,0,10,0,0,0,67,0,0,0,115,28,1, + 0,0,116,0,106,1,125,3,124,3,100,1,117,0,114,22, + 116,2,100,2,131,1,130,1,124,3,115,38,116,3,160,4, + 100,3,116,5,161,2,1,0,124,0,116,0,106,6,118,0, + 125,4,124,3,68,0,93,226,125,5,116,7,131,0,143,94, + 1,0,122,10,124,5,106,8,125,6,87,0,110,54,4,0, + 116,9,121,128,1,0,1,0,1,0,116,10,124,5,124,0, + 124,1,131,3,125,7,124,7,100,1,117,0,114,124,89,0, + 87,0,100,1,4,0,4,0,131,3,1,0,113,52,89,0, + 110,14,48,0,124,6,124,0,124,1,124,2,131,3,125,7, + 87,0,100,1,4,0,4,0,131,3,1,0,110,16,49,0, + 115,162,48,0,1,0,1,0,1,0,89,0,1,0,124,7, + 100,1,117,1,114,52,124,4,144,1,115,16,124,0,116,0, + 106,6,118,0,144,1,114,16,116,0,106,6,124,0,25,0, + 125,8,122,10,124,8,106,11,125,9,87,0,110,26,4,0, + 116,9,121,244,1,0,1,0,1,0,124,7,6,0,89,0, + 2,0,1,0,83,0,48,0,124,9,100,1,117,0,144,1, + 114,8,124,7,2,0,1,0,83,0,124,9,2,0,1,0, + 83,0,124,7,2,0,1,0,83,0,100,1,83,0,41,4, + 122,21,70,105,110,100,32,97,32,109,111,100,117,108,101,39, + 115,32,115,112,101,99,46,78,122,53,115,121,115,46,109,101, + 116,97,95,112,97,116,104,32,105,115,32,78,111,110,101,44, + 32,80,121,116,104,111,110,32,105,115,32,108,105,107,101,108, + 121,32,115,104,117,116,116,105,110,103,32,100,111,119,110,122, + 22,115,121,115,46,109,101,116,97,95,112,97,116,104,32,105, + 115,32,101,109,112,116,121,41,12,114,18,0,0,0,218,9, + 109,101,116,97,95,112,97,116,104,114,83,0,0,0,114,95, + 0,0,0,114,96,0,0,0,114,163,0,0,0,114,99,0, + 0,0,114,189,0,0,0,114,177,0,0,0,114,2,0,0, + 0,114,200,0,0,0,114,113,0,0,0,41,10,114,20,0, + 0,0,114,175,0,0,0,114,176,0,0,0,114,201,0,0, + 0,90,9,105,115,95,114,101,108,111,97,100,114,199,0,0, + 0,114,177,0,0,0,114,103,0,0,0,114,104,0,0,0, + 114,113,0,0,0,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,218,10,95,102,105,110,100,95,115,112,101,99, + 152,3,0,0,115,56,0,0,0,6,2,8,1,8,2,4, + 3,12,1,10,5,8,1,8,1,2,1,10,1,12,1,12, + 1,8,1,22,1,42,2,8,1,18,2,10,1,2,1,10, + 1,12,1,14,4,10,2,8,1,8,2,8,2,4,2,255, + 128,114,202,0,0,0,99,3,0,0,0,0,0,0,0,0, + 0,0,0,3,0,0,0,5,0,0,0,67,0,0,0,115, + 110,0,0,0,116,0,124,0,116,1,131,2,115,28,116,2, + 100,1,160,3,116,4,124,0,131,1,161,1,131,1,130,1, + 124,2,100,2,107,0,114,44,116,5,100,3,131,1,130,1, + 124,2,100,2,107,4,114,82,116,0,124,1,116,1,131,2, + 115,70,116,2,100,4,131,1,130,1,124,1,115,82,116,6, + 100,5,131,1,130,1,124,0,115,106,124,2,100,2,107,2, + 114,102,116,5,100,6,131,1,130,1,100,7,83,0,100,7, + 83,0,41,8,122,28,86,101,114,105,102,121,32,97,114,103, + 117,109,101,110,116,115,32,97,114,101,32,34,115,97,110,101, + 34,46,122,31,109,111,100,117,108,101,32,110,97,109,101,32, + 109,117,115,116,32,98,101,32,115,116,114,44,32,110,111,116, + 32,123,125,114,25,0,0,0,122,18,108,101,118,101,108,32, + 109,117,115,116,32,98,101,32,62,61,32,48,122,31,95,95, + 112,97,99,107,97,103,101,95,95,32,110,111,116,32,115,101, + 116,32,116,111,32,97,32,115,116,114,105,110,103,122,54,97, + 116,116,101,109,112,116,101,100,32,114,101,108,97,116,105,118, + 101,32,105,109,112,111,114,116,32,119,105,116,104,32,110,111, + 32,107,110,111,119,110,32,112,97,114,101,110,116,32,112,97, + 99,107,97,103,101,122,17,69,109,112,116,121,32,109,111,100, + 117,108,101,32,110,97,109,101,78,41,7,218,10,105,115,105, + 110,115,116,97,110,99,101,218,3,115,116,114,218,9,84,121, + 112,101,69,114,114,111,114,114,49,0,0,0,114,3,0,0, + 0,218,10,86,97,108,117,101,69,114,114,111,114,114,83,0, + 0,0,169,3,114,20,0,0,0,114,196,0,0,0,114,197, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,218,13,95,115,97,110,105,116,121,95,99,104,101,99, + 107,199,3,0,0,115,26,0,0,0,10,2,18,1,8,1, + 8,1,8,1,10,1,8,1,4,1,8,1,12,2,8,1, + 8,255,255,128,114,208,0,0,0,122,16,78,111,32,109,111, + 100,117,108,101,32,110,97,109,101,100,32,122,4,123,33,114, + 125,99,2,0,0,0,0,0,0,0,0,0,0,0,9,0, + 0,0,8,0,0,0,67,0,0,0,115,20,1,0,0,100, + 0,125,2,124,0,160,0,100,1,161,1,100,2,25,0,125, + 3,124,3,114,128,124,3,116,1,106,2,118,1,114,42,116, + 3,124,1,124,3,131,2,1,0,124,0,116,1,106,2,118, + 0,114,62,116,1,106,2,124,0,25,0,83,0,116,1,106, + 2,124,3,25,0,125,4,122,10,124,4,106,4,125,2,87, + 0,110,44,4,0,116,5,121,126,1,0,1,0,1,0,116, + 6,100,3,23,0,160,7,124,0,124,3,161,2,125,5,116, + 8,124,5,124,0,100,4,141,2,100,0,130,2,48,0,116, + 9,124,0,124,2,131,2,125,6,124,6,100,0,117,0,114, + 164,116,8,116,6,160,7,124,0,161,1,124,0,100,4,141, + 2,130,1,116,10,124,6,131,1,125,7,124,3,144,1,114, + 16,116,1,106,2,124,3,25,0,125,4,124,0,160,0,100, + 1,161,1,100,5,25,0,125,8,122,18,116,11,124,4,124, + 8,124,7,131,3,1,0,87,0,124,7,83,0,4,0,116, + 5,144,1,121,14,1,0,1,0,1,0,100,6,124,3,155, + 2,100,7,124,8,155,2,157,4,125,5,116,12,160,13,124, + 5,116,14,161,2,1,0,89,0,124,7,83,0,48,0,124, + 7,83,0,41,8,78,114,135,0,0,0,114,25,0,0,0, + 122,23,59,32,123,33,114,125,32,105,115,32,110,111,116,32, + 97,32,112,97,99,107,97,103,101,114,19,0,0,0,233,2, + 0,0,0,122,27,67,97,110,110,111,116,32,115,101,116,32, + 97,110,32,97,116,116,114,105,98,117,116,101,32,111,110,32, + 122,18,32,102,111,114,32,99,104,105,108,100,32,109,111,100, + 117,108,101,32,41,15,114,136,0,0,0,114,18,0,0,0, + 114,99,0,0,0,114,71,0,0,0,114,148,0,0,0,114, + 2,0,0,0,218,8,95,69,82,82,95,77,83,71,114,49, + 0,0,0,218,19,77,111,100,117,108,101,78,111,116,70,111, + 117,110,100,69,114,114,111,114,114,202,0,0,0,114,167,0, + 0,0,114,12,0,0,0,114,95,0,0,0,114,96,0,0, + 0,114,163,0,0,0,41,9,114,20,0,0,0,218,7,105, + 109,112,111,114,116,95,114,175,0,0,0,114,137,0,0,0, + 90,13,112,97,114,101,110,116,95,109,111,100,117,108,101,114, + 102,0,0,0,114,103,0,0,0,114,104,0,0,0,90,5, + 99,104,105,108,100,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,218,23,95,102,105,110,100,95,97,110,100,95, + 108,111,97,100,95,117,110,108,111,99,107,101,100,218,3,0, + 0,115,60,0,0,0,4,1,14,1,4,1,10,1,10,1, + 10,2,10,1,10,1,2,1,10,1,12,1,16,1,16,1, + 10,1,8,1,18,1,8,2,6,1,10,2,14,1,2,1, + 14,1,4,4,14,253,16,1,14,1,4,1,2,255,4,1, + 255,128,114,213,0,0,0,99,2,0,0,0,0,0,0,0, + 0,0,0,0,4,0,0,0,8,0,0,0,67,0,0,0, + 115,128,0,0,0,116,0,124,0,131,1,143,62,1,0,116, + 1,106,2,160,3,124,0,116,4,161,2,125,2,124,2,116, + 4,117,0,114,56,116,5,124,0,124,1,131,2,87,0,2, + 0,100,1,4,0,4,0,131,3,1,0,83,0,87,0,100, + 1,4,0,4,0,131,3,1,0,110,16,49,0,115,76,48, + 0,1,0,1,0,1,0,89,0,1,0,124,2,100,1,117, + 0,114,116,100,2,160,6,124,0,161,1,125,3,116,7,124, + 3,124,0,100,3,141,2,130,1,116,8,124,0,131,1,1, + 0,124,2,83,0,41,4,122,25,70,105,110,100,32,97,110, + 100,32,108,111,97,100,32,116,104,101,32,109,111,100,117,108, + 101,46,78,122,40,105,109,112,111,114,116,32,111,102,32,123, + 125,32,104,97,108,116,101,100,59,32,78,111,110,101,32,105, + 110,32,115,121,115,46,109,111,100,117,108,101,115,114,19,0, + 0,0,41,9,114,54,0,0,0,114,18,0,0,0,114,99, + 0,0,0,114,38,0,0,0,218,14,95,78,69,69,68,83, + 95,76,79,65,68,73,78,71,114,213,0,0,0,114,49,0, + 0,0,114,211,0,0,0,114,69,0,0,0,41,4,114,20, + 0,0,0,114,212,0,0,0,114,104,0,0,0,114,79,0, + 0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0, + 0,218,14,95,102,105,110,100,95,97,110,100,95,108,111,97, + 100,253,3,0,0,115,24,0,0,0,10,2,14,1,8,1, + 54,1,8,2,4,1,2,1,4,255,12,2,8,2,4,1, + 255,128,114,215,0,0,0,114,25,0,0,0,99,3,0,0, + 0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0, + 0,67,0,0,0,115,42,0,0,0,116,0,124,0,124,1, + 124,2,131,3,1,0,124,2,100,1,107,4,114,32,116,1, + 124,0,124,1,124,2,131,3,125,0,116,2,124,0,116,3, + 131,2,83,0,41,3,97,50,1,0,0,73,109,112,111,114, + 116,32,97,110,100,32,114,101,116,117,114,110,32,116,104,101, + 32,109,111,100,117,108,101,32,98,97,115,101,100,32,111,110, + 32,105,116,115,32,110,97,109,101,44,32,116,104,101,32,112, + 97,99,107,97,103,101,32,116,104,101,32,99,97,108,108,32, + 105,115,10,32,32,32,32,98,101,105,110,103,32,109,97,100, + 101,32,102,114,111,109,44,32,97,110,100,32,116,104,101,32, + 108,101,118,101,108,32,97,100,106,117,115,116,109,101,110,116, + 46,10,10,32,32,32,32,84,104,105,115,32,102,117,110,99, + 116,105,111,110,32,114,101,112,114,101,115,101,110,116,115,32, + 116,104,101,32,103,114,101,97,116,101,115,116,32,99,111,109, + 109,111,110,32,100,101,110,111,109,105,110,97,116,111,114,32, + 111,102,32,102,117,110,99,116,105,111,110,97,108,105,116,121, + 10,32,32,32,32,98,101,116,119,101,101,110,32,105,109,112, + 111,114,116,95,109,111,100,117,108,101,32,97,110,100,32,95, + 95,105,109,112,111,114,116,95,95,46,32,84,104,105,115,32, + 105,110,99,108,117,100,101,115,32,115,101,116,116,105,110,103, + 32,95,95,112,97,99,107,97,103,101,95,95,32,105,102,10, + 32,32,32,32,116,104,101,32,108,111,97,100,101,114,32,100, + 105,100,32,110,111,116,46,10,10,32,32,32,32,114,25,0, + 0,0,78,41,4,114,208,0,0,0,114,198,0,0,0,114, + 215,0,0,0,218,11,95,103,99,100,95,105,109,112,111,114, + 116,114,207,0,0,0,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,114,216,0,0,0,13,4,0,0,115,10, + 0,0,0,12,9,8,1,12,1,10,1,255,128,114,216,0, + 0,0,169,1,218,9,114,101,99,117,114,115,105,118,101,99, + 3,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0, + 11,0,0,0,67,0,0,0,115,216,0,0,0,124,1,68, + 0,93,204,125,4,116,0,124,4,116,1,131,2,115,64,124, + 3,114,34,124,0,106,2,100,1,23,0,125,5,110,4,100, + 2,125,5,116,3,100,3,124,5,155,0,100,4,116,4,124, + 4,131,1,106,2,155,0,157,4,131,1,130,1,124,4,100, + 5,107,2,114,106,124,3,115,4,116,5,124,0,100,6,131, + 2,114,4,116,6,124,0,124,0,106,7,124,2,100,7,100, + 8,141,4,1,0,113,4,116,5,124,0,124,4,131,2,115, + 4,100,9,160,8,124,0,106,2,124,4,161,2,125,6,122, + 14,116,9,124,2,124,6,131,2,1,0,87,0,113,4,4, + 0,116,10,121,214,1,0,125,7,1,0,122,42,124,7,106, + 11,124,6,107,2,114,200,116,12,106,13,160,14,124,6,116, + 15,161,2,100,10,117,1,114,200,87,0,89,0,100,10,125, + 7,126,7,113,4,130,0,100,10,125,7,126,7,48,0,124, + 0,83,0,48,0,41,11,122,238,70,105,103,117,114,101,32, + 111,117,116,32,119,104,97,116,32,95,95,105,109,112,111,114, + 116,95,95,32,115,104,111,117,108,100,32,114,101,116,117,114, + 110,46,10,10,32,32,32,32,84,104,101,32,105,109,112,111, + 114,116,95,32,112,97,114,97,109,101,116,101,114,32,105,115, + 32,97,32,99,97,108,108,97,98,108,101,32,119,104,105,99, + 104,32,116,97,107,101,115,32,116,104,101,32,110,97,109,101, + 32,111,102,32,109,111,100,117,108,101,32,116,111,10,32,32, + 32,32,105,109,112,111,114,116,46,32,73,116,32,105,115,32, + 114,101,113,117,105,114,101,100,32,116,111,32,100,101,99,111, + 117,112,108,101,32,116,104,101,32,102,117,110,99,116,105,111, + 110,32,102,114,111,109,32,97,115,115,117,109,105,110,103,32, + 105,109,112,111,114,116,108,105,98,39,115,10,32,32,32,32, + 105,109,112,111,114,116,32,105,109,112,108,101,109,101,110,116, + 97,116,105,111,110,32,105,115,32,100,101,115,105,114,101,100, + 46,10,10,32,32,32,32,122,8,46,95,95,97,108,108,95, + 95,122,13,96,96,102,114,111,109,32,108,105,115,116,39,39, + 122,8,73,116,101,109,32,105,110,32,122,18,32,109,117,115, + 116,32,98,101,32,115,116,114,44,32,110,111,116,32,250,1, + 42,218,7,95,95,97,108,108,95,95,84,114,217,0,0,0, + 114,193,0,0,0,78,41,16,114,203,0,0,0,114,204,0, + 0,0,114,9,0,0,0,114,205,0,0,0,114,3,0,0, + 0,114,11,0,0,0,218,16,95,104,97,110,100,108,101,95, + 102,114,111,109,108,105,115,116,114,220,0,0,0,114,49,0, + 0,0,114,71,0,0,0,114,211,0,0,0,114,20,0,0, + 0,114,18,0,0,0,114,99,0,0,0,114,38,0,0,0, + 114,214,0,0,0,41,8,114,104,0,0,0,218,8,102,114, + 111,109,108,105,115,116,114,212,0,0,0,114,218,0,0,0, + 218,1,120,90,5,119,104,101,114,101,90,9,102,114,111,109, + 95,110,97,109,101,90,3,101,120,99,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,114,221,0,0,0,28,4, + 0,0,115,54,0,0,0,8,10,10,1,4,1,12,1,4, + 2,10,1,8,1,8,255,8,2,14,1,10,1,2,1,8, + 255,10,2,14,1,2,1,14,1,14,1,10,4,16,1,2, + 255,12,2,2,1,8,128,4,1,2,248,255,128,114,221,0, + 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,6,0,0,0,67,0,0,0,115,146,0,0,0, + 124,0,160,0,100,1,161,1,125,1,124,0,160,0,100,2, + 161,1,125,2,124,1,100,3,117,1,114,82,124,2,100,3, + 117,1,114,78,124,1,124,2,106,1,107,3,114,78,116,2, + 106,3,100,4,124,1,155,2,100,5,124,2,106,1,155,2, + 100,6,157,5,116,4,100,7,100,8,141,3,1,0,124,1, + 83,0,124,2,100,3,117,1,114,96,124,2,106,1,83,0, + 116,2,106,3,100,9,116,4,100,7,100,8,141,3,1,0, + 124,0,100,10,25,0,125,1,100,11,124,0,118,1,114,142, + 124,1,160,5,100,12,161,1,100,13,25,0,125,1,124,1, + 83,0,41,14,122,167,67,97,108,99,117,108,97,116,101,32, + 119,104,97,116,32,95,95,112,97,99,107,97,103,101,95,95, + 32,115,104,111,117,108,100,32,98,101,46,10,10,32,32,32, + 32,95,95,112,97,99,107,97,103,101,95,95,32,105,115,32, + 110,111,116,32,103,117,97,114,97,110,116,101,101,100,32,116, + 111,32,98,101,32,100,101,102,105,110,101,100,32,111,114,32, + 99,111,117,108,100,32,98,101,32,115,101,116,32,116,111,32, + 78,111,110,101,10,32,32,32,32,116,111,32,114,101,112,114, + 101,115,101,110,116,32,116,104,97,116,32,105,116,115,32,112, + 114,111,112,101,114,32,118,97,108,117,101,32,105,115,32,117, + 110,107,110,111,119,110,46,10,10,32,32,32,32,114,152,0, + 0,0,114,113,0,0,0,78,122,32,95,95,112,97,99,107, + 97,103,101,95,95,32,33,61,32,95,95,115,112,101,99,95, + 95,46,112,97,114,101,110,116,32,40,122,4,32,33,61,32, + 250,1,41,233,3,0,0,0,41,1,90,10,115,116,97,99, + 107,108,101,118,101,108,122,89,99,97,110,39,116,32,114,101, + 115,111,108,118,101,32,112,97,99,107,97,103,101,32,102,114, + 111,109,32,95,95,115,112,101,99,95,95,32,111,114,32,95, + 95,112,97,99,107,97,103,101,95,95,44,32,102,97,108,108, + 105,110,103,32,98,97,99,107,32,111,110,32,95,95,110,97, + 109,101,95,95,32,97,110,100,32,95,95,112,97,116,104,95, + 95,114,9,0,0,0,114,148,0,0,0,114,135,0,0,0, + 114,25,0,0,0,41,6,114,38,0,0,0,114,137,0,0, + 0,114,95,0,0,0,114,96,0,0,0,114,163,0,0,0, + 114,136,0,0,0,41,3,218,7,103,108,111,98,97,108,115, + 114,196,0,0,0,114,103,0,0,0,114,5,0,0,0,114, + 5,0,0,0,114,6,0,0,0,218,17,95,99,97,108,99, + 95,95,95,112,97,99,107,97,103,101,95,95,65,4,0,0, + 115,44,0,0,0,10,7,10,1,8,1,18,1,6,1,2, + 1,4,255,4,1,6,255,4,2,6,254,4,3,8,1,6, + 1,6,2,4,2,6,254,8,3,8,1,14,1,4,1,255, + 128,114,227,0,0,0,114,5,0,0,0,99,5,0,0,0, + 0,0,0,0,0,0,0,0,9,0,0,0,5,0,0,0, + 67,0,0,0,115,174,0,0,0,124,4,100,1,107,2,114, + 18,116,0,124,0,131,1,125,5,110,36,124,1,100,2,117, + 1,114,30,124,1,110,2,105,0,125,6,116,1,124,6,131, + 1,125,7,116,0,124,0,124,7,124,4,131,3,125,5,124, + 3,115,148,124,4,100,1,107,2,114,84,116,0,124,0,160, + 2,100,3,161,1,100,1,25,0,131,1,83,0,124,0,115, + 92,124,5,83,0,116,3,124,0,131,1,116,3,124,0,160, + 2,100,3,161,1,100,1,25,0,131,1,24,0,125,8,116, + 4,106,5,124,5,106,6,100,2,116,3,124,5,106,6,131, + 1,124,8,24,0,133,2,25,0,25,0,83,0,116,7,124, + 5,100,4,131,2,114,170,116,8,124,5,124,3,116,0,131, + 3,83,0,124,5,83,0,41,5,97,215,1,0,0,73,109, + 112,111,114,116,32,97,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,84,104,101,32,39,103,108,111,98,97,108,115, + 39,32,97,114,103,117,109,101,110,116,32,105,115,32,117,115, + 101,100,32,116,111,32,105,110,102,101,114,32,119,104,101,114, + 101,32,116,104,101,32,105,109,112,111,114,116,32,105,115,32, + 111,99,99,117,114,114,105,110,103,32,102,114,111,109,10,32, + 32,32,32,116,111,32,104,97,110,100,108,101,32,114,101,108, + 97,116,105,118,101,32,105,109,112,111,114,116,115,46,32,84, + 104,101,32,39,108,111,99,97,108,115,39,32,97,114,103,117, + 109,101,110,116,32,105,115,32,105,103,110,111,114,101,100,46, + 32,84,104,101,10,32,32,32,32,39,102,114,111,109,108,105, + 115,116,39,32,97,114,103,117,109,101,110,116,32,115,112,101, + 99,105,102,105,101,115,32,119,104,97,116,32,115,104,111,117, + 108,100,32,101,120,105,115,116,32,97,115,32,97,116,116,114, + 105,98,117,116,101,115,32,111,110,32,116,104,101,32,109,111, + 100,117,108,101,10,32,32,32,32,98,101,105,110,103,32,105, + 109,112,111,114,116,101,100,32,40,101,46,103,46,32,96,96, + 102,114,111,109,32,109,111,100,117,108,101,32,105,109,112,111, + 114,116,32,60,102,114,111,109,108,105,115,116,62,96,96,41, + 46,32,32,84,104,101,32,39,108,101,118,101,108,39,10,32, + 32,32,32,97,114,103,117,109,101,110,116,32,114,101,112,114, + 101,115,101,110,116,115,32,116,104,101,32,112,97,99,107,97, + 103,101,32,108,111,99,97,116,105,111,110,32,116,111,32,105, + 109,112,111,114,116,32,102,114,111,109,32,105,110,32,97,32, + 114,101,108,97,116,105,118,101,10,32,32,32,32,105,109,112, + 111,114,116,32,40,101,46,103,46,32,96,96,102,114,111,109, + 32,46,46,112,107,103,32,105,109,112,111,114,116,32,109,111, + 100,96,96,32,119,111,117,108,100,32,104,97,118,101,32,97, + 32,39,108,101,118,101,108,39,32,111,102,32,50,41,46,10, + 10,32,32,32,32,114,25,0,0,0,78,114,135,0,0,0, + 114,148,0,0,0,41,9,114,216,0,0,0,114,227,0,0, + 0,218,9,112,97,114,116,105,116,105,111,110,114,195,0,0, + 0,114,18,0,0,0,114,99,0,0,0,114,9,0,0,0, + 114,11,0,0,0,114,221,0,0,0,41,9,114,20,0,0, + 0,114,226,0,0,0,218,6,108,111,99,97,108,115,114,222, + 0,0,0,114,197,0,0,0,114,104,0,0,0,90,8,103, + 108,111,98,97,108,115,95,114,196,0,0,0,90,7,99,117, + 116,95,111,102,102,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,218,10,95,95,105,109,112,111,114,116,95,95, + 92,4,0,0,115,32,0,0,0,8,11,10,1,16,2,8, + 1,12,1,4,1,8,3,18,1,4,1,4,1,26,4,30, + 3,10,1,12,1,4,2,255,128,114,230,0,0,0,99,1, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, + 0,0,0,67,0,0,0,115,38,0,0,0,116,0,160,1, + 124,0,161,1,125,1,124,1,100,0,117,0,114,30,116,2, + 100,1,124,0,23,0,131,1,130,1,116,3,124,1,131,1, + 83,0,41,2,78,122,25,110,111,32,98,117,105,108,116,45, + 105,110,32,109,111,100,117,108,101,32,110,97,109,101,100,32, + 41,4,114,169,0,0,0,114,177,0,0,0,114,83,0,0, + 0,114,167,0,0,0,41,2,114,20,0,0,0,114,103,0, + 0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0, + 0,218,18,95,98,117,105,108,116,105,110,95,102,114,111,109, + 95,110,97,109,101,129,4,0,0,115,10,0,0,0,10,1, + 8,1,12,1,8,1,255,128,114,231,0,0,0,99,2,0, + 0,0,0,0,0,0,0,0,0,0,10,0,0,0,5,0, + 0,0,67,0,0,0,115,164,0,0,0,124,1,97,0,124, + 0,97,1,116,2,116,1,131,1,125,2,116,1,106,3,160, + 4,161,0,68,0,93,70,92,2,125,3,125,4,116,5,124, + 4,124,2,131,2,114,26,124,3,116,1,106,6,118,0,114, + 60,116,7,125,5,110,16,116,0,160,8,124,3,161,1,114, + 26,116,9,125,5,110,0,116,10,124,4,124,5,131,2,125, + 6,116,11,124,6,124,4,131,2,1,0,113,26,116,1,106, + 3,116,12,25,0,125,7,100,1,68,0,93,46,125,8,124, + 8,116,1,106,3,118,1,114,136,116,13,124,8,131,1,125, + 9,110,10,116,1,106,3,124,8,25,0,125,9,116,14,124, + 7,124,8,124,9,131,3,1,0,113,112,100,2,83,0,41, + 3,122,250,83,101,116,117,112,32,105,109,112,111,114,116,108, + 105,98,32,98,121,32,105,109,112,111,114,116,105,110,103,32, + 110,101,101,100,101,100,32,98,117,105,108,116,45,105,110,32, + 109,111,100,117,108,101,115,32,97,110,100,32,105,110,106,101, + 99,116,105,110,103,32,116,104,101,109,10,32,32,32,32,105, + 110,116,111,32,116,104,101,32,103,108,111,98,97,108,32,110, + 97,109,101,115,112,97,99,101,46,10,10,32,32,32,32,65, + 115,32,115,121,115,32,105,115,32,110,101,101,100,101,100,32, + 102,111,114,32,115,121,115,46,109,111,100,117,108,101,115,32, + 97,99,99,101,115,115,32,97,110,100,32,95,105,109,112,32, + 105,115,32,110,101,101,100,101,100,32,116,111,32,108,111,97, + 100,32,98,117,105,108,116,45,105,110,10,32,32,32,32,109, + 111,100,117,108,101,115,44,32,116,104,111,115,101,32,116,119, + 111,32,109,111,100,117,108,101,115,32,109,117,115,116,32,98, + 101,32,101,120,112,108,105,99,105,116,108,121,32,112,97,115, + 115,101,100,32,105,110,46,10,10,32,32,32,32,41,3,114, + 26,0,0,0,114,95,0,0,0,114,68,0,0,0,78,41, + 15,114,61,0,0,0,114,18,0,0,0,114,3,0,0,0, + 114,99,0,0,0,218,5,105,116,101,109,115,114,203,0,0, + 0,114,82,0,0,0,114,169,0,0,0,114,92,0,0,0, + 114,184,0,0,0,114,149,0,0,0,114,155,0,0,0,114, + 9,0,0,0,114,231,0,0,0,114,12,0,0,0,41,10, + 218,10,115,121,115,95,109,111,100,117,108,101,218,11,95,105, + 109,112,95,109,111,100,117,108,101,90,11,109,111,100,117,108, + 101,95,116,121,112,101,114,20,0,0,0,114,104,0,0,0, + 114,116,0,0,0,114,103,0,0,0,90,11,115,101,108,102, + 95,109,111,100,117,108,101,90,12,98,117,105,108,116,105,110, + 95,110,97,109,101,90,14,98,117,105,108,116,105,110,95,109, + 111,100,117,108,101,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,218,6,95,115,101,116,117,112,136,4,0,0, + 115,38,0,0,0,4,9,4,1,8,3,18,1,10,1,10, + 1,6,1,10,1,6,1,10,3,12,1,10,3,8,1,10, + 1,10,1,10,2,14,1,4,251,255,128,114,235,0,0,0, + 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,3,0,0,0,67,0,0,0,115,38,0,0,0,116,0, + 124,0,124,1,131,2,1,0,116,1,106,2,160,3,116,4, + 161,1,1,0,116,1,106,2,160,3,116,5,161,1,1,0, + 100,1,83,0,41,2,122,48,73,110,115,116,97,108,108,32, + 105,109,112,111,114,116,101,114,115,32,102,111,114,32,98,117, + 105,108,116,105,110,32,97,110,100,32,102,114,111,122,101,110, + 32,109,111,100,117,108,101,115,78,41,6,114,235,0,0,0, + 114,18,0,0,0,114,201,0,0,0,114,126,0,0,0,114, + 169,0,0,0,114,184,0,0,0,41,2,114,233,0,0,0, + 114,234,0,0,0,114,5,0,0,0,114,5,0,0,0,114, + 6,0,0,0,218,8,95,105,110,115,116,97,108,108,171,4, + 0,0,115,8,0,0,0,10,2,12,2,16,1,255,128,114, + 236,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, + 0,1,0,0,0,4,0,0,0,67,0,0,0,115,32,0, + 0,0,100,1,100,2,108,0,125,0,124,0,97,1,124,0, + 160,2,116,3,106,4,116,5,25,0,161,1,1,0,100,2, + 83,0,41,3,122,57,73,110,115,116,97,108,108,32,105,109, + 112,111,114,116,101,114,115,32,116,104,97,116,32,114,101,113, + 117,105,114,101,32,101,120,116,101,114,110,97,108,32,102,105, + 108,101,115,121,115,116,101,109,32,97,99,99,101,115,115,114, + 25,0,0,0,78,41,6,218,26,95,102,114,111,122,101,110, + 95,105,109,112,111,114,116,108,105,98,95,101,120,116,101,114, + 110,97,108,114,133,0,0,0,114,236,0,0,0,114,18,0, + 0,0,114,99,0,0,0,114,9,0,0,0,41,1,114,237, + 0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0, + 0,0,218,27,95,105,110,115,116,97,108,108,95,101,120,116, + 101,114,110,97,108,95,105,109,112,111,114,116,101,114,115,179, + 4,0,0,115,8,0,0,0,8,3,4,1,20,1,255,128, + 114,238,0,0,0,41,2,78,78,41,1,78,41,2,78,114, + 25,0,0,0,41,4,78,78,114,5,0,0,0,114,25,0, + 0,0,41,54,114,10,0,0,0,114,7,0,0,0,114,26, + 0,0,0,114,95,0,0,0,114,68,0,0,0,114,133,0, + 0,0,114,17,0,0,0,114,21,0,0,0,114,63,0,0, + 0,114,37,0,0,0,114,47,0,0,0,114,22,0,0,0, + 114,23,0,0,0,114,53,0,0,0,114,54,0,0,0,114, + 57,0,0,0,114,69,0,0,0,114,71,0,0,0,114,80, + 0,0,0,114,90,0,0,0,114,94,0,0,0,114,105,0, + 0,0,114,118,0,0,0,114,119,0,0,0,114,98,0,0, + 0,114,149,0,0,0,114,155,0,0,0,114,159,0,0,0, + 114,114,0,0,0,114,100,0,0,0,114,166,0,0,0,114, + 167,0,0,0,114,101,0,0,0,114,169,0,0,0,114,184, + 0,0,0,114,189,0,0,0,114,198,0,0,0,114,200,0, + 0,0,114,202,0,0,0,114,208,0,0,0,90,15,95,69, + 82,82,95,77,83,71,95,80,82,69,70,73,88,114,210,0, + 0,0,114,213,0,0,0,218,6,111,98,106,101,99,116,114, + 214,0,0,0,114,215,0,0,0,114,216,0,0,0,114,221, + 0,0,0,114,227,0,0,0,114,230,0,0,0,114,231,0, + 0,0,114,235,0,0,0,114,236,0,0,0,114,238,0,0, + 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, + 114,6,0,0,0,218,8,60,109,111,100,117,108,101,62,1, + 0,0,0,115,106,0,0,0,4,0,8,22,4,9,4,1, + 4,1,4,3,8,3,8,8,4,8,4,2,16,3,14,4, + 14,77,14,21,8,16,8,37,8,17,14,11,8,8,8,11, + 8,12,8,19,14,36,16,101,10,26,14,45,8,72,8,17, + 8,17,8,30,8,36,8,45,14,15,14,75,14,80,8,13, + 8,9,10,9,8,47,4,16,8,1,8,2,6,32,8,3, + 10,16,14,15,8,37,10,27,8,37,8,7,8,35,12,8, + 255,128, }; diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 73be4fed942737..dc1f76b6879435 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -1,2709 +1,2668 @@ /* Auto-generated by Programs/_freeze_importlib.c */ const unsigned char _Py_M__importlib_bootstrap_external[] = { 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,5,0,0,0,64,0,0,0,115,32,2,0,0,100,0, - 90,0,100,1,90,1,100,2,90,2,101,2,101,1,23,0, - 90,3,100,3,100,4,132,0,90,4,100,5,100,6,132,0, - 90,5,100,7,100,8,132,0,90,6,100,9,100,10,132,0, - 90,7,100,11,100,12,132,0,90,8,100,13,100,14,132,0, - 90,9,100,15,100,16,132,0,90,10,100,17,100,18,132,0, - 90,11,100,19,100,20,132,0,90,12,100,21,100,22,132,0, - 90,13,100,23,100,24,132,0,90,14,100,101,100,26,100,27, - 132,1,90,15,101,16,101,15,106,17,131,1,90,18,100,28, - 160,19,100,29,100,30,161,2,100,31,23,0,90,20,101,21, - 160,22,101,20,100,30,161,2,90,23,100,32,90,24,100,33, - 90,25,100,34,103,1,90,26,100,35,103,1,90,27,101,27, - 4,0,90,28,90,29,100,102,100,36,100,37,156,1,100,38, - 100,39,132,3,90,30,100,40,100,41,132,0,90,31,100,42, - 100,43,132,0,90,32,100,44,100,45,132,0,90,33,100,46, - 100,47,132,0,90,34,100,48,100,49,132,0,90,35,100,50, - 100,51,132,0,90,36,100,52,100,53,132,0,90,37,100,54, - 100,55,132,0,90,38,100,56,100,57,132,0,90,39,100,103, - 100,58,100,59,132,1,90,40,100,104,100,61,100,62,132,1, - 90,41,100,105,100,64,100,65,132,1,90,42,100,66,100,67, - 132,0,90,43,101,44,131,0,90,45,100,106,100,36,101,45, - 100,68,156,2,100,69,100,70,132,3,90,46,71,0,100,71, - 100,72,132,0,100,72,131,2,90,47,71,0,100,73,100,74, - 132,0,100,74,131,2,90,48,71,0,100,75,100,76,132,0, - 100,76,101,48,131,3,90,49,71,0,100,77,100,78,132,0, - 100,78,131,2,90,50,71,0,100,79,100,80,132,0,100,80, - 101,50,101,49,131,4,90,51,71,0,100,81,100,82,132,0, - 100,82,101,50,101,48,131,4,90,52,103,0,90,53,71,0, - 100,83,100,84,132,0,100,84,101,50,101,48,131,4,90,54, - 71,0,100,85,100,86,132,0,100,86,131,2,90,55,71,0, - 100,87,100,88,132,0,100,88,131,2,90,56,71,0,100,89, - 100,90,132,0,100,90,131,2,90,57,71,0,100,91,100,92, - 132,0,100,92,131,2,90,58,100,107,100,93,100,94,132,1, - 90,59,100,95,100,96,132,0,90,60,100,97,100,98,132,0, - 90,61,100,99,100,100,132,0,90,62,100,36,83,0,41,108, - 97,94,1,0,0,67,111,114,101,32,105,109,112,108,101,109, - 101,110,116,97,116,105,111,110,32,111,102,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,46,10,10, - 84,104,105,115,32,109,111,100,117,108,101,32,105,115,32,78, - 79,84,32,109,101,97,110,116,32,116,111,32,98,101,32,100, - 105,114,101,99,116,108,121,32,105,109,112,111,114,116,101,100, - 33,32,73,116,32,104,97,115,32,98,101,101,110,32,100,101, - 115,105,103,110,101,100,32,115,117,99,104,10,116,104,97,116, - 32,105,116,32,99,97,110,32,98,101,32,98,111,111,116,115, - 116,114,97,112,112,101,100,32,105,110,116,111,32,80,121,116, - 104,111,110,32,97,115,32,116,104,101,32,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,112, - 111,114,116,46,32,65,115,10,115,117,99,104,32,105,116,32, - 114,101,113,117,105,114,101,115,32,116,104,101,32,105,110,106, - 101,99,116,105,111,110,32,111,102,32,115,112,101,99,105,102, - 105,99,32,109,111,100,117,108,101,115,32,97,110,100,32,97, - 116,116,114,105,98,117,116,101,115,32,105,110,32,111,114,100, - 101,114,32,116,111,10,119,111,114,107,46,32,79,110,101,32, - 115,104,111,117,108,100,32,117,115,101,32,105,109,112,111,114, - 116,108,105,98,32,97,115,32,116,104,101,32,112,117,98,108, - 105,99,45,102,97,99,105,110,103,32,118,101,114,115,105,111, - 110,32,111,102,32,116,104,105,115,32,109,111,100,117,108,101, - 46,10,10,41,1,218,3,119,105,110,41,2,90,6,99,121, - 103,119,105,110,90,6,100,97,114,119,105,110,99,0,0,0, - 0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0, - 0,3,0,0,0,115,60,0,0,0,116,0,106,1,160,2, - 116,3,161,1,114,48,116,0,106,1,160,2,116,4,161,1, - 114,30,100,1,137,0,110,4,100,2,137,0,135,0,102,1, - 100,3,100,4,132,8,125,0,110,8,100,5,100,4,132,0, - 125,0,124,0,83,0,41,6,78,90,12,80,89,84,72,79, - 78,67,65,83,69,79,75,115,12,0,0,0,80,89,84,72, - 79,78,67,65,83,69,79,75,99,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,19,0,0, - 0,115,20,0,0,0,116,0,106,1,106,2,12,0,111,18, - 136,0,116,3,106,4,118,0,83,0,41,1,122,94,84,114, - 117,101,32,105,102,32,102,105,108,101,110,97,109,101,115,32, - 109,117,115,116,32,98,101,32,99,104,101,99,107,101,100,32, - 99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101, - 108,121,32,97,110,100,32,105,103,110,111,114,101,32,101,110, - 118,105,114,111,110,109,101,110,116,32,102,108,97,103,115,32, - 97,114,101,32,110,111,116,32,115,101,116,46,41,5,218,3, - 115,121,115,218,5,102,108,97,103,115,218,18,105,103,110,111, - 114,101,95,101,110,118,105,114,111,110,109,101,110,116,218,3, - 95,111,115,90,7,101,110,118,105,114,111,110,169,0,169,1, - 218,3,107,101,121,114,5,0,0,0,250,38,60,102,114,111, - 122,101,110,32,105,109,112,111,114,116,108,105,98,46,95,98, - 111,111,116,115,116,114,97,112,95,101,120,116,101,114,110,97, - 108,62,218,11,95,114,101,108,97,120,95,99,97,115,101,36, - 0,0,0,115,4,0,0,0,20,2,255,128,122,37,95,109, - 97,107,101,95,114,101,108,97,120,95,99,97,115,101,46,60, - 108,111,99,97,108,115,62,46,95,114,101,108,97,120,95,99, - 97,115,101,99,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,1,0,0,0,83,0,0,0,115,4,0,0, - 0,100,1,83,0,41,2,122,53,84,114,117,101,32,105,102, - 32,102,105,108,101,110,97,109,101,115,32,109,117,115,116,32, - 98,101,32,99,104,101,99,107,101,100,32,99,97,115,101,45, - 105,110,115,101,110,115,105,116,105,118,101,108,121,46,70,114, - 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,9,0,0,0,40,0,0, - 0,115,4,0,0,0,4,2,255,128,41,5,114,1,0,0, - 0,218,8,112,108,97,116,102,111,114,109,218,10,115,116,97, - 114,116,115,119,105,116,104,218,27,95,67,65,83,69,95,73, - 78,83,69,78,83,73,84,73,86,69,95,80,76,65,84,70, - 79,82,77,83,218,35,95,67,65,83,69,95,73,78,83,69, - 78,83,73,84,73,86,69,95,80,76,65,84,70,79,82,77, - 83,95,83,84,82,95,75,69,89,41,1,114,9,0,0,0, - 114,5,0,0,0,114,6,0,0,0,114,8,0,0,0,218, - 16,95,109,97,107,101,95,114,101,108,97,120,95,99,97,115, - 101,29,0,0,0,115,16,0,0,0,12,1,12,1,6,1, - 4,2,14,2,8,4,4,3,255,128,114,14,0,0,0,99, - 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 4,0,0,0,67,0,0,0,115,20,0,0,0,116,0,124, - 0,131,1,100,1,64,0,160,1,100,2,100,3,161,2,83, - 0,41,4,122,42,67,111,110,118,101,114,116,32,97,32,51, - 50,45,98,105,116,32,105,110,116,101,103,101,114,32,116,111, - 32,108,105,116,116,108,101,45,101,110,100,105,97,110,46,236, - 3,0,0,0,255,127,255,127,3,0,233,4,0,0,0,218, - 6,108,105,116,116,108,101,41,2,218,3,105,110,116,218,8, - 116,111,95,98,121,116,101,115,41,1,218,1,120,114,5,0, - 0,0,114,5,0,0,0,114,8,0,0,0,218,12,95,112, - 97,99,107,95,117,105,110,116,51,50,46,0,0,0,115,4, - 0,0,0,20,2,255,128,114,21,0,0,0,99,1,0,0, - 0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0, - 0,67,0,0,0,115,28,0,0,0,116,0,124,0,131,1, - 100,1,107,2,115,16,74,0,130,1,116,1,160,2,124,0, - 100,2,161,2,83,0,41,3,122,47,67,111,110,118,101,114, - 116,32,52,32,98,121,116,101,115,32,105,110,32,108,105,116, - 116,108,101,45,101,110,100,105,97,110,32,116,111,32,97,110, - 32,105,110,116,101,103,101,114,46,114,16,0,0,0,114,17, - 0,0,0,169,3,218,3,108,101,110,114,18,0,0,0,218, - 10,102,114,111,109,95,98,121,116,101,115,169,1,218,4,100, - 97,116,97,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,14,95,117,110,112,97,99,107,95,117,105,110,116, - 51,50,51,0,0,0,115,6,0,0,0,16,2,12,1,255, - 128,114,27,0,0,0,99,1,0,0,0,0,0,0,0,0, - 0,0,0,1,0,0,0,4,0,0,0,67,0,0,0,115, - 28,0,0,0,116,0,124,0,131,1,100,1,107,2,115,16, - 74,0,130,1,116,1,160,2,124,0,100,2,161,2,83,0, - 41,3,122,47,67,111,110,118,101,114,116,32,50,32,98,121, - 116,101,115,32,105,110,32,108,105,116,116,108,101,45,101,110, - 100,105,97,110,32,116,111,32,97,110,32,105,110,116,101,103, - 101,114,46,233,2,0,0,0,114,17,0,0,0,114,22,0, - 0,0,114,25,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,218,14,95,117,110,112,97,99,107,95, - 117,105,110,116,49,54,56,0,0,0,115,6,0,0,0,16, - 2,12,1,255,128,114,29,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,71, - 0,0,0,115,20,0,0,0,116,0,160,1,100,1,100,2, - 132,0,124,0,68,0,131,1,161,1,83,0,41,3,122,31, - 82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32, - 111,115,46,112,97,116,104,46,106,111,105,110,40,41,46,99, - 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 5,0,0,0,83,0,0,0,115,26,0,0,0,103,0,124, - 0,93,18,125,1,124,1,114,4,124,1,160,0,116,1,161, - 1,145,2,113,4,83,0,114,5,0,0,0,41,2,218,6, - 114,115,116,114,105,112,218,15,112,97,116,104,95,115,101,112, - 97,114,97,116,111,114,115,41,2,218,2,46,48,218,4,112, - 97,114,116,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,10,60,108,105,115,116,99,111,109,112,62,64,0, - 0,0,115,8,0,0,0,6,0,6,1,14,255,255,128,122, - 30,95,112,97,116,104,95,106,111,105,110,46,60,108,111,99, - 97,108,115,62,46,60,108,105,115,116,99,111,109,112,62,41, - 2,218,8,112,97,116,104,95,115,101,112,218,4,106,111,105, - 110,41,1,218,10,112,97,116,104,95,112,97,114,116,115,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,10, - 95,112,97,116,104,95,106,111,105,110,62,0,0,0,115,8, - 0,0,0,10,2,2,1,8,255,255,128,114,38,0,0,0, - 99,1,0,0,0,0,0,0,0,0,0,0,0,5,0,0, - 0,5,0,0,0,67,0,0,0,115,94,0,0,0,116,0, - 116,1,131,1,100,1,107,2,114,36,124,0,160,2,116,3, - 161,1,92,3,125,1,125,2,125,3,124,1,124,3,102,2, - 83,0,116,4,124,0,131,1,68,0,93,40,125,4,124,4, - 116,1,118,0,114,44,124,0,106,5,124,4,100,1,100,2, - 141,2,92,2,125,1,125,3,124,1,124,3,102,2,2,0, - 1,0,83,0,100,3,124,0,102,2,83,0,41,4,122,32, - 82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32, - 111,115,46,112,97,116,104,46,115,112,108,105,116,40,41,46, - 233,1,0,0,0,41,1,90,8,109,97,120,115,112,108,105, - 116,218,0,41,6,114,23,0,0,0,114,31,0,0,0,218, - 10,114,112,97,114,116,105,116,105,111,110,114,35,0,0,0, - 218,8,114,101,118,101,114,115,101,100,218,6,114,115,112,108, - 105,116,41,5,218,4,112,97,116,104,90,5,102,114,111,110, - 116,218,1,95,218,4,116,97,105,108,114,20,0,0,0,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,11, - 95,112,97,116,104,95,115,112,108,105,116,68,0,0,0,115, - 18,0,0,0,12,2,16,1,8,1,12,1,8,1,18,1, - 12,1,8,1,255,128,114,47,0,0,0,99,1,0,0,0, + 0,5,0,0,0,64,0,0,0,115,216,2,0,0,100,0, + 90,0,100,1,97,1,100,2,100,1,108,2,90,2,100,2, + 100,1,108,3,90,3,100,2,100,1,108,4,90,4,100,2, + 100,1,108,5,90,5,100,2,100,1,108,6,90,6,101,4, + 106,7,100,3,107,2,90,8,101,8,114,80,100,2,100,1, + 108,9,90,10,100,2,100,1,108,11,90,11,110,8,100,2, + 100,1,108,12,90,10,101,8,114,102,100,4,100,5,103,2, + 90,13,110,6,100,5,103,1,90,13,101,14,100,6,100,7, + 132,0,101,13,68,0,131,1,131,1,115,130,74,0,130,1, + 101,13,100,2,25,0,90,15,100,8,160,16,101,13,161,1, + 90,13,100,9,100,10,132,0,101,13,68,0,131,1,90,17, + 100,11,90,18,100,12,90,19,101,19,101,18,23,0,90,20, + 100,13,100,14,132,0,90,21,101,21,131,0,90,22,100,15, + 100,16,132,0,90,23,100,17,100,18,132,0,90,24,100,19, + 100,20,132,0,90,25,100,21,100,22,132,0,90,26,100,23, + 100,24,132,0,90,27,100,25,100,26,132,0,90,28,100,27, + 100,28,132,0,90,29,100,29,100,30,132,0,90,30,100,31, + 100,32,132,0,90,31,100,33,100,34,132,0,90,32,100,110, + 100,36,100,37,132,1,90,33,101,34,101,33,106,35,131,1, + 90,36,100,38,160,37,100,39,100,40,161,2,100,41,23,0, + 90,38,101,39,160,40,101,38,100,40,161,2,90,41,100,42, + 90,42,100,43,90,43,100,44,103,1,90,44,101,8,144,1, + 114,94,101,44,160,45,100,45,161,1,1,0,101,2,160,46, + 161,0,90,47,100,46,103,1,90,48,101,48,4,0,90,49, + 90,50,100,111,100,1,100,47,156,1,100,48,100,49,132,3, + 90,51,100,50,100,51,132,0,90,52,100,52,100,53,132,0, + 90,53,100,54,100,55,132,0,90,54,100,56,100,57,132,0, + 90,55,100,58,100,59,132,0,90,56,100,60,100,61,132,0, + 90,57,100,62,100,63,132,0,90,58,100,64,100,65,132,0, + 90,59,100,66,100,67,132,0,90,60,100,112,100,68,100,69, + 132,1,90,61,100,113,100,70,100,71,132,1,90,62,100,114, + 100,73,100,74,132,1,90,63,100,75,100,76,132,0,90,64, + 101,65,131,0,90,66,100,115,100,1,101,66,100,77,156,2, + 100,78,100,79,132,3,90,67,71,0,100,80,100,81,132,0, + 100,81,131,2,90,68,71,0,100,82,100,83,132,0,100,83, + 131,2,90,69,71,0,100,84,100,85,132,0,100,85,101,69, + 131,3,90,70,71,0,100,86,100,87,132,0,100,87,131,2, + 90,71,71,0,100,88,100,89,132,0,100,89,101,71,101,70, + 131,4,90,72,71,0,100,90,100,91,132,0,100,91,101,71, + 101,69,131,4,90,73,71,0,100,92,100,93,132,0,100,93, + 101,71,101,69,131,4,90,74,71,0,100,94,100,95,132,0, + 100,95,131,2,90,75,71,0,100,96,100,97,132,0,100,97, + 131,2,90,76,71,0,100,98,100,99,132,0,100,99,131,2, + 90,77,71,0,100,100,100,101,132,0,100,101,131,2,90,78, + 100,116,100,102,100,103,132,1,90,79,100,104,100,105,132,0, + 90,80,100,106,100,107,132,0,90,81,100,108,100,109,132,0, + 90,82,100,1,83,0,41,117,97,94,1,0,0,67,111,114, + 101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110, + 32,111,102,32,112,97,116,104,45,98,97,115,101,100,32,105, + 109,112,111,114,116,46,10,10,84,104,105,115,32,109,111,100, + 117,108,101,32,105,115,32,78,79,84,32,109,101,97,110,116, + 32,116,111,32,98,101,32,100,105,114,101,99,116,108,121,32, + 105,109,112,111,114,116,101,100,33,32,73,116,32,104,97,115, + 32,98,101,101,110,32,100,101,115,105,103,110,101,100,32,115, + 117,99,104,10,116,104,97,116,32,105,116,32,99,97,110,32, + 98,101,32,98,111,111,116,115,116,114,97,112,112,101,100,32, + 105,110,116,111,32,80,121,116,104,111,110,32,97,115,32,116, + 104,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, + 110,32,111,102,32,105,109,112,111,114,116,46,32,65,115,10, + 115,117,99,104,32,105,116,32,114,101,113,117,105,114,101,115, + 32,116,104,101,32,105,110,106,101,99,116,105,111,110,32,111, + 102,32,115,112,101,99,105,102,105,99,32,109,111,100,117,108, + 101,115,32,97,110,100,32,97,116,116,114,105,98,117,116,101, + 115,32,105,110,32,111,114,100,101,114,32,116,111,10,119,111, + 114,107,46,32,79,110,101,32,115,104,111,117,108,100,32,117, + 115,101,32,105,109,112,111,114,116,108,105,98,32,97,115,32, + 116,104,101,32,112,117,98,108,105,99,45,102,97,99,105,110, + 103,32,118,101,114,115,105,111,110,32,111,102,32,116,104,105, + 115,32,109,111,100,117,108,101,46,10,10,78,233,0,0,0, + 0,90,5,119,105,110,51,50,250,1,92,250,1,47,99,1, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, + 0,0,0,99,0,0,0,115,26,0,0,0,124,0,93,18, + 125,1,116,0,124,1,131,1,100,0,107,2,86,0,1,0, + 113,2,100,1,83,0,41,2,233,1,0,0,0,78,41,1, + 218,3,108,101,110,41,2,218,2,46,48,218,3,115,101,112, + 169,0,114,7,0,0,0,250,38,60,102,114,111,122,101,110, + 32,105,109,112,111,114,116,108,105,98,46,95,98,111,111,116, + 115,116,114,97,112,95,101,120,116,101,114,110,97,108,62,218, + 9,60,103,101,110,101,120,112,114,62,46,0,0,0,115,4, + 0,0,0,26,0,255,128,114,9,0,0,0,218,0,99,1, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,67,0,0,0,115,22,0,0,0,104,0,124,0, + 93,14,125,1,100,0,124,1,155,0,157,2,146,2,113,4, + 83,0,41,1,250,1,58,114,7,0,0,0,41,2,114,5, + 0,0,0,218,1,115,114,7,0,0,0,114,7,0,0,0, + 114,8,0,0,0,218,9,60,115,101,116,99,111,109,112,62, + 49,0,0,0,115,4,0,0,0,22,0,255,128,114,13,0, + 0,0,41,1,218,3,119,105,110,41,2,90,6,99,121,103, + 119,105,110,90,6,100,97,114,119,105,110,99,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0, - 67,0,0,0,115,10,0,0,0,116,0,160,1,124,0,161, - 1,83,0,41,1,122,126,83,116,97,116,32,116,104,101,32, - 112,97,116,104,46,10,10,32,32,32,32,77,97,100,101,32, - 97,32,115,101,112,97,114,97,116,101,32,102,117,110,99,116, - 105,111,110,32,116,111,32,109,97,107,101,32,105,116,32,101, - 97,115,105,101,114,32,116,111,32,111,118,101,114,114,105,100, - 101,32,105,110,32,101,120,112,101,114,105,109,101,110,116,115, - 10,32,32,32,32,40,101,46,103,46,32,99,97,99,104,101, - 32,115,116,97,116,32,114,101,115,117,108,116,115,41,46,10, - 10,32,32,32,32,41,2,114,4,0,0,0,90,4,115,116, - 97,116,169,1,114,44,0,0,0,114,5,0,0,0,114,5, + 3,0,0,0,115,62,0,0,0,116,0,106,1,160,2,116, + 3,161,1,114,50,116,0,106,1,160,2,116,4,161,1,114, + 30,100,1,137,0,110,4,100,2,137,0,135,0,102,1,100, + 3,100,4,132,8,125,0,124,0,83,0,100,5,100,4,132, + 0,125,0,124,0,83,0,41,6,78,90,12,80,89,84,72, + 79,78,67,65,83,69,79,75,115,12,0,0,0,80,89,84, + 72,79,78,67,65,83,69,79,75,99,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,19,0, + 0,0,115,20,0,0,0,116,0,106,1,106,2,12,0,111, + 18,136,0,116,3,106,4,118,0,83,0,41,2,122,94,84, + 114,117,101,32,105,102,32,102,105,108,101,110,97,109,101,115, + 32,109,117,115,116,32,98,101,32,99,104,101,99,107,101,100, + 32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118, + 101,108,121,32,97,110,100,32,105,103,110,111,114,101,32,101, + 110,118,105,114,111,110,109,101,110,116,32,102,108,97,103,115, + 32,97,114,101,32,110,111,116,32,115,101,116,46,78,41,5, + 218,3,115,121,115,218,5,102,108,97,103,115,218,18,105,103, + 110,111,114,101,95,101,110,118,105,114,111,110,109,101,110,116, + 218,3,95,111,115,90,7,101,110,118,105,114,111,110,114,7, + 0,0,0,169,1,218,3,107,101,121,114,7,0,0,0,114, + 8,0,0,0,218,11,95,114,101,108,97,120,95,99,97,115, + 101,66,0,0,0,115,4,0,0,0,20,2,255,128,122,37, + 95,109,97,107,101,95,114,101,108,97,120,95,99,97,115,101, + 46,60,108,111,99,97,108,115,62,46,95,114,101,108,97,120, + 95,99,97,115,101,99,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,83,0,0,0,115,4, + 0,0,0,100,1,83,0,41,3,122,53,84,114,117,101,32, + 105,102,32,102,105,108,101,110,97,109,101,115,32,109,117,115, + 116,32,98,101,32,99,104,101,99,107,101,100,32,99,97,115, + 101,45,105,110,115,101,110,115,105,116,105,118,101,108,121,46, + 70,78,114,7,0,0,0,114,7,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,114,21,0,0,0, + 70,0,0,0,115,4,0,0,0,4,2,255,128,41,5,114, + 15,0,0,0,218,8,112,108,97,116,102,111,114,109,218,10, + 115,116,97,114,116,115,119,105,116,104,218,27,95,67,65,83, + 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, + 65,84,70,79,82,77,83,218,35,95,67,65,83,69,95,73, + 78,83,69,78,83,73,84,73,86,69,95,80,76,65,84,70, + 79,82,77,83,95,83,84,82,95,75,69,89,41,1,114,21, + 0,0,0,114,7,0,0,0,114,19,0,0,0,114,8,0, + 0,0,218,16,95,109,97,107,101,95,114,101,108,97,120,95, + 99,97,115,101,59,0,0,0,115,18,0,0,0,12,1,12, + 1,6,1,4,2,12,2,4,7,8,253,4,3,255,128,114, + 26,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, + 0,1,0,0,0,4,0,0,0,67,0,0,0,115,20,0, + 0,0,116,0,124,0,131,1,100,1,64,0,160,1,100,2, + 100,3,161,2,83,0,41,5,122,42,67,111,110,118,101,114, + 116,32,97,32,51,50,45,98,105,116,32,105,110,116,101,103, + 101,114,32,116,111,32,108,105,116,116,108,101,45,101,110,100, + 105,97,110,46,236,3,0,0,0,255,127,255,127,3,0,233, + 4,0,0,0,218,6,108,105,116,116,108,101,78,41,2,218, + 3,105,110,116,218,8,116,111,95,98,121,116,101,115,41,1, + 218,1,120,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,218,12,95,112,97,99,107,95,117,105,110,116,51,50, + 78,0,0,0,115,4,0,0,0,20,2,255,128,114,33,0, + 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,1, + 0,0,0,4,0,0,0,67,0,0,0,115,28,0,0,0, + 116,0,124,0,131,1,100,1,107,2,115,16,74,0,130,1, + 116,1,160,2,124,0,100,2,161,2,83,0,41,4,122,47, + 67,111,110,118,101,114,116,32,52,32,98,121,116,101,115,32, + 105,110,32,108,105,116,116,108,101,45,101,110,100,105,97,110, + 32,116,111,32,97,110,32,105,110,116,101,103,101,114,46,114, + 28,0,0,0,114,29,0,0,0,78,169,3,114,4,0,0, + 0,114,30,0,0,0,218,10,102,114,111,109,95,98,121,116, + 101,115,169,1,218,4,100,97,116,97,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,218,14,95,117,110,112,97, + 99,107,95,117,105,110,116,51,50,83,0,0,0,115,6,0, + 0,0,16,2,12,1,255,128,114,38,0,0,0,99,1,0, + 0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0, + 0,0,67,0,0,0,115,28,0,0,0,116,0,124,0,131, + 1,100,1,107,2,115,16,74,0,130,1,116,1,160,2,124, + 0,100,2,161,2,83,0,41,4,122,47,67,111,110,118,101, + 114,116,32,50,32,98,121,116,101,115,32,105,110,32,108,105, + 116,116,108,101,45,101,110,100,105,97,110,32,116,111,32,97, + 110,32,105,110,116,101,103,101,114,46,233,2,0,0,0,114, + 29,0,0,0,78,114,34,0,0,0,114,36,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,14, + 95,117,110,112,97,99,107,95,117,105,110,116,49,54,88,0, + 0,0,115,6,0,0,0,16,2,12,1,255,128,114,40,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,1, + 0,0,0,4,0,0,0,71,0,0,0,115,20,0,0,0, + 116,0,160,1,100,1,100,2,132,0,124,0,68,0,131,1, + 161,1,83,0,41,4,122,31,82,101,112,108,97,99,101,109, + 101,110,116,32,102,111,114,32,111,115,46,112,97,116,104,46, + 106,111,105,110,40,41,46,99,1,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,5,0,0,0,83,0,0,0, + 115,26,0,0,0,103,0,124,0,93,18,125,1,124,1,114, + 4,124,1,160,0,116,1,161,1,145,2,113,4,83,0,114, + 7,0,0,0,41,2,218,6,114,115,116,114,105,112,218,15, + 112,97,116,104,95,115,101,112,97,114,97,116,111,114,115,41, + 2,114,5,0,0,0,218,4,112,97,114,116,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,10,60,108,105, + 115,116,99,111,109,112,62,96,0,0,0,115,8,0,0,0, + 6,0,6,1,14,255,255,128,122,30,95,112,97,116,104,95, + 106,111,105,110,46,60,108,111,99,97,108,115,62,46,60,108, + 105,115,116,99,111,109,112,62,78,41,2,218,8,112,97,116, + 104,95,115,101,112,218,4,106,111,105,110,41,1,218,10,112, + 97,116,104,95,112,97,114,116,115,114,7,0,0,0,114,7, 0,0,0,114,8,0,0,0,218,10,95,112,97,116,104,95, - 115,116,97,116,80,0,0,0,115,4,0,0,0,10,7,255, - 128,114,49,0,0,0,99,2,0,0,0,0,0,0,0,0, - 0,0,0,3,0,0,0,8,0,0,0,67,0,0,0,115, - 48,0,0,0,122,12,116,0,124,0,131,1,125,2,87,0, - 110,20,4,0,116,1,121,32,1,0,1,0,1,0,89,0, - 100,1,83,0,48,0,124,2,106,2,100,2,64,0,124,1, - 107,2,83,0,41,3,122,49,84,101,115,116,32,119,104,101, - 116,104,101,114,32,116,104,101,32,112,97,116,104,32,105,115, - 32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109, - 111,100,101,32,116,121,112,101,46,70,105,0,240,0,0,41, - 3,114,49,0,0,0,218,7,79,83,69,114,114,111,114,218, - 7,115,116,95,109,111,100,101,41,3,114,44,0,0,0,218, + 106,111,105,110,94,0,0,0,115,8,0,0,0,10,2,2, + 1,8,255,255,128,114,48,0,0,0,99,1,0,0,0,0, + 0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,67, + 0,0,0,115,94,0,0,0,116,0,116,1,131,1,100,1, + 107,2,114,36,124,0,160,2,116,3,161,1,92,3,125,1, + 125,2,125,3,124,1,124,3,102,2,83,0,116,4,124,0, + 131,1,68,0,93,40,125,4,124,4,116,1,118,0,114,44, + 124,0,106,5,124,4,100,1,100,2,141,2,92,2,125,1, + 125,3,124,1,124,3,102,2,2,0,1,0,83,0,100,3, + 124,0,102,2,83,0,41,5,122,32,82,101,112,108,97,99, + 101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,116, + 104,46,115,112,108,105,116,40,41,46,114,3,0,0,0,41, + 1,90,8,109,97,120,115,112,108,105,116,114,10,0,0,0, + 78,41,6,114,4,0,0,0,114,42,0,0,0,218,10,114, + 112,97,114,116,105,116,105,111,110,114,45,0,0,0,218,8, + 114,101,118,101,114,115,101,100,218,6,114,115,112,108,105,116, + 41,5,218,4,112,97,116,104,90,5,102,114,111,110,116,218, + 1,95,218,4,116,97,105,108,114,32,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,218,11,95,112, + 97,116,104,95,115,112,108,105,116,100,0,0,0,115,18,0, + 0,0,12,2,16,1,8,1,12,1,8,1,18,1,12,1, + 8,1,255,128,114,55,0,0,0,99,1,0,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, + 0,0,115,10,0,0,0,116,0,160,1,124,0,161,1,83, + 0,41,2,122,126,83,116,97,116,32,116,104,101,32,112,97, + 116,104,46,10,10,32,32,32,32,77,97,100,101,32,97,32, + 115,101,112,97,114,97,116,101,32,102,117,110,99,116,105,111, + 110,32,116,111,32,109,97,107,101,32,105,116,32,101,97,115, + 105,101,114,32,116,111,32,111,118,101,114,114,105,100,101,32, + 105,110,32,101,120,112,101,114,105,109,101,110,116,115,10,32, + 32,32,32,40,101,46,103,46,32,99,97,99,104,101,32,115, + 116,97,116,32,114,101,115,117,108,116,115,41,46,10,10,32, + 32,32,32,78,41,2,114,18,0,0,0,90,4,115,116,97, + 116,169,1,114,52,0,0,0,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,218,10,95,112,97,116,104,95,115, + 116,97,116,112,0,0,0,115,4,0,0,0,10,7,255,128, + 114,57,0,0,0,99,2,0,0,0,0,0,0,0,0,0, + 0,0,3,0,0,0,8,0,0,0,67,0,0,0,115,48, + 0,0,0,122,12,116,0,124,0,131,1,125,2,87,0,110, + 20,4,0,116,1,121,32,1,0,1,0,1,0,89,0,100, + 1,83,0,48,0,124,2,106,2,100,2,64,0,124,1,107, + 2,83,0,41,4,122,49,84,101,115,116,32,119,104,101,116, + 104,101,114,32,116,104,101,32,112,97,116,104,32,105,115,32, + 116,104,101,32,115,112,101,99,105,102,105,101,100,32,109,111, + 100,101,32,116,121,112,101,46,70,105,0,240,0,0,78,41, + 3,114,57,0,0,0,218,7,79,83,69,114,114,111,114,218, + 7,115,116,95,109,111,100,101,41,3,114,52,0,0,0,218, 4,109,111,100,101,90,9,115,116,97,116,95,105,110,102,111, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218, 18,95,112,97,116,104,95,105,115,95,109,111,100,101,95,116, - 121,112,101,90,0,0,0,115,12,0,0,0,2,2,12,1, - 12,1,8,1,14,1,255,128,114,53,0,0,0,99,1,0, + 121,112,101,122,0,0,0,115,12,0,0,0,2,2,12,1, + 12,1,8,1,14,1,255,128,114,61,0,0,0,99,1,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0, 0,0,67,0,0,0,115,10,0,0,0,116,0,124,0,100, - 1,131,2,83,0,41,2,122,31,82,101,112,108,97,99,101, + 1,131,2,83,0,41,3,122,31,82,101,112,108,97,99,101, 109,101,110,116,32,102,111,114,32,111,115,46,112,97,116,104, - 46,105,115,102,105,108,101,46,105,0,128,0,0,41,1,114, - 53,0,0,0,114,48,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,12,95,112,97,116,104,95, - 105,115,102,105,108,101,99,0,0,0,115,4,0,0,0,10, - 2,255,128,114,54,0,0,0,99,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, - 0,115,22,0,0,0,124,0,115,12,116,0,160,1,161,0, - 125,0,116,2,124,0,100,1,131,2,83,0,41,2,122,30, - 82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32, - 111,115,46,112,97,116,104,46,105,115,100,105,114,46,105,0, - 64,0,0,41,3,114,4,0,0,0,218,6,103,101,116,99, - 119,100,114,53,0,0,0,114,48,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,218,11,95,112,97, - 116,104,95,105,115,100,105,114,104,0,0,0,115,8,0,0, - 0,4,2,8,1,10,1,255,128,114,56,0,0,0,99,1, - 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, - 0,0,0,67,0,0,0,115,26,0,0,0,124,0,160,0, - 116,1,161,1,112,24,124,0,100,1,100,2,133,2,25,0, - 116,2,118,0,83,0,41,3,122,142,82,101,112,108,97,99, - 101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,116, - 104,46,105,115,97,98,115,46,10,10,32,32,32,32,67,111, - 110,115,105,100,101,114,115,32,97,32,87,105,110,100,111,119, - 115,32,100,114,105,118,101,45,114,101,108,97,116,105,118,101, - 32,112,97,116,104,32,40,110,111,32,100,114,105,118,101,44, - 32,98,117,116,32,115,116,97,114,116,115,32,119,105,116,104, - 32,115,108,97,115,104,41,32,116,111,10,32,32,32,32,115, - 116,105,108,108,32,98,101,32,34,97,98,115,111,108,117,116, - 101,34,46,10,32,32,32,32,114,39,0,0,0,233,3,0, - 0,0,41,3,114,11,0,0,0,114,31,0,0,0,218,20, - 95,112,97,116,104,115,101,112,115,95,119,105,116,104,95,99, - 111,108,111,110,114,48,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,11,95,112,97,116,104,95, - 105,115,97,98,115,111,0,0,0,115,4,0,0,0,26,6, - 255,128,114,59,0,0,0,233,182,1,0,0,99,3,0,0, - 0,0,0,0,0,0,0,0,0,6,0,0,0,11,0,0, - 0,67,0,0,0,115,172,0,0,0,100,1,160,0,124,0, - 116,1,124,0,131,1,161,2,125,3,116,2,160,3,124,3, - 116,2,106,4,116,2,106,5,66,0,116,2,106,6,66,0, - 124,2,100,2,64,0,161,3,125,4,122,70,116,7,160,8, - 124,4,100,3,161,2,143,26,125,5,124,5,160,9,124,1, - 161,1,1,0,87,0,100,4,4,0,4,0,131,3,1,0, - 110,16,49,0,115,94,48,0,1,0,1,0,1,0,89,0, - 1,0,116,2,160,10,124,3,124,0,161,2,1,0,87,0, - 110,48,4,0,116,11,121,166,1,0,1,0,1,0,122,14, - 116,2,160,12,124,3,161,1,1,0,87,0,130,0,4,0, - 116,11,121,164,1,0,1,0,1,0,89,0,130,0,48,0, - 48,0,100,4,83,0,41,5,122,162,66,101,115,116,45,101, - 102,102,111,114,116,32,102,117,110,99,116,105,111,110,32,116, - 111,32,119,114,105,116,101,32,100,97,116,97,32,116,111,32, - 97,32,112,97,116,104,32,97,116,111,109,105,99,97,108,108, - 121,46,10,32,32,32,32,66,101,32,112,114,101,112,97,114, - 101,100,32,116,111,32,104,97,110,100,108,101,32,97,32,70, - 105,108,101,69,120,105,115,116,115,69,114,114,111,114,32,105, - 102,32,99,111,110,99,117,114,114,101,110,116,32,119,114,105, - 116,105,110,103,32,111,102,32,116,104,101,10,32,32,32,32, - 116,101,109,112,111,114,97,114,121,32,102,105,108,101,32,105, - 115,32,97,116,116,101,109,112,116,101,100,46,250,5,123,125, - 46,123,125,114,60,0,0,0,90,2,119,98,78,41,13,218, - 6,102,111,114,109,97,116,218,2,105,100,114,4,0,0,0, - 90,4,111,112,101,110,90,6,79,95,69,88,67,76,90,7, - 79,95,67,82,69,65,84,90,8,79,95,87,82,79,78,76, - 89,218,3,95,105,111,218,6,70,105,108,101,73,79,218,5, - 119,114,105,116,101,218,7,114,101,112,108,97,99,101,114,50, - 0,0,0,90,6,117,110,108,105,110,107,41,6,114,44,0, - 0,0,114,26,0,0,0,114,52,0,0,0,90,8,112,97, - 116,104,95,116,109,112,90,2,102,100,218,4,102,105,108,101, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 13,95,119,114,105,116,101,95,97,116,111,109,105,99,120,0, - 0,0,115,32,0,0,0,16,5,6,1,22,1,4,255,2, - 2,14,3,40,1,16,1,12,1,2,1,14,1,12,1,6, - 1,2,1,4,128,255,128,114,69,0,0,0,105,104,13,0, - 0,114,28,0,0,0,114,17,0,0,0,115,2,0,0,0, - 13,10,90,11,95,95,112,121,99,97,99,104,101,95,95,122, - 4,111,112,116,45,122,3,46,112,121,122,4,46,112,121,99, - 78,41,1,218,12,111,112,116,105,109,105,122,97,116,105,111, - 110,99,2,0,0,0,0,0,0,0,1,0,0,0,12,0, - 0,0,5,0,0,0,67,0,0,0,115,88,1,0,0,124, - 1,100,1,117,1,114,52,116,0,160,1,100,2,116,2,161, - 2,1,0,124,2,100,1,117,1,114,40,100,3,125,3,116, - 3,124,3,131,1,130,1,124,1,114,48,100,4,110,2,100, - 5,125,2,116,4,160,5,124,0,161,1,125,0,116,6,124, - 0,131,1,92,2,125,4,125,5,124,5,160,7,100,6,161, - 1,92,3,125,6,125,7,125,8,116,8,106,9,106,10,125, - 9,124,9,100,1,117,0,114,114,116,11,100,7,131,1,130, - 1,100,4,160,12,124,6,114,126,124,6,110,2,124,8,124, - 7,124,9,103,3,161,1,125,10,124,2,100,1,117,0,114, - 172,116,8,106,13,106,14,100,8,107,2,114,164,100,4,125, - 2,110,8,116,8,106,13,106,14,125,2,116,15,124,2,131, - 1,125,2,124,2,100,4,107,3,114,224,124,2,160,16,161, - 0,115,210,116,17,100,9,160,18,124,2,161,1,131,1,130, - 1,100,10,160,18,124,10,116,19,124,2,161,3,125,10,124, - 10,116,20,100,8,25,0,23,0,125,11,116,8,106,21,100, - 1,117,1,144,1,114,76,116,22,124,4,131,1,144,1,115, - 16,116,23,116,4,160,24,161,0,124,4,131,2,125,4,124, - 4,100,5,25,0,100,11,107,2,144,1,114,56,124,4,100, - 8,25,0,116,25,118,1,144,1,114,56,124,4,100,12,100, - 1,133,2,25,0,125,4,116,23,116,8,106,21,124,4,160, - 26,116,25,161,1,124,11,131,3,83,0,116,23,124,4,116, - 27,124,11,131,3,83,0,41,13,97,254,2,0,0,71,105, - 118,101,110,32,116,104,101,32,112,97,116,104,32,116,111,32, - 97,32,46,112,121,32,102,105,108,101,44,32,114,101,116,117, - 114,110,32,116,104,101,32,112,97,116,104,32,116,111,32,105, - 116,115,32,46,112,121,99,32,102,105,108,101,46,10,10,32, - 32,32,32,84,104,101,32,46,112,121,32,102,105,108,101,32, - 100,111,101,115,32,110,111,116,32,110,101,101,100,32,116,111, - 32,101,120,105,115,116,59,32,116,104,105,115,32,115,105,109, - 112,108,121,32,114,101,116,117,114,110,115,32,116,104,101,32, - 112,97,116,104,32,116,111,32,116,104,101,10,32,32,32,32, - 46,112,121,99,32,102,105,108,101,32,99,97,108,99,117,108, - 97,116,101,100,32,97,115,32,105,102,32,116,104,101,32,46, - 112,121,32,102,105,108,101,32,119,101,114,101,32,105,109,112, - 111,114,116,101,100,46,10,10,32,32,32,32,84,104,101,32, - 39,111,112,116,105,109,105,122,97,116,105,111,110,39,32,112, - 97,114,97,109,101,116,101,114,32,99,111,110,116,114,111,108, - 115,32,116,104,101,32,112,114,101,115,117,109,101,100,32,111, - 112,116,105,109,105,122,97,116,105,111,110,32,108,101,118,101, - 108,32,111,102,10,32,32,32,32,116,104,101,32,98,121,116, - 101,99,111,100,101,32,102,105,108,101,46,32,73,102,32,39, - 111,112,116,105,109,105,122,97,116,105,111,110,39,32,105,115, - 32,110,111,116,32,78,111,110,101,44,32,116,104,101,32,115, - 116,114,105,110,103,32,114,101,112,114,101,115,101,110,116,97, - 116,105,111,110,10,32,32,32,32,111,102,32,116,104,101,32, - 97,114,103,117,109,101,110,116,32,105,115,32,116,97,107,101, - 110,32,97,110,100,32,118,101,114,105,102,105,101,100,32,116, - 111,32,98,101,32,97,108,112,104,97,110,117,109,101,114,105, - 99,32,40,101,108,115,101,32,86,97,108,117,101,69,114,114, - 111,114,10,32,32,32,32,105,115,32,114,97,105,115,101,100, - 41,46,10,10,32,32,32,32,84,104,101,32,100,101,98,117, - 103,95,111,118,101,114,114,105,100,101,32,112,97,114,97,109, - 101,116,101,114,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,73,102,32,100,101,98,117,103,95,111,118,101, - 114,114,105,100,101,32,105,115,32,110,111,116,32,78,111,110, - 101,44,10,32,32,32,32,97,32,84,114,117,101,32,118,97, - 108,117,101,32,105,115,32,116,104,101,32,115,97,109,101,32, - 97,115,32,115,101,116,116,105,110,103,32,39,111,112,116,105, - 109,105,122,97,116,105,111,110,39,32,116,111,32,116,104,101, - 32,101,109,112,116,121,32,115,116,114,105,110,103,10,32,32, - 32,32,119,104,105,108,101,32,97,32,70,97,108,115,101,32, - 118,97,108,117,101,32,105,115,32,101,113,117,105,118,97,108, - 101,110,116,32,116,111,32,115,101,116,116,105,110,103,32,39, - 111,112,116,105,109,105,122,97,116,105,111,110,39,32,116,111, - 32,39,49,39,46,10,10,32,32,32,32,73,102,32,115,121, - 115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,110, - 46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,111, - 110,101,32,116,104,101,110,32,78,111,116,73,109,112,108,101, - 109,101,110,116,101,100,69,114,114,111,114,32,105,115,32,114, - 97,105,115,101,100,46,10,10,32,32,32,32,78,122,70,116, - 104,101,32,100,101,98,117,103,95,111,118,101,114,114,105,100, - 101,32,112,97,114,97,109,101,116,101,114,32,105,115,32,100, - 101,112,114,101,99,97,116,101,100,59,32,117,115,101,32,39, - 111,112,116,105,109,105,122,97,116,105,111,110,39,32,105,110, - 115,116,101,97,100,122,50,100,101,98,117,103,95,111,118,101, - 114,114,105,100,101,32,111,114,32,111,112,116,105,109,105,122, - 97,116,105,111,110,32,109,117,115,116,32,98,101,32,115,101, - 116,32,116,111,32,78,111,110,101,114,40,0,0,0,114,39, - 0,0,0,218,1,46,250,36,115,121,115,46,105,109,112,108, + 46,105,115,102,105,108,101,46,105,0,128,0,0,78,41,1, + 114,61,0,0,0,114,56,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,218,12,95,112,97,116,104, + 95,105,115,102,105,108,101,131,0,0,0,115,4,0,0,0, + 10,2,255,128,114,62,0,0,0,99,1,0,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, + 0,0,115,22,0,0,0,124,0,115,12,116,0,160,1,161, + 0,125,0,116,2,124,0,100,1,131,2,83,0,41,3,122, + 30,82,101,112,108,97,99,101,109,101,110,116,32,102,111,114, + 32,111,115,46,112,97,116,104,46,105,115,100,105,114,46,105, + 0,64,0,0,78,41,3,114,18,0,0,0,218,6,103,101, + 116,99,119,100,114,61,0,0,0,114,56,0,0,0,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,218,11,95, + 112,97,116,104,95,105,115,100,105,114,136,0,0,0,115,8, + 0,0,0,4,2,8,1,10,1,255,128,114,64,0,0,0, + 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,67,0,0,0,115,26,0,0,0,124,0, + 160,0,116,1,161,1,112,24,124,0,100,1,100,2,133,2, + 25,0,116,2,118,0,83,0,41,4,122,142,82,101,112,108, + 97,99,101,109,101,110,116,32,102,111,114,32,111,115,46,112, + 97,116,104,46,105,115,97,98,115,46,10,10,32,32,32,32, + 67,111,110,115,105,100,101,114,115,32,97,32,87,105,110,100, + 111,119,115,32,100,114,105,118,101,45,114,101,108,97,116,105, + 118,101,32,112,97,116,104,32,40,110,111,32,100,114,105,118, + 101,44,32,98,117,116,32,115,116,97,114,116,115,32,119,105, + 116,104,32,115,108,97,115,104,41,32,116,111,10,32,32,32, + 32,115,116,105,108,108,32,98,101,32,34,97,98,115,111,108, + 117,116,101,34,46,10,32,32,32,32,114,3,0,0,0,233, + 3,0,0,0,78,41,3,114,23,0,0,0,114,42,0,0, + 0,218,20,95,112,97,116,104,115,101,112,115,95,119,105,116, + 104,95,99,111,108,111,110,114,56,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,11,95,112,97, + 116,104,95,105,115,97,98,115,143,0,0,0,115,4,0,0, + 0,26,6,255,128,114,67,0,0,0,233,182,1,0,0,99, + 3,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0, + 11,0,0,0,67,0,0,0,115,170,0,0,0,100,1,160, + 0,124,0,116,1,124,0,131,1,161,2,125,3,116,2,160, + 3,124,3,116,2,106,4,116,2,106,5,66,0,116,2,106, + 6,66,0,124,2,100,2,64,0,161,3,125,4,122,72,116, + 7,160,8,124,4,100,3,161,2,143,26,125,5,124,5,160, + 9,124,1,161,1,1,0,87,0,100,4,4,0,4,0,131, + 3,1,0,110,16,49,0,115,94,48,0,1,0,1,0,1, + 0,89,0,1,0,116,2,160,10,124,3,124,0,161,2,1, + 0,87,0,100,4,83,0,4,0,116,11,121,168,1,0,1, + 0,1,0,122,14,116,2,160,12,124,3,161,1,1,0,87, + 0,130,0,4,0,116,11,121,166,1,0,1,0,1,0,89, + 0,130,0,48,0,48,0,41,5,122,162,66,101,115,116,45, + 101,102,102,111,114,116,32,102,117,110,99,116,105,111,110,32, + 116,111,32,119,114,105,116,101,32,100,97,116,97,32,116,111, + 32,97,32,112,97,116,104,32,97,116,111,109,105,99,97,108, + 108,121,46,10,32,32,32,32,66,101,32,112,114,101,112,97, + 114,101,100,32,116,111,32,104,97,110,100,108,101,32,97,32, + 70,105,108,101,69,120,105,115,116,115,69,114,114,111,114,32, + 105,102,32,99,111,110,99,117,114,114,101,110,116,32,119,114, + 105,116,105,110,103,32,111,102,32,116,104,101,10,32,32,32, + 32,116,101,109,112,111,114,97,114,121,32,102,105,108,101,32, + 105,115,32,97,116,116,101,109,112,116,101,100,46,250,5,123, + 125,46,123,125,114,68,0,0,0,90,2,119,98,78,41,13, + 218,6,102,111,114,109,97,116,218,2,105,100,114,18,0,0, + 0,90,4,111,112,101,110,90,6,79,95,69,88,67,76,90, + 7,79,95,67,82,69,65,84,90,8,79,95,87,82,79,78, + 76,89,218,3,95,105,111,218,6,70,105,108,101,73,79,218, + 5,119,114,105,116,101,218,7,114,101,112,108,97,99,101,114, + 58,0,0,0,90,6,117,110,108,105,110,107,41,6,114,52, + 0,0,0,114,37,0,0,0,114,60,0,0,0,90,8,112, + 97,116,104,95,116,109,112,90,2,102,100,218,4,102,105,108, + 101,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0, + 218,13,95,119,114,105,116,101,95,97,116,111,109,105,99,152, + 0,0,0,115,36,0,0,0,16,5,6,1,22,1,4,255, + 2,2,14,3,40,1,18,1,12,1,2,1,12,1,2,3, + 12,254,2,1,2,1,2,255,2,1,255,128,114,77,0,0, + 0,105,105,13,0,0,114,39,0,0,0,114,29,0,0,0, + 115,2,0,0,0,13,10,90,11,95,95,112,121,99,97,99, + 104,101,95,95,122,4,111,112,116,45,122,3,46,112,121,122, + 4,46,112,121,119,122,4,46,112,121,99,41,1,218,12,111, + 112,116,105,109,105,122,97,116,105,111,110,99,2,0,0,0, + 0,0,0,0,1,0,0,0,12,0,0,0,5,0,0,0, + 67,0,0,0,115,88,1,0,0,124,1,100,1,117,1,114, + 52,116,0,160,1,100,2,116,2,161,2,1,0,124,2,100, + 1,117,1,114,40,100,3,125,3,116,3,124,3,131,1,130, + 1,124,1,114,48,100,4,110,2,100,5,125,2,116,4,160, + 5,124,0,161,1,125,0,116,6,124,0,131,1,92,2,125, + 4,125,5,124,5,160,7,100,6,161,1,92,3,125,6,125, + 7,125,8,116,8,106,9,106,10,125,9,124,9,100,1,117, + 0,114,114,116,11,100,7,131,1,130,1,100,4,160,12,124, + 6,114,126,124,6,110,2,124,8,124,7,124,9,103,3,161, + 1,125,10,124,2,100,1,117,0,114,172,116,8,106,13,106, + 14,100,8,107,2,114,164,100,4,125,2,110,8,116,8,106, + 13,106,14,125,2,116,15,124,2,131,1,125,2,124,2,100, + 4,107,3,114,224,124,2,160,16,161,0,115,210,116,17,100, + 9,160,18,124,2,161,1,131,1,130,1,100,10,160,18,124, + 10,116,19,124,2,161,3,125,10,124,10,116,20,100,8,25, + 0,23,0,125,11,116,8,106,21,100,1,117,1,144,1,114, + 76,116,22,124,4,131,1,144,1,115,16,116,23,116,4,160, + 24,161,0,124,4,131,2,125,4,124,4,100,5,25,0,100, + 11,107,2,144,1,114,56,124,4,100,8,25,0,116,25,118, + 1,144,1,114,56,124,4,100,12,100,1,133,2,25,0,125, + 4,116,23,116,8,106,21,124,4,160,26,116,25,161,1,124, + 11,131,3,83,0,116,23,124,4,116,27,124,11,131,3,83, + 0,41,13,97,254,2,0,0,71,105,118,101,110,32,116,104, + 101,32,112,97,116,104,32,116,111,32,97,32,46,112,121,32, + 102,105,108,101,44,32,114,101,116,117,114,110,32,116,104,101, + 32,112,97,116,104,32,116,111,32,105,116,115,32,46,112,121, + 99,32,102,105,108,101,46,10,10,32,32,32,32,84,104,101, + 32,46,112,121,32,102,105,108,101,32,100,111,101,115,32,110, + 111,116,32,110,101,101,100,32,116,111,32,101,120,105,115,116, + 59,32,116,104,105,115,32,115,105,109,112,108,121,32,114,101, + 116,117,114,110,115,32,116,104,101,32,112,97,116,104,32,116, + 111,32,116,104,101,10,32,32,32,32,46,112,121,99,32,102, + 105,108,101,32,99,97,108,99,117,108,97,116,101,100,32,97, + 115,32,105,102,32,116,104,101,32,46,112,121,32,102,105,108, + 101,32,119,101,114,101,32,105,109,112,111,114,116,101,100,46, + 10,10,32,32,32,32,84,104,101,32,39,111,112,116,105,109, + 105,122,97,116,105,111,110,39,32,112,97,114,97,109,101,116, + 101,114,32,99,111,110,116,114,111,108,115,32,116,104,101,32, + 112,114,101,115,117,109,101,100,32,111,112,116,105,109,105,122, + 97,116,105,111,110,32,108,101,118,101,108,32,111,102,10,32, + 32,32,32,116,104,101,32,98,121,116,101,99,111,100,101,32, + 102,105,108,101,46,32,73,102,32,39,111,112,116,105,109,105, + 122,97,116,105,111,110,39,32,105,115,32,110,111,116,32,78, + 111,110,101,44,32,116,104,101,32,115,116,114,105,110,103,32, + 114,101,112,114,101,115,101,110,116,97,116,105,111,110,10,32, + 32,32,32,111,102,32,116,104,101,32,97,114,103,117,109,101, + 110,116,32,105,115,32,116,97,107,101,110,32,97,110,100,32, + 118,101,114,105,102,105,101,100,32,116,111,32,98,101,32,97, + 108,112,104,97,110,117,109,101,114,105,99,32,40,101,108,115, + 101,32,86,97,108,117,101,69,114,114,111,114,10,32,32,32, + 32,105,115,32,114,97,105,115,101,100,41,46,10,10,32,32, + 32,32,84,104,101,32,100,101,98,117,103,95,111,118,101,114, + 114,105,100,101,32,112,97,114,97,109,101,116,101,114,32,105, + 115,32,100,101,112,114,101,99,97,116,101,100,46,32,73,102, + 32,100,101,98,117,103,95,111,118,101,114,114,105,100,101,32, + 105,115,32,110,111,116,32,78,111,110,101,44,10,32,32,32, + 32,97,32,84,114,117,101,32,118,97,108,117,101,32,105,115, + 32,116,104,101,32,115,97,109,101,32,97,115,32,115,101,116, + 116,105,110,103,32,39,111,112,116,105,109,105,122,97,116,105, + 111,110,39,32,116,111,32,116,104,101,32,101,109,112,116,121, + 32,115,116,114,105,110,103,10,32,32,32,32,119,104,105,108, + 101,32,97,32,70,97,108,115,101,32,118,97,108,117,101,32, + 105,115,32,101,113,117,105,118,97,108,101,110,116,32,116,111, + 32,115,101,116,116,105,110,103,32,39,111,112,116,105,109,105, + 122,97,116,105,111,110,39,32,116,111,32,39,49,39,46,10, + 10,32,32,32,32,73,102,32,115,121,115,46,105,109,112,108, 101,109,101,110,116,97,116,105,111,110,46,99,97,99,104,101, - 95,116,97,103,32,105,115,32,78,111,110,101,233,0,0,0, - 0,122,24,123,33,114,125,32,105,115,32,110,111,116,32,97, - 108,112,104,97,110,117,109,101,114,105,99,122,7,123,125,46, - 123,125,123,125,250,1,58,114,28,0,0,0,41,28,218,9, - 95,119,97,114,110,105,110,103,115,218,4,119,97,114,110,218, - 18,68,101,112,114,101,99,97,116,105,111,110,87,97,114,110, - 105,110,103,218,9,84,121,112,101,69,114,114,111,114,114,4, - 0,0,0,218,6,102,115,112,97,116,104,114,47,0,0,0, - 114,41,0,0,0,114,1,0,0,0,218,14,105,109,112,108, - 101,109,101,110,116,97,116,105,111,110,218,9,99,97,99,104, - 101,95,116,97,103,218,19,78,111,116,73,109,112,108,101,109, - 101,110,116,101,100,69,114,114,111,114,114,36,0,0,0,114, - 2,0,0,0,218,8,111,112,116,105,109,105,122,101,218,3, - 115,116,114,218,7,105,115,97,108,110,117,109,218,10,86,97, - 108,117,101,69,114,114,111,114,114,62,0,0,0,218,4,95, - 79,80,84,218,17,66,89,84,69,67,79,68,69,95,83,85, - 70,70,73,88,69,83,218,14,112,121,99,97,99,104,101,95, - 112,114,101,102,105,120,114,59,0,0,0,114,38,0,0,0, - 114,55,0,0,0,114,31,0,0,0,218,6,108,115,116,114, - 105,112,218,8,95,80,89,67,65,67,72,69,41,12,114,44, - 0,0,0,90,14,100,101,98,117,103,95,111,118,101,114,114, - 105,100,101,114,70,0,0,0,218,7,109,101,115,115,97,103, - 101,218,4,104,101,97,100,114,46,0,0,0,90,4,98,97, - 115,101,218,3,115,101,112,218,4,114,101,115,116,90,3,116, - 97,103,90,15,97,108,109,111,115,116,95,102,105,108,101,110, - 97,109,101,218,8,102,105,108,101,110,97,109,101,114,5,0, - 0,0,114,5,0,0,0,114,8,0,0,0,218,17,99,97, - 99,104,101,95,102,114,111,109,95,115,111,117,114,99,101,48, - 1,0,0,115,74,0,0,0,8,18,6,1,2,1,4,255, - 8,2,4,1,8,1,12,1,10,1,12,1,16,1,8,1, - 8,1,8,1,24,1,8,1,12,1,6,1,8,2,8,1, - 8,1,8,1,14,1,14,1,12,1,12,1,10,9,14,1, - 28,5,12,1,2,4,4,1,8,1,2,1,4,253,12,5, - 255,128,114,97,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,10,0,0,0,5,0,0,0,67,0,0,0, - 115,46,1,0,0,116,0,106,1,106,2,100,1,117,0,114, - 20,116,3,100,2,131,1,130,1,116,4,160,5,124,0,161, - 1,125,0,116,6,124,0,131,1,92,2,125,1,125,2,100, - 3,125,3,116,0,106,7,100,1,117,1,114,102,116,0,106, - 7,160,8,116,9,161,1,125,4,124,1,160,10,124,4,116, - 11,23,0,161,1,114,102,124,1,116,12,124,4,131,1,100, - 1,133,2,25,0,125,1,100,4,125,3,124,3,115,144,116, - 6,124,1,131,1,92,2,125,1,125,5,124,5,116,13,107, - 3,114,144,116,14,116,13,155,0,100,5,124,0,155,2,157, - 3,131,1,130,1,124,2,160,15,100,6,161,1,125,6,124, - 6,100,7,118,1,114,178,116,14,100,8,124,2,155,2,157, - 2,131,1,130,1,110,92,124,6,100,9,107,2,144,1,114, - 14,124,2,160,16,100,6,100,10,161,2,100,11,25,0,125, - 7,124,7,160,10,116,17,161,1,115,228,116,14,100,12,116, - 17,155,2,157,2,131,1,130,1,124,7,116,12,116,17,131, - 1,100,1,133,2,25,0,125,8,124,8,160,18,161,0,144, - 1,115,14,116,14,100,13,124,7,155,2,100,14,157,3,131, - 1,130,1,124,2,160,19,100,6,161,1,100,15,25,0,125, - 9,116,20,124,1,124,9,116,21,100,15,25,0,23,0,131, - 2,83,0,41,16,97,110,1,0,0,71,105,118,101,110,32, - 116,104,101,32,112,97,116,104,32,116,111,32,97,32,46,112, - 121,99,46,32,102,105,108,101,44,32,114,101,116,117,114,110, - 32,116,104,101,32,112,97,116,104,32,116,111,32,105,116,115, - 32,46,112,121,32,102,105,108,101,46,10,10,32,32,32,32, - 84,104,101,32,46,112,121,99,32,102,105,108,101,32,100,111, - 101,115,32,110,111,116,32,110,101,101,100,32,116,111,32,101, - 120,105,115,116,59,32,116,104,105,115,32,115,105,109,112,108, - 121,32,114,101,116,117,114,110,115,32,116,104,101,32,112,97, - 116,104,32,116,111,10,32,32,32,32,116,104,101,32,46,112, - 121,32,102,105,108,101,32,99,97,108,99,117,108,97,116,101, - 100,32,116,111,32,99,111,114,114,101,115,112,111,110,100,32, - 116,111,32,116,104,101,32,46,112,121,99,32,102,105,108,101, - 46,32,32,73,102,32,112,97,116,104,32,100,111,101,115,10, - 32,32,32,32,110,111,116,32,99,111,110,102,111,114,109,32, - 116,111,32,80,69,80,32,51,49,52,55,47,52,56,56,32, - 102,111,114,109,97,116,44,32,86,97,108,117,101,69,114,114, - 111,114,32,119,105,108,108,32,98,101,32,114,97,105,115,101, - 100,46,32,73,102,10,32,32,32,32,115,121,115,46,105,109, - 112,108,101,109,101,110,116,97,116,105,111,110,46,99,97,99, - 104,101,95,116,97,103,32,105,115,32,78,111,110,101,32,116, - 104,101,110,32,78,111,116,73,109,112,108,101,109,101,110,116, - 101,100,69,114,114,111,114,32,105,115,32,114,97,105,115,101, - 100,46,10,10,32,32,32,32,78,114,72,0,0,0,70,84, - 122,31,32,110,111,116,32,98,111,116,116,111,109,45,108,101, - 118,101,108,32,100,105,114,101,99,116,111,114,121,32,105,110, - 32,114,71,0,0,0,62,2,0,0,0,114,28,0,0,0, - 114,57,0,0,0,122,29,101,120,112,101,99,116,101,100,32, - 111,110,108,121,32,50,32,111,114,32,51,32,100,111,116,115, - 32,105,110,32,114,57,0,0,0,114,28,0,0,0,233,254, - 255,255,255,122,53,111,112,116,105,109,105,122,97,116,105,111, - 110,32,112,111,114,116,105,111,110,32,111,102,32,102,105,108, - 101,110,97,109,101,32,100,111,101,115,32,110,111,116,32,115, - 116,97,114,116,32,119,105,116,104,32,122,19,111,112,116,105, - 109,105,122,97,116,105,111,110,32,108,101,118,101,108,32,122, - 29,32,105,115,32,110,111,116,32,97,110,32,97,108,112,104, - 97,110,117,109,101,114,105,99,32,118,97,108,117,101,114,73, - 0,0,0,41,22,114,1,0,0,0,114,80,0,0,0,114, - 81,0,0,0,114,82,0,0,0,114,4,0,0,0,114,79, - 0,0,0,114,47,0,0,0,114,89,0,0,0,114,30,0, - 0,0,114,31,0,0,0,114,11,0,0,0,114,35,0,0, - 0,114,23,0,0,0,114,91,0,0,0,114,86,0,0,0, - 218,5,99,111,117,110,116,114,43,0,0,0,114,87,0,0, - 0,114,85,0,0,0,218,9,112,97,114,116,105,116,105,111, - 110,114,38,0,0,0,218,15,83,79,85,82,67,69,95,83, - 85,70,70,73,88,69,83,41,10,114,44,0,0,0,114,93, - 0,0,0,90,16,112,121,99,97,99,104,101,95,102,105,108, - 101,110,97,109,101,90,23,102,111,117,110,100,95,105,110,95, - 112,121,99,97,99,104,101,95,112,114,101,102,105,120,90,13, - 115,116,114,105,112,112,101,100,95,112,97,116,104,90,7,112, - 121,99,97,99,104,101,90,9,100,111,116,95,99,111,117,110, - 116,114,70,0,0,0,90,9,111,112,116,95,108,101,118,101, - 108,90,13,98,97,115,101,95,102,105,108,101,110,97,109,101, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 17,115,111,117,114,99,101,95,102,114,111,109,95,99,97,99, - 104,101,119,1,0,0,115,62,0,0,0,12,9,8,1,10, - 1,12,1,4,1,10,1,12,1,14,1,16,1,4,1,4, - 1,12,1,8,1,8,1,2,1,8,255,10,2,8,1,16, - 1,10,1,16,1,10,1,4,1,2,1,8,255,16,2,10, - 1,16,1,14,2,18,1,255,128,114,102,0,0,0,99,1, - 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,9, - 0,0,0,67,0,0,0,115,124,0,0,0,116,0,124,0, - 131,1,100,1,107,2,114,16,100,2,83,0,124,0,160,1, - 100,3,161,1,92,3,125,1,125,2,125,3,124,1,114,56, - 124,3,160,2,161,0,100,4,100,5,133,2,25,0,100,6, - 107,3,114,60,124,0,83,0,122,12,116,3,124,0,131,1, - 125,4,87,0,110,34,4,0,116,4,116,5,102,2,121,106, - 1,0,1,0,1,0,124,0,100,2,100,5,133,2,25,0, - 125,4,89,0,110,2,48,0,116,6,124,4,131,1,114,120, - 124,4,83,0,124,0,83,0,41,7,122,188,67,111,110,118, - 101,114,116,32,97,32,98,121,116,101,99,111,100,101,32,102, - 105,108,101,32,112,97,116,104,32,116,111,32,97,32,115,111, - 117,114,99,101,32,112,97,116,104,32,40,105,102,32,112,111, - 115,115,105,98,108,101,41,46,10,10,32,32,32,32,84,104, - 105,115,32,102,117,110,99,116,105,111,110,32,101,120,105,115, - 116,115,32,112,117,114,101,108,121,32,102,111,114,32,98,97, - 99,107,119,97,114,100,115,45,99,111,109,112,97,116,105,98, - 105,108,105,116,121,32,102,111,114,10,32,32,32,32,80,121, - 73,109,112,111,114,116,95,69,120,101,99,67,111,100,101,77, - 111,100,117,108,101,87,105,116,104,70,105,108,101,110,97,109, - 101,115,40,41,32,105,110,32,116,104,101,32,67,32,65,80, - 73,46,10,10,32,32,32,32,114,73,0,0,0,78,114,71, - 0,0,0,233,253,255,255,255,233,255,255,255,255,90,2,112, - 121,41,7,114,23,0,0,0,114,41,0,0,0,218,5,108, - 111,119,101,114,114,102,0,0,0,114,82,0,0,0,114,86, - 0,0,0,114,54,0,0,0,41,5,218,13,98,121,116,101, - 99,111,100,101,95,112,97,116,104,114,95,0,0,0,114,45, - 0,0,0,90,9,101,120,116,101,110,115,105,111,110,218,11, - 115,111,117,114,99,101,95,112,97,116,104,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,218,15,95,103,101,116, - 95,115,111,117,114,99,101,102,105,108,101,159,1,0,0,115, - 22,0,0,0,12,7,4,1,16,1,24,1,4,1,2,1, - 12,1,16,1,18,1,16,1,255,128,114,108,0,0,0,99, - 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 8,0,0,0,67,0,0,0,115,70,0,0,0,124,0,160, - 0,116,1,116,2,131,1,161,1,114,44,122,10,116,3,124, - 0,131,1,87,0,83,0,4,0,116,4,121,42,1,0,1, - 0,1,0,89,0,110,24,48,0,124,0,160,0,116,1,116, - 5,131,1,161,1,114,62,124,0,83,0,100,0,83,0,100, - 0,83,0,169,1,78,41,6,218,8,101,110,100,115,119,105, - 116,104,218,5,116,117,112,108,101,114,101,0,0,0,114,97, - 0,0,0,114,82,0,0,0,114,88,0,0,0,41,1,114, - 96,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,11,95,103,101,116,95,99,97,99,104,101,100, - 178,1,0,0,115,20,0,0,0,14,1,2,1,10,1,12, - 1,6,1,14,1,4,1,4,2,4,128,255,128,114,112,0, - 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,8,0,0,0,67,0,0,0,115,50,0,0,0, - 122,14,116,0,124,0,131,1,106,1,125,1,87,0,110,22, - 4,0,116,2,121,36,1,0,1,0,1,0,100,1,125,1, - 89,0,110,2,48,0,124,1,100,2,79,0,125,1,124,1, - 83,0,41,3,122,51,67,97,108,99,117,108,97,116,101,32, - 116,104,101,32,109,111,100,101,32,112,101,114,109,105,115,115, - 105,111,110,115,32,102,111,114,32,97,32,98,121,116,101,99, - 111,100,101,32,102,105,108,101,46,114,60,0,0,0,233,128, - 0,0,0,41,3,114,49,0,0,0,114,51,0,0,0,114, - 50,0,0,0,41,2,114,44,0,0,0,114,52,0,0,0, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 10,95,99,97,108,99,95,109,111,100,101,190,1,0,0,115, - 14,0,0,0,2,2,14,1,12,1,10,1,8,3,4,1, - 255,128,114,114,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,8,0,0,0,3,0,0,0, - 115,66,0,0,0,100,6,135,0,102,1,100,2,100,3,132, - 9,125,1,122,10,116,0,106,1,125,2,87,0,110,26,4, - 0,116,2,121,50,1,0,1,0,1,0,100,4,100,5,132, - 0,125,2,89,0,110,2,48,0,124,2,124,1,136,0,131, - 2,1,0,124,1,83,0,41,7,122,252,68,101,99,111,114, - 97,116,111,114,32,116,111,32,118,101,114,105,102,121,32,116, - 104,97,116,32,116,104,101,32,109,111,100,117,108,101,32,98, - 101,105,110,103,32,114,101,113,117,101,115,116,101,100,32,109, - 97,116,99,104,101,115,32,116,104,101,32,111,110,101,32,116, - 104,101,10,32,32,32,32,108,111,97,100,101,114,32,99,97, - 110,32,104,97,110,100,108,101,46,10,10,32,32,32,32,84, - 104,101,32,102,105,114,115,116,32,97,114,103,117,109,101,110, - 116,32,40,115,101,108,102,41,32,109,117,115,116,32,100,101, - 102,105,110,101,32,95,110,97,109,101,32,119,104,105,99,104, - 32,116,104,101,32,115,101,99,111,110,100,32,97,114,103,117, - 109,101,110,116,32,105,115,10,32,32,32,32,99,111,109,112, - 97,114,101,100,32,97,103,97,105,110,115,116,46,32,73,102, - 32,116,104,101,32,99,111,109,112,97,114,105,115,111,110,32, - 102,97,105,108,115,32,116,104,101,110,32,73,109,112,111,114, - 116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100, - 46,10,10,32,32,32,32,78,99,2,0,0,0,0,0,0, - 0,0,0,0,0,4,0,0,0,4,0,0,0,31,0,0, - 0,115,72,0,0,0,124,1,100,0,117,0,114,16,124,0, - 106,0,125,1,110,32,124,0,106,0,124,1,107,3,114,48, - 116,1,100,1,124,0,106,0,124,1,102,2,22,0,124,1, - 100,2,141,2,130,1,136,0,124,0,124,1,103,2,124,2, - 162,1,82,0,105,0,124,3,164,1,142,1,83,0,41,3, - 78,122,30,108,111,97,100,101,114,32,102,111,114,32,37,115, - 32,99,97,110,110,111,116,32,104,97,110,100,108,101,32,37, - 115,169,1,218,4,110,97,109,101,41,2,114,116,0,0,0, - 218,11,73,109,112,111,114,116,69,114,114,111,114,41,4,218, - 4,115,101,108,102,114,116,0,0,0,218,4,97,114,103,115, - 218,6,107,119,97,114,103,115,169,1,218,6,109,101,116,104, - 111,100,114,5,0,0,0,114,8,0,0,0,218,19,95,99, + 95,116,97,103,32,105,115,32,78,111,110,101,32,116,104,101, + 110,32,78,111,116,73,109,112,108,101,109,101,110,116,101,100, + 69,114,114,111,114,32,105,115,32,114,97,105,115,101,100,46, + 10,10,32,32,32,32,78,122,70,116,104,101,32,100,101,98, + 117,103,95,111,118,101,114,114,105,100,101,32,112,97,114,97, + 109,101,116,101,114,32,105,115,32,100,101,112,114,101,99,97, + 116,101,100,59,32,117,115,101,32,39,111,112,116,105,109,105, + 122,97,116,105,111,110,39,32,105,110,115,116,101,97,100,122, + 50,100,101,98,117,103,95,111,118,101,114,114,105,100,101,32, + 111,114,32,111,112,116,105,109,105,122,97,116,105,111,110,32, + 109,117,115,116,32,98,101,32,115,101,116,32,116,111,32,78, + 111,110,101,114,10,0,0,0,114,3,0,0,0,218,1,46, + 250,36,115,121,115,46,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,46,99,97,99,104,101,95,116,97,103,32,105, + 115,32,78,111,110,101,114,0,0,0,0,122,24,123,33,114, + 125,32,105,115,32,110,111,116,32,97,108,112,104,97,110,117, + 109,101,114,105,99,122,7,123,125,46,123,125,123,125,114,11, + 0,0,0,114,39,0,0,0,41,28,218,9,95,119,97,114, + 110,105,110,103,115,218,4,119,97,114,110,218,18,68,101,112, + 114,101,99,97,116,105,111,110,87,97,114,110,105,110,103,218, + 9,84,121,112,101,69,114,114,111,114,114,18,0,0,0,218, + 6,102,115,112,97,116,104,114,55,0,0,0,114,49,0,0, + 0,114,15,0,0,0,218,14,105,109,112,108,101,109,101,110, + 116,97,116,105,111,110,218,9,99,97,99,104,101,95,116,97, + 103,218,19,78,111,116,73,109,112,108,101,109,101,110,116,101, + 100,69,114,114,111,114,114,46,0,0,0,114,16,0,0,0, + 218,8,111,112,116,105,109,105,122,101,218,3,115,116,114,218, + 7,105,115,97,108,110,117,109,218,10,86,97,108,117,101,69, + 114,114,111,114,114,70,0,0,0,218,4,95,79,80,84,218, + 17,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, + 69,83,218,14,112,121,99,97,99,104,101,95,112,114,101,102, + 105,120,114,67,0,0,0,114,48,0,0,0,114,63,0,0, + 0,114,42,0,0,0,218,6,108,115,116,114,105,112,218,8, + 95,80,89,67,65,67,72,69,41,12,114,52,0,0,0,90, + 14,100,101,98,117,103,95,111,118,101,114,114,105,100,101,114, + 78,0,0,0,218,7,109,101,115,115,97,103,101,218,4,104, + 101,97,100,114,54,0,0,0,90,4,98,97,115,101,114,6, + 0,0,0,218,4,114,101,115,116,90,3,116,97,103,90,15, + 97,108,109,111,115,116,95,102,105,108,101,110,97,109,101,218, + 8,102,105,108,101,110,97,109,101,114,7,0,0,0,114,7, + 0,0,0,114,8,0,0,0,218,17,99,97,99,104,101,95, + 102,114,111,109,95,115,111,117,114,99,101,85,1,0,0,115, + 74,0,0,0,8,18,6,1,2,1,4,255,8,2,4,1, + 8,1,12,1,10,1,12,1,16,1,8,1,8,1,8,1, + 24,1,8,1,12,1,6,1,8,2,8,1,8,1,8,1, + 14,1,14,1,12,1,12,1,10,9,14,1,28,5,12,1, + 2,4,4,1,8,1,2,1,4,253,12,5,255,128,114,102, + 0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0, + 10,0,0,0,5,0,0,0,67,0,0,0,115,44,1,0, + 0,116,0,106,1,106,2,100,1,117,0,114,20,116,3,100, + 2,131,1,130,1,116,4,160,5,124,0,161,1,125,0,116, + 6,124,0,131,1,92,2,125,1,125,2,100,3,125,3,116, + 0,106,7,100,1,117,1,114,102,116,0,106,7,160,8,116, + 9,161,1,125,4,124,1,160,10,124,4,116,11,23,0,161, + 1,114,102,124,1,116,12,124,4,131,1,100,1,133,2,25, + 0,125,1,100,4,125,3,124,3,115,144,116,6,124,1,131, + 1,92,2,125,1,125,5,124,5,116,13,107,3,114,144,116, + 14,116,13,155,0,100,5,124,0,155,2,157,3,131,1,130, + 1,124,2,160,15,100,6,161,1,125,6,124,6,100,7,118, + 1,114,176,116,14,100,8,124,2,155,2,157,2,131,1,130, + 1,124,6,100,9,107,2,144,1,114,12,124,2,160,16,100, + 6,100,10,161,2,100,11,25,0,125,7,124,7,160,10,116, + 17,161,1,115,226,116,14,100,12,116,17,155,2,157,2,131, + 1,130,1,124,7,116,12,116,17,131,1,100,1,133,2,25, + 0,125,8,124,8,160,18,161,0,144,1,115,12,116,14,100, + 13,124,7,155,2,100,14,157,3,131,1,130,1,124,2,160, + 19,100,6,161,1,100,15,25,0,125,9,116,20,124,1,124, + 9,116,21,100,15,25,0,23,0,131,2,83,0,41,16,97, + 110,1,0,0,71,105,118,101,110,32,116,104,101,32,112,97, + 116,104,32,116,111,32,97,32,46,112,121,99,46,32,102,105, + 108,101,44,32,114,101,116,117,114,110,32,116,104,101,32,112, + 97,116,104,32,116,111,32,105,116,115,32,46,112,121,32,102, + 105,108,101,46,10,10,32,32,32,32,84,104,101,32,46,112, + 121,99,32,102,105,108,101,32,100,111,101,115,32,110,111,116, + 32,110,101,101,100,32,116,111,32,101,120,105,115,116,59,32, + 116,104,105,115,32,115,105,109,112,108,121,32,114,101,116,117, + 114,110,115,32,116,104,101,32,112,97,116,104,32,116,111,10, + 32,32,32,32,116,104,101,32,46,112,121,32,102,105,108,101, + 32,99,97,108,99,117,108,97,116,101,100,32,116,111,32,99, + 111,114,114,101,115,112,111,110,100,32,116,111,32,116,104,101, + 32,46,112,121,99,32,102,105,108,101,46,32,32,73,102,32, + 112,97,116,104,32,100,111,101,115,10,32,32,32,32,110,111, + 116,32,99,111,110,102,111,114,109,32,116,111,32,80,69,80, + 32,51,49,52,55,47,52,56,56,32,102,111,114,109,97,116, + 44,32,86,97,108,117,101,69,114,114,111,114,32,119,105,108, + 108,32,98,101,32,114,97,105,115,101,100,46,32,73,102,10, + 32,32,32,32,115,121,115,46,105,109,112,108,101,109,101,110, + 116,97,116,105,111,110,46,99,97,99,104,101,95,116,97,103, + 32,105,115,32,78,111,110,101,32,116,104,101,110,32,78,111, + 116,73,109,112,108,101,109,101,110,116,101,100,69,114,114,111, + 114,32,105,115,32,114,97,105,115,101,100,46,10,10,32,32, + 32,32,78,114,80,0,0,0,70,84,122,31,32,110,111,116, + 32,98,111,116,116,111,109,45,108,101,118,101,108,32,100,105, + 114,101,99,116,111,114,121,32,105,110,32,114,79,0,0,0, + 62,2,0,0,0,114,39,0,0,0,114,65,0,0,0,122, + 29,101,120,112,101,99,116,101,100,32,111,110,108,121,32,50, + 32,111,114,32,51,32,100,111,116,115,32,105,110,32,114,65, + 0,0,0,114,39,0,0,0,233,254,255,255,255,122,53,111, + 112,116,105,109,105,122,97,116,105,111,110,32,112,111,114,116, + 105,111,110,32,111,102,32,102,105,108,101,110,97,109,101,32, + 100,111,101,115,32,110,111,116,32,115,116,97,114,116,32,119, + 105,116,104,32,122,19,111,112,116,105,109,105,122,97,116,105, + 111,110,32,108,101,118,101,108,32,122,29,32,105,115,32,110, + 111,116,32,97,110,32,97,108,112,104,97,110,117,109,101,114, + 105,99,32,118,97,108,117,101,114,0,0,0,0,41,22,114, + 15,0,0,0,114,86,0,0,0,114,87,0,0,0,114,88, + 0,0,0,114,18,0,0,0,114,85,0,0,0,114,55,0, + 0,0,114,95,0,0,0,114,41,0,0,0,114,42,0,0, + 0,114,23,0,0,0,114,45,0,0,0,114,4,0,0,0, + 114,97,0,0,0,114,92,0,0,0,218,5,99,111,117,110, + 116,114,51,0,0,0,114,93,0,0,0,114,91,0,0,0, + 218,9,112,97,114,116,105,116,105,111,110,114,48,0,0,0, + 218,15,83,79,85,82,67,69,95,83,85,70,70,73,88,69, + 83,41,10,114,52,0,0,0,114,99,0,0,0,90,16,112, + 121,99,97,99,104,101,95,102,105,108,101,110,97,109,101,90, + 23,102,111,117,110,100,95,105,110,95,112,121,99,97,99,104, + 101,95,112,114,101,102,105,120,90,13,115,116,114,105,112,112, + 101,100,95,112,97,116,104,90,7,112,121,99,97,99,104,101, + 90,9,100,111,116,95,99,111,117,110,116,114,78,0,0,0, + 90,9,111,112,116,95,108,101,118,101,108,90,13,98,97,115, + 101,95,102,105,108,101,110,97,109,101,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,218,17,115,111,117,114,99, + 101,95,102,114,111,109,95,99,97,99,104,101,156,1,0,0, + 115,62,0,0,0,12,9,8,1,10,1,12,1,4,1,10, + 1,12,1,14,1,16,1,4,1,4,1,12,1,8,1,8, + 1,2,1,8,255,10,2,8,1,14,1,10,1,16,1,10, + 1,4,1,2,1,8,255,16,2,10,1,16,1,14,2,18, + 1,255,128,114,107,0,0,0,99,1,0,0,0,0,0,0, + 0,0,0,0,0,5,0,0,0,9,0,0,0,67,0,0, + 0,115,124,0,0,0,116,0,124,0,131,1,100,1,107,2, + 114,16,100,2,83,0,124,0,160,1,100,3,161,1,92,3, + 125,1,125,2,125,3,124,1,114,56,124,3,160,2,161,0, + 100,4,100,5,133,2,25,0,100,6,107,3,114,60,124,0, + 83,0,122,12,116,3,124,0,131,1,125,4,87,0,110,34, + 4,0,116,4,116,5,102,2,121,106,1,0,1,0,1,0, + 124,0,100,2,100,5,133,2,25,0,125,4,89,0,110,2, + 48,0,116,6,124,4,131,1,114,120,124,4,83,0,124,0, + 83,0,41,7,122,188,67,111,110,118,101,114,116,32,97,32, + 98,121,116,101,99,111,100,101,32,102,105,108,101,32,112,97, + 116,104,32,116,111,32,97,32,115,111,117,114,99,101,32,112, + 97,116,104,32,40,105,102,32,112,111,115,115,105,98,108,101, + 41,46,10,10,32,32,32,32,84,104,105,115,32,102,117,110, + 99,116,105,111,110,32,101,120,105,115,116,115,32,112,117,114, + 101,108,121,32,102,111,114,32,98,97,99,107,119,97,114,100, + 115,45,99,111,109,112,97,116,105,98,105,108,105,116,121,32, + 102,111,114,10,32,32,32,32,80,121,73,109,112,111,114,116, + 95,69,120,101,99,67,111,100,101,77,111,100,117,108,101,87, + 105,116,104,70,105,108,101,110,97,109,101,115,40,41,32,105, + 110,32,116,104,101,32,67,32,65,80,73,46,10,10,32,32, + 32,32,114,0,0,0,0,78,114,79,0,0,0,233,253,255, + 255,255,233,255,255,255,255,90,2,112,121,41,7,114,4,0, + 0,0,114,49,0,0,0,218,5,108,111,119,101,114,114,107, + 0,0,0,114,88,0,0,0,114,92,0,0,0,114,62,0, + 0,0,41,5,218,13,98,121,116,101,99,111,100,101,95,112, + 97,116,104,114,100,0,0,0,114,53,0,0,0,90,9,101, + 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, + 95,112,97,116,104,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, + 101,102,105,108,101,196,1,0,0,115,22,0,0,0,12,7, + 4,1,16,1,24,1,4,1,2,1,12,1,16,1,18,1, + 16,1,255,128,114,113,0,0,0,99,1,0,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,8,0,0,0,67,0, + 0,0,115,68,0,0,0,124,0,160,0,116,1,116,2,131, + 1,161,1,114,46,122,10,116,3,124,0,131,1,87,0,83, + 0,4,0,116,4,121,44,1,0,1,0,1,0,89,0,100, + 0,83,0,48,0,124,0,160,0,116,1,116,5,131,1,161, + 1,114,64,124,0,83,0,100,0,83,0,169,1,78,41,6, + 218,8,101,110,100,115,119,105,116,104,218,5,116,117,112,108, + 101,114,106,0,0,0,114,102,0,0,0,114,88,0,0,0, + 114,94,0,0,0,41,1,114,101,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,11,95,103,101, + 116,95,99,97,99,104,101,100,215,1,0,0,115,18,0,0, + 0,14,1,2,1,10,1,12,1,8,1,14,1,4,1,4, + 2,255,128,114,117,0,0,0,99,1,0,0,0,0,0,0, + 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, + 0,115,50,0,0,0,122,14,116,0,124,0,131,1,106,1, + 125,1,87,0,110,22,4,0,116,2,121,36,1,0,1,0, + 1,0,100,1,125,1,89,0,110,2,48,0,124,1,100,2, + 79,0,125,1,124,1,83,0,41,4,122,51,67,97,108,99, + 117,108,97,116,101,32,116,104,101,32,109,111,100,101,32,112, + 101,114,109,105,115,115,105,111,110,115,32,102,111,114,32,97, + 32,98,121,116,101,99,111,100,101,32,102,105,108,101,46,114, + 68,0,0,0,233,128,0,0,0,78,41,3,114,57,0,0, + 0,114,59,0,0,0,114,58,0,0,0,41,2,114,52,0, + 0,0,114,60,0,0,0,114,7,0,0,0,114,7,0,0, + 0,114,8,0,0,0,218,10,95,99,97,108,99,95,109,111, + 100,101,227,1,0,0,115,14,0,0,0,2,2,14,1,12, + 1,10,1,8,3,4,1,255,128,114,119,0,0,0,99,1, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4, + 0,0,0,3,0,0,0,115,52,0,0,0,100,6,135,0, + 102,1,100,2,100,3,132,9,125,1,116,0,100,1,117,1, + 114,30,116,0,106,1,125,2,110,8,100,4,100,5,132,0, + 125,2,124,2,124,1,136,0,131,2,1,0,124,1,83,0, + 41,7,122,252,68,101,99,111,114,97,116,111,114,32,116,111, + 32,118,101,114,105,102,121,32,116,104,97,116,32,116,104,101, + 32,109,111,100,117,108,101,32,98,101,105,110,103,32,114,101, + 113,117,101,115,116,101,100,32,109,97,116,99,104,101,115,32, + 116,104,101,32,111,110,101,32,116,104,101,10,32,32,32,32, + 108,111,97,100,101,114,32,99,97,110,32,104,97,110,100,108, + 101,46,10,10,32,32,32,32,84,104,101,32,102,105,114,115, + 116,32,97,114,103,117,109,101,110,116,32,40,115,101,108,102, + 41,32,109,117,115,116,32,100,101,102,105,110,101,32,95,110, + 97,109,101,32,119,104,105,99,104,32,116,104,101,32,115,101, + 99,111,110,100,32,97,114,103,117,109,101,110,116,32,105,115, + 10,32,32,32,32,99,111,109,112,97,114,101,100,32,97,103, + 97,105,110,115,116,46,32,73,102,32,116,104,101,32,99,111, + 109,112,97,114,105,115,111,110,32,102,97,105,108,115,32,116, + 104,101,110,32,73,109,112,111,114,116,69,114,114,111,114,32, + 105,115,32,114,97,105,115,101,100,46,10,10,32,32,32,32, + 78,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,4,0,0,0,31,0,0,0,115,72,0,0,0,124, + 1,100,0,117,0,114,16,124,0,106,0,125,1,110,32,124, + 0,106,0,124,1,107,3,114,48,116,1,100,1,124,0,106, + 0,124,1,102,2,22,0,124,1,100,2,141,2,130,1,136, + 0,124,0,124,1,103,2,124,2,162,1,82,0,105,0,124, + 3,164,1,142,1,83,0,41,3,78,122,30,108,111,97,100, + 101,114,32,102,111,114,32,37,115,32,99,97,110,110,111,116, + 32,104,97,110,100,108,101,32,37,115,169,1,218,4,110,97, + 109,101,41,2,114,121,0,0,0,218,11,73,109,112,111,114, + 116,69,114,114,111,114,41,4,218,4,115,101,108,102,114,121, + 0,0,0,218,4,97,114,103,115,218,6,107,119,97,114,103, + 115,169,1,218,6,109,101,116,104,111,100,114,7,0,0,0, + 114,8,0,0,0,218,19,95,99,104,101,99,107,95,110,97, + 109,101,95,119,114,97,112,112,101,114,247,1,0,0,115,20, + 0,0,0,8,1,8,1,10,1,4,1,8,1,2,255,2, + 1,6,255,24,2,255,128,122,40,95,99,104,101,99,107,95, + 110,97,109,101,46,60,108,111,99,97,108,115,62,46,95,99, 104,101,99,107,95,110,97,109,101,95,119,114,97,112,112,101, - 114,210,1,0,0,115,20,0,0,0,8,1,8,1,10,1, - 4,1,8,1,2,255,2,1,6,255,24,2,255,128,122,40, - 95,99,104,101,99,107,95,110,97,109,101,46,60,108,111,99, - 97,108,115,62,46,95,99,104,101,99,107,95,110,97,109,101, - 95,119,114,97,112,112,101,114,99,2,0,0,0,0,0,0, - 0,0,0,0,0,3,0,0,0,7,0,0,0,83,0,0, - 0,115,56,0,0,0,100,1,68,0,93,32,125,2,116,0, - 124,1,124,2,131,2,114,4,116,1,124,0,124,2,116,2, - 124,1,124,2,131,2,131,3,1,0,113,4,124,0,106,3, - 160,4,124,1,106,3,161,1,1,0,100,0,83,0,41,2, - 78,41,4,218,10,95,95,109,111,100,117,108,101,95,95,218, - 8,95,95,110,97,109,101,95,95,218,12,95,95,113,117,97, - 108,110,97,109,101,95,95,218,7,95,95,100,111,99,95,95, - 41,5,218,7,104,97,115,97,116,116,114,218,7,115,101,116, - 97,116,116,114,218,7,103,101,116,97,116,116,114,218,8,95, - 95,100,105,99,116,95,95,218,6,117,112,100,97,116,101,41, - 3,90,3,110,101,119,90,3,111,108,100,114,67,0,0,0, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 5,95,119,114,97,112,221,1,0,0,115,12,0,0,0,8, - 1,10,1,20,1,14,1,4,128,255,128,122,26,95,99,104, - 101,99,107,95,110,97,109,101,46,60,108,111,99,97,108,115, - 62,46,95,119,114,97,112,41,1,78,41,3,218,10,95,98, - 111,111,116,115,116,114,97,112,114,133,0,0,0,218,9,78, - 97,109,101,69,114,114,111,114,41,3,114,122,0,0,0,114, - 123,0,0,0,114,133,0,0,0,114,5,0,0,0,114,121, - 0,0,0,114,8,0,0,0,218,11,95,99,104,101,99,107, - 95,110,97,109,101,202,1,0,0,115,16,0,0,0,14,8, - 2,7,10,1,12,1,14,2,10,5,4,1,255,128,114,136, - 0,0,0,99,2,0,0,0,0,0,0,0,0,0,0,0, - 5,0,0,0,6,0,0,0,67,0,0,0,115,60,0,0, - 0,124,0,160,0,124,1,161,1,92,2,125,2,125,3,124, - 2,100,1,117,0,114,56,116,1,124,3,131,1,114,56,100, - 2,125,4,116,2,160,3,124,4,160,4,124,3,100,3,25, - 0,161,1,116,5,161,2,1,0,124,2,83,0,41,4,122, - 155,84,114,121,32,116,111,32,102,105,110,100,32,97,32,108, - 111,97,100,101,114,32,102,111,114,32,116,104,101,32,115,112, - 101,99,105,102,105,101,100,32,109,111,100,117,108,101,32,98, - 121,32,100,101,108,101,103,97,116,105,110,103,32,116,111,10, - 32,32,32,32,115,101,108,102,46,102,105,110,100,95,108,111, - 97,100,101,114,40,41,46,10,10,32,32,32,32,84,104,105, - 115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114, - 101,99,97,116,101,100,32,105,110,32,102,97,118,111,114,32, - 111,102,32,102,105,110,100,101,114,46,102,105,110,100,95,115, - 112,101,99,40,41,46,10,10,32,32,32,32,78,122,44,78, - 111,116,32,105,109,112,111,114,116,105,110,103,32,100,105,114, - 101,99,116,111,114,121,32,123,125,58,32,109,105,115,115,105, - 110,103,32,95,95,105,110,105,116,95,95,114,73,0,0,0, - 41,6,218,11,102,105,110,100,95,108,111,97,100,101,114,114, - 23,0,0,0,114,75,0,0,0,114,76,0,0,0,114,62, - 0,0,0,218,13,73,109,112,111,114,116,87,97,114,110,105, - 110,103,41,5,114,118,0,0,0,218,8,102,117,108,108,110, - 97,109,101,218,6,108,111,97,100,101,114,218,8,112,111,114, - 116,105,111,110,115,218,3,109,115,103,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,218,17,95,102,105,110,100, - 95,109,111,100,117,108,101,95,115,104,105,109,230,1,0,0, - 115,12,0,0,0,14,10,16,1,4,1,22,1,4,1,255, - 128,114,143,0,0,0,99,3,0,0,0,0,0,0,0,0, + 114,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,7,0,0,0,83,0,0,0,115,56,0,0,0,100, + 1,68,0,93,32,125,2,116,0,124,1,124,2,131,2,114, + 4,116,1,124,0,124,2,116,2,124,1,124,2,131,2,131, + 3,1,0,113,4,124,0,106,3,160,4,124,1,106,3,161, + 1,1,0,100,0,83,0,41,2,78,41,4,218,10,95,95, + 109,111,100,117,108,101,95,95,218,8,95,95,110,97,109,101, + 95,95,218,12,95,95,113,117,97,108,110,97,109,101,95,95, + 218,7,95,95,100,111,99,95,95,41,5,218,7,104,97,115, + 97,116,116,114,218,7,115,101,116,97,116,116,114,218,7,103, + 101,116,97,116,116,114,218,8,95,95,100,105,99,116,95,95, + 218,6,117,112,100,97,116,101,41,3,90,3,110,101,119,90, + 3,111,108,100,114,75,0,0,0,114,7,0,0,0,114,7, + 0,0,0,114,8,0,0,0,218,5,95,119,114,97,112,4, + 2,0,0,115,10,0,0,0,8,1,10,1,20,1,18,1, + 255,128,122,26,95,99,104,101,99,107,95,110,97,109,101,46, + 60,108,111,99,97,108,115,62,46,95,119,114,97,112,41,1, + 78,41,2,218,10,95,98,111,111,116,115,116,114,97,112,114, + 138,0,0,0,41,3,114,127,0,0,0,114,128,0,0,0, + 114,138,0,0,0,114,7,0,0,0,114,126,0,0,0,114, + 8,0,0,0,218,11,95,99,104,101,99,107,95,110,97,109, + 101,239,1,0,0,115,14,0,0,0,14,8,8,10,8,1, + 8,2,10,6,4,1,255,128,114,140,0,0,0,99,2,0, + 0,0,0,0,0,0,0,0,0,0,5,0,0,0,6,0, + 0,0,67,0,0,0,115,60,0,0,0,124,0,160,0,124, + 1,161,1,92,2,125,2,125,3,124,2,100,1,117,0,114, + 56,116,1,124,3,131,1,114,56,100,2,125,4,116,2,160, + 3,124,4,160,4,124,3,100,3,25,0,161,1,116,5,161, + 2,1,0,124,2,83,0,41,4,122,155,84,114,121,32,116, + 111,32,102,105,110,100,32,97,32,108,111,97,100,101,114,32, + 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, + 100,32,109,111,100,117,108,101,32,98,121,32,100,101,108,101, + 103,97,116,105,110,103,32,116,111,10,32,32,32,32,115,101, + 108,102,46,102,105,110,100,95,108,111,97,100,101,114,40,41, + 46,10,10,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 32,105,110,32,102,97,118,111,114,32,111,102,32,102,105,110, + 100,101,114,46,102,105,110,100,95,115,112,101,99,40,41,46, + 10,10,32,32,32,32,78,122,44,78,111,116,32,105,109,112, + 111,114,116,105,110,103,32,100,105,114,101,99,116,111,114,121, + 32,123,125,58,32,109,105,115,115,105,110,103,32,95,95,105, + 110,105,116,95,95,114,0,0,0,0,41,6,218,11,102,105, + 110,100,95,108,111,97,100,101,114,114,4,0,0,0,114,81, + 0,0,0,114,82,0,0,0,114,70,0,0,0,218,13,73, + 109,112,111,114,116,87,97,114,110,105,110,103,41,5,114,123, + 0,0,0,218,8,102,117,108,108,110,97,109,101,218,6,108, + 111,97,100,101,114,218,8,112,111,114,116,105,111,110,115,218, + 3,109,115,103,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,17,95,102,105,110,100,95,109,111,100,117,108, + 101,95,115,104,105,109,14,2,0,0,115,12,0,0,0,14, + 10,16,1,4,1,22,1,4,1,255,128,114,147,0,0,0, + 99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0, + 0,4,0,0,0,67,0,0,0,115,166,0,0,0,124,0, + 100,1,100,2,133,2,25,0,125,3,124,3,116,0,107,3, + 114,64,100,3,124,1,155,2,100,4,124,3,155,2,157,4, + 125,4,116,1,160,2,100,5,124,4,161,2,1,0,116,3, + 124,4,102,1,105,0,124,2,164,1,142,1,130,1,116,4, + 124,0,131,1,100,6,107,0,114,106,100,7,124,1,155,2, + 157,2,125,4,116,1,160,2,100,5,124,4,161,2,1,0, + 116,5,124,4,131,1,130,1,116,6,124,0,100,2,100,8, + 133,2,25,0,131,1,125,5,124,5,100,9,64,0,114,162, + 100,10,124,5,155,2,100,11,124,1,155,2,157,4,125,4, + 116,3,124,4,102,1,105,0,124,2,164,1,142,1,130,1, + 124,5,83,0,41,12,97,84,2,0,0,80,101,114,102,111, + 114,109,32,98,97,115,105,99,32,118,97,108,105,100,105,116, + 121,32,99,104,101,99,107,105,110,103,32,111,102,32,97,32, + 112,121,99,32,104,101,97,100,101,114,32,97,110,100,32,114, + 101,116,117,114,110,32,116,104,101,32,102,108,97,103,115,32, + 102,105,101,108,100,44,10,32,32,32,32,119,104,105,99,104, + 32,100,101,116,101,114,109,105,110,101,115,32,104,111,119,32, + 116,104,101,32,112,121,99,32,115,104,111,117,108,100,32,98, + 101,32,102,117,114,116,104,101,114,32,118,97,108,105,100,97, + 116,101,100,32,97,103,97,105,110,115,116,32,116,104,101,32, + 115,111,117,114,99,101,46,10,10,32,32,32,32,42,100,97, + 116,97,42,32,105,115,32,116,104,101,32,99,111,110,116,101, + 110,116,115,32,111,102,32,116,104,101,32,112,121,99,32,102, + 105,108,101,46,32,40,79,110,108,121,32,116,104,101,32,102, + 105,114,115,116,32,49,54,32,98,121,116,101,115,32,97,114, + 101,10,32,32,32,32,114,101,113,117,105,114,101,100,44,32, + 116,104,111,117,103,104,46,41,10,10,32,32,32,32,42,110, + 97,109,101,42,32,105,115,32,116,104,101,32,110,97,109,101, + 32,111,102,32,116,104,101,32,109,111,100,117,108,101,32,98, + 101,105,110,103,32,105,109,112,111,114,116,101,100,46,32,73, + 116,32,105,115,32,117,115,101,100,32,102,111,114,32,108,111, + 103,103,105,110,103,46,10,10,32,32,32,32,42,101,120,99, + 95,100,101,116,97,105,108,115,42,32,105,115,32,97,32,100, + 105,99,116,105,111,110,97,114,121,32,112,97,115,115,101,100, + 32,116,111,32,73,109,112,111,114,116,69,114,114,111,114,32, + 105,102,32,105,116,32,114,97,105,115,101,100,32,102,111,114, + 10,32,32,32,32,105,109,112,114,111,118,101,100,32,100,101, + 98,117,103,103,105,110,103,46,10,10,32,32,32,32,73,109, + 112,111,114,116,69,114,114,111,114,32,105,115,32,114,97,105, + 115,101,100,32,119,104,101,110,32,116,104,101,32,109,97,103, + 105,99,32,110,117,109,98,101,114,32,105,115,32,105,110,99, + 111,114,114,101,99,116,32,111,114,32,119,104,101,110,32,116, + 104,101,32,102,108,97,103,115,10,32,32,32,32,102,105,101, + 108,100,32,105,115,32,105,110,118,97,108,105,100,46,32,69, + 79,70,69,114,114,111,114,32,105,115,32,114,97,105,115,101, + 100,32,119,104,101,110,32,116,104,101,32,100,97,116,97,32, + 105,115,32,102,111,117,110,100,32,116,111,32,98,101,32,116, + 114,117,110,99,97,116,101,100,46,10,10,32,32,32,32,78, + 114,28,0,0,0,122,20,98,97,100,32,109,97,103,105,99, + 32,110,117,109,98,101,114,32,105,110,32,122,2,58,32,250, + 2,123,125,233,16,0,0,0,122,40,114,101,97,99,104,101, + 100,32,69,79,70,32,119,104,105,108,101,32,114,101,97,100, + 105,110,103,32,112,121,99,32,104,101,97,100,101,114,32,111, + 102,32,233,8,0,0,0,233,252,255,255,255,122,14,105,110, + 118,97,108,105,100,32,102,108,97,103,115,32,122,4,32,105, + 110,32,41,7,218,12,77,65,71,73,67,95,78,85,77,66, + 69,82,114,139,0,0,0,218,16,95,118,101,114,98,111,115, + 101,95,109,101,115,115,97,103,101,114,122,0,0,0,114,4, + 0,0,0,218,8,69,79,70,69,114,114,111,114,114,38,0, + 0,0,41,6,114,37,0,0,0,114,121,0,0,0,218,11, + 101,120,99,95,100,101,116,97,105,108,115,90,5,109,97,103, + 105,99,114,98,0,0,0,114,16,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,13,95,99,108, + 97,115,115,105,102,121,95,112,121,99,31,2,0,0,115,30, + 0,0,0,12,16,8,1,16,1,12,1,16,1,12,1,10, + 1,12,1,8,1,16,1,8,2,16,1,16,1,4,1,255, + 128,114,156,0,0,0,99,5,0,0,0,0,0,0,0,0, 0,0,0,6,0,0,0,4,0,0,0,67,0,0,0,115, - 166,0,0,0,124,0,100,1,100,2,133,2,25,0,125,3, - 124,3,116,0,107,3,114,64,100,3,124,1,155,2,100,4, - 124,3,155,2,157,4,125,4,116,1,160,2,100,5,124,4, - 161,2,1,0,116,3,124,4,102,1,105,0,124,2,164,1, - 142,1,130,1,116,4,124,0,131,1,100,6,107,0,114,106, - 100,7,124,1,155,2,157,2,125,4,116,1,160,2,100,5, - 124,4,161,2,1,0,116,5,124,4,131,1,130,1,116,6, - 124,0,100,2,100,8,133,2,25,0,131,1,125,5,124,5, - 100,9,64,0,114,162,100,10,124,5,155,2,100,11,124,1, - 155,2,157,4,125,4,116,3,124,4,102,1,105,0,124,2, - 164,1,142,1,130,1,124,5,83,0,41,12,97,84,2,0, - 0,80,101,114,102,111,114,109,32,98,97,115,105,99,32,118, - 97,108,105,100,105,116,121,32,99,104,101,99,107,105,110,103, - 32,111,102,32,97,32,112,121,99,32,104,101,97,100,101,114, - 32,97,110,100,32,114,101,116,117,114,110,32,116,104,101,32, - 102,108,97,103,115,32,102,105,101,108,100,44,10,32,32,32, - 32,119,104,105,99,104,32,100,101,116,101,114,109,105,110,101, - 115,32,104,111,119,32,116,104,101,32,112,121,99,32,115,104, - 111,117,108,100,32,98,101,32,102,117,114,116,104,101,114,32, - 118,97,108,105,100,97,116,101,100,32,97,103,97,105,110,115, - 116,32,116,104,101,32,115,111,117,114,99,101,46,10,10,32, - 32,32,32,42,100,97,116,97,42,32,105,115,32,116,104,101, - 32,99,111,110,116,101,110,116,115,32,111,102,32,116,104,101, - 32,112,121,99,32,102,105,108,101,46,32,40,79,110,108,121, - 32,116,104,101,32,102,105,114,115,116,32,49,54,32,98,121, - 116,101,115,32,97,114,101,10,32,32,32,32,114,101,113,117, - 105,114,101,100,44,32,116,104,111,117,103,104,46,41,10,10, - 32,32,32,32,42,110,97,109,101,42,32,105,115,32,116,104, - 101,32,110,97,109,101,32,111,102,32,116,104,101,32,109,111, - 100,117,108,101,32,98,101,105,110,103,32,105,109,112,111,114, - 116,101,100,46,32,73,116,32,105,115,32,117,115,101,100,32, - 102,111,114,32,108,111,103,103,105,110,103,46,10,10,32,32, - 32,32,42,101,120,99,95,100,101,116,97,105,108,115,42,32, - 105,115,32,97,32,100,105,99,116,105,111,110,97,114,121,32, - 112,97,115,115,101,100,32,116,111,32,73,109,112,111,114,116, - 69,114,114,111,114,32,105,102,32,105,116,32,114,97,105,115, - 101,100,32,102,111,114,10,32,32,32,32,105,109,112,114,111, - 118,101,100,32,100,101,98,117,103,103,105,110,103,46,10,10, - 32,32,32,32,73,109,112,111,114,116,69,114,114,111,114,32, - 105,115,32,114,97,105,115,101,100,32,119,104,101,110,32,116, - 104,101,32,109,97,103,105,99,32,110,117,109,98,101,114,32, - 105,115,32,105,110,99,111,114,114,101,99,116,32,111,114,32, - 119,104,101,110,32,116,104,101,32,102,108,97,103,115,10,32, - 32,32,32,102,105,101,108,100,32,105,115,32,105,110,118,97, - 108,105,100,46,32,69,79,70,69,114,114,111,114,32,105,115, - 32,114,97,105,115,101,100,32,119,104,101,110,32,116,104,101, - 32,100,97,116,97,32,105,115,32,102,111,117,110,100,32,116, - 111,32,98,101,32,116,114,117,110,99,97,116,101,100,46,10, - 10,32,32,32,32,78,114,16,0,0,0,122,20,98,97,100, - 32,109,97,103,105,99,32,110,117,109,98,101,114,32,105,110, - 32,122,2,58,32,250,2,123,125,233,16,0,0,0,122,40, - 114,101,97,99,104,101,100,32,69,79,70,32,119,104,105,108, - 101,32,114,101,97,100,105,110,103,32,112,121,99,32,104,101, - 97,100,101,114,32,111,102,32,233,8,0,0,0,233,252,255, - 255,255,122,14,105,110,118,97,108,105,100,32,102,108,97,103, - 115,32,122,4,32,105,110,32,41,7,218,12,77,65,71,73, - 67,95,78,85,77,66,69,82,114,134,0,0,0,218,16,95, - 118,101,114,98,111,115,101,95,109,101,115,115,97,103,101,114, - 117,0,0,0,114,23,0,0,0,218,8,69,79,70,69,114, - 114,111,114,114,27,0,0,0,41,6,114,26,0,0,0,114, - 116,0,0,0,218,11,101,120,99,95,100,101,116,97,105,108, - 115,90,5,109,97,103,105,99,114,92,0,0,0,114,2,0, - 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,13,95,99,108,97,115,115,105,102,121,95,112,121,99, - 247,1,0,0,115,30,0,0,0,12,16,8,1,16,1,12, - 1,16,1,12,1,10,1,12,1,8,1,16,1,8,2,16, - 1,16,1,4,1,255,128,114,152,0,0,0,99,5,0,0, - 0,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0, - 0,67,0,0,0,115,120,0,0,0,116,0,124,0,100,1, - 100,2,133,2,25,0,131,1,124,1,100,3,64,0,107,3, - 114,62,100,4,124,3,155,2,157,2,125,5,116,1,160,2, - 100,5,124,5,161,2,1,0,116,3,124,5,102,1,105,0, - 124,4,164,1,142,1,130,1,124,2,100,6,117,1,114,116, - 116,0,124,0,100,2,100,7,133,2,25,0,131,1,124,2, - 100,3,64,0,107,3,114,116,116,3,100,4,124,3,155,2, - 157,2,102,1,105,0,124,4,164,1,142,1,130,1,100,6, - 83,0,41,8,97,7,2,0,0,86,97,108,105,100,97,116, - 101,32,97,32,112,121,99,32,97,103,97,105,110,115,116,32, - 116,104,101,32,115,111,117,114,99,101,32,108,97,115,116,45, - 109,111,100,105,102,105,101,100,32,116,105,109,101,46,10,10, - 32,32,32,32,42,100,97,116,97,42,32,105,115,32,116,104, - 101,32,99,111,110,116,101,110,116,115,32,111,102,32,116,104, - 101,32,112,121,99,32,102,105,108,101,46,32,40,79,110,108, - 121,32,116,104,101,32,102,105,114,115,116,32,49,54,32,98, - 121,116,101,115,32,97,114,101,10,32,32,32,32,114,101,113, - 117,105,114,101,100,46,41,10,10,32,32,32,32,42,115,111, - 117,114,99,101,95,109,116,105,109,101,42,32,105,115,32,116, - 104,101,32,108,97,115,116,32,109,111,100,105,102,105,101,100, - 32,116,105,109,101,115,116,97,109,112,32,111,102,32,116,104, - 101,32,115,111,117,114,99,101,32,102,105,108,101,46,10,10, - 32,32,32,32,42,115,111,117,114,99,101,95,115,105,122,101, - 42,32,105,115,32,78,111,110,101,32,111,114,32,116,104,101, - 32,115,105,122,101,32,111,102,32,116,104,101,32,115,111,117, - 114,99,101,32,102,105,108,101,32,105,110,32,98,121,116,101, - 115,46,10,10,32,32,32,32,42,110,97,109,101,42,32,105, - 115,32,116,104,101,32,110,97,109,101,32,111,102,32,116,104, - 101,32,109,111,100,117,108,101,32,98,101,105,110,103,32,105, - 109,112,111,114,116,101,100,46,32,73,116,32,105,115,32,117, - 115,101,100,32,102,111,114,32,108,111,103,103,105,110,103,46, - 10,10,32,32,32,32,42,101,120,99,95,100,101,116,97,105, - 108,115,42,32,105,115,32,97,32,100,105,99,116,105,111,110, - 97,114,121,32,112,97,115,115,101,100,32,116,111,32,73,109, - 112,111,114,116,69,114,114,111,114,32,105,102,32,105,116,32, - 114,97,105,115,101,100,32,102,111,114,10,32,32,32,32,105, - 109,112,114,111,118,101,100,32,100,101,98,117,103,103,105,110, - 103,46,10,10,32,32,32,32,65,110,32,73,109,112,111,114, - 116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100, - 32,105,102,32,116,104,101,32,98,121,116,101,99,111,100,101, - 32,105,115,32,115,116,97,108,101,46,10,10,32,32,32,32, - 114,146,0,0,0,233,12,0,0,0,114,15,0,0,0,122, - 22,98,121,116,101,99,111,100,101,32,105,115,32,115,116,97, - 108,101,32,102,111,114,32,114,144,0,0,0,78,114,145,0, - 0,0,41,4,114,27,0,0,0,114,134,0,0,0,114,149, - 0,0,0,114,117,0,0,0,41,6,114,26,0,0,0,218, - 12,115,111,117,114,99,101,95,109,116,105,109,101,218,11,115, - 111,117,114,99,101,95,115,105,122,101,114,116,0,0,0,114, - 151,0,0,0,114,92,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,23,95,118,97,108,105,100, - 97,116,101,95,116,105,109,101,115,116,97,109,112,95,112,121, - 99,24,2,0,0,115,20,0,0,0,24,19,10,1,12,1, - 16,1,8,1,22,1,2,255,22,2,4,128,255,128,114,156, - 0,0,0,99,4,0,0,0,0,0,0,0,0,0,0,0, - 4,0,0,0,4,0,0,0,67,0,0,0,115,42,0,0, - 0,124,0,100,1,100,2,133,2,25,0,124,1,107,3,114, - 38,116,0,100,3,124,2,155,2,157,2,102,1,105,0,124, - 3,164,1,142,1,130,1,100,4,83,0,41,5,97,243,1, - 0,0,86,97,108,105,100,97,116,101,32,97,32,104,97,115, - 104,45,98,97,115,101,100,32,112,121,99,32,98,121,32,99, - 104,101,99,107,105,110,103,32,116,104,101,32,114,101,97,108, - 32,115,111,117,114,99,101,32,104,97,115,104,32,97,103,97, - 105,110,115,116,32,116,104,101,32,111,110,101,32,105,110,10, - 32,32,32,32,116,104,101,32,112,121,99,32,104,101,97,100, - 101,114,46,10,10,32,32,32,32,42,100,97,116,97,42,32, - 105,115,32,116,104,101,32,99,111,110,116,101,110,116,115,32, - 111,102,32,116,104,101,32,112,121,99,32,102,105,108,101,46, - 32,40,79,110,108,121,32,116,104,101,32,102,105,114,115,116, - 32,49,54,32,98,121,116,101,115,32,97,114,101,10,32,32, - 32,32,114,101,113,117,105,114,101,100,46,41,10,10,32,32, - 32,32,42,115,111,117,114,99,101,95,104,97,115,104,42,32, - 105,115,32,116,104,101,32,105,109,112,111,114,116,108,105,98, - 46,117,116,105,108,46,115,111,117,114,99,101,95,104,97,115, - 104,40,41,32,111,102,32,116,104,101,32,115,111,117,114,99, - 101,32,102,105,108,101,46,10,10,32,32,32,32,42,110,97, - 109,101,42,32,105,115,32,116,104,101,32,110,97,109,101,32, - 111,102,32,116,104,101,32,109,111,100,117,108,101,32,98,101, - 105,110,103,32,105,109,112,111,114,116,101,100,46,32,73,116, - 32,105,115,32,117,115,101,100,32,102,111,114,32,108,111,103, - 103,105,110,103,46,10,10,32,32,32,32,42,101,120,99,95, - 100,101,116,97,105,108,115,42,32,105,115,32,97,32,100,105, - 99,116,105,111,110,97,114,121,32,112,97,115,115,101,100,32, - 116,111,32,73,109,112,111,114,116,69,114,114,111,114,32,105, - 102,32,105,116,32,114,97,105,115,101,100,32,102,111,114,10, - 32,32,32,32,105,109,112,114,111,118,101,100,32,100,101,98, - 117,103,103,105,110,103,46,10,10,32,32,32,32,65,110,32, - 73,109,112,111,114,116,69,114,114,111,114,32,105,115,32,114, - 97,105,115,101,100,32,105,102,32,116,104,101,32,98,121,116, - 101,99,111,100,101,32,105,115,32,115,116,97,108,101,46,10, - 10,32,32,32,32,114,146,0,0,0,114,145,0,0,0,122, - 46,104,97,115,104,32,105,110,32,98,121,116,101,99,111,100, - 101,32,100,111,101,115,110,39,116,32,109,97,116,99,104,32, - 104,97,115,104,32,111,102,32,115,111,117,114,99,101,32,78, - 41,1,114,117,0,0,0,41,4,114,26,0,0,0,218,11, - 115,111,117,114,99,101,95,104,97,115,104,114,116,0,0,0, - 114,151,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,18,95,118,97,108,105,100,97,116,101,95, - 104,97,115,104,95,112,121,99,52,2,0,0,115,16,0,0, - 0,16,17,2,1,8,1,4,255,2,2,6,254,4,128,255, - 128,114,158,0,0,0,99,4,0,0,0,0,0,0,0,0, - 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, - 80,0,0,0,116,0,160,1,124,0,161,1,125,4,116,2, - 124,4,116,3,131,2,114,56,116,4,160,5,100,1,124,2, - 161,2,1,0,124,3,100,2,117,1,114,52,116,6,160,7, - 124,4,124,3,161,2,1,0,124,4,83,0,116,8,100,3, - 160,9,124,2,161,1,124,1,124,2,100,4,141,3,130,1, - 100,2,83,0,41,5,122,35,67,111,109,112,105,108,101,32, - 98,121,116,101,99,111,100,101,32,97,115,32,102,111,117,110, - 100,32,105,110,32,97,32,112,121,99,46,122,21,99,111,100, - 101,32,111,98,106,101,99,116,32,102,114,111,109,32,123,33, - 114,125,78,122,23,78,111,110,45,99,111,100,101,32,111,98, - 106,101,99,116,32,105,110,32,123,33,114,125,169,2,114,116, - 0,0,0,114,44,0,0,0,41,10,218,7,109,97,114,115, - 104,97,108,90,5,108,111,97,100,115,218,10,105,115,105,110, - 115,116,97,110,99,101,218,10,95,99,111,100,101,95,116,121, - 112,101,114,134,0,0,0,114,149,0,0,0,218,4,95,105, - 109,112,90,16,95,102,105,120,95,99,111,95,102,105,108,101, - 110,97,109,101,114,117,0,0,0,114,62,0,0,0,41,5, - 114,26,0,0,0,114,116,0,0,0,114,106,0,0,0,114, - 107,0,0,0,218,4,99,111,100,101,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,218,17,95,99,111,109,112, - 105,108,101,95,98,121,116,101,99,111,100,101,76,2,0,0, - 115,22,0,0,0,10,2,10,1,12,1,8,1,12,1,4, - 1,10,2,4,1,6,255,4,128,255,128,114,165,0,0,0, - 114,73,0,0,0,99,3,0,0,0,0,0,0,0,0,0, - 0,0,4,0,0,0,5,0,0,0,67,0,0,0,115,70, - 0,0,0,116,0,116,1,131,1,125,3,124,3,160,2,116, - 3,100,1,131,1,161,1,1,0,124,3,160,2,116,3,124, - 1,131,1,161,1,1,0,124,3,160,2,116,3,124,2,131, - 1,161,1,1,0,124,3,160,2,116,4,160,5,124,0,161, - 1,161,1,1,0,124,3,83,0,41,2,122,43,80,114,111, - 100,117,99,101,32,116,104,101,32,100,97,116,97,32,102,111, - 114,32,97,32,116,105,109,101,115,116,97,109,112,45,98,97, - 115,101,100,32,112,121,99,46,114,73,0,0,0,41,6,218, - 9,98,121,116,101,97,114,114,97,121,114,148,0,0,0,218, - 6,101,120,116,101,110,100,114,21,0,0,0,114,160,0,0, - 0,218,5,100,117,109,112,115,41,4,114,164,0,0,0,218, - 5,109,116,105,109,101,114,155,0,0,0,114,26,0,0,0, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 22,95,99,111,100,101,95,116,111,95,116,105,109,101,115,116, - 97,109,112,95,112,121,99,89,2,0,0,115,14,0,0,0, - 8,2,14,1,14,1,14,1,16,1,4,1,255,128,114,170, - 0,0,0,84,99,3,0,0,0,0,0,0,0,0,0,0, - 0,5,0,0,0,5,0,0,0,67,0,0,0,115,80,0, - 0,0,116,0,116,1,131,1,125,3,100,1,124,2,100,1, - 62,0,66,0,125,4,124,3,160,2,116,3,124,4,131,1, - 161,1,1,0,116,4,124,1,131,1,100,2,107,2,115,50, - 74,0,130,1,124,3,160,2,124,1,161,1,1,0,124,3, - 160,2,116,5,160,6,124,0,161,1,161,1,1,0,124,3, - 83,0,41,3,122,38,80,114,111,100,117,99,101,32,116,104, - 101,32,100,97,116,97,32,102,111,114,32,97,32,104,97,115, - 104,45,98,97,115,101,100,32,112,121,99,46,114,39,0,0, - 0,114,146,0,0,0,41,7,114,166,0,0,0,114,148,0, - 0,0,114,167,0,0,0,114,21,0,0,0,114,23,0,0, - 0,114,160,0,0,0,114,168,0,0,0,41,5,114,164,0, - 0,0,114,157,0,0,0,90,7,99,104,101,99,107,101,100, - 114,26,0,0,0,114,2,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,218,17,95,99,111,100,101, - 95,116,111,95,104,97,115,104,95,112,121,99,99,2,0,0, - 115,16,0,0,0,8,2,12,1,14,1,16,1,10,1,16, - 1,4,1,255,128,114,171,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,67, - 0,0,0,115,62,0,0,0,100,1,100,2,108,0,125,1, - 116,1,160,2,124,0,161,1,106,3,125,2,124,1,160,4, - 124,2,161,1,125,3,116,1,160,5,100,2,100,3,161,2, - 125,4,124,4,160,6,124,0,160,6,124,3,100,1,25,0, - 161,1,161,1,83,0,41,4,122,121,68,101,99,111,100,101, - 32,98,121,116,101,115,32,114,101,112,114,101,115,101,110,116, - 105,110,103,32,115,111,117,114,99,101,32,99,111,100,101,32, - 97,110,100,32,114,101,116,117,114,110,32,116,104,101,32,115, - 116,114,105,110,103,46,10,10,32,32,32,32,85,110,105,118, - 101,114,115,97,108,32,110,101,119,108,105,110,101,32,115,117, - 112,112,111,114,116,32,105,115,32,117,115,101,100,32,105,110, - 32,116,104,101,32,100,101,99,111,100,105,110,103,46,10,32, - 32,32,32,114,73,0,0,0,78,84,41,7,218,8,116,111, - 107,101,110,105,122,101,114,64,0,0,0,90,7,66,121,116, - 101,115,73,79,90,8,114,101,97,100,108,105,110,101,90,15, - 100,101,116,101,99,116,95,101,110,99,111,100,105,110,103,90, - 25,73,110,99,114,101,109,101,110,116,97,108,78,101,119,108, - 105,110,101,68,101,99,111,100,101,114,218,6,100,101,99,111, - 100,101,41,5,218,12,115,111,117,114,99,101,95,98,121,116, - 101,115,114,172,0,0,0,90,21,115,111,117,114,99,101,95, - 98,121,116,101,115,95,114,101,97,100,108,105,110,101,218,8, - 101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110, - 101,95,100,101,99,111,100,101,114,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,13,100,101,99,111,100,101, - 95,115,111,117,114,99,101,110,2,0,0,115,12,0,0,0, - 8,5,12,1,10,1,12,1,20,1,255,128,114,176,0,0, - 0,169,2,114,140,0,0,0,218,26,115,117,98,109,111,100, - 117,108,101,95,115,101,97,114,99,104,95,108,111,99,97,116, - 105,111,110,115,99,2,0,0,0,0,0,0,0,2,0,0, - 0,9,0,0,0,8,0,0,0,67,0,0,0,115,10,1, - 0,0,124,1,100,1,117,0,114,56,100,2,125,1,116,0, - 124,2,100,3,131,2,114,66,122,14,124,2,160,1,124,0, - 161,1,125,1,87,0,110,28,4,0,116,2,121,54,1,0, - 1,0,1,0,89,0,110,12,48,0,116,3,160,4,124,1, - 161,1,125,1,116,5,106,6,124,0,124,2,124,1,100,4, - 141,3,125,4,100,5,124,4,95,7,124,2,100,1,117,0, - 114,150,116,8,131,0,68,0,93,42,92,2,125,5,125,6, - 124,1,160,9,116,10,124,6,131,1,161,1,114,102,124,5, - 124,0,124,1,131,2,125,2,124,2,124,4,95,11,1,0, - 113,150,113,102,100,1,83,0,124,3,116,12,117,0,114,214, - 116,0,124,2,100,6,131,2,114,220,122,14,124,2,160,13, - 124,0,161,1,125,7,87,0,110,18,4,0,116,2,121,200, - 1,0,1,0,1,0,89,0,110,20,48,0,124,7,114,220, - 103,0,124,4,95,14,110,6,124,3,124,4,95,14,124,4, - 106,14,103,0,107,2,144,1,114,6,124,1,144,1,114,6, - 116,15,124,1,131,1,100,7,25,0,125,8,124,4,106,14, - 160,16,124,8,161,1,1,0,124,4,83,0,41,8,97,61, - 1,0,0,82,101,116,117,114,110,32,97,32,109,111,100,117, - 108,101,32,115,112,101,99,32,98,97,115,101,100,32,111,110, - 32,97,32,102,105,108,101,32,108,111,99,97,116,105,111,110, - 46,10,10,32,32,32,32,84,111,32,105,110,100,105,99,97, - 116,101,32,116,104,97,116,32,116,104,101,32,109,111,100,117, - 108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,44, - 32,115,101,116,10,32,32,32,32,115,117,98,109,111,100,117, - 108,101,95,115,101,97,114,99,104,95,108,111,99,97,116,105, - 111,110,115,32,116,111,32,97,32,108,105,115,116,32,111,102, - 32,100,105,114,101,99,116,111,114,121,32,112,97,116,104,115, - 46,32,32,65,110,10,32,32,32,32,101,109,112,116,121,32, - 108,105,115,116,32,105,115,32,115,117,102,102,105,99,105,101, - 110,116,44,32,116,104,111,117,103,104,32,105,116,115,32,110, - 111,116,32,111,116,104,101,114,119,105,115,101,32,117,115,101, - 102,117,108,32,116,111,32,116,104,101,10,32,32,32,32,105, - 109,112,111,114,116,32,115,121,115,116,101,109,46,10,10,32, - 32,32,32,84,104,101,32,108,111,97,100,101,114,32,109,117, - 115,116,32,116,97,107,101,32,97,32,115,112,101,99,32,97, - 115,32,105,116,115,32,111,110,108,121,32,95,95,105,110,105, - 116,95,95,40,41,32,97,114,103,46,10,10,32,32,32,32, - 78,122,9,60,117,110,107,110,111,119,110,62,218,12,103,101, - 116,95,102,105,108,101,110,97,109,101,169,1,218,6,111,114, - 105,103,105,110,84,218,10,105,115,95,112,97,99,107,97,103, - 101,114,73,0,0,0,41,17,114,128,0,0,0,114,179,0, - 0,0,114,117,0,0,0,114,4,0,0,0,114,79,0,0, - 0,114,134,0,0,0,218,10,77,111,100,117,108,101,83,112, - 101,99,90,13,95,115,101,116,95,102,105,108,101,97,116,116, - 114,218,27,95,103,101,116,95,115,117,112,112,111,114,116,101, - 100,95,102,105,108,101,95,108,111,97,100,101,114,115,114,110, - 0,0,0,114,111,0,0,0,114,140,0,0,0,218,9,95, - 80,79,80,85,76,65,84,69,114,182,0,0,0,114,178,0, - 0,0,114,47,0,0,0,218,6,97,112,112,101,110,100,41, - 9,114,116,0,0,0,90,8,108,111,99,97,116,105,111,110, - 114,140,0,0,0,114,178,0,0,0,218,4,115,112,101,99, - 218,12,108,111,97,100,101,114,95,99,108,97,115,115,218,8, - 115,117,102,102,105,120,101,115,114,182,0,0,0,90,7,100, - 105,114,110,97,109,101,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,218,23,115,112,101,99,95,102,114,111,109, - 95,102,105,108,101,95,108,111,99,97,116,105,111,110,127,2, - 0,0,115,64,0,0,0,8,12,4,4,10,1,2,2,14, - 1,12,1,6,1,10,2,16,8,6,1,8,3,14,1,14, - 1,10,1,6,1,6,1,4,2,8,3,10,2,2,1,14, - 1,12,1,6,1,4,2,8,1,6,2,12,1,6,1,12, - 1,12,1,4,2,255,128,114,190,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, - 0,64,0,0,0,115,80,0,0,0,101,0,90,1,100,0, - 90,2,100,1,90,3,100,2,90,4,100,3,90,5,100,4, - 90,6,101,7,100,5,100,6,132,0,131,1,90,8,101,7, - 100,7,100,8,132,0,131,1,90,9,101,7,100,14,100,10, - 100,11,132,1,131,1,90,10,101,7,100,15,100,12,100,13, - 132,1,131,1,90,11,100,9,83,0,41,16,218,21,87,105, - 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110, - 100,101,114,122,62,77,101,116,97,32,112,97,116,104,32,102, - 105,110,100,101,114,32,102,111,114,32,109,111,100,117,108,101, - 115,32,100,101,99,108,97,114,101,100,32,105,110,32,116,104, - 101,32,87,105,110,100,111,119,115,32,114,101,103,105,115,116, - 114,121,46,122,59,83,111,102,116,119,97,114,101,92,80,121, - 116,104,111,110,92,80,121,116,104,111,110,67,111,114,101,92, - 123,115,121,115,95,118,101,114,115,105,111,110,125,92,77,111, - 100,117,108,101,115,92,123,102,117,108,108,110,97,109,101,125, - 122,65,83,111,102,116,119,97,114,101,92,80,121,116,104,111, - 110,92,80,121,116,104,111,110,67,111,114,101,92,123,115,121, - 115,95,118,101,114,115,105,111,110,125,92,77,111,100,117,108, - 101,115,92,123,102,117,108,108,110,97,109,101,125,92,68,101, - 98,117,103,70,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,8,0,0,0,67,0,0,0,115,50,0, - 0,0,122,16,116,0,160,1,116,0,106,2,124,1,161,2, - 87,0,83,0,4,0,116,3,121,48,1,0,1,0,1,0, - 116,0,160,1,116,0,106,4,124,1,161,2,6,0,89,0, - 83,0,48,0,114,109,0,0,0,41,5,218,6,119,105,110, - 114,101,103,90,7,79,112,101,110,75,101,121,90,17,72,75, - 69,89,95,67,85,82,82,69,78,84,95,85,83,69,82,114, - 50,0,0,0,90,18,72,75,69,89,95,76,79,67,65,76, - 95,77,65,67,72,73,78,69,41,2,218,3,99,108,115,114, - 7,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,14,95,111,112,101,110,95,114,101,103,105,115, - 116,114,121,207,2,0,0,115,10,0,0,0,2,2,16,1, - 12,1,20,1,255,128,122,36,87,105,110,100,111,119,115,82, - 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,111, - 112,101,110,95,114,101,103,105,115,116,114,121,99,2,0,0, - 0,0,0,0,0,0,0,0,0,6,0,0,0,8,0,0, - 0,67,0,0,0,115,132,0,0,0,124,0,106,0,114,14, - 124,0,106,1,125,2,110,6,124,0,106,2,125,2,124,2, - 106,3,124,1,100,1,116,4,106,5,100,0,100,2,133,2, - 25,0,22,0,100,3,141,2,125,3,122,58,124,0,160,6, - 124,3,161,1,143,28,125,4,116,7,160,8,124,4,100,4, - 161,2,125,5,87,0,100,0,4,0,4,0,131,3,1,0, - 110,16,49,0,115,94,48,0,1,0,1,0,1,0,89,0, - 1,0,87,0,110,20,4,0,116,9,121,126,1,0,1,0, - 1,0,89,0,100,0,83,0,48,0,124,5,83,0,41,5, - 78,122,5,37,100,46,37,100,114,28,0,0,0,41,2,114, - 139,0,0,0,90,11,115,121,115,95,118,101,114,115,105,111, - 110,114,40,0,0,0,41,10,218,11,68,69,66,85,71,95, - 66,85,73,76,68,218,18,82,69,71,73,83,84,82,89,95, - 75,69,89,95,68,69,66,85,71,218,12,82,69,71,73,83, - 84,82,89,95,75,69,89,114,62,0,0,0,114,1,0,0, - 0,218,12,118,101,114,115,105,111,110,95,105,110,102,111,114, - 194,0,0,0,114,192,0,0,0,90,10,81,117,101,114,121, - 86,97,108,117,101,114,50,0,0,0,41,6,114,193,0,0, - 0,114,139,0,0,0,90,12,114,101,103,105,115,116,114,121, - 95,107,101,121,114,7,0,0,0,90,4,104,107,101,121,218, - 8,102,105,108,101,112,97,116,104,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,16,95,115,101,97,114,99, - 104,95,114,101,103,105,115,116,114,121,214,2,0,0,115,26, - 0,0,0,6,2,8,1,6,2,6,1,16,1,6,255,2, - 2,12,1,46,1,12,1,8,1,4,1,255,128,122,38,87, - 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, - 110,100,101,114,46,95,115,101,97,114,99,104,95,114,101,103, - 105,115,116,114,121,78,99,4,0,0,0,0,0,0,0,0, - 0,0,0,8,0,0,0,8,0,0,0,67,0,0,0,115, - 118,0,0,0,124,0,160,0,124,1,161,1,125,4,124,4, - 100,0,117,0,114,22,100,0,83,0,122,12,116,1,124,4, - 131,1,1,0,87,0,110,20,4,0,116,2,121,54,1,0, - 1,0,1,0,89,0,100,0,83,0,48,0,116,3,131,0, - 68,0,93,50,92,2,125,5,125,6,124,4,160,4,116,5, - 124,6,131,1,161,1,114,62,116,6,106,7,124,1,124,5, - 124,1,124,4,131,2,124,4,100,1,141,3,125,7,124,7, - 2,0,1,0,83,0,100,0,83,0,41,2,78,114,180,0, - 0,0,41,8,114,200,0,0,0,114,49,0,0,0,114,50, - 0,0,0,114,184,0,0,0,114,110,0,0,0,114,111,0, - 0,0,114,134,0,0,0,218,16,115,112,101,99,95,102,114, - 111,109,95,108,111,97,100,101,114,41,8,114,193,0,0,0, - 114,139,0,0,0,114,44,0,0,0,218,6,116,97,114,103, - 101,116,114,199,0,0,0,114,140,0,0,0,114,189,0,0, - 0,114,187,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,218,9,102,105,110,100,95,115,112,101,99, - 229,2,0,0,115,32,0,0,0,10,2,8,1,4,1,2, - 1,12,1,12,1,8,1,14,1,14,1,6,1,8,1,2, - 1,6,254,8,3,4,128,255,128,122,31,87,105,110,100,111, - 119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114, - 46,102,105,110,100,95,115,112,101,99,99,3,0,0,0,0, - 0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67, - 0,0,0,115,30,0,0,0,124,0,160,0,124,1,124,2, - 161,2,125,3,124,3,100,1,117,1,114,26,124,3,106,1, - 83,0,100,1,83,0,41,2,122,108,70,105,110,100,32,109, - 111,100,117,108,101,32,110,97,109,101,100,32,105,110,32,116, - 104,101,32,114,101,103,105,115,116,114,121,46,10,10,32,32, - 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108, - 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,78,169,2,114,203,0,0,0,114,140, - 0,0,0,169,4,114,193,0,0,0,114,139,0,0,0,114, - 44,0,0,0,114,187,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,11,102,105,110,100,95,109, - 111,100,117,108,101,245,2,0,0,115,10,0,0,0,12,7, - 8,1,6,1,4,2,255,128,122,33,87,105,110,100,111,119, - 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, - 102,105,110,100,95,109,111,100,117,108,101,41,2,78,78,41, - 1,78,41,12,114,125,0,0,0,114,124,0,0,0,114,126, - 0,0,0,114,127,0,0,0,114,197,0,0,0,114,196,0, - 0,0,114,195,0,0,0,218,11,99,108,97,115,115,109,101, - 116,104,111,100,114,194,0,0,0,114,200,0,0,0,114,203, - 0,0,0,114,206,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,5,0,0,0,114,8,0,0,0,114,191,0,0, - 0,195,2,0,0,115,32,0,0,0,8,0,4,2,2,3, - 2,255,2,4,2,255,4,3,2,2,10,1,2,6,10,1, - 2,14,12,1,2,15,16,1,255,128,114,191,0,0,0,99, + 124,0,0,0,116,0,124,0,100,1,100,2,133,2,25,0, + 131,1,124,1,100,3,64,0,107,3,114,62,100,4,124,3, + 155,2,157,2,125,5,116,1,160,2,100,5,124,5,161,2, + 1,0,116,3,124,5,102,1,105,0,124,4,164,1,142,1, + 130,1,124,2,100,6,117,1,114,120,116,0,124,0,100,2, + 100,7,133,2,25,0,131,1,124,2,100,3,64,0,107,3, + 114,116,116,3,100,4,124,3,155,2,157,2,102,1,105,0, + 124,4,164,1,142,1,130,1,100,6,83,0,100,6,83,0, + 41,8,97,7,2,0,0,86,97,108,105,100,97,116,101,32, + 97,32,112,121,99,32,97,103,97,105,110,115,116,32,116,104, + 101,32,115,111,117,114,99,101,32,108,97,115,116,45,109,111, + 100,105,102,105,101,100,32,116,105,109,101,46,10,10,32,32, + 32,32,42,100,97,116,97,42,32,105,115,32,116,104,101,32, + 99,111,110,116,101,110,116,115,32,111,102,32,116,104,101,32, + 112,121,99,32,102,105,108,101,46,32,40,79,110,108,121,32, + 116,104,101,32,102,105,114,115,116,32,49,54,32,98,121,116, + 101,115,32,97,114,101,10,32,32,32,32,114,101,113,117,105, + 114,101,100,46,41,10,10,32,32,32,32,42,115,111,117,114, + 99,101,95,109,116,105,109,101,42,32,105,115,32,116,104,101, + 32,108,97,115,116,32,109,111,100,105,102,105,101,100,32,116, + 105,109,101,115,116,97,109,112,32,111,102,32,116,104,101,32, + 115,111,117,114,99,101,32,102,105,108,101,46,10,10,32,32, + 32,32,42,115,111,117,114,99,101,95,115,105,122,101,42,32, + 105,115,32,78,111,110,101,32,111,114,32,116,104,101,32,115, + 105,122,101,32,111,102,32,116,104,101,32,115,111,117,114,99, + 101,32,102,105,108,101,32,105,110,32,98,121,116,101,115,46, + 10,10,32,32,32,32,42,110,97,109,101,42,32,105,115,32, + 116,104,101,32,110,97,109,101,32,111,102,32,116,104,101,32, + 109,111,100,117,108,101,32,98,101,105,110,103,32,105,109,112, + 111,114,116,101,100,46,32,73,116,32,105,115,32,117,115,101, + 100,32,102,111,114,32,108,111,103,103,105,110,103,46,10,10, + 32,32,32,32,42,101,120,99,95,100,101,116,97,105,108,115, + 42,32,105,115,32,97,32,100,105,99,116,105,111,110,97,114, + 121,32,112,97,115,115,101,100,32,116,111,32,73,109,112,111, + 114,116,69,114,114,111,114,32,105,102,32,105,116,32,114,97, + 105,115,101,100,32,102,111,114,10,32,32,32,32,105,109,112, + 114,111,118,101,100,32,100,101,98,117,103,103,105,110,103,46, + 10,10,32,32,32,32,65,110,32,73,109,112,111,114,116,69, + 114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,105, + 102,32,116,104,101,32,98,121,116,101,99,111,100,101,32,105, + 115,32,115,116,97,108,101,46,10,10,32,32,32,32,114,150, + 0,0,0,233,12,0,0,0,114,27,0,0,0,122,22,98, + 121,116,101,99,111,100,101,32,105,115,32,115,116,97,108,101, + 32,102,111,114,32,114,148,0,0,0,78,114,149,0,0,0, + 41,4,114,38,0,0,0,114,139,0,0,0,114,153,0,0, + 0,114,122,0,0,0,41,6,114,37,0,0,0,218,12,115, + 111,117,114,99,101,95,109,116,105,109,101,218,11,115,111,117, + 114,99,101,95,115,105,122,101,114,121,0,0,0,114,155,0, + 0,0,114,98,0,0,0,114,7,0,0,0,114,7,0,0, + 0,114,8,0,0,0,218,23,95,118,97,108,105,100,97,116, + 101,95,116,105,109,101,115,116,97,109,112,95,112,121,99,64, + 2,0,0,115,20,0,0,0,24,19,10,1,12,1,16,1, + 8,1,22,1,2,255,22,2,8,254,255,128,114,160,0,0, + 0,99,4,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,4,0,0,0,67,0,0,0,115,42,0,0,0,124, + 0,100,1,100,2,133,2,25,0,124,1,107,3,114,38,116, + 0,100,3,124,2,155,2,157,2,102,1,105,0,124,3,164, + 1,142,1,130,1,100,4,83,0,41,5,97,243,1,0,0, + 86,97,108,105,100,97,116,101,32,97,32,104,97,115,104,45, + 98,97,115,101,100,32,112,121,99,32,98,121,32,99,104,101, + 99,107,105,110,103,32,116,104,101,32,114,101,97,108,32,115, + 111,117,114,99,101,32,104,97,115,104,32,97,103,97,105,110, + 115,116,32,116,104,101,32,111,110,101,32,105,110,10,32,32, + 32,32,116,104,101,32,112,121,99,32,104,101,97,100,101,114, + 46,10,10,32,32,32,32,42,100,97,116,97,42,32,105,115, + 32,116,104,101,32,99,111,110,116,101,110,116,115,32,111,102, + 32,116,104,101,32,112,121,99,32,102,105,108,101,46,32,40, + 79,110,108,121,32,116,104,101,32,102,105,114,115,116,32,49, + 54,32,98,121,116,101,115,32,97,114,101,10,32,32,32,32, + 114,101,113,117,105,114,101,100,46,41,10,10,32,32,32,32, + 42,115,111,117,114,99,101,95,104,97,115,104,42,32,105,115, + 32,116,104,101,32,105,109,112,111,114,116,108,105,98,46,117, + 116,105,108,46,115,111,117,114,99,101,95,104,97,115,104,40, + 41,32,111,102,32,116,104,101,32,115,111,117,114,99,101,32, + 102,105,108,101,46,10,10,32,32,32,32,42,110,97,109,101, + 42,32,105,115,32,116,104,101,32,110,97,109,101,32,111,102, + 32,116,104,101,32,109,111,100,117,108,101,32,98,101,105,110, + 103,32,105,109,112,111,114,116,101,100,46,32,73,116,32,105, + 115,32,117,115,101,100,32,102,111,114,32,108,111,103,103,105, + 110,103,46,10,10,32,32,32,32,42,101,120,99,95,100,101, + 116,97,105,108,115,42,32,105,115,32,97,32,100,105,99,116, + 105,111,110,97,114,121,32,112,97,115,115,101,100,32,116,111, + 32,73,109,112,111,114,116,69,114,114,111,114,32,105,102,32, + 105,116,32,114,97,105,115,101,100,32,102,111,114,10,32,32, + 32,32,105,109,112,114,111,118,101,100,32,100,101,98,117,103, + 103,105,110,103,46,10,10,32,32,32,32,65,110,32,73,109, + 112,111,114,116,69,114,114,111,114,32,105,115,32,114,97,105, + 115,101,100,32,105,102,32,116,104,101,32,98,121,116,101,99, + 111,100,101,32,105,115,32,115,116,97,108,101,46,10,10,32, + 32,32,32,114,150,0,0,0,114,149,0,0,0,122,46,104, + 97,115,104,32,105,110,32,98,121,116,101,99,111,100,101,32, + 100,111,101,115,110,39,116,32,109,97,116,99,104,32,104,97, + 115,104,32,111,102,32,115,111,117,114,99,101,32,78,41,1, + 114,122,0,0,0,41,4,114,37,0,0,0,218,11,115,111, + 117,114,99,101,95,104,97,115,104,114,121,0,0,0,114,155, + 0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,218,18,95,118,97,108,105,100,97,116,101,95,104,97, + 115,104,95,112,121,99,92,2,0,0,115,16,0,0,0,16, + 17,2,1,8,1,4,255,2,2,6,254,4,255,255,128,114, + 162,0,0,0,99,4,0,0,0,0,0,0,0,0,0,0, + 0,5,0,0,0,5,0,0,0,67,0,0,0,115,76,0, + 0,0,116,0,160,1,124,0,161,1,125,4,116,2,124,4, + 116,3,131,2,114,56,116,4,160,5,100,1,124,2,161,2, + 1,0,124,3,100,2,117,1,114,52,116,6,160,7,124,4, + 124,3,161,2,1,0,124,4,83,0,116,8,100,3,160,9, + 124,2,161,1,124,1,124,2,100,4,141,3,130,1,41,5, + 122,35,67,111,109,112,105,108,101,32,98,121,116,101,99,111, + 100,101,32,97,115,32,102,111,117,110,100,32,105,110,32,97, + 32,112,121,99,46,122,21,99,111,100,101,32,111,98,106,101, + 99,116,32,102,114,111,109,32,123,33,114,125,78,122,23,78, + 111,110,45,99,111,100,101,32,111,98,106,101,99,116,32,105, + 110,32,123,33,114,125,169,2,114,121,0,0,0,114,52,0, + 0,0,41,10,218,7,109,97,114,115,104,97,108,90,5,108, + 111,97,100,115,218,10,105,115,105,110,115,116,97,110,99,101, + 218,10,95,99,111,100,101,95,116,121,112,101,114,139,0,0, + 0,114,153,0,0,0,218,4,95,105,109,112,90,16,95,102, + 105,120,95,99,111,95,102,105,108,101,110,97,109,101,114,122, + 0,0,0,114,70,0,0,0,41,5,114,37,0,0,0,114, + 121,0,0,0,114,111,0,0,0,114,112,0,0,0,218,4, + 99,111,100,101,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,17,95,99,111,109,112,105,108,101,95,98,121, + 116,101,99,111,100,101,116,2,0,0,115,20,0,0,0,10, + 2,10,1,12,1,8,1,12,1,4,1,10,2,4,1,6, + 255,255,128,114,169,0,0,0,99,3,0,0,0,0,0,0, + 0,0,0,0,0,4,0,0,0,5,0,0,0,67,0,0, + 0,115,70,0,0,0,116,0,116,1,131,1,125,3,124,3, + 160,2,116,3,100,1,131,1,161,1,1,0,124,3,160,2, + 116,3,124,1,131,1,161,1,1,0,124,3,160,2,116,3, + 124,2,131,1,161,1,1,0,124,3,160,2,116,4,160,5, + 124,0,161,1,161,1,1,0,124,3,83,0,41,3,122,43, + 80,114,111,100,117,99,101,32,116,104,101,32,100,97,116,97, + 32,102,111,114,32,97,32,116,105,109,101,115,116,97,109,112, + 45,98,97,115,101,100,32,112,121,99,46,114,0,0,0,0, + 78,41,6,218,9,98,121,116,101,97,114,114,97,121,114,152, + 0,0,0,218,6,101,120,116,101,110,100,114,33,0,0,0, + 114,164,0,0,0,218,5,100,117,109,112,115,41,4,114,168, + 0,0,0,218,5,109,116,105,109,101,114,159,0,0,0,114, + 37,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,22,95,99,111,100,101,95,116,111,95,116,105, + 109,101,115,116,97,109,112,95,112,121,99,129,2,0,0,115, + 14,0,0,0,8,2,14,1,14,1,14,1,16,1,4,1, + 255,128,114,174,0,0,0,84,99,3,0,0,0,0,0,0, + 0,0,0,0,0,5,0,0,0,5,0,0,0,67,0,0, + 0,115,80,0,0,0,116,0,116,1,131,1,125,3,100,1, + 124,2,100,1,62,0,66,0,125,4,124,3,160,2,116,3, + 124,4,131,1,161,1,1,0,116,4,124,1,131,1,100,2, + 107,2,115,50,74,0,130,1,124,3,160,2,124,1,161,1, + 1,0,124,3,160,2,116,5,160,6,124,0,161,1,161,1, + 1,0,124,3,83,0,41,4,122,38,80,114,111,100,117,99, + 101,32,116,104,101,32,100,97,116,97,32,102,111,114,32,97, + 32,104,97,115,104,45,98,97,115,101,100,32,112,121,99,46, + 114,3,0,0,0,114,150,0,0,0,78,41,7,114,170,0, + 0,0,114,152,0,0,0,114,171,0,0,0,114,33,0,0, + 0,114,4,0,0,0,114,164,0,0,0,114,172,0,0,0, + 41,5,114,168,0,0,0,114,161,0,0,0,90,7,99,104, + 101,99,107,101,100,114,37,0,0,0,114,16,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,17, + 95,99,111,100,101,95,116,111,95,104,97,115,104,95,112,121, + 99,139,2,0,0,115,16,0,0,0,8,2,12,1,14,1, + 16,1,10,1,16,1,4,1,255,128,114,175,0,0,0,99, + 1,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, + 6,0,0,0,67,0,0,0,115,62,0,0,0,100,1,100, + 2,108,0,125,1,116,1,160,2,124,0,161,1,106,3,125, + 2,124,1,160,4,124,2,161,1,125,3,116,1,160,5,100, + 2,100,3,161,2,125,4,124,4,160,6,124,0,160,6,124, + 3,100,1,25,0,161,1,161,1,83,0,41,4,122,121,68, + 101,99,111,100,101,32,98,121,116,101,115,32,114,101,112,114, + 101,115,101,110,116,105,110,103,32,115,111,117,114,99,101,32, + 99,111,100,101,32,97,110,100,32,114,101,116,117,114,110,32, + 116,104,101,32,115,116,114,105,110,103,46,10,10,32,32,32, + 32,85,110,105,118,101,114,115,97,108,32,110,101,119,108,105, + 110,101,32,115,117,112,112,111,114,116,32,105,115,32,117,115, + 101,100,32,105,110,32,116,104,101,32,100,101,99,111,100,105, + 110,103,46,10,32,32,32,32,114,0,0,0,0,78,84,41, + 7,218,8,116,111,107,101,110,105,122,101,114,72,0,0,0, + 90,7,66,121,116,101,115,73,79,90,8,114,101,97,100,108, + 105,110,101,90,15,100,101,116,101,99,116,95,101,110,99,111, + 100,105,110,103,90,25,73,110,99,114,101,109,101,110,116,97, + 108,78,101,119,108,105,110,101,68,101,99,111,100,101,114,218, + 6,100,101,99,111,100,101,41,5,218,12,115,111,117,114,99, + 101,95,98,121,116,101,115,114,176,0,0,0,90,21,115,111, + 117,114,99,101,95,98,121,116,101,115,95,114,101,97,100,108, + 105,110,101,218,8,101,110,99,111,100,105,110,103,90,15,110, + 101,119,108,105,110,101,95,100,101,99,111,100,101,114,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,218,13,100, + 101,99,111,100,101,95,115,111,117,114,99,101,150,2,0,0, + 115,12,0,0,0,8,5,12,1,10,1,12,1,20,1,255, + 128,114,180,0,0,0,169,2,114,144,0,0,0,218,26,115, + 117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,95, + 108,111,99,97,116,105,111,110,115,99,2,0,0,0,0,0, + 0,0,2,0,0,0,9,0,0,0,8,0,0,0,67,0, + 0,0,115,8,1,0,0,124,1,100,1,117,0,114,56,100, + 2,125,1,116,0,124,2,100,3,131,2,114,66,122,14,124, + 2,160,1,124,0,161,1,125,1,87,0,110,28,4,0,116, + 2,121,54,1,0,1,0,1,0,89,0,110,12,48,0,116, + 3,160,4,124,1,161,1,125,1,116,5,106,6,124,0,124, + 2,124,1,100,4,141,3,125,4,100,5,124,4,95,7,124, + 2,100,1,117,0,114,148,116,8,131,0,68,0,93,40,92, + 2,125,5,125,6,124,1,160,9,116,10,124,6,131,1,161, + 1,114,102,124,5,124,0,124,1,131,2,125,2,124,2,124, + 4,95,11,1,0,113,148,100,1,83,0,124,3,116,12,117, + 0,114,212,116,0,124,2,100,6,131,2,114,218,122,14,124, + 2,160,13,124,0,161,1,125,7,87,0,110,18,4,0,116, + 2,121,198,1,0,1,0,1,0,89,0,110,20,48,0,124, + 7,114,218,103,0,124,4,95,14,110,6,124,3,124,4,95, + 14,124,4,106,14,103,0,107,2,144,1,114,4,124,1,144, + 1,114,4,116,15,124,1,131,1,100,7,25,0,125,8,124, + 4,106,14,160,16,124,8,161,1,1,0,124,4,83,0,41, + 8,97,61,1,0,0,82,101,116,117,114,110,32,97,32,109, + 111,100,117,108,101,32,115,112,101,99,32,98,97,115,101,100, + 32,111,110,32,97,32,102,105,108,101,32,108,111,99,97,116, + 105,111,110,46,10,10,32,32,32,32,84,111,32,105,110,100, + 105,99,97,116,101,32,116,104,97,116,32,116,104,101,32,109, + 111,100,117,108,101,32,105,115,32,97,32,112,97,99,107,97, + 103,101,44,32,115,101,116,10,32,32,32,32,115,117,98,109, + 111,100,117,108,101,95,115,101,97,114,99,104,95,108,111,99, + 97,116,105,111,110,115,32,116,111,32,97,32,108,105,115,116, + 32,111,102,32,100,105,114,101,99,116,111,114,121,32,112,97, + 116,104,115,46,32,32,65,110,10,32,32,32,32,101,109,112, + 116,121,32,108,105,115,116,32,105,115,32,115,117,102,102,105, + 99,105,101,110,116,44,32,116,104,111,117,103,104,32,105,116, + 115,32,110,111,116,32,111,116,104,101,114,119,105,115,101,32, + 117,115,101,102,117,108,32,116,111,32,116,104,101,10,32,32, + 32,32,105,109,112,111,114,116,32,115,121,115,116,101,109,46, + 10,10,32,32,32,32,84,104,101,32,108,111,97,100,101,114, + 32,109,117,115,116,32,116,97,107,101,32,97,32,115,112,101, + 99,32,97,115,32,105,116,115,32,111,110,108,121,32,95,95, + 105,110,105,116,95,95,40,41,32,97,114,103,46,10,10,32, + 32,32,32,78,122,9,60,117,110,107,110,111,119,110,62,218, + 12,103,101,116,95,102,105,108,101,110,97,109,101,169,1,218, + 6,111,114,105,103,105,110,84,218,10,105,115,95,112,97,99, + 107,97,103,101,114,0,0,0,0,41,17,114,133,0,0,0, + 114,183,0,0,0,114,122,0,0,0,114,18,0,0,0,114, + 85,0,0,0,114,139,0,0,0,218,10,77,111,100,117,108, + 101,83,112,101,99,90,13,95,115,101,116,95,102,105,108,101, + 97,116,116,114,218,27,95,103,101,116,95,115,117,112,112,111, + 114,116,101,100,95,102,105,108,101,95,108,111,97,100,101,114, + 115,114,115,0,0,0,114,116,0,0,0,114,144,0,0,0, + 218,9,95,80,79,80,85,76,65,84,69,114,186,0,0,0, + 114,182,0,0,0,114,55,0,0,0,218,6,97,112,112,101, + 110,100,41,9,114,121,0,0,0,90,8,108,111,99,97,116, + 105,111,110,114,144,0,0,0,114,182,0,0,0,218,4,115, + 112,101,99,218,12,108,111,97,100,101,114,95,99,108,97,115, + 115,218,8,115,117,102,102,105,120,101,115,114,186,0,0,0, + 90,7,100,105,114,110,97,109,101,114,7,0,0,0,114,7, + 0,0,0,114,8,0,0,0,218,23,115,112,101,99,95,102, + 114,111,109,95,102,105,108,101,95,108,111,99,97,116,105,111, + 110,167,2,0,0,115,64,0,0,0,8,12,4,4,10,1, + 2,2,14,1,12,1,6,1,10,2,16,8,6,1,8,3, + 14,1,14,1,10,1,6,1,4,1,4,2,8,3,10,2, + 2,1,14,1,12,1,6,1,4,2,8,1,6,2,12,1, + 6,1,12,1,12,1,4,2,255,128,114,194,0,0,0,99, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,64,0,0,0,115,48,0,0,0,101,0,90, - 1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,90, - 4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,90, - 6,100,8,100,9,132,0,90,7,100,10,83,0,41,11,218, - 13,95,76,111,97,100,101,114,66,97,115,105,99,115,122,83, - 66,97,115,101,32,99,108,97,115,115,32,111,102,32,99,111, - 109,109,111,110,32,99,111,100,101,32,110,101,101,100,101,100, - 32,98,121,32,98,111,116,104,32,83,111,117,114,99,101,76, - 111,97,100,101,114,32,97,110,100,10,32,32,32,32,83,111, - 117,114,99,101,108,101,115,115,70,105,108,101,76,111,97,100, - 101,114,46,99,2,0,0,0,0,0,0,0,0,0,0,0, - 5,0,0,0,4,0,0,0,67,0,0,0,115,64,0,0, - 0,116,0,124,0,160,1,124,1,161,1,131,1,100,1,25, - 0,125,2,124,2,160,2,100,2,100,1,161,2,100,3,25, - 0,125,3,124,1,160,3,100,2,161,1,100,4,25,0,125, - 4,124,3,100,5,107,2,111,62,124,4,100,5,107,3,83, - 0,41,6,122,141,67,111,110,99,114,101,116,101,32,105,109, - 112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,32, - 73,110,115,112,101,99,116,76,111,97,100,101,114,46,105,115, - 95,112,97,99,107,97,103,101,32,98,121,32,99,104,101,99, - 107,105,110,103,32,105,102,10,32,32,32,32,32,32,32,32, - 116,104,101,32,112,97,116,104,32,114,101,116,117,114,110,101, - 100,32,98,121,32,103,101,116,95,102,105,108,101,110,97,109, - 101,32,104,97,115,32,97,32,102,105,108,101,110,97,109,101, - 32,111,102,32,39,95,95,105,110,105,116,95,95,46,112,121, - 39,46,114,39,0,0,0,114,71,0,0,0,114,73,0,0, - 0,114,28,0,0,0,218,8,95,95,105,110,105,116,95,95, - 41,4,114,47,0,0,0,114,179,0,0,0,114,43,0,0, - 0,114,41,0,0,0,41,5,114,118,0,0,0,114,139,0, - 0,0,114,96,0,0,0,90,13,102,105,108,101,110,97,109, - 101,95,98,97,115,101,90,9,116,97,105,108,95,110,97,109, - 101,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 114,182,0,0,0,8,3,0,0,115,10,0,0,0,18,3, - 16,1,14,1,16,1,255,128,122,24,95,76,111,97,100,101, - 114,66,97,115,105,99,115,46,105,115,95,112,97,99,107,97, - 103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, - 100,1,83,0,169,2,122,42,85,115,101,32,100,101,102,97, - 117,108,116,32,115,101,109,97,110,116,105,99,115,32,102,111, - 114,32,109,111,100,117,108,101,32,99,114,101,97,116,105,111, - 110,46,78,114,5,0,0,0,169,2,114,118,0,0,0,114, - 187,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,117, - 108,101,16,3,0,0,115,4,0,0,0,4,128,255,128,122, - 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, - 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,5,0,0, - 0,67,0,0,0,115,56,0,0,0,124,0,160,0,124,1, - 106,1,161,1,125,2,124,2,100,1,117,0,114,36,116,2, - 100,2,160,3,124,1,106,1,161,1,131,1,130,1,116,4, - 160,5,116,6,124,2,124,1,106,7,161,3,1,0,100,1, - 83,0,41,3,122,19,69,120,101,99,117,116,101,32,116,104, - 101,32,109,111,100,117,108,101,46,78,122,52,99,97,110,110, - 111,116,32,108,111,97,100,32,109,111,100,117,108,101,32,123, - 33,114,125,32,119,104,101,110,32,103,101,116,95,99,111,100, - 101,40,41,32,114,101,116,117,114,110,115,32,78,111,110,101, - 41,8,218,8,103,101,116,95,99,111,100,101,114,125,0,0, - 0,114,117,0,0,0,114,62,0,0,0,114,134,0,0,0, - 218,25,95,99,97,108,108,95,119,105,116,104,95,102,114,97, - 109,101,115,95,114,101,109,111,118,101,100,218,4,101,120,101, - 99,114,131,0,0,0,41,3,114,118,0,0,0,218,6,109, - 111,100,117,108,101,114,164,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,218,11,101,120,101,99,95, - 109,111,100,117,108,101,19,3,0,0,115,16,0,0,0,12, - 2,8,1,6,1,4,1,6,255,16,2,4,128,255,128,122, - 25,95,76,111,97,100,101,114,66,97,115,105,99,115,46,101, - 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, - 0,0,0,115,12,0,0,0,116,0,160,1,124,0,124,1, - 161,2,83,0,41,1,122,26,84,104,105,115,32,109,111,100, - 117,108,101,32,105,115,32,100,101,112,114,101,99,97,116,101, - 100,46,41,2,114,134,0,0,0,218,17,95,108,111,97,100, - 95,109,111,100,117,108,101,95,115,104,105,109,169,2,114,118, - 0,0,0,114,139,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,11,108,111,97,100,95,109,111, - 100,117,108,101,27,3,0,0,115,4,0,0,0,12,2,255, - 128,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, - 46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114, - 125,0,0,0,114,124,0,0,0,114,126,0,0,0,114,127, - 0,0,0,114,182,0,0,0,114,212,0,0,0,114,217,0, - 0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,114,208,0,0,0, - 3,3,0,0,115,14,0,0,0,8,0,4,2,8,3,8, - 8,8,3,12,8,255,128,114,208,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,64,0,0,0,115,74,0,0,0,101,0,90,1,100,0, - 90,2,100,1,100,2,132,0,90,3,100,3,100,4,132,0, - 90,4,100,5,100,6,132,0,90,5,100,7,100,8,132,0, - 90,6,100,9,100,10,132,0,90,7,100,11,100,12,156,1, - 100,13,100,14,132,2,90,8,100,15,100,16,132,0,90,9, - 100,17,83,0,41,18,218,12,83,111,117,114,99,101,76,111, - 97,100,101,114,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,1,0,0,0,67,0,0,0,115,8,0, - 0,0,116,0,130,1,100,1,83,0,41,2,122,165,79,112, - 116,105,111,110,97,108,32,109,101,116,104,111,100,32,116,104, - 97,116,32,114,101,116,117,114,110,115,32,116,104,101,32,109, - 111,100,105,102,105,99,97,116,105,111,110,32,116,105,109,101, - 32,40,97,110,32,105,110,116,41,32,102,111,114,32,116,104, - 101,10,32,32,32,32,32,32,32,32,115,112,101,99,105,102, - 105,101,100,32,112,97,116,104,32,40,97,32,115,116,114,41, - 46,10,10,32,32,32,32,32,32,32,32,82,97,105,115,101, - 115,32,79,83,69,114,114,111,114,32,119,104,101,110,32,116, - 104,101,32,112,97,116,104,32,99,97,110,110,111,116,32,98, - 101,32,104,97,110,100,108,101,100,46,10,32,32,32,32,32, - 32,32,32,78,41,1,114,50,0,0,0,169,2,114,118,0, - 0,0,114,44,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,218,10,112,97,116,104,95,109,116,105, - 109,101,34,3,0,0,115,6,0,0,0,4,6,4,128,255, - 128,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, - 112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, - 0,0,0,115,14,0,0,0,100,1,124,0,160,0,124,1, - 161,1,105,1,83,0,41,2,97,158,1,0,0,79,112,116, - 105,111,110,97,108,32,109,101,116,104,111,100,32,114,101,116, - 117,114,110,105,110,103,32,97,32,109,101,116,97,100,97,116, - 97,32,100,105,99,116,32,102,111,114,32,116,104,101,32,115, - 112,101,99,105,102,105,101,100,10,32,32,32,32,32,32,32, + 4,0,0,0,64,0,0,0,115,88,0,0,0,101,0,90, + 1,100,0,90,2,100,1,90,3,100,2,90,4,100,3,90, + 5,101,6,111,30,100,4,101,7,118,0,90,8,101,9,100, + 5,100,6,132,0,131,1,90,10,101,11,100,7,100,8,132, + 0,131,1,90,12,101,11,100,14,100,10,100,11,132,1,131, + 1,90,13,101,11,100,15,100,12,100,13,132,1,131,1,90, + 14,100,9,83,0,41,16,218,21,87,105,110,100,111,119,115, + 82,101,103,105,115,116,114,121,70,105,110,100,101,114,122,62, + 77,101,116,97,32,112,97,116,104,32,102,105,110,100,101,114, + 32,102,111,114,32,109,111,100,117,108,101,115,32,100,101,99, + 108,97,114,101,100,32,105,110,32,116,104,101,32,87,105,110, + 100,111,119,115,32,114,101,103,105,115,116,114,121,46,122,59, + 83,111,102,116,119,97,114,101,92,80,121,116,104,111,110,92, + 80,121,116,104,111,110,67,111,114,101,92,123,115,121,115,95, + 118,101,114,115,105,111,110,125,92,77,111,100,117,108,101,115, + 92,123,102,117,108,108,110,97,109,101,125,122,65,83,111,102, + 116,119,97,114,101,92,80,121,116,104,111,110,92,80,121,116, + 104,111,110,67,111,114,101,92,123,115,121,115,95,118,101,114, + 115,105,111,110,125,92,77,111,100,117,108,101,115,92,123,102, + 117,108,108,110,97,109,101,125,92,68,101,98,117,103,122,6, + 95,100,46,112,121,100,99,1,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,8,0,0,0,67,0,0,0,115, + 50,0,0,0,122,16,116,0,160,1,116,0,106,2,124,0, + 161,2,87,0,83,0,4,0,116,3,121,48,1,0,1,0, + 1,0,116,0,160,1,116,0,106,4,124,0,161,2,6,0, + 89,0,83,0,48,0,114,114,0,0,0,41,5,218,6,119, + 105,110,114,101,103,90,7,79,112,101,110,75,101,121,90,17, + 72,75,69,89,95,67,85,82,82,69,78,84,95,85,83,69, + 82,114,58,0,0,0,90,18,72,75,69,89,95,76,79,67, + 65,76,95,77,65,67,72,73,78,69,114,19,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,14, + 95,111,112,101,110,95,114,101,103,105,115,116,114,121,247,2, + 0,0,115,10,0,0,0,2,2,16,1,12,1,20,1,255, + 128,122,36,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,46,95,111,112,101,110,95,114, + 101,103,105,115,116,114,121,99,2,0,0,0,0,0,0,0, + 0,0,0,0,6,0,0,0,8,0,0,0,67,0,0,0, + 115,130,0,0,0,124,0,106,0,114,14,124,0,106,1,125, + 2,110,6,124,0,106,2,125,2,124,2,106,3,124,1,100, + 1,116,4,106,5,100,0,100,2,133,2,25,0,22,0,100, + 3,141,2,125,3,122,60,124,0,160,6,124,3,161,1,143, + 28,125,4,116,7,160,8,124,4,100,4,161,2,125,5,87, + 0,100,0,4,0,4,0,131,3,1,0,110,16,49,0,115, + 94,48,0,1,0,1,0,1,0,89,0,1,0,87,0,124, + 5,83,0,4,0,116,9,121,128,1,0,1,0,1,0,89, + 0,100,0,83,0,48,0,41,5,78,122,5,37,100,46,37, + 100,114,39,0,0,0,41,2,114,143,0,0,0,90,11,115, + 121,115,95,118,101,114,115,105,111,110,114,10,0,0,0,41, + 10,218,11,68,69,66,85,71,95,66,85,73,76,68,218,18, + 82,69,71,73,83,84,82,89,95,75,69,89,95,68,69,66, + 85,71,218,12,82,69,71,73,83,84,82,89,95,75,69,89, + 114,70,0,0,0,114,15,0,0,0,218,12,118,101,114,115, + 105,111,110,95,105,110,102,111,114,197,0,0,0,114,196,0, + 0,0,90,10,81,117,101,114,121,86,97,108,117,101,114,58, + 0,0,0,41,6,218,3,99,108,115,114,143,0,0,0,90, + 12,114,101,103,105,115,116,114,121,95,107,101,121,114,20,0, + 0,0,90,4,104,107,101,121,218,8,102,105,108,101,112,97, + 116,104,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,218,16,95,115,101,97,114,99,104,95,114,101,103,105,115, + 116,114,121,254,2,0,0,115,26,0,0,0,6,2,8,1, + 6,2,6,1,16,1,6,255,2,2,12,1,44,1,4,3, + 12,254,8,1,255,128,122,38,87,105,110,100,111,119,115,82, + 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,115, + 101,97,114,99,104,95,114,101,103,105,115,116,114,121,78,99, + 4,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0, + 8,0,0,0,67,0,0,0,115,118,0,0,0,124,0,160, + 0,124,1,161,1,125,4,124,4,100,0,117,0,114,22,100, + 0,83,0,122,12,116,1,124,4,131,1,1,0,87,0,110, + 20,4,0,116,2,121,54,1,0,1,0,1,0,89,0,100, + 0,83,0,48,0,116,3,131,0,68,0,93,50,92,2,125, + 5,125,6,124,4,160,4,116,5,124,6,131,1,161,1,114, + 62,116,6,106,7,124,1,124,5,124,1,124,4,131,2,124, + 4,100,1,141,3,125,7,124,7,2,0,1,0,83,0,100, + 0,83,0,41,2,78,114,184,0,0,0,41,8,114,204,0, + 0,0,114,57,0,0,0,114,58,0,0,0,114,188,0,0, + 0,114,115,0,0,0,114,116,0,0,0,114,139,0,0,0, + 218,16,115,112,101,99,95,102,114,111,109,95,108,111,97,100, + 101,114,41,8,114,202,0,0,0,114,143,0,0,0,114,52, + 0,0,0,218,6,116,97,114,103,101,116,114,203,0,0,0, + 114,144,0,0,0,114,193,0,0,0,114,191,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,9, + 102,105,110,100,95,115,112,101,99,13,3,0,0,115,32,0, + 0,0,10,2,8,1,4,1,2,1,12,1,12,1,8,1, + 14,1,14,1,6,1,8,1,2,1,6,254,8,3,4,251, + 255,128,122,31,87,105,110,100,111,119,115,82,101,103,105,115, + 116,114,121,70,105,110,100,101,114,46,102,105,110,100,95,115, + 112,101,99,99,3,0,0,0,0,0,0,0,0,0,0,0, + 4,0,0,0,4,0,0,0,67,0,0,0,115,30,0,0, + 0,124,0,160,0,124,1,124,2,161,2,125,3,124,3,100, + 1,117,1,114,26,124,3,106,1,83,0,100,1,83,0,41, + 2,122,108,70,105,110,100,32,109,111,100,117,108,101,32,110, + 97,109,101,100,32,105,110,32,116,104,101,32,114,101,103,105, + 115,116,114,121,46,10,10,32,32,32,32,32,32,32,32,84, + 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101, + 112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,101, + 120,101,99,95,109,111,100,117,108,101,40,41,32,105,110,115, + 116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,78, + 169,2,114,207,0,0,0,114,144,0,0,0,169,4,114,202, + 0,0,0,114,143,0,0,0,114,52,0,0,0,114,191,0, + 0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,218,11,102,105,110,100,95,109,111,100,117,108,101,29,3, + 0,0,115,10,0,0,0,12,7,8,1,6,1,4,2,255, + 128,122,33,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,46,102,105,110,100,95,109,111, + 100,117,108,101,41,2,78,78,41,1,78,41,15,114,130,0, + 0,0,114,129,0,0,0,114,131,0,0,0,114,132,0,0, + 0,114,200,0,0,0,114,199,0,0,0,218,11,95,77,83, + 95,87,73,78,68,79,87,83,218,18,69,88,84,69,78,83, + 73,79,78,95,83,85,70,70,73,88,69,83,114,198,0,0, + 0,218,12,115,116,97,116,105,99,109,101,116,104,111,100,114, + 197,0,0,0,218,11,99,108,97,115,115,109,101,116,104,111, + 100,114,204,0,0,0,114,207,0,0,0,114,210,0,0,0, + 114,7,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,114,195,0,0,0,235,2,0,0,115,32,0, + 0,0,8,0,4,2,2,3,2,255,2,4,2,255,12,3, + 2,2,10,1,2,6,10,1,2,14,12,1,2,15,16,1, + 255,128,114,195,0,0,0,99,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,0, + 115,48,0,0,0,101,0,90,1,100,0,90,2,100,1,90, + 3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,90, + 5,100,6,100,7,132,0,90,6,100,8,100,9,132,0,90, + 7,100,10,83,0,41,11,218,13,95,76,111,97,100,101,114, + 66,97,115,105,99,115,122,83,66,97,115,101,32,99,108,97, + 115,115,32,111,102,32,99,111,109,109,111,110,32,99,111,100, + 101,32,110,101,101,100,101,100,32,98,121,32,98,111,116,104, + 32,83,111,117,114,99,101,76,111,97,100,101,114,32,97,110, + 100,10,32,32,32,32,83,111,117,114,99,101,108,101,115,115, + 70,105,108,101,76,111,97,100,101,114,46,99,2,0,0,0, + 0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0, + 67,0,0,0,115,64,0,0,0,116,0,124,0,160,1,124, + 1,161,1,131,1,100,1,25,0,125,2,124,2,160,2,100, + 2,100,1,161,2,100,3,25,0,125,3,124,1,160,3,100, + 2,161,1,100,4,25,0,125,4,124,3,100,5,107,2,111, + 62,124,4,100,5,107,3,83,0,41,7,122,141,67,111,110, + 99,114,101,116,101,32,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,32,111,102,32,73,110,115,112,101,99,116,76, + 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, + 32,98,121,32,99,104,101,99,107,105,110,103,32,105,102,10, + 32,32,32,32,32,32,32,32,116,104,101,32,112,97,116,104, + 32,114,101,116,117,114,110,101,100,32,98,121,32,103,101,116, + 95,102,105,108,101,110,97,109,101,32,104,97,115,32,97,32, + 102,105,108,101,110,97,109,101,32,111,102,32,39,95,95,105, + 110,105,116,95,95,46,112,121,39,46,114,3,0,0,0,114, + 79,0,0,0,114,0,0,0,0,114,39,0,0,0,218,8, + 95,95,105,110,105,116,95,95,78,41,4,114,55,0,0,0, + 114,183,0,0,0,114,51,0,0,0,114,49,0,0,0,41, + 5,114,123,0,0,0,114,143,0,0,0,114,101,0,0,0, + 90,13,102,105,108,101,110,97,109,101,95,98,97,115,101,90, + 9,116,97,105,108,95,110,97,109,101,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,186,0,0,0,48,3, + 0,0,115,10,0,0,0,18,3,16,1,14,1,16,1,255, + 128,122,24,95,76,111,97,100,101,114,66,97,115,105,99,115, + 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, + 67,0,0,0,115,4,0,0,0,100,1,83,0,169,2,122, + 42,85,115,101,32,100,101,102,97,117,108,116,32,115,101,109, + 97,110,116,105,99,115,32,102,111,114,32,109,111,100,117,108, + 101,32,99,114,101,97,116,105,111,110,46,78,114,7,0,0, + 0,169,2,114,123,0,0,0,114,191,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,218,13,99,114, + 101,97,116,101,95,109,111,100,117,108,101,56,3,0,0,115, + 4,0,0,0,4,0,255,128,122,27,95,76,111,97,100,101, + 114,66,97,115,105,99,115,46,99,114,101,97,116,101,95,109, + 111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0, + 0,0,3,0,0,0,5,0,0,0,67,0,0,0,115,56, + 0,0,0,124,0,160,0,124,1,106,1,161,1,125,2,124, + 2,100,1,117,0,114,36,116,2,100,2,160,3,124,1,106, + 1,161,1,131,1,130,1,116,4,160,5,116,6,124,2,124, + 1,106,7,161,3,1,0,100,1,83,0,41,3,122,19,69, + 120,101,99,117,116,101,32,116,104,101,32,109,111,100,117,108, + 101,46,78,122,52,99,97,110,110,111,116,32,108,111,97,100, + 32,109,111,100,117,108,101,32,123,33,114,125,32,119,104,101, + 110,32,103,101,116,95,99,111,100,101,40,41,32,114,101,116, + 117,114,110,115,32,78,111,110,101,41,8,218,8,103,101,116, + 95,99,111,100,101,114,130,0,0,0,114,122,0,0,0,114, + 70,0,0,0,114,139,0,0,0,218,25,95,99,97,108,108, + 95,119,105,116,104,95,102,114,97,109,101,115,95,114,101,109, + 111,118,101,100,218,4,101,120,101,99,114,136,0,0,0,41, + 3,114,123,0,0,0,218,6,109,111,100,117,108,101,114,168, + 0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,218,11,101,120,101,99,95,109,111,100,117,108,101,59, + 3,0,0,115,14,0,0,0,12,2,8,1,6,1,4,1, + 6,255,20,2,255,128,122,25,95,76,111,97,100,101,114,66, + 97,115,105,99,115,46,101,120,101,99,95,109,111,100,117,108, + 101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,4,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,160,1,124,0,124,1,161,2,83,0,41,2,122,26,84, + 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101, + 112,114,101,99,97,116,101,100,46,78,41,2,114,139,0,0, + 0,218,17,95,108,111,97,100,95,109,111,100,117,108,101,95, + 115,104,105,109,169,2,114,123,0,0,0,114,143,0,0,0, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218, + 11,108,111,97,100,95,109,111,100,117,108,101,67,3,0,0, + 115,4,0,0,0,12,3,255,128,122,25,95,76,111,97,100, + 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, + 100,117,108,101,78,41,8,114,130,0,0,0,114,129,0,0, + 0,114,131,0,0,0,114,132,0,0,0,114,186,0,0,0, + 114,219,0,0,0,114,224,0,0,0,114,227,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,114,215,0,0,0,43,3,0,0,115,14,0,0, + 0,8,0,4,2,8,3,8,8,8,3,12,8,255,128,114, + 215,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,64,0,0,0,115,74,0, + 0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0, + 90,3,100,3,100,4,132,0,90,4,100,5,100,6,132,0, + 90,5,100,7,100,8,132,0,90,6,100,9,100,10,132,0, + 90,7,100,11,100,12,156,1,100,13,100,14,132,2,90,8, + 100,15,100,16,132,0,90,9,100,17,83,0,41,18,218,12, + 83,111,117,114,99,101,76,111,97,100,101,114,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,4,0,0,0,116,0,130,1,41,2, + 122,165,79,112,116,105,111,110,97,108,32,109,101,116,104,111, + 100,32,116,104,97,116,32,114,101,116,117,114,110,115,32,116, + 104,101,32,109,111,100,105,102,105,99,97,116,105,111,110,32, + 116,105,109,101,32,40,97,110,32,105,110,116,41,32,102,111, + 114,32,116,104,101,10,32,32,32,32,32,32,32,32,115,112, + 101,99,105,102,105,101,100,32,112,97,116,104,32,40,97,32, + 115,116,114,41,46,10,10,32,32,32,32,32,32,32,32,82, + 97,105,115,101,115,32,79,83,69,114,114,111,114,32,119,104, + 101,110,32,116,104,101,32,112,97,116,104,32,99,97,110,110, + 111,116,32,98,101,32,104,97,110,100,108,101,100,46,10,32, + 32,32,32,32,32,32,32,78,41,1,114,58,0,0,0,169, + 2,114,123,0,0,0,114,52,0,0,0,114,7,0,0,0, + 114,7,0,0,0,114,8,0,0,0,218,10,112,97,116,104, + 95,109,116,105,109,101,75,3,0,0,115,4,0,0,0,4, + 6,255,128,122,23,83,111,117,114,99,101,76,111,97,100,101, + 114,46,112,97,116,104,95,109,116,105,109,101,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, + 0,67,0,0,0,115,14,0,0,0,100,1,124,0,160,0, + 124,1,161,1,105,1,83,0,41,3,97,158,1,0,0,79, + 112,116,105,111,110,97,108,32,109,101,116,104,111,100,32,114, + 101,116,117,114,110,105,110,103,32,97,32,109,101,116,97,100, + 97,116,97,32,100,105,99,116,32,102,111,114,32,116,104,101, + 32,115,112,101,99,105,102,105,101,100,10,32,32,32,32,32, + 32,32,32,112,97,116,104,32,40,97,32,115,116,114,41,46, + 10,10,32,32,32,32,32,32,32,32,80,111,115,115,105,98, + 108,101,32,107,101,121,115,58,10,32,32,32,32,32,32,32, + 32,45,32,39,109,116,105,109,101,39,32,40,109,97,110,100, + 97,116,111,114,121,41,32,105,115,32,116,104,101,32,110,117, + 109,101,114,105,99,32,116,105,109,101,115,116,97,109,112,32, + 111,102,32,108,97,115,116,32,115,111,117,114,99,101,10,32, + 32,32,32,32,32,32,32,32,32,99,111,100,101,32,109,111, + 100,105,102,105,99,97,116,105,111,110,59,10,32,32,32,32, + 32,32,32,32,45,32,39,115,105,122,101,39,32,40,111,112, + 116,105,111,110,97,108,41,32,105,115,32,116,104,101,32,115, + 105,122,101,32,105,110,32,98,121,116,101,115,32,111,102,32, + 116,104,101,32,115,111,117,114,99,101,32,99,111,100,101,46, + 10,10,32,32,32,32,32,32,32,32,73,109,112,108,101,109, + 101,110,116,105,110,103,32,116,104,105,115,32,109,101,116,104, + 111,100,32,97,108,108,111,119,115,32,116,104,101,32,108,111, + 97,100,101,114,32,116,111,32,114,101,97,100,32,98,121,116, + 101,99,111,100,101,32,102,105,108,101,115,46,10,32,32,32, + 32,32,32,32,32,82,97,105,115,101,115,32,79,83,69,114, + 114,111,114,32,119,104,101,110,32,116,104,101,32,112,97,116, + 104,32,99,97,110,110,111,116,32,98,101,32,104,97,110,100, + 108,101,100,46,10,32,32,32,32,32,32,32,32,114,173,0, + 0,0,78,41,1,114,230,0,0,0,114,229,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,10, + 112,97,116,104,95,115,116,97,116,115,83,3,0,0,115,4, + 0,0,0,14,12,255,128,122,23,83,111,117,114,99,101,76, + 111,97,100,101,114,46,112,97,116,104,95,115,116,97,116,115, + 99,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,4,0,0,0,67,0,0,0,115,12,0,0,0,124,0, + 160,0,124,2,124,3,161,2,83,0,41,2,122,228,79,112, + 116,105,111,110,97,108,32,109,101,116,104,111,100,32,119,104, + 105,99,104,32,119,114,105,116,101,115,32,100,97,116,97,32, + 40,98,121,116,101,115,41,32,116,111,32,97,32,102,105,108, + 101,32,112,97,116,104,32,40,97,32,115,116,114,41,46,10, + 10,32,32,32,32,32,32,32,32,73,109,112,108,101,109,101, + 110,116,105,110,103,32,116,104,105,115,32,109,101,116,104,111, + 100,32,97,108,108,111,119,115,32,102,111,114,32,116,104,101, + 32,119,114,105,116,105,110,103,32,111,102,32,98,121,116,101, + 99,111,100,101,32,102,105,108,101,115,46,10,10,32,32,32, + 32,32,32,32,32,84,104,101,32,115,111,117,114,99,101,32, + 112,97,116,104,32,105,115,32,110,101,101,100,101,100,32,105, + 110,32,111,114,100,101,114,32,116,111,32,99,111,114,114,101, + 99,116,108,121,32,116,114,97,110,115,102,101,114,32,112,101, + 114,109,105,115,115,105,111,110,115,10,32,32,32,32,32,32, + 32,32,78,41,1,218,8,115,101,116,95,100,97,116,97,41, + 4,114,123,0,0,0,114,112,0,0,0,90,10,99,97,99, + 104,101,95,112,97,116,104,114,37,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,15,95,99,97, + 99,104,101,95,98,121,116,101,99,111,100,101,97,3,0,0, + 115,4,0,0,0,12,8,255,128,122,28,83,111,117,114,99, + 101,76,111,97,100,101,114,46,95,99,97,99,104,101,95,98, + 121,116,101,99,111,100,101,99,3,0,0,0,0,0,0,0, + 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,1,83,0,41,2,122,150,79,112,116, + 105,111,110,97,108,32,109,101,116,104,111,100,32,119,104,105, + 99,104,32,119,114,105,116,101,115,32,100,97,116,97,32,40, + 98,121,116,101,115,41,32,116,111,32,97,32,102,105,108,101, 32,112,97,116,104,32,40,97,32,115,116,114,41,46,10,10, - 32,32,32,32,32,32,32,32,80,111,115,115,105,98,108,101, - 32,107,101,121,115,58,10,32,32,32,32,32,32,32,32,45, - 32,39,109,116,105,109,101,39,32,40,109,97,110,100,97,116, - 111,114,121,41,32,105,115,32,116,104,101,32,110,117,109,101, - 114,105,99,32,116,105,109,101,115,116,97,109,112,32,111,102, - 32,108,97,115,116,32,115,111,117,114,99,101,10,32,32,32, - 32,32,32,32,32,32,32,99,111,100,101,32,109,111,100,105, - 102,105,99,97,116,105,111,110,59,10,32,32,32,32,32,32, - 32,32,45,32,39,115,105,122,101,39,32,40,111,112,116,105, - 111,110,97,108,41,32,105,115,32,116,104,101,32,115,105,122, - 101,32,105,110,32,98,121,116,101,115,32,111,102,32,116,104, - 101,32,115,111,117,114,99,101,32,99,111,100,101,46,10,10, 32,32,32,32,32,32,32,32,73,109,112,108,101,109,101,110, 116,105,110,103,32,116,104,105,115,32,109,101,116,104,111,100, - 32,97,108,108,111,119,115,32,116,104,101,32,108,111,97,100, - 101,114,32,116,111,32,114,101,97,100,32,98,121,116,101,99, + 32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,32, + 119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,99, 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, - 32,32,32,82,97,105,115,101,115,32,79,83,69,114,114,111, - 114,32,119,104,101,110,32,116,104,101,32,112,97,116,104,32, - 99,97,110,110,111,116,32,98,101,32,104,97,110,100,108,101, - 100,46,10,32,32,32,32,32,32,32,32,114,169,0,0,0, - 41,1,114,223,0,0,0,114,222,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,42,3,0,0,115,4,0,0,0, - 14,12,255,128,122,23,83,111,117,114,99,101,76,111,97,100, - 101,114,46,112,97,116,104,95,115,116,97,116,115,99,4,0, - 0,0,0,0,0,0,0,0,0,0,4,0,0,0,4,0, - 0,0,67,0,0,0,115,12,0,0,0,124,0,160,0,124, - 2,124,3,161,2,83,0,41,1,122,228,79,112,116,105,111, - 110,97,108,32,109,101,116,104,111,100,32,119,104,105,99,104, - 32,119,114,105,116,101,115,32,100,97,116,97,32,40,98,121, - 116,101,115,41,32,116,111,32,97,32,102,105,108,101,32,112, - 97,116,104,32,40,97,32,115,116,114,41,46,10,10,32,32, - 32,32,32,32,32,32,73,109,112,108,101,109,101,110,116,105, - 110,103,32,116,104,105,115,32,109,101,116,104,111,100,32,97, - 108,108,111,119,115,32,102,111,114,32,116,104,101,32,119,114, - 105,116,105,110,103,32,111,102,32,98,121,116,101,99,111,100, - 101,32,102,105,108,101,115,46,10,10,32,32,32,32,32,32, - 32,32,84,104,101,32,115,111,117,114,99,101,32,112,97,116, - 104,32,105,115,32,110,101,101,100,101,100,32,105,110,32,111, - 114,100,101,114,32,116,111,32,99,111,114,114,101,99,116,108, - 121,32,116,114,97,110,115,102,101,114,32,112,101,114,109,105, - 115,115,105,111,110,115,10,32,32,32,32,32,32,32,32,41, - 1,218,8,115,101,116,95,100,97,116,97,41,4,114,118,0, - 0,0,114,107,0,0,0,90,10,99,97,99,104,101,95,112, - 97,116,104,114,26,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,15,95,99,97,99,104,101,95, - 98,121,116,101,99,111,100,101,56,3,0,0,115,4,0,0, - 0,12,8,255,128,122,28,83,111,117,114,99,101,76,111,97, - 100,101,114,46,95,99,97,99,104,101,95,98,121,116,101,99, - 111,100,101,99,3,0,0,0,0,0,0,0,0,0,0,0, - 3,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, - 0,100,1,83,0,41,2,122,150,79,112,116,105,111,110,97, - 108,32,109,101,116,104,111,100,32,119,104,105,99,104,32,119, - 114,105,116,101,115,32,100,97,116,97,32,40,98,121,116,101, - 115,41,32,116,111,32,97,32,102,105,108,101,32,112,97,116, - 104,32,40,97,32,115,116,114,41,46,10,10,32,32,32,32, - 32,32,32,32,73,109,112,108,101,109,101,110,116,105,110,103, - 32,116,104,105,115,32,109,101,116,104,111,100,32,97,108,108, - 111,119,115,32,102,111,114,32,116,104,101,32,119,114,105,116, - 105,110,103,32,111,102,32,98,121,116,101,99,111,100,101,32, - 102,105,108,101,115,46,10,32,32,32,32,32,32,32,32,78, - 114,5,0,0,0,41,3,114,118,0,0,0,114,44,0,0, - 0,114,26,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,225,0,0,0,66,3,0,0,115,4, - 0,0,0,4,128,255,128,122,21,83,111,117,114,99,101,76, - 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, - 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,10, - 0,0,0,67,0,0,0,115,84,0,0,0,124,0,160,0, - 124,1,161,1,125,2,122,14,124,0,160,1,124,2,161,1, - 125,3,87,0,110,50,4,0,116,2,121,74,1,0,125,4, - 1,0,122,26,116,3,100,1,124,1,100,2,141,2,124,4, - 130,2,87,0,89,0,100,3,125,4,126,4,110,10,100,3, - 125,4,126,4,48,0,48,0,116,4,124,3,131,1,83,0, - 41,4,122,52,67,111,110,99,114,101,116,101,32,105,109,112, - 108,101,109,101,110,116,97,116,105,111,110,32,111,102,32,73, - 110,115,112,101,99,116,76,111,97,100,101,114,46,103,101,116, - 95,115,111,117,114,99,101,46,122,39,115,111,117,114,99,101, - 32,110,111,116,32,97,118,97,105,108,97,98,108,101,32,116, - 104,114,111,117,103,104,32,103,101,116,95,100,97,116,97,40, - 41,114,115,0,0,0,78,41,5,114,179,0,0,0,218,8, - 103,101,116,95,100,97,116,97,114,50,0,0,0,114,117,0, - 0,0,114,176,0,0,0,41,5,114,118,0,0,0,114,139, - 0,0,0,114,44,0,0,0,114,174,0,0,0,218,3,101, - 120,99,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,218,10,103,101,116,95,115,111,117,114,99,101,73,3,0, - 0,115,24,0,0,0,10,2,2,1,14,1,14,1,4,1, - 2,1,4,255,2,1,6,255,18,128,8,2,255,128,122,23, + 32,32,32,78,114,7,0,0,0,41,3,114,123,0,0,0, + 114,52,0,0,0,114,37,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,232,0,0,0,107,3, + 0,0,115,4,0,0,0,4,0,255,128,122,21,83,111,117, + 114,99,101,76,111,97,100,101,114,46,115,101,116,95,100,97, + 116,97,99,2,0,0,0,0,0,0,0,0,0,0,0,5, + 0,0,0,10,0,0,0,67,0,0,0,115,70,0,0,0, + 124,0,160,0,124,1,161,1,125,2,122,20,124,0,160,1, + 124,2,161,1,125,3,87,0,116,4,124,3,131,1,83,0, + 4,0,116,2,121,68,1,0,125,4,1,0,122,14,116,3, + 100,1,124,1,100,2,141,2,124,4,130,2,100,3,125,4, + 126,4,48,0,48,0,41,4,122,52,67,111,110,99,114,101, + 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, + 110,32,111,102,32,73,110,115,112,101,99,116,76,111,97,100, + 101,114,46,103,101,116,95,115,111,117,114,99,101,46,122,39, + 115,111,117,114,99,101,32,110,111,116,32,97,118,97,105,108, + 97,98,108,101,32,116,104,114,111,117,103,104,32,103,101,116, + 95,100,97,116,97,40,41,114,120,0,0,0,78,41,5,114, + 183,0,0,0,218,8,103,101,116,95,100,97,116,97,114,58, + 0,0,0,114,122,0,0,0,114,180,0,0,0,41,5,114, + 123,0,0,0,114,143,0,0,0,114,52,0,0,0,114,178, + 0,0,0,218,3,101,120,99,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,218,10,103,101,116,95,115,111,117, + 114,99,101,114,3,0,0,115,26,0,0,0,10,2,2,1, + 12,1,8,4,14,253,4,1,2,1,4,255,2,1,2,255, + 8,128,2,255,255,128,122,23,83,111,117,114,99,101,76,111, + 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,114, + 109,0,0,0,41,1,218,9,95,111,112,116,105,109,105,122, + 101,99,3,0,0,0,0,0,0,0,1,0,0,0,4,0, + 0,0,8,0,0,0,67,0,0,0,115,22,0,0,0,116, + 0,106,1,116,2,124,1,124,2,100,1,100,2,124,3,100, + 3,141,6,83,0,41,5,122,130,82,101,116,117,114,110,32, + 116,104,101,32,99,111,100,101,32,111,98,106,101,99,116,32, + 99,111,109,112,105,108,101,100,32,102,114,111,109,32,115,111, + 117,114,99,101,46,10,10,32,32,32,32,32,32,32,32,84, + 104,101,32,39,100,97,116,97,39,32,97,114,103,117,109,101, + 110,116,32,99,97,110,32,98,101,32,97,110,121,32,111,98, + 106,101,99,116,32,116,121,112,101,32,116,104,97,116,32,99, + 111,109,112,105,108,101,40,41,32,115,117,112,112,111,114,116, + 115,46,10,32,32,32,32,32,32,32,32,114,222,0,0,0, + 84,41,2,218,12,100,111,110,116,95,105,110,104,101,114,105, + 116,114,89,0,0,0,78,41,3,114,139,0,0,0,114,221, + 0,0,0,218,7,99,111,109,112,105,108,101,41,4,114,123, + 0,0,0,114,37,0,0,0,114,52,0,0,0,114,237,0, + 0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,218,14,115,111,117,114,99,101,95,116,111,95,99,111,100, + 101,124,3,0,0,115,8,0,0,0,12,5,4,1,6,255, + 255,128,122,27,83,111,117,114,99,101,76,111,97,100,101,114, + 46,115,111,117,114,99,101,95,116,111,95,99,111,100,101,99, + 2,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0, + 9,0,0,0,67,0,0,0,115,28,2,0,0,124,0,160, + 0,124,1,161,1,125,2,100,1,125,3,100,1,125,4,100, + 1,125,5,100,2,125,6,100,3,125,7,122,12,116,1,124, + 2,131,1,125,8,87,0,110,24,4,0,116,2,121,66,1, + 0,1,0,1,0,100,1,125,8,89,0,144,1,110,42,48, + 0,122,14,124,0,160,3,124,2,161,1,125,9,87,0,110, + 20,4,0,116,4,121,102,1,0,1,0,1,0,89,0,144, + 1,110,6,48,0,116,5,124,9,100,4,25,0,131,1,125, + 3,122,14,124,0,160,6,124,8,161,1,125,10,87,0,110, + 18,4,0,116,4,121,148,1,0,1,0,1,0,89,0,110, + 216,48,0,124,1,124,8,100,5,156,2,125,11,122,148,116, + 7,124,10,124,1,124,11,131,3,125,12,116,8,124,10,131, + 1,100,6,100,1,133,2,25,0,125,13,124,12,100,7,64, + 0,100,8,107,3,125,6,124,6,144,1,114,30,124,12,100, + 9,64,0,100,8,107,3,125,7,116,9,106,10,100,10,107, + 3,144,1,114,50,124,7,115,248,116,9,106,10,100,11,107, + 2,144,1,114,50,124,0,160,6,124,2,161,1,125,4,116, + 9,160,11,116,12,124,4,161,2,125,5,116,13,124,10,124, + 5,124,1,124,11,131,4,1,0,110,20,116,14,124,10,124, + 3,124,9,100,12,25,0,124,1,124,11,131,5,1,0,87, + 0,110,24,4,0,116,15,116,16,102,2,144,1,121,76,1, + 0,1,0,1,0,89,0,110,32,48,0,116,17,160,18,100, + 13,124,8,124,2,161,3,1,0,116,19,124,13,124,1,124, + 8,124,2,100,14,141,4,83,0,124,4,100,1,117,0,144, + 1,114,128,124,0,160,6,124,2,161,1,125,4,124,0,160, + 20,124,4,124,2,161,2,125,14,116,17,160,18,100,15,124, + 2,161,2,1,0,116,21,106,22,144,2,115,24,124,8,100, + 1,117,1,144,2,114,24,124,3,100,1,117,1,144,2,114, + 24,124,6,144,1,114,220,124,5,100,1,117,0,144,1,114, + 206,116,9,160,11,124,4,161,1,125,5,116,23,124,14,124, + 5,124,7,131,3,125,10,110,16,116,24,124,14,124,3,116, + 25,124,4,131,1,131,3,125,10,122,20,124,0,160,26,124, + 2,124,8,124,10,161,3,1,0,87,0,124,14,83,0,4, + 0,116,2,144,2,121,22,1,0,1,0,1,0,89,0,124, + 14,83,0,48,0,124,14,83,0,41,16,122,190,67,111,110, + 99,114,101,116,101,32,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,32,111,102,32,73,110,115,112,101,99,116,76, + 111,97,100,101,114,46,103,101,116,95,99,111,100,101,46,10, + 10,32,32,32,32,32,32,32,32,82,101,97,100,105,110,103, + 32,111,102,32,98,121,116,101,99,111,100,101,32,114,101,113, + 117,105,114,101,115,32,112,97,116,104,95,115,116,97,116,115, + 32,116,111,32,98,101,32,105,109,112,108,101,109,101,110,116, + 101,100,46,32,84,111,32,119,114,105,116,101,10,32,32,32, + 32,32,32,32,32,98,121,116,101,99,111,100,101,44,32,115, + 101,116,95,100,97,116,97,32,109,117,115,116,32,97,108,115, + 111,32,98,101,32,105,109,112,108,101,109,101,110,116,101,100, + 46,10,10,32,32,32,32,32,32,32,32,78,70,84,114,173, + 0,0,0,114,163,0,0,0,114,149,0,0,0,114,3,0, + 0,0,114,0,0,0,0,114,39,0,0,0,90,5,110,101, + 118,101,114,90,6,97,108,119,97,121,115,218,4,115,105,122, + 101,122,13,123,125,32,109,97,116,99,104,101,115,32,123,125, + 41,3,114,121,0,0,0,114,111,0,0,0,114,112,0,0, + 0,122,19,99,111,100,101,32,111,98,106,101,99,116,32,102, + 114,111,109,32,123,125,41,27,114,183,0,0,0,114,102,0, + 0,0,114,88,0,0,0,114,231,0,0,0,114,58,0,0, + 0,114,30,0,0,0,114,234,0,0,0,114,156,0,0,0, + 218,10,109,101,109,111,114,121,118,105,101,119,114,167,0,0, + 0,90,21,99,104,101,99,107,95,104,97,115,104,95,98,97, + 115,101,100,95,112,121,99,115,114,161,0,0,0,218,17,95, + 82,65,87,95,77,65,71,73,67,95,78,85,77,66,69,82, + 114,162,0,0,0,114,160,0,0,0,114,122,0,0,0,114, + 154,0,0,0,114,139,0,0,0,114,153,0,0,0,114,169, + 0,0,0,114,240,0,0,0,114,15,0,0,0,218,19,100, + 111,110,116,95,119,114,105,116,101,95,98,121,116,101,99,111, + 100,101,114,175,0,0,0,114,174,0,0,0,114,4,0,0, + 0,114,233,0,0,0,41,15,114,123,0,0,0,114,143,0, + 0,0,114,112,0,0,0,114,158,0,0,0,114,178,0,0, + 0,114,161,0,0,0,90,10,104,97,115,104,95,98,97,115, + 101,100,90,12,99,104,101,99,107,95,115,111,117,114,99,101, + 114,111,0,0,0,218,2,115,116,114,37,0,0,0,114,155, + 0,0,0,114,16,0,0,0,90,10,98,121,116,101,115,95, + 100,97,116,97,90,11,99,111,100,101,95,111,98,106,101,99, + 116,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0, + 114,220,0,0,0,132,3,0,0,115,160,0,0,0,10,7, + 4,1,4,1,4,1,4,1,4,1,2,1,12,1,12,1, + 12,1,2,2,14,1,12,1,8,1,12,2,2,1,14,1, + 12,1,6,1,2,3,2,1,6,254,2,4,12,1,16,1, + 12,1,6,1,12,1,12,1,2,1,2,255,8,2,4,254, + 10,3,4,1,2,1,2,1,4,254,8,4,2,1,6,255, + 2,3,2,1,2,1,6,1,2,1,2,1,8,251,18,7, + 6,1,8,2,2,1,4,255,6,2,2,1,2,1,6,254, + 10,3,10,1,12,1,12,1,18,1,6,1,4,255,6,2, + 10,1,10,1,14,1,6,2,6,1,4,255,2,2,16,1, + 4,3,14,254,2,1,4,1,2,255,4,1,255,128,122,21, 83,111,117,114,99,101,76,111,97,100,101,114,46,103,101,116, - 95,115,111,117,114,99,101,114,104,0,0,0,41,1,218,9, - 95,111,112,116,105,109,105,122,101,99,3,0,0,0,0,0, - 0,0,1,0,0,0,4,0,0,0,8,0,0,0,67,0, - 0,0,115,22,0,0,0,116,0,106,1,116,2,124,1,124, - 2,100,1,100,2,124,3,100,3,141,6,83,0,41,4,122, - 130,82,101,116,117,114,110,32,116,104,101,32,99,111,100,101, - 32,111,98,106,101,99,116,32,99,111,109,112,105,108,101,100, - 32,102,114,111,109,32,115,111,117,114,99,101,46,10,10,32, - 32,32,32,32,32,32,32,84,104,101,32,39,100,97,116,97, - 39,32,97,114,103,117,109,101,110,116,32,99,97,110,32,98, - 101,32,97,110,121,32,111,98,106,101,99,116,32,116,121,112, - 101,32,116,104,97,116,32,99,111,109,112,105,108,101,40,41, - 32,115,117,112,112,111,114,116,115,46,10,32,32,32,32,32, - 32,32,32,114,215,0,0,0,84,41,2,218,12,100,111,110, - 116,95,105,110,104,101,114,105,116,114,83,0,0,0,41,3, - 114,134,0,0,0,114,214,0,0,0,218,7,99,111,109,112, - 105,108,101,41,4,114,118,0,0,0,114,26,0,0,0,114, - 44,0,0,0,114,230,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,218,14,115,111,117,114,99,101, - 95,116,111,95,99,111,100,101,83,3,0,0,115,8,0,0, - 0,12,5,4,1,6,255,255,128,122,27,83,111,117,114,99, - 101,76,111,97,100,101,114,46,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, - 0,0,0,15,0,0,0,9,0,0,0,67,0,0,0,115, - 24,2,0,0,124,0,160,0,124,1,161,1,125,2,100,1, - 125,3,100,1,125,4,100,1,125,5,100,2,125,6,100,3, - 125,7,122,12,116,1,124,2,131,1,125,8,87,0,110,24, - 4,0,116,2,121,66,1,0,1,0,1,0,100,1,125,8, - 89,0,144,1,110,42,48,0,122,14,124,0,160,3,124,2, - 161,1,125,9,87,0,110,20,4,0,116,4,121,102,1,0, - 1,0,1,0,89,0,144,1,110,6,48,0,116,5,124,9, - 100,4,25,0,131,1,125,3,122,14,124,0,160,6,124,8, - 161,1,125,10,87,0,110,18,4,0,116,4,121,148,1,0, - 1,0,1,0,89,0,110,216,48,0,124,1,124,8,100,5, - 156,2,125,11,122,148,116,7,124,10,124,1,124,11,131,3, - 125,12,116,8,124,10,131,1,100,6,100,1,133,2,25,0, - 125,13,124,12,100,7,64,0,100,8,107,3,125,6,124,6, - 144,1,114,30,124,12,100,9,64,0,100,8,107,3,125,7, - 116,9,106,10,100,10,107,3,144,1,114,50,124,7,115,248, - 116,9,106,10,100,11,107,2,144,1,114,50,124,0,160,6, - 124,2,161,1,125,4,116,9,160,11,116,12,124,4,161,2, - 125,5,116,13,124,10,124,5,124,1,124,11,131,4,1,0, - 110,20,116,14,124,10,124,3,124,9,100,12,25,0,124,1, - 124,11,131,5,1,0,87,0,110,24,4,0,116,15,116,16, - 102,2,144,1,121,76,1,0,1,0,1,0,89,0,110,32, - 48,0,116,17,160,18,100,13,124,8,124,2,161,3,1,0, - 116,19,124,13,124,1,124,8,124,2,100,14,141,4,83,0, - 124,4,100,1,117,0,144,1,114,128,124,0,160,6,124,2, - 161,1,125,4,124,0,160,20,124,4,124,2,161,2,125,14, - 116,17,160,18,100,15,124,2,161,2,1,0,116,21,106,22, - 144,2,115,20,124,8,100,1,117,1,144,2,114,20,124,3, - 100,1,117,1,144,2,114,20,124,6,144,1,114,220,124,5, - 100,1,117,0,144,1,114,206,116,9,160,11,124,4,161,1, - 125,5,116,23,124,14,124,5,124,7,131,3,125,10,110,16, - 116,24,124,14,124,3,116,25,124,4,131,1,131,3,125,10, - 122,18,124,0,160,26,124,2,124,8,124,10,161,3,1,0, - 87,0,110,20,4,0,116,2,144,2,121,18,1,0,1,0, - 1,0,89,0,110,2,48,0,124,14,83,0,41,16,122,190, - 67,111,110,99,114,101,116,101,32,105,109,112,108,101,109,101, - 110,116,97,116,105,111,110,32,111,102,32,73,110,115,112,101, - 99,116,76,111,97,100,101,114,46,103,101,116,95,99,111,100, - 101,46,10,10,32,32,32,32,32,32,32,32,82,101,97,100, - 105,110,103,32,111,102,32,98,121,116,101,99,111,100,101,32, - 114,101,113,117,105,114,101,115,32,112,97,116,104,95,115,116, - 97,116,115,32,116,111,32,98,101,32,105,109,112,108,101,109, - 101,110,116,101,100,46,32,84,111,32,119,114,105,116,101,10, - 32,32,32,32,32,32,32,32,98,121,116,101,99,111,100,101, - 44,32,115,101,116,95,100,97,116,97,32,109,117,115,116,32, - 97,108,115,111,32,98,101,32,105,109,112,108,101,109,101,110, - 116,101,100,46,10,10,32,32,32,32,32,32,32,32,78,70, - 84,114,169,0,0,0,114,159,0,0,0,114,145,0,0,0, - 114,39,0,0,0,114,73,0,0,0,114,28,0,0,0,90, - 5,110,101,118,101,114,90,6,97,108,119,97,121,115,218,4, - 115,105,122,101,122,13,123,125,32,109,97,116,99,104,101,115, - 32,123,125,41,3,114,116,0,0,0,114,106,0,0,0,114, - 107,0,0,0,122,19,99,111,100,101,32,111,98,106,101,99, - 116,32,102,114,111,109,32,123,125,41,27,114,179,0,0,0, - 114,97,0,0,0,114,82,0,0,0,114,224,0,0,0,114, - 50,0,0,0,114,18,0,0,0,114,227,0,0,0,114,152, - 0,0,0,218,10,109,101,109,111,114,121,118,105,101,119,114, - 163,0,0,0,90,21,99,104,101,99,107,95,104,97,115,104, - 95,98,97,115,101,100,95,112,121,99,115,114,157,0,0,0, - 218,17,95,82,65,87,95,77,65,71,73,67,95,78,85,77, - 66,69,82,114,158,0,0,0,114,156,0,0,0,114,117,0, - 0,0,114,150,0,0,0,114,134,0,0,0,114,149,0,0, - 0,114,165,0,0,0,114,233,0,0,0,114,1,0,0,0, - 218,19,100,111,110,116,95,119,114,105,116,101,95,98,121,116, - 101,99,111,100,101,114,171,0,0,0,114,170,0,0,0,114, - 23,0,0,0,114,226,0,0,0,41,15,114,118,0,0,0, - 114,139,0,0,0,114,107,0,0,0,114,154,0,0,0,114, - 174,0,0,0,114,157,0,0,0,90,10,104,97,115,104,95, - 98,97,115,101,100,90,12,99,104,101,99,107,95,115,111,117, - 114,99,101,114,106,0,0,0,218,2,115,116,114,26,0,0, - 0,114,151,0,0,0,114,2,0,0,0,90,10,98,121,116, - 101,115,95,100,97,116,97,90,11,99,111,100,101,95,111,98, - 106,101,99,116,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,213,0,0,0,91,3,0,0,115,154,0,0, - 0,10,7,4,1,4,1,4,1,4,1,4,1,2,1,12, - 1,12,1,12,1,2,2,14,1,12,1,8,1,12,2,2, - 1,14,1,12,1,6,1,2,3,2,1,6,254,2,4,12, - 1,16,1,12,1,6,1,12,1,12,1,2,1,2,255,8, - 2,4,254,10,3,4,1,2,1,2,1,4,254,8,4,2, - 1,6,255,2,3,2,1,2,1,6,1,2,1,2,1,8, - 251,18,7,6,1,8,2,2,1,4,255,6,2,2,1,2, - 1,6,254,10,3,10,1,12,1,12,1,18,1,6,1,4, - 255,6,2,10,1,10,1,14,1,6,2,6,1,4,255,2, - 2,18,1,14,1,6,1,4,1,255,128,122,21,83,111,117, - 114,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, - 100,101,78,41,10,114,125,0,0,0,114,124,0,0,0,114, - 126,0,0,0,114,223,0,0,0,114,224,0,0,0,114,226, - 0,0,0,114,225,0,0,0,114,229,0,0,0,114,233,0, - 0,0,114,213,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,114,221,0,0,0, - 32,3,0,0,115,18,0,0,0,8,0,8,2,8,8,8, - 14,8,10,8,7,14,10,12,8,255,128,114,221,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,4,0,0,0,0,0,0,0,115,92,0,0,0,101,0, - 90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,0, - 90,4,100,4,100,5,132,0,90,5,100,6,100,7,132,0, - 90,6,101,7,135,0,102,1,100,8,100,9,132,8,131,1, - 90,8,101,7,100,10,100,11,132,0,131,1,90,9,100,12, - 100,13,132,0,90,10,101,7,100,14,100,15,132,0,131,1, - 90,11,135,0,4,0,90,12,83,0,41,16,218,10,70,105, - 108,101,76,111,97,100,101,114,122,103,66,97,115,101,32,102, - 105,108,101,32,108,111,97,100,101,114,32,99,108,97,115,115, - 32,119,104,105,99,104,32,105,109,112,108,101,109,101,110,116, - 115,32,116,104,101,32,108,111,97,100,101,114,32,112,114,111, - 116,111,99,111,108,32,109,101,116,104,111,100,115,32,116,104, - 97,116,10,32,32,32,32,114,101,113,117,105,114,101,32,102, - 105,108,101,32,115,121,115,116,101,109,32,117,115,97,103,101, - 46,99,3,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,124, - 1,124,0,95,0,124,2,124,0,95,1,100,1,83,0,41, - 2,122,75,67,97,99,104,101,32,116,104,101,32,109,111,100, - 117,108,101,32,110,97,109,101,32,97,110,100,32,116,104,101, - 32,112,97,116,104,32,116,111,32,116,104,101,32,102,105,108, - 101,32,102,111,117,110,100,32,98,121,32,116,104,101,10,32, - 32,32,32,32,32,32,32,102,105,110,100,101,114,46,78,114, - 159,0,0,0,41,3,114,118,0,0,0,114,139,0,0,0, - 114,44,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,209,0,0,0,181,3,0,0,115,8,0, - 0,0,6,3,6,1,4,128,255,128,122,19,70,105,108,101, - 76,111,97,100,101,114,46,95,95,105,110,105,116,95,95,99, - 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 2,0,0,0,67,0,0,0,115,24,0,0,0,124,0,106, - 0,124,1,106,0,107,2,111,22,124,0,106,1,124,1,106, - 1,107,2,83,0,114,109,0,0,0,169,2,218,9,95,95, - 99,108,97,115,115,95,95,114,131,0,0,0,169,2,114,118, - 0,0,0,90,5,111,116,104,101,114,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,218,6,95,95,101,113,95, - 95,187,3,0,0,115,8,0,0,0,12,1,10,1,2,255, - 255,128,122,17,70,105,108,101,76,111,97,100,101,114,46,95, - 95,101,113,95,95,99,1,0,0,0,0,0,0,0,0,0, - 0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,20, - 0,0,0,116,0,124,0,106,1,131,1,116,0,124,0,106, - 2,131,1,65,0,83,0,114,109,0,0,0,169,3,218,4, - 104,97,115,104,114,116,0,0,0,114,44,0,0,0,169,1, - 114,118,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,8,95,95,104,97,115,104,95,95,191,3, - 0,0,115,4,0,0,0,20,1,255,128,122,19,70,105,108, - 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, + 95,99,111,100,101,78,41,10,114,130,0,0,0,114,129,0, + 0,0,114,131,0,0,0,114,230,0,0,0,114,231,0,0, + 0,114,233,0,0,0,114,232,0,0,0,114,236,0,0,0, + 114,240,0,0,0,114,220,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,228, + 0,0,0,73,3,0,0,115,18,0,0,0,8,0,8,2, + 8,8,8,14,8,10,8,7,14,10,12,8,255,128,114,228, + 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,4,0,0,0,0,0,0,0,115,92,0,0, + 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, + 3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100, + 7,132,0,90,6,101,7,135,0,102,1,100,8,100,9,132, + 8,131,1,90,8,101,7,100,10,100,11,132,0,131,1,90, + 9,100,12,100,13,132,0,90,10,101,7,100,14,100,15,132, + 0,131,1,90,11,135,0,4,0,90,12,83,0,41,16,218, + 10,70,105,108,101,76,111,97,100,101,114,122,103,66,97,115, + 101,32,102,105,108,101,32,108,111,97,100,101,114,32,99,108, + 97,115,115,32,119,104,105,99,104,32,105,109,112,108,101,109, + 101,110,116,115,32,116,104,101,32,108,111,97,100,101,114,32, + 112,114,111,116,111,99,111,108,32,109,101,116,104,111,100,115, + 32,116,104,97,116,10,32,32,32,32,114,101,113,117,105,114, + 101,32,102,105,108,101,32,115,121,115,116,101,109,32,117,115, + 97,103,101,46,99,3,0,0,0,0,0,0,0,0,0,0, + 0,3,0,0,0,2,0,0,0,67,0,0,0,115,16,0, + 0,0,124,1,124,0,95,0,124,2,124,0,95,1,100,1, + 83,0,41,2,122,75,67,97,99,104,101,32,116,104,101,32, + 109,111,100,117,108,101,32,110,97,109,101,32,97,110,100,32, + 116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,32, + 102,105,108,101,32,102,111,117,110,100,32,98,121,32,116,104, + 101,10,32,32,32,32,32,32,32,32,102,105,110,100,101,114, + 46,78,114,163,0,0,0,41,3,114,123,0,0,0,114,143, + 0,0,0,114,52,0,0,0,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,114,216,0,0,0,222,3,0,0, + 115,6,0,0,0,6,3,10,1,255,128,122,19,70,105,108, + 101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,95, 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,3,0,0,0,3,0,0,0,115,16,0,0,0,116,0, - 116,1,124,0,131,2,160,2,124,1,161,1,83,0,41,1, - 122,100,76,111,97,100,32,97,32,109,111,100,117,108,101,32, - 102,114,111,109,32,97,32,102,105,108,101,46,10,10,32,32, - 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108, - 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,41,3,218,5,115,117,112,101,114,114, - 239,0,0,0,114,220,0,0,0,114,219,0,0,0,169,1, - 114,241,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 220,0,0,0,194,3,0,0,115,4,0,0,0,16,10,255, - 128,122,22,70,105,108,101,76,111,97,100,101,114,46,108,111, - 97,100,95,109,111,100,117,108,101,99,2,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,6,0,0,0,124,0,106,0,83,0,169,1,122, - 58,82,101,116,117,114,110,32,116,104,101,32,112,97,116,104, - 32,116,111,32,116,104,101,32,115,111,117,114,99,101,32,102, - 105,108,101,32,97,115,32,102,111,117,110,100,32,98,121,32, - 116,104,101,32,102,105,110,100,101,114,46,114,48,0,0,0, - 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,179,0,0,0,206,3,0,0,115,4,0, - 0,0,6,3,255,128,122,23,70,105,108,101,76,111,97,100, - 101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,99, - 2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, - 8,0,0,0,67,0,0,0,115,126,0,0,0,116,0,124, - 0,116,1,116,2,102,2,131,2,114,70,116,3,160,4,116, - 5,124,1,131,1,161,1,143,24,125,2,124,2,160,6,161, - 0,87,0,2,0,100,1,4,0,4,0,131,3,1,0,83, - 0,49,0,115,58,48,0,1,0,1,0,1,0,89,0,1, - 0,110,52,116,3,160,7,124,1,100,2,161,2,143,24,125, - 2,124,2,160,6,161,0,87,0,2,0,100,1,4,0,4, - 0,131,3,1,0,83,0,49,0,115,112,48,0,1,0,1, - 0,1,0,89,0,1,0,100,1,83,0,41,3,122,39,82, - 101,116,117,114,110,32,116,104,101,32,100,97,116,97,32,102, - 114,111,109,32,112,97,116,104,32,97,115,32,114,97,119,32, - 98,121,116,101,115,46,78,218,1,114,41,8,114,161,0,0, - 0,114,221,0,0,0,218,19,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,114,64,0,0,0, - 90,9,111,112,101,110,95,99,111,100,101,114,84,0,0,0, - 90,4,114,101,97,100,114,65,0,0,0,41,3,114,118,0, - 0,0,114,44,0,0,0,114,68,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,114,227,0,0,0, - 211,3,0,0,115,14,0,0,0,14,2,16,1,40,1,14, - 2,38,1,4,128,255,128,122,19,70,105,108,101,76,111,97, - 100,101,114,46,103,101,116,95,100,97,116,97,99,2,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0, - 0,67,0,0,0,115,20,0,0,0,100,1,100,2,108,0, - 109,1,125,2,1,0,124,2,124,0,131,1,83,0,41,3, - 78,114,73,0,0,0,41,1,218,10,70,105,108,101,82,101, - 97,100,101,114,41,2,90,17,105,109,112,111,114,116,108,105, - 98,46,114,101,97,100,101,114,115,114,253,0,0,0,41,3, - 114,118,0,0,0,114,216,0,0,0,114,253,0,0,0,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,19, - 103,101,116,95,114,101,115,111,117,114,99,101,95,114,101,97, - 100,101,114,220,3,0,0,115,6,0,0,0,12,2,8,1, - 255,128,122,30,70,105,108,101,76,111,97,100,101,114,46,103, - 101,116,95,114,101,115,111,117,114,99,101,95,114,101,97,100, - 101,114,41,13,114,125,0,0,0,114,124,0,0,0,114,126, - 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, - 0,0,114,247,0,0,0,114,136,0,0,0,114,220,0,0, - 0,114,179,0,0,0,114,227,0,0,0,114,254,0,0,0, - 90,13,95,95,99,108,97,115,115,99,101,108,108,95,95,114, - 5,0,0,0,114,5,0,0,0,114,249,0,0,0,114,8, - 0,0,0,114,239,0,0,0,176,3,0,0,115,26,0,0, - 0,8,0,4,2,8,3,8,6,8,4,2,3,14,1,2, - 11,10,1,8,4,2,9,18,1,255,128,114,239,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,64,0,0,0,115,46,0,0,0,101,0, - 90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,0, - 90,4,100,4,100,5,132,0,90,5,100,6,100,7,156,1, - 100,8,100,9,132,2,90,6,100,10,83,0,41,11,218,16, - 83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,114, - 122,62,67,111,110,99,114,101,116,101,32,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,32,111,102,32,83,111,117, - 114,99,101,76,111,97,100,101,114,32,117,115,105,110,103,32, - 116,104,101,32,102,105,108,101,32,115,121,115,116,101,109,46, - 99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,3,0,0,0,67,0,0,0,115,22,0,0,0,116,0, - 124,1,131,1,125,2,124,2,106,1,124,2,106,2,100,1, - 156,2,83,0,41,2,122,33,82,101,116,117,114,110,32,116, - 104,101,32,109,101,116,97,100,97,116,97,32,102,111,114,32, - 116,104,101,32,112,97,116,104,46,41,2,114,169,0,0,0, - 114,234,0,0,0,41,3,114,49,0,0,0,218,8,115,116, - 95,109,116,105,109,101,90,7,115,116,95,115,105,122,101,41, - 3,114,118,0,0,0,114,44,0,0,0,114,238,0,0,0, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114, - 224,0,0,0,230,3,0,0,115,6,0,0,0,8,2,14, - 1,255,128,122,27,83,111,117,114,99,101,70,105,108,101,76, - 111,97,100,101,114,46,112,97,116,104,95,115,116,97,116,115, - 99,4,0,0,0,0,0,0,0,0,0,0,0,5,0,0, - 0,5,0,0,0,67,0,0,0,115,24,0,0,0,116,0, - 124,1,131,1,125,4,124,0,106,1,124,2,124,3,124,4, - 100,1,141,3,83,0,41,2,78,169,1,218,5,95,109,111, - 100,101,41,2,114,114,0,0,0,114,225,0,0,0,41,5, - 114,118,0,0,0,114,107,0,0,0,114,106,0,0,0,114, - 26,0,0,0,114,52,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,226,0,0,0,235,3,0, - 0,115,6,0,0,0,8,2,16,1,255,128,122,32,83,111, - 117,114,99,101,70,105,108,101,76,111,97,100,101,114,46,95, - 99,97,99,104,101,95,98,121,116,101,99,111,100,101,114,60, - 0,0,0,114,1,1,0,0,99,3,0,0,0,0,0,0, - 0,1,0,0,0,9,0,0,0,11,0,0,0,67,0,0, - 0,115,248,0,0,0,116,0,124,1,131,1,92,2,125,4, - 125,5,103,0,125,6,124,4,114,52,116,1,124,4,131,1, - 115,52,116,0,124,4,131,1,92,2,125,4,125,7,124,6, - 160,2,124,7,161,1,1,0,113,16,116,3,124,6,131,1, - 68,0,93,102,125,7,116,4,124,4,124,7,131,2,125,4, - 122,14,116,5,160,6,124,4,161,1,1,0,87,0,113,60, - 4,0,116,7,121,110,1,0,1,0,1,0,89,0,113,60, - 89,0,113,60,4,0,116,8,121,162,1,0,125,8,1,0, - 122,30,116,9,160,10,100,1,124,4,124,8,161,3,1,0, - 87,0,89,0,100,2,125,8,126,8,1,0,100,2,83,0, - 100,2,125,8,126,8,48,0,48,0,122,28,116,11,124,1, + 0,2,0,0,0,67,0,0,0,115,24,0,0,0,124,0, + 106,0,124,1,106,0,107,2,111,22,124,0,106,1,124,1, + 106,1,107,2,83,0,114,114,0,0,0,169,2,218,9,95, + 95,99,108,97,115,115,95,95,114,136,0,0,0,169,2,114, + 123,0,0,0,90,5,111,116,104,101,114,114,7,0,0,0, + 114,7,0,0,0,114,8,0,0,0,218,6,95,95,101,113, + 95,95,228,3,0,0,115,8,0,0,0,12,1,10,1,2, + 255,255,128,122,17,70,105,108,101,76,111,97,100,101,114,46, + 95,95,101,113,95,95,99,1,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, + 20,0,0,0,116,0,124,0,106,1,131,1,116,0,124,0, + 106,2,131,1,65,0,83,0,114,114,0,0,0,169,3,218, + 4,104,97,115,104,114,121,0,0,0,114,52,0,0,0,169, + 1,114,123,0,0,0,114,7,0,0,0,114,7,0,0,0, + 114,8,0,0,0,218,8,95,95,104,97,115,104,95,95,232, + 3,0,0,115,4,0,0,0,20,1,255,128,122,19,70,105, + 108,101,76,111,97,100,101,114,46,95,95,104,97,115,104,95, + 95,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,3,0,0,0,3,0,0,0,115,16,0,0,0,116, + 0,116,1,124,0,131,2,160,2,124,1,161,1,83,0,41, + 2,122,100,76,111,97,100,32,97,32,109,111,100,117,108,101, + 32,102,114,111,109,32,97,32,102,105,108,101,46,10,10,32, + 32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,85,115,101,32,101,120,101,99,95,109,111,100,117, + 108,101,40,41,32,105,110,115,116,101,97,100,46,10,10,32, + 32,32,32,32,32,32,32,78,41,3,218,5,115,117,112,101, + 114,114,246,0,0,0,114,227,0,0,0,114,226,0,0,0, + 169,1,114,248,0,0,0,114,7,0,0,0,114,8,0,0, + 0,114,227,0,0,0,235,3,0,0,115,4,0,0,0,16, + 10,255,128,122,22,70,105,108,101,76,111,97,100,101,114,46, + 108,111,97,100,95,109,111,100,117,108,101,99,2,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, + 67,0,0,0,115,6,0,0,0,124,0,106,0,83,0,169, + 2,122,58,82,101,116,117,114,110,32,116,104,101,32,112,97, + 116,104,32,116,111,32,116,104,101,32,115,111,117,114,99,101, + 32,102,105,108,101,32,97,115,32,102,111,117,110,100,32,98, + 121,32,116,104,101,32,102,105,110,100,101,114,46,78,114,56, + 0,0,0,114,226,0,0,0,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,114,183,0,0,0,247,3,0,0, + 115,4,0,0,0,6,3,255,128,122,23,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,102,105,108,101,110,97, + 109,101,99,2,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,8,0,0,0,67,0,0,0,115,128,0,0,0, + 116,0,124,0,116,1,116,2,102,2,131,2,114,72,116,3, + 160,4,116,5,124,1,131,1,161,1,143,24,125,2,124,2, + 160,6,161,0,87,0,2,0,100,1,4,0,4,0,131,3, + 1,0,83,0,49,0,115,58,48,0,1,0,1,0,1,0, + 89,0,1,0,100,1,83,0,116,3,160,7,124,1,100,2, + 161,2,143,24,125,2,124,2,160,6,161,0,87,0,2,0, + 100,1,4,0,4,0,131,3,1,0,83,0,49,0,115,114, + 48,0,1,0,1,0,1,0,89,0,1,0,100,1,83,0, + 41,3,122,39,82,101,116,117,114,110,32,116,104,101,32,100, + 97,116,97,32,102,114,111,109,32,112,97,116,104,32,97,115, + 32,114,97,119,32,98,121,116,101,115,46,78,218,1,114,41, + 8,114,165,0,0,0,114,228,0,0,0,218,19,69,120,116, + 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, + 114,72,0,0,0,90,9,111,112,101,110,95,99,111,100,101, + 114,90,0,0,0,90,4,114,101,97,100,114,73,0,0,0, + 41,3,114,123,0,0,0,114,52,0,0,0,114,76,0,0, + 0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0, + 114,234,0,0,0,252,3,0,0,115,14,0,0,0,14,2, + 16,1,42,1,14,2,38,1,4,128,255,128,122,19,70,105, + 108,101,76,111,97,100,101,114,46,103,101,116,95,100,97,116, + 97,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,2,0,0,0,67,0,0,0,115,20,0,0,0,100, + 1,100,2,108,0,109,1,125,2,1,0,124,2,124,0,131, + 1,83,0,41,3,78,114,0,0,0,0,41,1,218,10,70, + 105,108,101,82,101,97,100,101,114,41,2,90,17,105,109,112, + 111,114,116,108,105,98,46,114,101,97,100,101,114,115,114,4, + 1,0,0,41,3,114,123,0,0,0,114,223,0,0,0,114, + 4,1,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,19,103,101,116,95,114,101,115,111,117,114,99, + 101,95,114,101,97,100,101,114,5,4,0,0,115,6,0,0, + 0,12,2,8,1,255,128,122,30,70,105,108,101,76,111,97, + 100,101,114,46,103,101,116,95,114,101,115,111,117,114,99,101, + 95,114,101,97,100,101,114,41,13,114,130,0,0,0,114,129, + 0,0,0,114,131,0,0,0,114,132,0,0,0,114,216,0, + 0,0,114,250,0,0,0,114,254,0,0,0,114,140,0,0, + 0,114,227,0,0,0,114,183,0,0,0,114,234,0,0,0, + 114,5,1,0,0,90,13,95,95,99,108,97,115,115,99,101, + 108,108,95,95,114,7,0,0,0,114,7,0,0,0,114,0, + 1,0,0,114,8,0,0,0,114,246,0,0,0,217,3,0, + 0,115,26,0,0,0,8,0,4,2,8,3,8,6,8,4, + 2,3,14,1,2,11,10,1,8,4,2,9,18,1,255,128, + 114,246,0,0,0,99,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,46, + 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,100, + 2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,100, + 6,100,7,156,1,100,8,100,9,132,2,90,6,100,10,83, + 0,41,11,218,16,83,111,117,114,99,101,70,105,108,101,76, + 111,97,100,101,114,122,62,67,111,110,99,114,101,116,101,32, + 105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,111, + 102,32,83,111,117,114,99,101,76,111,97,100,101,114,32,117, + 115,105,110,103,32,116,104,101,32,102,105,108,101,32,115,121, + 115,116,101,109,46,99,2,0,0,0,0,0,0,0,0,0, + 0,0,3,0,0,0,3,0,0,0,67,0,0,0,115,22, + 0,0,0,116,0,124,1,131,1,125,2,124,2,106,1,124, + 2,106,2,100,1,156,2,83,0,41,3,122,33,82,101,116, + 117,114,110,32,116,104,101,32,109,101,116,97,100,97,116,97, + 32,102,111,114,32,116,104,101,32,112,97,116,104,46,41,2, + 114,173,0,0,0,114,241,0,0,0,78,41,3,114,57,0, + 0,0,218,8,115,116,95,109,116,105,109,101,90,7,115,116, + 95,115,105,122,101,41,3,114,123,0,0,0,114,52,0,0, + 0,114,245,0,0,0,114,7,0,0,0,114,7,0,0,0, + 114,8,0,0,0,114,231,0,0,0,15,4,0,0,115,6, + 0,0,0,8,2,14,1,255,128,122,27,83,111,117,114,99, + 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, + 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,0, + 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115, + 24,0,0,0,116,0,124,1,131,1,125,4,124,0,106,1, + 124,2,124,3,124,4,100,1,141,3,83,0,41,2,78,169, + 1,218,5,95,109,111,100,101,41,2,114,119,0,0,0,114, + 232,0,0,0,41,5,114,123,0,0,0,114,112,0,0,0, + 114,111,0,0,0,114,37,0,0,0,114,60,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,233, + 0,0,0,20,4,0,0,115,6,0,0,0,8,2,16,1, + 255,128,122,32,83,111,117,114,99,101,70,105,108,101,76,111, + 97,100,101,114,46,95,99,97,99,104,101,95,98,121,116,101, + 99,111,100,101,114,68,0,0,0,114,8,1,0,0,99,3, + 0,0,0,0,0,0,0,1,0,0,0,9,0,0,0,11, + 0,0,0,67,0,0,0,115,248,0,0,0,116,0,124,1, + 131,1,92,2,125,4,125,5,103,0,125,6,124,4,114,52, + 116,1,124,4,131,1,115,52,116,0,124,4,131,1,92,2, + 125,4,125,7,124,6,160,2,124,7,161,1,1,0,113,16, + 116,3,124,6,131,1,68,0,93,96,125,7,116,4,124,4, + 124,7,131,2,125,4,122,14,116,5,160,6,124,4,161,1, + 1,0,87,0,113,60,4,0,116,7,121,106,1,0,1,0, + 1,0,89,0,113,60,4,0,116,8,121,246,1,0,125,8, + 1,0,122,30,116,9,160,10,100,1,124,4,124,8,161,3, + 1,0,87,0,89,0,100,2,125,8,126,8,1,0,100,2, + 83,0,100,2,125,8,126,8,48,0,122,30,116,11,124,1, 124,2,124,3,131,3,1,0,116,9,160,10,100,3,124,1, - 161,2,1,0,87,0,110,50,4,0,116,8,121,242,1,0, - 125,8,1,0,122,26,116,9,160,10,100,1,124,1,124,8, - 161,3,1,0,87,0,89,0,100,2,125,8,126,8,110,10, - 100,2,125,8,126,8,48,0,48,0,100,2,83,0,41,4, - 122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97, - 116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99, - 111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32, - 123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101, - 97,116,101,100,32,123,33,114,125,41,12,114,47,0,0,0, - 114,56,0,0,0,114,186,0,0,0,114,42,0,0,0,114, - 38,0,0,0,114,4,0,0,0,90,5,109,107,100,105,114, - 218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111, - 114,114,50,0,0,0,114,134,0,0,0,114,149,0,0,0, - 114,69,0,0,0,41,9,114,118,0,0,0,114,44,0,0, - 0,114,26,0,0,0,114,2,1,0,0,218,6,112,97,114, - 101,110,116,114,96,0,0,0,114,37,0,0,0,114,33,0, - 0,0,114,228,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,225,0,0,0,240,3,0,0,115, - 52,0,0,0,12,2,4,1,12,2,12,1,12,1,12,2, - 10,1,2,1,14,1,12,1,8,2,14,1,6,3,4,1, - 4,255,16,2,10,128,2,1,12,1,16,1,14,1,8,2, - 2,1,8,255,22,128,255,128,122,25,83,111,117,114,99,101, - 70,105,108,101,76,111,97,100,101,114,46,115,101,116,95,100, - 97,116,97,78,41,7,114,125,0,0,0,114,124,0,0,0, - 114,126,0,0,0,114,127,0,0,0,114,224,0,0,0,114, - 226,0,0,0,114,225,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,114,255,0, - 0,0,226,3,0,0,115,12,0,0,0,8,0,4,2,8, - 2,8,5,18,5,255,128,114,255,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,64,0,0,0,115,32,0,0,0,101,0,90,1,100,0, - 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, - 100,5,132,0,90,5,100,6,83,0,41,7,218,20,83,111, - 117,114,99,101,108,101,115,115,70,105,108,101,76,111,97,100, - 101,114,122,45,76,111,97,100,101,114,32,119,104,105,99,104, - 32,104,97,110,100,108,101,115,32,115,111,117,114,99,101,108, - 101,115,115,32,102,105,108,101,32,105,109,112,111,114,116,115, - 46,99,2,0,0,0,0,0,0,0,0,0,0,0,5,0, - 0,0,5,0,0,0,67,0,0,0,115,68,0,0,0,124, - 0,160,0,124,1,161,1,125,2,124,0,160,1,124,2,161, - 1,125,3,124,1,124,2,100,1,156,2,125,4,116,2,124, - 3,124,1,124,4,131,3,1,0,116,3,116,4,124,3,131, - 1,100,2,100,0,133,2,25,0,124,1,124,2,100,3,141, - 3,83,0,41,4,78,114,159,0,0,0,114,145,0,0,0, - 41,2,114,116,0,0,0,114,106,0,0,0,41,5,114,179, - 0,0,0,114,227,0,0,0,114,152,0,0,0,114,165,0, - 0,0,114,235,0,0,0,41,5,114,118,0,0,0,114,139, - 0,0,0,114,44,0,0,0,114,26,0,0,0,114,151,0, - 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,213,0,0,0,19,4,0,0,115,24,0,0,0,10, - 1,10,1,2,4,2,1,6,254,12,4,2,1,14,1,2, - 1,2,1,6,253,255,128,122,29,83,111,117,114,99,101,108, - 101,115,115,70,105,108,101,76,111,97,100,101,114,46,103,101, - 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, - 4,0,0,0,100,1,83,0,41,2,122,39,82,101,116,117, - 114,110,32,78,111,110,101,32,97,115,32,116,104,101,114,101, - 32,105,115,32,110,111,32,115,111,117,114,99,101,32,99,111, - 100,101,46,78,114,5,0,0,0,114,219,0,0,0,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,114,229,0, - 0,0,35,4,0,0,115,4,0,0,0,4,2,255,128,122, - 31,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, - 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, - 78,41,6,114,125,0,0,0,114,124,0,0,0,114,126,0, - 0,0,114,127,0,0,0,114,213,0,0,0,114,229,0,0, - 0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,5,1,0,0,15,4,0,0,115,10, - 0,0,0,8,0,4,2,8,2,12,16,255,128,114,5,1, - 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,3,0,0,0,64,0,0,0,115,92,0,0,0, - 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3, - 132,0,90,4,100,4,100,5,132,0,90,5,100,6,100,7, - 132,0,90,6,100,8,100,9,132,0,90,7,100,10,100,11, - 132,0,90,8,100,12,100,13,132,0,90,9,100,14,100,15, - 132,0,90,10,100,16,100,17,132,0,90,11,101,12,100,18, - 100,19,132,0,131,1,90,13,100,20,83,0,41,21,114,252, - 0,0,0,122,93,76,111,97,100,101,114,32,102,111,114,32, - 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 115,46,10,10,32,32,32,32,84,104,101,32,99,111,110,115, - 116,114,117,99,116,111,114,32,105,115,32,100,101,115,105,103, - 110,101,100,32,116,111,32,119,111,114,107,32,119,105,116,104, - 32,70,105,108,101,70,105,110,100,101,114,46,10,10,32,32, - 32,32,99,3,0,0,0,0,0,0,0,0,0,0,0,3, - 0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0, - 124,1,124,0,95,0,124,2,124,0,95,1,100,0,83,0, - 114,109,0,0,0,114,159,0,0,0,41,3,114,118,0,0, - 0,114,116,0,0,0,114,44,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,209,0,0,0,52, - 4,0,0,115,8,0,0,0,6,1,6,1,4,128,255,128, + 161,2,1,0,87,0,100,2,83,0,4,0,116,8,121,240, + 1,0,125,8,1,0,122,28,116,9,160,10,100,1,124,1, + 124,8,161,3,1,0,87,0,89,0,100,2,125,8,126,8, + 100,2,83,0,100,2,125,8,126,8,48,0,48,0,100,2, + 83,0,48,0,41,4,122,27,87,114,105,116,101,32,98,121, + 116,101,115,32,100,97,116,97,32,116,111,32,97,32,102,105, + 108,101,46,122,27,99,111,117,108,100,32,110,111,116,32,99, + 114,101,97,116,101,32,123,33,114,125,58,32,123,33,114,125, + 78,122,12,99,114,101,97,116,101,100,32,123,33,114,125,41, + 12,114,55,0,0,0,114,64,0,0,0,114,190,0,0,0, + 114,50,0,0,0,114,48,0,0,0,114,18,0,0,0,90, + 5,109,107,100,105,114,218,15,70,105,108,101,69,120,105,115, + 116,115,69,114,114,111,114,114,58,0,0,0,114,139,0,0, + 0,114,153,0,0,0,114,77,0,0,0,41,9,114,123,0, + 0,0,114,52,0,0,0,114,37,0,0,0,114,9,1,0, + 0,218,6,112,97,114,101,110,116,114,101,0,0,0,114,47, + 0,0,0,114,43,0,0,0,114,235,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,232,0,0, + 0,25,4,0,0,115,58,0,0,0,12,2,4,1,12,2, + 12,1,12,1,12,2,10,1,2,1,14,1,12,1,4,2, + 14,1,6,3,4,1,4,255,16,2,8,128,2,1,12,1, + 18,1,14,1,8,2,2,1,18,255,8,128,2,254,4,255, + 2,248,255,128,122,25,83,111,117,114,99,101,70,105,108,101, + 76,111,97,100,101,114,46,115,101,116,95,100,97,116,97,78, + 41,7,114,130,0,0,0,114,129,0,0,0,114,131,0,0, + 0,114,132,0,0,0,114,231,0,0,0,114,233,0,0,0, + 114,232,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,6,1,0,0,11,4, + 0,0,115,12,0,0,0,8,0,4,2,8,2,8,5,18, + 5,255,128,114,6,1,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0, + 0,115,32,0,0,0,101,0,90,1,100,0,90,2,100,1, + 90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0, + 90,5,100,6,83,0,41,7,218,20,83,111,117,114,99,101, + 108,101,115,115,70,105,108,101,76,111,97,100,101,114,122,45, + 76,111,97,100,101,114,32,119,104,105,99,104,32,104,97,110, + 100,108,101,115,32,115,111,117,114,99,101,108,101,115,115,32, + 102,105,108,101,32,105,109,112,111,114,116,115,46,99,2,0, + 0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,0, + 0,0,67,0,0,0,115,68,0,0,0,124,0,160,0,124, + 1,161,1,125,2,124,0,160,1,124,2,161,1,125,3,124, + 1,124,2,100,1,156,2,125,4,116,2,124,3,124,1,124, + 4,131,3,1,0,116,3,116,4,124,3,131,1,100,2,100, + 0,133,2,25,0,124,1,124,2,100,3,141,3,83,0,41, + 4,78,114,163,0,0,0,114,149,0,0,0,41,2,114,121, + 0,0,0,114,111,0,0,0,41,5,114,183,0,0,0,114, + 234,0,0,0,114,156,0,0,0,114,169,0,0,0,114,242, + 0,0,0,41,5,114,123,0,0,0,114,143,0,0,0,114, + 52,0,0,0,114,37,0,0,0,114,155,0,0,0,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,114,220,0, + 0,0,60,4,0,0,115,24,0,0,0,10,1,10,1,2, + 4,2,1,6,254,12,4,2,1,14,1,2,1,2,1,6, + 253,255,128,122,29,83,111,117,114,99,101,108,101,115,115,70, + 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, + 100,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, + 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, + 100,1,83,0,41,2,122,39,82,101,116,117,114,110,32,78, + 111,110,101,32,97,115,32,116,104,101,114,101,32,105,115,32, + 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, + 114,7,0,0,0,114,226,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,236,0,0,0,76,4, + 0,0,115,4,0,0,0,4,2,255,128,122,31,83,111,117, + 114,99,101,108,101,115,115,70,105,108,101,76,111,97,100,101, + 114,46,103,101,116,95,115,111,117,114,99,101,78,41,6,114, + 130,0,0,0,114,129,0,0,0,114,131,0,0,0,114,132, + 0,0,0,114,220,0,0,0,114,236,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,114,12,1,0,0,56,4,0,0,115,10,0,0,0,8, + 0,4,2,8,2,12,16,255,128,114,12,1,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,64,0,0,0,115,92,0,0,0,101,0,90,1, + 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, + 100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,6, + 100,8,100,9,132,0,90,7,100,10,100,11,132,0,90,8, + 100,12,100,13,132,0,90,9,100,14,100,15,132,0,90,10, + 100,16,100,17,132,0,90,11,101,12,100,18,100,19,132,0, + 131,1,90,13,100,20,83,0,41,21,114,3,1,0,0,122, + 93,76,111,97,100,101,114,32,102,111,114,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,115,46,10,10, + 32,32,32,32,84,104,101,32,99,111,110,115,116,114,117,99, + 116,111,114,32,105,115,32,100,101,115,105,103,110,101,100,32, + 116,111,32,119,111,114,107,32,119,105,116,104,32,70,105,108, + 101,70,105,110,100,101,114,46,10,10,32,32,32,32,99,3, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,2, + 0,0,0,67,0,0,0,115,16,0,0,0,124,1,124,0, + 95,0,124,2,124,0,95,1,100,0,83,0,114,114,0,0, + 0,114,163,0,0,0,41,3,114,123,0,0,0,114,121,0, + 0,0,114,52,0,0,0,114,7,0,0,0,114,7,0,0, + 0,114,8,0,0,0,114,216,0,0,0,89,4,0,0,115, + 6,0,0,0,6,1,10,1,255,128,122,28,69,120,116,101, + 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, + 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, + 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, + 0,115,24,0,0,0,124,0,106,0,124,1,106,0,107,2, + 111,22,124,0,106,1,124,1,106,1,107,2,83,0,114,114, + 0,0,0,114,247,0,0,0,114,249,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,250,0,0, + 0,93,4,0,0,115,8,0,0,0,12,1,10,1,2,255, + 255,128,122,26,69,120,116,101,110,115,105,111,110,70,105,108, + 101,76,111,97,100,101,114,46,95,95,101,113,95,95,99,1, + 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3, + 0,0,0,67,0,0,0,115,20,0,0,0,116,0,124,0, + 106,1,131,1,116,0,124,0,106,2,131,1,65,0,83,0, + 114,114,0,0,0,114,251,0,0,0,114,253,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,254, + 0,0,0,97,4,0,0,115,4,0,0,0,20,1,255,128, 122,28,69,120,116,101,110,115,105,111,110,70,105,108,101,76, - 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2, - 0,0,0,67,0,0,0,115,24,0,0,0,124,0,106,0, - 124,1,106,0,107,2,111,22,124,0,106,1,124,1,106,1, - 107,2,83,0,114,109,0,0,0,114,240,0,0,0,114,242, - 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,243,0,0,0,56,4,0,0,115,8,0,0,0, - 12,1,10,1,2,255,255,128,122,26,69,120,116,101,110,115, - 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, - 101,113,95,95,99,1,0,0,0,0,0,0,0,0,0,0, - 0,1,0,0,0,3,0,0,0,67,0,0,0,115,20,0, - 0,0,116,0,124,0,106,1,131,1,116,0,124,0,106,2, - 131,1,65,0,83,0,114,109,0,0,0,114,244,0,0,0, - 114,246,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,247,0,0,0,60,4,0,0,115,4,0, - 0,0,20,1,255,128,122,28,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97, - 115,104,95,95,99,2,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,5,0,0,0,67,0,0,0,115,36,0, - 0,0,116,0,160,1,116,2,106,3,124,1,161,2,125,2, - 116,0,160,4,100,1,124,1,106,5,124,0,106,6,161,3, - 1,0,124,2,83,0,41,2,122,38,67,114,101,97,116,101, - 32,97,110,32,117,110,105,116,105,97,108,105,122,101,100,32, + 111,97,100,101,114,46,95,95,104,97,115,104,95,95,99,2, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,5, + 0,0,0,67,0,0,0,115,36,0,0,0,116,0,160,1, + 116,2,106,3,124,1,161,2,125,2,116,0,160,4,100,1, + 124,1,106,5,124,0,106,6,161,3,1,0,124,2,83,0, + 41,3,122,38,67,114,101,97,116,101,32,97,110,32,117,110, + 105,116,105,97,108,105,122,101,100,32,101,120,116,101,110,115, + 105,111,110,32,109,111,100,117,108,101,122,38,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,32,123,33,114, + 125,32,108,111,97,100,101,100,32,102,114,111,109,32,123,33, + 114,125,78,41,7,114,139,0,0,0,114,221,0,0,0,114, + 167,0,0,0,90,14,99,114,101,97,116,101,95,100,121,110, + 97,109,105,99,114,153,0,0,0,114,121,0,0,0,114,52, + 0,0,0,41,3,114,123,0,0,0,114,191,0,0,0,114, + 223,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,114,219,0,0,0,100,4,0,0,115,16,0,0, + 0,4,2,6,1,4,255,6,2,8,1,4,255,4,2,255, + 128,122,33,69,120,116,101,110,115,105,111,110,70,105,108,101, + 76,111,97,100,101,114,46,99,114,101,97,116,101,95,109,111, + 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,5,0,0,0,67,0,0,0,115,36,0, + 0,0,116,0,160,1,116,2,106,3,124,1,161,2,1,0, + 116,0,160,4,100,1,124,0,106,5,124,0,106,6,161,3, + 1,0,100,2,83,0,41,3,122,30,73,110,105,116,105,97, + 108,105,122,101,32,97,110,32,101,120,116,101,110,115,105,111, + 110,32,109,111,100,117,108,101,122,40,101,120,116,101,110,115, + 105,111,110,32,109,111,100,117,108,101,32,123,33,114,125,32, + 101,120,101,99,117,116,101,100,32,102,114,111,109,32,123,33, + 114,125,78,41,7,114,139,0,0,0,114,221,0,0,0,114, + 167,0,0,0,90,12,101,120,101,99,95,100,121,110,97,109, + 105,99,114,153,0,0,0,114,121,0,0,0,114,52,0,0, + 0,169,2,114,123,0,0,0,114,223,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,224,0,0, + 0,108,4,0,0,115,10,0,0,0,14,2,6,1,8,1, + 8,255,255,128,122,31,69,120,116,101,110,115,105,111,110,70, + 105,108,101,76,111,97,100,101,114,46,101,120,101,99,95,109, + 111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,4,0,0,0,3,0,0,0,115,36, + 0,0,0,116,0,124,0,106,1,131,1,100,1,25,0,137, + 0,116,2,135,0,102,1,100,2,100,3,132,8,116,3,68, + 0,131,1,131,1,83,0,41,5,122,49,82,101,116,117,114, + 110,32,84,114,117,101,32,105,102,32,116,104,101,32,101,120, + 116,101,110,115,105,111,110,32,109,111,100,117,108,101,32,105, + 115,32,97,32,112,97,99,107,97,103,101,46,114,3,0,0, + 0,99,1,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,4,0,0,0,51,0,0,0,115,26,0,0,0,124, + 0,93,18,125,1,136,0,100,0,124,1,23,0,107,2,86, + 0,1,0,113,2,100,1,83,0,41,2,114,216,0,0,0, + 78,114,7,0,0,0,169,2,114,5,0,0,0,218,6,115, + 117,102,102,105,120,169,1,90,9,102,105,108,101,95,110,97, + 109,101,114,7,0,0,0,114,8,0,0,0,114,9,0,0, + 0,117,4,0,0,115,8,0,0,0,4,0,2,1,20,255, + 255,128,122,49,69,120,116,101,110,115,105,111,110,70,105,108, + 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, + 103,101,46,60,108,111,99,97,108,115,62,46,60,103,101,110, + 101,120,112,114,62,78,41,4,114,55,0,0,0,114,52,0, + 0,0,218,3,97,110,121,114,212,0,0,0,114,226,0,0, + 0,114,7,0,0,0,114,16,1,0,0,114,8,0,0,0, + 114,186,0,0,0,114,4,0,0,115,10,0,0,0,14,2, + 12,1,2,1,8,255,255,128,122,30,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115, + 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, + 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, + 0,115,4,0,0,0,100,1,83,0,41,2,122,63,82,101, + 116,117,114,110,32,78,111,110,101,32,97,115,32,97,110,32, 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 122,38,101,120,116,101,110,115,105,111,110,32,109,111,100,117, - 108,101,32,123,33,114,125,32,108,111,97,100,101,100,32,102, - 114,111,109,32,123,33,114,125,41,7,114,134,0,0,0,114, - 214,0,0,0,114,163,0,0,0,90,14,99,114,101,97,116, - 101,95,100,121,110,97,109,105,99,114,149,0,0,0,114,116, - 0,0,0,114,44,0,0,0,41,3,114,118,0,0,0,114, - 187,0,0,0,114,216,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,8,0,0,0,114,212,0,0,0,63,4,0, - 0,115,16,0,0,0,4,2,6,1,4,255,6,2,8,1, - 4,255,4,2,255,128,122,33,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,97, - 116,101,95,109,111,100,117,108,101,99,2,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,5,0,0,0,67,0, - 0,0,115,36,0,0,0,116,0,160,1,116,2,106,3,124, - 1,161,2,1,0,116,0,160,4,100,1,124,0,106,5,124, - 0,106,6,161,3,1,0,100,2,83,0,41,3,122,30,73, - 110,105,116,105,97,108,105,122,101,32,97,110,32,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,122,40,101, - 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,32, - 123,33,114,125,32,101,120,101,99,117,116,101,100,32,102,114, - 111,109,32,123,33,114,125,78,41,7,114,134,0,0,0,114, - 214,0,0,0,114,163,0,0,0,90,12,101,120,101,99,95, - 100,121,110,97,109,105,99,114,149,0,0,0,114,116,0,0, - 0,114,44,0,0,0,169,2,114,118,0,0,0,114,216,0, - 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,217,0,0,0,71,4,0,0,115,12,0,0,0,14, - 2,6,1,8,1,4,255,4,128,255,128,122,31,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, - 0,3,0,0,0,115,36,0,0,0,116,0,124,0,106,1, - 131,1,100,1,25,0,137,0,116,2,135,0,102,1,100,2, - 100,3,132,8,116,3,68,0,131,1,131,1,83,0,41,4, - 122,49,82,101,116,117,114,110,32,84,114,117,101,32,105,102, - 32,116,104,101,32,101,120,116,101,110,115,105,111,110,32,109, - 111,100,117,108,101,32,105,115,32,97,32,112,97,99,107,97, - 103,101,46,114,39,0,0,0,99,1,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,4,0,0,0,51,0,0, - 0,115,26,0,0,0,124,0,93,18,125,1,136,0,100,0, - 124,1,23,0,107,2,86,0,1,0,113,2,100,1,83,0, - 41,2,114,209,0,0,0,78,114,5,0,0,0,169,2,114, - 32,0,0,0,218,6,115,117,102,102,105,120,169,1,90,9, - 102,105,108,101,95,110,97,109,101,114,5,0,0,0,114,8, - 0,0,0,218,9,60,103,101,110,101,120,112,114,62,80,4, - 0,0,115,10,0,0,0,4,0,2,1,16,255,4,128,255, - 128,122,49,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,105,115,95,112,97,99,107,97,103, - 101,46,60,108,111,99,97,108,115,62,46,60,103,101,110,101, - 120,112,114,62,41,4,114,47,0,0,0,114,44,0,0,0, - 218,3,97,110,121,218,18,69,88,84,69,78,83,73,79,78, - 95,83,85,70,70,73,88,69,83,114,219,0,0,0,114,5, - 0,0,0,114,9,1,0,0,114,8,0,0,0,114,182,0, - 0,0,77,4,0,0,115,10,0,0,0,14,2,12,1,2, - 1,8,255,255,128,122,30,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,105,115,95,112,97, - 99,107,97,103,101,99,2,0,0,0,0,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,63,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,97,110,32,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,99,97, - 110,110,111,116,32,99,114,101,97,116,101,32,97,32,99,111, - 100,101,32,111,98,106,101,99,116,46,78,114,5,0,0,0, - 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,213,0,0,0,83,4,0,0,115,4,0, - 0,0,4,2,255,128,122,28,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, - 99,111,100,101,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, - 0,0,100,1,83,0,41,2,122,53,82,101,116,117,114,110, - 32,78,111,110,101,32,97,115,32,101,120,116,101,110,115,105, - 111,110,32,109,111,100,117,108,101,115,32,104,97,118,101,32, - 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, - 114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,229,0,0,0,87,4, - 0,0,115,4,0,0,0,4,2,255,128,122,30,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,103,101,116,95,115,111,117,114,99,101,99,2,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,6,0,0,0,124,0,106,0,83,0,114, - 250,0,0,0,114,48,0,0,0,114,219,0,0,0,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,114,179,0, - 0,0,91,4,0,0,115,4,0,0,0,6,3,255,128,122, - 32,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, - 97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,109, - 101,78,41,14,114,125,0,0,0,114,124,0,0,0,114,126, - 0,0,0,114,127,0,0,0,114,209,0,0,0,114,243,0, - 0,0,114,247,0,0,0,114,212,0,0,0,114,217,0,0, - 0,114,182,0,0,0,114,213,0,0,0,114,229,0,0,0, - 114,136,0,0,0,114,179,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,252, - 0,0,0,44,4,0,0,115,26,0,0,0,8,0,4,2, - 8,6,8,4,8,4,8,3,8,8,8,6,8,6,8,4, - 2,4,14,1,255,128,114,252,0,0,0,99,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 64,0,0,0,115,104,0,0,0,101,0,90,1,100,0,90, - 2,100,1,90,3,100,2,100,3,132,0,90,4,100,4,100, - 5,132,0,90,5,100,6,100,7,132,0,90,6,100,8,100, - 9,132,0,90,7,100,10,100,11,132,0,90,8,100,12,100, - 13,132,0,90,9,100,14,100,15,132,0,90,10,100,16,100, - 17,132,0,90,11,100,18,100,19,132,0,90,12,100,20,100, - 21,132,0,90,13,100,22,100,23,132,0,90,14,100,24,83, - 0,41,25,218,14,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,97,38,1,0,0,82,101,112,114,101,115,101,110, - 116,115,32,97,32,110,97,109,101,115,112,97,99,101,32,112, - 97,99,107,97,103,101,39,115,32,112,97,116,104,46,32,32, - 73,116,32,117,115,101,115,32,116,104,101,32,109,111,100,117, - 108,101,32,110,97,109,101,10,32,32,32,32,116,111,32,102, - 105,110,100,32,105,116,115,32,112,97,114,101,110,116,32,109, - 111,100,117,108,101,44,32,97,110,100,32,102,114,111,109,32, - 116,104,101,114,101,32,105,116,32,108,111,111,107,115,32,117, - 112,32,116,104,101,32,112,97,114,101,110,116,39,115,10,32, - 32,32,32,95,95,112,97,116,104,95,95,46,32,32,87,104, - 101,110,32,116,104,105,115,32,99,104,97,110,103,101,115,44, - 32,116,104,101,32,109,111,100,117,108,101,39,115,32,111,119, - 110,32,112,97,116,104,32,105,115,32,114,101,99,111,109,112, - 117,116,101,100,44,10,32,32,32,32,117,115,105,110,103,32, - 112,97,116,104,95,102,105,110,100,101,114,46,32,32,70,111, - 114,32,116,111,112,45,108,101,118,101,108,32,109,111,100,117, - 108,101,115,44,32,116,104,101,32,112,97,114,101,110,116,32, - 109,111,100,117,108,101,39,115,32,112,97,116,104,10,32,32, - 32,32,105,115,32,115,121,115,46,112,97,116,104,46,99,4, + 32,99,97,110,110,111,116,32,99,114,101,97,116,101,32,97, + 32,99,111,100,101,32,111,98,106,101,99,116,46,78,114,7, + 0,0,0,114,226,0,0,0,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,114,220,0,0,0,120,4,0,0, + 115,4,0,0,0,4,2,255,128,122,28,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,103, + 101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,1,83,0,41,2,122,53,82,101,116, + 117,114,110,32,78,111,110,101,32,97,115,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,115,32,104,97, + 118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100, + 101,46,78,114,7,0,0,0,114,226,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,236,0,0, + 0,124,4,0,0,115,4,0,0,0,4,2,255,128,122,30, + 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, + 100,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1, + 0,0,0,67,0,0,0,115,6,0,0,0,124,0,106,0, + 83,0,114,1,1,0,0,114,56,0,0,0,114,226,0,0, + 0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0, + 114,183,0,0,0,128,4,0,0,115,4,0,0,0,6,3, + 255,128,122,32,69,120,116,101,110,115,105,111,110,70,105,108, + 101,76,111,97,100,101,114,46,103,101,116,95,102,105,108,101, + 110,97,109,101,78,41,14,114,130,0,0,0,114,129,0,0, + 0,114,131,0,0,0,114,132,0,0,0,114,216,0,0,0, + 114,250,0,0,0,114,254,0,0,0,114,219,0,0,0,114, + 224,0,0,0,114,186,0,0,0,114,220,0,0,0,114,236, + 0,0,0,114,140,0,0,0,114,183,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,114,3,1,0,0,81,4,0,0,115,26,0,0,0,8, + 0,4,2,8,6,8,4,8,4,8,3,8,8,8,6,8, + 6,8,4,2,4,14,1,255,128,114,3,1,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, + 0,0,0,64,0,0,0,115,104,0,0,0,101,0,90,1, + 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, + 100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,6, + 100,8,100,9,132,0,90,7,100,10,100,11,132,0,90,8, + 100,12,100,13,132,0,90,9,100,14,100,15,132,0,90,10, + 100,16,100,17,132,0,90,11,100,18,100,19,132,0,90,12, + 100,20,100,21,132,0,90,13,100,22,100,23,132,0,90,14, + 100,24,83,0,41,25,218,14,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,97,38,1,0,0,82,101,112,114,101, + 115,101,110,116,115,32,97,32,110,97,109,101,115,112,97,99, + 101,32,112,97,99,107,97,103,101,39,115,32,112,97,116,104, + 46,32,32,73,116,32,117,115,101,115,32,116,104,101,32,109, + 111,100,117,108,101,32,110,97,109,101,10,32,32,32,32,116, + 111,32,102,105,110,100,32,105,116,115,32,112,97,114,101,110, + 116,32,109,111,100,117,108,101,44,32,97,110,100,32,102,114, + 111,109,32,116,104,101,114,101,32,105,116,32,108,111,111,107, + 115,32,117,112,32,116,104,101,32,112,97,114,101,110,116,39, + 115,10,32,32,32,32,95,95,112,97,116,104,95,95,46,32, + 32,87,104,101,110,32,116,104,105,115,32,99,104,97,110,103, + 101,115,44,32,116,104,101,32,109,111,100,117,108,101,39,115, + 32,111,119,110,32,112,97,116,104,32,105,115,32,114,101,99, + 111,109,112,117,116,101,100,44,10,32,32,32,32,117,115,105, + 110,103,32,112,97,116,104,95,102,105,110,100,101,114,46,32, + 32,70,111,114,32,116,111,112,45,108,101,118,101,108,32,109, + 111,100,117,108,101,115,44,32,116,104,101,32,112,97,114,101, + 110,116,32,109,111,100,117,108,101,39,115,32,112,97,116,104, + 10,32,32,32,32,105,115,32,115,121,115,46,112,97,116,104, + 46,99,4,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,3,0,0,0,67,0,0,0,115,36,0,0,0,124, + 1,124,0,95,0,124,2,124,0,95,1,116,2,124,0,160, + 3,161,0,131,1,124,0,95,4,124,3,124,0,95,5,100, + 0,83,0,114,114,0,0,0,41,6,218,5,95,110,97,109, + 101,218,5,95,112,97,116,104,114,116,0,0,0,218,16,95, + 103,101,116,95,112,97,114,101,110,116,95,112,97,116,104,218, + 17,95,108,97,115,116,95,112,97,114,101,110,116,95,112,97, + 116,104,218,12,95,112,97,116,104,95,102,105,110,100,101,114, + 169,4,114,123,0,0,0,114,121,0,0,0,114,52,0,0, + 0,90,11,112,97,116,104,95,102,105,110,100,101,114,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,114,216,0, + 0,0,141,4,0,0,115,10,0,0,0,6,1,6,1,14, + 1,10,1,255,128,122,23,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,46,95,95,105,110,105,116,95,95,99,1, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3, - 0,0,0,67,0,0,0,115,36,0,0,0,124,1,124,0, - 95,0,124,2,124,0,95,1,116,2,124,0,160,3,161,0, - 131,1,124,0,95,4,124,3,124,0,95,5,100,0,83,0, - 114,109,0,0,0,41,6,218,5,95,110,97,109,101,218,5, - 95,112,97,116,104,114,111,0,0,0,218,16,95,103,101,116, - 95,112,97,114,101,110,116,95,112,97,116,104,218,17,95,108, - 97,115,116,95,112,97,114,101,110,116,95,112,97,116,104,218, - 12,95,112,97,116,104,95,102,105,110,100,101,114,169,4,114, - 118,0,0,0,114,116,0,0,0,114,44,0,0,0,90,11, - 112,97,116,104,95,102,105,110,100,101,114,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,209,0,0,0,104, - 4,0,0,115,12,0,0,0,6,1,6,1,14,1,6,1, - 4,128,255,128,122,23,95,78,97,109,101,115,112,97,99,101, - 80,97,116,104,46,95,95,105,110,105,116,95,95,99,1,0, - 0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,0, - 0,0,67,0,0,0,115,38,0,0,0,124,0,106,0,160, - 1,100,1,161,1,92,3,125,1,125,2,125,3,124,2,100, - 2,107,2,114,30,100,3,83,0,124,1,100,4,102,2,83, - 0,41,5,122,62,82,101,116,117,114,110,115,32,97,32,116, - 117,112,108,101,32,111,102,32,40,112,97,114,101,110,116,45, - 109,111,100,117,108,101,45,110,97,109,101,44,32,112,97,114, - 101,110,116,45,112,97,116,104,45,97,116,116,114,45,110,97, - 109,101,41,114,71,0,0,0,114,40,0,0,0,41,2,114, - 1,0,0,0,114,44,0,0,0,90,8,95,95,112,97,116, - 104,95,95,41,2,114,14,1,0,0,114,41,0,0,0,41, - 4,114,118,0,0,0,114,4,1,0,0,218,3,100,111,116, - 90,2,109,101,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,23,95,102,105,110,100,95,112,97,114,101,110, - 116,95,112,97,116,104,95,110,97,109,101,115,110,4,0,0, - 115,10,0,0,0,18,2,8,1,4,2,8,3,255,128,122, - 38,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 95,102,105,110,100,95,112,97,114,101,110,116,95,112,97,116, - 104,95,110,97,109,101,115,99,1,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, - 115,28,0,0,0,124,0,160,0,161,0,92,2,125,1,125, - 2,116,1,116,2,106,3,124,1,25,0,124,2,131,2,83, - 0,114,109,0,0,0,41,4,114,21,1,0,0,114,130,0, - 0,0,114,1,0,0,0,218,7,109,111,100,117,108,101,115, - 41,3,114,118,0,0,0,90,18,112,97,114,101,110,116,95, - 109,111,100,117,108,101,95,110,97,109,101,90,14,112,97,116, - 104,95,97,116,116,114,95,110,97,109,101,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,16,1,0,0,120, - 4,0,0,115,6,0,0,0,12,1,16,1,255,128,122,31, - 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, - 103,101,116,95,112,97,114,101,110,116,95,112,97,116,104,99, - 1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, - 4,0,0,0,67,0,0,0,115,80,0,0,0,116,0,124, - 0,160,1,161,0,131,1,125,1,124,1,124,0,106,2,107, - 3,114,74,124,0,160,3,124,0,106,4,124,1,161,2,125, - 2,124,2,100,0,117,1,114,68,124,2,106,5,100,0,117, - 0,114,68,124,2,106,6,114,68,124,2,106,6,124,0,95, - 7,124,1,124,0,95,2,124,0,106,7,83,0,114,109,0, - 0,0,41,8,114,111,0,0,0,114,16,1,0,0,114,17, - 1,0,0,114,18,1,0,0,114,14,1,0,0,114,140,0, - 0,0,114,178,0,0,0,114,15,1,0,0,41,3,114,118, - 0,0,0,90,11,112,97,114,101,110,116,95,112,97,116,104, - 114,187,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,218,12,95,114,101,99,97,108,99,117,108,97, - 116,101,124,4,0,0,115,18,0,0,0,12,2,10,1,14, - 1,18,3,6,1,8,1,6,1,6,1,255,128,122,27,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,114, - 101,99,97,108,99,117,108,97,116,101,99,1,0,0,0,0, - 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67, - 0,0,0,115,12,0,0,0,116,0,124,0,160,1,161,0, - 131,1,83,0,114,109,0,0,0,41,2,218,4,105,116,101, - 114,114,23,1,0,0,114,246,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,218,8,95,95,105,116, - 101,114,95,95,137,4,0,0,115,4,0,0,0,12,1,255, - 128,122,23,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,105,116,101,114,95,95,99,2,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, - 0,0,0,115,12,0,0,0,124,0,160,0,161,0,124,1, - 25,0,83,0,114,109,0,0,0,169,1,114,23,1,0,0, - 41,2,114,118,0,0,0,218,5,105,110,100,101,120,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 95,103,101,116,105,116,101,109,95,95,140,4,0,0,115,4, - 0,0,0,12,1,255,128,122,26,95,78,97,109,101,115,112, - 97,99,101,80,97,116,104,46,95,95,103,101,116,105,116,101, - 109,95,95,99,3,0,0,0,0,0,0,0,0,0,0,0, - 3,0,0,0,3,0,0,0,67,0,0,0,115,14,0,0, - 0,124,2,124,0,106,0,124,1,60,0,100,0,83,0,114, - 109,0,0,0,41,1,114,15,1,0,0,41,3,114,118,0, - 0,0,114,27,1,0,0,114,44,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,218,11,95,95,115, - 101,116,105,116,101,109,95,95,143,4,0,0,115,6,0,0, - 0,10,1,4,128,255,128,122,26,95,78,97,109,101,115,112, + 0,0,0,67,0,0,0,115,38,0,0,0,124,0,106,0, + 160,1,100,1,161,1,92,3,125,1,125,2,125,3,124,2, + 100,2,107,2,114,30,100,3,83,0,124,1,100,4,102,2, + 83,0,41,6,122,62,82,101,116,117,114,110,115,32,97,32, + 116,117,112,108,101,32,111,102,32,40,112,97,114,101,110,116, + 45,109,111,100,117,108,101,45,110,97,109,101,44,32,112,97, + 114,101,110,116,45,112,97,116,104,45,97,116,116,114,45,110, + 97,109,101,41,114,79,0,0,0,114,10,0,0,0,41,2, + 114,15,0,0,0,114,52,0,0,0,90,8,95,95,112,97, + 116,104,95,95,78,41,2,114,19,1,0,0,114,49,0,0, + 0,41,4,114,123,0,0,0,114,11,1,0,0,218,3,100, + 111,116,90,2,109,101,114,7,0,0,0,114,7,0,0,0, + 114,8,0,0,0,218,23,95,102,105,110,100,95,112,97,114, + 101,110,116,95,112,97,116,104,95,110,97,109,101,115,147,4, + 0,0,115,10,0,0,0,18,2,8,1,4,2,8,3,255, + 128,122,38,95,78,97,109,101,115,112,97,99,101,80,97,116, + 104,46,95,102,105,110,100,95,112,97,114,101,110,116,95,112, + 97,116,104,95,110,97,109,101,115,99,1,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,28,0,0,0,124,0,160,0,161,0,92,2,125, + 1,125,2,116,1,116,2,106,3,124,1,25,0,124,2,131, + 2,83,0,114,114,0,0,0,41,4,114,26,1,0,0,114, + 135,0,0,0,114,15,0,0,0,218,7,109,111,100,117,108, + 101,115,41,3,114,123,0,0,0,90,18,112,97,114,101,110, + 116,95,109,111,100,117,108,101,95,110,97,109,101,90,14,112, + 97,116,104,95,97,116,116,114,95,110,97,109,101,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,21,1,0, + 0,157,4,0,0,115,6,0,0,0,12,1,16,1,255,128, + 122,31,95,78,97,109,101,115,112,97,99,101,80,97,116,104, + 46,95,103,101,116,95,112,97,114,101,110,116,95,112,97,116, + 104,99,1,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,4,0,0,0,67,0,0,0,115,80,0,0,0,116, + 0,124,0,160,1,161,0,131,1,125,1,124,1,124,0,106, + 2,107,3,114,74,124,0,160,3,124,0,106,4,124,1,161, + 2,125,2,124,2,100,0,117,1,114,68,124,2,106,5,100, + 0,117,0,114,68,124,2,106,6,114,68,124,2,106,6,124, + 0,95,7,124,1,124,0,95,2,124,0,106,7,83,0,114, + 114,0,0,0,41,8,114,116,0,0,0,114,21,1,0,0, + 114,22,1,0,0,114,23,1,0,0,114,19,1,0,0,114, + 144,0,0,0,114,182,0,0,0,114,20,1,0,0,41,3, + 114,123,0,0,0,90,11,112,97,114,101,110,116,95,112,97, + 116,104,114,191,0,0,0,114,7,0,0,0,114,7,0,0, + 0,114,8,0,0,0,218,12,95,114,101,99,97,108,99,117, + 108,97,116,101,161,4,0,0,115,18,0,0,0,12,2,10, + 1,14,1,18,3,6,1,8,1,6,1,6,1,255,128,122, + 27,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 95,114,101,99,97,108,99,117,108,97,116,101,99,1,0,0, + 0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,12,0,0,0,116,0,124,0,160,1, + 161,0,131,1,83,0,114,114,0,0,0,41,2,218,4,105, + 116,101,114,114,28,1,0,0,114,253,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,218,8,95,95, + 105,116,101,114,95,95,174,4,0,0,115,4,0,0,0,12, + 1,255,128,122,23,95,78,97,109,101,115,112,97,99,101,80, + 97,116,104,46,95,95,105,116,101,114,95,95,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0, + 0,67,0,0,0,115,12,0,0,0,124,0,160,0,161,0, + 124,1,25,0,83,0,114,114,0,0,0,169,1,114,28,1, + 0,0,41,2,114,123,0,0,0,218,5,105,110,100,101,120, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218, + 11,95,95,103,101,116,105,116,101,109,95,95,177,4,0,0, + 115,4,0,0,0,12,1,255,128,122,26,95,78,97,109,101, + 115,112,97,99,101,80,97,116,104,46,95,95,103,101,116,105, + 116,101,109,95,95,99,3,0,0,0,0,0,0,0,0,0, + 0,0,3,0,0,0,3,0,0,0,67,0,0,0,115,14, + 0,0,0,124,2,124,0,106,0,124,1,60,0,100,0,83, + 0,114,114,0,0,0,41,1,114,20,1,0,0,41,3,114, + 123,0,0,0,114,32,1,0,0,114,52,0,0,0,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,218,11,95, + 95,115,101,116,105,116,101,109,95,95,180,4,0,0,115,4, + 0,0,0,14,1,255,128,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,3,0,0,0,67,0,0,0,115,12,0,0, - 0,116,0,124,0,160,1,161,0,131,1,83,0,114,109,0, - 0,0,41,2,114,23,0,0,0,114,23,1,0,0,114,246, - 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,7,95,95,108,101,110,95,95,146,4,0,0,115, + 0,116,0,124,0,160,1,161,0,131,1,83,0,114,114,0, + 0,0,41,2,114,4,0,0,0,114,28,1,0,0,114,253, + 0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,218,7,95,95,108,101,110,95,95,183,4,0,0,115, 4,0,0,0,12,1,255,128,122,22,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,95,108,101,110,95,95, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,3,0,0,0,67,0,0,0,115,12,0,0,0,100,1, 160,0,124,0,106,1,161,1,83,0,41,2,78,122,20,95, 78,97,109,101,115,112,97,99,101,80,97,116,104,40,123,33, - 114,125,41,41,2,114,62,0,0,0,114,15,1,0,0,114, - 246,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,8,95,95,114,101,112,114,95,95,149,4,0, + 114,125,41,41,2,114,70,0,0,0,114,20,1,0,0,114, + 253,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,8,95,95,114,101,112,114,95,95,186,4,0, 0,115,4,0,0,0,12,1,255,128,122,23,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,95,114,101,112, 114,95,95,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,3,0,0,0,67,0,0,0,115,12,0,0, - 0,124,1,124,0,160,0,161,0,118,0,83,0,114,109,0, - 0,0,114,26,1,0,0,169,2,114,118,0,0,0,218,4, - 105,116,101,109,114,5,0,0,0,114,5,0,0,0,114,8, + 0,124,1,124,0,160,0,161,0,118,0,83,0,114,114,0, + 0,0,114,31,1,0,0,169,2,114,123,0,0,0,218,4, + 105,116,101,109,114,7,0,0,0,114,7,0,0,0,114,8, 0,0,0,218,12,95,95,99,111,110,116,97,105,110,115,95, - 95,152,4,0,0,115,4,0,0,0,12,1,255,128,122,27, + 95,189,4,0,0,115,4,0,0,0,12,1,255,128,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, 67,0,0,0,115,16,0,0,0,124,0,106,0,160,1,124, - 1,161,1,1,0,100,0,83,0,114,109,0,0,0,41,2, - 114,15,1,0,0,114,186,0,0,0,114,32,1,0,0,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,186, - 0,0,0,155,4,0,0,115,6,0,0,0,12,1,4,128, - 255,128,122,21,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,97,112,112,101,110,100,78,41,15,114,125,0,0, - 0,114,124,0,0,0,114,126,0,0,0,114,127,0,0,0, - 114,209,0,0,0,114,21,1,0,0,114,16,1,0,0,114, - 23,1,0,0,114,25,1,0,0,114,28,1,0,0,114,29, - 1,0,0,114,30,1,0,0,114,31,1,0,0,114,34,1, - 0,0,114,186,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,5,0,0,0,114,8,0,0,0,114,13,1,0,0, - 97,4,0,0,115,28,0,0,0,8,0,4,1,8,6,8, - 6,8,10,8,4,8,13,8,3,8,3,8,3,8,3,8, - 3,12,3,255,128,114,13,1,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, - 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, - 100,1,100,2,132,0,90,3,101,4,100,3,100,4,132,0, - 131,1,90,5,100,5,100,6,132,0,90,6,100,7,100,8, - 132,0,90,7,100,9,100,10,132,0,90,8,100,11,100,12, - 132,0,90,9,100,13,100,14,132,0,90,10,100,15,100,16, - 132,0,90,11,100,17,83,0,41,18,218,16,95,78,97,109, - 101,115,112,97,99,101,76,111,97,100,101,114,99,4,0,0, - 0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0, - 0,67,0,0,0,115,18,0,0,0,116,0,124,1,124,2, - 124,3,131,3,124,0,95,1,100,0,83,0,114,109,0,0, - 0,41,2,114,13,1,0,0,114,15,1,0,0,114,19,1, - 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,209,0,0,0,161,4,0,0,115,6,0,0,0,14, - 1,4,128,255,128,122,25,95,78,97,109,101,115,112,97,99, - 101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,95, - 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,3,0,0,0,67,0,0,0,115,12,0,0,0,100,1, - 160,0,124,1,106,1,161,1,83,0,41,2,122,115,82,101, - 116,117,114,110,32,114,101,112,114,32,102,111,114,32,116,104, - 101,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32, - 32,32,32,84,104,101,32,109,101,116,104,111,100,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,32,84,104, - 101,32,105,109,112,111,114,116,32,109,97,99,104,105,110,101, - 114,121,32,100,111,101,115,32,116,104,101,32,106,111,98,32, - 105,116,115,101,108,102,46,10,10,32,32,32,32,32,32,32, - 32,122,25,60,109,111,100,117,108,101,32,123,33,114,125,32, - 40,110,97,109,101,115,112,97,99,101,41,62,41,2,114,62, - 0,0,0,114,125,0,0,0,41,2,114,193,0,0,0,114, - 216,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,11,109,111,100,117,108,101,95,114,101,112,114, - 164,4,0,0,115,4,0,0,0,12,7,255,128,122,28,95, + 1,161,1,1,0,100,0,83,0,114,114,0,0,0,41,2, + 114,20,1,0,0,114,190,0,0,0,114,37,1,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,190, + 0,0,0,192,4,0,0,115,4,0,0,0,16,1,255,128, + 122,21,95,78,97,109,101,115,112,97,99,101,80,97,116,104, + 46,97,112,112,101,110,100,78,41,15,114,130,0,0,0,114, + 129,0,0,0,114,131,0,0,0,114,132,0,0,0,114,216, + 0,0,0,114,26,1,0,0,114,21,1,0,0,114,28,1, + 0,0,114,30,1,0,0,114,33,1,0,0,114,34,1,0, + 0,114,35,1,0,0,114,36,1,0,0,114,39,1,0,0, + 114,190,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,18,1,0,0,134,4, + 0,0,115,28,0,0,0,8,0,4,1,8,6,8,6,8, + 10,8,4,8,13,8,3,8,3,8,3,8,3,8,3,12, + 3,255,128,114,18,1,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, + 0,115,80,0,0,0,101,0,90,1,100,0,90,2,100,1, + 100,2,132,0,90,3,101,4,100,3,100,4,132,0,131,1, + 90,5,100,5,100,6,132,0,90,6,100,7,100,8,132,0, + 90,7,100,9,100,10,132,0,90,8,100,11,100,12,132,0, + 90,9,100,13,100,14,132,0,90,10,100,15,100,16,132,0, + 90,11,100,17,83,0,41,18,218,16,95,78,97,109,101,115, + 112,97,99,101,76,111,97,100,101,114,99,4,0,0,0,0, + 0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67, + 0,0,0,115,18,0,0,0,116,0,124,1,124,2,124,3, + 131,3,124,0,95,1,100,0,83,0,114,114,0,0,0,41, + 2,114,18,1,0,0,114,20,1,0,0,114,24,1,0,0, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,114, + 216,0,0,0,198,4,0,0,115,4,0,0,0,18,1,255, + 128,122,25,95,78,97,109,101,115,112,97,99,101,76,111,97, + 100,101,114,46,95,95,105,110,105,116,95,95,99,1,0,0, + 0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,12,0,0,0,100,1,160,0,124,0, + 106,1,161,1,83,0,41,3,122,115,82,101,116,117,114,110, + 32,114,101,112,114,32,102,111,114,32,116,104,101,32,109,111, + 100,117,108,101,46,10,10,32,32,32,32,32,32,32,32,84, + 104,101,32,109,101,116,104,111,100,32,105,115,32,100,101,112, + 114,101,99,97,116,101,100,46,32,32,84,104,101,32,105,109, + 112,111,114,116,32,109,97,99,104,105,110,101,114,121,32,100, + 111,101,115,32,116,104,101,32,106,111,98,32,105,116,115,101, + 108,102,46,10,10,32,32,32,32,32,32,32,32,122,25,60, + 109,111,100,117,108,101,32,123,33,114,125,32,40,110,97,109, + 101,115,112,97,99,101,41,62,78,41,2,114,70,0,0,0, + 114,130,0,0,0,41,1,114,223,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,218,11,109,111,100, + 117,108,101,95,114,101,112,114,201,4,0,0,115,4,0,0, + 0,12,7,255,128,122,28,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,109,111,100,117,108,101,95,114, + 101,112,114,99,2,0,0,0,0,0,0,0,0,0,0,0, + 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, + 0,100,1,83,0,41,2,78,84,114,7,0,0,0,114,226, + 0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,114,186,0,0,0,210,4,0,0,115,4,0,0,0, + 4,1,255,128,122,27,95,78,97,109,101,115,112,97,99,101, + 76,111,97,100,101,114,46,105,115,95,112,97,99,107,97,103, + 101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, + 1,83,0,41,2,78,114,10,0,0,0,114,7,0,0,0, + 114,226,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,114,236,0,0,0,213,4,0,0,115,4,0, + 0,0,4,1,255,128,122,27,95,78,97,109,101,115,112,97, + 99,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, + 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, + 2,0,0,0,6,0,0,0,67,0,0,0,115,16,0,0, + 0,116,0,100,1,100,2,100,3,100,4,100,5,141,4,83, + 0,41,6,78,114,10,0,0,0,122,8,60,115,116,114,105, + 110,103,62,114,222,0,0,0,84,41,1,114,238,0,0,0, + 41,1,114,239,0,0,0,114,226,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,114,220,0,0,0, + 216,4,0,0,115,4,0,0,0,16,1,255,128,122,25,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 109,111,100,117,108,101,95,114,101,112,114,99,2,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,4,0,0,0,100,1,83,0,41,2,78, - 84,114,5,0,0,0,114,219,0,0,0,114,5,0,0,0, - 114,5,0,0,0,114,8,0,0,0,114,182,0,0,0,173, - 4,0,0,115,4,0,0,0,4,1,255,128,122,27,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,105, - 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,4,0,0,0,100,1,83,0,41,2,78,114,40, - 0,0,0,114,5,0,0,0,114,219,0,0,0,114,5,0, - 0,0,114,5,0,0,0,114,8,0,0,0,114,229,0,0, - 0,176,4,0,0,115,4,0,0,0,4,1,255,128,122,27, - 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, - 46,103,101,116,95,115,111,117,114,99,101,99,2,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,6,0,0,0, - 67,0,0,0,115,16,0,0,0,116,0,100,1,100,2,100, - 3,100,4,100,5,141,4,83,0,41,6,78,114,40,0,0, - 0,122,8,60,115,116,114,105,110,103,62,114,215,0,0,0, - 84,41,1,114,231,0,0,0,41,1,114,232,0,0,0,114, - 219,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,213,0,0,0,179,4,0,0,115,4,0,0, - 0,16,1,255,128,122,25,95,78,97,109,101,115,112,97,99, - 101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101, - 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1, - 83,0,114,210,0,0,0,114,5,0,0,0,114,211,0,0, - 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 114,212,0,0,0,182,4,0,0,115,4,0,0,0,4,128, - 255,128,122,30,95,78,97,109,101,115,112,97,99,101,76,111, - 97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117, - 108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, - 100,0,83,0,114,109,0,0,0,114,5,0,0,0,114,6, - 1,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,217,0,0,0,185,4,0,0,115,6,0,0,0, - 2,1,2,128,255,128,122,28,95,78,97,109,101,115,112,97, - 99,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, - 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,4,0,0,0,67,0,0,0,115,26,0, - 0,0,116,0,160,1,100,1,124,0,106,2,161,2,1,0, - 116,0,160,3,124,0,124,1,161,2,83,0,41,2,122,98, - 76,111,97,100,32,97,32,110,97,109,101,115,112,97,99,101, - 32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,32, - 32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115, - 101,32,101,120,101,99,95,109,111,100,117,108,101,40,41,32, - 105,110,115,116,101,97,100,46,10,10,32,32,32,32,32,32, - 32,32,122,38,110,97,109,101,115,112,97,99,101,32,109,111, - 100,117,108,101,32,108,111,97,100,101,100,32,119,105,116,104, - 32,112,97,116,104,32,123,33,114,125,41,4,114,134,0,0, - 0,114,149,0,0,0,114,15,1,0,0,114,218,0,0,0, - 114,219,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,220,0,0,0,188,4,0,0,115,10,0, - 0,0,6,7,4,1,4,255,12,2,255,128,122,28,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,108, - 111,97,100,95,109,111,100,117,108,101,78,41,12,114,125,0, - 0,0,114,124,0,0,0,114,126,0,0,0,114,209,0,0, - 0,114,207,0,0,0,114,36,1,0,0,114,182,0,0,0, - 114,229,0,0,0,114,213,0,0,0,114,212,0,0,0,114, - 217,0,0,0,114,220,0,0,0,114,5,0,0,0,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,114,35,1, - 0,0,160,4,0,0,115,22,0,0,0,8,0,8,1,2, - 3,10,1,8,8,8,3,8,3,8,3,8,3,12,3,255, - 128,114,35,1,0,0,99,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,4,0,0,0,64,0,0,0,115, - 118,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, - 101,4,100,2,100,3,132,0,131,1,90,5,101,4,100,4, - 100,5,132,0,131,1,90,6,101,4,100,6,100,7,132,0, - 131,1,90,7,101,4,100,8,100,9,132,0,131,1,90,8, - 101,4,100,19,100,11,100,12,132,1,131,1,90,9,101,4, - 100,20,100,13,100,14,132,1,131,1,90,10,101,4,100,21, - 100,15,100,16,132,1,131,1,90,11,101,4,100,17,100,18, - 132,0,131,1,90,12,100,10,83,0,41,22,218,10,80,97, - 116,104,70,105,110,100,101,114,122,62,77,101,116,97,32,112, - 97,116,104,32,102,105,110,100,101,114,32,102,111,114,32,115, - 121,115,46,112,97,116,104,32,97,110,100,32,112,97,99,107, - 97,103,101,32,95,95,112,97,116,104,95,95,32,97,116,116, - 114,105,98,117,116,101,115,46,99,1,0,0,0,0,0,0, - 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, - 0,115,64,0,0,0,116,0,116,1,106,2,160,3,161,0, - 131,1,68,0,93,44,92,2,125,1,125,2,124,2,100,1, - 117,0,114,40,116,1,106,2,124,1,61,0,113,14,116,4, - 124,2,100,2,131,2,114,14,124,2,160,5,161,0,1,0, - 113,14,100,1,83,0,41,3,122,125,67,97,108,108,32,116, - 104,101,32,105,110,118,97,108,105,100,97,116,101,95,99,97, - 99,104,101,115,40,41,32,109,101,116,104,111,100,32,111,110, - 32,97,108,108,32,112,97,116,104,32,101,110,116,114,121,32, - 102,105,110,100,101,114,115,10,32,32,32,32,32,32,32,32, - 115,116,111,114,101,100,32,105,110,32,115,121,115,46,112,97, - 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,115,32,40,119,104,101,114,101,32,105,109,112,108,101,109, - 101,110,116,101,100,41,46,78,218,17,105,110,118,97,108,105, - 100,97,116,101,95,99,97,99,104,101,115,41,6,218,4,108, - 105,115,116,114,1,0,0,0,218,19,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,218,5,105, - 116,101,109,115,114,128,0,0,0,114,38,1,0,0,41,3, - 114,193,0,0,0,114,116,0,0,0,218,6,102,105,110,100, - 101,114,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,38,1,0,0,206,4,0,0,115,14,0,0,0,22, - 4,8,1,10,1,10,1,10,1,4,128,255,128,122,28,80, - 97,116,104,70,105,110,100,101,114,46,105,110,118,97,108,105, - 100,97,116,101,95,99,97,99,104,101,115,99,2,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,9,0,0,0, - 67,0,0,0,115,80,0,0,0,116,0,106,1,100,1,117, - 1,114,28,116,0,106,1,115,28,116,2,160,3,100,2,116, - 4,161,2,1,0,116,0,106,1,68,0,93,40,125,2,122, - 14,124,2,124,1,131,1,87,0,2,0,1,0,83,0,4, - 0,116,5,121,74,1,0,1,0,1,0,89,0,113,34,89, - 0,113,34,48,0,100,1,83,0,41,3,122,46,83,101,97, - 114,99,104,32,115,121,115,46,112,97,116,104,95,104,111,111, - 107,115,32,102,111,114,32,97,32,102,105,110,100,101,114,32, - 102,111,114,32,39,112,97,116,104,39,46,78,122,23,115,121, - 115,46,112,97,116,104,95,104,111,111,107,115,32,105,115,32, - 101,109,112,116,121,41,6,114,1,0,0,0,218,10,112,97, - 116,104,95,104,111,111,107,115,114,75,0,0,0,114,76,0, - 0,0,114,138,0,0,0,114,117,0,0,0,41,3,114,193, - 0,0,0,114,44,0,0,0,90,4,104,111,111,107,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95, - 112,97,116,104,95,104,111,111,107,115,216,4,0,0,115,18, - 0,0,0,16,3,12,1,10,1,2,1,14,1,12,1,10, - 1,4,2,255,128,122,22,80,97,116,104,70,105,110,100,101, - 114,46,95,112,97,116,104,95,104,111,111,107,115,99,2,0, - 0,0,0,0,0,0,0,0,0,0,3,0,0,0,8,0, - 0,0,67,0,0,0,115,100,0,0,0,124,1,100,1,107, - 2,114,42,122,12,116,0,160,1,161,0,125,1,87,0,110, - 20,4,0,116,2,121,40,1,0,1,0,1,0,89,0,100, - 2,83,0,48,0,122,14,116,3,106,4,124,1,25,0,125, - 2,87,0,110,38,4,0,116,5,121,94,1,0,1,0,1, - 0,124,0,160,6,124,1,161,1,125,2,124,2,116,3,106, - 4,124,1,60,0,89,0,110,2,48,0,124,2,83,0,41, - 3,122,210,71,101,116,32,116,104,101,32,102,105,110,100,101, - 114,32,102,111,114,32,116,104,101,32,112,97,116,104,32,101, - 110,116,114,121,32,102,114,111,109,32,115,121,115,46,112,97, - 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,46,10,10,32,32,32,32,32,32,32,32,73,102,32,116, - 104,101,32,112,97,116,104,32,101,110,116,114,121,32,105,115, - 32,110,111,116,32,105,110,32,116,104,101,32,99,97,99,104, - 101,44,32,102,105,110,100,32,116,104,101,32,97,112,112,114, - 111,112,114,105,97,116,101,32,102,105,110,100,101,114,10,32, - 32,32,32,32,32,32,32,97,110,100,32,99,97,99,104,101, - 32,105,116,46,32,73,102,32,110,111,32,102,105,110,100,101, - 114,32,105,115,32,97,118,97,105,108,97,98,108,101,44,32, - 115,116,111,114,101,32,78,111,110,101,46,10,10,32,32,32, - 32,32,32,32,32,114,40,0,0,0,78,41,7,114,4,0, - 0,0,114,55,0,0,0,218,17,70,105,108,101,78,111,116, - 70,111,117,110,100,69,114,114,111,114,114,1,0,0,0,114, - 40,1,0,0,218,8,75,101,121,69,114,114,111,114,114,44, - 1,0,0,41,3,114,193,0,0,0,114,44,0,0,0,114, - 42,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, - 116,101,114,95,99,97,99,104,101,229,4,0,0,115,24,0, - 0,0,8,8,2,1,12,1,12,1,8,3,2,1,14,1, - 12,1,10,1,16,1,4,1,255,128,122,31,80,97,116,104, - 70,105,110,100,101,114,46,95,112,97,116,104,95,105,109,112, - 111,114,116,101,114,95,99,97,99,104,101,99,3,0,0,0, - 0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0, - 67,0,0,0,115,82,0,0,0,116,0,124,2,100,1,131, - 2,114,26,124,2,160,1,124,1,161,1,92,2,125,3,125, - 4,110,14,124,2,160,2,124,1,161,1,125,3,103,0,125, - 4,124,3,100,0,117,1,114,60,116,3,160,4,124,1,124, - 3,161,2,83,0,116,3,160,5,124,1,100,0,161,2,125, - 5,124,4,124,5,95,6,124,5,83,0,41,2,78,114,137, - 0,0,0,41,7,114,128,0,0,0,114,137,0,0,0,114, - 206,0,0,0,114,134,0,0,0,114,201,0,0,0,114,183, - 0,0,0,114,178,0,0,0,41,6,114,193,0,0,0,114, - 139,0,0,0,114,42,1,0,0,114,140,0,0,0,114,141, - 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,218,16,95,108,101,103,97,99,121, - 95,103,101,116,95,115,112,101,99,251,4,0,0,115,20,0, - 0,0,10,4,16,1,10,2,4,1,8,1,12,1,12,1, - 6,1,4,1,255,128,122,27,80,97,116,104,70,105,110,100, - 101,114,46,95,108,101,103,97,99,121,95,103,101,116,95,115, - 112,101,99,78,99,4,0,0,0,0,0,0,0,0,0,0, - 0,9,0,0,0,5,0,0,0,67,0,0,0,115,166,0, - 0,0,103,0,125,4,124,2,68,0,93,134,125,5,116,0, - 124,5,116,1,116,2,102,2,131,2,115,28,113,8,124,0, - 160,3,124,5,161,1,125,6,124,6,100,1,117,1,114,8, - 116,4,124,6,100,2,131,2,114,70,124,6,160,5,124,1, - 124,3,161,2,125,7,110,12,124,0,160,6,124,1,124,6, - 161,2,125,7,124,7,100,1,117,0,114,92,113,8,124,7, - 106,7,100,1,117,1,114,110,124,7,2,0,1,0,83,0, - 124,7,106,8,125,8,124,8,100,1,117,0,114,132,116,9, - 100,3,131,1,130,1,124,4,160,10,124,8,161,1,1,0, - 113,8,116,11,160,12,124,1,100,1,161,2,125,7,124,4, - 124,7,95,8,124,7,83,0,41,4,122,63,70,105,110,100, - 32,116,104,101,32,108,111,97,100,101,114,32,111,114,32,110, - 97,109,101,115,112,97,99,101,95,112,97,116,104,32,102,111, - 114,32,116,104,105,115,32,109,111,100,117,108,101,47,112,97, - 99,107,97,103,101,32,110,97,109,101,46,78,114,203,0,0, - 0,122,19,115,112,101,99,32,109,105,115,115,105,110,103,32, - 108,111,97,100,101,114,41,13,114,161,0,0,0,114,84,0, - 0,0,218,5,98,121,116,101,115,114,47,1,0,0,114,128, - 0,0,0,114,203,0,0,0,114,48,1,0,0,114,140,0, - 0,0,114,178,0,0,0,114,117,0,0,0,114,167,0,0, - 0,114,134,0,0,0,114,183,0,0,0,41,9,114,193,0, - 0,0,114,139,0,0,0,114,44,0,0,0,114,202,0,0, - 0,218,14,110,97,109,101,115,112,97,99,101,95,112,97,116, - 104,90,5,101,110,116,114,121,114,42,1,0,0,114,187,0, - 0,0,114,141,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,218,9,95,103,101,116,95,115,112,101, - 99,10,5,0,0,115,42,0,0,0,4,5,8,1,14,1, - 2,1,10,1,8,1,10,1,14,1,12,2,8,1,2,1, - 10,1,8,1,6,1,8,1,8,1,12,5,12,2,6,1, - 4,1,255,128,122,20,80,97,116,104,70,105,110,100,101,114, - 46,95,103,101,116,95,115,112,101,99,99,4,0,0,0,0, - 0,0,0,0,0,0,0,6,0,0,0,5,0,0,0,67, - 0,0,0,115,94,0,0,0,124,2,100,1,117,0,114,14, - 116,0,106,1,125,2,124,0,160,2,124,1,124,2,124,3, - 161,3,125,4,124,4,100,1,117,0,114,40,100,1,83,0, - 124,4,106,3,100,1,117,0,114,90,124,4,106,4,125,5, - 124,5,114,86,100,1,124,4,95,5,116,6,124,1,124,5, - 124,0,106,2,131,3,124,4,95,4,124,4,83,0,100,1, - 83,0,124,4,83,0,41,2,122,141,84,114,121,32,116,111, - 32,102,105,110,100,32,97,32,115,112,101,99,32,102,111,114, - 32,39,102,117,108,108,110,97,109,101,39,32,111,110,32,115, - 121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,104, - 39,46,10,10,32,32,32,32,32,32,32,32,84,104,101,32, - 115,101,97,114,99,104,32,105,115,32,98,97,115,101,100,32, - 111,110,32,115,121,115,46,112,97,116,104,95,104,111,111,107, - 115,32,97,110,100,32,115,121,115,46,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,46,10,32, - 32,32,32,32,32,32,32,78,41,7,114,1,0,0,0,114, - 44,0,0,0,114,51,1,0,0,114,140,0,0,0,114,178, - 0,0,0,114,181,0,0,0,114,13,1,0,0,41,6,114, - 193,0,0,0,114,139,0,0,0,114,44,0,0,0,114,202, - 0,0,0,114,187,0,0,0,114,50,1,0,0,114,5,0, - 0,0,114,5,0,0,0,114,8,0,0,0,114,203,0,0, - 0,42,5,0,0,115,28,0,0,0,8,6,6,1,14,1, - 8,1,4,1,10,1,6,1,4,1,6,3,16,1,4,1, - 4,2,4,2,255,128,122,20,80,97,116,104,70,105,110,100, - 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0, - 0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0, - 0,67,0,0,0,115,30,0,0,0,124,0,160,0,124,1, - 124,2,161,2,125,3,124,3,100,1,117,0,114,24,100,1, - 83,0,124,3,106,1,83,0,41,2,122,170,102,105,110,100, - 32,116,104,101,32,109,111,100,117,108,101,32,111,110,32,115, - 121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,104, - 39,32,98,97,115,101,100,32,111,110,32,115,121,115,46,112, - 97,116,104,95,104,111,111,107,115,32,97,110,100,10,32,32, - 32,32,32,32,32,32,115,121,115,46,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,46,10,10, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, + 0,115,4,0,0,0,100,1,83,0,114,217,0,0,0,114, + 7,0,0,0,114,218,0,0,0,114,7,0,0,0,114,7, + 0,0,0,114,8,0,0,0,114,219,0,0,0,219,4,0, + 0,115,4,0,0,0,4,0,255,128,122,30,95,78,97,109, + 101,115,112,97,99,101,76,111,97,100,101,114,46,99,114,101, + 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67, + 0,0,0,115,4,0,0,0,100,0,83,0,114,114,0,0, + 0,114,7,0,0,0,114,13,1,0,0,114,7,0,0,0, + 114,7,0,0,0,114,8,0,0,0,114,224,0,0,0,222, + 4,0,0,115,4,0,0,0,4,1,255,128,122,28,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,101, + 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, + 0,0,0,115,26,0,0,0,116,0,160,1,100,1,124,0, + 106,2,161,2,1,0,116,0,160,3,124,0,124,1,161,2, + 83,0,41,3,122,98,76,111,97,100,32,97,32,110,97,109, + 101,115,112,97,99,101,32,109,111,100,117,108,101,46,10,10, 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101, - 100,46,32,32,85,115,101,32,102,105,110,100,95,115,112,101, - 99,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,78,114,204,0,0,0,114,205,0,0, - 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 114,206,0,0,0,66,5,0,0,115,10,0,0,0,12,8, - 8,1,4,1,6,1,255,128,122,22,80,97,116,104,70,105, - 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, - 99,1,0,0,0,0,0,0,0,0,0,0,0,4,0,0, - 0,4,0,0,0,79,0,0,0,115,28,0,0,0,100,1, - 100,2,108,0,109,1,125,3,1,0,124,3,106,2,124,1, - 105,0,124,2,164,1,142,1,83,0,41,3,97,32,1,0, - 0,10,32,32,32,32,32,32,32,32,70,105,110,100,32,100, - 105,115,116,114,105,98,117,116,105,111,110,115,46,10,10,32, - 32,32,32,32,32,32,32,82,101,116,117,114,110,32,97,110, - 32,105,116,101,114,97,98,108,101,32,111,102,32,97,108,108, - 32,68,105,115,116,114,105,98,117,116,105,111,110,32,105,110, - 115,116,97,110,99,101,115,32,99,97,112,97,98,108,101,32, - 111,102,10,32,32,32,32,32,32,32,32,108,111,97,100,105, - 110,103,32,116,104,101,32,109,101,116,97,100,97,116,97,32, - 102,111,114,32,112,97,99,107,97,103,101,115,32,109,97,116, - 99,104,105,110,103,32,96,96,99,111,110,116,101,120,116,46, - 110,97,109,101,96,96,10,32,32,32,32,32,32,32,32,40, - 111,114,32,97,108,108,32,110,97,109,101,115,32,105,102,32, - 96,96,78,111,110,101,96,96,32,105,110,100,105,99,97,116, - 101,100,41,32,97,108,111,110,103,32,116,104,101,32,112,97, - 116,104,115,32,105,110,32,116,104,101,32,108,105,115,116,10, - 32,32,32,32,32,32,32,32,111,102,32,100,105,114,101,99, - 116,111,114,105,101,115,32,96,96,99,111,110,116,101,120,116, - 46,112,97,116,104,96,96,46,10,32,32,32,32,32,32,32, - 32,114,73,0,0,0,41,1,218,18,77,101,116,97,100,97, - 116,97,80,97,116,104,70,105,110,100,101,114,41,3,90,18, - 105,109,112,111,114,116,108,105,98,46,109,101,116,97,100,97, - 116,97,114,52,1,0,0,218,18,102,105,110,100,95,100,105, - 115,116,114,105,98,117,116,105,111,110,115,41,4,114,193,0, - 0,0,114,119,0,0,0,114,120,0,0,0,114,52,1,0, - 0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 114,53,1,0,0,79,5,0,0,115,6,0,0,0,12,10, - 16,1,255,128,122,29,80,97,116,104,70,105,110,100,101,114, - 46,102,105,110,100,95,100,105,115,116,114,105,98,117,116,105, - 111,110,115,41,1,78,41,2,78,78,41,1,78,41,13,114, - 125,0,0,0,114,124,0,0,0,114,126,0,0,0,114,127, - 0,0,0,114,207,0,0,0,114,38,1,0,0,114,44,1, - 0,0,114,47,1,0,0,114,48,1,0,0,114,51,1,0, - 0,114,203,0,0,0,114,206,0,0,0,114,53,1,0,0, - 114,5,0,0,0,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,37,1,0,0,202,4,0,0,115,38,0, - 0,0,8,0,4,2,2,2,10,1,2,9,10,1,2,12, - 10,1,2,21,10,1,2,14,12,1,2,31,12,1,2,23, - 12,1,2,12,14,1,255,128,114,37,1,0,0,99,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,64,0,0,0,115,90,0,0,0,101,0,90,1,100, - 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, - 4,100,5,132,0,90,5,101,6,90,7,100,6,100,7,132, - 0,90,8,100,8,100,9,132,0,90,9,100,19,100,11,100, - 12,132,1,90,10,100,13,100,14,132,0,90,11,101,12,100, - 15,100,16,132,0,131,1,90,13,100,17,100,18,132,0,90, - 14,100,10,83,0,41,20,218,10,70,105,108,101,70,105,110, - 100,101,114,122,172,70,105,108,101,45,98,97,115,101,100,32, - 102,105,110,100,101,114,46,10,10,32,32,32,32,73,110,116, - 101,114,97,99,116,105,111,110,115,32,119,105,116,104,32,116, - 104,101,32,102,105,108,101,32,115,121,115,116,101,109,32,97, - 114,101,32,99,97,99,104,101,100,32,102,111,114,32,112,101, - 114,102,111,114,109,97,110,99,101,44,32,98,101,105,110,103, - 10,32,32,32,32,114,101,102,114,101,115,104,101,100,32,119, - 104,101,110,32,116,104,101,32,100,105,114,101,99,116,111,114, - 121,32,116,104,101,32,102,105,110,100,101,114,32,105,115,32, - 104,97,110,100,108,105,110,103,32,104,97,115,32,98,101,101, - 110,32,109,111,100,105,102,105,101,100,46,10,10,32,32,32, - 32,99,2,0,0,0,0,0,0,0,0,0,0,0,5,0, - 0,0,6,0,0,0,7,0,0,0,115,84,0,0,0,103, - 0,125,3,124,2,68,0,93,32,92,2,137,0,125,4,124, - 3,160,0,135,0,102,1,100,1,100,2,132,8,124,4,68, - 0,131,1,161,1,1,0,113,8,124,3,124,0,95,1,124, - 1,112,54,100,3,124,0,95,2,100,4,124,0,95,3,116, - 4,131,0,124,0,95,5,116,4,131,0,124,0,95,6,100, - 5,83,0,41,6,122,154,73,110,105,116,105,97,108,105,122, - 101,32,119,105,116,104,32,116,104,101,32,112,97,116,104,32, - 116,111,32,115,101,97,114,99,104,32,111,110,32,97,110,100, - 32,97,32,118,97,114,105,97,98,108,101,32,110,117,109,98, - 101,114,32,111,102,10,32,32,32,32,32,32,32,32,50,45, - 116,117,112,108,101,115,32,99,111,110,116,97,105,110,105,110, - 103,32,116,104,101,32,108,111,97,100,101,114,32,97,110,100, - 32,116,104,101,32,102,105,108,101,32,115,117,102,102,105,120, - 101,115,32,116,104,101,32,108,111,97,100,101,114,10,32,32, - 32,32,32,32,32,32,114,101,99,111,103,110,105,122,101,115, - 46,99,1,0,0,0,0,0,0,0,0,0,0,0,2,0, - 0,0,3,0,0,0,51,0,0,0,115,22,0,0,0,124, - 0,93,14,125,1,124,1,136,0,102,2,86,0,1,0,113, - 2,100,0,83,0,114,109,0,0,0,114,5,0,0,0,114, - 7,1,0,0,169,1,114,140,0,0,0,114,5,0,0,0, - 114,8,0,0,0,114,10,1,0,0,108,5,0,0,115,6, - 0,0,0,18,0,4,128,255,128,122,38,70,105,108,101,70, - 105,110,100,101,114,46,95,95,105,110,105,116,95,95,46,60, - 108,111,99,97,108,115,62,46,60,103,101,110,101,120,112,114, - 62,114,71,0,0,0,114,104,0,0,0,78,41,7,114,167, - 0,0,0,218,8,95,108,111,97,100,101,114,115,114,44,0, - 0,0,218,11,95,112,97,116,104,95,109,116,105,109,101,218, - 3,115,101,116,218,11,95,112,97,116,104,95,99,97,99,104, - 101,218,19,95,114,101,108,97,120,101,100,95,112,97,116,104, - 95,99,97,99,104,101,41,5,114,118,0,0,0,114,44,0, - 0,0,218,14,108,111,97,100,101,114,95,100,101,116,97,105, - 108,115,90,7,108,111,97,100,101,114,115,114,189,0,0,0, - 114,5,0,0,0,114,55,1,0,0,114,8,0,0,0,114, - 209,0,0,0,102,5,0,0,115,20,0,0,0,4,4,12, - 1,26,1,6,1,10,2,6,1,8,1,8,1,4,128,255, - 128,122,19,70,105,108,101,70,105,110,100,101,114,46,95,95, - 105,110,105,116,95,95,99,1,0,0,0,0,0,0,0,0, - 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, - 10,0,0,0,100,1,124,0,95,0,100,2,83,0,41,3, - 122,31,73,110,118,97,108,105,100,97,116,101,32,116,104,101, - 32,100,105,114,101,99,116,111,114,121,32,109,116,105,109,101, - 46,114,104,0,0,0,78,41,1,114,57,1,0,0,114,246, - 0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,114,38,1,0,0,116,5,0,0,115,6,0,0,0, - 6,2,4,128,255,128,122,28,70,105,108,101,70,105,110,100, - 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, - 99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,3,0,0,0,67,0,0,0,115,42,0, - 0,0,124,0,160,0,124,1,161,1,125,2,124,2,100,1, - 117,0,114,26,100,1,103,0,102,2,83,0,124,2,106,1, - 124,2,106,2,112,38,103,0,102,2,83,0,41,2,122,197, - 84,114,121,32,116,111,32,102,105,110,100,32,97,32,108,111, - 97,100,101,114,32,102,111,114,32,116,104,101,32,115,112,101, - 99,105,102,105,101,100,32,109,111,100,117,108,101,44,32,111, - 114,32,116,104,101,32,110,97,109,101,115,112,97,99,101,10, - 32,32,32,32,32,32,32,32,112,97,99,107,97,103,101,32, - 112,111,114,116,105,111,110,115,46,32,82,101,116,117,114,110, - 115,32,40,108,111,97,100,101,114,44,32,108,105,115,116,45, - 111,102,45,112,111,114,116,105,111,110,115,41,46,10,10,32, - 32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104, - 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, - 46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,99, - 40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32, - 32,32,32,32,32,78,41,3,114,203,0,0,0,114,140,0, - 0,0,114,178,0,0,0,41,3,114,118,0,0,0,114,139, - 0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,0, - 0,0,114,8,0,0,0,114,137,0,0,0,122,5,0,0, - 115,10,0,0,0,10,7,8,1,8,1,16,1,255,128,122, - 22,70,105,108,101,70,105,110,100,101,114,46,102,105,110,100, - 95,108,111,97,100,101,114,99,6,0,0,0,0,0,0,0, - 0,0,0,0,7,0,0,0,6,0,0,0,67,0,0,0, - 115,26,0,0,0,124,1,124,2,124,3,131,2,125,6,116, - 0,124,2,124,3,124,6,124,4,100,1,141,4,83,0,41, - 2,78,114,177,0,0,0,41,1,114,190,0,0,0,41,7, - 114,118,0,0,0,114,188,0,0,0,114,139,0,0,0,114, - 44,0,0,0,90,4,115,109,115,108,114,202,0,0,0,114, - 140,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,114,51,1,0,0,134,5,0,0,115,10,0,0, - 0,10,1,8,1,2,1,6,255,255,128,122,20,70,105,108, - 101,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,78,99,3,0,0,0,0,0,0,0,0,0,0,0,14, - 0,0,0,8,0,0,0,67,0,0,0,115,92,1,0,0, - 100,1,125,3,124,1,160,0,100,2,161,1,100,3,25,0, - 125,4,122,24,116,1,124,0,106,2,112,34,116,3,160,4, - 161,0,131,1,106,5,125,5,87,0,110,22,4,0,116,6, - 121,64,1,0,1,0,1,0,100,4,125,5,89,0,110,2, - 48,0,124,5,124,0,106,7,107,3,114,90,124,0,160,8, - 161,0,1,0,124,5,124,0,95,7,116,9,131,0,114,112, - 124,0,106,10,125,6,124,4,160,11,161,0,125,7,110,10, - 124,0,106,12,125,6,124,4,125,7,124,7,124,6,118,0, - 114,214,116,13,124,0,106,2,124,4,131,2,125,8,124,0, - 106,14,68,0,93,56,92,2,125,9,125,10,100,5,124,9, - 23,0,125,11,116,13,124,8,124,11,131,2,125,12,116,15, - 124,12,131,1,114,148,124,0,160,16,124,10,124,1,124,12, - 124,8,103,1,124,2,161,5,2,0,1,0,83,0,116,17, - 124,8,131,1,125,3,124,0,106,14,68,0,93,80,92,2, - 125,9,125,10,116,13,124,0,106,2,124,4,124,9,23,0, - 131,2,125,12,116,18,106,19,100,6,124,12,100,3,100,7, - 141,3,1,0,124,7,124,9,23,0,124,6,118,0,114,220, - 116,15,124,12,131,1,114,220,124,0,160,16,124,10,124,1, - 124,12,100,8,124,2,161,5,2,0,1,0,83,0,124,3, - 144,1,114,88,116,18,160,19,100,9,124,8,161,2,1,0, - 116,18,160,20,124,1,100,8,161,2,125,13,124,8,103,1, - 124,13,95,21,124,13,83,0,100,8,83,0,41,10,122,111, - 84,114,121,32,116,111,32,102,105,110,100,32,97,32,115,112, - 101,99,32,102,111,114,32,116,104,101,32,115,112,101,99,105, - 102,105,101,100,32,109,111,100,117,108,101,46,10,10,32,32, - 32,32,32,32,32,32,82,101,116,117,114,110,115,32,116,104, - 101,32,109,97,116,99,104,105,110,103,32,115,112,101,99,44, - 32,111,114,32,78,111,110,101,32,105,102,32,110,111,116,32, - 102,111,117,110,100,46,10,32,32,32,32,32,32,32,32,70, - 114,71,0,0,0,114,28,0,0,0,114,104,0,0,0,114, - 209,0,0,0,122,9,116,114,121,105,110,103,32,123,125,41, - 1,90,9,118,101,114,98,111,115,105,116,121,78,122,25,112, - 111,115,115,105,98,108,101,32,110,97,109,101,115,112,97,99, - 101,32,102,111,114,32,123,125,41,22,114,41,0,0,0,114, - 49,0,0,0,114,44,0,0,0,114,4,0,0,0,114,55, - 0,0,0,114,0,1,0,0,114,50,0,0,0,114,57,1, - 0,0,218,11,95,102,105,108,108,95,99,97,99,104,101,114, - 9,0,0,0,114,60,1,0,0,114,105,0,0,0,114,59, - 1,0,0,114,38,0,0,0,114,56,1,0,0,114,54,0, - 0,0,114,51,1,0,0,114,56,0,0,0,114,134,0,0, - 0,114,149,0,0,0,114,183,0,0,0,114,178,0,0,0, - 41,14,114,118,0,0,0,114,139,0,0,0,114,202,0,0, - 0,90,12,105,115,95,110,97,109,101,115,112,97,99,101,90, - 11,116,97,105,108,95,109,111,100,117,108,101,114,169,0,0, - 0,90,5,99,97,99,104,101,90,12,99,97,99,104,101,95, - 109,111,100,117,108,101,90,9,98,97,115,101,95,112,97,116, - 104,114,8,1,0,0,114,188,0,0,0,90,13,105,110,105, - 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, - 95,112,97,116,104,114,187,0,0,0,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,203,0,0,0,139,5, - 0,0,115,74,0,0,0,4,5,14,1,2,1,24,1,12, - 1,10,1,10,1,8,1,6,1,6,2,6,1,10,1,6, - 2,4,1,8,2,12,1,14,1,8,1,10,1,8,1,24, - 1,8,4,14,2,16,1,16,1,12,1,8,1,10,1,4, - 1,8,255,6,2,12,1,12,1,8,1,4,1,4,1,255, - 128,122,20,70,105,108,101,70,105,110,100,101,114,46,102,105, - 110,100,95,115,112,101,99,99,1,0,0,0,0,0,0,0, - 0,0,0,0,9,0,0,0,10,0,0,0,67,0,0,0, - 115,188,0,0,0,124,0,106,0,125,1,122,22,116,1,160, - 2,124,1,112,22,116,1,160,3,161,0,161,1,125,2,87, - 0,110,28,4,0,116,4,116,5,116,6,102,3,121,56,1, - 0,1,0,1,0,103,0,125,2,89,0,110,2,48,0,116, - 7,106,8,160,9,100,1,161,1,115,82,116,10,124,2,131, - 1,124,0,95,11,110,74,116,10,131,0,125,3,124,2,68, - 0,93,56,125,4,124,4,160,12,100,2,161,1,92,3,125, - 5,125,6,125,7,124,6,114,134,100,3,160,13,124,5,124, - 7,160,14,161,0,161,2,125,8,110,4,124,5,125,8,124, - 3,160,15,124,8,161,1,1,0,113,92,124,3,124,0,95, - 11,116,7,106,8,160,9,116,16,161,1,114,184,100,4,100, - 5,132,0,124,2,68,0,131,1,124,0,95,17,100,6,83, - 0,41,7,122,68,70,105,108,108,32,116,104,101,32,99,97, - 99,104,101,32,111,102,32,112,111,116,101,110,116,105,97,108, - 32,109,111,100,117,108,101,115,32,97,110,100,32,112,97,99, - 107,97,103,101,115,32,102,111,114,32,116,104,105,115,32,100, - 105,114,101,99,116,111,114,121,46,114,0,0,0,0,114,71, - 0,0,0,114,61,0,0,0,99,1,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,4,0,0,0,83,0,0, - 0,115,20,0,0,0,104,0,124,0,93,12,125,1,124,1, - 160,0,161,0,146,2,113,4,83,0,114,5,0,0,0,41, - 1,114,105,0,0,0,41,2,114,32,0,0,0,90,2,102, - 110,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0, - 218,9,60,115,101,116,99,111,109,112,62,216,5,0,0,115, - 4,0,0,0,20,0,255,128,122,41,70,105,108,101,70,105, - 110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101, - 46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111, - 109,112,62,78,41,18,114,44,0,0,0,114,4,0,0,0, - 90,7,108,105,115,116,100,105,114,114,55,0,0,0,114,45, - 1,0,0,218,15,80,101,114,109,105,115,115,105,111,110,69, - 114,114,111,114,218,18,78,111,116,65,68,105,114,101,99,116, - 111,114,121,69,114,114,111,114,114,1,0,0,0,114,10,0, - 0,0,114,11,0,0,0,114,58,1,0,0,114,59,1,0, - 0,114,100,0,0,0,114,62,0,0,0,114,105,0,0,0, - 218,3,97,100,100,114,12,0,0,0,114,60,1,0,0,41, - 9,114,118,0,0,0,114,44,0,0,0,90,8,99,111,110, - 116,101,110,116,115,90,21,108,111,119,101,114,95,115,117,102, - 102,105,120,95,99,111,110,116,101,110,116,115,114,33,1,0, - 0,114,116,0,0,0,114,20,1,0,0,114,8,1,0,0, - 90,8,110,101,119,95,110,97,109,101,114,5,0,0,0,114, - 5,0,0,0,114,8,0,0,0,114,62,1,0,0,187,5, - 0,0,115,38,0,0,0,6,2,2,1,22,1,18,1,10, - 3,12,3,12,1,6,7,8,1,16,1,4,1,18,1,4, - 2,12,1,6,1,12,1,16,1,4,128,255,128,122,22,70, - 105,108,101,70,105,110,100,101,114,46,95,102,105,108,108,95, - 99,97,99,104,101,99,1,0,0,0,0,0,0,0,0,0, - 0,0,3,0,0,0,3,0,0,0,7,0,0,0,115,18, - 0,0,0,135,0,135,1,102,2,100,1,100,2,132,8,125, - 2,124,2,83,0,41,3,97,20,1,0,0,65,32,99,108, - 97,115,115,32,109,101,116,104,111,100,32,119,104,105,99,104, - 32,114,101,116,117,114,110,115,32,97,32,99,108,111,115,117, - 114,101,32,116,111,32,117,115,101,32,111,110,32,115,121,115, - 46,112,97,116,104,95,104,111,111,107,10,32,32,32,32,32, - 32,32,32,119,104,105,99,104,32,119,105,108,108,32,114,101, - 116,117,114,110,32,97,110,32,105,110,115,116,97,110,99,101, - 32,117,115,105,110,103,32,116,104,101,32,115,112,101,99,105, - 102,105,101,100,32,108,111,97,100,101,114,115,32,97,110,100, - 32,116,104,101,32,112,97,116,104,10,32,32,32,32,32,32, - 32,32,99,97,108,108,101,100,32,111,110,32,116,104,101,32, - 99,108,111,115,117,114,101,46,10,10,32,32,32,32,32,32, - 32,32,73,102,32,116,104,101,32,112,97,116,104,32,99,97, - 108,108,101,100,32,111,110,32,116,104,101,32,99,108,111,115, - 117,114,101,32,105,115,32,110,111,116,32,97,32,100,105,114, - 101,99,116,111,114,121,44,32,73,109,112,111,114,116,69,114, - 114,111,114,32,105,115,10,32,32,32,32,32,32,32,32,114, - 97,105,115,101,100,46,10,10,32,32,32,32,32,32,32,32, + 100,46,32,32,85,115,101,32,101,120,101,99,95,109,111,100, + 117,108,101,40,41,32,105,110,115,116,101,97,100,46,10,10, + 32,32,32,32,32,32,32,32,122,38,110,97,109,101,115,112, + 97,99,101,32,109,111,100,117,108,101,32,108,111,97,100,101, + 100,32,119,105,116,104,32,112,97,116,104,32,123,33,114,125, + 78,41,4,114,139,0,0,0,114,153,0,0,0,114,20,1, + 0,0,114,225,0,0,0,114,226,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,114,227,0,0,0, + 225,4,0,0,115,10,0,0,0,6,7,4,1,4,255,12, + 3,255,128,122,28,95,78,97,109,101,115,112,97,99,101,76, + 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, + 101,78,41,12,114,130,0,0,0,114,129,0,0,0,114,131, + 0,0,0,114,216,0,0,0,114,213,0,0,0,114,41,1, + 0,0,114,186,0,0,0,114,236,0,0,0,114,220,0,0, + 0,114,219,0,0,0,114,224,0,0,0,114,227,0,0,0, + 114,7,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,114,40,1,0,0,197,4,0,0,115,22,0, + 0,0,8,0,8,1,2,3,10,1,8,8,8,3,8,3, + 8,3,8,3,12,3,255,128,114,40,1,0,0,99,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,64,0,0,0,115,118,0,0,0,101,0,90,1,100, + 0,90,2,100,1,90,3,101,4,100,2,100,3,132,0,131, + 1,90,5,101,4,100,4,100,5,132,0,131,1,90,6,101, + 7,100,6,100,7,132,0,131,1,90,8,101,7,100,8,100, + 9,132,0,131,1,90,9,101,7,100,19,100,11,100,12,132, + 1,131,1,90,10,101,7,100,20,100,13,100,14,132,1,131, + 1,90,11,101,7,100,21,100,15,100,16,132,1,131,1,90, + 12,101,4,100,17,100,18,132,0,131,1,90,13,100,10,83, + 0,41,22,218,10,80,97,116,104,70,105,110,100,101,114,122, + 62,77,101,116,97,32,112,97,116,104,32,102,105,110,100,101, + 114,32,102,111,114,32,115,121,115,46,112,97,116,104,32,97, + 110,100,32,112,97,99,107,97,103,101,32,95,95,112,97,116, + 104,95,95,32,97,116,116,114,105,98,117,116,101,115,46,99, + 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 4,0,0,0,67,0,0,0,115,64,0,0,0,116,0,116, + 1,106,2,160,3,161,0,131,1,68,0,93,44,92,2,125, + 0,125,1,124,1,100,1,117,0,114,40,116,1,106,2,124, + 0,61,0,113,14,116,4,124,1,100,2,131,2,114,14,124, + 1,160,5,161,0,1,0,113,14,100,1,83,0,41,3,122, + 125,67,97,108,108,32,116,104,101,32,105,110,118,97,108,105, + 100,97,116,101,95,99,97,99,104,101,115,40,41,32,109,101, + 116,104,111,100,32,111,110,32,97,108,108,32,112,97,116,104, + 32,101,110,116,114,121,32,102,105,110,100,101,114,115,10,32, + 32,32,32,32,32,32,32,115,116,111,114,101,100,32,105,110, + 32,115,121,115,46,112,97,116,104,95,105,109,112,111,114,116, + 101,114,95,99,97,99,104,101,115,32,40,119,104,101,114,101, + 32,105,109,112,108,101,109,101,110,116,101,100,41,46,78,218, + 17,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, + 101,115,41,6,218,4,108,105,115,116,114,15,0,0,0,218, + 19,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99, + 97,99,104,101,218,5,105,116,101,109,115,114,133,0,0,0, + 114,43,1,0,0,41,2,114,121,0,0,0,218,6,102,105, + 110,100,101,114,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,114,43,1,0,0,244,4,0,0,115,14,0,0, + 0,22,4,8,1,10,1,10,1,10,1,4,252,255,128,122, + 28,80,97,116,104,70,105,110,100,101,114,46,105,110,118,97, + 108,105,100,97,116,101,95,99,97,99,104,101,115,99,1,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,9,0, + 0,0,67,0,0,0,115,76,0,0,0,116,0,106,1,100, + 1,117,1,114,28,116,0,106,1,115,28,116,2,160,3,100, + 2,116,4,161,2,1,0,116,0,106,1,68,0,93,36,125, + 1,122,14,124,1,124,0,131,1,87,0,2,0,1,0,83, + 0,4,0,116,5,121,70,1,0,1,0,1,0,89,0,113, + 34,48,0,100,1,83,0,41,3,122,46,83,101,97,114,99, + 104,32,115,121,115,46,112,97,116,104,95,104,111,111,107,115, + 32,102,111,114,32,97,32,102,105,110,100,101,114,32,102,111, + 114,32,39,112,97,116,104,39,46,78,122,23,115,121,115,46, + 112,97,116,104,95,104,111,111,107,115,32,105,115,32,101,109, + 112,116,121,41,6,114,15,0,0,0,218,10,112,97,116,104, + 95,104,111,111,107,115,114,81,0,0,0,114,82,0,0,0, + 114,142,0,0,0,114,122,0,0,0,41,2,114,52,0,0, + 0,90,4,104,111,111,107,114,7,0,0,0,114,7,0,0, + 0,114,8,0,0,0,218,11,95,112,97,116,104,95,104,111, + 111,107,115,254,4,0,0,115,18,0,0,0,16,3,12,1, + 10,1,2,1,14,1,12,1,6,1,4,2,255,128,122,22, + 80,97,116,104,70,105,110,100,101,114,46,95,112,97,116,104, + 95,104,111,111,107,115,99,2,0,0,0,0,0,0,0,0, + 0,0,0,3,0,0,0,8,0,0,0,67,0,0,0,115, + 100,0,0,0,124,1,100,1,107,2,114,42,122,12,116,0, + 160,1,161,0,125,1,87,0,110,20,4,0,116,2,121,40, + 1,0,1,0,1,0,89,0,100,2,83,0,48,0,122,16, + 116,3,106,4,124,1,25,0,125,2,87,0,124,2,83,0, + 4,0,116,5,121,98,1,0,1,0,1,0,124,0,160,6, + 124,1,161,1,125,2,124,2,116,3,106,4,124,1,60,0, + 89,0,124,2,83,0,48,0,41,3,122,210,71,101,116,32, + 116,104,101,32,102,105,110,100,101,114,32,102,111,114,32,116, + 104,101,32,112,97,116,104,32,101,110,116,114,121,32,102,114, + 111,109,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,32, + 32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,104, + 32,101,110,116,114,121,32,105,115,32,110,111,116,32,105,110, + 32,116,104,101,32,99,97,99,104,101,44,32,102,105,110,100, + 32,116,104,101,32,97,112,112,114,111,112,114,105,97,116,101, + 32,102,105,110,100,101,114,10,32,32,32,32,32,32,32,32, + 97,110,100,32,99,97,99,104,101,32,105,116,46,32,73,102, + 32,110,111,32,102,105,110,100,101,114,32,105,115,32,97,118, + 97,105,108,97,98,108,101,44,32,115,116,111,114,101,32,78, + 111,110,101,46,10,10,32,32,32,32,32,32,32,32,114,10, + 0,0,0,78,41,7,114,18,0,0,0,114,63,0,0,0, + 218,17,70,105,108,101,78,111,116,70,111,117,110,100,69,114, + 114,111,114,114,15,0,0,0,114,45,1,0,0,218,8,75, + 101,121,69,114,114,111,114,114,49,1,0,0,41,3,114,202, + 0,0,0,114,52,0,0,0,114,47,1,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,218,20,95,112, + 97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,99, + 104,101,11,5,0,0,115,28,0,0,0,8,8,2,1,12, + 1,12,1,8,3,2,1,12,1,4,4,12,253,10,1,12, + 1,4,1,2,255,255,128,122,31,80,97,116,104,70,105,110, + 100,101,114,46,95,112,97,116,104,95,105,109,112,111,114,116, + 101,114,95,99,97,99,104,101,99,3,0,0,0,0,0,0, + 0,0,0,0,0,6,0,0,0,4,0,0,0,67,0,0, + 0,115,82,0,0,0,116,0,124,2,100,1,131,2,114,26, + 124,2,160,1,124,1,161,1,92,2,125,3,125,4,110,14, + 124,2,160,2,124,1,161,1,125,3,103,0,125,4,124,3, + 100,0,117,1,114,60,116,3,160,4,124,1,124,3,161,2, + 83,0,116,3,160,5,124,1,100,0,161,2,125,5,124,4, + 124,5,95,6,124,5,83,0,41,2,78,114,141,0,0,0, + 41,7,114,133,0,0,0,114,141,0,0,0,114,210,0,0, + 0,114,139,0,0,0,114,205,0,0,0,114,187,0,0,0, + 114,182,0,0,0,41,6,114,202,0,0,0,114,143,0,0, + 0,114,47,1,0,0,114,144,0,0,0,114,145,0,0,0, + 114,191,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, + 116,95,115,112,101,99,33,5,0,0,115,20,0,0,0,10, + 4,16,1,10,2,4,1,8,1,12,1,12,1,6,1,4, + 1,255,128,122,27,80,97,116,104,70,105,110,100,101,114,46, + 95,108,101,103,97,99,121,95,103,101,116,95,115,112,101,99, + 78,99,4,0,0,0,0,0,0,0,0,0,0,0,9,0, + 0,0,5,0,0,0,67,0,0,0,115,166,0,0,0,103, + 0,125,4,124,2,68,0,93,134,125,5,116,0,124,5,116, + 1,116,2,102,2,131,2,115,28,113,8,124,0,160,3,124, + 5,161,1,125,6,124,6,100,1,117,1,114,8,116,4,124, + 6,100,2,131,2,114,70,124,6,160,5,124,1,124,3,161, + 2,125,7,110,12,124,0,160,6,124,1,124,6,161,2,125, + 7,124,7,100,1,117,0,114,92,113,8,124,7,106,7,100, + 1,117,1,114,110,124,7,2,0,1,0,83,0,124,7,106, + 8,125,8,124,8,100,1,117,0,114,132,116,9,100,3,131, + 1,130,1,124,4,160,10,124,8,161,1,1,0,113,8,116, + 11,160,12,124,1,100,1,161,2,125,7,124,4,124,7,95, + 8,124,7,83,0,41,4,122,63,70,105,110,100,32,116,104, + 101,32,108,111,97,100,101,114,32,111,114,32,110,97,109,101, + 115,112,97,99,101,95,112,97,116,104,32,102,111,114,32,116, + 104,105,115,32,109,111,100,117,108,101,47,112,97,99,107,97, + 103,101,32,110,97,109,101,46,78,114,207,0,0,0,122,19, + 115,112,101,99,32,109,105,115,115,105,110,103,32,108,111,97, + 100,101,114,41,13,114,165,0,0,0,114,90,0,0,0,218, + 5,98,121,116,101,115,114,52,1,0,0,114,133,0,0,0, + 114,207,0,0,0,114,53,1,0,0,114,144,0,0,0,114, + 182,0,0,0,114,122,0,0,0,114,171,0,0,0,114,139, + 0,0,0,114,187,0,0,0,41,9,114,202,0,0,0,114, + 143,0,0,0,114,52,0,0,0,114,206,0,0,0,218,14, + 110,97,109,101,115,112,97,99,101,95,112,97,116,104,90,5, + 101,110,116,114,121,114,47,1,0,0,114,191,0,0,0,114, + 145,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8, + 0,0,0,218,9,95,103,101,116,95,115,112,101,99,48,5, + 0,0,115,42,0,0,0,4,5,8,1,14,1,2,1,10, + 1,8,1,10,1,14,1,12,2,8,1,2,1,10,1,8, + 1,6,1,8,1,8,1,12,5,12,2,6,1,4,1,255, + 128,122,20,80,97,116,104,70,105,110,100,101,114,46,95,103, + 101,116,95,115,112,101,99,99,4,0,0,0,0,0,0,0, + 0,0,0,0,6,0,0,0,5,0,0,0,67,0,0,0, + 115,94,0,0,0,124,2,100,1,117,0,114,14,116,0,106, + 1,125,2,124,0,160,2,124,1,124,2,124,3,161,3,125, + 4,124,4,100,1,117,0,114,40,100,1,83,0,124,4,106, + 3,100,1,117,0,114,90,124,4,106,4,125,5,124,5,114, + 86,100,1,124,4,95,5,116,6,124,1,124,5,124,0,106, + 2,131,3,124,4,95,4,124,4,83,0,100,1,83,0,124, + 4,83,0,41,2,122,141,84,114,121,32,116,111,32,102,105, + 110,100,32,97,32,115,112,101,99,32,102,111,114,32,39,102, + 117,108,108,110,97,109,101,39,32,111,110,32,115,121,115,46, + 112,97,116,104,32,111,114,32,39,112,97,116,104,39,46,10, + 10,32,32,32,32,32,32,32,32,84,104,101,32,115,101,97, + 114,99,104,32,105,115,32,98,97,115,101,100,32,111,110,32, + 115,121,115,46,112,97,116,104,95,104,111,111,107,115,32,97, + 110,100,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,10,32,32,32,32, + 32,32,32,32,78,41,7,114,15,0,0,0,114,52,0,0, + 0,114,56,1,0,0,114,144,0,0,0,114,182,0,0,0, + 114,185,0,0,0,114,18,1,0,0,41,6,114,202,0,0, + 0,114,143,0,0,0,114,52,0,0,0,114,206,0,0,0, + 114,191,0,0,0,114,55,1,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,207,0,0,0,80,5, + 0,0,115,28,0,0,0,8,6,6,1,14,1,8,1,4, + 1,10,1,6,1,4,1,6,3,16,1,4,1,4,2,4, + 2,255,128,122,20,80,97,116,104,70,105,110,100,101,114,46, + 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, + 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, + 0,0,115,30,0,0,0,124,0,160,0,124,1,124,2,161, + 2,125,3,124,3,100,1,117,0,114,24,100,1,83,0,124, + 3,106,1,83,0,41,2,122,170,102,105,110,100,32,116,104, + 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, + 112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,98, + 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, + 95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,32, + 32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,32, + 32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,85,115,101,32,102,105,110,100,95,115,112,101,99,40,41, + 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, + 32,32,32,78,114,208,0,0,0,114,209,0,0,0,114,7, + 0,0,0,114,7,0,0,0,114,8,0,0,0,114,210,0, + 0,0,104,5,0,0,115,10,0,0,0,12,8,8,1,4, + 1,6,1,255,128,122,22,80,97,116,104,70,105,110,100,101, + 114,46,102,105,110,100,95,109,111,100,117,108,101,99,0,0, + 0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0, + 0,0,79,0,0,0,115,28,0,0,0,100,1,100,2,108, + 0,109,1,125,2,1,0,124,2,106,2,124,0,105,0,124, + 1,164,1,142,1,83,0,41,4,97,32,1,0,0,10,32, + 32,32,32,32,32,32,32,70,105,110,100,32,100,105,115,116, + 114,105,98,117,116,105,111,110,115,46,10,10,32,32,32,32, + 32,32,32,32,82,101,116,117,114,110,32,97,110,32,105,116, + 101,114,97,98,108,101,32,111,102,32,97,108,108,32,68,105, + 115,116,114,105,98,117,116,105,111,110,32,105,110,115,116,97, + 110,99,101,115,32,99,97,112,97,98,108,101,32,111,102,10, + 32,32,32,32,32,32,32,32,108,111,97,100,105,110,103,32, + 116,104,101,32,109,101,116,97,100,97,116,97,32,102,111,114, + 32,112,97,99,107,97,103,101,115,32,109,97,116,99,104,105, + 110,103,32,96,96,99,111,110,116,101,120,116,46,110,97,109, + 101,96,96,10,32,32,32,32,32,32,32,32,40,111,114,32, + 97,108,108,32,110,97,109,101,115,32,105,102,32,96,96,78, + 111,110,101,96,96,32,105,110,100,105,99,97,116,101,100,41, + 32,97,108,111,110,103,32,116,104,101,32,112,97,116,104,115, + 32,105,110,32,116,104,101,32,108,105,115,116,10,32,32,32, + 32,32,32,32,32,111,102,32,100,105,114,101,99,116,111,114, + 105,101,115,32,96,96,99,111,110,116,101,120,116,46,112,97, + 116,104,96,96,46,10,32,32,32,32,32,32,32,32,114,0, + 0,0,0,41,1,218,18,77,101,116,97,100,97,116,97,80, + 97,116,104,70,105,110,100,101,114,78,41,3,90,18,105,109, + 112,111,114,116,108,105,98,46,109,101,116,97,100,97,116,97, + 114,57,1,0,0,218,18,102,105,110,100,95,100,105,115,116, + 114,105,98,117,116,105,111,110,115,41,3,114,124,0,0,0, + 114,125,0,0,0,114,57,1,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,58,1,0,0,117,5, + 0,0,115,6,0,0,0,12,10,16,1,255,128,122,29,80, + 97,116,104,70,105,110,100,101,114,46,102,105,110,100,95,100, + 105,115,116,114,105,98,117,116,105,111,110,115,41,1,78,41, + 2,78,78,41,1,78,41,14,114,130,0,0,0,114,129,0, + 0,0,114,131,0,0,0,114,132,0,0,0,114,213,0,0, + 0,114,43,1,0,0,114,49,1,0,0,114,214,0,0,0, + 114,52,1,0,0,114,53,1,0,0,114,56,1,0,0,114, + 207,0,0,0,114,210,0,0,0,114,58,1,0,0,114,7, + 0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0, + 0,0,114,42,1,0,0,240,4,0,0,115,38,0,0,0, + 8,0,4,2,2,2,10,1,2,9,10,1,2,12,10,1, + 2,21,10,1,2,14,12,1,2,31,12,1,2,23,12,1, + 2,12,14,1,255,128,114,42,1,0,0,99,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 64,0,0,0,115,90,0,0,0,101,0,90,1,100,0,90, + 2,100,1,90,3,100,2,100,3,132,0,90,4,100,4,100, + 5,132,0,90,5,101,6,90,7,100,6,100,7,132,0,90, + 8,100,8,100,9,132,0,90,9,100,19,100,11,100,12,132, + 1,90,10,100,13,100,14,132,0,90,11,101,12,100,15,100, + 16,132,0,131,1,90,13,100,17,100,18,132,0,90,14,100, + 10,83,0,41,20,218,10,70,105,108,101,70,105,110,100,101, + 114,122,172,70,105,108,101,45,98,97,115,101,100,32,102,105, + 110,100,101,114,46,10,10,32,32,32,32,73,110,116,101,114, + 97,99,116,105,111,110,115,32,119,105,116,104,32,116,104,101, + 32,102,105,108,101,32,115,121,115,116,101,109,32,97,114,101, + 32,99,97,99,104,101,100,32,102,111,114,32,112,101,114,102, + 111,114,109,97,110,99,101,44,32,98,101,105,110,103,10,32, + 32,32,32,114,101,102,114,101,115,104,101,100,32,119,104,101, + 110,32,116,104,101,32,100,105,114,101,99,116,111,114,121,32, + 116,104,101,32,102,105,110,100,101,114,32,105,115,32,104,97, + 110,100,108,105,110,103,32,104,97,115,32,98,101,101,110,32, + 109,111,100,105,102,105,101,100,46,10,10,32,32,32,32,99, + 2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, + 6,0,0,0,7,0,0,0,115,84,0,0,0,103,0,125, + 3,124,2,68,0,93,32,92,2,137,0,125,4,124,3,160, + 0,135,0,102,1,100,1,100,2,132,8,124,4,68,0,131, + 1,161,1,1,0,113,8,124,3,124,0,95,1,124,1,112, + 54,100,3,124,0,95,2,100,4,124,0,95,3,116,4,131, + 0,124,0,95,5,116,4,131,0,124,0,95,6,100,5,83, + 0,41,6,122,154,73,110,105,116,105,97,108,105,122,101,32, + 119,105,116,104,32,116,104,101,32,112,97,116,104,32,116,111, + 32,115,101,97,114,99,104,32,111,110,32,97,110,100,32,97, + 32,118,97,114,105,97,98,108,101,32,110,117,109,98,101,114, + 32,111,102,10,32,32,32,32,32,32,32,32,50,45,116,117, + 112,108,101,115,32,99,111,110,116,97,105,110,105,110,103,32, + 116,104,101,32,108,111,97,100,101,114,32,97,110,100,32,116, + 104,101,32,102,105,108,101,32,115,117,102,102,105,120,101,115, + 32,116,104,101,32,108,111,97,100,101,114,10,32,32,32,32, + 32,32,32,32,114,101,99,111,103,110,105,122,101,115,46,99, + 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,51,0,0,0,115,22,0,0,0,124,0,93, + 14,125,1,124,1,136,0,102,2,86,0,1,0,113,2,100, + 0,83,0,114,114,0,0,0,114,7,0,0,0,114,14,1, + 0,0,169,1,114,144,0,0,0,114,7,0,0,0,114,8, + 0,0,0,114,9,0,0,0,146,5,0,0,115,4,0,0, + 0,22,0,255,128,122,38,70,105,108,101,70,105,110,100,101, + 114,46,95,95,105,110,105,116,95,95,46,60,108,111,99,97, + 108,115,62,46,60,103,101,110,101,120,112,114,62,114,79,0, + 0,0,114,109,0,0,0,78,41,7,114,171,0,0,0,218, + 8,95,108,111,97,100,101,114,115,114,52,0,0,0,218,11, + 95,112,97,116,104,95,109,116,105,109,101,218,3,115,101,116, + 218,11,95,112,97,116,104,95,99,97,99,104,101,218,19,95, + 114,101,108,97,120,101,100,95,112,97,116,104,95,99,97,99, + 104,101,41,5,114,123,0,0,0,114,52,0,0,0,218,14, + 108,111,97,100,101,114,95,100,101,116,97,105,108,115,90,7, + 108,111,97,100,101,114,115,114,193,0,0,0,114,7,0,0, + 0,114,60,1,0,0,114,8,0,0,0,114,216,0,0,0, + 140,5,0,0,115,18,0,0,0,4,4,12,1,26,1,6, + 1,10,2,6,1,8,1,12,1,255,128,122,19,70,105,108, + 101,70,105,110,100,101,114,46,95,95,105,110,105,116,95,95, 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, - 0,4,0,0,0,19,0,0,0,115,36,0,0,0,116,0, - 124,0,131,1,115,20,116,1,100,1,124,0,100,2,141,2, - 130,1,136,0,124,0,103,1,136,1,162,1,82,0,142,0, - 83,0,41,3,122,45,80,97,116,104,32,104,111,111,107,32, - 102,111,114,32,105,109,112,111,114,116,108,105,98,46,109,97, - 99,104,105,110,101,114,121,46,70,105,108,101,70,105,110,100, - 101,114,46,122,30,111,110,108,121,32,100,105,114,101,99,116, - 111,114,105,101,115,32,97,114,101,32,115,117,112,112,111,114, - 116,101,100,114,48,0,0,0,41,2,114,56,0,0,0,114, - 117,0,0,0,114,48,0,0,0,169,2,114,193,0,0,0, - 114,61,1,0,0,114,5,0,0,0,114,8,0,0,0,218, - 24,112,97,116,104,95,104,111,111,107,95,102,111,114,95,70, - 105,108,101,70,105,110,100,101,114,228,5,0,0,115,8,0, - 0,0,8,2,12,1,16,1,255,128,122,54,70,105,108,101, - 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, - 46,60,108,111,99,97,108,115,62,46,112,97,116,104,95,104, - 111,111,107,95,102,111,114,95,70,105,108,101,70,105,110,100, - 101,114,114,5,0,0,0,41,3,114,193,0,0,0,114,61, - 1,0,0,114,68,1,0,0,114,5,0,0,0,114,67,1, - 0,0,114,8,0,0,0,218,9,112,97,116,104,95,104,111, - 111,107,218,5,0,0,115,6,0,0,0,14,10,4,6,255, - 128,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, - 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, - 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0, - 115,12,0,0,0,100,1,160,0,124,0,106,1,161,1,83, - 0,41,2,78,122,16,70,105,108,101,70,105,110,100,101,114, - 40,123,33,114,125,41,41,2,114,62,0,0,0,114,44,0, - 0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,0, - 0,114,8,0,0,0,114,31,1,0,0,236,5,0,0,115, - 4,0,0,0,12,1,255,128,122,19,70,105,108,101,70,105, - 110,100,101,114,46,95,95,114,101,112,114,95,95,41,1,78, - 41,15,114,125,0,0,0,114,124,0,0,0,114,126,0,0, - 0,114,127,0,0,0,114,209,0,0,0,114,38,1,0,0, - 114,143,0,0,0,114,206,0,0,0,114,137,0,0,0,114, - 51,1,0,0,114,203,0,0,0,114,62,1,0,0,114,207, - 0,0,0,114,69,1,0,0,114,31,1,0,0,114,5,0, - 0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0, - 0,114,54,1,0,0,93,5,0,0,115,26,0,0,0,8, - 0,4,2,8,7,8,14,4,4,8,2,8,12,10,5,8, - 48,2,31,10,1,12,17,255,128,114,54,1,0,0,99,4, - 0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,8, - 0,0,0,67,0,0,0,115,144,0,0,0,124,0,160,0, - 100,1,161,1,125,4,124,0,160,0,100,2,161,1,125,5, - 124,4,115,66,124,5,114,36,124,5,106,1,125,4,110,30, - 124,2,124,3,107,2,114,56,116,2,124,1,124,2,131,2, - 125,4,110,10,116,3,124,1,124,2,131,2,125,4,124,5, - 115,84,116,4,124,1,124,2,124,4,100,3,141,3,125,5, - 122,36,124,5,124,0,100,2,60,0,124,4,124,0,100,1, - 60,0,124,2,124,0,100,4,60,0,124,3,124,0,100,5, - 60,0,87,0,110,18,4,0,116,5,121,138,1,0,1,0, - 1,0,89,0,110,2,48,0,100,0,83,0,41,6,78,218, - 10,95,95,108,111,97,100,101,114,95,95,218,8,95,95,115, - 112,101,99,95,95,114,55,1,0,0,90,8,95,95,102,105, - 108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,95, - 41,6,218,3,103,101,116,114,140,0,0,0,114,5,1,0, - 0,114,255,0,0,0,114,190,0,0,0,218,9,69,120,99, - 101,112,116,105,111,110,41,6,90,2,110,115,114,116,0,0, - 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, - 116,104,110,97,109,101,114,140,0,0,0,114,187,0,0,0, - 114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218, - 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,242, - 5,0,0,115,38,0,0,0,10,2,10,1,4,1,4,1, - 8,1,8,1,12,1,10,2,4,1,14,1,2,1,8,1, - 8,1,8,1,12,1,12,1,6,2,4,128,255,128,114,74, - 1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, - 3,0,0,0,3,0,0,0,67,0,0,0,115,38,0,0, - 0,116,0,116,1,160,2,161,0,102,2,125,0,116,3,116, - 4,102,2,125,1,116,5,116,6,102,2,125,2,124,0,124, - 1,124,2,103,3,83,0,41,1,122,95,82,101,116,117,114, - 110,115,32,97,32,108,105,115,116,32,111,102,32,102,105,108, - 101,45,98,97,115,101,100,32,109,111,100,117,108,101,32,108, - 111,97,100,101,114,115,46,10,10,32,32,32,32,69,97,99, - 104,32,105,116,101,109,32,105,115,32,97,32,116,117,112,108, - 101,32,40,108,111,97,100,101,114,44,32,115,117,102,102,105, - 120,101,115,41,46,10,32,32,32,32,41,7,114,252,0,0, - 0,114,163,0,0,0,218,18,101,120,116,101,110,115,105,111, - 110,95,115,117,102,102,105,120,101,115,114,255,0,0,0,114, - 101,0,0,0,114,5,1,0,0,114,88,0,0,0,41,3, - 90,10,101,120,116,101,110,115,105,111,110,115,90,6,115,111, - 117,114,99,101,90,8,98,121,116,101,99,111,100,101,114,5, - 0,0,0,114,5,0,0,0,114,8,0,0,0,114,184,0, - 0,0,9,6,0,0,115,10,0,0,0,12,5,8,1,8, - 1,10,1,255,128,114,184,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,10,0,0,0,9,0,0,0,67, - 0,0,0,115,130,1,0,0,124,0,97,0,116,0,106,1, - 97,1,116,0,106,2,97,2,116,1,106,3,116,4,25,0, - 125,1,100,1,100,2,103,1,102,2,100,3,100,4,100,2, - 103,2,102,2,102,2,125,2,124,2,68,0,93,106,92,2, - 125,3,125,4,116,5,100,5,100,6,132,0,124,4,68,0, - 131,1,131,1,115,82,74,0,130,1,124,4,100,7,25,0, - 125,5,124,3,116,1,106,3,118,0,114,116,116,1,106,3, - 124,3,25,0,125,6,1,0,113,168,113,52,122,20,116,0, - 160,6,124,3,161,1,125,6,87,0,1,0,113,168,87,0, - 113,52,4,0,116,7,121,158,1,0,1,0,1,0,89,0, - 113,52,89,0,113,52,48,0,116,7,100,8,131,1,130,1, - 116,8,124,1,100,9,124,6,131,3,1,0,116,8,124,1, - 100,10,124,5,131,3,1,0,116,8,124,1,100,11,100,12, - 160,9,124,4,161,1,131,3,1,0,116,8,124,1,100,13, - 100,14,100,15,132,0,124,4,68,0,131,1,131,3,1,0, - 103,0,100,16,162,1,125,7,124,3,100,3,107,2,144,1, - 114,4,124,7,160,10,100,17,161,1,1,0,124,7,68,0, - 93,52,125,8,124,8,116,1,106,3,118,1,144,1,114,36, - 116,0,160,6,124,8,161,1,125,9,110,10,116,1,106,3, - 124,8,25,0,125,9,116,8,124,1,124,8,124,9,131,3, - 1,0,144,1,113,8,116,8,124,1,100,18,116,11,131,0, - 131,3,1,0,116,12,160,13,116,2,160,14,161,0,161,1, - 1,0,124,3,100,3,107,2,144,1,114,126,116,15,160,10, - 100,19,161,1,1,0,100,20,116,12,118,0,144,1,114,126, - 100,21,116,16,95,17,100,22,83,0,41,23,122,205,83,101, - 116,117,112,32,116,104,101,32,112,97,116,104,45,98,97,115, - 101,100,32,105,109,112,111,114,116,101,114,115,32,102,111,114, - 32,105,109,112,111,114,116,108,105,98,32,98,121,32,105,109, - 112,111,114,116,105,110,103,32,110,101,101,100,101,100,10,32, - 32,32,32,98,117,105,108,116,45,105,110,32,109,111,100,117, - 108,101,115,32,97,110,100,32,105,110,106,101,99,116,105,110, - 103,32,116,104,101,109,32,105,110,116,111,32,116,104,101,32, - 103,108,111,98,97,108,32,110,97,109,101,115,112,97,99,101, - 46,10,10,32,32,32,32,79,116,104,101,114,32,99,111,109, - 112,111,110,101,110,116,115,32,97,114,101,32,101,120,116,114, - 97,99,116,101,100,32,102,114,111,109,32,116,104,101,32,99, - 111,114,101,32,98,111,111,116,115,116,114,97,112,32,109,111, - 100,117,108,101,46,10,10,32,32,32,32,90,5,112,111,115, - 105,120,250,1,47,90,2,110,116,250,1,92,99,1,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0, - 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, - 116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2, - 100,1,83,0,41,2,114,39,0,0,0,78,41,1,114,23, - 0,0,0,41,2,114,32,0,0,0,114,94,0,0,0,114, - 5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,10, - 1,0,0,38,6,0,0,115,6,0,0,0,22,0,4,128, - 255,128,122,25,95,115,101,116,117,112,46,60,108,111,99,97, - 108,115,62,46,60,103,101,110,101,120,112,114,62,114,73,0, - 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101, - 113,117,105,114,101,115,32,112,111,115,105,120,32,111,114,32, - 110,116,114,4,0,0,0,114,35,0,0,0,114,31,0,0, - 0,114,40,0,0,0,114,58,0,0,0,99,1,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0, - 83,0,0,0,115,22,0,0,0,104,0,124,0,93,14,125, - 1,100,0,124,1,155,0,157,2,146,2,113,4,83,0,41, - 1,114,74,0,0,0,114,5,0,0,0,41,2,114,32,0, - 0,0,218,1,115,114,5,0,0,0,114,5,0,0,0,114, - 8,0,0,0,114,63,1,0,0,55,6,0,0,115,4,0, - 0,0,22,0,255,128,122,25,95,115,101,116,117,112,46,60, - 108,111,99,97,108,115,62,46,60,115,101,116,99,111,109,112, - 62,41,3,114,64,0,0,0,114,75,0,0,0,114,160,0, - 0,0,114,192,0,0,0,114,9,0,0,0,122,4,46,112, - 121,119,122,6,95,100,46,112,121,100,84,78,41,18,114,134, - 0,0,0,114,1,0,0,0,114,163,0,0,0,114,22,1, - 0,0,114,125,0,0,0,218,3,97,108,108,90,18,95,98, - 117,105,108,116,105,110,95,102,114,111,109,95,110,97,109,101, - 114,117,0,0,0,114,129,0,0,0,114,36,0,0,0,114, - 186,0,0,0,114,14,0,0,0,114,12,1,0,0,114,167, - 0,0,0,114,75,1,0,0,114,101,0,0,0,114,191,0, - 0,0,114,195,0,0,0,41,10,218,17,95,98,111,111,116, - 115,116,114,97,112,95,109,111,100,117,108,101,90,11,115,101, - 108,102,95,109,111,100,117,108,101,90,10,111,115,95,100,101, - 116,97,105,108,115,90,10,98,117,105,108,116,105,110,95,111, - 115,114,31,0,0,0,114,35,0,0,0,90,9,111,115,95, - 109,111,100,117,108,101,90,13,98,117,105,108,116,105,110,95, - 110,97,109,101,115,90,12,98,117,105,108,116,105,110,95,110, - 97,109,101,90,14,98,117,105,108,116,105,110,95,109,111,100, - 117,108,101,114,5,0,0,0,114,5,0,0,0,114,8,0, - 0,0,218,6,95,115,101,116,117,112,20,6,0,0,115,74, - 0,0,0,4,8,6,1,6,1,10,2,22,3,12,1,22, - 2,8,1,10,1,10,1,6,1,2,2,10,1,10,1,12, - 1,10,1,8,2,12,2,12,1,18,1,22,1,8,3,10, - 1,10,1,8,1,12,1,12,1,10,2,16,1,14,3,14, - 1,10,1,10,1,10,1,6,1,4,128,255,128,114,81,1, - 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,4,0,0,0,67,0,0,0,115,50,0,0,0, - 116,0,124,0,131,1,1,0,116,1,131,0,125,1,116,2, - 106,3,160,4,116,5,106,6,124,1,142,0,103,1,161,1, - 1,0,116,2,106,7,160,8,116,9,161,1,1,0,100,1, - 83,0,41,2,122,41,73,110,115,116,97,108,108,32,116,104, - 101,32,112,97,116,104,45,98,97,115,101,100,32,105,109,112, - 111,114,116,32,99,111,109,112,111,110,101,110,116,115,46,78, - 41,10,114,81,1,0,0,114,184,0,0,0,114,1,0,0, - 0,114,43,1,0,0,114,167,0,0,0,114,54,1,0,0, - 114,69,1,0,0,218,9,109,101,116,97,95,112,97,116,104, - 114,186,0,0,0,114,37,1,0,0,41,2,114,80,1,0, - 0,90,17,115,117,112,112,111,114,116,101,100,95,108,111,97, - 100,101,114,115,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,8,95,105,110,115,116,97,108,108,77,6,0, - 0,115,12,0,0,0,8,2,6,1,20,1,12,1,4,128, - 255,128,114,83,1,0,0,41,1,114,60,0,0,0,41,1, - 78,41,3,78,78,78,41,2,114,73,0,0,0,114,73,0, - 0,0,41,1,84,41,1,78,41,1,78,41,63,114,127,0, - 0,0,114,13,0,0,0,90,37,95,67,65,83,69,95,73, - 78,83,69,78,83,73,84,73,86,69,95,80,76,65,84,70, - 79,82,77,83,95,66,89,84,69,83,95,75,69,89,114,12, - 0,0,0,114,14,0,0,0,114,21,0,0,0,114,27,0, - 0,0,114,29,0,0,0,114,38,0,0,0,114,47,0,0, - 0,114,49,0,0,0,114,53,0,0,0,114,54,0,0,0, - 114,56,0,0,0,114,59,0,0,0,114,69,0,0,0,218, - 4,116,121,112,101,218,8,95,95,99,111,100,101,95,95,114, - 162,0,0,0,114,19,0,0,0,114,148,0,0,0,114,18, - 0,0,0,114,24,0,0,0,114,236,0,0,0,114,91,0, - 0,0,114,87,0,0,0,114,101,0,0,0,114,88,0,0, - 0,90,23,68,69,66,85,71,95,66,89,84,69,67,79,68, - 69,95,83,85,70,70,73,88,69,83,90,27,79,80,84,73, - 77,73,90,69,68,95,66,89,84,69,67,79,68,69,95,83, - 85,70,70,73,88,69,83,114,97,0,0,0,114,102,0,0, - 0,114,108,0,0,0,114,112,0,0,0,114,114,0,0,0, - 114,136,0,0,0,114,143,0,0,0,114,152,0,0,0,114, - 156,0,0,0,114,158,0,0,0,114,165,0,0,0,114,170, - 0,0,0,114,171,0,0,0,114,176,0,0,0,218,6,111, - 98,106,101,99,116,114,185,0,0,0,114,190,0,0,0,114, - 191,0,0,0,114,208,0,0,0,114,221,0,0,0,114,239, - 0,0,0,114,255,0,0,0,114,5,1,0,0,114,12,1, - 0,0,114,252,0,0,0,114,13,1,0,0,114,35,1,0, - 0,114,37,1,0,0,114,54,1,0,0,114,74,1,0,0, - 114,184,0,0,0,114,81,1,0,0,114,83,1,0,0,114, - 5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8, - 0,0,0,218,8,60,109,111,100,117,108,101,62,1,0,0, - 0,115,132,0,0,0,4,0,4,22,4,1,2,1,2,1, - 4,255,8,4,8,17,8,5,8,5,8,6,8,6,8,12, - 8,10,8,9,8,5,8,7,10,9,10,22,0,127,16,23, - 12,1,4,2,4,1,6,2,6,2,8,2,16,2,8,71, - 8,40,8,19,8,12,8,12,8,28,8,17,8,33,8,28, - 10,24,10,13,10,10,8,11,6,14,4,3,2,1,12,255, - 14,68,14,64,16,29,0,127,14,17,18,50,18,45,4,26, - 18,3,14,53,14,63,14,42,0,127,14,20,0,127,10,22, - 8,23,8,11,8,57,4,128,255,128, + 0,2,0,0,0,67,0,0,0,115,10,0,0,0,100,1, + 124,0,95,0,100,2,83,0,41,3,122,31,73,110,118,97, + 108,105,100,97,116,101,32,116,104,101,32,100,105,114,101,99, + 116,111,114,121,32,109,116,105,109,101,46,114,109,0,0,0, + 78,41,1,114,62,1,0,0,114,253,0,0,0,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,43,1,0, + 0,154,5,0,0,115,4,0,0,0,10,2,255,128,122,28, + 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, + 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, + 0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0, + 0,67,0,0,0,115,42,0,0,0,124,0,160,0,124,1, + 161,1,125,2,124,2,100,1,117,0,114,26,100,1,103,0, + 102,2,83,0,124,2,106,1,124,2,106,2,112,38,103,0, + 102,2,83,0,41,2,122,197,84,114,121,32,116,111,32,102, + 105,110,100,32,97,32,108,111,97,100,101,114,32,102,111,114, + 32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109, + 111,100,117,108,101,44,32,111,114,32,116,104,101,32,110,97, + 109,101,115,112,97,99,101,10,32,32,32,32,32,32,32,32, + 112,97,99,107,97,103,101,32,112,111,114,116,105,111,110,115, + 46,32,82,101,116,117,114,110,115,32,40,108,111,97,100,101, + 114,44,32,108,105,115,116,45,111,102,45,112,111,114,116,105, + 111,110,115,41,46,10,10,32,32,32,32,32,32,32,32,84, + 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101, + 112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,102, + 105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,101, + 97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,3, + 114,207,0,0,0,114,144,0,0,0,114,182,0,0,0,41, + 3,114,123,0,0,0,114,143,0,0,0,114,191,0,0,0, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,114, + 141,0,0,0,160,5,0,0,115,10,0,0,0,10,7,8, + 1,8,1,16,1,255,128,122,22,70,105,108,101,70,105,110, + 100,101,114,46,102,105,110,100,95,108,111,97,100,101,114,99, + 6,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0, + 6,0,0,0,67,0,0,0,115,26,0,0,0,124,1,124, + 2,124,3,131,2,125,6,116,0,124,2,124,3,124,6,124, + 4,100,1,141,4,83,0,41,2,78,114,181,0,0,0,41, + 1,114,194,0,0,0,41,7,114,123,0,0,0,114,192,0, + 0,0,114,143,0,0,0,114,52,0,0,0,90,4,115,109, + 115,108,114,206,0,0,0,114,144,0,0,0,114,7,0,0, + 0,114,7,0,0,0,114,8,0,0,0,114,56,1,0,0, + 172,5,0,0,115,10,0,0,0,10,1,8,1,2,1,6, + 255,255,128,122,20,70,105,108,101,70,105,110,100,101,114,46, + 95,103,101,116,95,115,112,101,99,78,99,3,0,0,0,0, + 0,0,0,0,0,0,0,14,0,0,0,8,0,0,0,67, + 0,0,0,115,92,1,0,0,100,1,125,3,124,1,160,0, + 100,2,161,1,100,3,25,0,125,4,122,24,116,1,124,0, + 106,2,112,34,116,3,160,4,161,0,131,1,106,5,125,5, + 87,0,110,22,4,0,116,6,121,64,1,0,1,0,1,0, + 100,4,125,5,89,0,110,2,48,0,124,5,124,0,106,7, + 107,3,114,90,124,0,160,8,161,0,1,0,124,5,124,0, + 95,7,116,9,131,0,114,112,124,0,106,10,125,6,124,4, + 160,11,161,0,125,7,110,10,124,0,106,12,125,6,124,4, + 125,7,124,7,124,6,118,0,114,214,116,13,124,0,106,2, + 124,4,131,2,125,8,124,0,106,14,68,0,93,56,92,2, + 125,9,125,10,100,5,124,9,23,0,125,11,116,13,124,8, + 124,11,131,2,125,12,116,15,124,12,131,1,114,148,124,0, + 160,16,124,10,124,1,124,12,124,8,103,1,124,2,161,5, + 2,0,1,0,83,0,116,17,124,8,131,1,125,3,124,0, + 106,14,68,0,93,80,92,2,125,9,125,10,116,13,124,0, + 106,2,124,4,124,9,23,0,131,2,125,12,116,18,106,19, + 100,6,124,12,100,3,100,7,141,3,1,0,124,7,124,9, + 23,0,124,6,118,0,114,220,116,15,124,12,131,1,114,220, + 124,0,160,16,124,10,124,1,124,12,100,8,124,2,161,5, + 2,0,1,0,83,0,124,3,144,1,114,88,116,18,160,19, + 100,9,124,8,161,2,1,0,116,18,160,20,124,1,100,8, + 161,2,125,13,124,8,103,1,124,13,95,21,124,13,83,0, + 100,8,83,0,41,10,122,111,84,114,121,32,116,111,32,102, + 105,110,100,32,97,32,115,112,101,99,32,102,111,114,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,100, + 117,108,101,46,10,10,32,32,32,32,32,32,32,32,82,101, + 116,117,114,110,115,32,116,104,101,32,109,97,116,99,104,105, + 110,103,32,115,112,101,99,44,32,111,114,32,78,111,110,101, + 32,105,102,32,110,111,116,32,102,111,117,110,100,46,10,32, + 32,32,32,32,32,32,32,70,114,79,0,0,0,114,39,0, + 0,0,114,109,0,0,0,114,216,0,0,0,122,9,116,114, + 121,105,110,103,32,123,125,41,1,90,9,118,101,114,98,111, + 115,105,116,121,78,122,25,112,111,115,115,105,98,108,101,32, + 110,97,109,101,115,112,97,99,101,32,102,111,114,32,123,125, + 41,22,114,49,0,0,0,114,57,0,0,0,114,52,0,0, + 0,114,18,0,0,0,114,63,0,0,0,114,7,1,0,0, + 114,58,0,0,0,114,62,1,0,0,218,11,95,102,105,108, + 108,95,99,97,99,104,101,114,21,0,0,0,114,65,1,0, + 0,114,110,0,0,0,114,64,1,0,0,114,48,0,0,0, + 114,61,1,0,0,114,62,0,0,0,114,56,1,0,0,114, + 64,0,0,0,114,139,0,0,0,114,153,0,0,0,114,187, + 0,0,0,114,182,0,0,0,41,14,114,123,0,0,0,114, + 143,0,0,0,114,206,0,0,0,90,12,105,115,95,110,97, + 109,101,115,112,97,99,101,90,11,116,97,105,108,95,109,111, + 100,117,108,101,114,173,0,0,0,90,5,99,97,99,104,101, + 90,12,99,97,99,104,101,95,109,111,100,117,108,101,90,9, + 98,97,115,101,95,112,97,116,104,114,15,1,0,0,114,192, + 0,0,0,90,13,105,110,105,116,95,102,105,108,101,110,97, + 109,101,90,9,102,117,108,108,95,112,97,116,104,114,191,0, + 0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,114,207,0,0,0,177,5,0,0,115,74,0,0,0,4, + 5,14,1,2,1,24,1,12,1,10,1,10,1,8,1,6, + 1,6,2,6,1,10,1,6,2,4,1,8,2,12,1,14, + 1,8,1,10,1,8,1,24,1,8,4,14,2,16,1,16, + 1,12,1,8,1,10,1,4,1,8,255,6,2,12,1,12, + 1,8,1,4,1,4,1,255,128,122,20,70,105,108,101,70, + 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,99, + 1,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0, + 10,0,0,0,67,0,0,0,115,192,0,0,0,124,0,106, + 0,125,1,122,22,116,1,160,2,124,1,112,22,116,1,160, + 3,161,0,161,1,125,2,87,0,110,28,4,0,116,4,116, + 5,116,6,102,3,121,56,1,0,1,0,1,0,103,0,125, + 2,89,0,110,2,48,0,116,7,106,8,160,9,100,1,161, + 1,115,82,116,10,124,2,131,1,124,0,95,11,110,74,116, + 10,131,0,125,3,124,2,68,0,93,56,125,4,124,4,160, + 12,100,2,161,1,92,3,125,5,125,6,125,7,124,6,114, + 134,100,3,160,13,124,5,124,7,160,14,161,0,161,2,125, + 8,110,4,124,5,125,8,124,3,160,15,124,8,161,1,1, + 0,113,92,124,3,124,0,95,11,116,7,106,8,160,9,116, + 16,161,1,114,188,100,4,100,5,132,0,124,2,68,0,131, + 1,124,0,95,17,100,6,83,0,100,6,83,0,41,7,122, + 68,70,105,108,108,32,116,104,101,32,99,97,99,104,101,32, + 111,102,32,112,111,116,101,110,116,105,97,108,32,109,111,100, + 117,108,101,115,32,97,110,100,32,112,97,99,107,97,103,101, + 115,32,102,111,114,32,116,104,105,115,32,100,105,114,101,99, + 116,111,114,121,46,114,14,0,0,0,114,79,0,0,0,114, + 69,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,4,0,0,0,83,0,0,0,115,20,0, + 0,0,104,0,124,0,93,12,125,1,124,1,160,0,161,0, + 146,2,113,4,83,0,114,7,0,0,0,41,1,114,110,0, + 0,0,41,2,114,5,0,0,0,90,2,102,110,114,7,0, + 0,0,114,7,0,0,0,114,8,0,0,0,114,13,0,0, + 0,254,5,0,0,115,4,0,0,0,20,0,255,128,122,41, + 70,105,108,101,70,105,110,100,101,114,46,95,102,105,108,108, + 95,99,97,99,104,101,46,60,108,111,99,97,108,115,62,46, + 60,115,101,116,99,111,109,112,62,78,41,18,114,52,0,0, + 0,114,18,0,0,0,90,7,108,105,115,116,100,105,114,114, + 63,0,0,0,114,50,1,0,0,218,15,80,101,114,109,105, + 115,115,105,111,110,69,114,114,111,114,218,18,78,111,116,65, + 68,105,114,101,99,116,111,114,121,69,114,114,111,114,114,15, + 0,0,0,114,22,0,0,0,114,23,0,0,0,114,63,1, + 0,0,114,64,1,0,0,114,105,0,0,0,114,70,0,0, + 0,114,110,0,0,0,218,3,97,100,100,114,24,0,0,0, + 114,65,1,0,0,41,9,114,123,0,0,0,114,52,0,0, + 0,90,8,99,111,110,116,101,110,116,115,90,21,108,111,119, + 101,114,95,115,117,102,102,105,120,95,99,111,110,116,101,110, + 116,115,114,38,1,0,0,114,121,0,0,0,114,25,1,0, + 0,114,15,1,0,0,90,8,110,101,119,95,110,97,109,101, + 114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,114, + 67,1,0,0,225,5,0,0,115,38,0,0,0,6,2,2, + 1,22,1,18,1,10,3,12,3,12,1,6,7,8,1,16, + 1,4,1,18,1,4,2,12,1,6,1,12,1,20,1,4, + 255,255,128,122,22,70,105,108,101,70,105,110,100,101,114,46, + 95,102,105,108,108,95,99,97,99,104,101,99,1,0,0,0, + 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, + 7,0,0,0,115,18,0,0,0,135,0,135,1,102,2,100, + 1,100,2,132,8,125,2,124,2,83,0,41,4,97,20,1, + 0,0,65,32,99,108,97,115,115,32,109,101,116,104,111,100, + 32,119,104,105,99,104,32,114,101,116,117,114,110,115,32,97, + 32,99,108,111,115,117,114,101,32,116,111,32,117,115,101,32, + 111,110,32,115,121,115,46,112,97,116,104,95,104,111,111,107, + 10,32,32,32,32,32,32,32,32,119,104,105,99,104,32,119, + 105,108,108,32,114,101,116,117,114,110,32,97,110,32,105,110, + 115,116,97,110,99,101,32,117,115,105,110,103,32,116,104,101, + 32,115,112,101,99,105,102,105,101,100,32,108,111,97,100,101, + 114,115,32,97,110,100,32,116,104,101,32,112,97,116,104,10, + 32,32,32,32,32,32,32,32,99,97,108,108,101,100,32,111, + 110,32,116,104,101,32,99,108,111,115,117,114,101,46,10,10, + 32,32,32,32,32,32,32,32,73,102,32,116,104,101,32,112, + 97,116,104,32,99,97,108,108,101,100,32,111,110,32,116,104, + 101,32,99,108,111,115,117,114,101,32,105,115,32,110,111,116, + 32,97,32,100,105,114,101,99,116,111,114,121,44,32,73,109, + 112,111,114,116,69,114,114,111,114,32,105,115,10,32,32,32, + 32,32,32,32,32,114,97,105,115,101,100,46,10,10,32,32, + 32,32,32,32,32,32,99,1,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,4,0,0,0,19,0,0,0,115, + 36,0,0,0,116,0,124,0,131,1,115,20,116,1,100,1, + 124,0,100,2,141,2,130,1,136,0,124,0,103,1,136,1, + 162,1,82,0,142,0,83,0,41,4,122,45,80,97,116,104, + 32,104,111,111,107,32,102,111,114,32,105,109,112,111,114,116, + 108,105,98,46,109,97,99,104,105,110,101,114,121,46,70,105, + 108,101,70,105,110,100,101,114,46,122,30,111,110,108,121,32, + 100,105,114,101,99,116,111,114,105,101,115,32,97,114,101,32, + 115,117,112,112,111,114,116,101,100,114,56,0,0,0,78,41, + 2,114,64,0,0,0,114,122,0,0,0,114,56,0,0,0, + 169,2,114,202,0,0,0,114,66,1,0,0,114,7,0,0, + 0,114,8,0,0,0,218,24,112,97,116,104,95,104,111,111, + 107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,114, + 10,6,0,0,115,8,0,0,0,8,2,12,1,16,1,255, + 128,122,54,70,105,108,101,70,105,110,100,101,114,46,112,97, + 116,104,95,104,111,111,107,46,60,108,111,99,97,108,115,62, + 46,112,97,116,104,95,104,111,111,107,95,102,111,114,95,70, + 105,108,101,70,105,110,100,101,114,78,114,7,0,0,0,41, + 3,114,202,0,0,0,114,66,1,0,0,114,72,1,0,0, + 114,7,0,0,0,114,71,1,0,0,114,8,0,0,0,218, + 9,112,97,116,104,95,104,111,111,107,0,6,0,0,115,6, + 0,0,0,14,10,4,6,255,128,122,20,70,105,108,101,70, + 105,110,100,101,114,46,112,97,116,104,95,104,111,111,107,99, + 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, + 3,0,0,0,67,0,0,0,115,12,0,0,0,100,1,160, + 0,124,0,106,1,161,1,83,0,41,2,78,122,16,70,105, + 108,101,70,105,110,100,101,114,40,123,33,114,125,41,41,2, + 114,70,0,0,0,114,52,0,0,0,114,253,0,0,0,114, + 7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,36, + 1,0,0,18,6,0,0,115,4,0,0,0,12,1,255,128, + 122,19,70,105,108,101,70,105,110,100,101,114,46,95,95,114, + 101,112,114,95,95,41,1,78,41,15,114,130,0,0,0,114, + 129,0,0,0,114,131,0,0,0,114,132,0,0,0,114,216, + 0,0,0,114,43,1,0,0,114,147,0,0,0,114,210,0, + 0,0,114,141,0,0,0,114,56,1,0,0,114,207,0,0, + 0,114,67,1,0,0,114,214,0,0,0,114,73,1,0,0, + 114,36,1,0,0,114,7,0,0,0,114,7,0,0,0,114, + 7,0,0,0,114,8,0,0,0,114,59,1,0,0,131,5, + 0,0,115,26,0,0,0,8,0,4,2,8,7,8,14,4, + 4,8,2,8,12,10,5,8,48,2,31,10,1,12,17,255, + 128,114,59,1,0,0,99,4,0,0,0,0,0,0,0,0, + 0,0,0,6,0,0,0,8,0,0,0,67,0,0,0,115, + 144,0,0,0,124,0,160,0,100,1,161,1,125,4,124,0, + 160,0,100,2,161,1,125,5,124,4,115,66,124,5,114,36, + 124,5,106,1,125,4,110,30,124,2,124,3,107,2,114,56, + 116,2,124,1,124,2,131,2,125,4,110,10,116,3,124,1, + 124,2,131,2,125,4,124,5,115,84,116,4,124,1,124,2, + 124,4,100,3,141,3,125,5,122,38,124,5,124,0,100,2, + 60,0,124,4,124,0,100,1,60,0,124,2,124,0,100,4, + 60,0,124,3,124,0,100,5,60,0,87,0,100,0,83,0, + 4,0,116,5,121,142,1,0,1,0,1,0,89,0,100,0, + 83,0,48,0,41,6,78,218,10,95,95,108,111,97,100,101, + 114,95,95,218,8,95,95,115,112,101,99,95,95,114,60,1, + 0,0,90,8,95,95,102,105,108,101,95,95,90,10,95,95, + 99,97,99,104,101,100,95,95,41,6,218,3,103,101,116,114, + 144,0,0,0,114,12,1,0,0,114,6,1,0,0,114,194, + 0,0,0,218,9,69,120,99,101,112,116,105,111,110,41,6, + 90,2,110,115,114,121,0,0,0,90,8,112,97,116,104,110, + 97,109,101,90,9,99,112,97,116,104,110,97,109,101,114,144, + 0,0,0,114,191,0,0,0,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,218,14,95,102,105,120,95,117,112, + 95,109,111,100,117,108,101,24,6,0,0,115,36,0,0,0, + 10,2,10,1,4,1,4,1,8,1,8,1,12,1,10,2, + 4,1,14,1,2,1,8,1,8,1,8,1,14,1,12,1, + 8,2,255,128,114,78,1,0,0,99,0,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,38,0,0,0,116,0,116,1,160,2,161,0,102, + 2,125,0,116,3,116,4,102,2,125,1,116,5,116,6,102, + 2,125,2,124,0,124,1,124,2,103,3,83,0,41,2,122, + 95,82,101,116,117,114,110,115,32,97,32,108,105,115,116,32, + 111,102,32,102,105,108,101,45,98,97,115,101,100,32,109,111, + 100,117,108,101,32,108,111,97,100,101,114,115,46,10,10,32, + 32,32,32,69,97,99,104,32,105,116,101,109,32,105,115,32, + 97,32,116,117,112,108,101,32,40,108,111,97,100,101,114,44, + 32,115,117,102,102,105,120,101,115,41,46,10,32,32,32,32, + 78,41,7,114,3,1,0,0,114,167,0,0,0,218,18,101, + 120,116,101,110,115,105,111,110,95,115,117,102,102,105,120,101, + 115,114,6,1,0,0,114,106,0,0,0,114,12,1,0,0, + 114,94,0,0,0,41,3,90,10,101,120,116,101,110,115,105, + 111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,116, + 101,99,111,100,101,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,114,188,0,0,0,47,6,0,0,115,10,0, + 0,0,12,5,8,1,8,1,10,1,255,128,114,188,0,0, + 0,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0, + 0,0,1,0,0,0,67,0,0,0,115,8,0,0,0,124, + 0,97,0,100,0,83,0,114,114,0,0,0,41,1,114,139, + 0,0,0,41,1,218,17,95,98,111,111,116,115,116,114,97, + 112,95,109,111,100,117,108,101,114,7,0,0,0,114,7,0, + 0,0,114,8,0,0,0,218,21,95,115,101,116,95,98,111, + 111,116,115,116,114,97,112,95,109,111,100,117,108,101,58,6, + 0,0,115,4,0,0,0,8,2,255,128,114,81,1,0,0, + 99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,4,0,0,0,67,0,0,0,115,50,0,0,0,116,0, + 124,0,131,1,1,0,116,1,131,0,125,1,116,2,106,3, + 160,4,116,5,106,6,124,1,142,0,103,1,161,1,1,0, + 116,2,106,7,160,8,116,9,161,1,1,0,100,1,83,0, + 41,2,122,41,73,110,115,116,97,108,108,32,116,104,101,32, + 112,97,116,104,45,98,97,115,101,100,32,105,109,112,111,114, + 116,32,99,111,109,112,111,110,101,110,116,115,46,78,41,10, + 114,81,1,0,0,114,188,0,0,0,114,15,0,0,0,114, + 48,1,0,0,114,171,0,0,0,114,59,1,0,0,114,73, + 1,0,0,218,9,109,101,116,97,95,112,97,116,104,114,190, + 0,0,0,114,42,1,0,0,41,2,114,80,1,0,0,90, + 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, + 114,115,114,7,0,0,0,114,7,0,0,0,114,8,0,0, + 0,218,8,95,105,110,115,116,97,108,108,63,6,0,0,115, + 10,0,0,0,8,2,6,1,20,1,16,1,255,128,114,83, + 1,0,0,41,1,114,68,0,0,0,41,1,78,41,3,78, + 78,78,41,2,114,0,0,0,0,114,0,0,0,0,41,1, + 84,41,1,78,41,1,78,41,83,114,132,0,0,0,114,139, + 0,0,0,114,167,0,0,0,114,72,0,0,0,114,15,0, + 0,0,114,81,0,0,0,114,164,0,0,0,114,22,0,0, + 0,114,211,0,0,0,90,2,110,116,114,18,0,0,0,114, + 196,0,0,0,90,5,112,111,115,105,120,114,42,0,0,0, + 218,3,97,108,108,114,45,0,0,0,114,46,0,0,0,114, + 66,0,0,0,114,25,0,0,0,90,37,95,67,65,83,69, + 95,73,78,83,69,78,83,73,84,73,86,69,95,80,76,65, + 84,70,79,82,77,83,95,66,89,84,69,83,95,75,69,89, + 114,24,0,0,0,114,26,0,0,0,114,21,0,0,0,114, + 33,0,0,0,114,38,0,0,0,114,40,0,0,0,114,48, + 0,0,0,114,55,0,0,0,114,57,0,0,0,114,61,0, + 0,0,114,62,0,0,0,114,64,0,0,0,114,67,0,0, + 0,114,77,0,0,0,218,4,116,121,112,101,218,8,95,95, + 99,111,100,101,95,95,114,166,0,0,0,114,31,0,0,0, + 114,152,0,0,0,114,30,0,0,0,114,35,0,0,0,114, + 243,0,0,0,114,97,0,0,0,114,93,0,0,0,114,106, + 0,0,0,114,190,0,0,0,114,79,1,0,0,114,212,0, + 0,0,114,94,0,0,0,90,23,68,69,66,85,71,95,66, + 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, + 90,27,79,80,84,73,77,73,90,69,68,95,66,89,84,69, + 67,79,68,69,95,83,85,70,70,73,88,69,83,114,102,0, + 0,0,114,107,0,0,0,114,113,0,0,0,114,117,0,0, + 0,114,119,0,0,0,114,140,0,0,0,114,147,0,0,0, + 114,156,0,0,0,114,160,0,0,0,114,162,0,0,0,114, + 169,0,0,0,114,174,0,0,0,114,175,0,0,0,114,180, + 0,0,0,218,6,111,98,106,101,99,116,114,189,0,0,0, + 114,194,0,0,0,114,195,0,0,0,114,215,0,0,0,114, + 228,0,0,0,114,246,0,0,0,114,6,1,0,0,114,12, + 1,0,0,114,3,1,0,0,114,18,1,0,0,114,40,1, + 0,0,114,42,1,0,0,114,59,1,0,0,114,78,1,0, + 0,114,188,0,0,0,114,81,1,0,0,114,83,1,0,0, + 114,7,0,0,0,114,7,0,0,0,114,7,0,0,0,114, + 8,0,0,0,218,8,60,109,111,100,117,108,101,62,1,0, + 0,0,115,172,0,0,0,4,0,4,22,8,3,8,1,8, + 1,8,1,8,1,10,3,4,1,8,1,10,1,8,2,4, + 3,10,1,6,2,22,2,8,1,10,1,14,1,4,4,4, + 1,2,1,2,1,4,255,8,4,6,16,8,3,8,5,8, + 5,8,6,8,6,8,12,8,10,8,9,8,5,8,7,10, + 9,10,22,0,127,16,24,12,1,4,2,4,1,6,2,6, + 1,10,1,8,2,6,2,8,2,16,2,8,71,8,40,8, + 19,8,12,8,12,8,31,8,17,8,33,8,28,10,24,10, + 13,10,10,8,11,6,14,4,3,2,1,12,255,14,68,14, + 64,16,30,0,127,14,17,18,50,18,45,18,25,14,53,14, + 63,14,43,0,127,14,20,0,127,10,22,8,23,8,11,12, + 5,255,128, }; diff --git a/Python/importlib_zipimport.h b/Python/importlib_zipimport.h index c90a5b79aa5631..cf6e8902ddcfd2 100644 --- a/Python/importlib_zipimport.h +++ b/Python/importlib_zipimport.h @@ -1,567 +1,622 @@ /* Auto-generated by Programs/_freeze_importlib.c */ const unsigned char _Py_M__zipimport[] = { 99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,4,0,0,0,64,0,0,0,115,68,1,0,0,100,0, + 0,4,0,0,0,64,0,0,0,115,80,1,0,0,100,0, 90,0,100,1,100,2,108,1,90,2,100,1,100,3,108,1, 109,3,90,3,109,4,90,4,1,0,100,1,100,2,108,5, 90,6,100,1,100,2,108,7,90,7,100,1,100,2,108,8, 90,8,100,1,100,2,108,9,90,9,100,1,100,2,108,10, - 90,10,100,1,100,2,108,11,90,11,100,4,100,5,103,2, - 90,12,101,2,106,13,90,13,101,2,106,14,100,6,100,2, - 133,2,25,0,90,15,71,0,100,7,100,4,132,0,100,4, - 101,16,131,3,90,17,105,0,90,18,101,19,101,10,131,1, - 90,20,100,8,90,21,100,9,90,22,100,10,90,23,71,0, - 100,11,100,5,132,0,100,5,131,2,90,24,101,13,100,12, - 23,0,100,13,100,13,102,3,101,13,100,14,23,0,100,15, - 100,13,102,3,100,16,100,17,102,4,90,25,100,18,100,19, - 132,0,90,26,100,20,100,21,132,0,90,27,100,22,100,23, - 132,0,90,28,100,24,100,25,132,0,90,29,100,26,90,30, - 100,15,97,31,100,27,100,28,132,0,90,32,100,29,100,30, - 132,0,90,33,100,31,100,32,132,0,90,34,100,33,100,34, - 132,0,90,35,101,19,101,35,106,36,131,1,90,37,100,35, - 100,36,132,0,90,38,100,37,100,38,132,0,90,39,100,39, - 100,40,132,0,90,40,100,41,100,42,132,0,90,41,100,43, - 100,44,132,0,90,42,100,45,100,46,132,0,90,43,100,2, - 83,0,41,47,97,80,2,0,0,122,105,112,105,109,112,111, - 114,116,32,112,114,111,118,105,100,101,115,32,115,117,112,112, - 111,114,116,32,102,111,114,32,105,109,112,111,114,116,105,110, - 103,32,80,121,116,104,111,110,32,109,111,100,117,108,101,115, - 32,102,114,111,109,32,90,105,112,32,97,114,99,104,105,118, - 101,115,46,10,10,84,104,105,115,32,109,111,100,117,108,101, - 32,101,120,112,111,114,116,115,32,116,104,114,101,101,32,111, - 98,106,101,99,116,115,58,10,45,32,122,105,112,105,109,112, - 111,114,116,101,114,58,32,97,32,99,108,97,115,115,59,32, - 105,116,115,32,99,111,110,115,116,114,117,99,116,111,114,32, - 116,97,107,101,115,32,97,32,112,97,116,104,32,116,111,32, - 97,32,90,105,112,32,97,114,99,104,105,118,101,46,10,45, - 32,90,105,112,73,109,112,111,114,116,69,114,114,111,114,58, - 32,101,120,99,101,112,116,105,111,110,32,114,97,105,115,101, - 100,32,98,121,32,122,105,112,105,109,112,111,114,116,101,114, - 32,111,98,106,101,99,116,115,46,32,73,116,39,115,32,97, - 10,32,32,115,117,98,99,108,97,115,115,32,111,102,32,73, - 109,112,111,114,116,69,114,114,111,114,44,32,115,111,32,105, - 116,32,99,97,110,32,98,101,32,99,97,117,103,104,116,32, - 97,115,32,73,109,112,111,114,116,69,114,114,111,114,44,32, - 116,111,111,46,10,45,32,95,122,105,112,95,100,105,114,101, - 99,116,111,114,121,95,99,97,99,104,101,58,32,97,32,100, - 105,99,116,44,32,109,97,112,112,105,110,103,32,97,114,99, - 104,105,118,101,32,112,97,116,104,115,32,116,111,32,122,105, - 112,32,100,105,114,101,99,116,111,114,121,10,32,32,105,110, - 102,111,32,100,105,99,116,115,44,32,97,115,32,117,115,101, - 100,32,105,110,32,122,105,112,105,109,112,111,114,116,101,114, - 46,95,102,105,108,101,115,46,10,10,73,116,32,105,115,32, - 117,115,117,97,108,108,121,32,110,111,116,32,110,101,101,100, - 101,100,32,116,111,32,117,115,101,32,116,104,101,32,122,105, - 112,105,109,112,111,114,116,32,109,111,100,117,108,101,32,101, - 120,112,108,105,99,105,116,108,121,59,32,105,116,32,105,115, - 10,117,115,101,100,32,98,121,32,116,104,101,32,98,117,105, - 108,116,105,110,32,105,109,112,111,114,116,32,109,101,99,104, - 97,110,105,115,109,32,102,111,114,32,115,121,115,46,112,97, - 116,104,32,105,116,101,109,115,32,116,104,97,116,32,97,114, - 101,32,112,97,116,104,115,10,116,111,32,90,105,112,32,97, - 114,99,104,105,118,101,115,46,10,233,0,0,0,0,78,41, - 2,218,14,95,117,110,112,97,99,107,95,117,105,110,116,49, - 54,218,14,95,117,110,112,97,99,107,95,117,105,110,116,51, - 50,218,14,90,105,112,73,109,112,111,114,116,69,114,114,111, - 114,218,11,122,105,112,105,109,112,111,114,116,101,114,233,1, - 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,1,0,0,0,64,0,0,0,115,12,0,0, - 0,101,0,90,1,100,0,90,2,100,1,83,0,41,2,114, - 3,0,0,0,78,41,3,218,8,95,95,110,97,109,101,95, - 95,218,10,95,95,109,111,100,117,108,101,95,95,218,12,95, - 95,113,117,97,108,110,97,109,101,95,95,169,0,114,9,0, - 0,0,114,9,0,0,0,250,18,60,102,114,111,122,101,110, - 32,122,105,112,105,109,112,111,114,116,62,114,3,0,0,0, - 33,0,0,0,115,6,0,0,0,8,0,4,1,255,128,233, - 22,0,0,0,115,4,0,0,0,80,75,5,6,105,255,255, - 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,3,0,0,0,64,0,0,0,115,108,0,0,0, - 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3, - 132,0,90,4,100,25,100,5,100,6,132,1,90,5,100,26, - 100,7,100,8,132,1,90,6,100,9,100,10,132,0,90,7, - 100,11,100,12,132,0,90,8,100,13,100,14,132,0,90,9, - 100,15,100,16,132,0,90,10,100,17,100,18,132,0,90,11, - 100,19,100,20,132,0,90,12,100,21,100,22,132,0,90,13, - 100,23,100,24,132,0,90,14,100,4,83,0,41,27,114,4, - 0,0,0,97,255,1,0,0,122,105,112,105,109,112,111,114, - 116,101,114,40,97,114,99,104,105,118,101,112,97,116,104,41, - 32,45,62,32,122,105,112,105,109,112,111,114,116,101,114,32, - 111,98,106,101,99,116,10,10,32,32,32,32,67,114,101,97, - 116,101,32,97,32,110,101,119,32,122,105,112,105,109,112,111, - 114,116,101,114,32,105,110,115,116,97,110,99,101,46,32,39, - 97,114,99,104,105,118,101,112,97,116,104,39,32,109,117,115, - 116,32,98,101,32,97,32,112,97,116,104,32,116,111,10,32, - 32,32,32,97,32,122,105,112,102,105,108,101,44,32,111,114, - 32,116,111,32,97,32,115,112,101,99,105,102,105,99,32,112, - 97,116,104,32,105,110,115,105,100,101,32,97,32,122,105,112, - 102,105,108,101,46,32,70,111,114,32,101,120,97,109,112,108, - 101,44,32,105,116,32,99,97,110,32,98,101,10,32,32,32, - 32,39,47,116,109,112,47,109,121,105,109,112,111,114,116,46, - 122,105,112,39,44,32,111,114,32,39,47,116,109,112,47,109, - 121,105,109,112,111,114,116,46,122,105,112,47,109,121,100,105, - 114,101,99,116,111,114,121,39,44,32,105,102,32,109,121,100, - 105,114,101,99,116,111,114,121,32,105,115,32,97,10,32,32, - 32,32,118,97,108,105,100,32,100,105,114,101,99,116,111,114, - 121,32,105,110,115,105,100,101,32,116,104,101,32,97,114,99, - 104,105,118,101,46,10,10,32,32,32,32,39,90,105,112,73, - 109,112,111,114,116,69,114,114,111,114,32,105,115,32,114,97, - 105,115,101,100,32,105,102,32,39,97,114,99,104,105,118,101, - 112,97,116,104,39,32,100,111,101,115,110,39,116,32,112,111, - 105,110,116,32,116,111,32,97,32,118,97,108,105,100,32,90, - 105,112,10,32,32,32,32,97,114,99,104,105,118,101,46,10, - 10,32,32,32,32,84,104,101,32,39,97,114,99,104,105,118, - 101,39,32,97,116,116,114,105,98,117,116,101,32,111,102,32, - 122,105,112,105,109,112,111,114,116,101,114,32,111,98,106,101, - 99,116,115,32,99,111,110,116,97,105,110,115,32,116,104,101, - 32,110,97,109,101,32,111,102,32,116,104,101,10,32,32,32, - 32,122,105,112,102,105,108,101,32,116,97,114,103,101,116,101, - 100,46,10,32,32,32,32,99,2,0,0,0,0,0,0,0, - 0,0,0,0,8,0,0,0,9,0,0,0,67,0,0,0, - 115,32,1,0,0,116,0,124,1,116,1,131,2,115,28,100, - 1,100,0,108,2,125,2,124,2,160,3,124,1,161,1,125, - 1,124,1,115,44,116,4,100,2,124,1,100,3,141,2,130, - 1,116,5,114,60,124,1,160,6,116,5,116,7,161,2,125, - 1,103,0,125,3,122,14,116,8,160,9,124,1,161,1,125, - 4,87,0,110,70,4,0,116,10,116,11,102,2,121,148,1, - 0,1,0,1,0,116,8,160,12,124,1,161,1,92,2,125, - 5,125,6,124,5,124,1,107,2,114,130,116,4,100,4,124, - 1,100,3,141,2,130,1,124,5,125,1,124,3,160,13,124, - 6,161,1,1,0,89,0,113,64,48,0,124,4,106,14,100, - 5,64,0,100,6,107,3,114,180,116,4,100,4,124,1,100, - 3,141,2,130,1,113,180,113,64,122,12,116,15,124,1,25, - 0,125,7,87,0,110,34,4,0,116,16,121,226,1,0,1, - 0,1,0,116,17,124,1,131,1,125,7,124,7,116,15,124, - 1,60,0,89,0,110,2,48,0,124,7,124,0,95,18,124, - 1,124,0,95,19,116,8,106,20,124,3,100,0,100,0,100, - 7,133,3,25,0,142,0,124,0,95,21,124,0,106,21,144, - 1,114,28,124,0,4,0,106,21,116,7,55,0,2,0,95, - 21,100,0,83,0,41,8,78,114,0,0,0,0,122,21,97, - 114,99,104,105,118,101,32,112,97,116,104,32,105,115,32,101, - 109,112,116,121,169,1,218,4,112,97,116,104,122,14,110,111, - 116,32,97,32,90,105,112,32,102,105,108,101,105,0,240,0, - 0,105,0,128,0,0,233,255,255,255,255,41,22,218,10,105, - 115,105,110,115,116,97,110,99,101,218,3,115,116,114,218,2, - 111,115,90,8,102,115,100,101,99,111,100,101,114,3,0,0, - 0,218,12,97,108,116,95,112,97,116,104,95,115,101,112,218, - 7,114,101,112,108,97,99,101,218,8,112,97,116,104,95,115, - 101,112,218,19,95,98,111,111,116,115,116,114,97,112,95,101, - 120,116,101,114,110,97,108,90,10,95,112,97,116,104,95,115, - 116,97,116,218,7,79,83,69,114,114,111,114,218,10,86,97, - 108,117,101,69,114,114,111,114,90,11,95,112,97,116,104,95, - 115,112,108,105,116,218,6,97,112,112,101,110,100,90,7,115, - 116,95,109,111,100,101,218,20,95,122,105,112,95,100,105,114, - 101,99,116,111,114,121,95,99,97,99,104,101,218,8,75,101, - 121,69,114,114,111,114,218,15,95,114,101,97,100,95,100,105, - 114,101,99,116,111,114,121,218,6,95,102,105,108,101,115,218, - 7,97,114,99,104,105,118,101,218,10,95,112,97,116,104,95, - 106,111,105,110,218,6,112,114,101,102,105,120,41,8,218,4, - 115,101,108,102,114,13,0,0,0,114,17,0,0,0,114,31, - 0,0,0,90,2,115,116,90,7,100,105,114,110,97,109,101, - 90,8,98,97,115,101,110,97,109,101,218,5,102,105,108,101, - 115,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, - 218,8,95,95,105,110,105,116,95,95,63,0,0,0,115,62, - 0,0,0,10,1,8,1,10,1,4,1,12,1,4,1,12, - 1,4,2,2,2,14,1,16,1,14,3,8,1,12,1,4, - 1,16,1,14,3,12,2,4,1,2,2,12,1,12,1,8, - 1,14,1,6,1,6,1,22,2,8,1,14,1,4,128,255, - 128,122,20,122,105,112,105,109,112,111,114,116,101,114,46,95, - 95,105,110,105,116,95,95,78,99,3,0,0,0,0,0,0, - 0,0,0,0,0,5,0,0,0,4,0,0,0,67,0,0, - 0,115,78,0,0,0,116,0,124,0,124,1,131,2,125,3, - 124,3,100,1,117,1,114,26,124,0,103,0,102,2,83,0, - 116,1,124,0,124,1,131,2,125,4,116,2,124,0,124,4, - 131,2,114,70,100,1,124,0,106,3,155,0,116,4,155,0, - 124,4,155,0,157,3,103,1,102,2,83,0,100,1,103,0, - 102,2,83,0,41,2,97,239,1,0,0,102,105,110,100,95, - 108,111,97,100,101,114,40,102,117,108,108,110,97,109,101,44, - 32,112,97,116,104,61,78,111,110,101,41,32,45,62,32,115, - 101,108,102,44,32,115,116,114,32,111,114,32,78,111,110,101, - 46,10,10,32,32,32,32,32,32,32,32,83,101,97,114,99, - 104,32,102,111,114,32,97,32,109,111,100,117,108,101,32,115, - 112,101,99,105,102,105,101,100,32,98,121,32,39,102,117,108, - 108,110,97,109,101,39,46,32,39,102,117,108,108,110,97,109, - 101,39,32,109,117,115,116,32,98,101,32,116,104,101,10,32, - 32,32,32,32,32,32,32,102,117,108,108,121,32,113,117,97, - 108,105,102,105,101,100,32,40,100,111,116,116,101,100,41,32, - 109,111,100,117,108,101,32,110,97,109,101,46,32,73,116,32, - 114,101,116,117,114,110,115,32,116,104,101,32,122,105,112,105, - 109,112,111,114,116,101,114,10,32,32,32,32,32,32,32,32, - 105,110,115,116,97,110,99,101,32,105,116,115,101,108,102,32, - 105,102,32,116,104,101,32,109,111,100,117,108,101,32,119,97, - 115,32,102,111,117,110,100,44,32,97,32,115,116,114,105,110, - 103,32,99,111,110,116,97,105,110,105,110,103,32,116,104,101, - 10,32,32,32,32,32,32,32,32,102,117,108,108,32,112,97, - 116,104,32,110,97,109,101,32,105,102,32,105,116,39,115,32, - 112,111,115,115,105,98,108,121,32,97,32,112,111,114,116,105, - 111,110,32,111,102,32,97,32,110,97,109,101,115,112,97,99, - 101,32,112,97,99,107,97,103,101,44,10,32,32,32,32,32, - 32,32,32,111,114,32,78,111,110,101,32,111,116,104,101,114, - 119,105,115,101,46,32,84,104,101,32,111,112,116,105,111,110, - 97,108,32,39,112,97,116,104,39,32,97,114,103,117,109,101, - 110,116,32,105,115,32,105,103,110,111,114,101,100,32,45,45, - 32,105,116,39,115,10,32,32,32,32,32,32,32,32,116,104, - 101,114,101,32,102,111,114,32,99,111,109,112,97,116,105,98, - 105,108,105,116,121,32,119,105,116,104,32,116,104,101,32,105, - 109,112,111,114,116,101,114,32,112,114,111,116,111,99,111,108, - 46,10,32,32,32,32,32,32,32,32,78,41,5,218,16,95, - 103,101,116,95,109,111,100,117,108,101,95,105,110,102,111,218, - 16,95,103,101,116,95,109,111,100,117,108,101,95,112,97,116, - 104,218,7,95,105,115,95,100,105,114,114,29,0,0,0,114, - 20,0,0,0,41,5,114,32,0,0,0,218,8,102,117,108, - 108,110,97,109,101,114,13,0,0,0,218,2,109,105,218,7, - 109,111,100,112,97,116,104,114,9,0,0,0,114,9,0,0, - 0,114,10,0,0,0,218,11,102,105,110,100,95,108,111,97, - 100,101,114,109,0,0,0,115,16,0,0,0,10,10,8,1, - 8,2,10,7,10,1,24,4,8,2,255,128,122,23,122,105, - 112,105,109,112,111,114,116,101,114,46,102,105,110,100,95,108, - 111,97,100,101,114,99,3,0,0,0,0,0,0,0,0,0, - 0,0,3,0,0,0,4,0,0,0,67,0,0,0,115,16, - 0,0,0,124,0,160,0,124,1,124,2,161,2,100,1,25, - 0,83,0,41,2,97,139,1,0,0,102,105,110,100,95,109, - 111,100,117,108,101,40,102,117,108,108,110,97,109,101,44,32, - 112,97,116,104,61,78,111,110,101,41,32,45,62,32,115,101, - 108,102,32,111,114,32,78,111,110,101,46,10,10,32,32,32, - 32,32,32,32,32,83,101,97,114,99,104,32,102,111,114,32, - 97,32,109,111,100,117,108,101,32,115,112,101,99,105,102,105, + 90,10,100,1,100,2,108,11,90,11,100,1,100,2,108,12, + 90,12,100,4,100,5,103,2,90,13,101,2,106,14,90,14, + 101,2,106,15,100,6,100,2,133,2,25,0,90,16,71,0, + 100,7,100,4,132,0,100,4,101,17,131,3,90,18,105,0, + 90,19,101,20,101,10,131,1,90,21,100,8,90,22,100,9, + 90,23,100,10,90,24,71,0,100,11,100,5,132,0,100,5, + 101,2,106,25,131,3,90,26,101,14,100,12,23,0,100,13, + 100,13,102,3,101,14,100,14,23,0,100,15,100,13,102,3, + 100,16,100,17,102,4,90,27,100,18,100,19,132,0,90,28, + 100,20,100,21,132,0,90,29,100,22,100,23,132,0,90,30, + 100,24,100,25,132,0,90,31,100,26,90,32,100,15,97,33, + 100,27,100,28,132,0,90,34,100,29,100,30,132,0,90,35, + 100,31,100,32,132,0,90,36,100,33,100,34,132,0,90,37, + 101,20,101,37,106,38,131,1,90,39,100,35,100,36,132,0, + 90,40,100,37,100,38,132,0,90,41,100,39,100,40,132,0, + 90,42,100,41,100,42,132,0,90,43,100,43,100,44,132,0, + 90,44,100,45,100,46,132,0,90,45,100,2,83,0,41,47, + 97,80,2,0,0,122,105,112,105,109,112,111,114,116,32,112, + 114,111,118,105,100,101,115,32,115,117,112,112,111,114,116,32, + 102,111,114,32,105,109,112,111,114,116,105,110,103,32,80,121, + 116,104,111,110,32,109,111,100,117,108,101,115,32,102,114,111, + 109,32,90,105,112,32,97,114,99,104,105,118,101,115,46,10, + 10,84,104,105,115,32,109,111,100,117,108,101,32,101,120,112, + 111,114,116,115,32,116,104,114,101,101,32,111,98,106,101,99, + 116,115,58,10,45,32,122,105,112,105,109,112,111,114,116,101, + 114,58,32,97,32,99,108,97,115,115,59,32,105,116,115,32, + 99,111,110,115,116,114,117,99,116,111,114,32,116,97,107,101, + 115,32,97,32,112,97,116,104,32,116,111,32,97,32,90,105, + 112,32,97,114,99,104,105,118,101,46,10,45,32,90,105,112, + 73,109,112,111,114,116,69,114,114,111,114,58,32,101,120,99, + 101,112,116,105,111,110,32,114,97,105,115,101,100,32,98,121, + 32,122,105,112,105,109,112,111,114,116,101,114,32,111,98,106, + 101,99,116,115,46,32,73,116,39,115,32,97,10,32,32,115, + 117,98,99,108,97,115,115,32,111,102,32,73,109,112,111,114, + 116,69,114,114,111,114,44,32,115,111,32,105,116,32,99,97, + 110,32,98,101,32,99,97,117,103,104,116,32,97,115,32,73, + 109,112,111,114,116,69,114,114,111,114,44,32,116,111,111,46, + 10,45,32,95,122,105,112,95,100,105,114,101,99,116,111,114, + 121,95,99,97,99,104,101,58,32,97,32,100,105,99,116,44, + 32,109,97,112,112,105,110,103,32,97,114,99,104,105,118,101, + 32,112,97,116,104,115,32,116,111,32,122,105,112,32,100,105, + 114,101,99,116,111,114,121,10,32,32,105,110,102,111,32,100, + 105,99,116,115,44,32,97,115,32,117,115,101,100,32,105,110, + 32,122,105,112,105,109,112,111,114,116,101,114,46,95,102,105, + 108,101,115,46,10,10,73,116,32,105,115,32,117,115,117,97, + 108,108,121,32,110,111,116,32,110,101,101,100,101,100,32,116, + 111,32,117,115,101,32,116,104,101,32,122,105,112,105,109,112, + 111,114,116,32,109,111,100,117,108,101,32,101,120,112,108,105, + 99,105,116,108,121,59,32,105,116,32,105,115,10,117,115,101, + 100,32,98,121,32,116,104,101,32,98,117,105,108,116,105,110, + 32,105,109,112,111,114,116,32,109,101,99,104,97,110,105,115, + 109,32,102,111,114,32,115,121,115,46,112,97,116,104,32,105, + 116,101,109,115,32,116,104,97,116,32,97,114,101,32,112,97, + 116,104,115,10,116,111,32,90,105,112,32,97,114,99,104,105, + 118,101,115,46,10,233,0,0,0,0,78,41,2,218,14,95, + 117,110,112,97,99,107,95,117,105,110,116,49,54,218,14,95, + 117,110,112,97,99,107,95,117,105,110,116,51,50,218,14,90, + 105,112,73,109,112,111,114,116,69,114,114,111,114,218,11,122, + 105,112,105,109,112,111,114,116,101,114,233,1,0,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,0,0,0,64,0,0,0,115,12,0,0,0,101,0,90, + 1,100,0,90,2,100,1,83,0,41,2,114,3,0,0,0, + 78,41,3,218,8,95,95,110,97,109,101,95,95,218,10,95, + 95,109,111,100,117,108,101,95,95,218,12,95,95,113,117,97, + 108,110,97,109,101,95,95,169,0,114,9,0,0,0,114,9, + 0,0,0,250,18,60,102,114,111,122,101,110,32,122,105,112, + 105,109,112,111,114,116,62,114,3,0,0,0,34,0,0,0, + 115,6,0,0,0,8,0,4,1,255,128,233,22,0,0,0, + 115,4,0,0,0,80,75,5,6,105,255,255,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,64,0,0,0,115,118,0,0,0,101,0,90,1, + 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, + 100,27,100,5,100,6,132,1,90,5,100,28,100,7,100,8, + 132,1,90,6,100,29,100,9,100,10,132,1,90,7,100,11, + 100,12,132,0,90,8,100,13,100,14,132,0,90,9,100,15, + 100,16,132,0,90,10,100,17,100,18,132,0,90,11,100,19, + 100,20,132,0,90,12,100,21,100,22,132,0,90,13,100,23, + 100,24,132,0,90,14,100,25,100,26,132,0,90,15,100,4, + 83,0,41,30,114,4,0,0,0,97,255,1,0,0,122,105, + 112,105,109,112,111,114,116,101,114,40,97,114,99,104,105,118, + 101,112,97,116,104,41,32,45,62,32,122,105,112,105,109,112, + 111,114,116,101,114,32,111,98,106,101,99,116,10,10,32,32, + 32,32,67,114,101,97,116,101,32,97,32,110,101,119,32,122, + 105,112,105,109,112,111,114,116,101,114,32,105,110,115,116,97, + 110,99,101,46,32,39,97,114,99,104,105,118,101,112,97,116, + 104,39,32,109,117,115,116,32,98,101,32,97,32,112,97,116, + 104,32,116,111,10,32,32,32,32,97,32,122,105,112,102,105, + 108,101,44,32,111,114,32,116,111,32,97,32,115,112,101,99, + 105,102,105,99,32,112,97,116,104,32,105,110,115,105,100,101, + 32,97,32,122,105,112,102,105,108,101,46,32,70,111,114,32, + 101,120,97,109,112,108,101,44,32,105,116,32,99,97,110,32, + 98,101,10,32,32,32,32,39,47,116,109,112,47,109,121,105, + 109,112,111,114,116,46,122,105,112,39,44,32,111,114,32,39, + 47,116,109,112,47,109,121,105,109,112,111,114,116,46,122,105, + 112,47,109,121,100,105,114,101,99,116,111,114,121,39,44,32, + 105,102,32,109,121,100,105,114,101,99,116,111,114,121,32,105, + 115,32,97,10,32,32,32,32,118,97,108,105,100,32,100,105, + 114,101,99,116,111,114,121,32,105,110,115,105,100,101,32,116, + 104,101,32,97,114,99,104,105,118,101,46,10,10,32,32,32, + 32,39,90,105,112,73,109,112,111,114,116,69,114,114,111,114, + 32,105,115,32,114,97,105,115,101,100,32,105,102,32,39,97, + 114,99,104,105,118,101,112,97,116,104,39,32,100,111,101,115, + 110,39,116,32,112,111,105,110,116,32,116,111,32,97,32,118, + 97,108,105,100,32,90,105,112,10,32,32,32,32,97,114,99, + 104,105,118,101,46,10,10,32,32,32,32,84,104,101,32,39, + 97,114,99,104,105,118,101,39,32,97,116,116,114,105,98,117, + 116,101,32,111,102,32,122,105,112,105,109,112,111,114,116,101, + 114,32,111,98,106,101,99,116,115,32,99,111,110,116,97,105, + 110,115,32,116,104,101,32,110,97,109,101,32,111,102,32,116, + 104,101,10,32,32,32,32,122,105,112,102,105,108,101,32,116, + 97,114,103,101,116,101,100,46,10,32,32,32,32,99,2,0, + 0,0,0,0,0,0,0,0,0,0,8,0,0,0,9,0, + 0,0,67,0,0,0,115,32,1,0,0,116,0,124,1,116, + 1,131,2,115,28,100,1,100,0,108,2,125,2,124,2,160, + 3,124,1,161,1,125,1,124,1,115,44,116,4,100,2,124, + 1,100,3,141,2,130,1,116,5,114,60,124,1,160,6,116, + 5,116,7,161,2,125,1,103,0,125,3,122,14,116,8,160, + 9,124,1,161,1,125,4,87,0,110,70,4,0,116,10,116, + 11,102,2,121,148,1,0,1,0,1,0,116,8,160,12,124, + 1,161,1,92,2,125,5,125,6,124,5,124,1,107,2,114, + 130,116,4,100,4,124,1,100,3,141,2,130,1,124,5,125, + 1,124,3,160,13,124,6,161,1,1,0,89,0,113,64,48, + 0,124,4,106,14,100,5,64,0,100,6,107,3,114,176,116, + 4,100,4,124,1,100,3,141,2,130,1,122,12,116,15,124, + 1,25,0,125,7,87,0,110,34,4,0,116,16,121,222,1, + 0,1,0,1,0,116,17,124,1,131,1,125,7,124,7,116, + 15,124,1,60,0,89,0,110,2,48,0,124,7,124,0,95, + 18,124,1,124,0,95,19,116,8,106,20,124,3,100,0,100, + 0,100,7,133,3,25,0,142,0,124,0,95,21,124,0,106, + 21,144,1,114,28,124,0,4,0,106,21,116,7,55,0,2, + 0,95,21,100,0,83,0,100,0,83,0,41,8,78,114,0, + 0,0,0,122,21,97,114,99,104,105,118,101,32,112,97,116, + 104,32,105,115,32,101,109,112,116,121,169,1,218,4,112,97, + 116,104,122,14,110,111,116,32,97,32,90,105,112,32,102,105, + 108,101,105,0,240,0,0,105,0,128,0,0,233,255,255,255, + 255,41,22,218,10,105,115,105,110,115,116,97,110,99,101,218, + 3,115,116,114,218,2,111,115,90,8,102,115,100,101,99,111, + 100,101,114,3,0,0,0,218,12,97,108,116,95,112,97,116, + 104,95,115,101,112,218,7,114,101,112,108,97,99,101,218,8, + 112,97,116,104,95,115,101,112,218,19,95,98,111,111,116,115, + 116,114,97,112,95,101,120,116,101,114,110,97,108,90,10,95, + 112,97,116,104,95,115,116,97,116,218,7,79,83,69,114,114, + 111,114,218,10,86,97,108,117,101,69,114,114,111,114,90,11, + 95,112,97,116,104,95,115,112,108,105,116,218,6,97,112,112, + 101,110,100,90,7,115,116,95,109,111,100,101,218,20,95,122, + 105,112,95,100,105,114,101,99,116,111,114,121,95,99,97,99, + 104,101,218,8,75,101,121,69,114,114,111,114,218,15,95,114, + 101,97,100,95,100,105,114,101,99,116,111,114,121,218,6,95, + 102,105,108,101,115,218,7,97,114,99,104,105,118,101,218,10, + 95,112,97,116,104,95,106,111,105,110,218,6,112,114,101,102, + 105,120,41,8,218,4,115,101,108,102,114,13,0,0,0,114, + 17,0,0,0,114,31,0,0,0,90,2,115,116,90,7,100, + 105,114,110,97,109,101,90,8,98,97,115,101,110,97,109,101, + 218,5,102,105,108,101,115,114,9,0,0,0,114,9,0,0, + 0,114,10,0,0,0,218,8,95,95,105,110,105,116,95,95, + 64,0,0,0,115,60,0,0,0,10,1,8,1,10,1,4, + 1,12,1,4,1,12,1,4,2,2,2,14,1,16,1,14, + 3,8,1,12,1,4,1,16,1,14,3,12,2,2,3,12, + 1,12,1,8,1,14,1,6,1,6,1,22,2,8,1,18, + 1,4,255,255,128,122,20,122,105,112,105,109,112,111,114,116, + 101,114,46,95,95,105,110,105,116,95,95,78,99,3,0,0, + 0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0, + 0,67,0,0,0,115,78,0,0,0,116,0,124,0,124,1, + 131,2,125,3,124,3,100,1,117,1,114,26,124,0,103,0, + 102,2,83,0,116,1,124,0,124,1,131,2,125,4,116,2, + 124,0,124,4,131,2,114,70,100,1,124,0,106,3,155,0, + 116,4,155,0,124,4,155,0,157,3,103,1,102,2,83,0, + 100,1,103,0,102,2,83,0,41,2,97,47,2,0,0,102, + 105,110,100,95,108,111,97,100,101,114,40,102,117,108,108,110, + 97,109,101,44,32,112,97,116,104,61,78,111,110,101,41,32, + 45,62,32,115,101,108,102,44,32,115,116,114,32,111,114,32, + 78,111,110,101,46,10,10,32,32,32,32,32,32,32,32,83, + 101,97,114,99,104,32,102,111,114,32,97,32,109,111,100,117, + 108,101,32,115,112,101,99,105,102,105,101,100,32,98,121,32, + 39,102,117,108,108,110,97,109,101,39,46,32,39,102,117,108, + 108,110,97,109,101,39,32,109,117,115,116,32,98,101,32,116, + 104,101,10,32,32,32,32,32,32,32,32,102,117,108,108,121, + 32,113,117,97,108,105,102,105,101,100,32,40,100,111,116,116, + 101,100,41,32,109,111,100,117,108,101,32,110,97,109,101,46, + 32,73,116,32,114,101,116,117,114,110,115,32,116,104,101,32, + 122,105,112,105,109,112,111,114,116,101,114,10,32,32,32,32, + 32,32,32,32,105,110,115,116,97,110,99,101,32,105,116,115, + 101,108,102,32,105,102,32,116,104,101,32,109,111,100,117,108, + 101,32,119,97,115,32,102,111,117,110,100,44,32,97,32,115, + 116,114,105,110,103,32,99,111,110,116,97,105,110,105,110,103, + 32,116,104,101,10,32,32,32,32,32,32,32,32,102,117,108, + 108,32,112,97,116,104,32,110,97,109,101,32,105,102,32,105, + 116,39,115,32,112,111,115,115,105,98,108,121,32,97,32,112, + 111,114,116,105,111,110,32,111,102,32,97,32,110,97,109,101, + 115,112,97,99,101,32,112,97,99,107,97,103,101,44,10,32, + 32,32,32,32,32,32,32,111,114,32,78,111,110,101,32,111, + 116,104,101,114,119,105,115,101,46,32,84,104,101,32,111,112, + 116,105,111,110,97,108,32,39,112,97,116,104,39,32,97,114, + 103,117,109,101,110,116,32,105,115,32,105,103,110,111,114,101, + 100,32,45,45,32,105,116,39,115,10,32,32,32,32,32,32, + 32,32,116,104,101,114,101,32,102,111,114,32,99,111,109,112, + 97,116,105,98,105,108,105,116,121,32,119,105,116,104,32,116, + 104,101,32,105,109,112,111,114,116,101,114,32,112,114,111,116, + 111,99,111,108,46,10,10,32,32,32,32,32,32,32,32,68, + 101,112,114,101,99,97,116,101,100,32,115,105,110,99,101,32, + 80,121,116,104,111,110,32,51,46,49,48,46,32,85,115,101, + 32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,115, + 116,101,97,100,46,10,32,32,32,32,32,32,32,32,78,41, + 5,218,16,95,103,101,116,95,109,111,100,117,108,101,95,105, + 110,102,111,218,16,95,103,101,116,95,109,111,100,117,108,101, + 95,112,97,116,104,218,7,95,105,115,95,100,105,114,114,29, + 0,0,0,114,20,0,0,0,41,5,114,32,0,0,0,218, + 8,102,117,108,108,110,97,109,101,114,13,0,0,0,218,2, + 109,105,218,7,109,111,100,112,97,116,104,114,9,0,0,0, + 114,9,0,0,0,114,10,0,0,0,218,11,102,105,110,100, + 95,108,111,97,100,101,114,110,0,0,0,115,16,0,0,0, + 10,12,8,1,8,2,10,7,10,1,24,4,8,2,255,128, + 122,23,122,105,112,105,109,112,111,114,116,101,114,46,102,105, + 110,100,95,108,111,97,100,101,114,99,3,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,4,0,0,0,67,0, + 0,0,115,16,0,0,0,124,0,160,0,124,1,124,2,161, + 2,100,1,25,0,83,0,41,3,97,203,1,0,0,102,105, + 110,100,95,109,111,100,117,108,101,40,102,117,108,108,110,97, + 109,101,44,32,112,97,116,104,61,78,111,110,101,41,32,45, + 62,32,115,101,108,102,32,111,114,32,78,111,110,101,46,10, + 10,32,32,32,32,32,32,32,32,83,101,97,114,99,104,32, + 102,111,114,32,97,32,109,111,100,117,108,101,32,115,112,101, + 99,105,102,105,101,100,32,98,121,32,39,102,117,108,108,110, + 97,109,101,39,46,32,39,102,117,108,108,110,97,109,101,39, + 32,109,117,115,116,32,98,101,32,116,104,101,10,32,32,32, + 32,32,32,32,32,102,117,108,108,121,32,113,117,97,108,105, + 102,105,101,100,32,40,100,111,116,116,101,100,41,32,109,111, + 100,117,108,101,32,110,97,109,101,46,32,73,116,32,114,101, + 116,117,114,110,115,32,116,104,101,32,122,105,112,105,109,112, + 111,114,116,101,114,10,32,32,32,32,32,32,32,32,105,110, + 115,116,97,110,99,101,32,105,116,115,101,108,102,32,105,102, + 32,116,104,101,32,109,111,100,117,108,101,32,119,97,115,32, + 102,111,117,110,100,44,32,111,114,32,78,111,110,101,32,105, + 102,32,105,116,32,119,97,115,110,39,116,46,10,32,32,32, + 32,32,32,32,32,84,104,101,32,111,112,116,105,111,110,97, + 108,32,39,112,97,116,104,39,32,97,114,103,117,109,101,110, + 116,32,105,115,32,105,103,110,111,114,101,100,32,45,45,32, + 105,116,39,115,32,116,104,101,114,101,32,102,111,114,32,99, + 111,109,112,97,116,105,98,105,108,105,116,121,10,32,32,32, + 32,32,32,32,32,119,105,116,104,32,116,104,101,32,105,109, + 112,111,114,116,101,114,32,112,114,111,116,111,99,111,108,46, + 10,10,32,32,32,32,32,32,32,32,68,101,112,114,101,99, + 97,116,101,100,32,115,105,110,99,101,32,80,121,116,104,111, + 110,32,51,46,49,48,46,32,85,115,101,32,102,105,110,100, + 95,115,112,101,99,40,41,32,105,110,115,116,101,97,100,46, + 10,32,32,32,32,32,32,32,32,114,0,0,0,0,78,41, + 1,114,41,0,0,0,41,3,114,32,0,0,0,114,38,0, + 0,0,114,13,0,0,0,114,9,0,0,0,114,9,0,0, + 0,114,10,0,0,0,218,11,102,105,110,100,95,109,111,100, + 117,108,101,144,0,0,0,115,4,0,0,0,16,11,255,128, + 122,23,122,105,112,105,109,112,111,114,116,101,114,46,102,105, + 110,100,95,109,111,100,117,108,101,99,3,0,0,0,0,0, + 0,0,0,0,0,0,7,0,0,0,5,0,0,0,67,0, + 0,0,115,108,0,0,0,116,0,124,0,124,1,131,2,125, + 3,124,3,100,1,117,1,114,34,116,1,106,2,124,1,124, + 0,124,3,100,2,141,3,83,0,116,3,124,0,124,1,131, + 2,125,4,116,4,124,0,124,4,131,2,114,104,124,0,106, + 5,155,0,116,6,155,0,124,4,155,0,157,3,125,5,116, + 1,106,7,124,1,100,1,100,3,100,4,141,3,125,6,124, + 6,106,8,160,9,124,5,161,1,1,0,124,6,83,0,100, + 1,83,0,41,5,122,107,67,114,101,97,116,101,32,97,32, + 77,111,100,117,108,101,83,112,101,99,32,102,111,114,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,100, + 117,108,101,46,10,10,32,32,32,32,32,32,32,32,82,101, + 116,117,114,110,115,32,78,111,110,101,32,105,102,32,116,104, + 101,32,109,111,100,117,108,101,32,99,97,110,110,111,116,32, + 98,101,32,102,111,117,110,100,46,10,32,32,32,32,32,32, + 32,32,78,41,1,218,10,105,115,95,112,97,99,107,97,103, + 101,84,41,3,218,4,110,97,109,101,90,6,108,111,97,100, + 101,114,114,43,0,0,0,41,10,114,35,0,0,0,218,10, + 95,98,111,111,116,115,116,114,97,112,90,16,115,112,101,99, + 95,102,114,111,109,95,108,111,97,100,101,114,114,36,0,0, + 0,114,37,0,0,0,114,29,0,0,0,114,20,0,0,0, + 90,10,77,111,100,117,108,101,83,112,101,99,90,26,115,117, + 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, + 111,99,97,116,105,111,110,115,114,24,0,0,0,41,7,114, + 32,0,0,0,114,38,0,0,0,90,6,116,97,114,103,101, + 116,90,11,109,111,100,117,108,101,95,105,110,102,111,114,40, + 0,0,0,114,13,0,0,0,90,4,115,112,101,99,114,9, + 0,0,0,114,9,0,0,0,114,10,0,0,0,218,9,102, + 105,110,100,95,115,112,101,99,157,0,0,0,115,26,0,0, + 0,10,5,8,1,16,1,10,7,10,1,18,4,8,1,2, + 1,6,255,12,2,4,1,4,2,255,128,122,21,122,105,112, + 105,109,112,111,114,116,101,114,46,102,105,110,100,95,115,112, + 101,99,99,2,0,0,0,0,0,0,0,0,0,0,0,5, + 0,0,0,3,0,0,0,67,0,0,0,115,20,0,0,0, + 116,0,124,0,124,1,131,2,92,3,125,2,125,3,125,4, + 124,2,83,0,41,2,122,163,103,101,116,95,99,111,100,101, + 40,102,117,108,108,110,97,109,101,41,32,45,62,32,99,111, + 100,101,32,111,98,106,101,99,116,46,10,10,32,32,32,32, + 32,32,32,32,82,101,116,117,114,110,32,116,104,101,32,99, + 111,100,101,32,111,98,106,101,99,116,32,102,111,114,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,100, + 117,108,101,46,32,82,97,105,115,101,32,90,105,112,73,109, + 112,111,114,116,69,114,114,111,114,10,32,32,32,32,32,32, + 32,32,105,102,32,116,104,101,32,109,111,100,117,108,101,32, + 99,111,117,108,100,110,39,116,32,98,101,32,102,111,117,110, + 100,46,10,32,32,32,32,32,32,32,32,78,169,1,218,16, + 95,103,101,116,95,109,111,100,117,108,101,95,99,111,100,101, + 169,5,114,32,0,0,0,114,38,0,0,0,218,4,99,111, + 100,101,218,9,105,115,112,97,99,107,97,103,101,114,40,0, + 0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0, + 0,218,8,103,101,116,95,99,111,100,101,184,0,0,0,115, + 6,0,0,0,16,6,4,1,255,128,122,20,122,105,112,105, + 109,112,111,114,116,101,114,46,103,101,116,95,99,111,100,101, + 99,2,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,8,0,0,0,67,0,0,0,115,112,0,0,0,116,0, + 114,16,124,1,160,1,116,0,116,2,161,2,125,1,124,1, + 125,2,124,1,160,3,124,0,106,4,116,2,23,0,161,1, + 114,58,124,1,116,5,124,0,106,4,116,2,23,0,131,1, + 100,1,133,2,25,0,125,2,122,14,124,0,106,6,124,2, + 25,0,125,3,87,0,110,26,4,0,116,7,121,98,1,0, + 1,0,1,0,116,8,100,2,100,3,124,2,131,3,130,1, + 48,0,116,9,124,0,106,4,124,3,131,2,83,0,41,4, + 122,154,103,101,116,95,100,97,116,97,40,112,97,116,104,110, + 97,109,101,41,32,45,62,32,115,116,114,105,110,103,32,119, + 105,116,104,32,102,105,108,101,32,100,97,116,97,46,10,10, + 32,32,32,32,32,32,32,32,82,101,116,117,114,110,32,116, + 104,101,32,100,97,116,97,32,97,115,115,111,99,105,97,116, + 101,100,32,119,105,116,104,32,39,112,97,116,104,110,97,109, + 101,39,46,32,82,97,105,115,101,32,79,83,69,114,114,111, + 114,32,105,102,10,32,32,32,32,32,32,32,32,116,104,101, + 32,102,105,108,101,32,119,97,115,110,39,116,32,102,111,117, + 110,100,46,10,32,32,32,32,32,32,32,32,78,114,0,0, + 0,0,218,0,41,10,114,18,0,0,0,114,19,0,0,0, + 114,20,0,0,0,218,10,115,116,97,114,116,115,119,105,116, + 104,114,29,0,0,0,218,3,108,101,110,114,28,0,0,0, + 114,26,0,0,0,114,22,0,0,0,218,9,95,103,101,116, + 95,100,97,116,97,41,4,114,32,0,0,0,218,8,112,97, + 116,104,110,97,109,101,90,3,107,101,121,218,9,116,111,99, + 95,101,110,116,114,121,114,9,0,0,0,114,9,0,0,0, + 114,10,0,0,0,218,8,103,101,116,95,100,97,116,97,194, + 0,0,0,115,22,0,0,0,4,6,12,1,4,2,16,1, + 22,1,2,2,14,1,12,1,14,1,12,1,255,128,122,20, + 122,105,112,105,109,112,111,114,116,101,114,46,103,101,116,95, + 100,97,116,97,99,2,0,0,0,0,0,0,0,0,0,0, + 0,5,0,0,0,3,0,0,0,67,0,0,0,115,20,0, + 0,0,116,0,124,0,124,1,131,2,92,3,125,2,125,3, + 125,4,124,4,83,0,41,2,122,106,103,101,116,95,102,105, + 108,101,110,97,109,101,40,102,117,108,108,110,97,109,101,41, + 32,45,62,32,102,105,108,101,110,97,109,101,32,115,116,114, + 105,110,103,46,10,10,32,32,32,32,32,32,32,32,82,101, + 116,117,114,110,32,116,104,101,32,102,105,108,101,110,97,109, + 101,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102, + 105,101,100,32,109,111,100,117,108,101,46,10,32,32,32,32, + 32,32,32,32,78,114,47,0,0,0,114,49,0,0,0,114, + 9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,12, + 103,101,116,95,102,105,108,101,110,97,109,101,215,0,0,0, + 115,6,0,0,0,16,7,4,1,255,128,122,24,122,105,112, + 105,109,112,111,114,116,101,114,46,103,101,116,95,102,105,108, + 101,110,97,109,101,99,2,0,0,0,0,0,0,0,0,0, + 0,0,6,0,0,0,8,0,0,0,67,0,0,0,115,126, + 0,0,0,116,0,124,0,124,1,131,2,125,2,124,2,100, + 1,117,0,114,36,116,1,100,2,124,1,155,2,157,2,124, + 1,100,3,141,2,130,1,116,2,124,0,124,1,131,2,125, + 3,124,2,114,64,116,3,160,4,124,3,100,4,161,2,125, + 4,110,10,124,3,155,0,100,5,157,2,125,4,122,14,124, + 0,106,5,124,4,25,0,125,5,87,0,110,20,4,0,116, + 6,121,108,1,0,1,0,1,0,89,0,100,1,83,0,48, + 0,116,7,124,0,106,8,124,5,131,2,160,9,161,0,83, + 0,41,6,122,253,103,101,116,95,115,111,117,114,99,101,40, + 102,117,108,108,110,97,109,101,41,32,45,62,32,115,111,117, + 114,99,101,32,115,116,114,105,110,103,46,10,10,32,32,32, + 32,32,32,32,32,82,101,116,117,114,110,32,116,104,101,32, + 115,111,117,114,99,101,32,99,111,100,101,32,102,111,114,32, + 116,104,101,32,115,112,101,99,105,102,105,101,100,32,109,111, + 100,117,108,101,46,32,82,97,105,115,101,32,90,105,112,73, + 109,112,111,114,116,69,114,114,111,114,10,32,32,32,32,32, + 32,32,32,105,102,32,116,104,101,32,109,111,100,117,108,101, + 32,99,111,117,108,100,110,39,116,32,98,101,32,102,111,117, + 110,100,44,32,114,101,116,117,114,110,32,78,111,110,101,32, + 105,102,32,116,104,101,32,97,114,99,104,105,118,101,32,100, + 111,101,115,10,32,32,32,32,32,32,32,32,99,111,110,116, + 97,105,110,32,116,104,101,32,109,111,100,117,108,101,44,32, + 98,117,116,32,104,97,115,32,110,111,32,115,111,117,114,99, + 101,32,102,111,114,32,105,116,46,10,32,32,32,32,32,32, + 32,32,78,250,18,99,97,110,39,116,32,102,105,110,100,32, + 109,111,100,117,108,101,32,169,1,114,44,0,0,0,250,11, + 95,95,105,110,105,116,95,95,46,112,121,250,3,46,112,121, + 41,10,114,35,0,0,0,114,3,0,0,0,114,36,0,0, + 0,114,21,0,0,0,114,30,0,0,0,114,28,0,0,0, + 114,26,0,0,0,114,56,0,0,0,114,29,0,0,0,218, + 6,100,101,99,111,100,101,41,6,114,32,0,0,0,114,38, + 0,0,0,114,39,0,0,0,114,13,0,0,0,218,8,102, + 117,108,108,112,97,116,104,114,58,0,0,0,114,9,0,0, + 0,114,9,0,0,0,114,10,0,0,0,218,10,103,101,116, + 95,115,111,117,114,99,101,226,0,0,0,115,26,0,0,0, + 10,7,8,1,18,1,10,2,4,1,14,1,10,2,2,2, + 14,1,12,1,8,2,16,1,255,128,122,22,122,105,112,105, + 109,112,111,114,116,101,114,46,103,101,116,95,115,111,117,114, + 99,101,99,2,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,4,0,0,0,67,0,0,0,115,40,0,0,0, + 116,0,124,0,124,1,131,2,125,2,124,2,100,1,117,0, + 114,36,116,1,100,2,124,1,155,2,157,2,124,1,100,3, + 141,2,130,1,124,2,83,0,41,4,122,171,105,115,95,112, + 97,99,107,97,103,101,40,102,117,108,108,110,97,109,101,41, + 32,45,62,32,98,111,111,108,46,10,10,32,32,32,32,32, + 32,32,32,82,101,116,117,114,110,32,84,114,117,101,32,105, + 102,32,116,104,101,32,109,111,100,117,108,101,32,115,112,101, + 99,105,102,105,101,100,32,98,121,32,102,117,108,108,110,97, + 109,101,32,105,115,32,97,32,112,97,99,107,97,103,101,46, + 10,32,32,32,32,32,32,32,32,82,97,105,115,101,32,90, + 105,112,73,109,112,111,114,116,69,114,114,111,114,32,105,102, + 32,116,104,101,32,109,111,100,117,108,101,32,99,111,117,108, + 100,110,39,116,32,98,101,32,102,111,117,110,100,46,10,32, + 32,32,32,32,32,32,32,78,114,61,0,0,0,114,62,0, + 0,0,41,2,114,35,0,0,0,114,3,0,0,0,41,3, + 114,32,0,0,0,114,38,0,0,0,114,39,0,0,0,114, + 9,0,0,0,114,9,0,0,0,114,10,0,0,0,114,43, + 0,0,0,252,0,0,0,115,10,0,0,0,10,6,8,1, + 18,1,4,1,255,128,122,22,122,105,112,105,109,112,111,114, + 116,101,114,46,105,115,95,112,97,99,107,97,103,101,99,2, + 0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,8, + 0,0,0,67,0,0,0,115,252,0,0,0,100,1,125,2, + 116,0,160,1,124,2,116,2,161,2,1,0,116,3,124,0, + 124,1,131,2,92,3,125,3,125,4,125,5,116,4,106,5, + 160,6,124,1,161,1,125,6,124,6,100,2,117,0,115,62, + 116,7,124,6,116,8,131,2,115,80,116,8,124,1,131,1, + 125,6,124,6,116,4,106,5,124,1,60,0,124,0,124,6, + 95,9,122,84,124,4,114,124,116,10,124,0,124,1,131,2, + 125,7,116,11,160,12,124,0,106,13,124,7,161,2,125,8, + 124,8,103,1,124,6,95,14,116,15,124,6,100,3,131,2, + 115,140,116,16,124,6,95,16,116,11,160,17,124,6,106,18, + 124,1,124,5,161,3,1,0,116,19,124,3,124,6,106,18, + 131,2,1,0,87,0,110,16,1,0,1,0,1,0,116,4, + 106,5,124,1,61,0,130,0,122,14,116,4,106,5,124,1, + 25,0,125,6,87,0,110,30,4,0,116,20,121,232,1,0, + 1,0,1,0,116,21,100,4,124,1,155,2,100,5,157,3, + 131,1,130,1,48,0,116,22,160,23,100,6,124,1,124,5, + 161,3,1,0,124,6,83,0,41,7,97,55,1,0,0,108, + 111,97,100,95,109,111,100,117,108,101,40,102,117,108,108,110, + 97,109,101,41,32,45,62,32,109,111,100,117,108,101,46,10, + 10,32,32,32,32,32,32,32,32,76,111,97,100,32,116,104, + 101,32,109,111,100,117,108,101,32,115,112,101,99,105,102,105, 101,100,32,98,121,32,39,102,117,108,108,110,97,109,101,39, 46,32,39,102,117,108,108,110,97,109,101,39,32,109,117,115, 116,32,98,101,32,116,104,101,10,32,32,32,32,32,32,32, 32,102,117,108,108,121,32,113,117,97,108,105,102,105,101,100, 32,40,100,111,116,116,101,100,41,32,109,111,100,117,108,101, 32,110,97,109,101,46,32,73,116,32,114,101,116,117,114,110, - 115,32,116,104,101,32,122,105,112,105,109,112,111,114,116,101, - 114,10,32,32,32,32,32,32,32,32,105,110,115,116,97,110, - 99,101,32,105,116,115,101,108,102,32,105,102,32,116,104,101, - 32,109,111,100,117,108,101,32,119,97,115,32,102,111,117,110, - 100,44,32,111,114,32,78,111,110,101,32,105,102,32,105,116, - 32,119,97,115,110,39,116,46,10,32,32,32,32,32,32,32, - 32,84,104,101,32,111,112,116,105,111,110,97,108,32,39,112, - 97,116,104,39,32,97,114,103,117,109,101,110,116,32,105,115, - 32,105,103,110,111,114,101,100,32,45,45,32,105,116,39,115, - 32,116,104,101,114,101,32,102,111,114,32,99,111,109,112,97, - 116,105,98,105,108,105,116,121,10,32,32,32,32,32,32,32, - 32,119,105,116,104,32,116,104,101,32,105,109,112,111,114,116, - 101,114,32,112,114,111,116,111,99,111,108,46,10,32,32,32, - 32,32,32,32,32,114,0,0,0,0,41,1,114,41,0,0, - 0,41,3,114,32,0,0,0,114,38,0,0,0,114,13,0, - 0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0, - 0,218,11,102,105,110,100,95,109,111,100,117,108,101,141,0, - 0,0,115,4,0,0,0,16,9,255,128,122,23,122,105,112, - 105,109,112,111,114,116,101,114,46,102,105,110,100,95,109,111, - 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, - 0,5,0,0,0,3,0,0,0,67,0,0,0,115,20,0, - 0,0,116,0,124,0,124,1,131,2,92,3,125,2,125,3, - 125,4,124,2,83,0,41,1,122,163,103,101,116,95,99,111, - 100,101,40,102,117,108,108,110,97,109,101,41,32,45,62,32, - 99,111,100,101,32,111,98,106,101,99,116,46,10,10,32,32, - 32,32,32,32,32,32,82,101,116,117,114,110,32,116,104,101, - 32,99,111,100,101,32,111,98,106,101,99,116,32,102,111,114, - 32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109, - 111,100,117,108,101,46,32,82,97,105,115,101,32,90,105,112, - 73,109,112,111,114,116,69,114,114,111,114,10,32,32,32,32, - 32,32,32,32,105,102,32,116,104,101,32,109,111,100,117,108, - 101,32,99,111,117,108,100,110,39,116,32,98,101,32,102,111, - 117,110,100,46,10,32,32,32,32,32,32,32,32,169,1,218, - 16,95,103,101,116,95,109,111,100,117,108,101,95,99,111,100, - 101,169,5,114,32,0,0,0,114,38,0,0,0,218,4,99, - 111,100,101,218,9,105,115,112,97,99,107,97,103,101,114,40, - 0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0, - 0,0,218,8,103,101,116,95,99,111,100,101,153,0,0,0, - 115,6,0,0,0,16,6,4,1,255,128,122,20,122,105,112, - 105,109,112,111,114,116,101,114,46,103,101,116,95,99,111,100, - 101,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0, - 0,0,8,0,0,0,67,0,0,0,115,116,0,0,0,116, - 0,114,16,124,1,160,1,116,0,116,2,161,2,125,1,124, - 1,125,2,124,1,160,3,124,0,106,4,116,2,23,0,161, - 1,114,58,124,1,116,5,124,0,106,4,116,2,23,0,131, - 1,100,1,133,2,25,0,125,2,122,14,124,0,106,6,124, - 2,25,0,125,3,87,0,110,30,4,0,116,7,121,102,1, - 0,1,0,1,0,116,8,100,2,100,3,124,2,131,3,130, - 1,89,0,110,2,48,0,116,9,124,0,106,4,124,3,131, - 2,83,0,41,4,122,154,103,101,116,95,100,97,116,97,40, - 112,97,116,104,110,97,109,101,41,32,45,62,32,115,116,114, - 105,110,103,32,119,105,116,104,32,102,105,108,101,32,100,97, - 116,97,46,10,10,32,32,32,32,32,32,32,32,82,101,116, - 117,114,110,32,116,104,101,32,100,97,116,97,32,97,115,115, - 111,99,105,97,116,101,100,32,119,105,116,104,32,39,112,97, - 116,104,110,97,109,101,39,46,32,82,97,105,115,101,32,79, - 83,69,114,114,111,114,32,105,102,10,32,32,32,32,32,32, - 32,32,116,104,101,32,102,105,108,101,32,119,97,115,110,39, - 116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,32, - 32,78,114,0,0,0,0,218,0,41,10,114,18,0,0,0, - 114,19,0,0,0,114,20,0,0,0,218,10,115,116,97,114, - 116,115,119,105,116,104,114,29,0,0,0,218,3,108,101,110, - 114,28,0,0,0,114,26,0,0,0,114,22,0,0,0,218, - 9,95,103,101,116,95,100,97,116,97,41,4,114,32,0,0, - 0,218,8,112,97,116,104,110,97,109,101,90,3,107,101,121, - 218,9,116,111,99,95,101,110,116,114,121,114,9,0,0,0, - 114,9,0,0,0,114,10,0,0,0,218,8,103,101,116,95, - 100,97,116,97,163,0,0,0,115,22,0,0,0,4,6,12, - 1,4,2,16,1,22,1,2,2,14,1,12,1,18,1,12, - 1,255,128,122,20,122,105,112,105,109,112,111,114,116,101,114, - 46,103,101,116,95,100,97,116,97,99,2,0,0,0,0,0, - 0,0,0,0,0,0,5,0,0,0,3,0,0,0,67,0, - 0,0,115,20,0,0,0,116,0,124,0,124,1,131,2,92, - 3,125,2,125,3,125,4,124,4,83,0,41,1,122,106,103, - 101,116,95,102,105,108,101,110,97,109,101,40,102,117,108,108, - 110,97,109,101,41,32,45,62,32,102,105,108,101,110,97,109, - 101,32,115,116,114,105,110,103,46,10,10,32,32,32,32,32, - 32,32,32,82,101,116,117,114,110,32,116,104,101,32,102,105, - 108,101,110,97,109,101,32,102,111,114,32,116,104,101,32,115, - 112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,46, - 10,32,32,32,32,32,32,32,32,114,43,0,0,0,114,45, - 0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0, - 0,0,218,12,103,101,116,95,102,105,108,101,110,97,109,101, - 184,0,0,0,115,6,0,0,0,16,7,4,1,255,128,122, - 24,122,105,112,105,109,112,111,114,116,101,114,46,103,101,116, - 95,102,105,108,101,110,97,109,101,99,2,0,0,0,0,0, - 0,0,0,0,0,0,6,0,0,0,8,0,0,0,67,0, - 0,0,115,126,0,0,0,116,0,124,0,124,1,131,2,125, - 2,124,2,100,1,117,0,114,36,116,1,100,2,124,1,155, - 2,157,2,124,1,100,3,141,2,130,1,116,2,124,0,124, - 1,131,2,125,3,124,2,114,64,116,3,160,4,124,3,100, - 4,161,2,125,4,110,10,124,3,155,0,100,5,157,2,125, - 4,122,14,124,0,106,5,124,4,25,0,125,5,87,0,110, - 20,4,0,116,6,121,108,1,0,1,0,1,0,89,0,100, - 1,83,0,48,0,116,7,124,0,106,8,124,5,131,2,160, - 9,161,0,83,0,41,6,122,253,103,101,116,95,115,111,117, - 114,99,101,40,102,117,108,108,110,97,109,101,41,32,45,62, - 32,115,111,117,114,99,101,32,115,116,114,105,110,103,46,10, - 10,32,32,32,32,32,32,32,32,82,101,116,117,114,110,32, - 116,104,101,32,115,111,117,114,99,101,32,99,111,100,101,32, - 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, - 100,32,109,111,100,117,108,101,46,32,82,97,105,115,101,32, - 90,105,112,73,109,112,111,114,116,69,114,114,111,114,10,32, - 32,32,32,32,32,32,32,105,102,32,116,104,101,32,109,111, - 100,117,108,101,32,99,111,117,108,100,110,39,116,32,98,101, - 32,102,111,117,110,100,44,32,114,101,116,117,114,110,32,78, - 111,110,101,32,105,102,32,116,104,101,32,97,114,99,104,105, - 118,101,32,100,111,101,115,10,32,32,32,32,32,32,32,32, - 99,111,110,116,97,105,110,32,116,104,101,32,109,111,100,117, - 108,101,44,32,98,117,116,32,104,97,115,32,110,111,32,115, - 111,117,114,99,101,32,102,111,114,32,105,116,46,10,32,32, - 32,32,32,32,32,32,78,250,18,99,97,110,39,116,32,102, - 105,110,100,32,109,111,100,117,108,101,32,169,1,218,4,110, - 97,109,101,250,11,95,95,105,110,105,116,95,95,46,112,121, - 250,3,46,112,121,41,10,114,35,0,0,0,114,3,0,0, - 0,114,36,0,0,0,114,21,0,0,0,114,30,0,0,0, - 114,28,0,0,0,114,26,0,0,0,114,52,0,0,0,114, - 29,0,0,0,218,6,100,101,99,111,100,101,41,6,114,32, - 0,0,0,114,38,0,0,0,114,39,0,0,0,114,13,0, - 0,0,218,8,102,117,108,108,112,97,116,104,114,54,0,0, - 0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, - 218,10,103,101,116,95,115,111,117,114,99,101,195,0,0,0, - 115,26,0,0,0,10,7,8,1,18,1,10,2,4,1,14, - 1,10,2,2,2,14,1,12,1,8,2,16,1,255,128,122, - 22,122,105,112,105,109,112,111,114,116,101,114,46,103,101,116, - 95,115,111,117,114,99,101,99,2,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,4,0,0,0,67,0,0,0, - 115,40,0,0,0,116,0,124,0,124,1,131,2,125,2,124, - 2,100,1,117,0,114,36,116,1,100,2,124,1,155,2,157, - 2,124,1,100,3,141,2,130,1,124,2,83,0,41,4,122, - 171,105,115,95,112,97,99,107,97,103,101,40,102,117,108,108, - 110,97,109,101,41,32,45,62,32,98,111,111,108,46,10,10, - 32,32,32,32,32,32,32,32,82,101,116,117,114,110,32,84, - 114,117,101,32,105,102,32,116,104,101,32,109,111,100,117,108, - 101,32,115,112,101,99,105,102,105,101,100,32,98,121,32,102, - 117,108,108,110,97,109,101,32,105,115,32,97,32,112,97,99, - 107,97,103,101,46,10,32,32,32,32,32,32,32,32,82,97, - 105,115,101,32,90,105,112,73,109,112,111,114,116,69,114,114, - 111,114,32,105,102,32,116,104,101,32,109,111,100,117,108,101, - 32,99,111,117,108,100,110,39,116,32,98,101,32,102,111,117, - 110,100,46,10,32,32,32,32,32,32,32,32,78,114,57,0, - 0,0,114,58,0,0,0,41,2,114,35,0,0,0,114,3, - 0,0,0,41,3,114,32,0,0,0,114,38,0,0,0,114, - 39,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10, - 0,0,0,218,10,105,115,95,112,97,99,107,97,103,101,221, - 0,0,0,115,10,0,0,0,10,6,8,1,18,1,4,1, - 255,128,122,22,122,105,112,105,109,112,111,114,116,101,114,46, - 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, - 0,0,0,0,0,0,0,8,0,0,0,8,0,0,0,67, - 0,0,0,115,246,0,0,0,116,0,124,0,124,1,131,2, - 92,3,125,2,125,3,125,4,116,1,106,2,160,3,124,1, - 161,1,125,5,124,5,100,1,117,0,115,46,116,4,124,5, - 116,5,131,2,115,64,116,5,124,1,131,1,125,5,124,5, - 116,1,106,2,124,1,60,0,124,0,124,5,95,6,122,84, - 124,3,114,108,116,7,124,0,124,1,131,2,125,6,116,8, - 160,9,124,0,106,10,124,6,161,2,125,7,124,7,103,1, - 124,5,95,11,116,12,124,5,100,2,131,2,115,124,116,13, - 124,5,95,13,116,8,160,14,124,5,106,15,124,1,124,4, - 161,3,1,0,116,16,124,2,124,5,106,15,131,2,1,0, - 87,0,110,22,1,0,1,0,1,0,116,1,106,2,124,1, - 61,0,130,0,89,0,110,2,48,0,122,14,116,1,106,2, - 124,1,25,0,125,5,87,0,110,34,4,0,116,17,121,226, - 1,0,1,0,1,0,116,18,100,3,124,1,155,2,100,4, - 157,3,131,1,130,1,89,0,110,2,48,0,116,19,160,20, - 100,5,124,1,124,4,161,3,1,0,124,5,83,0,41,6, - 122,245,108,111,97,100,95,109,111,100,117,108,101,40,102,117, - 108,108,110,97,109,101,41,32,45,62,32,109,111,100,117,108, - 101,46,10,10,32,32,32,32,32,32,32,32,76,111,97,100, - 32,116,104,101,32,109,111,100,117,108,101,32,115,112,101,99, - 105,102,105,101,100,32,98,121,32,39,102,117,108,108,110,97, - 109,101,39,46,32,39,102,117,108,108,110,97,109,101,39,32, - 109,117,115,116,32,98,101,32,116,104,101,10,32,32,32,32, - 32,32,32,32,102,117,108,108,121,32,113,117,97,108,105,102, - 105,101,100,32,40,100,111,116,116,101,100,41,32,109,111,100, - 117,108,101,32,110,97,109,101,46,32,73,116,32,114,101,116, - 117,114,110,115,32,116,104,101,32,105,109,112,111,114,116,101, - 100,10,32,32,32,32,32,32,32,32,109,111,100,117,108,101, - 44,32,111,114,32,114,97,105,115,101,115,32,90,105,112,73, - 109,112,111,114,116,69,114,114,111,114,32,105,102,32,105,116, - 32,119,97,115,110,39,116,32,102,111,117,110,100,46,10,32, - 32,32,32,32,32,32,32,78,218,12,95,95,98,117,105,108, - 116,105,110,115,95,95,122,14,76,111,97,100,101,100,32,109, - 111,100,117,108,101,32,122,25,32,110,111,116,32,102,111,117, - 110,100,32,105,110,32,115,121,115,46,109,111,100,117,108,101, - 115,122,30,105,109,112,111,114,116,32,123,125,32,35,32,108, - 111,97,100,101,100,32,102,114,111,109,32,90,105,112,32,123, - 125,41,21,114,44,0,0,0,218,3,115,121,115,218,7,109, - 111,100,117,108,101,115,218,3,103,101,116,114,15,0,0,0, - 218,12,95,109,111,100,117,108,101,95,116,121,112,101,218,10, - 95,95,108,111,97,100,101,114,95,95,114,36,0,0,0,114, - 21,0,0,0,114,30,0,0,0,114,29,0,0,0,90,8, - 95,95,112,97,116,104,95,95,218,7,104,97,115,97,116,116, - 114,114,66,0,0,0,90,14,95,102,105,120,95,117,112,95, - 109,111,100,117,108,101,218,8,95,95,100,105,99,116,95,95, - 218,4,101,120,101,99,114,26,0,0,0,218,11,73,109,112, - 111,114,116,69,114,114,111,114,218,10,95,98,111,111,116,115, - 116,114,97,112,218,16,95,118,101,114,98,111,115,101,95,109, - 101,115,115,97,103,101,41,8,114,32,0,0,0,114,38,0, - 0,0,114,46,0,0,0,114,47,0,0,0,114,40,0,0, - 0,90,3,109,111,100,114,13,0,0,0,114,63,0,0,0, - 114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218, - 11,108,111,97,100,95,109,111,100,117,108,101,234,0,0,0, - 115,50,0,0,0,16,7,12,1,18,1,8,1,10,1,6, - 1,2,2,4,1,10,3,14,1,8,1,10,2,6,1,16, - 1,16,1,6,1,8,1,8,1,2,2,14,1,12,1,22, - 1,14,1,4,1,255,128,122,23,122,105,112,105,109,112,111, - 114,116,101,114,46,108,111,97,100,95,109,111,100,117,108,101, - 99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,8,0,0,0,67,0,0,0,115,64,0,0,0,122,20, - 124,0,160,0,124,1,161,1,115,18,87,0,100,1,83,0, - 87,0,110,20,4,0,116,1,121,40,1,0,1,0,1,0, - 89,0,100,1,83,0,48,0,100,2,100,3,108,2,109,3, - 125,2,1,0,124,2,124,0,124,1,131,2,83,0,41,4, - 122,204,82,101,116,117,114,110,32,116,104,101,32,82,101,115, - 111,117,114,99,101,82,101,97,100,101,114,32,102,111,114,32, - 97,32,112,97,99,107,97,103,101,32,105,110,32,97,32,122, - 105,112,32,102,105,108,101,46,10,10,32,32,32,32,32,32, - 32,32,73,102,32,39,102,117,108,108,110,97,109,101,39,32, - 105,115,32,97,32,112,97,99,107,97,103,101,32,119,105,116, - 104,105,110,32,116,104,101,32,122,105,112,32,102,105,108,101, - 44,32,114,101,116,117,114,110,32,116,104,101,10,32,32,32, - 32,32,32,32,32,39,82,101,115,111,117,114,99,101,82,101, - 97,100,101,114,39,32,111,98,106,101,99,116,32,102,111,114, - 32,116,104,101,32,112,97,99,107,97,103,101,46,32,32,79, - 116,104,101,114,119,105,115,101,32,114,101,116,117,114,110,32, - 78,111,110,101,46,10,32,32,32,32,32,32,32,32,78,114, - 0,0,0,0,41,1,218,9,90,105,112,82,101,97,100,101, - 114,41,4,114,65,0,0,0,114,3,0,0,0,90,17,105, - 109,112,111,114,116,108,105,98,46,114,101,97,100,101,114,115, - 114,79,0,0,0,41,3,114,32,0,0,0,114,38,0,0, - 0,114,79,0,0,0,114,9,0,0,0,114,9,0,0,0, - 114,10,0,0,0,218,19,103,101,116,95,114,101,115,111,117, - 114,99,101,95,114,101,97,100,101,114,16,1,0,0,115,16, - 0,0,0,2,6,10,1,10,1,12,1,8,1,12,1,10, - 1,255,128,122,31,122,105,112,105,109,112,111,114,116,101,114, - 46,103,101,116,95,114,101,115,111,117,114,99,101,95,114,101, - 97,100,101,114,99,1,0,0,0,0,0,0,0,0,0,0, - 0,1,0,0,0,5,0,0,0,67,0,0,0,115,24,0, - 0,0,100,1,124,0,106,0,155,0,116,1,155,0,124,0, - 106,2,155,0,100,2,157,5,83,0,41,3,78,122,21,60, - 122,105,112,105,109,112,111,114,116,101,114,32,111,98,106,101, - 99,116,32,34,122,2,34,62,41,3,114,29,0,0,0,114, - 20,0,0,0,114,31,0,0,0,41,1,114,32,0,0,0, + 115,32,116,104,101,32,105,109,112,111,114,116,101,100,10,32, + 32,32,32,32,32,32,32,109,111,100,117,108,101,44,32,111, + 114,32,114,97,105,115,101,115,32,90,105,112,73,109,112,111, + 114,116,69,114,114,111,114,32,105,102,32,105,116,32,119,97, + 115,110,39,116,32,102,111,117,110,100,46,10,10,32,32,32, + 32,32,32,32,32,68,101,112,114,101,99,97,116,101,100,32, + 115,105,110,99,101,32,80,121,116,104,111,110,32,51,46,49, + 48,46,32,85,115,101,32,101,120,101,99,95,109,111,100,117, + 108,101,40,41,32,105,110,115,116,101,97,100,46,10,32,32, + 32,32,32,32,32,32,122,114,122,105,112,105,109,112,111,114, + 116,46,122,105,112,105,109,112,111,114,116,101,114,46,108,111, + 97,100,95,109,111,100,117,108,101,40,41,32,105,115,32,100, + 101,112,114,101,99,97,116,101,100,32,97,110,100,32,115,108, + 97,116,101,100,32,102,111,114,32,114,101,109,111,118,97,108, + 32,105,110,32,80,121,116,104,111,110,32,51,46,49,50,59, + 32,117,115,101,32,101,120,101,99,95,109,111,100,117,108,101, + 40,41,32,105,110,115,116,101,97,100,78,218,12,95,95,98, + 117,105,108,116,105,110,115,95,95,122,14,76,111,97,100,101, + 100,32,109,111,100,117,108,101,32,122,25,32,110,111,116,32, + 102,111,117,110,100,32,105,110,32,115,121,115,46,109,111,100, + 117,108,101,115,122,30,105,109,112,111,114,116,32,123,125,32, + 35,32,108,111,97,100,101,100,32,102,114,111,109,32,90,105, + 112,32,123,125,41,24,218,9,95,119,97,114,110,105,110,103, + 115,90,4,119,97,114,110,218,18,68,101,112,114,101,99,97, + 116,105,111,110,87,97,114,110,105,110,103,114,48,0,0,0, + 218,3,115,121,115,218,7,109,111,100,117,108,101,115,218,3, + 103,101,116,114,15,0,0,0,218,12,95,109,111,100,117,108, + 101,95,116,121,112,101,218,10,95,95,108,111,97,100,101,114, + 95,95,114,36,0,0,0,114,21,0,0,0,114,30,0,0, + 0,114,29,0,0,0,90,8,95,95,112,97,116,104,95,95, + 218,7,104,97,115,97,116,116,114,114,68,0,0,0,90,14, + 95,102,105,120,95,117,112,95,109,111,100,117,108,101,218,8, + 95,95,100,105,99,116,95,95,218,4,101,120,101,99,114,26, + 0,0,0,218,11,73,109,112,111,114,116,69,114,114,111,114, + 114,45,0,0,0,218,16,95,118,101,114,98,111,115,101,95, + 109,101,115,115,97,103,101,41,9,114,32,0,0,0,114,38, + 0,0,0,218,3,109,115,103,114,50,0,0,0,114,51,0, + 0,0,114,40,0,0,0,90,3,109,111,100,114,13,0,0, + 0,114,66,0,0,0,114,9,0,0,0,114,9,0,0,0, + 114,10,0,0,0,218,11,108,111,97,100,95,109,111,100,117, + 108,101,9,1,0,0,115,54,0,0,0,4,9,12,2,16, + 1,12,1,18,1,8,1,10,1,6,1,2,2,4,1,10, + 3,14,1,8,1,10,2,6,1,16,1,16,1,6,1,8, + 1,2,1,2,2,14,1,12,1,18,1,14,1,4,1,255, + 128,122,23,122,105,112,105,109,112,111,114,116,101,114,46,108, + 111,97,100,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,0,0,0,0,3,0,0,0,8,0,0,0,67, + 0,0,0,115,64,0,0,0,122,20,124,0,160,0,124,1, + 161,1,115,18,87,0,100,1,83,0,87,0,110,20,4,0, + 116,1,121,40,1,0,1,0,1,0,89,0,100,1,83,0, + 48,0,100,2,100,3,108,2,109,3,125,2,1,0,124,2, + 124,0,124,1,131,2,83,0,41,4,122,204,82,101,116,117, + 114,110,32,116,104,101,32,82,101,115,111,117,114,99,101,82, + 101,97,100,101,114,32,102,111,114,32,97,32,112,97,99,107, + 97,103,101,32,105,110,32,97,32,122,105,112,32,102,105,108, + 101,46,10,10,32,32,32,32,32,32,32,32,73,102,32,39, + 102,117,108,108,110,97,109,101,39,32,105,115,32,97,32,112, + 97,99,107,97,103,101,32,119,105,116,104,105,110,32,116,104, + 101,32,122,105,112,32,102,105,108,101,44,32,114,101,116,117, + 114,110,32,116,104,101,10,32,32,32,32,32,32,32,32,39, + 82,101,115,111,117,114,99,101,82,101,97,100,101,114,39,32, + 111,98,106,101,99,116,32,102,111,114,32,116,104,101,32,112, + 97,99,107,97,103,101,46,32,32,79,116,104,101,114,119,105, + 115,101,32,114,101,116,117,114,110,32,78,111,110,101,46,10, + 32,32,32,32,32,32,32,32,78,114,0,0,0,0,41,1, + 218,9,90,105,112,82,101,97,100,101,114,41,4,114,43,0, + 0,0,114,3,0,0,0,90,17,105,109,112,111,114,116,108, + 105,98,46,114,101,97,100,101,114,115,114,83,0,0,0,41, + 3,114,32,0,0,0,114,38,0,0,0,114,83,0,0,0, 114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218, - 8,95,95,114,101,112,114,95,95,31,1,0,0,115,4,0, - 0,0,24,1,255,128,122,20,122,105,112,105,109,112,111,114, - 116,101,114,46,95,95,114,101,112,114,95,95,41,1,78,41, - 1,78,41,15,114,6,0,0,0,114,7,0,0,0,114,8, - 0,0,0,218,7,95,95,100,111,99,95,95,114,34,0,0, - 0,114,41,0,0,0,114,42,0,0,0,114,48,0,0,0, - 114,55,0,0,0,114,56,0,0,0,114,64,0,0,0,114, - 65,0,0,0,114,78,0,0,0,114,80,0,0,0,114,81, - 0,0,0,114,9,0,0,0,114,9,0,0,0,114,9,0, - 0,0,114,10,0,0,0,114,4,0,0,0,45,0,0,0, - 115,28,0,0,0,8,0,4,1,8,17,10,46,10,32,8, - 12,8,10,8,21,8,11,8,26,8,13,8,38,12,15,255, - 128,122,12,95,95,105,110,105,116,95,95,46,112,121,99,84, - 114,60,0,0,0,70,41,3,122,4,46,112,121,99,84,70, - 41,3,114,61,0,0,0,70,70,99,2,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,4,0,0,0,67,0, - 0,0,115,20,0,0,0,124,0,106,0,124,1,160,1,100, - 1,161,1,100,2,25,0,23,0,83,0,41,3,78,218,1, - 46,233,2,0,0,0,41,2,114,31,0,0,0,218,10,114, - 112,97,114,116,105,116,105,111,110,41,2,114,32,0,0,0, - 114,38,0,0,0,114,9,0,0,0,114,9,0,0,0,114, - 10,0,0,0,114,36,0,0,0,49,1,0,0,115,4,0, - 0,0,20,1,255,128,114,36,0,0,0,99,2,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0, - 67,0,0,0,115,18,0,0,0,124,1,116,0,23,0,125, - 2,124,2,124,0,106,1,118,0,83,0,169,1,78,41,2, - 114,20,0,0,0,114,28,0,0,0,41,3,114,32,0,0, - 0,114,13,0,0,0,90,7,100,105,114,112,97,116,104,114, - 9,0,0,0,114,9,0,0,0,114,10,0,0,0,114,37, - 0,0,0,53,1,0,0,115,6,0,0,0,8,4,10,2, - 255,128,114,37,0,0,0,99,2,0,0,0,0,0,0,0, - 0,0,0,0,7,0,0,0,4,0,0,0,67,0,0,0, - 115,54,0,0,0,116,0,124,0,124,1,131,2,125,2,116, - 1,68,0,93,34,92,3,125,3,125,4,125,5,124,2,124, - 3,23,0,125,6,124,6,124,0,106,2,118,0,114,14,124, - 5,2,0,1,0,83,0,100,0,83,0,114,86,0,0,0, - 41,3,114,36,0,0,0,218,16,95,122,105,112,95,115,101, - 97,114,99,104,111,114,100,101,114,114,28,0,0,0,41,7, - 114,32,0,0,0,114,38,0,0,0,114,13,0,0,0,218, - 6,115,117,102,102,105,120,218,10,105,115,98,121,116,101,99, - 111,100,101,114,47,0,0,0,114,63,0,0,0,114,9,0, - 0,0,114,9,0,0,0,114,10,0,0,0,114,35,0,0, - 0,62,1,0,0,115,14,0,0,0,10,1,14,1,8,1, - 10,1,8,1,4,1,255,128,114,35,0,0,0,99,1,0, - 0,0,0,0,0,0,0,0,0,0,26,0,0,0,9,0, - 0,0,67,0,0,0,115,2,5,0,0,122,14,116,0,160, - 1,124,0,161,1,125,1,87,0,110,36,4,0,116,2,121, - 50,1,0,1,0,1,0,116,3,100,1,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,89,0,110,2,48,0,124, - 1,144,4,143,164,1,0,122,36,124,1,160,4,116,5,11, + 19,103,101,116,95,114,101,115,111,117,114,99,101,95,114,101, + 97,100,101,114,52,1,0,0,115,16,0,0,0,2,6,10, + 1,10,1,12,1,8,1,12,1,10,1,255,128,122,31,122, + 105,112,105,109,112,111,114,116,101,114,46,103,101,116,95,114, + 101,115,111,117,114,99,101,95,114,101,97,100,101,114,99,1, + 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5, + 0,0,0,67,0,0,0,115,24,0,0,0,100,1,124,0, + 106,0,155,0,116,1,155,0,124,0,106,2,155,0,100,2, + 157,5,83,0,41,3,78,122,21,60,122,105,112,105,109,112, + 111,114,116,101,114,32,111,98,106,101,99,116,32,34,122,2, + 34,62,41,3,114,29,0,0,0,114,20,0,0,0,114,31, + 0,0,0,41,1,114,32,0,0,0,114,9,0,0,0,114, + 9,0,0,0,114,10,0,0,0,218,8,95,95,114,101,112, + 114,95,95,67,1,0,0,115,4,0,0,0,24,1,255,128, + 122,20,122,105,112,105,109,112,111,114,116,101,114,46,95,95, + 114,101,112,114,95,95,41,1,78,41,1,78,41,1,78,41, + 16,114,6,0,0,0,114,7,0,0,0,114,8,0,0,0, + 218,7,95,95,100,111,99,95,95,114,34,0,0,0,114,41, + 0,0,0,114,42,0,0,0,114,46,0,0,0,114,52,0, + 0,0,114,59,0,0,0,114,60,0,0,0,114,67,0,0, + 0,114,43,0,0,0,114,82,0,0,0,114,84,0,0,0, + 114,85,0,0,0,114,9,0,0,0,114,9,0,0,0,114, + 9,0,0,0,114,10,0,0,0,114,4,0,0,0,46,0, + 0,0,115,30,0,0,0,8,0,4,1,8,17,10,46,10, + 34,10,13,8,27,8,10,8,21,8,11,8,26,8,13,8, + 43,12,15,255,128,122,12,95,95,105,110,105,116,95,95,46, + 112,121,99,84,114,63,0,0,0,70,41,3,122,4,46,112, + 121,99,84,70,41,3,114,64,0,0,0,70,70,99,2,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,20,0,0,0,124,0,106,0,124, + 1,160,1,100,1,161,1,100,2,25,0,23,0,83,0,41, + 3,78,218,1,46,233,2,0,0,0,41,2,114,31,0,0, + 0,218,10,114,112,97,114,116,105,116,105,111,110,41,2,114, + 32,0,0,0,114,38,0,0,0,114,9,0,0,0,114,9, + 0,0,0,114,10,0,0,0,114,36,0,0,0,85,1,0, + 0,115,4,0,0,0,20,1,255,128,114,36,0,0,0,99, + 2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 2,0,0,0,67,0,0,0,115,18,0,0,0,124,1,116, + 0,23,0,125,2,124,2,124,0,106,1,118,0,83,0,169, + 1,78,41,2,114,20,0,0,0,114,28,0,0,0,41,3, + 114,32,0,0,0,114,13,0,0,0,90,7,100,105,114,112, + 97,116,104,114,9,0,0,0,114,9,0,0,0,114,10,0, + 0,0,114,37,0,0,0,89,1,0,0,115,6,0,0,0, + 8,4,10,2,255,128,114,37,0,0,0,99,2,0,0,0, + 0,0,0,0,0,0,0,0,7,0,0,0,4,0,0,0, + 67,0,0,0,115,54,0,0,0,116,0,124,0,124,1,131, + 2,125,2,116,1,68,0,93,34,92,3,125,3,125,4,125, + 5,124,2,124,3,23,0,125,6,124,6,124,0,106,2,118, + 0,114,14,124,5,2,0,1,0,83,0,100,0,83,0,114, + 90,0,0,0,41,3,114,36,0,0,0,218,16,95,122,105, + 112,95,115,101,97,114,99,104,111,114,100,101,114,114,28,0, + 0,0,41,7,114,32,0,0,0,114,38,0,0,0,114,13, + 0,0,0,218,6,115,117,102,102,105,120,218,10,105,115,98, + 121,116,101,99,111,100,101,114,51,0,0,0,114,66,0,0, + 0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, + 114,35,0,0,0,98,1,0,0,115,14,0,0,0,10,1, + 14,1,8,1,10,1,8,1,4,1,255,128,114,35,0,0, + 0,99,1,0,0,0,0,0,0,0,0,0,0,0,26,0, + 0,0,9,0,0,0,67,0,0,0,115,230,4,0,0,122, + 14,116,0,160,1,124,0,161,1,125,1,87,0,110,32,4, + 0,116,2,121,46,1,0,1,0,1,0,116,3,100,1,124, + 0,155,2,157,2,124,0,100,2,141,2,130,1,48,0,124, + 1,144,4,143,140,1,0,122,36,124,1,160,4,116,5,11, 0,100,3,161,2,1,0,124,1,160,6,161,0,125,2,124, - 1,160,7,116,5,161,1,125,3,87,0,110,36,4,0,116, - 2,121,132,1,0,1,0,1,0,116,3,100,4,124,0,155, - 2,157,2,124,0,100,2,141,2,130,1,89,0,110,2,48, - 0,116,8,124,3,131,1,116,5,107,3,114,164,116,3,100, - 4,124,0,155,2,157,2,124,0,100,2,141,2,130,1,124, - 3,100,0,100,5,133,2,25,0,116,9,107,3,144,1,114, - 170,122,24,124,1,160,4,100,6,100,3,161,2,1,0,124, - 1,160,6,161,0,125,4,87,0,110,36,4,0,116,2,121, - 242,1,0,1,0,1,0,116,3,100,4,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,89,0,110,2,48,0,116, - 10,124,4,116,11,24,0,116,5,24,0,100,6,131,2,125, - 5,122,22,124,1,160,4,124,5,161,1,1,0,124,1,160, - 7,161,0,125,6,87,0,110,38,4,0,116,2,144,1,121, - 66,1,0,1,0,1,0,116,3,100,4,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,89,0,110,2,48,0,124, - 6,160,12,116,9,161,1,125,7,124,7,100,6,107,0,144, - 1,114,106,116,3,100,7,124,0,155,2,157,2,124,0,100, - 2,141,2,130,1,124,6,124,7,124,7,116,5,23,0,133, - 2,25,0,125,3,116,8,124,3,131,1,116,5,107,3,144, - 1,114,154,116,3,100,8,124,0,155,2,157,2,124,0,100, - 2,141,2,130,1,124,4,116,8,124,6,131,1,24,0,124, - 7,23,0,125,2,116,13,124,3,100,9,100,10,133,2,25, - 0,131,1,125,8,116,13,124,3,100,10,100,11,133,2,25, - 0,131,1,125,9,124,2,124,8,107,0,144,1,114,230,116, - 3,100,12,124,0,155,2,157,2,124,0,100,2,141,2,130, - 1,124,2,124,9,107,0,144,2,114,2,116,3,100,13,124, - 0,155,2,157,2,124,0,100,2,141,2,130,1,124,2,124, - 8,56,0,125,2,124,2,124,9,24,0,125,10,124,10,100, - 6,107,0,144,2,114,46,116,3,100,14,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,105,0,125,11,100,6,125, - 12,122,14,124,1,160,4,124,2,161,1,1,0,87,0,110, - 38,4,0,116,2,144,2,121,106,1,0,1,0,1,0,116, + 1,160,7,116,5,161,1,125,3,87,0,110,32,4,0,116, + 2,121,124,1,0,1,0,1,0,116,3,100,4,124,0,155, + 2,157,2,124,0,100,2,141,2,130,1,48,0,116,8,124, + 3,131,1,116,5,107,3,114,156,116,3,100,4,124,0,155, + 2,157,2,124,0,100,2,141,2,130,1,124,3,100,0,100, + 5,133,2,25,0,116,9,107,3,144,1,114,154,122,24,124, + 1,160,4,100,6,100,3,161,2,1,0,124,1,160,6,161, + 0,125,4,87,0,110,32,4,0,116,2,121,230,1,0,1, + 0,1,0,116,3,100,4,124,0,155,2,157,2,124,0,100, + 2,141,2,130,1,48,0,116,10,124,4,116,11,24,0,116, + 5,24,0,100,6,131,2,125,5,122,22,124,1,160,4,124, + 5,161,1,1,0,124,1,160,7,161,0,125,6,87,0,110, + 34,4,0,116,2,144,1,121,50,1,0,1,0,1,0,116, 3,100,4,124,0,155,2,157,2,124,0,100,2,141,2,130, - 1,89,0,110,2,48,0,124,1,160,7,100,15,161,1,125, - 3,116,8,124,3,131,1,100,5,107,0,144,2,114,140,116, + 1,48,0,124,6,160,12,116,9,161,1,125,7,124,7,100, + 6,107,0,144,1,114,90,116,3,100,7,124,0,155,2,157, + 2,124,0,100,2,141,2,130,1,124,6,124,7,124,7,116, + 5,23,0,133,2,25,0,125,3,116,8,124,3,131,1,116, + 5,107,3,144,1,114,138,116,3,100,8,124,0,155,2,157, + 2,124,0,100,2,141,2,130,1,124,4,116,8,124,6,131, + 1,24,0,124,7,23,0,125,2,116,13,124,3,100,9,100, + 10,133,2,25,0,131,1,125,8,116,13,124,3,100,10,100, + 11,133,2,25,0,131,1,125,9,124,2,124,8,107,0,144, + 1,114,214,116,3,100,12,124,0,155,2,157,2,124,0,100, + 2,141,2,130,1,124,2,124,9,107,0,144,1,114,242,116, + 3,100,13,124,0,155,2,157,2,124,0,100,2,141,2,130, + 1,124,2,124,8,56,0,125,2,124,2,124,9,24,0,125, + 10,124,10,100,6,107,0,144,2,114,30,116,3,100,14,124, + 0,155,2,157,2,124,0,100,2,141,2,130,1,105,0,125, + 11,100,6,125,12,122,14,124,1,160,4,124,2,161,1,1, + 0,87,0,110,34,4,0,116,2,144,2,121,86,1,0,1, + 0,1,0,116,3,100,4,124,0,155,2,157,2,124,0,100, + 2,141,2,130,1,48,0,124,1,160,7,100,15,161,1,125, + 3,116,8,124,3,131,1,100,5,107,0,144,2,114,120,116, 14,100,16,131,1,130,1,124,3,100,0,100,5,133,2,25, - 0,100,17,107,3,144,2,114,162,144,4,113,208,116,8,124, - 3,131,1,100,15,107,3,144,2,114,184,116,14,100,16,131, + 0,100,17,107,3,144,2,114,142,144,4,113,180,116,8,124, + 3,131,1,100,15,107,3,144,2,114,164,116,14,100,16,131, 1,130,1,116,15,124,3,100,18,100,19,133,2,25,0,131, 1,125,13,116,15,124,3,100,19,100,9,133,2,25,0,131, 1,125,14,116,15,124,3,100,9,100,20,133,2,25,0,131, @@ -574,392 +629,391 @@ const unsigned char _Py_M__zipimport[] = { 1,125,20,116,15,124,3,100,24,100,25,133,2,25,0,131, 1,125,21,116,13,124,3,100,26,100,15,133,2,25,0,131, 1,125,22,124,19,124,20,23,0,124,21,23,0,125,8,124, - 22,124,9,107,4,144,3,114,144,116,3,100,27,124,0,155, + 22,124,9,107,4,144,3,114,124,116,3,100,27,124,0,155, 2,157,2,124,0,100,2,141,2,130,1,124,22,124,10,55, 0,125,22,122,14,124,1,160,7,124,19,161,1,125,23,87, - 0,110,38,4,0,116,2,144,3,121,204,1,0,1,0,1, + 0,110,34,4,0,116,2,144,3,121,180,1,0,1,0,1, 0,116,3,100,4,124,0,155,2,157,2,124,0,100,2,141, - 2,130,1,89,0,110,2,48,0,116,8,124,23,131,1,124, - 19,107,3,144,3,114,238,116,3,100,4,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,122,50,116,8,124,1,160, - 7,124,8,124,19,24,0,161,1,131,1,124,8,124,19,24, - 0,107,3,144,4,114,30,116,3,100,4,124,0,155,2,157, - 2,124,0,100,2,141,2,130,1,87,0,110,38,4,0,116, - 2,144,4,121,70,1,0,1,0,1,0,116,3,100,4,124, - 0,155,2,157,2,124,0,100,2,141,2,130,1,89,0,110, - 2,48,0,124,13,100,28,64,0,144,4,114,92,124,23,160, - 16,161,0,125,23,110,52,122,14,124,23,160,16,100,29,161, - 1,125,23,87,0,110,36,4,0,116,17,144,4,121,142,1, - 0,1,0,1,0,124,23,160,16,100,30,161,1,160,18,116, - 19,161,1,125,23,89,0,110,2,48,0,124,23,160,20,100, - 31,116,21,161,2,125,23,116,22,160,23,124,0,124,23,161, - 2,125,24,124,24,124,14,124,18,124,4,124,22,124,15,124, - 16,124,17,102,8,125,25,124,25,124,11,124,23,60,0,124, - 12,100,32,55,0,125,12,144,2,113,108,87,0,100,0,4, - 0,4,0,131,3,1,0,110,18,49,0,144,4,115,230,48, - 0,1,0,1,0,1,0,89,0,1,0,116,24,160,25,100, - 33,124,12,124,0,161,3,1,0,124,11,83,0,41,34,78, - 122,21,99,97,110,39,116,32,111,112,101,110,32,90,105,112, - 32,102,105,108,101,58,32,114,12,0,0,0,114,84,0,0, - 0,250,21,99,97,110,39,116,32,114,101,97,100,32,90,105, - 112,32,102,105,108,101,58,32,233,4,0,0,0,114,0,0, - 0,0,122,16,110,111,116,32,97,32,90,105,112,32,102,105, - 108,101,58,32,122,18,99,111,114,114,117,112,116,32,90,105, - 112,32,102,105,108,101,58,32,233,12,0,0,0,233,16,0, - 0,0,233,20,0,0,0,122,28,98,97,100,32,99,101,110, - 116,114,97,108,32,100,105,114,101,99,116,111,114,121,32,115, - 105,122,101,58,32,122,30,98,97,100,32,99,101,110,116,114, - 97,108,32,100,105,114,101,99,116,111,114,121,32,111,102,102, - 115,101,116,58,32,122,38,98,97,100,32,99,101,110,116,114, - 97,108,32,100,105,114,101,99,116,111,114,121,32,115,105,122, - 101,32,111,114,32,111,102,102,115,101,116,58,32,233,46,0, - 0,0,250,27,69,79,70,32,114,101,97,100,32,119,104,101, - 114,101,32,110,111,116,32,101,120,112,101,99,116,101,100,115, - 4,0,0,0,80,75,1,2,233,8,0,0,0,233,10,0, - 0,0,233,14,0,0,0,233,24,0,0,0,233,28,0,0, - 0,233,30,0,0,0,233,32,0,0,0,233,34,0,0,0, - 233,42,0,0,0,122,25,98,97,100,32,108,111,99,97,108, - 32,104,101,97,100,101,114,32,111,102,102,115,101,116,58,32, - 105,0,8,0,0,218,5,97,115,99,105,105,90,6,108,97, - 116,105,110,49,250,1,47,114,5,0,0,0,122,33,122,105, - 112,105,109,112,111,114,116,58,32,102,111,117,110,100,32,123, - 125,32,110,97,109,101,115,32,105,110,32,123,33,114,125,41, - 26,218,3,95,105,111,218,9,111,112,101,110,95,99,111,100, - 101,114,22,0,0,0,114,3,0,0,0,218,4,115,101,101, - 107,218,20,69,78,68,95,67,69,78,84,82,65,76,95,68, - 73,82,95,83,73,90,69,90,4,116,101,108,108,218,4,114, - 101,97,100,114,51,0,0,0,218,18,83,84,82,73,78,71, - 95,69,78,68,95,65,82,67,72,73,86,69,218,3,109,97, - 120,218,15,77,65,88,95,67,79,77,77,69,78,84,95,76, - 69,78,218,5,114,102,105,110,100,114,2,0,0,0,218,8, - 69,79,70,69,114,114,111,114,114,1,0,0,0,114,62,0, - 0,0,218,18,85,110,105,99,111,100,101,68,101,99,111,100, - 101,69,114,114,111,114,218,9,116,114,97,110,115,108,97,116, - 101,218,11,99,112,52,51,55,95,116,97,98,108,101,114,19, - 0,0,0,114,20,0,0,0,114,21,0,0,0,114,30,0, - 0,0,114,76,0,0,0,114,77,0,0,0,41,26,114,29, - 0,0,0,218,2,102,112,90,15,104,101,97,100,101,114,95, - 112,111,115,105,116,105,111,110,218,6,98,117,102,102,101,114, - 218,9,102,105,108,101,95,115,105,122,101,90,17,109,97,120, - 95,99,111,109,109,101,110,116,95,115,116,97,114,116,218,4, - 100,97,116,97,90,3,112,111,115,218,11,104,101,97,100,101, - 114,95,115,105,122,101,90,13,104,101,97,100,101,114,95,111, - 102,102,115,101,116,90,10,97,114,99,95,111,102,102,115,101, - 116,114,33,0,0,0,218,5,99,111,117,110,116,218,5,102, - 108,97,103,115,218,8,99,111,109,112,114,101,115,115,218,4, - 116,105,109,101,218,4,100,97,116,101,218,3,99,114,99,218, - 9,100,97,116,97,95,115,105,122,101,218,9,110,97,109,101, - 95,115,105,122,101,218,10,101,120,116,114,97,95,115,105,122, - 101,90,12,99,111,109,109,101,110,116,95,115,105,122,101,218, - 11,102,105,108,101,95,111,102,102,115,101,116,114,59,0,0, - 0,114,13,0,0,0,218,1,116,114,9,0,0,0,114,9, - 0,0,0,114,10,0,0,0,114,27,0,0,0,93,1,0, - 0,115,214,0,0,0,2,1,14,1,12,1,24,1,8,2, - 2,1,14,1,8,1,14,1,12,1,24,1,12,1,18,1, - 18,1,2,3,12,1,12,1,12,1,10,1,2,1,12,255, - 8,2,2,1,2,255,2,1,4,255,2,2,10,1,12,1, - 14,1,10,1,2,1,12,255,10,2,10,1,10,1,2,1, - 6,255,16,2,14,1,10,1,2,1,6,255,16,2,16,2, - 16,1,10,1,18,1,10,1,18,1,8,1,8,1,10,1, - 18,1,4,2,4,2,2,1,14,1,14,1,24,1,10,2, - 14,1,8,1,18,2,4,1,14,1,8,1,16,1,16,1, - 16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1, - 16,1,12,1,10,1,18,1,8,1,2,2,14,1,14,1, - 24,1,14,1,18,1,2,4,28,1,22,1,14,1,24,1, - 10,2,10,2,2,3,14,1,14,1,22,1,12,2,12,1, - 20,1,8,1,44,1,14,1,4,1,255,128,114,27,0,0, - 0,117,190,1,0,0,0,1,2,3,4,5,6,7,8,9, - 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, - 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, - 42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57, - 58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73, - 74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89, - 90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105, - 106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121, - 122,123,124,125,126,127,195,135,195,188,195,169,195,162,195,164, - 195,160,195,165,195,167,195,170,195,171,195,168,195,175,195,174, - 195,172,195,132,195,133,195,137,195,166,195,134,195,180,195,182, - 195,178,195,187,195,185,195,191,195,150,195,156,194,162,194,163, - 194,165,226,130,167,198,146,195,161,195,173,195,179,195,186,195, - 177,195,145,194,170,194,186,194,191,226,140,144,194,172,194,189, - 194,188,194,161,194,171,194,187,226,150,145,226,150,146,226,150, - 147,226,148,130,226,148,164,226,149,161,226,149,162,226,149,150, - 226,149,149,226,149,163,226,149,145,226,149,151,226,149,157,226, - 149,156,226,149,155,226,148,144,226,148,148,226,148,180,226,148, - 172,226,148,156,226,148,128,226,148,188,226,149,158,226,149,159, - 226,149,154,226,149,148,226,149,169,226,149,166,226,149,160,226, - 149,144,226,149,172,226,149,167,226,149,168,226,149,164,226,149, - 165,226,149,153,226,149,152,226,149,146,226,149,147,226,149,171, - 226,149,170,226,148,152,226,148,140,226,150,136,226,150,132,226, - 150,140,226,150,144,226,150,128,206,177,195,159,206,147,207,128, - 206,163,207,131,194,181,207,132,206,166,206,152,206,169,206,180, - 226,136,158,207,134,206,181,226,136,169,226,137,161,194,177,226, - 137,165,226,137,164,226,140,160,226,140,161,195,183,226,137,136, - 194,176,226,136,153,194,183,226,136,154,226,129,191,194,178,226, - 150,160,194,160,99,0,0,0,0,0,0,0,0,0,0,0, - 0,1,0,0,0,8,0,0,0,67,0,0,0,115,110,0, - 0,0,116,0,114,22,116,1,160,2,100,1,161,1,1,0, - 116,3,100,2,131,1,130,1,100,3,97,0,122,62,122,16, - 100,4,100,5,108,4,109,5,125,0,1,0,87,0,110,36, - 4,0,116,6,121,80,1,0,1,0,1,0,116,1,160,2, - 100,1,161,1,1,0,116,3,100,2,131,1,130,1,89,0, - 110,2,48,0,87,0,100,6,97,0,110,6,100,6,97,0, - 48,0,116,1,160,2,100,7,161,1,1,0,124,0,83,0, - 41,8,78,122,27,122,105,112,105,109,112,111,114,116,58,32, - 122,108,105,98,32,85,78,65,86,65,73,76,65,66,76,69, - 250,41,99,97,110,39,116,32,100,101,99,111,109,112,114,101, - 115,115,32,100,97,116,97,59,32,122,108,105,98,32,110,111, - 116,32,97,118,97,105,108,97,98,108,101,84,114,0,0,0, - 0,169,1,218,10,100,101,99,111,109,112,114,101,115,115,70, - 122,25,122,105,112,105,109,112,111,114,116,58,32,122,108,105, - 98,32,97,118,97,105,108,97,98,108,101,41,7,218,15,95, - 105,109,112,111,114,116,105,110,103,95,122,108,105,98,114,76, - 0,0,0,114,77,0,0,0,114,3,0,0,0,90,4,122, - 108,105,98,114,139,0,0,0,218,9,69,120,99,101,112,116, - 105,111,110,114,138,0,0,0,114,9,0,0,0,114,9,0, - 0,0,114,10,0,0,0,218,20,95,103,101,116,95,100,101, - 99,111,109,112,114,101,115,115,95,102,117,110,99,251,1,0, - 0,115,26,0,0,0,4,2,10,3,8,1,4,2,4,1, - 16,1,12,1,10,1,16,1,12,2,10,2,4,1,255,128, - 114,142,0,0,0,99,2,0,0,0,0,0,0,0,0,0, - 0,0,17,0,0,0,9,0,0,0,67,0,0,0,115,144, - 1,0,0,124,1,92,8,125,2,125,3,125,4,125,5,125, - 6,125,7,125,8,125,9,124,4,100,1,107,0,114,36,116, - 0,100,2,131,1,130,1,116,1,160,2,124,0,161,1,144, - 1,143,14,125,10,122,14,124,10,160,3,124,6,161,1,1, - 0,87,0,110,36,4,0,116,4,121,100,1,0,1,0,1, - 0,116,0,100,3,124,0,155,2,157,2,124,0,100,4,141, - 2,130,1,89,0,110,2,48,0,124,10,160,5,100,5,161, - 1,125,11,116,6,124,11,131,1,100,5,107,3,114,132,116, + 2,130,1,48,0,116,8,124,23,131,1,124,19,107,3,144, + 3,114,214,116,3,100,4,124,0,155,2,157,2,124,0,100, + 2,141,2,130,1,122,50,116,8,124,1,160,7,124,8,124, + 19,24,0,161,1,131,1,124,8,124,19,24,0,107,3,144, + 4,114,6,116,3,100,4,124,0,155,2,157,2,124,0,100, + 2,141,2,130,1,87,0,110,34,4,0,116,2,144,4,121, + 42,1,0,1,0,1,0,116,3,100,4,124,0,155,2,157, + 2,124,0,100,2,141,2,130,1,48,0,124,13,100,28,64, + 0,144,4,114,64,124,23,160,16,161,0,125,23,110,52,122, + 14,124,23,160,16,100,29,161,1,125,23,87,0,110,36,4, + 0,116,17,144,4,121,114,1,0,1,0,1,0,124,23,160, + 16,100,30,161,1,160,18,116,19,161,1,125,23,89,0,110, + 2,48,0,124,23,160,20,100,31,116,21,161,2,125,23,116, + 22,160,23,124,0,124,23,161,2,125,24,124,24,124,14,124, + 18,124,4,124,22,124,15,124,16,124,17,102,8,125,25,124, + 25,124,11,124,23,60,0,124,12,100,32,55,0,125,12,144, + 2,113,88,87,0,100,0,4,0,4,0,131,3,1,0,110, + 18,49,0,144,4,115,202,48,0,1,0,1,0,1,0,89, + 0,1,0,116,24,160,25,100,33,124,12,124,0,161,3,1, + 0,124,11,83,0,41,34,78,122,21,99,97,110,39,116,32, + 111,112,101,110,32,90,105,112,32,102,105,108,101,58,32,114, + 12,0,0,0,114,88,0,0,0,250,21,99,97,110,39,116, + 32,114,101,97,100,32,90,105,112,32,102,105,108,101,58,32, + 233,4,0,0,0,114,0,0,0,0,122,16,110,111,116,32, + 97,32,90,105,112,32,102,105,108,101,58,32,122,18,99,111, + 114,114,117,112,116,32,90,105,112,32,102,105,108,101,58,32, + 233,12,0,0,0,233,16,0,0,0,233,20,0,0,0,122, + 28,98,97,100,32,99,101,110,116,114,97,108,32,100,105,114, + 101,99,116,111,114,121,32,115,105,122,101,58,32,122,30,98, + 97,100,32,99,101,110,116,114,97,108,32,100,105,114,101,99, + 116,111,114,121,32,111,102,102,115,101,116,58,32,122,38,98, + 97,100,32,99,101,110,116,114,97,108,32,100,105,114,101,99, + 116,111,114,121,32,115,105,122,101,32,111,114,32,111,102,102, + 115,101,116,58,32,233,46,0,0,0,250,27,69,79,70,32, + 114,101,97,100,32,119,104,101,114,101,32,110,111,116,32,101, + 120,112,101,99,116,101,100,115,4,0,0,0,80,75,1,2, + 233,8,0,0,0,233,10,0,0,0,233,14,0,0,0,233, + 24,0,0,0,233,28,0,0,0,233,30,0,0,0,233,32, + 0,0,0,233,34,0,0,0,233,42,0,0,0,122,25,98, + 97,100,32,108,111,99,97,108,32,104,101,97,100,101,114,32, + 111,102,102,115,101,116,58,32,105,0,8,0,0,218,5,97, + 115,99,105,105,90,6,108,97,116,105,110,49,250,1,47,114, + 5,0,0,0,122,33,122,105,112,105,109,112,111,114,116,58, + 32,102,111,117,110,100,32,123,125,32,110,97,109,101,115,32, + 105,110,32,123,33,114,125,41,26,218,3,95,105,111,218,9, + 111,112,101,110,95,99,111,100,101,114,22,0,0,0,114,3, + 0,0,0,218,4,115,101,101,107,218,20,69,78,68,95,67, + 69,78,84,82,65,76,95,68,73,82,95,83,73,90,69,90, + 4,116,101,108,108,218,4,114,101,97,100,114,55,0,0,0, + 218,18,83,84,82,73,78,71,95,69,78,68,95,65,82,67, + 72,73,86,69,218,3,109,97,120,218,15,77,65,88,95,67, + 79,77,77,69,78,84,95,76,69,78,218,5,114,102,105,110, + 100,114,2,0,0,0,218,8,69,79,70,69,114,114,111,114, + 114,1,0,0,0,114,65,0,0,0,218,18,85,110,105,99, + 111,100,101,68,101,99,111,100,101,69,114,114,111,114,218,9, + 116,114,97,110,115,108,97,116,101,218,11,99,112,52,51,55, + 95,116,97,98,108,101,114,19,0,0,0,114,20,0,0,0, + 114,21,0,0,0,114,30,0,0,0,114,45,0,0,0,114, + 80,0,0,0,41,26,114,29,0,0,0,218,2,102,112,90, + 15,104,101,97,100,101,114,95,112,111,115,105,116,105,111,110, + 218,6,98,117,102,102,101,114,218,9,102,105,108,101,95,115, + 105,122,101,90,17,109,97,120,95,99,111,109,109,101,110,116, + 95,115,116,97,114,116,218,4,100,97,116,97,90,3,112,111, + 115,218,11,104,101,97,100,101,114,95,115,105,122,101,90,13, + 104,101,97,100,101,114,95,111,102,102,115,101,116,90,10,97, + 114,99,95,111,102,102,115,101,116,114,33,0,0,0,218,5, + 99,111,117,110,116,218,5,102,108,97,103,115,218,8,99,111, + 109,112,114,101,115,115,218,4,116,105,109,101,218,4,100,97, + 116,101,218,3,99,114,99,218,9,100,97,116,97,95,115,105, + 122,101,218,9,110,97,109,101,95,115,105,122,101,218,10,101, + 120,116,114,97,95,115,105,122,101,90,12,99,111,109,109,101, + 110,116,95,115,105,122,101,218,11,102,105,108,101,95,111,102, + 102,115,101,116,114,44,0,0,0,114,13,0,0,0,218,1, + 116,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, + 114,27,0,0,0,129,1,0,0,115,214,0,0,0,2,1, + 14,1,12,1,20,1,8,2,2,1,14,1,8,1,14,1, + 12,1,20,1,12,1,18,1,18,1,2,3,12,1,12,1, + 12,1,10,1,2,1,8,255,8,2,2,1,2,255,2,1, + 4,255,2,2,10,1,12,1,14,1,10,1,2,1,8,255, + 10,2,10,1,10,1,2,1,6,255,16,2,14,1,10,1, + 2,1,6,255,16,2,16,2,16,1,10,1,18,1,10,1, + 18,1,8,1,8,1,10,1,18,1,4,2,4,2,2,1, + 14,1,14,1,20,1,10,2,14,1,8,1,18,2,4,1, + 14,1,8,1,16,1,16,1,16,1,16,1,16,1,16,1, + 16,1,16,1,16,1,16,1,16,1,12,1,10,1,18,1, + 8,1,2,2,14,1,14,1,20,1,14,1,18,1,2,4, + 28,1,22,1,14,1,20,1,10,2,10,2,2,3,14,1, + 14,1,22,1,12,2,12,1,20,1,8,1,44,1,14,1, + 4,1,255,128,114,27,0,0,0,117,190,1,0,0,0,1, + 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, + 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65, + 66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81, + 82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97, + 98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113, + 114,115,116,117,118,119,120,121,122,123,124,125,126,127,195,135, + 195,188,195,169,195,162,195,164,195,160,195,165,195,167,195,170, + 195,171,195,168,195,175,195,174,195,172,195,132,195,133,195,137, + 195,166,195,134,195,180,195,182,195,178,195,187,195,185,195,191, + 195,150,195,156,194,162,194,163,194,165,226,130,167,198,146,195, + 161,195,173,195,179,195,186,195,177,195,145,194,170,194,186,194, + 191,226,140,144,194,172,194,189,194,188,194,161,194,171,194,187, + 226,150,145,226,150,146,226,150,147,226,148,130,226,148,164,226, + 149,161,226,149,162,226,149,150,226,149,149,226,149,163,226,149, + 145,226,149,151,226,149,157,226,149,156,226,149,155,226,148,144, + 226,148,148,226,148,180,226,148,172,226,148,156,226,148,128,226, + 148,188,226,149,158,226,149,159,226,149,154,226,149,148,226,149, + 169,226,149,166,226,149,160,226,149,144,226,149,172,226,149,167, + 226,149,168,226,149,164,226,149,165,226,149,153,226,149,152,226, + 149,146,226,149,147,226,149,171,226,149,170,226,148,152,226,148, + 140,226,150,136,226,150,132,226,150,140,226,150,144,226,150,128, + 206,177,195,159,206,147,207,128,206,163,207,131,194,181,207,132, + 206,166,206,152,206,169,206,180,226,136,158,207,134,206,181,226, + 136,169,226,137,161,194,177,226,137,165,226,137,164,226,140,160, + 226,140,161,195,183,226,137,136,194,176,226,136,153,194,183,226, + 136,154,226,129,191,194,178,226,150,160,194,160,99,0,0,0, + 0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0, + 0,67,0,0,0,115,106,0,0,0,116,0,114,22,116,1, + 160,2,100,1,161,1,1,0,116,3,100,2,131,1,130,1, + 100,3,97,0,122,58,122,16,100,4,100,5,108,4,109,5, + 125,0,1,0,87,0,110,32,4,0,116,6,121,76,1,0, + 1,0,1,0,116,1,160,2,100,1,161,1,1,0,116,3, + 100,2,131,1,130,1,48,0,87,0,100,6,97,0,110,6, + 100,6,97,0,48,0,116,1,160,2,100,7,161,1,1,0, + 124,0,83,0,41,8,78,122,27,122,105,112,105,109,112,111, + 114,116,58,32,122,108,105,98,32,85,78,65,86,65,73,76, + 65,66,76,69,250,41,99,97,110,39,116,32,100,101,99,111, + 109,112,114,101,115,115,32,100,97,116,97,59,32,122,108,105, + 98,32,110,111,116,32,97,118,97,105,108,97,98,108,101,84, + 114,0,0,0,0,169,1,218,10,100,101,99,111,109,112,114, + 101,115,115,70,122,25,122,105,112,105,109,112,111,114,116,58, + 32,122,108,105,98,32,97,118,97,105,108,97,98,108,101,41, + 7,218,15,95,105,109,112,111,114,116,105,110,103,95,122,108, + 105,98,114,45,0,0,0,114,80,0,0,0,114,3,0,0, + 0,90,4,122,108,105,98,114,143,0,0,0,218,9,69,120, + 99,101,112,116,105,111,110,114,142,0,0,0,114,9,0,0, + 0,114,9,0,0,0,114,10,0,0,0,218,20,95,103,101, + 116,95,100,101,99,111,109,112,114,101,115,115,95,102,117,110, + 99,31,2,0,0,115,26,0,0,0,4,2,10,3,8,1, + 4,2,4,1,16,1,12,1,10,1,12,1,12,2,10,2, + 4,1,255,128,114,146,0,0,0,99,2,0,0,0,0,0, + 0,0,0,0,0,0,17,0,0,0,9,0,0,0,67,0, + 0,0,115,132,1,0,0,124,1,92,8,125,2,125,3,125, + 4,125,5,125,6,125,7,125,8,125,9,124,4,100,1,107, + 0,114,36,116,0,100,2,131,1,130,1,116,1,160,2,124, + 0,161,1,144,1,143,6,125,10,122,14,124,10,160,3,124, + 6,161,1,1,0,87,0,110,32,4,0,116,4,121,96,1, + 0,1,0,1,0,116,0,100,3,124,0,155,2,157,2,124, + 0,100,4,141,2,130,1,48,0,124,10,160,5,100,5,161, + 1,125,11,116,6,124,11,131,1,100,5,107,3,114,128,116, 7,100,6,131,1,130,1,124,11,100,0,100,7,133,2,25, - 0,100,8,107,3,114,166,116,0,100,9,124,0,155,2,157, + 0,100,8,107,3,114,162,116,0,100,9,124,0,155,2,157, 2,124,0,100,4,141,2,130,1,116,8,124,11,100,10,100, 11,133,2,25,0,131,1,125,12,116,8,124,11,100,11,100, 5,133,2,25,0,131,1,125,13,100,5,124,12,23,0,124, 13,23,0,125,14,124,6,124,14,55,0,125,6,122,14,124, - 10,160,3,124,6,161,1,1,0,87,0,110,38,4,0,116, - 4,144,1,121,14,1,0,1,0,1,0,116,0,100,3,124, - 0,155,2,157,2,124,0,100,4,141,2,130,1,89,0,110, - 2,48,0,124,10,160,5,124,4,161,1,125,15,116,6,124, - 15,131,1,124,4,107,3,144,1,114,48,116,4,100,12,131, - 1,130,1,87,0,100,0,4,0,4,0,131,3,1,0,110, - 18,49,0,144,1,115,70,48,0,1,0,1,0,1,0,89, - 0,1,0,124,3,100,1,107,2,144,1,114,94,124,15,83, - 0,122,10,116,9,131,0,125,16,87,0,110,28,4,0,116, - 10,144,1,121,132,1,0,1,0,1,0,116,0,100,13,131, - 1,130,1,89,0,110,2,48,0,124,16,124,15,100,14,131, - 2,83,0,41,15,78,114,0,0,0,0,122,18,110,101,103, - 97,116,105,118,101,32,100,97,116,97,32,115,105,122,101,114, - 90,0,0,0,114,12,0,0,0,114,102,0,0,0,114,96, - 0,0,0,114,91,0,0,0,115,4,0,0,0,80,75,3, - 4,122,23,98,97,100,32,108,111,99,97,108,32,102,105,108, - 101,32,104,101,97,100,101,114,58,32,233,26,0,0,0,114, - 101,0,0,0,122,26,122,105,112,105,109,112,111,114,116,58, - 32,99,97,110,39,116,32,114,101,97,100,32,100,97,116,97, - 114,137,0,0,0,105,241,255,255,255,41,11,114,3,0,0, - 0,114,108,0,0,0,114,109,0,0,0,114,110,0,0,0, - 114,22,0,0,0,114,112,0,0,0,114,51,0,0,0,114, - 117,0,0,0,114,1,0,0,0,114,142,0,0,0,114,141, - 0,0,0,41,17,114,29,0,0,0,114,54,0,0,0,90, - 8,100,97,116,97,112,97,116,104,114,128,0,0,0,114,132, - 0,0,0,114,123,0,0,0,114,135,0,0,0,114,129,0, - 0,0,114,130,0,0,0,114,131,0,0,0,114,121,0,0, - 0,114,122,0,0,0,114,133,0,0,0,114,134,0,0,0, - 114,125,0,0,0,90,8,114,97,119,95,100,97,116,97,114, - 139,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10, - 0,0,0,114,52,0,0,0,16,2,0,0,115,64,0,0, - 0,20,1,8,1,8,1,14,2,2,2,14,1,12,1,24, - 1,10,1,12,1,8,1,16,2,18,2,16,2,16,1,12, - 1,8,1,2,1,14,1,14,1,24,1,10,1,14,1,40, - 1,10,2,4,2,2,3,10,1,14,1,14,1,10,1,255, - 128,114,52,0,0,0,99,2,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 16,0,0,0,116,0,124,0,124,1,24,0,131,1,100,1, - 107,1,83,0,41,2,78,114,5,0,0,0,41,1,218,3, - 97,98,115,41,2,90,2,116,49,90,2,116,50,114,9,0, - 0,0,114,9,0,0,0,114,10,0,0,0,218,9,95,101, - 113,95,109,116,105,109,101,62,2,0,0,115,4,0,0,0, - 16,2,255,128,114,145,0,0,0,99,5,0,0,0,0,0, - 0,0,0,0,0,0,14,0,0,0,8,0,0,0,67,0, - 0,0,115,60,1,0,0,124,3,124,2,100,1,156,2,125, - 5,122,18,116,0,160,1,124,4,124,3,124,5,161,3,125, - 6,87,0,110,20,4,0,116,2,121,48,1,0,1,0,1, - 0,89,0,100,0,83,0,48,0,124,6,100,2,64,0,100, - 3,107,3,125,7,124,7,114,182,124,6,100,4,64,0,100, - 3,107,3,125,8,116,3,106,4,100,5,107,3,144,1,114, - 10,124,8,115,106,116,3,106,4,100,6,107,2,144,1,114, - 10,116,5,124,0,124,2,131,2,125,9,124,9,100,0,117, - 1,144,1,114,10,116,3,160,6,116,0,106,7,124,9,161, - 2,125,10,122,20,116,0,160,8,124,4,124,10,124,3,124, - 5,161,4,1,0,87,0,110,104,4,0,116,2,121,180,1, - 0,1,0,1,0,89,0,100,0,83,0,48,0,116,9,124, - 0,124,2,131,2,92,2,125,11,125,12,124,11,144,1,114, - 10,116,10,116,11,124,4,100,7,100,8,133,2,25,0,131, - 1,124,11,131,2,114,246,116,11,124,4,100,8,100,9,133, - 2,25,0,131,1,124,12,107,3,144,1,114,10,116,12,160, - 13,100,10,124,3,155,2,157,2,161,1,1,0,100,0,83, - 0,116,14,160,15,124,4,100,9,100,0,133,2,25,0,161, - 1,125,13,116,16,124,13,116,17,131,2,144,1,115,56,116, - 18,100,11,124,1,155,2,100,12,157,3,131,1,130,1,124, - 13,83,0,41,13,78,41,2,114,59,0,0,0,114,13,0, - 0,0,114,5,0,0,0,114,0,0,0,0,114,84,0,0, - 0,90,5,110,101,118,101,114,90,6,97,108,119,97,121,115, - 114,97,0,0,0,114,92,0,0,0,114,93,0,0,0,122, - 22,98,121,116,101,99,111,100,101,32,105,115,32,115,116,97, - 108,101,32,102,111,114,32,122,16,99,111,109,112,105,108,101, - 100,32,109,111,100,117,108,101,32,122,21,32,105,115,32,110, - 111,116,32,97,32,99,111,100,101,32,111,98,106,101,99,116, - 41,19,114,21,0,0,0,90,13,95,99,108,97,115,115,105, - 102,121,95,112,121,99,114,75,0,0,0,218,4,95,105,109, - 112,90,21,99,104,101,99,107,95,104,97,115,104,95,98,97, - 115,101,100,95,112,121,99,115,218,15,95,103,101,116,95,112, - 121,99,95,115,111,117,114,99,101,218,11,115,111,117,114,99, - 101,95,104,97,115,104,90,17,95,82,65,87,95,77,65,71, - 73,67,95,78,85,77,66,69,82,90,18,95,118,97,108,105, - 100,97,116,101,95,104,97,115,104,95,112,121,99,218,29,95, - 103,101,116,95,109,116,105,109,101,95,97,110,100,95,115,105, - 122,101,95,111,102,95,115,111,117,114,99,101,114,145,0,0, - 0,114,2,0,0,0,114,76,0,0,0,114,77,0,0,0, - 218,7,109,97,114,115,104,97,108,90,5,108,111,97,100,115, - 114,15,0,0,0,218,10,95,99,111,100,101,95,116,121,112, - 101,218,9,84,121,112,101,69,114,114,111,114,41,14,114,32, - 0,0,0,114,53,0,0,0,114,63,0,0,0,114,38,0, - 0,0,114,124,0,0,0,90,11,101,120,99,95,100,101,116, - 97,105,108,115,114,127,0,0,0,90,10,104,97,115,104,95, - 98,97,115,101,100,90,12,99,104,101,99,107,95,115,111,117, - 114,99,101,90,12,115,111,117,114,99,101,95,98,121,116,101, - 115,114,148,0,0,0,90,12,115,111,117,114,99,101,95,109, - 116,105,109,101,90,11,115,111,117,114,99,101,95,115,105,122, - 101,114,46,0,0,0,114,9,0,0,0,114,9,0,0,0, - 114,10,0,0,0,218,15,95,117,110,109,97,114,115,104,97, - 108,95,99,111,100,101,72,2,0,0,115,84,0,0,0,2, - 2,2,1,6,254,2,5,18,1,12,1,8,1,12,2,4, - 1,12,1,12,1,2,1,2,255,8,1,4,255,10,2,10, - 1,4,1,4,1,2,1,4,254,2,5,4,1,8,1,8, - 255,12,2,8,1,8,3,6,255,6,3,22,3,18,1,4, - 255,4,2,8,1,4,255,4,2,18,2,12,1,16,1,4, - 1,255,128,114,153,0,0,0,99,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,4,0,0,0,67,0,0, - 0,115,28,0,0,0,124,0,160,0,100,1,100,2,161,2, - 125,0,124,0,160,0,100,3,100,2,161,2,125,0,124,0, - 83,0,41,4,78,115,2,0,0,0,13,10,243,1,0,0, - 0,10,243,1,0,0,0,13,41,1,114,19,0,0,0,41, - 1,218,6,115,111,117,114,99,101,114,9,0,0,0,114,9, - 0,0,0,114,10,0,0,0,218,23,95,110,111,114,109,97, - 108,105,122,101,95,108,105,110,101,95,101,110,100,105,110,103, - 115,123,2,0,0,115,8,0,0,0,12,1,12,1,4,1, - 255,128,114,157,0,0,0,99,2,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,6,0,0,0,67,0,0,0, - 115,24,0,0,0,116,0,124,1,131,1,125,1,116,1,124, - 1,124,0,100,1,100,2,100,3,141,4,83,0,41,4,78, - 114,74,0,0,0,84,41,1,90,12,100,111,110,116,95,105, - 110,104,101,114,105,116,41,2,114,157,0,0,0,218,7,99, - 111,109,112,105,108,101,41,2,114,53,0,0,0,114,156,0, - 0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0, - 0,218,15,95,99,111,109,112,105,108,101,95,115,111,117,114, - 99,101,130,2,0,0,115,6,0,0,0,8,1,16,1,255, - 128,114,159,0,0,0,99,2,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,11,0,0,0,67,0,0,0,115, - 68,0,0,0,116,0,160,1,124,0,100,1,63,0,100,2, - 23,0,124,0,100,3,63,0,100,4,64,0,124,0,100,5, - 64,0,124,1,100,6,63,0,124,1,100,3,63,0,100,7, - 64,0,124,1,100,5,64,0,100,8,20,0,100,9,100,9, - 100,9,102,9,161,1,83,0,41,10,78,233,9,0,0,0, - 105,188,7,0,0,233,5,0,0,0,233,15,0,0,0,233, - 31,0,0,0,233,11,0,0,0,233,63,0,0,0,114,84, - 0,0,0,114,14,0,0,0,41,2,114,129,0,0,0,90, - 6,109,107,116,105,109,101,41,2,218,1,100,114,136,0,0, - 0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, - 218,14,95,112,97,114,115,101,95,100,111,115,116,105,109,101, - 136,2,0,0,115,20,0,0,0,4,1,10,1,10,1,6, - 1,6,1,10,1,10,1,6,1,6,249,255,128,114,167,0, - 0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,6, - 0,0,0,10,0,0,0,67,0,0,0,115,110,0,0,0, - 122,82,124,1,100,1,100,0,133,2,25,0,100,2,118,0, - 115,22,74,0,130,1,124,1,100,0,100,1,133,2,25,0, - 125,1,124,0,106,0,124,1,25,0,125,2,124,2,100,3, - 25,0,125,3,124,2,100,4,25,0,125,4,124,2,100,5, - 25,0,125,5,116,1,124,4,124,3,131,2,124,5,102,2, - 87,0,83,0,4,0,116,2,116,3,116,4,102,3,121,108, - 1,0,1,0,1,0,89,0,100,6,83,0,48,0,41,7, - 78,114,14,0,0,0,169,2,218,1,99,218,1,111,114,161, - 0,0,0,233,6,0,0,0,233,3,0,0,0,41,2,114, - 0,0,0,0,114,0,0,0,0,41,5,114,28,0,0,0, - 114,167,0,0,0,114,26,0,0,0,218,10,73,110,100,101, - 120,69,114,114,111,114,114,152,0,0,0,41,6,114,32,0, - 0,0,114,13,0,0,0,114,54,0,0,0,114,129,0,0, - 0,114,130,0,0,0,90,17,117,110,99,111,109,112,114,101, - 115,115,101,100,95,115,105,122,101,114,9,0,0,0,114,9, - 0,0,0,114,10,0,0,0,114,149,0,0,0,149,2,0, - 0,115,22,0,0,0,2,1,20,2,12,1,10,1,8,3, - 8,1,8,1,16,1,18,1,8,1,255,128,114,149,0,0, - 0,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,8,0,0,0,67,0,0,0,115,80,0,0,0,124, - 1,100,1,100,0,133,2,25,0,100,2,118,0,115,20,74, - 0,130,1,124,1,100,0,100,1,133,2,25,0,125,1,122, - 14,124,0,106,0,124,1,25,0,125,2,87,0,110,20,4, - 0,116,1,121,66,1,0,1,0,1,0,89,0,100,0,83, - 0,48,0,116,2,124,0,106,3,124,2,131,2,83,0,41, - 3,78,114,14,0,0,0,114,168,0,0,0,41,4,114,28, - 0,0,0,114,26,0,0,0,114,52,0,0,0,114,29,0, - 0,0,41,3,114,32,0,0,0,114,13,0,0,0,114,54, + 10,160,3,124,6,161,1,1,0,87,0,110,34,4,0,116, + 4,144,1,121,6,1,0,1,0,1,0,116,0,100,3,124, + 0,155,2,157,2,124,0,100,4,141,2,130,1,48,0,124, + 10,160,5,124,4,161,1,125,15,116,6,124,15,131,1,124, + 4,107,3,144,1,114,40,116,4,100,12,131,1,130,1,87, + 0,100,0,4,0,4,0,131,3,1,0,110,18,49,0,144, + 1,115,62,48,0,1,0,1,0,1,0,89,0,1,0,124, + 3,100,1,107,2,144,1,114,86,124,15,83,0,122,10,116, + 9,131,0,125,16,87,0,110,24,4,0,116,10,144,1,121, + 120,1,0,1,0,1,0,116,0,100,13,131,1,130,1,48, + 0,124,16,124,15,100,14,131,2,83,0,41,15,78,114,0, + 0,0,0,122,18,110,101,103,97,116,105,118,101,32,100,97, + 116,97,32,115,105,122,101,114,94,0,0,0,114,12,0,0, + 0,114,106,0,0,0,114,100,0,0,0,114,95,0,0,0, + 115,4,0,0,0,80,75,3,4,122,23,98,97,100,32,108, + 111,99,97,108,32,102,105,108,101,32,104,101,97,100,101,114, + 58,32,233,26,0,0,0,114,105,0,0,0,122,26,122,105, + 112,105,109,112,111,114,116,58,32,99,97,110,39,116,32,114, + 101,97,100,32,100,97,116,97,114,141,0,0,0,105,241,255, + 255,255,41,11,114,3,0,0,0,114,112,0,0,0,114,113, + 0,0,0,114,114,0,0,0,114,22,0,0,0,114,116,0, + 0,0,114,55,0,0,0,114,121,0,0,0,114,1,0,0, + 0,114,146,0,0,0,114,145,0,0,0,41,17,114,29,0, + 0,0,114,58,0,0,0,90,8,100,97,116,97,112,97,116, + 104,114,132,0,0,0,114,136,0,0,0,114,127,0,0,0, + 114,139,0,0,0,114,133,0,0,0,114,134,0,0,0,114, + 135,0,0,0,114,125,0,0,0,114,126,0,0,0,114,137, + 0,0,0,114,138,0,0,0,114,129,0,0,0,90,8,114, + 97,119,95,100,97,116,97,114,143,0,0,0,114,9,0,0, + 0,114,9,0,0,0,114,10,0,0,0,114,56,0,0,0, + 52,2,0,0,115,64,0,0,0,20,1,8,1,8,1,14, + 2,2,2,14,1,12,1,20,1,10,1,12,1,8,1,16, + 2,18,2,16,2,16,1,12,1,8,1,2,1,14,1,14, + 1,20,1,10,1,14,1,40,1,10,2,4,2,2,3,10, + 1,14,1,10,1,10,1,255,128,114,56,0,0,0,99,2, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3, + 0,0,0,67,0,0,0,115,16,0,0,0,116,0,124,0, + 124,1,24,0,131,1,100,1,107,1,83,0,41,2,78,114, + 5,0,0,0,41,1,218,3,97,98,115,41,2,90,2,116, + 49,90,2,116,50,114,9,0,0,0,114,9,0,0,0,114, + 10,0,0,0,218,9,95,101,113,95,109,116,105,109,101,98, + 2,0,0,115,4,0,0,0,16,2,255,128,114,149,0,0, + 0,99,5,0,0,0,0,0,0,0,0,0,0,0,14,0, + 0,0,8,0,0,0,67,0,0,0,115,60,1,0,0,124, + 3,124,2,100,1,156,2,125,5,122,18,116,0,160,1,124, + 4,124,3,124,5,161,3,125,6,87,0,110,20,4,0,116, + 2,121,48,1,0,1,0,1,0,89,0,100,0,83,0,48, + 0,124,6,100,2,64,0,100,3,107,3,125,7,124,7,114, + 182,124,6,100,4,64,0,100,3,107,3,125,8,116,3,106, + 4,100,5,107,3,144,1,114,10,124,8,115,106,116,3,106, + 4,100,6,107,2,144,1,114,10,116,5,124,0,124,2,131, + 2,125,9,124,9,100,0,117,1,144,1,114,10,116,3,160, + 6,116,0,106,7,124,9,161,2,125,10,122,20,116,0,160, + 8,124,4,124,10,124,3,124,5,161,4,1,0,87,0,110, + 104,4,0,116,2,121,180,1,0,1,0,1,0,89,0,100, + 0,83,0,48,0,116,9,124,0,124,2,131,2,92,2,125, + 11,125,12,124,11,144,1,114,10,116,10,116,11,124,4,100, + 7,100,8,133,2,25,0,131,1,124,11,131,2,114,246,116, + 11,124,4,100,8,100,9,133,2,25,0,131,1,124,12,107, + 3,144,1,114,10,116,12,160,13,100,10,124,3,155,2,157, + 2,161,1,1,0,100,0,83,0,116,14,160,15,124,4,100, + 9,100,0,133,2,25,0,161,1,125,13,116,16,124,13,116, + 17,131,2,144,1,115,56,116,18,100,11,124,1,155,2,100, + 12,157,3,131,1,130,1,124,13,83,0,41,13,78,41,2, + 114,44,0,0,0,114,13,0,0,0,114,5,0,0,0,114, + 0,0,0,0,114,88,0,0,0,90,5,110,101,118,101,114, + 90,6,97,108,119,97,121,115,114,101,0,0,0,114,96,0, + 0,0,114,97,0,0,0,122,22,98,121,116,101,99,111,100, + 101,32,105,115,32,115,116,97,108,101,32,102,111,114,32,122, + 16,99,111,109,112,105,108,101,100,32,109,111,100,117,108,101, + 32,122,21,32,105,115,32,110,111,116,32,97,32,99,111,100, + 101,32,111,98,106,101,99,116,41,19,114,21,0,0,0,90, + 13,95,99,108,97,115,115,105,102,121,95,112,121,99,114,79, + 0,0,0,218,4,95,105,109,112,90,21,99,104,101,99,107, + 95,104,97,115,104,95,98,97,115,101,100,95,112,121,99,115, + 218,15,95,103,101,116,95,112,121,99,95,115,111,117,114,99, + 101,218,11,115,111,117,114,99,101,95,104,97,115,104,90,17, + 95,82,65,87,95,77,65,71,73,67,95,78,85,77,66,69, + 82,90,18,95,118,97,108,105,100,97,116,101,95,104,97,115, + 104,95,112,121,99,218,29,95,103,101,116,95,109,116,105,109, + 101,95,97,110,100,95,115,105,122,101,95,111,102,95,115,111, + 117,114,99,101,114,149,0,0,0,114,2,0,0,0,114,45, + 0,0,0,114,80,0,0,0,218,7,109,97,114,115,104,97, + 108,90,5,108,111,97,100,115,114,15,0,0,0,218,10,95, + 99,111,100,101,95,116,121,112,101,218,9,84,121,112,101,69, + 114,114,111,114,41,14,114,32,0,0,0,114,57,0,0,0, + 114,66,0,0,0,114,38,0,0,0,114,128,0,0,0,90, + 11,101,120,99,95,100,101,116,97,105,108,115,114,131,0,0, + 0,90,10,104,97,115,104,95,98,97,115,101,100,90,12,99, + 104,101,99,107,95,115,111,117,114,99,101,90,12,115,111,117, + 114,99,101,95,98,121,116,101,115,114,152,0,0,0,90,12, + 115,111,117,114,99,101,95,109,116,105,109,101,90,11,115,111, + 117,114,99,101,95,115,105,122,101,114,50,0,0,0,114,9, + 0,0,0,114,9,0,0,0,114,10,0,0,0,218,15,95, + 117,110,109,97,114,115,104,97,108,95,99,111,100,101,108,2, + 0,0,115,84,0,0,0,2,2,2,1,6,254,2,5,18, + 1,12,1,8,1,12,2,4,1,12,1,12,1,2,1,2, + 255,8,1,4,255,10,2,10,1,4,1,4,1,2,1,4, + 254,2,5,4,1,8,1,8,255,12,2,8,1,8,3,6, + 255,6,3,22,3,18,1,4,255,4,2,8,1,4,255,4, + 2,18,2,12,1,16,1,4,1,255,128,114,157,0,0,0, + 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,4,0,0,0,67,0,0,0,115,28,0,0,0,124,0, + 160,0,100,1,100,2,161,2,125,0,124,0,160,0,100,3, + 100,2,161,2,125,0,124,0,83,0,41,4,78,115,2,0, + 0,0,13,10,243,1,0,0,0,10,243,1,0,0,0,13, + 41,1,114,19,0,0,0,41,1,218,6,115,111,117,114,99, + 101,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, + 218,23,95,110,111,114,109,97,108,105,122,101,95,108,105,110, + 101,95,101,110,100,105,110,103,115,159,2,0,0,115,8,0, + 0,0,12,1,12,1,4,1,255,128,114,161,0,0,0,99, + 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 6,0,0,0,67,0,0,0,115,24,0,0,0,116,0,124, + 1,131,1,125,1,116,1,124,1,124,0,100,1,100,2,100, + 3,141,4,83,0,41,4,78,114,78,0,0,0,84,41,1, + 90,12,100,111,110,116,95,105,110,104,101,114,105,116,41,2, + 114,161,0,0,0,218,7,99,111,109,112,105,108,101,41,2, + 114,57,0,0,0,114,160,0,0,0,114,9,0,0,0,114, + 9,0,0,0,114,10,0,0,0,218,15,95,99,111,109,112, + 105,108,101,95,115,111,117,114,99,101,166,2,0,0,115,6, + 0,0,0,8,1,16,1,255,128,114,163,0,0,0,99,2, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,11, + 0,0,0,67,0,0,0,115,68,0,0,0,116,0,160,1, + 124,0,100,1,63,0,100,2,23,0,124,0,100,3,63,0, + 100,4,64,0,124,0,100,5,64,0,124,1,100,6,63,0, + 124,1,100,3,63,0,100,7,64,0,124,1,100,5,64,0, + 100,8,20,0,100,9,100,9,100,9,102,9,161,1,83,0, + 41,10,78,233,9,0,0,0,105,188,7,0,0,233,5,0, + 0,0,233,15,0,0,0,233,31,0,0,0,233,11,0,0, + 0,233,63,0,0,0,114,88,0,0,0,114,14,0,0,0, + 41,2,114,133,0,0,0,90,6,109,107,116,105,109,101,41, + 2,218,1,100,114,140,0,0,0,114,9,0,0,0,114,9, + 0,0,0,114,10,0,0,0,218,14,95,112,97,114,115,101, + 95,100,111,115,116,105,109,101,172,2,0,0,115,20,0,0, + 0,4,1,10,1,10,1,6,1,6,1,10,1,10,1,6, + 1,6,249,255,128,114,171,0,0,0,99,2,0,0,0,0, + 0,0,0,0,0,0,0,6,0,0,0,10,0,0,0,67, + 0,0,0,115,110,0,0,0,122,82,124,1,100,1,100,0, + 133,2,25,0,100,2,118,0,115,22,74,0,130,1,124,1, + 100,0,100,1,133,2,25,0,125,1,124,0,106,0,124,1, + 25,0,125,2,124,2,100,3,25,0,125,3,124,2,100,4, + 25,0,125,4,124,2,100,5,25,0,125,5,116,1,124,4, + 124,3,131,2,124,5,102,2,87,0,83,0,4,0,116,2, + 116,3,116,4,102,3,121,108,1,0,1,0,1,0,89,0, + 100,6,83,0,48,0,41,7,78,114,14,0,0,0,169,2, + 218,1,99,218,1,111,114,165,0,0,0,233,6,0,0,0, + 233,3,0,0,0,41,2,114,0,0,0,0,114,0,0,0, + 0,41,5,114,28,0,0,0,114,171,0,0,0,114,26,0, + 0,0,218,10,73,110,100,101,120,69,114,114,111,114,114,156, + 0,0,0,41,6,114,32,0,0,0,114,13,0,0,0,114, + 58,0,0,0,114,133,0,0,0,114,134,0,0,0,90,17, + 117,110,99,111,109,112,114,101,115,115,101,100,95,115,105,122, + 101,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, + 114,153,0,0,0,185,2,0,0,115,22,0,0,0,2,1, + 20,2,12,1,10,1,8,3,8,1,8,1,16,1,18,1, + 8,1,255,128,114,153,0,0,0,99,2,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,8,0,0,0,67,0, + 0,0,115,80,0,0,0,124,1,100,1,100,0,133,2,25, + 0,100,2,118,0,115,20,74,0,130,1,124,1,100,0,100, + 1,133,2,25,0,125,1,122,14,124,0,106,0,124,1,25, + 0,125,2,87,0,110,20,4,0,116,1,121,66,1,0,1, + 0,1,0,89,0,100,0,83,0,48,0,116,2,124,0,106, + 3,124,2,131,2,83,0,41,3,78,114,14,0,0,0,114, + 172,0,0,0,41,4,114,28,0,0,0,114,26,0,0,0, + 114,56,0,0,0,114,29,0,0,0,41,3,114,32,0,0, + 0,114,13,0,0,0,114,58,0,0,0,114,9,0,0,0, + 114,9,0,0,0,114,10,0,0,0,114,151,0,0,0,204, + 2,0,0,115,16,0,0,0,20,2,12,1,2,2,14,1, + 12,1,8,1,12,2,255,128,114,151,0,0,0,99,2,0, + 0,0,0,0,0,0,0,0,0,0,11,0,0,0,9,0, + 0,0,67,0,0,0,115,190,0,0,0,116,0,124,0,124, + 1,131,2,125,2,116,1,68,0,93,156,92,3,125,3,125, + 4,125,5,124,2,124,3,23,0,125,6,116,2,106,3,100, + 1,124,0,106,4,116,5,124,6,100,2,100,3,141,5,1, + 0,122,14,124,0,106,6,124,6,25,0,125,7,87,0,110, + 18,4,0,116,7,121,86,1,0,1,0,1,0,89,0,113, + 14,48,0,124,7,100,4,25,0,125,8,116,8,124,0,106, + 4,124,7,131,2,125,9,124,4,114,130,116,9,124,0,124, + 8,124,6,124,1,124,9,131,5,125,10,110,10,116,10,124, + 8,124,9,131,2,125,10,124,10,100,0,117,0,114,150,113, + 14,124,7,100,4,25,0,125,8,124,10,124,5,124,8,102, + 3,2,0,1,0,83,0,116,11,100,5,124,1,155,2,157, + 2,124,1,100,6,141,2,130,1,41,7,78,122,13,116,114, + 121,105,110,103,32,123,125,123,125,123,125,114,88,0,0,0, + 41,1,90,9,118,101,114,98,111,115,105,116,121,114,0,0, + 0,0,114,61,0,0,0,114,62,0,0,0,41,12,114,36, + 0,0,0,114,91,0,0,0,114,45,0,0,0,114,80,0, + 0,0,114,29,0,0,0,114,20,0,0,0,114,28,0,0, + 0,114,26,0,0,0,114,56,0,0,0,114,157,0,0,0, + 114,163,0,0,0,114,3,0,0,0,41,11,114,32,0,0, + 0,114,38,0,0,0,114,13,0,0,0,114,92,0,0,0, + 114,93,0,0,0,114,51,0,0,0,114,66,0,0,0,114, + 58,0,0,0,114,40,0,0,0,114,128,0,0,0,114,50, 0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0, - 0,0,114,147,0,0,0,168,2,0,0,115,16,0,0,0, - 20,2,12,1,2,2,14,1,12,1,8,1,12,2,255,128, - 114,147,0,0,0,99,2,0,0,0,0,0,0,0,0,0, - 0,0,11,0,0,0,9,0,0,0,67,0,0,0,115,194, - 0,0,0,116,0,124,0,124,1,131,2,125,2,116,1,68, - 0,93,156,92,3,125,3,125,4,125,5,124,2,124,3,23, - 0,125,6,116,2,106,3,100,1,124,0,106,4,116,5,124, - 6,100,2,100,3,141,5,1,0,122,14,124,0,106,6,124, - 6,25,0,125,7,87,0,110,18,4,0,116,7,121,86,1, - 0,1,0,1,0,89,0,113,14,48,0,124,7,100,4,25, - 0,125,8,116,8,124,0,106,4,124,7,131,2,125,9,124, - 4,114,130,116,9,124,0,124,8,124,6,124,1,124,9,131, - 5,125,10,110,10,116,10,124,8,124,9,131,2,125,10,124, - 10,100,0,117,0,114,150,113,14,124,7,100,4,25,0,125, - 8,124,10,124,5,124,8,102,3,2,0,1,0,83,0,116, - 11,100,5,124,1,155,2,157,2,124,1,100,6,141,2,130, - 1,100,0,83,0,41,7,78,122,13,116,114,121,105,110,103, - 32,123,125,123,125,123,125,114,84,0,0,0,41,1,90,9, - 118,101,114,98,111,115,105,116,121,114,0,0,0,0,114,57, - 0,0,0,114,58,0,0,0,41,12,114,36,0,0,0,114, - 87,0,0,0,114,76,0,0,0,114,77,0,0,0,114,29, - 0,0,0,114,20,0,0,0,114,28,0,0,0,114,26,0, - 0,0,114,52,0,0,0,114,153,0,0,0,114,159,0,0, - 0,114,3,0,0,0,41,11,114,32,0,0,0,114,38,0, - 0,0,114,13,0,0,0,114,88,0,0,0,114,89,0,0, - 0,114,47,0,0,0,114,63,0,0,0,114,54,0,0,0, - 114,40,0,0,0,114,124,0,0,0,114,46,0,0,0,114, - 9,0,0,0,114,9,0,0,0,114,10,0,0,0,114,44, - 0,0,0,183,2,0,0,115,40,0,0,0,10,1,14,1, - 8,1,22,1,2,1,14,1,12,1,6,1,8,2,12,1, - 4,1,18,1,10,2,8,1,2,3,8,1,14,1,18,2, - 4,128,255,128,114,44,0,0,0,41,44,114,82,0,0,0, - 90,26,95,102,114,111,122,101,110,95,105,109,112,111,114,116, - 108,105,98,95,101,120,116,101,114,110,97,108,114,21,0,0, - 0,114,1,0,0,0,114,2,0,0,0,90,17,95,102,114, - 111,122,101,110,95,105,109,112,111,114,116,108,105,98,114,76, - 0,0,0,114,146,0,0,0,114,108,0,0,0,114,150,0, - 0,0,114,67,0,0,0,114,129,0,0,0,90,7,95,95, - 97,108,108,95,95,114,20,0,0,0,90,15,112,97,116,104, - 95,115,101,112,97,114,97,116,111,114,115,114,18,0,0,0, - 114,75,0,0,0,114,3,0,0,0,114,25,0,0,0,218, - 4,116,121,112,101,114,70,0,0,0,114,111,0,0,0,114, - 113,0,0,0,114,115,0,0,0,114,4,0,0,0,114,87, - 0,0,0,114,36,0,0,0,114,37,0,0,0,114,35,0, - 0,0,114,27,0,0,0,114,120,0,0,0,114,140,0,0, - 0,114,142,0,0,0,114,52,0,0,0,114,145,0,0,0, - 114,153,0,0,0,218,8,95,95,99,111,100,101,95,95,114, - 151,0,0,0,114,157,0,0,0,114,159,0,0,0,114,167, - 0,0,0,114,149,0,0,0,114,147,0,0,0,114,44,0, - 0,0,114,9,0,0,0,114,9,0,0,0,114,9,0,0, - 0,114,10,0,0,0,218,8,60,109,111,100,117,108,101,62, - 1,0,0,0,115,90,0,0,0,4,0,8,16,16,1,8, - 1,8,1,8,1,8,1,8,1,8,1,8,2,6,3,14, - 1,16,3,4,4,8,2,4,2,4,1,4,1,14,2,0, - 127,12,125,12,1,2,1,2,1,4,252,8,9,8,4,8, - 9,8,31,2,126,2,254,4,29,8,5,8,21,8,46,8, - 10,10,46,8,5,8,7,8,6,8,13,8,19,8,15,4, - 128,255,128, + 0,0,114,48,0,0,0,219,2,0,0,115,38,0,0,0, + 10,1,14,1,8,1,22,1,2,1,14,1,12,1,6,1, + 8,2,12,1,4,1,18,1,10,2,8,1,2,3,8,1, + 14,1,18,2,255,128,114,48,0,0,0,41,46,114,86,0, + 0,0,90,26,95,102,114,111,122,101,110,95,105,109,112,111, + 114,116,108,105,98,95,101,120,116,101,114,110,97,108,114,21, + 0,0,0,114,1,0,0,0,114,2,0,0,0,90,17,95, + 102,114,111,122,101,110,95,105,109,112,111,114,116,108,105,98, + 114,45,0,0,0,114,150,0,0,0,114,112,0,0,0,114, + 154,0,0,0,114,71,0,0,0,114,133,0,0,0,114,69, + 0,0,0,90,7,95,95,97,108,108,95,95,114,20,0,0, + 0,90,15,112,97,116,104,95,115,101,112,97,114,97,116,111, + 114,115,114,18,0,0,0,114,79,0,0,0,114,3,0,0, + 0,114,25,0,0,0,218,4,116,121,112,101,114,74,0,0, + 0,114,115,0,0,0,114,117,0,0,0,114,119,0,0,0, + 90,13,95,76,111,97,100,101,114,66,97,115,105,99,115,114, + 4,0,0,0,114,91,0,0,0,114,36,0,0,0,114,37, + 0,0,0,114,35,0,0,0,114,27,0,0,0,114,124,0, + 0,0,114,144,0,0,0,114,146,0,0,0,114,56,0,0, + 0,114,149,0,0,0,114,157,0,0,0,218,8,95,95,99, + 111,100,101,95,95,114,155,0,0,0,114,161,0,0,0,114, + 163,0,0,0,114,171,0,0,0,114,153,0,0,0,114,151, + 0,0,0,114,48,0,0,0,114,9,0,0,0,114,9,0, + 0,0,114,9,0,0,0,114,10,0,0,0,218,8,60,109, + 111,100,117,108,101,62,1,0,0,0,115,92,0,0,0,4, + 0,8,16,16,1,8,1,8,1,8,1,8,1,8,1,8, + 1,8,1,8,2,6,3,14,1,16,3,4,4,8,2,4, + 2,4,1,4,1,18,2,0,127,0,127,12,33,12,1,2, + 1,2,1,4,252,8,9,8,4,8,9,8,31,2,126,2, + 254,4,29,8,5,8,21,8,46,8,10,10,46,8,5,8, + 7,8,6,8,13,8,19,12,15,255,128, }; diff --git a/Python/initconfig.c b/Python/initconfig.c index 1fcc3600aa4666..62087fb4208dd4 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -38,7 +38,8 @@ Options and arguments (and corresponding environment variables):\n\ and comparing bytes/bytearray with str. (-bb: issue errors)\n\ -B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x\n\ -c cmd : program passed in as string (terminates option list)\n\ --d : debug output from parser; also PYTHONDEBUG=x\n\ +-d : turn on parser debugging output (for experts only, only works on\n\ + debug builds); also PYTHONDEBUG=x\n\ -E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\ -h : print this help message and exit (also --help)\n\ "; @@ -1050,8 +1051,8 @@ _PyConfig_AsDict(const PyConfig *config) static PyObject* config_dict_get(PyObject *dict, const char *name) { - PyObject *item = PyDict_GetItemString(dict, name); - if (item == NULL) { + PyObject *item = _PyDict_GetItemStringWithError(dict, name); + if (item == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_ValueError, "missing config key: %s", name); return NULL; } @@ -1085,7 +1086,7 @@ config_dict_get_int(PyObject *dict, const char *name, int *result) if (PyErr_ExceptionMatches(PyExc_TypeError)) { config_dict_invalid_type(name); } - else { + else if (PyErr_ExceptionMatches(PyExc_OverflowError)) { config_dict_invalid_value(name); } return -1; @@ -1104,7 +1105,12 @@ config_dict_get_ulong(PyObject *dict, const char *name, unsigned long *result) } unsigned long value = PyLong_AsUnsignedLong(item); if (value == (unsigned long)-1 && PyErr_Occurred()) { - config_dict_invalid_value(name); + if (PyErr_ExceptionMatches(PyExc_TypeError)) { + config_dict_invalid_type(name); + } + else if (PyErr_ExceptionMatches(PyExc_OverflowError)) { + config_dict_invalid_value(name); + } return -1; } *result = value; diff --git a/Python/marshal.c b/Python/marshal.c index d292987ce05f42..fa4ec9eb605f05 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -638,7 +638,7 @@ r_string(Py_ssize_t n, RFILE *p) return res; } if (p->buf == NULL) { - p->buf = PyMem_MALLOC(n); + p->buf = PyMem_Malloc(n); if (p->buf == NULL) { PyErr_NoMemory(); return NULL; @@ -646,7 +646,7 @@ r_string(Py_ssize_t n, RFILE *p) p->buf_size = n; } else if (p->buf_size < n) { - char *tmp = PyMem_REALLOC(p->buf, n); + char *tmp = PyMem_Realloc(p->buf, n); if (tmp == NULL) { PyErr_NoMemory(); return NULL; @@ -1453,7 +1453,7 @@ PyMarshal_ReadShortFromFile(FILE *fp) rf.buf = NULL; res = r_short(&rf); if (rf.buf != NULL) - PyMem_FREE(rf.buf); + PyMem_Free(rf.buf); return res; } @@ -1468,7 +1468,7 @@ PyMarshal_ReadLongFromFile(FILE *fp) rf.buf = NULL; res = r_long(&rf); if (rf.buf != NULL) - PyMem_FREE(rf.buf); + PyMem_Free(rf.buf); return res; } @@ -1501,11 +1501,11 @@ PyMarshal_ReadLastObjectFromFile(FILE *fp) off_t filesize; filesize = getfilesize(fp); if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) { - char* pBuf = (char *)PyMem_MALLOC(filesize); + char* pBuf = (char *)PyMem_Malloc(filesize); if (pBuf != NULL) { size_t n = fread(pBuf, 1, (size_t)filesize, fp); PyObject* v = PyMarshal_ReadObjectFromString(pBuf, n); - PyMem_FREE(pBuf); + PyMem_Free(pBuf); return v; } @@ -1534,7 +1534,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp) result = r_object(&rf); Py_DECREF(rf.refs); if (rf.buf != NULL) - PyMem_FREE(rf.buf); + PyMem_Free(rf.buf); return result; } @@ -1555,7 +1555,7 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len) result = r_object(&rf); Py_DECREF(rf.refs); if (rf.buf != NULL) - PyMem_FREE(rf.buf); + PyMem_Free(rf.buf); return result; } @@ -1684,7 +1684,7 @@ marshal_load(PyObject *module, PyObject *file) result = read_object(&rf); Py_DECREF(rf.refs); if (rf.buf != NULL) - PyMem_FREE(rf.buf); + PyMem_Free(rf.buf); } else result = NULL; } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 2d43e016efd508..70824ff674129a 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -8,6 +8,7 @@ #include "pycore_ceval.h" // _PyEval_FiniGIL() #include "pycore_context.h" // _PyContext_Init() #include "pycore_fileutils.h" // _Py_ResetForceASCII() +#include "pycore_import.h" // _PyImport_BootstrapImp() #include "pycore_initconfig.h" // _PyStatus_OK() #include "pycore_object.h" // _PyDebug_PrintTotalRefs() #include "pycore_pathconfig.h" // _PyConfig_WritePathConfig() @@ -54,7 +55,6 @@ static PyStatus add_main_module(PyInterpreterState *interp); static PyStatus init_import_site(void); static PyStatus init_set_builtins_open(void); static PyStatus init_sys_streams(PyThreadState *tstate); -static PyStatus init_signals(PyThreadState *tstate); static void call_py_exitfuncs(PyThreadState *tstate); static void wait_for_thread_shutdown(PyThreadState *tstate); static void call_ll_exitfuncs(_PyRuntimeState *runtime); @@ -97,14 +97,6 @@ _Py_IsFinalizing(void) int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \ PyOS_mystrnicmp; /* Python/pystrcmp.o */ -/* PyModule_GetWarningsModule is no longer necessary as of 2.6 -since _warnings is builtin. This API should not be used. */ -PyObject * -PyModule_GetWarningsModule(void) -{ - return PyImport_ImportModule("warnings"); -} - /* APIs to access the initialization flags * @@ -156,18 +148,11 @@ init_importlib(PyThreadState *tstate, PyObject *sysmod) } interp->importlib = Py_NewRef(importlib); - PyObject *import_func = _PyDict_GetItemStringWithError(interp->builtins, - "__import__"); - if (import_func == NULL) { - return -1; - } - interp->import_func = Py_NewRef(import_func); - // Import the _imp module if (verbose) { PySys_FormatStderr("import _imp # builtin\n"); } - PyObject *imp_mod = PyInit__imp(); + PyObject *imp_mod = _PyImport_BootstrapImp(tstate); if (imp_mod == NULL) { return -1; } @@ -742,6 +727,14 @@ pycore_init_builtins(PyThreadState *tstate) } Py_DECREF(bimod); + // Get the __import__ function + PyObject *import_func = _PyDict_GetItemStringWithError(interp->builtins, + "__import__"); + if (import_func == NULL) { + goto error; + } + interp->import_func = Py_NewRef(import_func); + assert(!_PyErr_Occurred(tstate)); return _PyStatus_OK(); @@ -763,12 +756,6 @@ pycore_interp_init(PyThreadState *tstate) goto done; } - if (_Py_IsMainInterpreter(tstate)) { - if (_PyTime_Init() < 0) { - return _PyStatus_ERR("can't initialize time"); - } - } - status = _PySys_Create(tstate, &sysmod); if (_PyStatus_EXCEPTION(status)) { goto done; @@ -1053,11 +1040,8 @@ init_interp_main(PyThreadState *tstate) } if (is_main_interp) { - if (config->install_signal_handlers) { - status = init_signals(tstate); - if (_PyStatus_EXCEPTION(status)) { - return status; - } + if (_PySignal_Init(config->install_signal_handlers) < 0) { + return _PyStatus_ERR("can't initialize signals"); } if (_PyTraceMalloc_Init(config->tracemalloc) < 0) { @@ -1654,7 +1638,6 @@ Py_FinalizeEx(void) /* Get current thread state and interpreter pointer */ PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); - PyInterpreterState *interp = tstate->interp; // Wrap up existing "threading"-module-created, non-daemon threads. wait_for_thread_shutdown(tstate); @@ -1677,13 +1660,13 @@ Py_FinalizeEx(void) /* Copy the core config, PyInterpreterState_Delete() free the core config memory */ #ifdef Py_REF_DEBUG - int show_ref_count = interp->config.show_ref_count; + int show_ref_count = tstate->interp->config.show_ref_count; #endif #ifdef Py_TRACE_REFS - int dump_refs = interp->config.dump_refs; + int dump_refs = tstate->interp->config.dump_refs; #endif #ifdef WITH_PYMALLOC - int malloc_stats = interp->config.malloc_stats; + int malloc_stats = tstate->interp->config.malloc_stats; #endif /* Remaining daemon threads will automatically exit @@ -1708,7 +1691,7 @@ Py_FinalizeEx(void) } /* Disable signal handling */ - PyOS_FiniInterrupts(); + _PySignal_Fini(); /* Collect garbage. This may call finalizers; it's nice to call these * before all modules are destroyed. @@ -2736,48 +2719,6 @@ Py_Exit(int sts) exit(sts); } -static PyStatus -init_signals(PyThreadState *tstate) -{ -#ifdef SIGPIPE - PyOS_setsig(SIGPIPE, SIG_IGN); -#endif -#ifdef SIGXFZ - PyOS_setsig(SIGXFZ, SIG_IGN); -#endif -#ifdef SIGXFSZ - PyOS_setsig(SIGXFSZ, SIG_IGN); -#endif - PyOS_InitInterrupts(); /* May imply init_signals() */ - if (_PyErr_Occurred(tstate)) { - return _PyStatus_ERR("can't import signal"); - } - return _PyStatus_OK(); -} - - -/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. - * - * All of the code in this function must only use async-signal-safe functions, - * listed at `man 7 signal` or - * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html. - * - * If this function is updated, update also _posix_spawn() of subprocess.py. - */ -void -_Py_RestoreSignals(void) -{ -#ifdef SIGPIPE - PyOS_setsig(SIGPIPE, SIG_DFL); -#endif -#ifdef SIGXFZ - PyOS_setsig(SIGXFZ, SIG_DFL); -#endif -#ifdef SIGXFSZ - PyOS_setsig(SIGXFSZ, SIG_DFL); -#endif -} - /* * The file descriptor fd is considered ``interactive'' if either diff --git a/Python/pystate.c b/Python/pystate.c index 9a20fb3776de7d..19e25dac69de97 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -607,7 +607,7 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->frame = NULL; tstate->recursion_depth = 0; - tstate->overflowed = 0; + tstate->recursion_headroom = 0; tstate->stackcheck_counter = 0; tstate->tracing = 0; tstate->use_tracing = 0; diff --git a/Python/pystrtod.c b/Python/pystrtod.c index 1c8202c7761884..9145d4eba121e1 100644 --- a/Python/pystrtod.c +++ b/Python/pystrtod.c @@ -255,7 +255,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr) char *copy, *c; /* Create a copy of the input, with the '.' converted to the locale-specific decimal point */ - copy = (char *)PyMem_MALLOC(end - digits_pos + + copy = (char *)PyMem_Malloc(end - digits_pos + 1 + decimal_point_len); if (copy == NULL) { *endptr = (char *)nptr; @@ -286,7 +286,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr) (fail_pos - copy); } - PyMem_FREE(copy); + PyMem_Free(copy); } else { diff --git a/Python/pythonrun.c b/Python/pythonrun.c index bd49c40e9786c3..15e407d9195c0c 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -59,9 +59,13 @@ extern "C" { static void flush_io(void); static PyObject *run_mod(mod_ty, PyObject *, PyObject *, PyObject *, PyCompilerFlags *, PyArena *); -static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *, +static PyObject *run_pyc_file(FILE *, PyObject *, PyObject *, PyCompilerFlags *); static int PyRun_InteractiveOneObjectEx(FILE *, PyObject *, PyCompilerFlags *); +static PyObject* pyrun_file(FILE *fp, PyObject *filename, int start, + PyObject *globals, PyObject *locals, int closeit, + PyCompilerFlags *flags); + /* Parse input from a file and execute it */ int @@ -269,82 +273,89 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename_str, PyCompilerFlags *f the file type, and, if we may close it, at the first few bytes. */ static int -maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit) +maybe_pyc_file(FILE *fp, PyObject *filename, int closeit) { - if (strcmp(ext, ".pyc") == 0) + PyObject *ext = PyUnicode_FromString(".pyc"); + if (ext == NULL) { + return -1; + } + Py_ssize_t endswith = PyUnicode_Tailmatch(filename, ext, 0, PY_SSIZE_T_MAX, +1); + Py_DECREF(ext); + if (endswith) { return 1; + } /* Only look into the file if we are allowed to close it, since it then should also be seekable. */ - if (closeit) { - /* Read only two bytes of the magic. If the file was opened in - text mode, the bytes 3 and 4 of the magic (\r\n) might not - be read as they are on disk. */ - unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; - unsigned char buf[2]; - /* Mess: In case of -x, the stream is NOT at its start now, - and ungetc() was used to push back the first newline, - which makes the current stream position formally undefined, - and a x-platform nightmare. - Unfortunately, we have no direct way to know whether -x - was specified. So we use a terrible hack: if the current - stream position is not 0, we assume -x was specified, and - give up. Bug 132850 on SourceForge spells out the - hopelessness of trying anything else (fseek and ftell - don't work predictably x-platform for text-mode files). - */ - int ispyc = 0; - if (ftell(fp) == 0) { - if (fread(buf, 1, 2, fp) == 2 && - ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) - ispyc = 1; - rewind(fp); - } - return ispyc; + if (!closeit) { + return 0; } - return 0; + + /* Read only two bytes of the magic. If the file was opened in + text mode, the bytes 3 and 4 of the magic (\r\n) might not + be read as they are on disk. */ + unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; + unsigned char buf[2]; + /* Mess: In case of -x, the stream is NOT at its start now, + and ungetc() was used to push back the first newline, + which makes the current stream position formally undefined, + and a x-platform nightmare. + Unfortunately, we have no direct way to know whether -x + was specified. So we use a terrible hack: if the current + stream position is not 0, we assume -x was specified, and + give up. Bug 132850 on SourceForge spells out the + hopelessness of trying anything else (fseek and ftell + don't work predictably x-platform for text-mode files). + */ + int ispyc = 0; + if (ftell(fp) == 0) { + if (fread(buf, 1, 2, fp) == 2 && + ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) + ispyc = 1; + rewind(fp); + } + return ispyc; } + static int -set_main_loader(PyObject *d, const char *filename, const char *loader_name) +set_main_loader(PyObject *d, PyObject *filename, const char *loader_name) { - PyObject *filename_obj, *bootstrap, *loader_type = NULL, *loader; - int result = 0; - - filename_obj = PyUnicode_DecodeFSDefault(filename); - if (filename_obj == NULL) - return -1; PyInterpreterState *interp = _PyInterpreterState_GET(); - bootstrap = PyObject_GetAttrString(interp->importlib, - "_bootstrap_external"); - if (bootstrap != NULL) { - loader_type = PyObject_GetAttrString(bootstrap, loader_name); - Py_DECREF(bootstrap); + PyObject *bootstrap = PyObject_GetAttrString(interp->importlib, + "_bootstrap_external"); + if (bootstrap == NULL) { + return -1; } + + PyObject *loader_type = PyObject_GetAttrString(bootstrap, loader_name); + Py_DECREF(bootstrap); if (loader_type == NULL) { - Py_DECREF(filename_obj); return -1; } - loader = PyObject_CallFunction(loader_type, "sN", "__main__", filename_obj); + + PyObject *loader = PyObject_CallFunction(loader_type, + "sO", "__main__", filename); Py_DECREF(loader_type); if (loader == NULL) { return -1; } + if (PyDict_SetItemString(d, "__loader__", loader) < 0) { - result = -1; + Py_DECREF(loader); + return -1; } Py_DECREF(loader); - return result; + return 0; } + int -PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, +_PyRun_SimpleFileObject(FILE *fp, PyObject *filename, int closeit, PyCompilerFlags *flags) { PyObject *m, *d, *v; - const char *ext; int set_file_name = 0, ret = -1; - size_t len; m = PyImport_AddModule("__main__"); if (m == NULL) @@ -355,29 +366,29 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, if (PyErr_Occurred()) { goto done; } - PyObject *f; - f = PyUnicode_DecodeFSDefault(filename); - if (f == NULL) - goto done; - if (PyDict_SetItemString(d, "__file__", f) < 0) { - Py_DECREF(f); + if (PyDict_SetItemString(d, "__file__", filename) < 0) { goto done; } if (PyDict_SetItemString(d, "__cached__", Py_None) < 0) { - Py_DECREF(f); goto done; } set_file_name = 1; - Py_DECREF(f); } - len = strlen(filename); - ext = filename + len - (len > 4 ? 4 : 0); - if (maybe_pyc_file(fp, filename, ext, closeit)) { + + int pyc = maybe_pyc_file(fp, filename, closeit); + if (pyc < 0) { + goto done; + } + + if (pyc) { FILE *pyc_fp; /* Try to run a pyc file. First, re-open in binary */ - if (closeit) + if (closeit) { fclose(fp); - if ((pyc_fp = _Py_fopen(filename, "rb")) == NULL) { + } + + pyc_fp = _Py_fopen_obj(filename, "rb"); + if (pyc_fp == NULL) { fprintf(stderr, "python: Can't reopen .pyc file\n"); goto done; } @@ -388,17 +399,17 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, fclose(pyc_fp); goto done; } - v = run_pyc_file(pyc_fp, filename, d, d, flags); + v = run_pyc_file(pyc_fp, d, d, flags); } else { /* When running from stdin, leave __main__.__loader__ alone */ - if (strcmp(filename, "") != 0 && + if (PyUnicode_CompareWithASCIIString(filename, "") != 0 && set_main_loader(d, filename, "SourceFileLoader") < 0) { fprintf(stderr, "python: failed to set __main__.__loader__\n"); ret = -1; goto done; } - v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, - closeit, flags); + v = pyrun_file(fp, filename, Py_file_input, d, d, + closeit, flags); } flush_io(); if (v == NULL) { @@ -421,6 +432,21 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, return ret; } + +int +PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, + PyCompilerFlags *flags) +{ + PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename); + if (filename_obj == NULL) { + return -1; + } + int res = _PyRun_SimpleFileObject(fp, filename_obj, closeit, flags); + Py_DECREF(filename_obj); + return res; +} + + int PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) { @@ -1039,40 +1065,54 @@ PyRun_StringFlags(const char *str, int start, PyObject *globals, return ret; } -PyObject * -PyRun_FileExFlags(FILE *fp, const char *filename_str, int start, PyObject *globals, - PyObject *locals, int closeit, PyCompilerFlags *flags) -{ - PyObject *ret = NULL; - mod_ty mod; - PyArena *arena = NULL; - PyObject *filename; - - filename = PyUnicode_DecodeFSDefault(filename_str); - if (filename == NULL) - goto exit; - arena = PyArena_New(); - if (arena == NULL) - goto exit; +static PyObject * +pyrun_file(FILE *fp, PyObject *filename, int start, PyObject *globals, + PyObject *locals, int closeit, PyCompilerFlags *flags) +{ + PyArena *arena = PyArena_New(); + if (arena == NULL) { + return NULL; + } + mod_ty mod; mod = PyParser_ASTFromFileObject(fp, filename, NULL, start, NULL, NULL, flags, NULL, arena); - if (closeit) + if (closeit) { fclose(fp); - if (mod == NULL) { - goto exit; } - ret = run_mod(mod, filename, globals, locals, flags, arena); -exit: - Py_XDECREF(filename); - if (arena != NULL) - PyArena_Free(arena); + PyObject *ret; + if (mod != NULL) { + ret = run_mod(mod, filename, globals, locals, flags, arena); + } + else { + ret = NULL; + } + PyArena_Free(arena); + return ret; } + +PyObject * +PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals, + PyObject *locals, int closeit, PyCompilerFlags *flags) +{ + PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename); + if (filename_obj == NULL) { + return NULL; + } + + PyObject *res = pyrun_file(fp, filename_obj, start, globals, + locals, closeit, flags); + Py_DECREF(filename_obj); + return res; + +} + + static void flush_io(void) { @@ -1155,8 +1195,8 @@ run_mod(mod_ty mod, PyObject *filename, PyObject *globals, PyObject *locals, } static PyObject * -run_pyc_file(FILE *fp, const char *filename, PyObject *globals, - PyObject *locals, PyCompilerFlags *flags) +run_pyc_file(FILE *fp, PyObject *globals, PyObject *locals, + PyCompilerFlags *flags) { PyThreadState *tstate = _PyThreadState_GET(); PyCodeObject *co; @@ -1235,14 +1275,6 @@ Py_CompileStringExFlags(const char *str, const char *filename_str, int start, return co; } -/* For use in Py_LIMITED_API */ -#undef Py_CompileString -PyObject * -PyCompileString(const char *str, const char *filename, int start) -{ - return Py_CompileStringFlags(str, filename, start, NULL); -} - const char * _Py_SourceAsString(PyObject *cmd, const char *funcname, const char *what, PyCompilerFlags *cf, PyObject **cmd_copy) { @@ -1371,6 +1403,109 @@ PyOS_CheckStack(void) #endif /* USE_STACKCHECK */ +/* Deprecated C API functions still provided for binary compatibility */ + +#undef PyRun_AnyFile +PyAPI_FUNC(int) +PyRun_AnyFile(FILE *fp, const char *name) +{ + return PyRun_AnyFileExFlags(fp, name, 0, NULL); +} + +#undef PyRun_AnyFileEx +PyAPI_FUNC(int) +PyRun_AnyFileEx(FILE *fp, const char *name, int closeit) +{ + return PyRun_AnyFileExFlags(fp, name, closeit, NULL); +} + +#undef PyRun_AnyFileFlags +PyAPI_FUNC(int) +PyRun_AnyFileFlags(FILE *fp, const char *name, PyCompilerFlags *flags) +{ + return PyRun_AnyFileExFlags(fp, name, 0, flags); +} + +#undef PyRun_File +PyAPI_FUNC(PyObject *) +PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l) +{ + return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); +} + +#undef PyRun_FileEx +PyAPI_FUNC(PyObject *) +PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c) +{ + return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); +} + +#undef PyRun_FileFlags +PyAPI_FUNC(PyObject *) +PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, + PyCompilerFlags *flags) +{ + return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); +} + +#undef PyRun_SimpleFile +PyAPI_FUNC(int) +PyRun_SimpleFile(FILE *f, const char *p) +{ + return PyRun_SimpleFileExFlags(f, p, 0, NULL); +} + +#undef PyRun_SimpleFileEx +PyAPI_FUNC(int) +PyRun_SimpleFileEx(FILE *f, const char *p, int c) +{ + return PyRun_SimpleFileExFlags(f, p, c, NULL); +} + + +#undef PyRun_String +PyAPI_FUNC(PyObject *) +PyRun_String(const char *str, int s, PyObject *g, PyObject *l) +{ + return PyRun_StringFlags(str, s, g, l, NULL); +} + +#undef PyRun_SimpleString +PyAPI_FUNC(int) +PyRun_SimpleString(const char *s) +{ + return PyRun_SimpleStringFlags(s, NULL); +} + +#undef Py_CompileString +PyAPI_FUNC(PyObject *) +Py_CompileString(const char *str, const char *p, int s) +{ + return Py_CompileStringExFlags(str, p, s, NULL, -1); +} + +#undef Py_CompileStringFlags +PyAPI_FUNC(PyObject *) +Py_CompileStringFlags(const char *str, const char *p, int s, + PyCompilerFlags *flags) +{ + return Py_CompileStringExFlags(str, p, s, flags, -1); +} + +#undef PyRun_InteractiveOne +PyAPI_FUNC(int) +PyRun_InteractiveOne(FILE *f, const char *p) +{ + return PyRun_InteractiveOneFlags(f, p, NULL); +} + +#undef PyRun_InteractiveLoop +PyAPI_FUNC(int) +PyRun_InteractiveLoop(FILE *f, const char *p) +{ + return PyRun_InteractiveLoopFlags(f, p, NULL); +} + #ifdef __cplusplus } #endif diff --git a/Python/pytime.c b/Python/pytime.c index 89d63e080422b3..1ef99aee748466 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -6,7 +6,7 @@ #if defined(__APPLE__) #include /* mach_absolute_time(), mach_timebase_info() */ -#if defined(__APPLE__) && defined(__has_builtin) +#if defined(__APPLE__) && defined(__has_builtin) # if __has_builtin(__builtin_available) # define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) # endif @@ -304,8 +304,8 @@ pytime_fromtimespec(_PyTime_t *tp, struct timespec *ts, int raise) if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) { if (raise) { _PyTime_overflow(); + res = -1; } - res = -1; t = (t > 0) ? _PyTime_MAX : _PyTime_MIN; } else { @@ -318,8 +318,8 @@ pytime_fromtimespec(_PyTime_t *tp, struct timespec *ts, int raise) if (t > _PyTime_MAX - nsec) { if (raise) { _PyTime_overflow(); + res = -1; } - res = -1; t = _PyTime_MAX; } else { @@ -350,8 +350,8 @@ pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise) if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) { if (raise) { _PyTime_overflow(); + res = -1; } - res = -1; t = (t > 0) ? _PyTime_MAX : _PyTime_MIN; } else { @@ -364,8 +364,8 @@ pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise) if (t > _PyTime_MAX - usec) { if (raise) { _PyTime_overflow(); + res = -1; } - res = -1; t = _PyTime_MAX; } else { @@ -656,7 +656,7 @@ _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts) #endif static int -pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise) +py_get_system_clock(_PyTime_t *tp, _Py_clock_info_t *info, int raise) { #ifdef MS_WINDOWS FILETIME system_time; @@ -730,7 +730,7 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise) } #ifdef HAVE_CLOCK_GETTIME_RUNTIME - } else { + } else { #endif #endif @@ -769,9 +769,10 @@ _PyTime_t _PyTime_GetSystemClock(void) { _PyTime_t t; - if (pygettimeofday(&t, NULL, 0) < 0) { - /* should not happen, _PyTime_Init() checked the clock at startup */ - Py_FatalError("pygettimeofday() failed"); + if (py_get_system_clock(&t, NULL, 0) < 0) { + // If clock_gettime(CLOCK_REALTIME) or gettimeofday() fails: + // silently ignore the failure and return 0. + t = 0; } return t; } @@ -779,11 +780,61 @@ _PyTime_GetSystemClock(void) int _PyTime_GetSystemClockWithInfo(_PyTime_t *t, _Py_clock_info_t *info) { - return pygettimeofday(t, info, 1); + return py_get_system_clock(t, info, 1); } +#if __APPLE__ static int -pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) +py_mach_timebase_info(_PyTime_t *pnumer, _PyTime_t *pdenom, int raise) +{ + static mach_timebase_info_data_t timebase; + /* According to the Technical Q&A QA1398, mach_timebase_info() cannot + fail: https://developer.apple.com/library/mac/#qa/qa1398/ */ + (void)mach_timebase_info(&timebase); + + /* Sanity check: should never occur in practice */ + if (timebase.numer < 1 || timebase.denom < 1) { + if (raise) { + PyErr_SetString(PyExc_RuntimeError, + "invalid mach_timebase_info"); + } + return -1; + } + + /* Check that timebase.numer and timebase.denom can be casted to + _PyTime_t. In practice, timebase uses uint32_t, so casting cannot + overflow. At the end, only make sure that the type is uint32_t + (_PyTime_t is 64-bit long). */ + Py_BUILD_ASSERT(sizeof(timebase.numer) < sizeof(_PyTime_t)); + Py_BUILD_ASSERT(sizeof(timebase.denom) < sizeof(_PyTime_t)); + + /* Make sure that (ticks * timebase.numer) cannot overflow in + _PyTime_MulDiv(), with ticks < timebase.denom. + + Known time bases: + + * always (1, 1) on Intel + * (1000000000, 33333335) or (1000000000, 25000000) on PowerPC + + None of these time bases can overflow with 64-bit _PyTime_t, but + check for overflow, just in case. */ + if ((_PyTime_t)timebase.numer > _PyTime_MAX / (_PyTime_t)timebase.denom) { + if (raise) { + PyErr_SetString(PyExc_OverflowError, + "mach_timebase_info is too large"); + } + return -1; + } + + *pnumer = (_PyTime_t)timebase.numer; + *pdenom = (_PyTime_t)timebase.denom; + return 0; +} +#endif + + +static int +py_get_monotonic_clock(_PyTime_t *tp, _Py_clock_info_t *info, int raise) { #if defined(MS_WINDOWS) ULONGLONG ticks; @@ -800,10 +851,12 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) _PyTime_overflow(); return -1; } - /* Hello, time traveler! */ - Py_FatalError("pymonotonic: integer overflow"); + // Truncate to _PyTime_MAX silently. + *tp = _PyTime_MAX; + } + else { + *tp = t * MS_TO_NS; } - *tp = t * MS_TO_NS; if (info) { DWORD timeAdjustment, timeIncrement; @@ -821,62 +874,23 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) } #elif defined(__APPLE__) - static mach_timebase_info_data_t timebase; - static uint64_t t0 = 0; - uint64_t ticks; - - if (timebase.denom == 0) { - /* According to the Technical Q&A QA1398, mach_timebase_info() cannot - fail: https://developer.apple.com/library/mac/#qa/qa1398/ */ - (void)mach_timebase_info(&timebase); - - /* Sanity check: should never occur in practice */ - if (timebase.numer < 1 || timebase.denom < 1) { - PyErr_SetString(PyExc_RuntimeError, - "invalid mach_timebase_info"); - return -1; - } - - /* Check that timebase.numer and timebase.denom can be casted to - _PyTime_t. In practice, timebase uses uint32_t, so casting cannot - overflow. At the end, only make sure that the type is uint32_t - (_PyTime_t is 64-bit long). */ - assert(sizeof(timebase.numer) < sizeof(_PyTime_t)); - assert(sizeof(timebase.denom) < sizeof(_PyTime_t)); - - /* Make sure that (ticks * timebase.numer) cannot overflow in - _PyTime_MulDiv(), with ticks < timebase.denom. - - Known time bases: - - * always (1, 1) on Intel - * (1000000000, 33333335) or (1000000000, 25000000) on PowerPC - - None of these time bases can overflow with 64-bit _PyTime_t, but - check for overflow, just in case. */ - if ((_PyTime_t)timebase.numer > _PyTime_MAX / (_PyTime_t)timebase.denom) { - PyErr_SetString(PyExc_OverflowError, - "mach_timebase_info is too large"); + static _PyTime_t timebase_numer = 0; + static _PyTime_t timebase_denom = 0; + if (timebase_denom == 0) { + if (py_mach_timebase_info(&timebase_numer, &timebase_denom, raise) < 0) { return -1; } - - t0 = mach_absolute_time(); } if (info) { info->implementation = "mach_absolute_time()"; - info->resolution = (double)timebase.numer / (double)timebase.denom * 1e-9; + info->resolution = (double)timebase_numer / (double)timebase_denom * 1e-9; info->monotonic = 1; info->adjustable = 0; } - ticks = mach_absolute_time(); - /* Use a "time zero" to reduce precision loss when converting time - to floatting point number, as in time.monotonic(). */ - ticks -= t0; - *tp = _PyTime_MulDiv(ticks, - (_PyTime_t)timebase.numer, - (_PyTime_t)timebase.denom); + uint64_t ticks = mach_absolute_time(); + *tp = _PyTime_MulDiv((_PyTime_t)ticks, timebase_numer, timebase_denom); #elif defined(__hpux) hrtime_t time; @@ -940,10 +954,10 @@ _PyTime_t _PyTime_GetMonotonicClock(void) { _PyTime_t t; - if (pymonotonic(&t, NULL, 0) < 0) { - /* should not happen, _PyTime_Init() checked that monotonic clock at - startup */ - Py_FatalError("pymonotonic() failed"); + if (py_get_monotonic_clock(&t, NULL, 0) < 0) { + // If mach_timebase_info(), clock_gettime() or gethrtime() fails: + // silently ignore the failure and return 0. + t = 0; } return t; } @@ -951,56 +965,69 @@ _PyTime_GetMonotonicClock(void) int _PyTime_GetMonotonicClockWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) { - return pymonotonic(tp, info, 1); + return py_get_monotonic_clock(tp, info, 1); } #ifdef MS_WINDOWS static int -win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info) +win_perf_counter_frequency(LONGLONG *pfrequency, int raise) { - static LONGLONG frequency = 0; - static LONGLONG t0 = 0; - LARGE_INTEGER now; - LONGLONG ticksll; - _PyTime_t ticks; + LONGLONG frequency; - if (frequency == 0) { - LARGE_INTEGER freq; - if (!QueryPerformanceFrequency(&freq)) { + LARGE_INTEGER freq; + if (!QueryPerformanceFrequency(&freq)) { + if (raise) { PyErr_SetFromWindowsErr(0); - return -1; } - frequency = freq.QuadPart; + return -1; + } + frequency = freq.QuadPart; - /* Sanity check: should never occur in practice */ - if (frequency < 1) { + /* Sanity check: should never occur in practice */ + if (frequency < 1) { + if (raise) { PyErr_SetString(PyExc_RuntimeError, "invalid QueryPerformanceFrequency"); - return -1; } + return -1; + } - /* Check that frequency can be casted to _PyTime_t. + /* Check that frequency can be casted to _PyTime_t. - Make also sure that (ticks * SEC_TO_NS) cannot overflow in - _PyTime_MulDiv(), with ticks < frequency. + Make also sure that (ticks * SEC_TO_NS) cannot overflow in + _PyTime_MulDiv(), with ticks < frequency. - Known QueryPerformanceFrequency() values: + Known QueryPerformanceFrequency() values: - * 10,000,000 (10 MHz): 100 ns resolution - * 3,579,545 Hz (3.6 MHz): 279 ns resolution + * 10,000,000 (10 MHz): 100 ns resolution + * 3,579,545 Hz (3.6 MHz): 279 ns resolution - None of these frequencies can overflow with 64-bit _PyTime_t, but - check for overflow, just in case. */ - if (frequency > _PyTime_MAX - || frequency > (LONGLONG)_PyTime_MAX / (LONGLONG)SEC_TO_NS) { + None of these frequencies can overflow with 64-bit _PyTime_t, but + check for overflow, just in case. */ + if (frequency > _PyTime_MAX + || frequency > (LONGLONG)_PyTime_MAX / (LONGLONG)SEC_TO_NS) + { + if (raise) { PyErr_SetString(PyExc_OverflowError, "QueryPerformanceFrequency is too large"); - return -1; } + return -1; + } - QueryPerformanceCounter(&now); - t0 = now.QuadPart; + *pfrequency = frequency; + return 0; +} + + +static int +py_get_win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info, int raise) +{ + static LONGLONG frequency = 0; + if (frequency == 0) { + if (win_perf_counter_frequency(&frequency, raise) < 0) { + return -1; + } } if (info) { @@ -1010,15 +1037,13 @@ win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info) info->adjustable = 0; } + LARGE_INTEGER now; QueryPerformanceCounter(&now); - ticksll = now.QuadPart; - - /* Use a "time zero" to reduce precision loss when converting time - to floatting point number, as in time.perf_counter(). */ - ticksll -= t0; + LONGLONG ticksll = now.QuadPart; /* Make sure that casting LONGLONG to _PyTime_t cannot overflow, both types are signed */ + _PyTime_t ticks; Py_BUILD_ASSERT(sizeof(ticksll) <= sizeof(ticks)); ticks = (_PyTime_t)ticksll; @@ -1032,7 +1057,7 @@ int _PyTime_GetPerfCounterWithInfo(_PyTime_t *t, _Py_clock_info_t *info) { #ifdef MS_WINDOWS - return win_perf_counter(t, info); + return py_get_win_perf_counter(t, info, 1); #else return _PyTime_GetMonotonicClockWithInfo(t, info); #endif @@ -1043,32 +1068,21 @@ _PyTime_t _PyTime_GetPerfCounter(void) { _PyTime_t t; - if (_PyTime_GetPerfCounterWithInfo(&t, NULL)) { - Py_FatalError("_PyTime_GetPerfCounterWithInfo() failed"); + int res; +#ifdef MS_WINDOWS + res = py_get_win_perf_counter(&t, NULL, 0); +#else + res = py_get_monotonic_clock(&t, NULL, 0); +#endif + if (res < 0) { + // If win_perf_counter_frequency() or py_get_monotonic_clock() fails: + // silently ignore the failure and return 0. + t = 0; } return t; } -int -_PyTime_Init(void) -{ - /* check that time.time(), time.monotonic() and time.perf_counter() clocks - are working properly to not have to check for exceptions at runtime. If - a clock works once, it cannot fail in next calls. */ - _PyTime_t t; - if (_PyTime_GetSystemClockWithInfo(&t, NULL) < 0) { - return -1; - } - if (_PyTime_GetMonotonicClockWithInfo(&t, NULL) < 0) { - return -1; - } - if (_PyTime_GetPerfCounterWithInfo(&t, NULL) < 0) { - return -1; - } - return 0; -} - int _PyTime_localtime(time_t t, struct tm *tm) { diff --git a/Python/symtable.c b/Python/symtable.c index c1b89ea7c9560a..10a47d1215e665 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -128,7 +128,7 @@ ste_dealloc(PySTEntryObject *ste) Py_XDECREF(ste->ste_varnames); Py_XDECREF(ste->ste_children); Py_XDECREF(ste->ste_directives); - PyObject_Del(ste); + PyObject_Free(ste); } #define OFF(x) offsetof(PySTEntryObject, x) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index f05b33a9aacf1d..b80d37df42c808 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1181,7 +1181,6 @@ static PyObject * sys_setrecursionlimit_impl(PyObject *module, int new_limit) /*[clinic end generated code: output=35e1c64754800ace input=b0f7a23393924af3]*/ { - int mark; PyThreadState *tstate = _PyThreadState_GET(); if (new_limit < 1) { @@ -1199,8 +1198,7 @@ sys_setrecursionlimit_impl(PyObject *module, int new_limit) Reject too low new limit if the current recursion depth is higher than the new low-water mark. Otherwise it may not be possible anymore to reset the overflowed flag to 0. */ - mark = _Py_RecursionLimitLowerWaterMark(new_limit); - if (tstate->recursion_depth >= mark) { + if (tstate->recursion_depth >= new_limit) { _PyErr_Format(tstate, PyExc_RecursionError, "cannot set the recursion limit to %i at " "the recursion depth %i: the limit is too low", diff --git a/Python/traceback.c b/Python/traceback.c index 99b63af11f8bee..708678facf7c31 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -419,12 +419,12 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent) if (lseek(fd, 0, SEEK_SET) == (off_t)-1) { Py_DECREF(io); Py_DECREF(binary); - PyMem_FREE(found_encoding); + PyMem_Free(found_encoding); return 0; } fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding); Py_DECREF(io); - PyMem_FREE(found_encoding); + PyMem_Free(found_encoding); if (fob == NULL) { PyErr_Clear(); diff --git a/README.rst b/README.rst index b27854d9178637..51d60d5da62092 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -This is Python version 3.10.0 alpha 2 +This is Python version 3.10.0 alpha 3 ===================================== .. image:: https://travis-ci.com/python/cpython.svg?branch=master diff --git a/Tools/c-analyzer/c_analyzer/__main__.py b/Tools/c-analyzer/c_analyzer/__main__.py index 4cff1d4efb5fe9..44325f2952e28c 100644 --- a/Tools/c-analyzer/c_analyzer/__main__.py +++ b/Tools/c-analyzer/c_analyzer/__main__.py @@ -5,6 +5,7 @@ import re import sys +from c_common import fsutil from c_common.logging import VERBOSITY, Printer from c_common.scriptutil import ( add_verbosity_cli, @@ -298,9 +299,9 @@ def cmd_check(filenames, *, checks=None, ignored=None, fmt=None, - relroot=None, failfast=False, iter_filenames=None, + relroot=fsutil.USE_CWD, track_progress=None, verbosity=VERBOSITY, _analyze=_analyze, @@ -317,14 +318,14 @@ def cmd_check(filenames, *, (handle_failure, handle_after, div ) = _get_check_handlers(fmt, printer, verbosity) - filenames = filter_filenames(filenames, iter_filenames) + filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot) + filenames = filter_filenames(filenames, iter_filenames, relroot) if track_progress: filenames = track_progress(filenames) logger.info('analyzing files...') analyzed = _analyze(filenames, **kwargs) - if relroot: - analyzed.fix_filenames(relroot) + analyzed.fix_filenames(relroot, normalize=False) decls = filter_forward(analyzed, markpublic=True) logger.info('checking analysis results...') @@ -374,6 +375,7 @@ def _cli_analyze(parser, **kwargs): def cmd_analyze(filenames, *, fmt=None, iter_filenames=None, + relroot=fsutil.USE_CWD, track_progress=None, verbosity=None, _analyze=_analyze, @@ -387,12 +389,14 @@ def cmd_analyze(filenames, *, except KeyError: raise ValueError(f'unsupported fmt {fmt!r}') - filenames = filter_filenames(filenames, iter_filenames) + filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot) + filenames = filter_filenames(filenames, iter_filenames, relroot) if track_progress: filenames = track_progress(filenames) logger.info('analyzing files...') analyzed = _analyze(filenames, **kwargs) + analyzed.fix_filenames(relroot, normalize=False) decls = filter_forward(analyzed, markpublic=True) for line in do_fmt(decls): @@ -434,7 +438,7 @@ def cmd_data(datacmd, filenames, known=None, *, _analyze=_analyze, formats=FORMATS, extracolumns=None, - relroot=None, + relroot=fsutil.USE_CWD, track_progress=None, **kwargs ): @@ -447,9 +451,11 @@ def cmd_data(datacmd, filenames, known=None, *, for line in do_fmt(known): print(line) elif datacmd == 'dump': + filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot) if track_progress: filenames = track_progress(filenames) analyzed = _analyze(filenames, **kwargs) + analyzed.fix_filenames(relroot, normalize=False) if known is None or usestdout: outfile = io.StringIO() _datafiles.write_known(analyzed, outfile, extracolumns, diff --git a/Tools/c-analyzer/c_analyzer/datafiles.py b/Tools/c-analyzer/c_analyzer/datafiles.py index d37a4eefe351ad..d5db3bd3ed74ac 100644 --- a/Tools/c-analyzer/c_analyzer/datafiles.py +++ b/Tools/c-analyzer/c_analyzer/datafiles.py @@ -1,3 +1,6 @@ +import os.path + +from c_common import fsutil import c_common.tables as _tables import c_parser.info as _info import c_parser.match as _match @@ -13,31 +16,10 @@ ] -def analyze_known(known, *, - analyze_resolved=None, - handle_unresolved=True, - ): - knowntypes = knowntypespecs = {} - collated = _match.group_by_kinds(known) - types = {decl: None for decl in collated['type']} - typespecs = _analyze.get_typespecs(types) - def analyze_decl(decl): - return _analyze.analyze_decl( - decl, - typespecs, - knowntypespecs, - types, - knowntypes, - analyze_resolved=analyze_resolved, - ) - _analyze.analyze_type_decls(types, analyze_decl, handle_unresolved) - return types, typespecs - - def get_known(known, extracolumns=None, *, analyze_resolved=None, handle_unresolved=True, - relroot=None, + relroot=fsutil.USE_CWD, ): if isinstance(known, str): known = read_known(known, extracolumns, relroot) @@ -48,7 +30,7 @@ def get_known(known, extracolumns=None, *, ) -def read_known(infile, extracolumns=None, relroot=None): +def read_known(infile, extracolumns=None, relroot=fsutil.USE_CWD): extracolumns = EXTRA_COLUMNS + ( list(extracolumns) if extracolumns else [] ) @@ -58,8 +40,29 @@ def read_known(infile, extracolumns=None, relroot=None): return known +def analyze_known(known, *, + analyze_resolved=None, + handle_unresolved=True, + ): + knowntypes = knowntypespecs = {} + collated = _match.group_by_kinds(known) + types = {decl: None for decl in collated['type']} + typespecs = _analyze.get_typespecs(types) + def analyze_decl(decl): + return _analyze.analyze_decl( + decl, + typespecs, + knowntypespecs, + types, + knowntypes, + analyze_resolved=analyze_resolved, + ) + _analyze.analyze_type_decls(types, analyze_decl, handle_unresolved) + return types, typespecs + + def write_known(rows, outfile, extracolumns=None, *, - relroot=None, + relroot=fsutil.USE_CWD, backup=True, ): extracolumns = EXTRA_COLUMNS + ( @@ -86,22 +89,34 @@ def write_known(rows, outfile, extracolumns=None, *, IGNORED_HEADER = '\t'.join(IGNORED_COLUMNS) -def read_ignored(infile): - return dict(_iter_ignored(infile)) +def read_ignored(infile, relroot=fsutil.USE_CWD): + return dict(_iter_ignored(infile, relroot)) -def _iter_ignored(infile): +def _iter_ignored(infile, relroot): + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) + bogus = {_tables.EMPTY, _tables.UNKNOWN} for row in _tables.read_table(infile, IGNORED_HEADER, sep='\t'): *varidinfo, reason = row + if _tables.EMPTY in varidinfo or _tables.UNKNOWN in varidinfo: + varidinfo = tuple(None if v in bogus else v + for v in varidinfo) + if reason in bogus: + reason = None varid = _info.DeclID.from_row(varidinfo) + varid = varid.fix_filename(relroot, formatted=False, fixroot=False) yield varid, reason -def write_ignored(variables, outfile): +def write_ignored(variables, outfile, relroot=fsutil.USE_CWD): raise NotImplementedError + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) reason = '???' #if not isinstance(varid, DeclID): # varid = getattr(varid, 'parsed', varid).id + decls = (d.fix_filename(relroot, fixroot=False) for d in decls) _tables.write_table( outfile, IGNORED_HEADER, diff --git a/Tools/c-analyzer/c_analyzer/info.py b/Tools/c-analyzer/c_analyzer/info.py index be9281502d250d..b75918e5e7a687 100644 --- a/Tools/c-analyzer/c_analyzer/info.py +++ b/Tools/c-analyzer/c_analyzer/info.py @@ -1,5 +1,7 @@ from collections import namedtuple +import os.path +from c_common import fsutil from c_common.clsutil import classonly import c_common.misc as _misc from c_parser.info import ( @@ -223,8 +225,9 @@ def is_known(self): else: return UNKNOWN not in self.typedecl - def fix_filename(self, relroot): - self.item.fix_filename(relroot) + def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): + self.item.fix_filename(relroot, **kwargs) + return self def as_rowdata(self, columns=None): # XXX finsih! @@ -309,9 +312,11 @@ def __getitem__(self, key): else: return self._analyzed[key] - def fix_filenames(self, relroot): + def fix_filenames(self, relroot=fsutil.USE_CWD, **kwargs): + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) for item in self._analyzed: - item.fix_filename(relroot) + item.fix_filename(relroot, fixroot=False, **kwargs) def _add_result(self, info, resolved): analyzed = type(self).build_item(info, resolved) diff --git a/Tools/c-analyzer/c_common/fsutil.py b/Tools/c-analyzer/c_common/fsutil.py index 56023f33523b0d..120a140288fb72 100644 --- a/Tools/c-analyzer/c_common/fsutil.py +++ b/Tools/c-analyzer/c_common/fsutil.py @@ -8,6 +8,9 @@ from .iterutil import iter_many +USE_CWD = object() + + C_SOURCE_SUFFIXES = ('.c', '.h') @@ -29,6 +32,78 @@ def create_backup(old, backup=None): return backup +################################## +# filenames + +def fix_filename(filename, relroot=USE_CWD, *, + fixroot=True, + _badprefix=f'..{os.path.sep}', + ): + """Return a normalized, absolute-path copy of the given filename.""" + if not relroot or relroot is USE_CWD: + return os.path.abspath(filename) + if fixroot: + relroot = os.path.abspath(relroot) + return _fix_filename(filename, relroot) + + +def _fix_filename(filename, relroot, *, + _badprefix=f'..{os.path.sep}', + ): + orig = filename + + # First we normalize. + filename = os.path.normpath(filename) + if filename.startswith(_badprefix): + raise ValueError(f'bad filename {orig!r} (resolves beyond relative root') + + # Now make sure it is absolute (relative to relroot). + if not os.path.isabs(filename): + filename = os.path.join(relroot, filename) + else: + relpath = os.path.relpath(filename, relroot) + if os.path.join(relroot, relpath) != filename: + raise ValueError(f'expected {relroot!r} as lroot, got {orig!r}') + + return filename + + +def fix_filenames(filenames, relroot=USE_CWD): + if not relroot or relroot is USE_CWD: + filenames = (os.path.abspath(v) for v in filenames) + else: + relroot = os.path.abspath(relroot) + filenames = (_fix_filename(v, relroot) for v in filenames) + return filenames, relroot + + +def format_filename(filename, relroot=USE_CWD, *, + fixroot=True, + normalize=True, + _badprefix=f'..{os.path.sep}', + ): + """Return a consistent relative-path representation of the filename.""" + orig = filename + if normalize: + filename = os.path.normpath(filename) + if relroot is None: + # Otherwise leave it as-is. + return filename + elif relroot is USE_CWD: + # Make it relative to CWD. + filename = os.path.relpath(filename) + else: + # Make it relative to "relroot". + if fixroot: + relroot = os.path.abspath(relroot) + elif not relroot: + raise ValueError('missing relroot') + filename = os.path.relpath(filename, relroot) + if filename.startswith(_badprefix): + raise ValueError(f'bad filename {orig!r} (resolves beyond relative root') + return filename + + ################################## # find files @@ -54,34 +129,29 @@ def match_glob(filename, pattern): return fnmatch.fnmatch(filename, pattern.replace('**/', '', 1)) -def iter_filenames(filenames, *, - start=None, - include=None, - exclude=None, - ): +def process_filenames(filenames, *, + start=None, + include=None, + exclude=None, + relroot=USE_CWD, + ): + if relroot and relroot is not USE_CWD: + relroot = os.path.abspath(relroot) + if start: + start = fix_filename(start, relroot, fixroot=False) + if include: + include = set(fix_filename(v, relroot, fixroot=False) + for v in include) + if exclude: + exclude = set(fix_filename(v, relroot, fixroot=False) + for v in exclude) + onempty = Exception('no filenames provided') for filename, solo in iter_many(filenames, onempty): + filename = fix_filename(filename, relroot, fixroot=False) + relfile = format_filename(filename, relroot, fixroot=False, normalize=False) check, start = _get_check(filename, start, include, exclude) - yield filename, check, solo -# filenames = iter(filenames or ()) -# try: -# first = next(filenames) -# except StopIteration: -# raise Exception('no filenames provided') -# try: -# second = next(filenames) -# except StopIteration: -# check, _ = _get_check(first, start, include, exclude) -# yield first, check, False -# return -# -# check, start = _get_check(first, start, include, exclude) -# yield first, check, True -# check, start = _get_check(second, start, include, exclude) -# yield second, check, True -# for filename in filenames: -# check, start = _get_check(filename, start, include, exclude) -# yield filename, check, True + yield filename, relfile, check, solo def expand_filenames(filenames): diff --git a/Tools/c-analyzer/c_common/scriptutil.py b/Tools/c-analyzer/c_common/scriptutil.py index 222059015d76ec..50dd7548869193 100644 --- a/Tools/c-analyzer/c_common/scriptutil.py +++ b/Tools/c-analyzer/c_common/scriptutil.py @@ -307,7 +307,9 @@ def process_args(args): exclude=tuple(_parse_files(_exclude)), # We use the default for "show_header" ) - ns[key] = (lambda files: fsutil.iter_filenames(files, **kwargs)) + def process_filenames(filenames, relroot=None): + return fsutil.process_filenames(filenames, relroot=relroot, **kwargs) + ns[key] = process_filenames return process_args @@ -529,42 +531,46 @@ def decorator(func): ################################## # main() helpers -def filter_filenames(filenames, iter_filenames=None): - for filename, check, _ in _iter_filenames(filenames, iter_filenames): +def filter_filenames(filenames, process_filenames=None, relroot=fsutil.USE_CWD): + # We expect each filename to be a normalized, absolute path. + for filename, _, check, _ in _iter_filenames(filenames, process_filenames, relroot): if (reason := check()): logger.debug(f'{filename}: {reason}') continue yield filename -def main_for_filenames(filenames, iter_filenames=None): - for filename, check, show in _iter_filenames(filenames, iter_filenames): +def main_for_filenames(filenames, process_filenames=None, relroot=fsutil.USE_CWD): + filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot) + for filename, relfile, check, show in _iter_filenames(filenames, process_filenames, relroot): if show: print() + print(relfile) print('-------------------------------------------') - print(filename) if (reason := check()): print(reason) continue - yield filename + yield filename, relfile -def _iter_filenames(filenames, iter_files): - if iter_files is None: - iter_files = fsutil.iter_filenames - yield from iter_files(filenames) +def _iter_filenames(filenames, process, relroot): + if process is None: + yield from fsutil.process_filenames(filenames, relroot=relroot) return onempty = Exception('no filenames provided') - items = iter_files(filenames) + items = process(filenames, relroot=relroot) items, peeked = iterutil.peek_and_iter(items) if not items: raise onempty if isinstance(peeked, str): + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) check = (lambda: True) for filename, ismany in iterutil.iter_many(items, onempty): - yield filename, check, ismany - elif len(peeked) == 3: + relfile = fsutil.format_filename(filename, relroot, fixroot=False) + yield filename, relfile, check, ismany + elif len(peeked) == 4: yield from items else: raise NotImplementedError diff --git a/Tools/c-analyzer/c_common/tables.py b/Tools/c-analyzer/c_common/tables.py index 70a230a90b6e85..411152e3f9498f 100644 --- a/Tools/c-analyzer/c_common/tables.py +++ b/Tools/c-analyzer/c_common/tables.py @@ -26,13 +26,14 @@ def fix_row(row, **markers): unknown = parse_markers(markers.pop('unknown', ('???',))) row = (val if val else None for val in row) if not empty: - if not unknown: - return row - return (UNKNOWN if val in unknown else val for val in row) + if unknown: + row = (UNKNOWN if val in unknown else val for val in row) elif not unknown: - return (EMPTY if val in empty else val for val in row) - return (EMPTY if val in empty else (UNKNOWN if val in unknown else val) - for val in row) + row = (EMPTY if val in empty else val for val in row) + else: + row = (EMPTY if val in empty else (UNKNOWN if val in unknown else val) + for val in row) + return tuple(row) def _fix_read_default(row): diff --git a/Tools/c-analyzer/c_parser/__main__.py b/Tools/c-analyzer/c_parser/__main__.py index 1752a703f606ad..539cec509cecb4 100644 --- a/Tools/c-analyzer/c_parser/__main__.py +++ b/Tools/c-analyzer/c_parser/__main__.py @@ -2,6 +2,7 @@ import os.path import sys +from c_common import fsutil from c_common.scriptutil import ( CLIArgSpec as Arg, add_verbosity_cli, @@ -64,8 +65,9 @@ def fmt_raw(filename, item, *, showfwd=None): def fmt_summary(filename, item, *, showfwd=None): - if item.filename and item.filename != os.path.join('.', filename): + if item.filename != filename: yield f'> {item.filename}' + if showfwd is None: LINE = ' {lno:>5} {kind:10} {funcname:40} {fwd:1} {name:40} {data}' else: @@ -172,6 +174,7 @@ def cmd_parse(filenames, *, fmt='summary', showfwd=None, iter_filenames=None, + relroot=None, **kwargs ): if 'get_file_preprocessor' not in kwargs: @@ -180,9 +183,10 @@ def cmd_parse(filenames, *, do_fmt = FORMATS[fmt] except KeyError: raise ValueError(f'unsupported fmt {fmt!r}') - for filename in main_for_filenames(filenames, iter_filenames): + for filename, relfile in main_for_filenames(filenames, iter_filenames, relroot): for item in _iter_parsed(filename, **kwargs): - for line in do_fmt(filename, item, showfwd=showfwd): + item = item.fix_filename(relroot, fixroot=False, normalize=False) + for line in do_fmt(relfile, item, showfwd=showfwd): print(line) diff --git a/Tools/c-analyzer/c_parser/datafiles.py b/Tools/c-analyzer/c_parser/datafiles.py index cdd69b1f9b2d8a..f053056619f05f 100644 --- a/Tools/c-analyzer/c_parser/datafiles.py +++ b/Tools/c-analyzer/c_parser/datafiles.py @@ -1,5 +1,6 @@ import os.path +from c_common import fsutil import c_common.tables as _tables import c_parser.info as _info @@ -81,21 +82,27 @@ def _get_format_handlers(group, fmt): # tsv -def iter_decls_tsv(infile, extracolumns=None, relroot=None): - for info, extra in _iter_decls_tsv(infile, extracolumns, relroot): +def iter_decls_tsv(infile, extracolumns=None, relroot=fsutil.USE_CWD): + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) + for info, extra in _iter_decls_tsv(infile, extracolumns): decl = _info.Declaration.from_row(info) + decl = decl.fix_filename(relroot, formatted=False, fixroot=False) yield decl, extra def write_decls_tsv(decls, outfile, extracolumns=None, *, - relroot=None, + relroot=fsutil.USE_CWD, **kwargs ): + if relroot and relroot is not fsutil.USE_CWD: + relroot = os.path.abspath(relroot) + decls = (d.fix_filename(relroot, fixroot=False) for d in decls) # XXX Move the row rendering here. - _write_decls_tsv(decls, outfile, extracolumns, relroot, kwargs) + _write_decls_tsv(decls, outfile, extracolumns, kwargs) -def _iter_decls_tsv(infile, extracolumns=None, relroot=None): +def _iter_decls_tsv(infile, extracolumns=None): columns = _get_columns('decls', extracolumns) for row in _tables.read_table(infile, columns, sep='\t'): if extracolumns: @@ -104,15 +111,13 @@ def _iter_decls_tsv(infile, extracolumns=None, relroot=None): else: declinfo = row extra = None - if relroot: - # XXX Use something like tables.fix_row() here. - declinfo = [None if v == '-' else v - for v in declinfo] - declinfo[0] = os.path.join(relroot, declinfo[0]) + # XXX Use something like tables.fix_row() here. + declinfo = [None if v == '-' else v + for v in declinfo] yield declinfo, extra -def _write_decls_tsv(decls, outfile, extracolumns, relroot,kwargs): +def _write_decls_tsv(decls, outfile, extracolumns, kwargs): columns = _get_columns('decls', extracolumns) if extracolumns: def render_decl(decl): @@ -121,7 +126,7 @@ def render_decl(decl): else: extra = () extra += ('???',) * (len(extraColumns) - len(extra)) - *row, declaration = _render_known_row(decl, relroot) + *row, declaration = _render_known_row(decl) row += extra + (declaration,) return row else: @@ -129,13 +134,13 @@ def render_decl(decl): _tables.write_table( outfile, header='\t'.join(columns), - rows=(render_decl(d, relroot) for d in decls), + rows=(render_decl(d) for d in decls), sep='\t', **kwargs ) -def _render_known_decl(decl, relroot, *, +def _render_known_decl(decl, *, # These match BASE_COLUMNS + END_COLUMNS[group]. _columns = 'filename parent name kind data'.split(), ): @@ -143,8 +148,6 @@ def _render_known_decl(decl, relroot, *, # e.g. Analyzed decl = decl.decl rowdata = decl.render_rowdata(_columns) - if relroot: - rowdata['filename'] = os.path.relpath(rowdata['filename'], relroot) return [rowdata[c] or '-' for c in _columns] # XXX #return _tables.fix_row(rowdata[c] for c in columns) diff --git a/Tools/c-analyzer/c_parser/info.py b/Tools/c-analyzer/c_parser/info.py index 798a45d2e08e71..98ff511cfe64a0 100644 --- a/Tools/c-analyzer/c_parser/info.py +++ b/Tools/c-analyzer/c_parser/info.py @@ -3,6 +3,7 @@ import os.path import re +from c_common import fsutil from c_common.clsutil import classonly import c_common.misc as _misc import c_common.strutil as _strutil @@ -148,6 +149,16 @@ def get_kind_group(item): ############################# # low-level +def _fix_filename(filename, relroot, *, + formatted=True, + **kwargs): + if formatted: + fix = fsutil.format_filename + else: + fix = fsutil.fix_filename + return fix(filename, relroot=relroot, **kwargs) + + class FileInfo(namedtuple('FileInfo', 'filename lno')): @classmethod def from_raw(cls, raw): @@ -165,8 +176,10 @@ def from_raw(cls, raw): def __str__(self): return self.filename - def fix_filename(self, relroot): - filename = os.path.relpath(self.filename, relroot) + def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): + filename = _fix_filename(self.filename, relroot, **kwargs) + if filename == self.filename: + return self return self._replace(filename=filename) @@ -194,6 +207,16 @@ def from_row(cls, row, **markers): row = _tables.fix_row(row, **markers) return cls(*row) + # We have to provde _make() becaose we implemented __new__(). + + @classmethod + def _make(cls, iterable): + try: + return cls(*iterable) + except Exception: + super()._make(iterable) + raise # re-raise + def __new__(cls, filename, funcname, name): self = super().__new__( cls, @@ -221,6 +244,12 @@ def __gt__(self, other): return NotImplemented return self._compare > other + def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): + filename = _fix_filename(self.filename, relroot, **kwargs) + if filename == self.filename: + return self + return self._replace(filename=filename) + class ParsedItem(namedtuple('ParsedItem', 'file kind parent name data')): @@ -290,6 +319,12 @@ def funcname(self): else: return self.parent.name + def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): + fixed = self.file.fix_filename(relroot, **kwargs) + if fixed == self.file: + return self + return self._replace(file=fixed) + def as_row(self, columns=None): if not columns: columns = self._fields @@ -591,9 +626,10 @@ def parsed(self): ) return self._parsed - def fix_filename(self, relroot): + def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): if self.file: - self.file = self.file.fix_filename(relroot) + self.file = self.file.fix_filename(relroot, **kwargs) + return self def as_rowdata(self, columns=None): columns, datacolumns, colnames = self._parse_columns(columns) diff --git a/Tools/c-analyzer/cpython/__main__.py b/Tools/c-analyzer/cpython/__main__.py index 23ce29776ca68e..6d78af299bb6f8 100644 --- a/Tools/c-analyzer/cpython/__main__.py +++ b/Tools/c-analyzer/cpython/__main__.py @@ -105,7 +105,11 @@ def cmd_parse(filenames=None, **kwargs): filenames = _resolve_filenames(filenames) if 'get_file_preprocessor' not in kwargs: kwargs['get_file_preprocessor'] = _parser.get_preprocessor() - c_parser.cmd_parse(filenames, **kwargs) + c_parser.cmd_parse( + filenames, + relroot=REPO_ROOT, + **kwargs + ) def _cli_check(parser, **kwargs): @@ -131,6 +135,7 @@ def cmd_analyze(filenames=None, **kwargs): kwargs['get_file_preprocessor'] = _parser.get_preprocessor(log_err=print) c_analyzer.cmd_analyze( filenames, + relroot=REPO_ROOT, _analyze=_analyzer.analyze, formats=formats, **kwargs diff --git a/Tools/c-analyzer/cpython/_analyzer.py b/Tools/c-analyzer/cpython/_analyzer.py index 978831d1fd9496..09904236cd623d 100644 --- a/Tools/c-analyzer/cpython/_analyzer.py +++ b/Tools/c-analyzer/cpython/_analyzer.py @@ -84,13 +84,13 @@ def write_known(): def read_ignored(): if not _IGNORED: - _IGNORED.update(_datafiles.read_ignored(IGNORED_FILE)) + _IGNORED.update(_datafiles.read_ignored(IGNORED_FILE, relroot=REPO_ROOT)) return dict(_IGNORED) def write_ignored(): raise NotImplementedError - datafiles.write_ignored(variables, IGNORED_FILE) + _datafiles.write_ignored(variables, IGNORED_FILE, relroot=REPO_ROOT) def analyze(filenames, *, diff --git a/Tools/c-analyzer/cpython/_parser.py b/Tools/c-analyzer/cpython/_parser.py index 7c8c2966653989..eef758495386c4 100644 --- a/Tools/c-analyzer/cpython/_parser.py +++ b/Tools/c-analyzer/cpython/_parser.py @@ -162,6 +162,12 @@ def clean_lines(text): Modules/_ctypes/cfield.c Py_BUILD_CORE 1 Modules/_heapqmodule.c Py_BUILD_CORE 1 Modules/_posixsubprocess.c Py_BUILD_CORE 1 +Modules/_sre.c Py_BUILD_CORE 1 +Modules/_collectionsmodule.c Py_BUILD_CORE 1 +Modules/_zoneinfo.c Py_BUILD_CORE 1 +Modules/unicodedata.c Py_BUILD_CORE 1 +Modules/_cursesmodule.c Py_BUILD_CORE 1 +Modules/_ctypes/_ctypes.c Py_BUILD_CORE 1 Objects/stringlib/codecs.h Py_BUILD_CORE 1 Python/ceval_gil.h Py_BUILD_CORE 1 Python/condvar.h Py_BUILD_CORE 1 diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv index 2c456db063e429..e5d93782076c3d 100644 --- a/Tools/c-analyzer/cpython/ignored.tsv +++ b/Tools/c-analyzer/cpython/ignored.tsv @@ -1,2 +1,2938 @@ filename funcname name reason #??? - somevar ??? + +# XXX The analyzer should have ignored these (forward/extern references): +Include/py_curses.h - PyCurses_API - +Include/pydecimal.h - _decimal_api - +Modules/_blake2/blake2module.c - blake2b_type_spec - +Modules/_blake2/blake2module.c - blake2s_type_spec - +Modules/_io/fileio.c - _Py_open_cloexec_works - +Modules/_io/_iomodule.h - PyIOBase_Type - +Modules/_io/_iomodule.h - PyRawIOBase_Type - +Modules/_io/_iomodule.h - PyBufferedIOBase_Type - +Modules/_io/_iomodule.h - PyTextIOBase_Type - +Modules/_io/_iomodule.h - PyFileIO_Type - +Modules/_io/_iomodule.h - PyBytesIO_Type - +Modules/_io/_iomodule.h - PyStringIO_Type - +Modules/_io/_iomodule.h - PyBufferedReader_Type - +Modules/_io/_iomodule.h - PyBufferedWriter_Type - +Modules/_io/_iomodule.h - PyBufferedRWPair_Type - +Modules/_io/_iomodule.h - PyBufferedRandom_Type - +Modules/_io/_iomodule.h - PyTextIOWrapper_Type - +Modules/_io/_iomodule.h - PyIncrementalNewlineDecoder_Type - +Modules/_io/_iomodule.h - _PyBytesIOBuffer_Type - +Modules/_io/_iomodule.h - _PyIO_str_close - +Modules/_io/_iomodule.h - _PyIO_str_closed - +Modules/_io/_iomodule.h - _PyIO_str_decode - +Modules/_io/_iomodule.h - _PyIO_str_encode - +Modules/_io/_iomodule.h - _PyIO_str_fileno - +Modules/_io/_iomodule.h - _PyIO_str_flush - +Modules/_io/_iomodule.h - _PyIO_str_getstate - +Modules/_io/_iomodule.h - _PyIO_str_isatty - +Modules/_io/_iomodule.h - _PyIO_str_newlines - +Modules/_io/_iomodule.h - _PyIO_str_nl - +Modules/_io/_iomodule.h - _PyIO_str_peek - +Modules/_io/_iomodule.h - _PyIO_str_read - +Modules/_io/_iomodule.h - _PyIO_str_read1 - +Modules/_io/_iomodule.h - _PyIO_str_readable - +Modules/_io/_iomodule.h - _PyIO_str_readall - +Modules/_io/_iomodule.h - _PyIO_str_readinto - +Modules/_io/_iomodule.h - _PyIO_str_readline - +Modules/_io/_iomodule.h - _PyIO_str_reset - +Modules/_io/_iomodule.h - _PyIO_str_seek - +Modules/_io/_iomodule.h - _PyIO_str_seekable - +Modules/_io/_iomodule.h - _PyIO_str_setstate - +Modules/_io/_iomodule.h - _PyIO_str_tell - +Modules/_io/_iomodule.h - _PyIO_str_truncate - +Modules/_io/_iomodule.h - _PyIO_str_writable - +Modules/_io/_iomodule.h - _PyIO_str_write - +Modules/_io/_iomodule.h - _PyIO_empty_str - +Modules/_io/_iomodule.h - _PyIO_empty_bytes - +Modules/_multiprocessing/multiprocessing.h - _PyMp_SemLockType - +Modules/_sqlite/cache.h - pysqlite_NodeType - +Modules/_sqlite/cache.h - pysqlite_CacheType - +Modules/_sqlite/cursor.h - pysqlite_CursorType - +Modules/_sqlite/row.h - pysqlite_RowType - +Modules/_sqlite/prepare_protocol.h - pysqlite_PrepareProtocolType - +Modules/_sqlite/statement.h - pysqlite_StatementType - +Modules/_sqlite/connection.h - pysqlite_ConnectionType - +Modules/_sqlite/module.c - pysqlite_Error - +Modules/_sqlite/module.c - pysqlite_Warning - +Modules/_sqlite/module.c - pysqlite_InterfaceError - +Modules/_sqlite/module.c - pysqlite_DatabaseError - +Modules/_sqlite/module.c - pysqlite_InternalError - +Modules/_sqlite/module.c - pysqlite_OperationalError - +Modules/_sqlite/module.c - pysqlite_ProgrammingError - +Modules/_sqlite/module.c - pysqlite_IntegrityError - +Modules/_sqlite/module.c - pysqlite_DataError - +Modules/_sqlite/module.c - pysqlite_NotSupportedError - +Modules/_sqlite/module.c - _pysqlite_converters - +Modules/_sqlite/module.c - _pysqlite_enable_callback_tracebacks - +Modules/_sqlite/module.c - pysqlite_BaseTypeAdapted - +Modules/_testcapimodule.c - _PyBytesIOBuffer_Type - +Modules/posixmodule.c - _Py_open_cloexec_works - +Python/importdl.h - _PyImport_DynLoadFiletab - + + +################################## +# test code +# [] + +Modules/_ctypes/_ctypes_test.c - _ctypes_test_slots - +Modules/_ctypes/_ctypes_test.c - module_methods - +Modules/_ctypes/_ctypes_test.c - my_spams - +Modules/_ctypes/_ctypes_test.c - my_eggs - +Modules/_ctypes/_ctypes_test.c - an_integer - +Modules/_ctypes/_ctypes_test.c - _xxx_lib - +Modules/_ctypes/_ctypes_test.c - left - +Modules/_ctypes/_ctypes_test.c - top - +Modules/_ctypes/_ctypes_test.c - right - +Modules/_ctypes/_ctypes_test.c - bottom - +Modules/_ctypes/_ctypes_test.c - _ctypes_testmodule - +Modules/_ctypes/_ctypes_test.c - last_tfrsuv_arg - +Modules/_ctypes/_ctypes_test.c - last_tf_arg_s - +Modules/_ctypes/_ctypes_test.c - last_tf_arg_u - +Modules/_testbuffer.c - simple_format - +Modules/_testbuffer.c - static_mem - +Modules/_testbuffer.c - static_shape - +Modules/_testbuffer.c - static_strides - +Modules/_testbuffer.c - NDArray_Type - +Modules/_testbuffer.c - StaticArray_Type - +Modules/_testbuffer.c ndarray_init kwlist - +Modules/_testbuffer.c ndarray_push kwlist - +Modules/_testbuffer.c staticarray_init kwlist - +Modules/_testbuffer.c - ndarray_methods - +Modules/_testbuffer.c - _testbuffer_functions - +Modules/_testbuffer.c - ndarray_getset - +Modules/_testbuffer.c - ndarray_as_buffer - +Modules/_testbuffer.c - staticarray_as_buffer - +Modules/_testbuffer.c - ndarray_as_sequence - +Modules/_testbuffer.c - ndarray_as_mapping - +Modules/_testbuffer.c - structmodule - +Modules/_testbuffer.c - _testbuffermodule - +Modules/_testbuffer.c - Struct - +Modules/_testbuffer.c - calcsize - +Modules/_testbuffer.c - simple_fmt - +Modules/_testbuffer.c - static_buffer - +Modules/_testbuffer.c ndarray_memoryview_from_buffer format - +Modules/_testbuffer.c ndarray_memoryview_from_buffer shape - +Modules/_testbuffer.c ndarray_memoryview_from_buffer strides - +Modules/_testbuffer.c ndarray_memoryview_from_buffer suboffsets - +Modules/_testbuffer.c ndarray_memoryview_from_buffer info - +Modules/_testbuffer.c - infobuf - +Modules/_testcapimodule.c - TestError - +Modules/_testcapimodule.c test_capsule buffer - +Modules/_testcapimodule.c - decimal_initialized - +Modules/_testcapimodule.c - thread_done - +Modules/_testcapimodule.c - capsule_error - +Modules/_testcapimodule.c - capsule_destructor_call_count - +Modules/_testcapimodule.c - str1 - +Modules/_testcapimodule.c - str2 - +Modules/_testcapimodule.c - test_run_counter - +Modules/_testcapimodule.c - FmHook - +Modules/_testcapimodule.c - FmData - +Modules/_testcapimodule.c - _testcapimodule - +Modules/_testcapimodule.c - _HashInheritanceTester_Type - +Modules/_testcapimodule.c - test_structmembersType - +Modules/_testcapimodule.c - matmulType - +Modules/_testcapimodule.c - ipowType - +Modules/_testcapimodule.c - awaitType - +Modules/_testcapimodule.c - PyRecursingInfinitelyError_Type - +Modules/_testcapimodule.c - MyList_Type - +Modules/_testcapimodule.c - GenericAlias_Type - +Modules/_testcapimodule.c - Generic_Type - +Modules/_testcapimodule.c - MethodDescriptorBase_Type - +Modules/_testcapimodule.c - MethodDescriptorDerived_Type - +Modules/_testcapimodule.c - MethodDescriptorNopGet_Type - +Modules/_testcapimodule.c - MethodDescriptor2_Type - +Modules/_testcapimodule.c - MethInstance_Type - +Modules/_testcapimodule.c - MethClass_Type - +Modules/_testcapimodule.c - MethStatic_Type - +Modules/_testcapimodule.c - ContainerNoGC_type - +Modules/_testcapimodule.c slot_tp_del PyId___tp_del__ - +Modules/_testcapimodule.c raise_SIGINT_then_send_None PyId_send - +Modules/_testcapimodule.c - HeapDocCType_spec - +Modules/_testcapimodule.c - HeapGcCType_spec - +Modules/_testcapimodule.c - HeapCType_spec - +Modules/_testcapimodule.c - HeapCTypeSubclass_spec - +Modules/_testcapimodule.c - HeapCTypeWithBuffer_spec - +Modules/_testcapimodule.c - HeapCTypeSubclassWithFinalizer_spec - +Modules/_testcapimodule.c - HeapCTypeWithDict_spec - +Modules/_testcapimodule.c - HeapCTypeWithNegativeDict_spec - +Modules/_testcapimodule.c - HeapCTypeWithWeakref_spec - +Modules/_testcapimodule.c - HeapCTypeSetattr_spec - +Modules/_testcapimodule.c - capsule_name - +Modules/_testcapimodule.c - capsule_pointer - +Modules/_testcapimodule.c - capsule_context - +Modules/_testcapimodule.c - x - +Modules/_testcapimodule.c getargs_keyword_only keywords - +Modules/_testcapimodule.c getargs_keywords keywords - +Modules/_testcapimodule.c getargs_positional_only_and_keywords keywords - +Modules/_testcapimodule.c make_exception_with_doc kwlist - +Modules/_testcapimodule.c test_empty_argparse kwlist - +Modules/_testcapimodule.c test_structmembers_new keywords - +Modules/_testcapimodule.c - ml - +Modules/_testcapimodule.c - TestMethods - +Modules/_testcapimodule.c - generic_alias_methods - +Modules/_testcapimodule.c - generic_methods - +Modules/_testcapimodule.c - meth_instance_methods - +Modules/_testcapimodule.c - meth_class_methods - +Modules/_testcapimodule.c - meth_static_methods - +Modules/_testcapimodule.c - test_members - +Modules/_testcapimodule.c - heapctype_members - +Modules/_testcapimodule.c - heapctypesubclass_members - +Modules/_testcapimodule.c - heapctypewithdict_members - +Modules/_testcapimodule.c - heapctypewithnegativedict_members - +Modules/_testcapimodule.c - heapctypewithweakref_members - +Modules/_testcapimodule.c - heapctypesetattr_members - +Modules/_testcapimodule.c - ContainerNoGC_members - +Modules/_testcapimodule.c - matmulType_as_number - +Modules/_testcapimodule.c - ipowType_as_number - +Modules/_testcapimodule.c - awaitType_as_async - +Modules/_testcapimodule.c - heapctypewithdict_getsetlist - +Modules/_testcapimodule.c - HeapDocCType_slots - +Modules/_testcapimodule.c - HeapGcCType_slots - +Modules/_testcapimodule.c - HeapCType_slots - +Modules/_testcapimodule.c - HeapCTypeSubclass_slots - +Modules/_testcapimodule.c - HeapCTypeWithBuffer_slots - +Modules/_testcapimodule.c - HeapCTypeSubclassWithFinalizer_slots - +Modules/_testcapimodule.c - HeapCTypeWithDict_slots - +Modules/_testcapimodule.c - HeapCTypeWithNegativeDict_slots - +Modules/_testcapimodule.c - HeapCTypeWithWeakref_slots - +Modules/_testcapimodule.c - HeapCTypeSetattr_slots - +Modules/_testimportmultiple.c - _foomodule - +Modules/_testimportmultiple.c - _barmodule - +Modules/_testimportmultiple.c - _testimportmultiple - +Modules/_testinternalcapi.c - _testcapimodule - +Modules/_testinternalcapi.c - TestMethods - +Modules/_testmultiphase.c - slots_create_nonmodule - +Modules/_testmultiphase.c - def_nonmodule - +Modules/_testmultiphase.c - main_def - +Modules/_testmultiphase.c - def_nonmodule_with_methods - +Modules/_testmultiphase.c - def_nonascii_latin - +Modules/_testmultiphase.c - def_nonascii_kana - +Modules/_testmultiphase.c - null_slots_def - +Modules/_testmultiphase.c - def_bad_large - +Modules/_testmultiphase.c - def_bad_negative - +Modules/_testmultiphase.c - def_create_int_with_state - +Modules/_testmultiphase.c - def_negative_size - +Modules/_testmultiphase.c - uninitialized_def - +Modules/_testmultiphase.c - def_create_null - +Modules/_testmultiphase.c - def_create_raise - +Modules/_testmultiphase.c - def_create_unreported_exception - +Modules/_testmultiphase.c - def_nonmodule_with_exec_slots - +Modules/_testmultiphase.c - def_exec_err - +Modules/_testmultiphase.c - def_exec_raise - +Modules/_testmultiphase.c - def_exec_unreported_exception - +Modules/_testmultiphase.c - def_meth_state_access - +Modules/_testmultiphase.c - imp_dummy_def - +Modules/_testmultiphase.c - Example_Type_slots - +Modules/_testmultiphase.c - StateAccessType_Type_slots - +Modules/_testmultiphase.c - Str_Type_slots - +Modules/_testmultiphase.c - main_slots - +Modules/_testmultiphase.c - slots_create_nonmodule - +Modules/_testmultiphase.c - slots_bad_large - +Modules/_testmultiphase.c - slots_bad_negative - +Modules/_testmultiphase.c - slots_create_null - +Modules/_testmultiphase.c - slots_create_raise - +Modules/_testmultiphase.c - slots_create_unreported_exception - +Modules/_testmultiphase.c - slots_nonmodule_with_exec_slots - +Modules/_testmultiphase.c - slots_exec_err - +Modules/_testmultiphase.c - slots_exec_raise - +Modules/_testmultiphase.c - slots_exec_unreported_exception - +Modules/_testmultiphase.c - meth_state_access_slots - +Modules/_testmultiphase.c - Example_methods - +Modules/_testmultiphase.c - StateAccessType_methods - +Modules/_testmultiphase.c - testexport_methods - +Modules/_testmultiphase.c - nonmodule_methods - +Modules/_testmultiphase.c - Example_Type_spec - +Modules/_testmultiphase.c - StateAccessType_spec - +Modules/_testmultiphase.c - Str_Type_spec - +Modules/_xxtestfuzz/_xxtestfuzz.c - module_methods - +Modules/_xxtestfuzz/_xxtestfuzz.c - _fuzzmodule - +Modules/_xxtestfuzz/fuzzer.c - csv_module - +Modules/_xxtestfuzz/fuzzer.c - regex_patterns - +Modules/_xxtestfuzz/fuzzer.c - struct_unpack_method - +Modules/_xxtestfuzz/fuzzer.c - struct_error - +Modules/_xxtestfuzz/fuzzer.c - json_loads_method - +Modules/_xxtestfuzz/fuzzer.c - sre_compile_method - +Modules/_xxtestfuzz/fuzzer.c - sre_error_exception - +Modules/_xxtestfuzz/fuzzer.c - compiled_patterns - +Modules/_xxtestfuzz/fuzzer.c - csv_error - +Modules/_xxtestfuzz/fuzzer.c - SRE_FLAG_DEBUG - +Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput STRUCT_UNPACK_INITIALIZED - +Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput JSON_LOADS_INITIALIZED - +Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput SRE_COMPILE_INITIALIZED - +Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput SRE_MATCH_INITIALIZED - +Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput CSV_READER_INITIALIZED - + + +################################## +# temporary whitelist - should be const + +# These are all variables that we will be making non-global. + +#----------------------- +# keywords for PyArg_ParseTupleAndKeywords() +# "static char *name[]" -> "static const char * const name[]" +# [] + +Modules/cjkcodecs/multibytecodec.c - incnewkwarglist - +Modules/cjkcodecs/multibytecodec.c - streamkwarglist - +Modules/_csv.c - dialect_kws - +Modules/_datetimemodule.c date_fromisocalendar keywords - +Modules/_datetimemodule.c - date_kws - +Modules/_datetimemodule.c date_strftime keywords - +Modules/_datetimemodule.c datetime_astimezone keywords - +Modules/_datetimemodule.c datetime_combine keywords - +Modules/_datetimemodule.c datetime_fromtimestamp keywords - +Modules/_datetimemodule.c datetime_isoformat keywords - +Modules/_datetimemodule.c - datetime_kws - +Modules/_datetimemodule.c delta_new keywords - +Modules/_datetimemodule.c time_isoformat keywords - +Modules/_datetimemodule.c - time_kws - +Modules/_datetimemodule.c time_strftime keywords - +Modules/_datetimemodule.c - timezone_kws - +Modules/_decimal/_decimal.c context_init kwlist - +Modules/_decimal/_decimal.c ctxmanager_new kwlist - +Modules/_decimal/_decimal.c ctx_mpd_qpow kwlist - +Modules/_decimal/_decimal.c dec_mpd_class kwlist - +Modules/_decimal/_decimal.c dec_mpd_compare_total kwlist - +Modules/_decimal/_decimal.c dec_mpd_compare_total_mag kwlist - +Modules/_decimal/_decimal.c dec_mpd_isnormal kwlist - +Modules/_decimal/_decimal.c dec_mpd_issubnormal kwlist - +Modules/_decimal/_decimal.c dec_mpd_qand kwlist - +Modules/_decimal/_decimal.c dec_mpd_qcompare kwlist - +Modules/_decimal/_decimal.c dec_mpd_qcompare_signal kwlist - +Modules/_decimal/_decimal.c dec_mpd_qcopy_sign kwlist - +Modules/_decimal/_decimal.c dec_mpd_qexp kwlist - +Modules/_decimal/_decimal.c dec_mpd_qfma kwlist - +Modules/_decimal/_decimal.c dec_mpd_qinvert kwlist - +Modules/_decimal/_decimal.c dec_mpd_qln kwlist - +Modules/_decimal/_decimal.c dec_mpd_qlog10 kwlist - +Modules/_decimal/_decimal.c dec_mpd_qlogb kwlist - +Modules/_decimal/_decimal.c dec_mpd_qmax kwlist - +Modules/_decimal/_decimal.c dec_mpd_qmax_mag kwlist - +Modules/_decimal/_decimal.c dec_mpd_qmin kwlist - +Modules/_decimal/_decimal.c dec_mpd_qmin_mag kwlist - +Modules/_decimal/_decimal.c dec_mpd_qnext_minus kwlist - +Modules/_decimal/_decimal.c dec_mpd_qnext_plus kwlist - +Modules/_decimal/_decimal.c dec_mpd_qnext_toward kwlist - +Modules/_decimal/_decimal.c dec_mpd_qor kwlist - +Modules/_decimal/_decimal.c dec_mpd_qquantize kwlist - +Modules/_decimal/_decimal.c dec_mpd_qreduce kwlist - +Modules/_decimal/_decimal.c dec_mpd_qrem_near kwlist - +Modules/_decimal/_decimal.c dec_mpd_qrotate kwlist - +Modules/_decimal/_decimal.c dec_mpd_qscaleb kwlist - +Modules/_decimal/_decimal.c dec_mpd_qshift kwlist - +Modules/_decimal/_decimal.c dec_mpd_qsqrt kwlist - +Modules/_decimal/_decimal.c dec_mpd_qxor kwlist - +Modules/_decimal/_decimal.c dec_mpd_same_quantum kwlist - +Modules/_decimal/_decimal.c dec_mpd_to_eng kwlist - +Modules/_decimal/_decimal.c dec_new kwlist - +Modules/_decimal/_decimal.c PyDec_ToIntegralExact kwlist - +Modules/_decimal/_decimal.c PyDec_ToIntegralValue kwlist - +Modules/_elementtree.c element_setstate_from_Python kwlist - +Modules/faulthandler.c faulthandler_dump_traceback_later kwlist - +Modules/faulthandler.c faulthandler_dump_traceback_py kwlist - +Modules/faulthandler.c faulthandler_py_enable kwlist - +Modules/faulthandler.c faulthandler_register_py kwlist - +Modules/_functoolsmodule.c functools_cmp_to_key kwargs - +Modules/_functoolsmodule.c keyobject_call kwargs - +Modules/_functoolsmodule.c lru_cache_new keywords - +Modules/itertoolsmodule.c repeat_new kwargs - +Modules/_json.c encoder_call kwlist - +Modules/_json.c encoder_new kwlist - +Modules/_json.c scanner_call kwlist - +Modules/_json.c scanner_new kwlist - +Modules/_lsprof.c profiler_enable kwlist - +Modules/_lsprof.c profiler_init kwlist - +Modules/_lzmamodule.c Compressor_init arg_names - +Modules/_lzmamodule.c parse_filter_spec_bcj optnames - +Modules/_lzmamodule.c parse_filter_spec_delta optnames - +Modules/_lzmamodule.c parse_filter_spec_lzma optnames - +Modules/mmapmodule.c new_mmap_object keywords - +Modules/nismodule.c nis_cat kwlist - +Modules/nismodule.c nis_maps kwlist - +Modules/nismodule.c nis_match kwlist - +Modules/signalmodule.c signal_set_wakeup_fd kwlist - +Modules/socketmodule.c sock_initobj keywords - +Modules/socketmodule.c sock_recvfrom_into kwlist - +Modules/socketmodule.c sock_recv_into kwlist - +Modules/socketmodule.c sock_sendmsg_afalg keywords - +Modules/socketmodule.c socket_getaddrinfo kwnames - +Modules/_sqlite/connection.c pysqlite_connection_backup keywords - +Modules/_sqlite/connection.c pysqlite_connection_create_aggregate kwlist - +Modules/_sqlite/connection.c pysqlite_connection_create_function kwlist - +Modules/_sqlite/connection.c pysqlite_connection_cursor kwlist - +Modules/_sqlite/connection.c pysqlite_connection_init kwlist - +Modules/_sqlite/connection.c pysqlite_connection_set_authorizer kwlist - +Modules/_sqlite/connection.c pysqlite_connection_set_progress_handler kwlist - +Modules/_sqlite/connection.c pysqlite_connection_set_trace_callback kwlist - +Modules/_sqlite/cursor.c pysqlite_cursor_fetchmany kwlist - +Modules/_sqlite/module.c module_complete kwlist - +Modules/_sqlite/module.c module_connect kwlist - +Modules/_sqlite/module.c module_enable_shared_cache kwlist - +Modules/syslogmodule.c syslog_openlog keywords - +Modules/_xxsubinterpretersmodule.c channel_close kwlist - +Modules/_xxsubinterpretersmodule.c channel_destroy kwlist - +Modules/_xxsubinterpretersmodule.c channelid_new kwlist - +Modules/_xxsubinterpretersmodule.c channel_list_interpreters kwlist - +Modules/_xxsubinterpretersmodule.c channel_recv kwlist - +Modules/_xxsubinterpretersmodule.c channel_release kwlist - +Modules/_xxsubinterpretersmodule.c channel_send kwlist - +Modules/_xxsubinterpretersmodule.c interp_create kwlist - +Modules/_xxsubinterpretersmodule.c interp_destroy kwlist - +Modules/_xxsubinterpretersmodule.c interp_is_running kwlist - +Modules/_xxsubinterpretersmodule.c interp_run_string kwlist - +Modules/_xxsubinterpretersmodule.c object_is_shareable kwlist - +Modules/_zoneinfo.c zoneinfo_clear_cache kwlist - +Modules/_zoneinfo.c zoneinfo_from_file kwlist - +Modules/_zoneinfo.c zoneinfo_new kwlist - +Modules/_zoneinfo.c zoneinfo_no_cache kwlist - +Objects/exceptions.c ImportError_init kwlist - +Objects/interpreteridobject.c interpid_new kwlist - +Objects/weakrefobject.c weakref_call kwlist - + +#----------------------- +# PyModuleDef_Slot +# [] + +Modules/_abc.c - _abcmodule_slots - +Modules/arraymodule.c - arrayslots - +Modules/atexitmodule.c - atexit_slots - +Modules/audioop.c - audioop_slots - +Modules/binascii.c - binascii_slots - +Modules/_blake2/blake2module.c - _blake2_slots - +Modules/cmathmodule.c - cmath_slots - +Modules/_codecsmodule.c - _codecs_slots - +Modules/_cryptmodule.c - _crypt_slots - +Modules/_curses_panel.c - _curses_slots - +Modules/_dbmmodule.c - _dbmmodule_slots - +Modules/errnomodule.c - errno_slots - +Modules/faulthandler.c - faulthandler_slots - +Modules/fcntlmodule.c - fcntl_slots - +Modules/_gdbmmodule.c - _gdbm_module_slots - +Modules/_hashopenssl.c - hashlib_slots - +Modules/_json.c - _json_slots - +Modules/_lsprof.c - _lsprofslots - +Modules/_lzmamodule.c - lzma_slots - +Modules/mathmodule.c - math_slots - +Modules/md5module.c - _md5_slots - +Modules/mmapmodule.c - mmap_slots - +Modules/_multiprocessing/multiprocessing.c - multiprocessing_slots - +Modules/nismodule.c - nis_slots - +Modules/overlapped.c - overlapped_slots - +Modules/posixmodule.c - posixmodile_slots - +Modules/_scproxy.c - _scproxy_slots - +Modules/sha1module.c - _sha1_slots - +Modules/sha256module.c - _sha256_slots - +Modules/_sha3/sha3module.c - _sha3_slots - +Modules/sha512module.c - _sha512_slots - +Modules/_stat.c - stat_slots - +Modules/syslogmodule.c - syslog_slots - +Modules/termios.c - termios_slots - +Modules/unicodedata.c - unicodedata_slots - +Modules/_uuidmodule.c - uuid_slots - +Modules/_winapi.c - winapi_slots - +Modules/xxlimited.c - xx_slots - +Modules/zlibmodule.c - zlib_slots - +Modules/_zoneinfo.c - zoneinfomodule_slots - +Python/marshal.c - marshalmodule_slots - +Python/Python-ast.c - astmodule_slots - +Modules/_bz2module.c - _bz2_slots - +Modules/_collectionsmodule.c - collections_slots - +Modules/_contextvarsmodule.c - _contextvars_slots - +Modules/_functoolsmodule.c - _functools_slots - +Modules/_heapqmodule.c - heapq_slots - +Modules/itertoolsmodule.c - itertoolsmodule_slots - +Modules/_localemodule.c - _locale_slots - +Modules/_operator.c - operator_slots - +Modules/resource.c - resource_slots - +Modules/_statisticsmodule.c - _statisticsmodule_slots - +Modules/timemodule.c - time_slots - +Modules/_weakref.c - weakref_slots - +Modules/xxmodule.c - xx_slots - +Modules/xxsubtype.c - xxsubtype_slots - + +#----------------------- +# PyMethodDef and PyMethodDef[], for static types and modules +# [] + +Modules/_abc.c - _destroy_def - +Modules/_abc.c - _abcmodule_methods - +Modules/arraymodule.c - array_methods - +Modules/arraymodule.c - arrayiter_methods - +Modules/arraymodule.c - a_methods - +Modules/_asynciomodule.c - FutureType_methods - +Modules/_asynciomodule.c - FutureIter_methods - +Modules/_asynciomodule.c - TaskType_methods - +Modules/_asynciomodule.c - asyncio_methods - +Modules/_asynciomodule.c - TaskWakeupDef - +Modules/atexitmodule.c - atexit_methods - +Modules/audioop.c - audioop_methods - +Modules/binascii.c - binascii_module_methods - +Modules/_bisectmodule.c - bisect_methods - +Modules/_blake2/blake2b_impl.c - py_blake2b_methods - +Modules/_blake2/blake2module.c - blake2mod_functions - +Modules/_blake2/blake2s_impl.c - py_blake2s_methods - +Modules/_bz2module.c - BZ2Compressor_methods - +Modules/_bz2module.c - BZ2Decompressor_methods - +Modules/cjkcodecs/multibytecodec.c - multibytecodec_methods - +Modules/cjkcodecs/multibytecodec.c - mbiencoder_methods - +Modules/cjkcodecs/multibytecodec.c - mbidecoder_methods - +Modules/cjkcodecs/multibytecodec.c - mbstreamreader_methods - +Modules/cjkcodecs/multibytecodec.c - mbstreamwriter_methods - +Modules/cjkcodecs/multibytecodec.c - __methods - +Modules/cmathmodule.c - cmath_methods - +Modules/_codecsmodule.c - _codecs_functions - +Modules/_collectionsmodule.c - deque_methods - +Modules/_collectionsmodule.c - dequeiter_methods - +Modules/_collectionsmodule.c - defdict_methods - +Modules/_collectionsmodule.c - tuplegetter_methods - +Modules/_collectionsmodule.c - collections_methods - +Modules/_contextvarsmodule.c - _contextvars_methods - +Modules/_cryptmodule.c - crypt_methods - +Modules/_csv.c - Reader_methods - +Modules/_csv.c - Writer_methods - +Modules/_csv.c - csv_methods - +Modules/_ctypes/callproc.c - _ctypes_module_methods - +Modules/_ctypes/_ctypes.c - CDataType_methods - +Modules/_ctypes/_ctypes.c - PyCPointerType_methods - +Modules/_ctypes/_ctypes.c - c_void_p_method - +Modules/_ctypes/_ctypes.c - c_char_p_method - +Modules/_ctypes/_ctypes.c - c_wchar_p_method - +Modules/_ctypes/_ctypes.c - PyCSimpleType_methods - +Modules/_ctypes/_ctypes.c - PyCData_methods - +Modules/_ctypes/_ctypes.c - Array_methods - +Modules/_ctypes/_ctypes.c - Simple_methods - +Modules/_ctypes/stgdict.c - PyCStgDict_methods - +Modules/_cursesmodule.c - PyCursesWindow_Methods - +Modules/_cursesmodule.c - PyCurses_methods - +Modules/_curses_panel.c - PyCursesPanel_Methods - +Modules/_curses_panel.c - PyCurses_methods - +Modules/_datetimemodule.c - delta_methods - +Modules/_datetimemodule.c - iso_calendar_date_methods - +Modules/_datetimemodule.c - date_methods - +Modules/_datetimemodule.c - tzinfo_methods - +Modules/_datetimemodule.c - timezone_methods - +Modules/_datetimemodule.c - time_methods - +Modules/_datetimemodule.c - datetime_methods - +Modules/_datetimemodule.c - module_methods - +Modules/_dbmmodule.c - dbm_methods - +Modules/_dbmmodule.c - dbmmodule_methods - +Modules/_decimal/_decimal.c - signaldict_methods - +Modules/_decimal/_decimal.c - ctxmanager_methods - +Modules/_decimal/_decimal.c - dec_methods - +Modules/_decimal/_decimal.c - context_methods - +Modules/_decimal/_decimal.c - _decimal_methods - +Modules/_elementtree.c - element_methods - +Modules/_elementtree.c - treebuilder_methods - +Modules/_elementtree.c - xmlparser_methods - +Modules/_elementtree.c - _functions - +Modules/errnomodule.c - errno_methods - +Modules/faulthandler.c - module_methods - +Modules/fcntlmodule.c - fcntl_methods - +Modules/_functoolsmodule.c - partial_methods - +Modules/_functoolsmodule.c - lru_cache_methods - +Modules/_functoolsmodule.c - _functools_methods - +Modules/gcmodule.c - GcMethods - +Modules/_gdbmmodule.c - gdbm_methods - +Modules/_gdbmmodule.c - _gdbm_module_methods - +Modules/grpmodule.c - grp_methods - +Modules/_hashopenssl.c - EVP_methods - +Modules/_hashopenssl.c - EVPXOF_methods - +Modules/_hashopenssl.c - HMAC_methods - +Modules/_hashopenssl.c - EVP_functions - +Modules/_heapqmodule.c - heapq_methods - +Modules/_io/bufferedio.c - bufferediobase_methods - +Modules/_io/bufferedio.c - bufferedreader_methods - +Modules/_io/bufferedio.c - bufferedwriter_methods - +Modules/_io/bufferedio.c - bufferedrwpair_methods - +Modules/_io/bufferedio.c - bufferedrandom_methods - +Modules/_io/bytesio.c - bytesio_methods - +Modules/_io/fileio.c - fileio_methods - +Modules/_io/iobase.c - iobase_methods - +Modules/_io/iobase.c - rawiobase_methods - +Modules/_io/_iomodule.c - module_methods - +Modules/_io/stringio.c - stringio_methods - +Modules/_io/textio.c - textiobase_methods - +Modules/_io/textio.c - incrementalnewlinedecoder_methods - +Modules/_io/textio.c - textiowrapper_methods - +Modules/_io/winconsoleio.c - winconsoleio_methods - +Modules/itertoolsmodule.c - groupby_methods - +Modules/itertoolsmodule.c - _grouper_methods - +Modules/itertoolsmodule.c - teedataobject_methods - +Modules/itertoolsmodule.c - tee_methods - +Modules/itertoolsmodule.c - cycle_methods - +Modules/itertoolsmodule.c - dropwhile_methods - +Modules/itertoolsmodule.c - takewhile_reduce_methods - +Modules/itertoolsmodule.c - islice_methods - +Modules/itertoolsmodule.c - starmap_methods - +Modules/itertoolsmodule.c - chain_methods - +Modules/itertoolsmodule.c - product_methods - +Modules/itertoolsmodule.c - combinations_methods - +Modules/itertoolsmodule.c - cwr_methods - +Modules/itertoolsmodule.c - permuations_methods - +Modules/itertoolsmodule.c - accumulate_methods - +Modules/itertoolsmodule.c - compress_methods - +Modules/itertoolsmodule.c - filterfalse_methods - +Modules/itertoolsmodule.c - count_methods - +Modules/itertoolsmodule.c - repeat_methods - +Modules/itertoolsmodule.c - zip_longest_methods - +Modules/itertoolsmodule.c - module_methods - +Modules/_json.c - speedups_methods - +Modules/_localemodule.c - PyLocale_Methods - +Modules/_lsprof.c - profiler_methods - +Modules/_lsprof.c - moduleMethods - +Modules/_lzmamodule.c - Compressor_methods - +Modules/_lzmamodule.c - Decompressor_methods - +Modules/_lzmamodule.c - lzma_methods - +Modules/mathmodule.c - math_methods - +Modules/md5module.c - MD5_methods - +Modules/md5module.c - MD5_functions - +Modules/mmapmodule.c - mmap_object_methods - +Modules/_multiprocessing/multiprocessing.c - module_methods - +Modules/_multiprocessing/posixshmem.c - module_methods - +Modules/_multiprocessing/semaphore.c - semlock_methods - +Modules/nismodule.c - nis_methods - +Modules/_opcode.c - opcode_functions - +Modules/_operator.c - operator_methods - +Modules/_operator.c - itemgetter_methods - +Modules/_operator.c - attrgetter_methods - +Modules/_operator.c - methodcaller_methods - +Modules/ossaudiodev.c - oss_methods - +Modules/ossaudiodev.c - oss_mixer_methods - +Modules/ossaudiodev.c - ossaudiodev_methods - +Modules/overlapped.c - Overlapped_methods - +Modules/overlapped.c - overlapped_functions - +Modules/_pickle.c - Pickler_methods - +Modules/_pickle.c - picklerproxy_methods - +Modules/_pickle.c - Unpickler_methods - +Modules/_pickle.c - unpicklerproxy_methods - +Modules/_pickle.c - pickle_methods - +Modules/posixmodule.c - DirEntry_methods - +Modules/posixmodule.c - ScandirIterator_methods - +Modules/posixmodule.c - posix_methods - +Modules/_posixsubprocess.c - module_methods - +Modules/pwdmodule.c - pwd_methods - +Modules/pyexpat.c - xmlparse_methods - +Modules/pyexpat.c - pyexpat_methods - +Modules/_queuemodule.c - simplequeue_methods - +Modules/_randommodule.c - random_methods - +Modules/readline.c - readline_methods - +Modules/resource.c - resource_methods - +Modules/_scproxy.c - mod_methods - +Modules/selectmodule.c - poll_methods - +Modules/selectmodule.c - devpoll_methods - +Modules/selectmodule.c - pyepoll_methods - +Modules/selectmodule.c - kqueue_queue_methods - +Modules/selectmodule.c - select_methods - +Modules/sha1module.c - SHA1_methods - +Modules/sha1module.c - SHA1_functions - +Modules/sha256module.c - SHA_methods - +Modules/sha256module.c - SHA_functions - +Modules/_sha3/sha3module.c - SHA3_methods - +Modules/_sha3/sha3module.c - SHAKE_methods - +Modules/sha512module.c - SHA_methods - +Modules/sha512module.c - SHA_functions - +Modules/signalmodule.c - signal_methods - +Modules/socketmodule.c - sock_methods - +Modules/socketmodule.c - socket_methods - +Modules/spwdmodule.c - spwd_methods - +Modules/_sqlite/cache.c - cache_methods - +Modules/_sqlite/connection.c - connection_methods - +Modules/_sqlite/cursor.c - cursor_methods - +Modules/_sqlite/module.c - module_methods - +Modules/_sqlite/row.c - row_methods - +Modules/_sre.c - pattern_methods - +Modules/_sre.c - match_methods - +Modules/_sre.c - scanner_methods - +Modules/_sre.c - _functions - +Modules/_ssl.c - PySSLMethods - +Modules/_ssl.c - context_methods - +Modules/_ssl.c - memory_bio_methods - +Modules/_ssl.c - PySSL_methods - +Modules/_stat.c - stat_methods - +Modules/_statisticsmodule.c - statistics_methods - +Modules/_struct.c - unpackiter_methods - +Modules/_struct.c - s_methods - +Modules/_struct.c - module_functions - +Modules/symtablemodule.c - symtable_methods - +Modules/syslogmodule.c - syslog_methods - +Modules/termios.c - termios_methods - +Modules/_threadmodule.c - lock_methods - +Modules/_threadmodule.c - rlock_methods - +Modules/_threadmodule.c local_new wr_callback_def - +Modules/_threadmodule.c - thread_methods - +Modules/timemodule.c - time_methods - +Modules/_tkinter.c - Tktt_methods - +Modules/_tkinter.c - Tkapp_methods - +Modules/_tkinter.c - moduleMethods - +Modules/_tracemalloc.c - module_methods - +Modules/unicodedata.c - unicodedata_functions - +Modules/_uuidmodule.c - uuid_methods - +Modules/_weakref.c - weakref_functions - +Modules/_winapi.c - overlapped_methods - +Modules/_winapi.c - winapi_functions - +Modules/xxlimited.c - Xxo_methods - +Modules/xxlimited.c - xx_methods - +Modules/xxmodule.c - Xxo_methods - +Modules/xxmodule.c - xx_methods - +Modules/_xxsubinterpretersmodule.c - module_functions - +Modules/xxsubtype.c - spamlist_methods - +Modules/xxsubtype.c - spamdict_methods - +Modules/xxsubtype.c - xxsubtype_functions - +Modules/zlibmodule.c - comp_methods - +Modules/zlibmodule.c - Decomp_methods - +Modules/zlibmodule.c - zlib_methods - +Modules/_zoneinfo.c - zoneinfo_methods - +Modules/_zoneinfo.c - module_methods - +Modules/cjkcodecs/cjkcodecs.h - __methods - +Objects/bytearrayobject.c - bytearray_methods - +Objects/bytearrayobject.c - bytearrayiter_methods - +Objects/bytesobject.c - bytes_methods - +Objects/bytesobject.c - striter_methods - +Objects/classobject.c - method_methods - +Objects/codeobject.c - code_methods - +Objects/complexobject.c - complex_methods - +Objects/descrobject.c - descr_methods - +Objects/descrobject.c - mappingproxy_methods - +Objects/descrobject.c - wrapper_methods - +Objects/descrobject.c - property_methods - +Objects/dictobject.c - mapp_methods - +Objects/dictobject.c - dictiter_methods - +Objects/dictobject.c - dictkeys_methods - +Objects/dictobject.c - dictitems_methods - +Objects/dictobject.c - dictvalues_methods - +Objects/enumobject.c - enum_methods - +Objects/enumobject.c - reversediter_methods - +Objects/exceptions.c - BaseException_methods - +Objects/exceptions.c - ImportError_methods - +Objects/exceptions.c - OSError_methods - +Objects/fileobject.c - stdprinter_methods - +Objects/floatobject.c - float_methods - +Objects/frameobject.c - frame_methods - +Objects/genericaliasobject.c - ga_methods - +Objects/genobject.c - gen_methods - +Objects/genobject.c - coro_methods - +Objects/genobject.c - coro_wrapper_methods - +Objects/genobject.c - async_gen_methods - +Objects/genobject.c - async_gen_asend_methods - +Objects/genobject.c - async_gen_athrow_methods - +Objects/iterobject.c - seqiter_methods - +Objects/iterobject.c - calliter_methods - +Objects/listobject.c - list_methods - +Objects/listobject.c - listiter_methods - +Objects/listobject.c - listreviter_methods - +Objects/longobject.c - long_methods - +Objects/memoryobject.c - memory_methods - +Objects/methodobject.c - meth_methods - +Objects/moduleobject.c - module_methods - +Objects/namespaceobject.c - namespace_methods - +Objects/object.c - notimplemented_methods - +Objects/odictobject.c - odict_methods - +Objects/odictobject.c - odictiter_methods - +Objects/odictobject.c - odictkeys_methods - +Objects/odictobject.c - odictitems_methods - +Objects/odictobject.c - odictvalues_methods - +Objects/picklebufobject.c - picklebuf_methods - +Objects/rangeobject.c - range_methods - +Objects/rangeobject.c - rangeiter_methods - +Objects/rangeobject.c - longrangeiter_methods - +Objects/setobject.c - setiter_methods - +Objects/setobject.c - set_methods - +Objects/setobject.c - frozenset_methods - +Objects/sliceobject.c - ellipsis_methods - +Objects/sliceobject.c - slice_methods - +Objects/structseq.c - structseq_methods - +Objects/tupleobject.c - tuple_methods - +Objects/tupleobject.c - tupleiter_methods - +Objects/typeobject.c - type_methods - +Objects/typeobject.c - object_methods - +Objects/typeobject.c - tp_new_methoddef - +Objects/unicodeobject.c - encoding_map_methods - +Objects/unicodeobject.c - unicode_methods - +Objects/unicodeobject.c - unicodeiter_methods - +Objects/unicodeobject.c - _string_methods - +Objects/unionobject.c - union_methods - +Objects/weakrefobject.c - weakref_methods - +Objects/weakrefobject.c - proxy_methods - +Objects/stringlib/unicode_format.h - formatteriter_methods - +Objects/stringlib/unicode_format.h - fieldnameiter_methods - +Python/bltinmodule.c - filter_methods - +Python/bltinmodule.c - map_methods - +Python/bltinmodule.c - zip_methods - +Python/bltinmodule.c - builtin_methods - +Python/context.c - PyContext_methods - +Python/context.c - PyContextVar_methods - +Python/context.c - PyContextTokenType_methods - +Python/hamt.c - PyHamt_methods - +Python/import.c - imp_methods - +Python/marshal.c - marshal_methods - +Python/Python-ast.c - ast_type_methods - +Python/sysmodule.c - sys_methods - +Python/traceback.c - tb_methods - +Python/_warnings.c - warnings_functions - + +#----------------------- +# PyMemberDef[], for static types and strucseq +# [] + +Modules/_bz2module.c - BZ2Decompressor_members - +Modules/cjkcodecs/multibytecodec.c - mbstreamreader_members - +Modules/cjkcodecs/multibytecodec.c - mbstreamwriter_members - +Modules/_collectionsmodule.c - defdict_members - +Modules/_collectionsmodule.c - tuplegetter_members - +Modules/_csv.c - Dialect_memberlist - +Modules/_csv.c - Reader_memberlist - +Modules/_csv.c - Writer_memberlist - +Modules/_ctypes/callproc.c - PyCArgType_members - +Modules/_ctypes/_ctypes.c - PyCData_members - +Modules/_datetimemodule.c - delta_members - +Modules/_elementtree.c - xmlparser_members - +Modules/_functoolsmodule.c - partial_memberlist - +Modules/_functoolsmodule.c - keyobject_members - +Modules/_io/bufferedio.c - bufferedreader_members - +Modules/_io/bufferedio.c - bufferedwriter_members - +Modules/_io/bufferedio.c - bufferedrandom_members - +Modules/_io/fileio.c - fileio_members - +Modules/_io/textio.c - textiowrapper_members - +Modules/_io/winconsoleio.c - winconsoleio_members - +Modules/_json.c - scanner_members - +Modules/_json.c - encoder_members - +Modules/_lzmamodule.c - Decompressor_members - +Modules/_multiprocessing/semaphore.c - semlock_members - +Modules/ossaudiodev.c - oss_members - +Modules/overlapped.c - Overlapped_members - +Modules/_pickle.c - Pickler_members - +Modules/posixmodule.c - DirEntry_members - +Modules/pyexpat.c - xmlparse_members - +Modules/selectmodule.c - kqueue_event_members - +Modules/sha256module.c - SHA_members - +Modules/sha512module.c - SHA_members - +Modules/socketmodule.c - sock_memberlist - +Modules/_sqlite/connection.c - connection_members - +Modules/_sqlite/cursor.c - cursor_members - +Modules/_sqlite/statement.c - stmt_members - +Modules/_sre.c - pattern_members - +Modules/_sre.c - match_members - +Modules/_sre.c - scanner_members - +Modules/_struct.c - s_members - +Modules/unicodedata.c - DB_members - +Modules/_winapi.c - overlapped_members - +Modules/xxsubtype.c - spamdict_members - +Modules/zlibmodule.c - Decomp_members - +Modules/_zoneinfo.c - zoneinfo_members - +Objects/classobject.c - method_memberlist - +Objects/classobject.c - instancemethod_memberlist - +Objects/codeobject.c - code_memberlist - +Objects/complexobject.c - complex_members - +Objects/descrobject.c - descr_members - +Objects/descrobject.c - wrapper_members - +Objects/descrobject.c - property_members - +Objects/exceptions.c - BaseException_members - +Objects/exceptions.c - StopIteration_members - +Objects/exceptions.c - SystemExit_members - +Objects/exceptions.c - ImportError_members - +Objects/exceptions.c - OSError_members - +Objects/exceptions.c - SyntaxError_members - +Objects/exceptions.c - UnicodeError_members - +Objects/frameobject.c - frame_memberlist - +Objects/funcobject.c - func_memberlist - +Objects/funcobject.c - cm_memberlist - +Objects/funcobject.c - sm_memberlist - +Objects/genericaliasobject.c - ga_members - +Objects/genobject.c - gen_memberlist - +Objects/genobject.c - coro_memberlist - +Objects/genobject.c - async_gen_memberlist - +Objects/methodobject.c - meth_members - +Objects/moduleobject.c - module_members - +Objects/namespaceobject.c - namespace_members - +Objects/rangeobject.c - range_members - +Objects/sliceobject.c - slice_members - +Objects/typeobject.c - type_members - +Objects/typeobject.c - super_members - +Objects/unionobject.c - union_members - +Objects/weakrefobject.c - weakref_members - +Python/context.c - PyContextVar_members - +Python/Python-ast.c - ast_type_members - +Python/symtable.c - ste_memberlist - +Python/traceback.c - tb_memberlist - + +#----------------------- +# for static types +# [] + +# PyNumberMethods [] +Modules/_collectionsmodule.c - deque_as_number - +Modules/_collectionsmodule.c - defdict_as_number - +Modules/_ctypes/_ctypes.c - PyCFuncPtr_as_number - +Modules/_ctypes/_ctypes.c - Simple_as_number - +Modules/_ctypes/_ctypes.c - Pointer_as_number - +Modules/_datetimemodule.c - delta_as_number - +Modules/_datetimemodule.c - date_as_number - +Modules/_datetimemodule.c - datetime_as_number - +Modules/_decimal/_decimal.c - dec_number_methods - +Modules/_xxsubinterpretersmodule.c - channelid_as_number - +Objects/boolobject.c - bool_as_number - +Objects/bytearrayobject.c - bytearray_as_number - +Objects/bytesobject.c - bytes_as_number - +Objects/complexobject.c - complex_as_number - +Objects/descrobject.c - mappingproxy_as_number - +Objects/dictobject.c - dict_as_number - +Objects/dictobject.c - dictviews_as_number - +Objects/floatobject.c - float_as_number - +Objects/interpreteridobject.c - interpid_as_number - +Objects/longobject.c - long_as_number - +Objects/object.c - none_as_number - +Objects/object.c - notimplemented_as_number - +Objects/odictobject.c - odict_as_number - +Objects/rangeobject.c - range_as_number - +Objects/setobject.c - set_as_number - +Objects/setobject.c - frozenset_as_number - +Objects/typeobject.c - type_as_number - +Objects/unicodeobject.c - unicode_as_number - +Objects/unionobject.c - union_as_number - +Objects/weakrefobject.c - proxy_as_number - + +# PySequenceMethods [] +Modules/arraymodule.c - array_as_sequence - +Modules/_collectionsmodule.c - deque_as_sequence - +Modules/_ctypes/_ctypes.c - CDataType_as_sequence - +Modules/_ctypes/_ctypes.c - Array_as_sequence - +Modules/_ctypes/_ctypes.c - Pointer_as_sequence - +Modules/_elementtree.c - element_as_sequence - +Modules/mmapmodule.c - mmap_as_sequence - +Objects/bytearrayobject.c - bytearray_as_sequence - +Objects/bytesobject.c - bytes_as_sequence - +Objects/descrobject.c - mappingproxy_as_sequence - +Objects/dictobject.c - dict_as_sequence - +Objects/dictobject.c - dictkeys_as_sequence - +Objects/dictobject.c - dictitems_as_sequence - +Objects/dictobject.c - dictvalues_as_sequence - +Objects/listobject.c - list_as_sequence - +Objects/memoryobject.c - memory_as_sequence - +Objects/rangeobject.c - range_as_sequence - +Objects/setobject.c - set_as_sequence - +Objects/tupleobject.c - tuple_as_sequence - +Objects/unicodeobject.c - unicode_as_sequence - +Objects/weakrefobject.c - proxy_as_sequence - +Python/context.c - PyContext_as_sequence - +Python/hamt.c - PyHamt_as_sequence - + +# PyMappingMethods [] +Modules/arraymodule.c - array_as_mapping - +Modules/_ctypes/_ctypes.c - Array_as_mapping - +Modules/_ctypes/_ctypes.c - Pointer_as_mapping - +Modules/_decimal/_decimal.c - signaldict_as_mapping - +Modules/_elementtree.c - element_as_mapping - +Modules/mmapmodule.c - mmap_as_mapping - +Modules/_sre.c - match_as_mapping - +Objects/bytearrayobject.c - bytearray_as_mapping - +Objects/bytesobject.c - bytes_as_mapping - +Objects/descrobject.c - mappingproxy_as_mapping - +Objects/dictobject.c - dict_as_mapping - +Objects/genericaliasobject.c - ga_as_mapping - +Objects/listobject.c - list_as_mapping - +Objects/memoryobject.c - memory_as_mapping - +Objects/odictobject.c - odict_as_mapping - +Objects/rangeobject.c - range_as_mapping - +Objects/tupleobject.c - tuple_as_mapping - +Objects/unicodeobject.c - unicode_as_mapping - +Objects/weakrefobject.c - proxy_as_mapping - +Python/context.c - PyContext_as_mapping - +Python/hamt.c - PyHamtIterator_as_mapping - +Python/hamt.c - PyHamt_as_mapping - + +# PyAsyncMethods [] +Modules/_asynciomodule.c - FutureType_as_async - +Objects/genobject.c - coro_as_async - +Objects/genobject.c - async_gen_as_async - +Objects/genobject.c - async_gen_asend_as_async - +Objects/genobject.c - async_gen_athrow_as_async - + +# PyBufferProcs [] +Modules/arraymodule.c - array_as_buffer - +Modules/_ctypes/_ctypes.c - PyCData_as_buffer - +Modules/_io/bytesio.c - bytesiobuf_as_buffer - +Modules/mmapmodule.c - mmap_as_buffer - +Objects/bytearrayobject.c - bytearray_as_buffer - +Objects/bytesobject.c - bytes_as_buffer - +Objects/memoryobject.c - memory_as_buffer - +Objects/picklebufobject.c - picklebuf_as_buffer - + +# PyGetSetDef [] +Modules/arraymodule.c - array_getsets - +Modules/_asynciomodule.c - FutureType_getsetlist - +Modules/_asynciomodule.c - TaskStepMethWrapper_getsetlist - +Modules/_asynciomodule.c - TaskType_getsetlist - +Modules/_blake2/blake2b_impl.c - py_blake2b_getsetters - +Modules/_blake2/blake2s_impl.c - py_blake2s_getsetters - +Modules/cjkcodecs/multibytecodec.c - codecctx_getsets - +Modules/_collectionsmodule.c - deque_getset - +Modules/_csv.c - Dialect_getsetlist - +Modules/_ctypes/cfield.c - PyCField_getset - +Modules/_ctypes/_ctypes.c - CharArray_getsets - +Modules/_ctypes/_ctypes.c - WCharArray_getsets - +Modules/_ctypes/_ctypes.c - PyCFuncPtr_getsets - +Modules/_ctypes/_ctypes.c - Simple_getsets - +Modules/_ctypes/_ctypes.c - Pointer_getsets - +Modules/_cursesmodule.c - PyCursesWindow_getsets - +Modules/_datetimemodule.c - date_getset - +Modules/_datetimemodule.c - iso_calendar_date_getset - +Modules/_datetimemodule.c - time_getset - +Modules/_datetimemodule.c - datetime_getset - +Modules/_decimal/_decimal.c - context_getsets - +Modules/_decimal/_decimal.c - dec_getsets - +Modules/_elementtree.c - xmlparser_getsetlist - +Modules/_elementtree.c - element_getsetlist - +Modules/_functoolsmodule.c - partial_getsetlist - +Modules/_functoolsmodule.c - lru_cache_getsetlist - +Modules/_hashopenssl.c - EVP_getseters - +Modules/_hashopenssl.c - EVPXOF_getseters - +Modules/_hashopenssl.c - HMAC_getset - +Modules/_io/bufferedio.c - bufferedreader_getset - +Modules/_io/bufferedio.c - bufferedwriter_getset - +Modules/_io/bufferedio.c - bufferedrwpair_getset - +Modules/_io/bufferedio.c - bufferedrandom_getset - +Modules/_io/bytesio.c - bytesio_getsetlist - +Modules/_io/fileio.c - fileio_getsetlist - +Modules/_io/iobase.c - iobase_getset - +Modules/_io/stringio.c - stringio_getset - +Modules/_io/textio.c - textiobase_getset - +Modules/_io/textio.c - incrementalnewlinedecoder_getset - +Modules/_io/textio.c - textiowrapper_getset - +Modules/_io/winconsoleio.c - winconsoleio_getsetlist - +Modules/md5module.c - MD5_getseters - +Modules/mmapmodule.c - mmap_object_getset - +Modules/ossaudiodev.c - oss_getsetlist - +Modules/overlapped.c - Overlapped_getsets - +Modules/_pickle.c - Pickler_getsets - +Modules/_pickle.c - Unpickler_getsets - +Modules/pyexpat.c - xmlparse_getsetlist - +Modules/selectmodule.c - devpoll_getsetlist - +Modules/selectmodule.c - pyepoll_getsetlist - +Modules/selectmodule.c - kqueue_queue_getsetlist - +Modules/sha1module.c - SHA1_getseters - +Modules/sha256module.c - SHA_getseters - +Modules/_sha3/sha3module.c - SHA3_getseters - +Modules/sha512module.c - SHA_getseters - +Modules/socketmodule.c - sock_getsetlist - +Modules/_sqlite/connection.c - connection_getset - +Modules/_sre.c - pattern_getset - +Modules/_sre.c - match_getset - +Modules/_ssl.c - ssl_getsetlist - +Modules/_ssl.c - context_getsetlist - +Modules/_ssl.c - memory_bio_getsetlist - +Modules/_ssl.c - PySSLSession_getsetlist - +Modules/_struct.c - s_getsetlist - +Modules/_tkinter.c - PyTclObject_getsetlist - +Modules/_xxsubinterpretersmodule.c - channelid_getsets - +Modules/xxsubtype.c - spamlist_getsets - +Objects/cellobject.c - cell_getsetlist - +Objects/classobject.c - method_getset - +Objects/classobject.c - instancemethod_getset - +Objects/descrobject.c - method_getset - +Objects/descrobject.c - member_getset - +Objects/descrobject.c - getset_getset - +Objects/descrobject.c - wrapperdescr_getset - +Objects/descrobject.c - wrapper_getsets - +Objects/descrobject.c - property_getsetlist - +Objects/dictobject.c - dictview_getset - +Objects/exceptions.c - BaseException_getset - +Objects/exceptions.c - OSError_getset - +Objects/fileobject.c - stdprinter_getsetlist - +Objects/floatobject.c - float_getset - +Objects/frameobject.c - frame_getsetlist - +Objects/funcobject.c - func_getsetlist - +Objects/funcobject.c - cm_getsetlist - +Objects/funcobject.c - sm_getsetlist - +Objects/genericaliasobject.c - ga_properties - +Objects/genobject.c - gen_getsetlist - +Objects/genobject.c - coro_getsetlist - +Objects/genobject.c - async_gen_getsetlist - +Objects/longobject.c - long_getset - +Objects/memoryobject.c - memory_getsetlist - +Objects/methodobject.c - meth_getsets - +Objects/odictobject.c - odict_getset - +Objects/typeobject.c - type_getsets - +Objects/typeobject.c - subtype_getsets_full - +Objects/typeobject.c - subtype_getsets_dict_only - +Objects/typeobject.c - subtype_getsets_weakref_only - +Objects/typeobject.c - object_getsets - +Python/context.c - PyContextTokenType_getsetlist - +Python/Python-ast.c - ast_type_getsets - +Python/traceback.c - tb_getsetters - + +#----------------------- +# for heap types +# [] + +# PyType_Slot [] +Modules/_abc.c - _abc_data_type_spec_slots - +Modules/_blake2/blake2b_impl.c - blake2b_type_slots - +Modules/_blake2/blake2s_impl.c - blake2s_type_slots - +Modules/_bz2module.c - bz2_compressor_type_slots - +Modules/_bz2module.c - bz2_decompressor_type_slots - +Modules/_curses_panel.c - PyCursesPanel_Type_slots - +Modules/_dbmmodule.c - dbmtype_spec_slots - +Modules/_gdbmmodule.c - gdbmtype_spec_slots - +Modules/_hashopenssl.c - EVPtype_slots - +Modules/_hashopenssl.c - EVPXOFtype_slots - +Modules/_hashopenssl.c - HMACtype_slots - +Modules/_json.c - PyScannerType_slots - +Modules/_json.c - PyEncoderType_slots - +Modules/_lsprof.c - _lsprof_profiler_type_spec_slots - +Modules/_lzmamodule.c - lzma_compressor_type_slots - +Modules/_lzmamodule.c - lzma_decompressor_type_slots - +Modules/md5module.c - md5_type_slots - +Modules/_operator.c - itemgetter_type_slots - +Modules/_operator.c - attrgetter_type_slots - +Modules/_operator.c - methodcaller_type_slots - +Modules/overlapped.c - overlapped_type_slots - +Modules/posixmodule.c - DirEntryType_slots - +Modules/posixmodule.c - ScandirIteratorType_slots - +Modules/_randommodule.c - Random_Type_slots - +Modules/selectmodule.c - devpoll_Type_slots - +Modules/selectmodule.c - kqueue_event_Type_slots - +Modules/selectmodule.c - poll_Type_slots - +Modules/selectmodule.c - pyEpoll_Type_slots - +Modules/selectmodule.c - kqueue_queue_Type_slots - +Modules/sha1module.c - sha1_type_slots - +Modules/sha256module.c - sha256_types_slots - +Modules/_sha3/sha3module.c - sha3_224_slots - +Modules/_sha3/sha3module.c - sha3_256_slots - +Modules/_sha3/sha3module.c - sha3_384_slots - +Modules/_sha3/sha3module.c - sha3_512_slots - +Modules/_sha3/sha3module.c - SHAKE128slots - +Modules/_sha3/sha3module.c - SHAKE256slots - +Modules/_sha3/sha3module.c - type_slots_obj - +Modules/sha512module.c - sha512_sha384_type_slots - +Modules/sha512module.c - sha512_sha512_type_slots - +Modules/_sqlite/cache.c - pysqlite_NodeType_slots - +Modules/_sqlite/cache.c - pysqlite_CacheType_slots - +Modules/_sqlite/connection.c - connection_slots - +Modules/_sqlite/cursor.c - cursor_slots - +Modules/_sqlite/prepare_protocol.c - type_slots - +Modules/_sqlite/row.c - row_slots - +Modules/_sqlite/statement.c - stmt_slots - +Modules/_ssl.c - sslerror_type_slots - +Modules/_struct.c - unpackiter_type_slots - +Modules/_struct.c - PyStructType_slots - +Modules/_tkinter.c - PyTclObject_Type_slots - +Modules/_tkinter.c - Tktt_Type_slots - +Modules/_tkinter.c - Tkapp_Type_slots - +Modules/unicodedata.c - ucd_type_slots - +Modules/_winapi.c - winapi_overlapped_type_slots - +Modules/xxlimited.c - Xxo_Type_slots - +Modules/xxlimited.c - Str_Type_slots - +Modules/xxlimited.c - Null_Type_slots - +Modules/zlibmodule.c - Comptype_slots - +Modules/zlibmodule.c - Decomptype_slots - +Python/Python-ast.c - AST_type_slots - + +# PyType_Spec [] +Modules/_abc.c - _abc_data_type_spec - +Modules/_blake2/blake2b_impl.c - blake2b_type_spec - +Modules/_blake2/blake2s_impl.c - blake2s_type_spec - +Modules/_bz2module.c - bz2_compressor_type_spec - +Modules/_bz2module.c - bz2_decompressor_type_spec - +Modules/_curses_panel.c - PyCursesPanel_Type_spec - +Modules/_dbmmodule.c - dbmtype_spec - +Modules/_gdbmmodule.c - gdbmtype_spec - +Modules/_hashopenssl.c - EVPtype_spec - +Modules/_hashopenssl.c - EVPXOFtype_spec - +Modules/_hashopenssl.c - HMACtype_spec - +Modules/_json.c - PyScannerType_spec - +Modules/_json.c - PyEncoderType_spec - +Modules/_lsprof.c - _lsprof_profiler_type_spec - +Modules/_lzmamodule.c - lzma_compressor_type_spec - +Modules/_lzmamodule.c - lzma_decompressor_type_spec - +Modules/_operator.c - itemgetter_type_spec - +Modules/_operator.c - attrgetter_type_spec - +Modules/_operator.c - methodcaller_type_spec - +Modules/_randommodule.c - Random_Type_spec - +Modules/_sha3/sha3module.c - sha3_224_spec - +Modules/_sha3/sha3module.c - sha3_256_spec - +Modules/_sha3/sha3module.c - sha3_384_spec - +Modules/_sha3/sha3module.c - sha3_512_spec - +Modules/_sha3/sha3module.c - SHAKE128_spec - +Modules/_sha3/sha3module.c - SHAKE256_spec - +Modules/_sha3/sha3module.c - type_spec_obj - +Modules/_sqlite/cache.c - pysqlite_NodeType_spec - +Modules/_sqlite/cache.c - pysqlite_CacheType_spec - +Modules/_sqlite/connection.c - connection_spec - +Modules/_sqlite/cursor.c - cursor_spec - +Modules/_sqlite/prepare_protocol.c - type_spec - +Modules/_sqlite/row.c - row_spec - +Modules/_sqlite/statement.c - stmt_spec - +Modules/_ssl.c - sslerror_type_spec - +Modules/_struct.c - unpackiter_type_spec - +Modules/_struct.c - PyStructType_spec - +Modules/_tkinter.c - PyTclObject_Type_spec - +Modules/_tkinter.c - Tktt_Type_spec - +Modules/_tkinter.c - Tkapp_Type_spec - +Modules/_winapi.c - winapi_overlapped_type_spec - +Modules/_zoneinfo.c - DAYS_IN_MONTH - +Modules/_zoneinfo.c - DAYS_BEFORE_MONTH - +Modules/md5module.c - md5_type_spec - +Modules/overlapped.c - overlapped_type_spec - +Modules/posixmodule.c - DirEntryType_spec - +Modules/posixmodule.c - ScandirIteratorType_spec - +Modules/selectmodule.c - devpoll_Type_spec - +Modules/selectmodule.c - kqueue_event_Type_spec - +Modules/selectmodule.c - poll_Type_spec - +Modules/selectmodule.c - pyEpoll_Type_spec - +Modules/selectmodule.c - kqueue_queue_Type_spec - +Modules/sha1module.c - sha1_type_spec - +Modules/sha256module.c - sha224_type_spec - +Modules/sha256module.c - sha256_type_spec - +Modules/sha512module.c - sha512_sha384_type_spec - +Modules/sha512module.c - sha512_sha512_type_spec - +Modules/unicodedata.c - ucd_type_spec - +Modules/xxlimited.c - Xxo_Type_spec - +Modules/xxlimited.c - Str_Type_spec - +Modules/xxlimited.c - Null_Type_spec - +Modules/zlibmodule.c - Comptype_spec - +Modules/zlibmodule.c - Decomptype_spec - +Python/Python-ast.c - AST_type_spec - + +#----------------------- +# for structseq +# [] + +# PyStructSequence_Field[] [] +Modules/_cursesmodule.c - ncurses_version_fields - +Modules/grpmodule.c - struct_group_type_fields - +Modules/_lsprof.c - profiler_entry_fields - +Modules/_lsprof.c - profiler_subentry_fields - +Modules/posixmodule.c - stat_result_fields - +Modules/posixmodule.c - statvfs_result_fields - +Modules/posixmodule.c - waitid_result_fields - +Modules/posixmodule.c - uname_result_fields - +Modules/posixmodule.c - sched_param_fields - +Modules/posixmodule.c - times_result_fields - +Modules/posixmodule.c - TerminalSize_fields - +Modules/pwdmodule.c - struct_pwd_type_fields - +Modules/resource.c - struct_rusage_fields - +Modules/signalmodule.c - struct_siginfo_fields - +Modules/spwdmodule.c - struct_spwd_type_fields - +Modules/_threadmodule.c - ExceptHookArgs_fields - +Modules/timemodule.c - struct_time_type_fields - +Objects/floatobject.c - floatinfo_fields - +Objects/longobject.c - int_info_fields - +Python/errors.c - UnraisableHookArgs_fields - +Python/sysmodule.c - asyncgen_hooks_fields - +Python/sysmodule.c - hash_info_fields - +Python/sysmodule.c - windows_version_fields - +Python/sysmodule.c - flags_fields - +Python/sysmodule.c - version_info_fields - +Python/thread.c - threadinfo_fields - + +# PyStructSequence_Desc [] +Modules/_cursesmodule.c - ncurses_version_desc - +Modules/grpmodule.c - struct_group_type_desc - +Modules/_lsprof.c - profiler_entry_desc - +Modules/_lsprof.c - profiler_subentry_desc - +Modules/posixmodule.c - stat_result_desc - +Modules/posixmodule.c - statvfs_result_desc - +Modules/posixmodule.c - waitid_result_desc - +Modules/posixmodule.c - uname_result_desc - +Modules/posixmodule.c - sched_param_desc - +Modules/posixmodule.c - times_result_desc - +Modules/posixmodule.c - TerminalSize_desc - +Modules/pwdmodule.c - struct_pwd_type_desc - +Modules/resource.c - struct_rusage_desc - +Modules/signalmodule.c - struct_siginfo_desc - +Modules/spwdmodule.c - struct_spwd_type_desc - +Modules/_threadmodule.c - ExceptHookArgs_desc - +Modules/timemodule.c - struct_time_type_desc - +Objects/floatobject.c - floatinfo_desc - +Objects/longobject.c - int_info_desc - +Python/errors.c - UnraisableHookArgs_desc - +Python/sysmodule.c - asyncgen_hooks_desc - +Python/sysmodule.c - hash_info_desc - +Python/sysmodule.c - windows_version_desc - +Python/sysmodule.c - flags_desc - +Python/sysmodule.c - version_info_desc - +Python/thread.c - threadinfo_desc - + +#----------------------- +# _PyArg_Parser +# [] + +Modules/clinic/md5module.c.h MD5Type_copy _parser - +Modules/clinic/md5module.c.h _md5_md5 _parser - +Modules/clinic/_dbmmodule.c.h _dbm_dbm_keys _parser - +Modules/clinic/_dbmmodule.c.h _dbm_dbm_get _parser - +Modules/clinic/_dbmmodule.c.h _dbm_dbm_setdefault _parser - +Modules/clinic/posixmodule.c.h os_stat _parser - +Modules/clinic/posixmodule.c.h os_lstat _parser - +Modules/clinic/posixmodule.c.h os_access _parser - +Modules/clinic/posixmodule.c.h os_chdir _parser - +Modules/clinic/posixmodule.c.h os_chmod _parser - +Modules/clinic/posixmodule.c.h os_listdir _parser - +Modules/clinic/posixmodule.c.h os_mkdir _parser - +Modules/clinic/posixmodule.c.h os_rename _parser - +Modules/clinic/posixmodule.c.h os_replace _parser - +Modules/clinic/posixmodule.c.h os_rmdir _parser - +Modules/clinic/posixmodule.c.h os_unlink _parser - +Modules/clinic/posixmodule.c.h os_remove _parser - +Modules/clinic/posixmodule.c.h os_utime _parser - +Modules/clinic/posixmodule.c.h os__exit _parser - +Modules/clinic/posixmodule.c.h os_open _parser - +Modules/clinic/posixmodule.c.h os_close _parser - +Modules/clinic/posixmodule.c.h os_dup2 _parser - +Modules/clinic/posixmodule.c.h os_fstat _parser - +Modules/clinic/posixmodule.c.h os_device_encoding _parser - +Modules/clinic/posixmodule.c.h os_DirEntry_is_symlink _parser - +Modules/clinic/posixmodule.c.h os_DirEntry_stat _parser - +Modules/clinic/posixmodule.c.h os_DirEntry_is_dir _parser - +Modules/clinic/posixmodule.c.h os_DirEntry_is_file _parser - +Modules/clinic/posixmodule.c.h os_scandir _parser - +Modules/clinic/posixmodule.c.h os_fspath _parser - +Modules/clinic/cmathmodule.c.h cmath_isclose _parser - +Modules/clinic/sha256module.c.h SHA256Type_copy _parser - +Modules/clinic/sha256module.c.h _sha256_sha256 _parser - +Modules/clinic/sha256module.c.h _sha256_sha224 _parser - +Modules/clinic/_hashopenssl.c.h EVP_new _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_md5 _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_sha1 _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_sha224 _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_sha256 _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_sha384 _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_openssl_sha512 _parser - +Modules/clinic/_hashopenssl.c.h pbkdf2_hmac _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_hmac_singleshot _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_hmac_new _parser - +Modules/clinic/_hashopenssl.c.h _hashlib_HMAC_update _parser - +Modules/clinic/_ssl.c.h _ssl__SSLSocket_get_channel_binding _parser - +Modules/clinic/_ssl.c.h _ssl__SSLContext_load_cert_chain _parser - +Modules/clinic/_ssl.c.h _ssl__SSLContext_load_verify_locations _parser - +Modules/clinic/_ssl.c.h _ssl__SSLContext__wrap_socket _parser - +Modules/clinic/_ssl.c.h _ssl__SSLContext__wrap_bio _parser - +Modules/clinic/_ssl.c.h _ssl__SSLContext_get_ca_certs _parser - +Modules/clinic/_ssl.c.h _ssl_txt2obj _parser - +Modules/clinic/_queuemodule.c.h _queue_SimpleQueue_put _parser - +Modules/clinic/_queuemodule.c.h _queue_SimpleQueue_put_nowait _parser - +Modules/clinic/_queuemodule.c.h _queue_SimpleQueue_get _parser - +Modules/clinic/_lsprof.c.h _lsprof_Profiler_getstats _parser - +Modules/clinic/_datetimemodule.c.h iso_calendar_date_new _parser - +Modules/clinic/_datetimemodule.c.h datetime_datetime_now _parser - +Modules/clinic/_opcode.c.h _opcode_stack_effect _parser - +Modules/clinic/_lzmamodule.c.h _lzma_LZMADecompressor_decompress _parser - +Modules/clinic/_lzmamodule.c.h _lzma_LZMADecompressor___init__ _parser - +Modules/clinic/pyexpat.c.h pyexpat_ParserCreate _parser - +Modules/clinic/mathmodule.c.h math_isclose _parser - +Modules/clinic/mathmodule.c.h math_prod _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_bottom _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_hide _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_show _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_top _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_move _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_replace _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_set_userptr _parser - +Modules/clinic/_curses_panel.c.h _curses_panel_panel_userptr _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_find _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_findtext _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_findall _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_iterfind _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_get _parser - +Modules/clinic/_elementtree.c.h _elementtree_Element_iter _parser - +Modules/clinic/_elementtree.c.h _elementtree_TreeBuilder___init__ _parser - +Modules/clinic/_elementtree.c.h _elementtree_XMLParser___init__ _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Future___init__ _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Future_add_done_callback _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Future_cancel _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Task___init__ _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Task_cancel _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Task_get_stack _parser - +Modules/clinic/_asynciomodule.c.h _asyncio_Task_print_stack _parser - +Modules/clinic/_asynciomodule.c.h _asyncio__register_task _parser - +Modules/clinic/_asynciomodule.c.h _asyncio__unregister_task _parser - +Modules/clinic/_asynciomodule.c.h _asyncio__enter_task _parser - +Modules/clinic/_asynciomodule.c.h _asyncio__leave_task _parser - +Modules/clinic/gcmodule.c.h gc_collect _parser - +Modules/clinic/gcmodule.c.h gc_get_objects _parser - +Modules/clinic/grpmodule.c.h grp_getgrgid _parser - +Modules/clinic/grpmodule.c.h grp_getgrnam _parser - +Modules/clinic/_pickle.c.h _pickle_Pickler___init__ _parser - +Modules/clinic/_pickle.c.h _pickle_Unpickler___init__ _parser - +Modules/clinic/_pickle.c.h _pickle_dump _parser - +Modules/clinic/_pickle.c.h _pickle_dumps _parser - +Modules/clinic/_pickle.c.h _pickle_load _parser - +Modules/clinic/_pickle.c.h _pickle_loads _parser - +Modules/clinic/_struct.c.h Struct___init__ _parser - +Modules/clinic/_struct.c.h Struct_unpack_from _parser - +Modules/clinic/_struct.c.h unpack_from _parser - +Modules/clinic/_testmultiphase.c.h _testmultiphase_StateAccessType_get_defining_module _parser - +Modules/clinic/_testmultiphase.c.h _testmultiphase_StateAccessType_increment_count_clinic _parser - +Modules/clinic/_testmultiphase.c.h _testmultiphase_StateAccessType_get_count _parser - +Modules/clinic/_gdbmmodule.c.h _gdbm_gdbm_keys _parser - +Modules/clinic/_gdbmmodule.c.h _gdbm_gdbm_firstkey _parser - +Modules/clinic/_gdbmmodule.c.h _gdbm_gdbm_nextkey _parser - +Modules/clinic/_gdbmmodule.c.h _gdbm_gdbm_reorganize _parser - +Modules/clinic/_gdbmmodule.c.h _gdbm_gdbm_sync _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_match _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_fullmatch _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_search _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_findall _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_finditer _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_scanner _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_split _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_sub _parser - +Modules/clinic/_sre.c.h _sre_SRE_Pattern_subn _parser - +Modules/clinic/_sre.c.h _sre_compile _parser - +Modules/clinic/_sre.c.h _sre_SRE_Match_expand _parser - +Modules/clinic/_sre.c.h _sre_SRE_Match_groups _parser - +Modules/clinic/_sre.c.h _sre_SRE_Match_groupdict _parser - +Modules/clinic/overlapped.c.h _overlapped_Overlapped _parser - +Modules/clinic/_bisectmodule.c.h _bisect_bisect_right _parser - +Modules/clinic/_bisectmodule.c.h _bisect_insort_right _parser - +Modules/clinic/_bisectmodule.c.h _bisect_bisect_left _parser - +Modules/clinic/_bisectmodule.c.h _bisect_insort_left _parser - +Modules/clinic/zlibmodule.c.h zlib_compress _parser - +Modules/clinic/zlibmodule.c.h zlib_decompress _parser - +Modules/clinic/zlibmodule.c.h zlib_compressobj _parser - +Modules/clinic/zlibmodule.c.h zlib_decompressobj _parser - +Modules/clinic/zlibmodule.c.h zlib_Compress_compress _parser - +Modules/clinic/zlibmodule.c.h zlib_Decompress_decompress _parser - +Modules/clinic/zlibmodule.c.h zlib_Compress_flush _parser - +Modules/clinic/zlibmodule.c.h zlib_Decompress_flush _parser - +Modules/clinic/sha512module.c.h SHA512Type_copy _parser - +Modules/clinic/sha512module.c.h _sha512_sha512 _parser - +Modules/clinic/sha512module.c.h _sha512_sha384 _parser - +Modules/clinic/_bz2module.c.h _bz2_BZ2Decompressor_decompress _parser - +Modules/clinic/sha1module.c.h SHA1Type_copy _parser - +Modules/clinic/sha1module.c.h _sha1_sha1 _parser - +Modules/clinic/_winapi.c.h _winapi_ConnectNamedPipe _parser - +Modules/clinic/_winapi.c.h _winapi_ReadFile _parser - +Modules/clinic/_winapi.c.h _winapi_WriteFile _parser - +Modules/clinic/_winapi.c.h _winapi_GetFileType _parser - +Modules/clinic/_codecsmodule.c.h _codecs_encode _parser - +Modules/clinic/_codecsmodule.c.h _codecs_decode _parser - +Modules/clinic/_cursesmodule.c.h _curses_setupterm _parser - +Modules/clinic/itertoolsmodule.c.h itertools_groupby _parser - +Modules/clinic/itertoolsmodule.c.h itertools_combinations _parser - +Modules/clinic/itertoolsmodule.c.h itertools_combinations_with_replacement _parser - +Modules/clinic/itertoolsmodule.c.h itertools_permutations _parser - +Modules/clinic/itertoolsmodule.c.h itertools_accumulate _parser - +Modules/clinic/itertoolsmodule.c.h itertools_compress _parser - +Modules/clinic/itertoolsmodule.c.h itertools_count _parser - +Modules/clinic/binascii.c.h binascii_b2a_uu _parser - +Modules/clinic/binascii.c.h binascii_b2a_base64 _parser - +Modules/clinic/binascii.c.h binascii_b2a_hex _parser - +Modules/clinic/binascii.c.h binascii_hexlify _parser - +Modules/clinic/binascii.c.h binascii_a2b_qp _parser - +Modules/clinic/binascii.c.h binascii_b2a_qp _parser - +Objects/clinic/enumobject.c.h enum_new _parser - +Objects/clinic/bytearrayobject.c.h bytearray___init__ _parser - +Objects/clinic/bytearrayobject.c.h bytearray_translate _parser - +Objects/clinic/bytearrayobject.c.h bytearray_split _parser - +Objects/clinic/bytearrayobject.c.h bytearray_rsplit _parser - +Objects/clinic/bytearrayobject.c.h bytearray_decode _parser - +Objects/clinic/bytearrayobject.c.h bytearray_splitlines _parser - +Objects/clinic/bytearrayobject.c.h bytearray_hex _parser - +Objects/clinic/descrobject.c.h mappingproxy_new _parser - +Objects/clinic/descrobject.c.h property_init _parser - +Objects/clinic/longobject.c.h long_new _parser - +Objects/clinic/longobject.c.h int_to_bytes _parser - +Objects/clinic/longobject.c.h int_from_bytes _parser - +Objects/clinic/moduleobject.c.h module___init__ _parser - +Objects/clinic/structseq.c.h structseq_new _parser - +Objects/clinic/memoryobject.c.h memoryview _parser - +Objects/clinic/memoryobject.c.h memoryview_cast _parser - +Objects/clinic/memoryobject.c.h memoryview_tobytes _parser - +Objects/clinic/memoryobject.c.h memoryview_hex _parser - +Objects/clinic/listobject.c.h list_sort _parser - +Objects/clinic/odictobject.c.h OrderedDict_fromkeys _parser - +Objects/clinic/odictobject.c.h OrderedDict_setdefault _parser - +Objects/clinic/odictobject.c.h OrderedDict_pop _parser - +Objects/clinic/odictobject.c.h OrderedDict_popitem _parser - +Objects/clinic/odictobject.c.h OrderedDict_move_to_end _parser - +Objects/clinic/complexobject.c.h complex_new _parser - +Objects/clinic/unicodeobject.c.h unicode_encode _parser - +Objects/clinic/unicodeobject.c.h unicode_expandtabs _parser - +Objects/clinic/unicodeobject.c.h unicode_split _parser - +Objects/clinic/unicodeobject.c.h unicode_rsplit _parser - +Objects/clinic/unicodeobject.c.h unicode_splitlines _parser - +Objects/clinic/unicodeobject.c.h unicode_new _parser - +Objects/clinic/bytesobject.c.h bytes_split _parser - +Objects/clinic/bytesobject.c.h bytes_rsplit _parser - +Objects/clinic/bytesobject.c.h bytes_translate _parser - +Objects/clinic/bytesobject.c.h bytes_decode _parser - +Objects/clinic/bytesobject.c.h bytes_splitlines _parser - +Objects/clinic/bytesobject.c.h bytes_hex _parser - +Objects/clinic/bytesobject.c.h bytes_new _parser - +Objects/clinic/funcobject.c.h func_new _parser - +Objects/clinic/codeobject.c.h code_replace _parser - +Python/clinic/traceback.c.h tb_new _parser - +Python/clinic/bltinmodule.c.h builtin_compile _parser - +Python/clinic/bltinmodule.c.h builtin_pow _parser - +Python/clinic/bltinmodule.c.h builtin_round _parser - +Python/clinic/bltinmodule.c.h builtin_sum _parser - +Python/clinic/import.c.h _imp_source_hash _parser - +Python/clinic/sysmodule.c.h sys_addaudithook _parser - +Python/clinic/sysmodule.c.h sys_set_coroutine_origin_tracking_depth _parser - +Python/clinic/_warnings.c.h warnings_warn _parser - + +#----------------------- +# other vars that are actually constant +# [] + +Modules/_csv.c - quote_styles - +Modules/_ctypes/cfield.c - ffi_type_void - +Modules/_ctypes/cfield.c - ffi_type_uint8 - +Modules/_ctypes/cfield.c - ffi_type_sint8 - +Modules/_ctypes/cfield.c - ffi_type_uint16 - +Modules/_ctypes/cfield.c - ffi_type_sint16 - +Modules/_ctypes/cfield.c - ffi_type_uint32 - +Modules/_ctypes/cfield.c - ffi_type_sint32 - +Modules/_ctypes/cfield.c - ffi_type_uint64 - +Modules/_ctypes/cfield.c - ffi_type_sint64 - +Modules/_ctypes/cfield.c - ffi_type_float - +Modules/_ctypes/cfield.c - ffi_type_double - +Modules/_ctypes/cfield.c - ffi_type_longdouble - +Modules/_ctypes/cfield.c - ffi_type_pointer - +Modules/_datetimemodule.c - epoch - +Modules/_datetimemodule.c - max_fold_seconds - +Modules/_datetimemodule.c datetime_isoformat specs - +Modules/_datetimemodule.c time_isoformat specs - +Modules/_decimal/_decimal.c - cond_map - +Modules/_decimal/_decimal.c - dec_signal_string - +Modules/_decimal/_decimal.c - dflt_ctx - +Modules/_decimal/_decimal.c - int_constants - +Modules/_decimal/_decimal.c - invalid_rounding_err - +Modules/_decimal/_decimal.c - invalid_signals_err - +Modules/_decimal/_decimal.c - signal_map - +Modules/_decimal/_decimal.c - ssize_constants - +Modules/_elementtree.c - ExpatMemoryHandler - +Modules/_io/textio.c - encodefuncs - +Modules/_localemodule.c - langinfo_constants - +Modules/_sre.c pattern_repr flag_names - +Modules/_struct.c - bigendian_table - +Modules/_struct.c - lilendian_table - +Modules/_tkinter.c - state_key - +Modules/_xxsubinterpretersmodule.c - _channelid_end_send - +Modules/_xxsubinterpretersmodule.c - _channelid_end_recv - +Modules/arraymodule.c - descriptors - +Modules/arraymodule.c - emptybuf - +Modules/cjkcodecs/cjkcodecs.h - __methods - +Modules/cmathmodule.c - acos_special_values - +Modules/cmathmodule.c - acosh_special_values - +Modules/cmathmodule.c - asinh_special_values - +Modules/cmathmodule.c - atanh_special_values - +Modules/cmathmodule.c - cosh_special_values - +Modules/cmathmodule.c - exp_special_values - +Modules/cmathmodule.c - log_special_values - +Modules/cmathmodule.c - sinh_special_values - +Modules/cmathmodule.c - sqrt_special_values - +Modules/cmathmodule.c - tanh_special_values - +Modules/cmathmodule.c - rect_special_values - +Modules/config.c - _PyImport_Inittab - +Modules/faulthandler.c - faulthandler_handlers - +Modules/getnameinfo.c - gni_afdl - +Modules/ossaudiodev.c - control_labels - +Modules/ossaudiodev.c - control_names - +Modules/nismodule.c - aliases - +Modules/nismodule.c - TIMEOUT - +Modules/posixmodule.c - posix_constants_pathconf - +Modules/posixmodule.c - posix_constants_confstr - +Modules/posixmodule.c - posix_constants_sysconf - +Modules/pyexpat.c - ExpatMemoryHandler - +Modules/pyexpat.c - handler_info - +Modules/termios.c - termios_constants - +Modules/timemodule.c init_timezone YEAR - +Objects/bytearrayobject.c - _PyByteArray_empty_string - +Objects/complexobject.c - c_1 - +Objects/genobject.c - NON_INIT_CORO_MSG - +Objects/genobject.c - ASYNC_GEN_IGNORED_EXIT_MSG - +Objects/longobject.c - _PyLong_DigitValue - +Objects/object.c - _Py_abstract_hack - +Objects/object.c - _Py_SwappedOp - +Objects/obmalloc.c - _PyMem - +Objects/obmalloc.c - _PyMem_Debug - +Objects/obmalloc.c - _PyMem_Raw - +Objects/obmalloc.c - _PyObject - +Objects/obmalloc.c - usedpools - +Objects/unicodeobject.c unicode_decode_call_errorhandler_wchar argparse - +Objects/unicodeobject.c unicode_decode_call_errorhandler_writer argparse - +Objects/unicodeobject.c unicode_encode_call_errorhandler argparse - +Objects/unicodeobject.c unicode_translate_call_errorhandler argparse - +Objects/unicodeobject.c - stripfuncnames - +Objects/unicodeobject.c - utf7_category - +Parser/parser.c - reserved_keywords - +Parser/tokenizer.c - type_comment_prefix - +Python/opcode_targets.h - opcode_targets - + + +################################## +# temporary whitelist - globals to fix + +# These are all variables that we will be making non-global. + +#----------------------- +# runtime static types +# [] + +Objects/floatobject.c - FloatInfoType - +Objects/floatobject.c - PyFloat_Type - +Objects/listobject.c - PyList_Type - +Objects/listobject.c - PyListIter_Type - +Objects/listobject.c - PyListRevIter_Type - +Objects/setobject.c - _PySetDummy_Type - +Objects/setobject.c - PySetIter_Type - +Objects/setobject.c - PySet_Type - +Objects/setobject.c - PyFrozenSet_Type - +Objects/genobject.c - PyGen_Type - +Objects/genobject.c - PyCoro_Type - +Objects/genobject.c - _PyCoroWrapper_Type - +Objects/genobject.c - PyAsyncGen_Type - +Objects/genobject.c - _PyAsyncGenASend_Type - +Objects/genobject.c - _PyAsyncGenWrappedValue_Type - +Objects/genobject.c - _PyAsyncGenAThrow_Type - +Objects/classobject.c - PyMethod_Type - +Objects/classobject.c - PyInstanceMethod_Type - +Objects/complexobject.c - PyComplex_Type - +Objects/sliceobject.c - PyEllipsis_Type - +Objects/sliceobject.c - PySlice_Type - +Objects/bytesobject.c - PyBytes_Type - +Objects/bytesobject.c - PyBytesIter_Type - +Objects/descrobject.c - PyMethodDescr_Type - +Objects/descrobject.c - PyClassMethodDescr_Type - +Objects/descrobject.c - PyMemberDescr_Type - +Objects/descrobject.c - PyGetSetDescr_Type - +Objects/descrobject.c - PyWrapperDescr_Type - +Objects/descrobject.c - _PyMethodWrapper_Type - +Objects/descrobject.c - PyDictProxy_Type - +Objects/descrobject.c - PyProperty_Type - +Objects/unicodeobject.c - EncodingMapType - +Objects/unicodeobject.c - PyUnicode_Type - +Objects/unicodeobject.c - PyUnicodeIter_Type - +Objects/unionobject.c - _Py_UnionType - +Objects/moduleobject.c - PyModuleDef_Type - +Objects/moduleobject.c - PyModule_Type - +Objects/capsule.c - PyCapsule_Type - +Objects/methodobject.c - PyCFunction_Type - +Objects/methodobject.c - PyCMethod_Type - +Objects/bytearrayobject.c - PyByteArray_Type - +Objects/bytearrayobject.c - PyByteArrayIter_Type - +Objects/interpreteridobject.c - _PyInterpreterID_Type - +Objects/enumobject.c - PyEnum_Type - +Objects/enumobject.c - PyReversed_Type - +Objects/picklebufobject.c - PyPickleBuffer_Type - +Objects/object.c - _PyNone_Type - +Objects/object.c - _PyNotImplemented_Type - +Objects/fileobject.c - PyStdPrinter_Type - +Objects/weakrefobject.c - _PyWeakref_RefType - +Objects/weakrefobject.c - _PyWeakref_ProxyType - +Objects/weakrefobject.c - _PyWeakref_CallableProxyType - +Objects/genericaliasobject.c - Py_GenericAliasType - +Objects/rangeobject.c - PyRange_Type - +Objects/rangeobject.c - PyRangeIter_Type - +Objects/rangeobject.c - PyLongRangeIter_Type - +Objects/namespaceobject.c - _PyNamespace_Type - +Objects/iterobject.c - PySeqIter_Type - +Objects/iterobject.c - PyCallIter_Type - +Objects/boolobject.c - PyBool_Type - +Objects/frameobject.c - PyFrame_Type - +Objects/longobject.c - Int_InfoType - +Objects/longobject.c - PyLong_Type - +Objects/funcobject.c - PyFunction_Type - +Objects/funcobject.c - PyClassMethod_Type - +Objects/funcobject.c - PyStaticMethod_Type - +Objects/typeobject.c - PyType_Type - +Objects/typeobject.c - PyBaseObject_Type - +Objects/typeobject.c - PySuper_Type - +Objects/cellobject.c - PyCell_Type - +Objects/odictobject.c - PyODict_Type - +Objects/odictobject.c - PyODictIter_Type - +Objects/odictobject.c - PyODictKeys_Type - +Objects/odictobject.c - PyODictItems_Type - +Objects/odictobject.c - PyODictValues_Type - +Objects/dictobject.c - PyDict_Type - +Objects/dictobject.c - PyDictIterKey_Type - +Objects/dictobject.c - PyDictIterValue_Type - +Objects/dictobject.c - PyDictIterItem_Type - +Objects/dictobject.c - PyDictRevIterKey_Type - +Objects/dictobject.c - PyDictRevIterItem_Type - +Objects/dictobject.c - PyDictRevIterValue_Type - +Objects/dictobject.c - PyDictKeys_Type - +Objects/dictobject.c - PyDictItems_Type - +Objects/dictobject.c - PyDictValues_Type - +Objects/memoryobject.c - PyMemoryIter_Type - +Objects/memoryobject.c - _PyManagedBuffer_Type - +Objects/memoryobject.c - PyMemoryView_Type - +Objects/tupleobject.c - PyTuple_Type - +Objects/tupleobject.c - PyTupleIter_Type - +Objects/codeobject.c - PyCode_Type - + +#----------------------- +# builtin exception types +# [] + +Objects/exceptions.c - _PyExc_BaseException - +Objects/exceptions.c - _PyExc_UnicodeEncodeError - +Objects/exceptions.c - _PyExc_UnicodeDecodeError - +Objects/exceptions.c - _PyExc_UnicodeTranslateError - +Objects/exceptions.c - _PyExc_MemoryError - +Objects/exceptions.c - _PyExc_Exception - +Objects/exceptions.c - _PyExc_TypeError - +Objects/exceptions.c - _PyExc_StopAsyncIteration - +Objects/exceptions.c - _PyExc_StopIteration - +Objects/exceptions.c - _PyExc_GeneratorExit - +Objects/exceptions.c - _PyExc_SystemExit - +Objects/exceptions.c - _PyExc_KeyboardInterrupt - +Objects/exceptions.c - _PyExc_ImportError - +Objects/exceptions.c - _PyExc_ModuleNotFoundError - +Objects/exceptions.c - _PyExc_OSError - +Objects/exceptions.c - _PyExc_BlockingIOError - +Objects/exceptions.c - _PyExc_ConnectionError - +Objects/exceptions.c - _PyExc_ChildProcessError - +Objects/exceptions.c - _PyExc_BrokenPipeError - +Objects/exceptions.c - _PyExc_ConnectionAbortedError - +Objects/exceptions.c - _PyExc_ConnectionRefusedError - +Objects/exceptions.c - _PyExc_ConnectionResetError - +Objects/exceptions.c - _PyExc_FileExistsError - +Objects/exceptions.c - _PyExc_FileNotFoundError - +Objects/exceptions.c - _PyExc_IsADirectoryError - +Objects/exceptions.c - _PyExc_NotADirectoryError - +Objects/exceptions.c - _PyExc_InterruptedError - +Objects/exceptions.c - _PyExc_PermissionError - +Objects/exceptions.c - _PyExc_ProcessLookupError - +Objects/exceptions.c - _PyExc_TimeoutError - +Objects/exceptions.c - _PyExc_EOFError - +Objects/exceptions.c - _PyExc_RuntimeError - +Objects/exceptions.c - _PyExc_RecursionError - +Objects/exceptions.c - _PyExc_NotImplementedError - +Objects/exceptions.c - _PyExc_NameError - +Objects/exceptions.c - _PyExc_UnboundLocalError - +Objects/exceptions.c - _PyExc_AttributeError - +Objects/exceptions.c - _PyExc_SyntaxError - +Objects/exceptions.c - _PyExc_IndentationError - +Objects/exceptions.c - _PyExc_TabError - +Objects/exceptions.c - _PyExc_LookupError - +Objects/exceptions.c - _PyExc_IndexError - +Objects/exceptions.c - _PyExc_KeyError - +Objects/exceptions.c - _PyExc_ValueError - +Objects/exceptions.c - _PyExc_UnicodeError - +Objects/exceptions.c - _PyExc_AssertionError - +Objects/exceptions.c - _PyExc_ArithmeticError - +Objects/exceptions.c - _PyExc_FloatingPointError - +Objects/exceptions.c - _PyExc_OverflowError - +Objects/exceptions.c - _PyExc_ZeroDivisionError - +Objects/exceptions.c - _PyExc_SystemError - +Objects/exceptions.c - _PyExc_ReferenceError - +Objects/exceptions.c - _PyExc_BufferError - +Objects/exceptions.c - _PyExc_Warning - +Objects/exceptions.c - _PyExc_UserWarning - +Objects/exceptions.c - _PyExc_DeprecationWarning - +Objects/exceptions.c - _PyExc_PendingDeprecationWarning - +Objects/exceptions.c - _PyExc_SyntaxWarning - +Objects/exceptions.c - _PyExc_RuntimeWarning - +Objects/exceptions.c - _PyExc_FutureWarning - +Objects/exceptions.c - _PyExc_ImportWarning - +Objects/exceptions.c - _PyExc_UnicodeWarning - +Objects/exceptions.c - _PyExc_BytesWarning - +Objects/exceptions.c - _PyExc_ResourceWarning - +Objects/exceptions.c - PyExc_EnvironmentError - +Objects/exceptions.c - PyExc_IOError - +Objects/exceptions.c - PyExc_BaseException - +Objects/exceptions.c - PyExc_Exception - +Objects/exceptions.c - PyExc_TypeError - +Objects/exceptions.c - PyExc_StopAsyncIteration - +Objects/exceptions.c - PyExc_StopIteration - +Objects/exceptions.c - PyExc_GeneratorExit - +Objects/exceptions.c - PyExc_SystemExit - +Objects/exceptions.c - PyExc_KeyboardInterrupt - +Objects/exceptions.c - PyExc_ImportError - +Objects/exceptions.c - PyExc_ModuleNotFoundError - +Objects/exceptions.c - PyExc_OSError - +Objects/exceptions.c - PyExc_BlockingIOError - +Objects/exceptions.c - PyExc_ConnectionError - +Objects/exceptions.c - PyExc_ChildProcessError - +Objects/exceptions.c - PyExc_BrokenPipeError - +Objects/exceptions.c - PyExc_ConnectionAbortedError - +Objects/exceptions.c - PyExc_ConnectionRefusedError - +Objects/exceptions.c - PyExc_ConnectionResetError - +Objects/exceptions.c - PyExc_FileExistsError - +Objects/exceptions.c - PyExc_FileNotFoundError - +Objects/exceptions.c - PyExc_IsADirectoryError - +Objects/exceptions.c - PyExc_NotADirectoryError - +Objects/exceptions.c - PyExc_InterruptedError - +Objects/exceptions.c - PyExc_PermissionError - +Objects/exceptions.c - PyExc_ProcessLookupError - +Objects/exceptions.c - PyExc_TimeoutError - +Objects/exceptions.c - PyExc_EOFError - +Objects/exceptions.c - PyExc_RuntimeError - +Objects/exceptions.c - PyExc_RecursionError - +Objects/exceptions.c - PyExc_NotImplementedError - +Objects/exceptions.c - PyExc_NameError - +Objects/exceptions.c - PyExc_UnboundLocalError - +Objects/exceptions.c - PyExc_AttributeError - +Objects/exceptions.c - PyExc_SyntaxError - +Objects/exceptions.c - PyExc_IndentationError - +Objects/exceptions.c - PyExc_TabError - +Objects/exceptions.c - PyExc_LookupError - +Objects/exceptions.c - PyExc_IndexError - +Objects/exceptions.c - PyExc_KeyError - +Objects/exceptions.c - PyExc_ValueError - +Objects/exceptions.c - PyExc_UnicodeError - +Objects/exceptions.c - PyExc_UnicodeEncodeError - +Objects/exceptions.c - PyExc_UnicodeDecodeError - +Objects/exceptions.c - PyExc_UnicodeTranslateError - +Objects/exceptions.c - PyExc_AssertionError - +Objects/exceptions.c - PyExc_ArithmeticError - +Objects/exceptions.c - PyExc_FloatingPointError - +Objects/exceptions.c - PyExc_OverflowError - +Objects/exceptions.c - PyExc_ZeroDivisionError - +Objects/exceptions.c - PyExc_SystemError - +Objects/exceptions.c - PyExc_ReferenceError - +Objects/exceptions.c - PyExc_MemoryError - +Objects/exceptions.c - PyExc_BufferError - +Objects/exceptions.c - PyExc_Warning - +Objects/exceptions.c - PyExc_UserWarning - +Objects/exceptions.c - PyExc_DeprecationWarning - +Objects/exceptions.c - PyExc_PendingDeprecationWarning - +Objects/exceptions.c - PyExc_SyntaxWarning - +Objects/exceptions.c - PyExc_RuntimeWarning - +Objects/exceptions.c - PyExc_FutureWarning - +Objects/exceptions.c - PyExc_ImportWarning - +Objects/exceptions.c - PyExc_UnicodeWarning - +Objects/exceptions.c - PyExc_BytesWarning - +Objects/exceptions.c - PyExc_ResourceWarning - + +#----------------------- +# singletons +# [] + +Objects/boolobject.c - _Py_FalseStruct - +Objects/boolobject.c - _Py_TrueStruct - +Objects/dictobject.c - empty_keys_struct - +Objects/dictobject.c - empty_values - +Objects/object.c - _Py_NoneStruct - +Objects/object.c - _Py_NotImplementedStruct - +Objects/setobject.c - _dummy_struct - +Objects/setobject.c - _PySet_Dummy - +Objects/sliceobject.c - _Py_EllipsisObject - + +#----------------------- +# runtime initialized once - cached PyUnicode +# [] + +# Py_IDENTIFIER (global) [] +Objects/classobject.c - PyId___name__ - +Objects/classobject.c - PyId___qualname__ - +Objects/structseq.c - PyId_n_sequence_fields - +Objects/structseq.c - PyId_n_fields - +Objects/structseq.c - PyId_n_unnamed_fields - +Objects/bytesobject.c - PyId___bytes__ - +Objects/descrobject.c - PyId_getattr - +Objects/moduleobject.c - PyId___doc__ - +Objects/moduleobject.c - PyId___name__ - +Objects/moduleobject.c - PyId___spec__ - +Objects/object.c - PyId_Py_Repr - +Objects/object.c - PyId___bytes__ - +Objects/object.c - PyId___dir__ - +Objects/object.c - PyId___isabstractmethod__ - +Objects/fileobject.c - PyId_open - +Objects/rangeobject.c - PyId_iter - +Objects/iterobject.c - PyId_iter - +Objects/frameobject.c - PyId___builtins__ - +Objects/longobject.c - PyId_little - +Objects/longobject.c - PyId_big - +Objects/typeobject.c - PyId___abstractmethods__ - +Objects/typeobject.c - PyId___class__ - +Objects/typeobject.c - PyId___class_getitem__ - +Objects/typeobject.c - PyId___delitem__ - +Objects/typeobject.c - PyId___dict__ - +Objects/typeobject.c - PyId___doc__ - +Objects/typeobject.c - PyId___getattribute__ - +Objects/typeobject.c - PyId___getitem__ - +Objects/typeobject.c - PyId___hash__ - +Objects/typeobject.c - PyId___init_subclass__ - +Objects/typeobject.c - PyId___len__ - +Objects/typeobject.c - PyId___module__ - +Objects/typeobject.c - PyId___name__ - +Objects/typeobject.c - PyId___new__ - +Objects/typeobject.c - PyId___set_name__ - +Objects/typeobject.c - PyId___setitem__ - +Objects/typeobject.c - PyId_builtins - +Objects/typeobject.c - PyId_mro - +Objects/odictobject.c - PyId_items - + +# Py_IDENTIFIER (local) [] +Objects/listobject.c listiter_reduce_general PyId_iter - +Objects/listobject.c listiter_reduce_general PyId_reversed - +Objects/setobject.c setiter_reduce PyId_iter - +Objects/setobject.c set_reduce PyId___dict__ - +Objects/abstract.c PyObject_LengthHint PyId___length_hint__ - +Objects/abstract.c PyObject_GetItem PyId___class_getitem__ - +Objects/abstract.c PyObject_Format PyId___format__ - +Objects/abstract.c PyNumber_Long PyId___trunc__ - +Objects/abstract.c PyMapping_Keys PyId_keys - +Objects/abstract.c PyMapping_Items PyId_items - +Objects/abstract.c PyMapping_Values PyId_values - +Objects/abstract.c abstract_get_bases PyId___bases__ - +Objects/abstract.c object_isinstance PyId___class__ - +Objects/abstract.c object_recursive_isinstance PyId___instancecheck__ - +Objects/abstract.c object_issubclass PyId___subclasscheck__ - +Objects/genobject.c PyIter_Send PyId_send - +Objects/genobject.c gen_close_iter PyId_close - +Objects/genobject.c _gen_throw PyId_throw - +Objects/classobject.c method_reduce PyId_getattr - +Objects/complexobject.c try_complex_special_method PyId___complex__ - +Objects/bytesobject.c striter_reduce PyId_iter - +Objects/descrobject.c calculate_qualname PyId___qualname__ - +Objects/descrobject.c mappingproxy_get PyId_get - +Objects/descrobject.c mappingproxy_keys PyId_keys - +Objects/descrobject.c mappingproxy_values PyId_values - +Objects/descrobject.c mappingproxy_items PyId_items - +Objects/descrobject.c mappingproxy_copy PyId_copy - +Objects/descrobject.c mappingproxy_reversed PyId___reversed__ - +Objects/descrobject.c property_init_impl PyId___doc__ - +Objects/unicodeobject.c unicodeiter_reduce PyId_iter - +Objects/unionobject.c union_repr_item PyId___module__ - +Objects/unionobject.c union_repr_item PyId___qualname__ - +Objects/unionobject.c union_repr_item PyId___origin__ - +Objects/unionobject.c union_repr_item PyId___args__ - +Objects/moduleobject.c module_init_dict PyId___package__ - +Objects/moduleobject.c module_init_dict PyId___loader__ - +Objects/moduleobject.c PyModule_GetFilenameObject PyId___file__ - +Objects/moduleobject.c _PyModuleSpec_IsInitializing PyId__initializing - +Objects/moduleobject.c module_getattro PyId___getattr__ - +Objects/moduleobject.c module_dir PyId___dict__ - +Objects/moduleobject.c module_dir PyId___dir__ - +Objects/methodobject.c meth_reduce PyId_getattr - +Objects/methodobject.c meth_get__qualname__ PyId___qualname__ - +Objects/bytearrayobject.c _common_reduce PyId___dict__ - +Objects/bytearrayobject.c bytearrayiter_reduce PyId_iter - +Objects/enumobject.c reversed_new_impl PyId___reversed__ - +Objects/object.c _PyObject_FunctionStr PyId___module__ - +Objects/object.c _PyObject_FunctionStr PyId___qualname__ - +Objects/object.c _PyObject_FunctionStr PyId_builtins - +Objects/fileobject.c PyFile_GetLine PyId_readline - +Objects/fileobject.c PyFile_WriteObject PyId_write - +Objects/fileobject.c PyObject_AsFileDescriptor PyId_fileno - +Objects/weakrefobject.c weakref_repr PyId___name__ - +Objects/weakrefobject.c proxy_bytes PyId___bytes__ - +Objects/weakrefobject.c proxy_reversed PyId___reversed__ - +Objects/genericaliasobject.c ga_repr_item PyId___module__ - +Objects/genericaliasobject.c ga_repr_item PyId___qualname__ - +Objects/genericaliasobject.c ga_repr_item PyId___origin__ - +Objects/genericaliasobject.c ga_repr_item PyId___args__ - +Objects/genericaliasobject.c make_parameters PyId___parameters__ - +Objects/genericaliasobject.c subs_tvars PyId___parameters__ - +Objects/exceptions.c ImportError_getstate PyId_name - +Objects/exceptions.c ImportError_getstate PyId_path - +Objects/typeobject.c type_new PyId___qualname__ - +Objects/typeobject.c type_new PyId___slots__ - +Objects/typeobject.c type_new PyId___classcell__ - +Objects/typeobject.c type_new PyId___mro_entries__ - +Objects/typeobject.c merge_class_dict PyId___bases__ - +Objects/typeobject.c import_copyreg PyId_copyreg - +Objects/typeobject.c _PyType_GetSlotNames PyId___slotnames__ - +Objects/typeobject.c _PyType_GetSlotNames PyId__slotnames - +Objects/typeobject.c _PyObject_GetState PyId___getstate__ - +Objects/typeobject.c _PyObject_GetNewArguments PyId___getnewargs_ex__ - +Objects/typeobject.c _PyObject_GetNewArguments PyId___getnewargs__ - +Objects/typeobject.c _PyObject_GetItemsIter PyId_items - +Objects/typeobject.c reduce_newobj PyId___newobj__ - +Objects/typeobject.c reduce_newobj PyId___newobj_ex__ - +Objects/typeobject.c object___reduce_ex___impl PyId___reduce__ - +Objects/typeobject.c overrides_hash PyId___eq__ - +Objects/typeobject.c slot_sq_contains PyId___contains__ - +Objects/typeobject.c slot_nb_power PyId___pow__ - +Objects/typeobject.c slot_nb_bool PyId___bool__ - +Objects/typeobject.c slot_nb_index PyId___index__ - +Objects/typeobject.c slot_nb_inplace_power PyId___ipow__ - +Objects/typeobject.c slot_tp_repr PyId___repr__ - +Objects/typeobject.c slot_tp_call PyId___call__ - +Objects/typeobject.c slot_tp_getattr_hook PyId___getattr__ - +Objects/typeobject.c slot_tp_setattro PyId___delattr__ - +Objects/typeobject.c slot_tp_setattro PyId___setattr__ - +Objects/typeobject.c slot_tp_iter PyId___iter__ - +Objects/typeobject.c slot_tp_iternext PyId___next__ - +Objects/typeobject.c slot_tp_descr_get PyId___get__ - +Objects/typeobject.c slot_tp_descr_set PyId___delete__ - +Objects/typeobject.c slot_tp_descr_set PyId___set__ - +Objects/typeobject.c slot_tp_init PyId___init__ - +Objects/typeobject.c slot_tp_finalize PyId___del__ - +Objects/typeobject.c slot_am_await PyId___await__ - +Objects/typeobject.c slot_am_aiter PyId___aiter__ - +Objects/typeobject.c slot_am_anext PyId___anext__ - +Objects/odictobject.c odict_reduce PyId___dict__ - +Objects/odictobject.c odictiter_reduce PyId_iter - +Objects/odictobject.c mutablemapping_update_arg PyId_keys - +Objects/dictobject.c dict_subscript PyId___missing__ - +Objects/dictobject.c dict_update_arg PyId_keys - +Objects/dictobject.c dictiter_reduce PyId_iter - +Objects/dictobject.c dictviews_sub PyId_difference_update - +Objects/dictobject.c _PyDictView_Intersect PyId_intersection - +Objects/dictobject.c dictitems_xor PyId_items - +Objects/dictobject.c dictviews_xor PyId_symmetric_difference_update - +Objects/tupleobject.c tupleiter_reduce PyId_iter - +Parser/tokenizer.c fp_setreadl PyId_open - +Parser/tokenizer.c fp_setreadl PyId_readline - + +# _Py_static_string [] +Objects/typeobject.c - name_op - +Objects/typeobject.c object_new comma_id - +Objects/typeobject.c slot_mp_subscript id - +Objects/typeobject.c slot_nb_add op_id - +Objects/typeobject.c slot_nb_add rop_id - +Objects/typeobject.c slot_nb_subtract op_id - +Objects/typeobject.c slot_nb_subtract rop_id - +Objects/typeobject.c slot_nb_multiply op_id - +Objects/typeobject.c slot_nb_multiply rop_id - +Objects/typeobject.c slot_nb_matrix_multiply op_id - +Objects/typeobject.c slot_nb_matrix_multiply rop_id - +Objects/typeobject.c slot_nb_remainder op_id - +Objects/typeobject.c slot_nb_remainder rop_id - +Objects/typeobject.c slot_nb_divmod op_id - +Objects/typeobject.c slot_nb_divmod rop_id - +Objects/typeobject.c slot_nb_power_binary op_id - +Objects/typeobject.c slot_nb_power_binary rop_id - +Objects/typeobject.c slot_nb_negative id - +Objects/typeobject.c slot_nb_positive id - +Objects/typeobject.c slot_nb_absolute id - +Objects/typeobject.c slot_nb_invert id - +Objects/typeobject.c slot_nb_lshift op_id - +Objects/typeobject.c slot_nb_lshift rop_id - +Objects/typeobject.c slot_nb_rshift op_id - +Objects/typeobject.c slot_nb_rshift rop_id - +Objects/typeobject.c slot_nb_and op_id - +Objects/typeobject.c slot_nb_and rop_id - +Objects/typeobject.c slot_nb_xor op_id - +Objects/typeobject.c slot_nb_xor rop_id - +Objects/typeobject.c slot_nb_or op_id - +Objects/typeobject.c slot_nb_or rop_id - +Objects/typeobject.c slot_nb_int id - +Objects/typeobject.c slot_nb_float id - +Objects/typeobject.c slot_nb_inplace_add id - +Objects/typeobject.c slot_nb_inplace_subtract id - +Objects/typeobject.c slot_nb_inplace_multiply id - +Objects/typeobject.c slot_nb_inplace_matrix_multiply id - +Objects/typeobject.c slot_nb_inplace_remainder id - +Objects/typeobject.c slot_nb_inplace_lshift id - +Objects/typeobject.c slot_nb_inplace_rshift id - +Objects/typeobject.c slot_nb_inplace_and id - +Objects/typeobject.c slot_nb_inplace_xor id - +Objects/typeobject.c slot_nb_inplace_or id - +Objects/typeobject.c slot_nb_floor_divide op_id - +Objects/typeobject.c slot_nb_floor_divide rop_id - +Objects/typeobject.c slot_nb_true_divide op_id - +Objects/typeobject.c slot_nb_true_divide rop_id - +Objects/typeobject.c slot_nb_inplace_floor_divide id - +Objects/typeobject.c slot_nb_inplace_true_divide id - +Objects/typeobject.c slot_tp_str id - +Python/compile.c compiler_set_qualname dot - +Python/compile.c compiler_set_qualname dot_locals - + +# manually cached PyUnicodeOjbect [] +Objects/boolobject.c - false_str - +Objects/boolobject.c - true_str - +Objects/classobject.c method_get_doc docstr - +Objects/classobject.c instancemethod_get_doc docstr - +Objects/codeobject.c PyCode_NewEmpty emptystring - +Objects/exceptions.c _check_for_legacy_statements print_prefix - +Objects/exceptions.c _check_for_legacy_statements exec_prefix - +Objects/funcobject.c PyFunction_NewWithQualName __name__ - +Objects/listobject.c - indexerr - +Objects/typeobject.c object___reduce_ex___impl objreduce - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_close_br - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_dbl_close_br - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_dbl_open_br - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_inf - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_open_br - +# XXX This should have been found by the analyzer but wasn't: +Python/ast_unparse.c - _str_replace_inf - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c - __annotations__ - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c - __doc__ - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_dictcomp name - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_from_import empty_string - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_genexp name - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_lambda name - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_listcomp name - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_setcomp name - +# XXX This should have been found by the analyzer but wasn't: +Python/compile.c compiler_visit_annotations return_str - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c PyImport_Import builtins_str - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c PyImport_Import import_str - +# XXX This should have been found by the analyzer but wasn't: +Python/sysmodule.c - whatstrings - +# XXX This should have been found by the analyzer but wasn't: +Python/sysmodule.c sys_displayhook newline - +# XXX This should have been found by the analyzer but wasn't: +Python/_warnings.c is_internal_frame bootstrap_string - +# XXX This should have been found by the analyzer but wasn't: +Python/_warnings.c is_internal_frame importlib_string - + +#----------------------- +# runtime initialized once - other PyObject +# [] + +# cache [] +Objects/unicodeobject.c - interned - +Objects/unicodeobject.c - static_strings - +Objects/typeobject.c - method_cache - + +# other [] +# XXX This should have been found by the analyzer but wasn't: +Python/context.c - _token_missing - +# XXX This should have been found by the analyzer but wasn't: +Python/hamt.c - _empty_bitmap_node - +# XXX This should have been found by the analyzer but wasn't: +Python/hamt.c - _empty_hamt - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c PyImport_Import silly_list - + +#----------------------- +# runtime initialized once - non-PyObject +# [] + +# during init [] +Parser/parser.c - Py_DebugFlag - + +# other [] +Objects/codeobject.c PyCode_NewEmpty nulltuple - +Objects/longobject.c PyLong_FromString log_base_BASE - +Objects/longobject.c PyLong_FromString convwidth_base - +Objects/longobject.c PyLong_FromString convmultmax_base - +Objects/typeobject.c - slotdefs - +Objects/typeobject.c - slotdefs_initialized - +Objects/unicodeobject.c - bloom_linebreak - +Objects/unicodeobject.c - ucnhash_capi - +Parser/pegen.c _PyPegen_dummy_name cache - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c - import_lock - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c import_find_and_load header - + +#----------------------- +# runtime state + +# (look at the bottome of the file) + +#----------------------- +# modules +# [119] + +Modules/pwdmodule.c - pwdmodule - +Modules/grpmodule.c - grpmodule - +Modules/_ssl.c - PySocketModule - +Modules/_ssl.c - _sslmodule - +Modules/_struct.c - _structmodule - +Modules/_sre.c - sremodule - +Modules/timemodule.c - timemodule - +Modules/xxmodule.c - xxmodule - +Modules/itertoolsmodule.c - itertoolsmodule - +Modules/_tkinter.c - _tkintermodule - +Modules/gcmodule.c - gcmodule - +Modules/mmapmodule.c - mmapmodule - +Modules/errnomodule.c - errnomodule - +Modules/_gdbmmodule.c - _gdbmmodule - +Modules/xxlimited.c - xxmodule - +Modules/arraymodule.c - arraymodule - +Modules/_uuidmodule.c - uuidmodule - +Modules/_collectionsmodule.c - _collectionsmodule - +Modules/_csv.c - _csvmodule - +Modules/_json.c - jsonmodule - +Modules/zlibmodule.c - zlibmodule - +Modules/readline.c - readlinemodule - +Modules/faulthandler.c - module_def - +Modules/_codecsmodule.c - codecsmodule - +Modules/_asynciomodule.c - _asynciomodule - +Modules/signalmodule.c - signalmodule - +Modules/binascii.c - binasciimodule - +Modules/mathmodule.c - mathmodule - +Modules/_stat.c - statmodule - +Modules/_opcode.c - opcodemodule - +Modules/_operator.c - operatormodule - +Modules/_cryptmodule.c - cryptmodule - +Modules/cmathmodule.c - cmathmodule - +Modules/_lzmamodule.c - _lzmamodule - +Modules/_zoneinfo.c - zoneinfomodule - +Modules/posixmodule.c - posixmodule - +Modules/_bz2module.c - _bz2module - +Modules/_functoolsmodule.c - _functools_module - +Modules/_abc.c - _abcmodule - +Modules/_heapqmodule.c - _heapqmodule - +Modules/_bisectmodule.c - _bisectmodule - +Modules/_tracemalloc.c - module_def - +Modules/pyexpat.c - pyexpatmodule - +Modules/_randommodule.c - _randommodule - +Modules/atexitmodule.c - atexitmodule - +Modules/syslogmodule.c - syslogmodule - +Modules/_queuemodule.c - queuemodule - +Modules/_threadmodule.c - threadmodule - +Modules/_weakref.c - weakrefmodule - +Modules/spwdmodule.c - spwdmodule - +Modules/_contextvarsmodule.c - _contextvarsmodule - +Modules/_posixsubprocess.c - _posixsubprocessmodule - +Modules/_xxsubinterpretersmodule.c - interpretersmodule - +Modules/_curses_panel.c - _curses_panelmodule - +Modules/audioop.c - audioopmodule - +Modules/nismodule.c - nismodule - +Modules/_elementtree.c - elementtreemodule - +Modules/sha256module.c - _sha256module - +Modules/resource.c - resourcemodule - +Modules/symtablemodule.c - symtablemodule - +Modules/sha1module.c - _sha1module - +Modules/selectmodule.c - selectmodule - +Modules/_pickle.c - _picklemodule - +Modules/_localemodule.c - _localemodule - +Modules/unicodedata.c - unicodedata_module - +Modules/_statisticsmodule.c - statisticsmodule - +Modules/termios.c - termiosmodule - +Modules/xxsubtype.c - xxsubtypemodule - +Modules/sha512module.c - _sha512module - +Modules/_cursesmodule.c - _cursesmodule - +Modules/md5module.c - _md5module - +Modules/socketmodule.c - socketmodule - +Modules/_datetimemodule.c - datetimemodule - +Modules/_hashopenssl.c - _hashlibmodule - +Modules/fcntlmodule.c - fcntlmodule - +Modules/ossaudiodev.c - ossaudiodevmodule - +Modules/_lsprof.c - _lsprofmodule - +Modules/_blake2/blake2module.c - blake2_module - +Modules/_multiprocessing/multiprocessing.c - multiprocessing_module - +Modules/_multiprocessing/posixshmem.c - this_module - +Modules/_sqlite/module.c - _sqlite3module - +Modules/_sha3/sha3module.c - _sha3module - +Modules/cjkcodecs/multibytecodec.c - _multibytecodecmodule - +Modules/_decimal/_decimal.c - _decimal_module - +Modules/_ctypes/_ctypes.c - _ctypesmodule - +Objects/unicodeobject.c - _string_module - +Modules/_io/_iomodule.h - _PyIO_Module - +Modules/_io/_iomodule.c - _PyIO_Module - + +#----------------------- +# module static types +# [] + +Modules/arraymodule.c - Arraytype - +Modules/arraymodule.c - PyArrayIter_Type - +Modules/_asynciomodule.c - FutureType - +Modules/_asynciomodule.c - FutureIterType - +Modules/_asynciomodule.c - TaskStepMethWrapper_Type - +Modules/_asynciomodule.c - TaskType - +Modules/_asynciomodule.c - PyRunningLoopHolder_Type - +Modules/cjkcodecs/multibytecodec.c - MultibyteCodec_Type - +Modules/cjkcodecs/multibytecodec.c - MultibyteIncrementalEncoder_Type - +Modules/cjkcodecs/multibytecodec.c - MultibyteIncrementalDecoder_Type - +Modules/cjkcodecs/multibytecodec.c - MultibyteStreamReader_Type - +Modules/cjkcodecs/multibytecodec.c - MultibyteStreamWriter_Type - +Modules/_collectionsmodule.c - deque_type - +Modules/_collectionsmodule.c - dequeiter_type - +Modules/_collectionsmodule.c - dequereviter_type - +Modules/_collectionsmodule.c - defdict_type - +Modules/_collectionsmodule.c - tuplegetter_type - +Modules/_csv.c - Dialect_Type - +Modules/_csv.c - Reader_Type - +Modules/_csv.c - Writer_Type - +Modules/_ctypes/callbacks.c - PyCThunk_Type - +Modules/_ctypes/callproc.c - PyCArg_Type - +Modules/_ctypes/cfield.c - PyCField_Type - +Modules/_ctypes/_ctypes.c - DictRemover_Type - +Modules/_ctypes/_ctypes.c - StructParam_Type - +Modules/_ctypes/_ctypes.c - PyCStructType_Type - +Modules/_ctypes/_ctypes.c - UnionType_Type - +Modules/_ctypes/_ctypes.c - PyCPointerType_Type - +Modules/_ctypes/_ctypes.c - PyCArrayType_Type - +Modules/_ctypes/_ctypes.c - PyCSimpleType_Type - +Modules/_ctypes/_ctypes.c - PyCFuncPtrType_Type - +Modules/_ctypes/_ctypes.c - PyCData_Type - +Modules/_ctypes/_ctypes.c - PyCFuncPtr_Type - +Modules/_ctypes/_ctypes.c - Struct_Type - +Modules/_ctypes/_ctypes.c - Union_Type - +Modules/_ctypes/_ctypes.c - PyCArray_Type - +Modules/_ctypes/_ctypes.c - Simple_Type - +Modules/_ctypes/_ctypes.c - PyCPointer_Type - +Modules/_ctypes/_ctypes.c - PyComError_Type - +Modules/_ctypes/stgdict.c - PyCStgDict_Type - +Modules/_cursesmodule.c - PyCursesWindow_Type - +Modules/_datetimemodule.c - PyDateTime_DeltaType - +Modules/_datetimemodule.c - PyDateTime_IsoCalendarDateType - +Modules/_datetimemodule.c - PyDateTime_DateType - +Modules/_datetimemodule.c - PyDateTime_TZInfoType - +Modules/_datetimemodule.c - PyDateTime_TimeZoneType - +Modules/_datetimemodule.c - PyDateTime_TimeType - +Modules/_datetimemodule.c - PyDateTime_DateTimeType - +Modules/_decimal/_decimal.c - PyDecSignalDictMixin_Type - +Modules/_decimal/_decimal.c - PyDecContextManager_Type - +Modules/_decimal/_decimal.c - PyDec_Type - +Modules/_decimal/_decimal.c - PyDecContext_Type - +Modules/_elementtree.c - ElementIter_Type - +Modules/_elementtree.c - Element_Type - +Modules/_elementtree.c - TreeBuilder_Type - +Modules/_elementtree.c - XMLParser_Type - +Modules/_functoolsmodule.c - partial_type - +Modules/_functoolsmodule.c - keyobject_type - +Modules/_functoolsmodule.c - lru_list_elem_type - +Modules/_functoolsmodule.c - lru_cache_type - +Modules/_io/bufferedio.c - PyBufferedIOBase_Type - +Modules/_io/bufferedio.c - PyBufferedReader_Type - +Modules/_io/bufferedio.c - PyBufferedWriter_Type - +Modules/_io/bufferedio.c - PyBufferedRWPair_Type - +Modules/_io/bufferedio.c - PyBufferedRandom_Type - +Modules/_io/bytesio.c - PyBytesIO_Type - +Modules/_io/bytesio.c - _PyBytesIOBuffer_Type - +Modules/_io/fileio.c - PyFileIO_Type - +Modules/_io/iobase.c - PyIOBase_Type - +Modules/_io/iobase.c - PyRawIOBase_Type - +Modules/_io/stringio.c - PyStringIO_Type - +Modules/_io/textio.c - PyTextIOBase_Type - +Modules/_io/textio.c - PyIncrementalNewlineDecoder_Type - +Modules/_io/textio.c - PyTextIOWrapper_Type - +Modules/_io/winconsoleio.c - PyWindowsConsoleIO_Type - +Modules/itertoolsmodule.c - groupby_type - +Modules/itertoolsmodule.c - _grouper_type - +Modules/itertoolsmodule.c - teedataobject_type - +Modules/itertoolsmodule.c - tee_type - +Modules/itertoolsmodule.c - cycle_type - +Modules/itertoolsmodule.c - dropwhile_type - +Modules/itertoolsmodule.c - takewhile_type - +Modules/itertoolsmodule.c - islice_type - +Modules/itertoolsmodule.c - starmap_type - +Modules/itertoolsmodule.c - chain_type - +Modules/itertoolsmodule.c - product_type - +Modules/itertoolsmodule.c - combinations_type - +Modules/itertoolsmodule.c - cwr_type - +Modules/itertoolsmodule.c - permutations_type - +Modules/itertoolsmodule.c - accumulate_type - +Modules/itertoolsmodule.c - compress_type - +Modules/itertoolsmodule.c - filterfalse_type - +Modules/itertoolsmodule.c - count_type - +Modules/itertoolsmodule.c - repeat_type - +Modules/itertoolsmodule.c - ziplongest_type - +Modules/mmapmodule.c - mmap_object_type - +Modules/_multiprocessing/semaphore.c - _PyMp_SemLockType - +Modules/ossaudiodev.c - OSSAudioType - +Modules/ossaudiodev.c - OSSMixerType - +Modules/_pickle.c - Pdata_Type - +Modules/_pickle.c - PicklerMemoProxyType - +Modules/_pickle.c - Pickler_Type - +Modules/_pickle.c - UnpicklerMemoProxyType - +Modules/_pickle.c - Unpickler_Type - +Modules/pyexpat.c - Xmlparsetype - +Modules/_queuemodule.c - PySimpleQueueType - +Modules/socketmodule.c - sock_type - +Modules/_sre.c - Pattern_Type - +Modules/_sre.c - Match_Type - +Modules/_sre.c - Scanner_Type - +Modules/_ssl.c - PySSLSocket_Type - +Modules/_ssl.c - PySSLContext_Type - +Modules/_ssl.c - PySSLMemoryBIO_Type - +Modules/_ssl.c - PySSLSession_Type - +Modules/_threadmodule.c - Locktype - +Modules/_threadmodule.c - RLocktype - +Modules/_threadmodule.c - localdummytype - +Modules/_threadmodule.c - localtype - +Modules/xxmodule.c - Xxo_Type - +Modules/xxmodule.c - Str_Type - +Modules/xxmodule.c - Null_Type - +Modules/_xxsubinterpretersmodule.c - ChannelIDtype - +Modules/xxsubtype.c - spamlist_type - +Modules/xxsubtype.c - spamdict_type - +Modules/_zoneinfo.c - PyZoneInfo_ZoneInfoType - + +#----------------------- +# module initialized once - non-static types +# [] + +# structseq types [6] +Modules/timemodule.c - StructTimeType - +Modules/signalmodule.c - SiginfoType - +Modules/_threadmodule.c - ExceptHookArgsType - +Modules/spwdmodule.c - StructSpwdType - +Modules/resource.c - StructRUsageType - +Modules/_cursesmodule.c - NcursesVersionType - + +# heap types [12] +Modules/_tkinter.c - Tkapp_Type - +Modules/_tkinter.c - PyTclObject_Type - +Modules/_tkinter.c - Tktt_Type - +Modules/xxlimited.c - Xxo_Type - +Modules/_decimal/_decimal.c - DecimalTuple - +Modules/_decimal/_decimal.c - PyDecSignalDict_Type - +Modules/_sqlite/connection.c - pysqlite_ConnectionType - +Modules/_sqlite/statement.c - pysqlite_StatementType - +Modules/_sqlite/cache.c - pysqlite_NodeType - +Modules/_sqlite/cache.c - pysqlite_CacheType - +Modules/_sqlite/row.c - pysqlite_RowType - +Modules/_sqlite/prepare_protocol.c - pysqlite_PrepareProtocolType - +Modules/_sqlite/cursor.c - pysqlite_CursorType - + +# exception types [] +Modules/_ctypes/_ctypes.c - PyExc_ArgError - +Modules/_cursesmodule.c - PyCursesError - +Modules/_decimal/_decimal.c - DecimalException - +Modules/_queuemodule.c - EmptyError - +Modules/_sqlite/module.h - pysqlite_Error - +Modules/_sqlite/module.h - pysqlite_Warning - +Modules/_sqlite/module.h - pysqlite_InterfaceError - +Modules/_sqlite/module.h - pysqlite_DatabaseError - +Modules/_sqlite/module.h - pysqlite_InternalError - +Modules/_sqlite/module.h - pysqlite_OperationalError - +Modules/_sqlite/module.h - pysqlite_ProgrammingError - +Modules/_sqlite/module.h - pysqlite_IntegrityError - +Modules/_sqlite/module.h - pysqlite_DataError - +Modules/_sqlite/module.h - pysqlite_NotSupportedError - +Modules/_ssl.c - PySSLErrorObject - +Modules/_ssl.c - PySSLCertVerificationErrorObject - +Modules/_ssl.c - PySSLZeroReturnErrorObject - +Modules/_ssl.c - PySSLWantReadErrorObject - +Modules/_ssl.c - PySSLWantWriteErrorObject - +Modules/_ssl.c - PySSLSyscallErrorObject - +Modules/_ssl.c - PySSLEOFErrorObject - +Modules/_threadmodule.c - ThreadError - +Modules/_tkinter.c - Tkinter_TclError - +Modules/_xxsubinterpretersmodule.c - ChannelError - +Modules/_xxsubinterpretersmodule.c - ChannelNotFoundError - +Modules/_xxsubinterpretersmodule.c - ChannelClosedError - +Modules/_xxsubinterpretersmodule.c - ChannelEmptyError - +Modules/_xxsubinterpretersmodule.c - ChannelNotEmptyError - +Modules/_xxsubinterpretersmodule.c - RunFailedError - +Modules/ossaudiodev.c - OSSAudioError - +Modules/pyexpat.c - ErrorObject - +Modules/signalmodule.c - ItimerError - +Modules/socketmodule.c - socket_herror - +Modules/socketmodule.c - socket_gaierror - +Modules/socketmodule.c - socket_timeout - +Modules/xxlimited.c - ErrorObject - +Modules/xxmodule.c - ErrorObject - + +#----------------------- +# module initialized once - cached PyUnicode +# [] + +# Py_IDENTIFIER (global) [] +Modules/faulthandler.c - PyId_enable - +Modules/faulthandler.c - PyId_fileno - +Modules/faulthandler.c - PyId_flush - +Modules/faulthandler.c - PyId_stderr - +Modules/_asynciomodule.c - PyId___asyncio_running_event_loop__ - +Modules/_asynciomodule.c - PyId__asyncio_future_blocking - +Modules/_asynciomodule.c - PyId_add_done_callback - +Modules/_asynciomodule.c - PyId_call_soon - +Modules/_asynciomodule.c - PyId_cancel - +Modules/_asynciomodule.c - PyId_get_event_loop - +Modules/_asynciomodule.c - PyId_throw - +Modules/posixmodule.c - PyId___fspath__ - +Modules/_abc.c - PyId___abstractmethods__ - +Modules/_abc.c - PyId___class__ - +Modules/_abc.c - PyId___dict__ - +Modules/_abc.c - PyId___bases__ - +Modules/_abc.c - PyId__abc_impl - +Modules/_abc.c - PyId___subclasscheck__ - +Modules/_abc.c - PyId___subclasshook__ - +Modules/_bisectmodule.c - PyId_insert - +Modules/_threadmodule.c - PyId_stderr - +Modules/_threadmodule.c - PyId_flush - +Modules/unicodedata.c - PyId_NFC - +Modules/unicodedata.c - PyId_NFD - +Modules/unicodedata.c - PyId_NFKC - +Modules/unicodedata.c - PyId_NFKD - +Modules/_datetimemodule.c - PyId_as_integer_ratio - +Modules/_datetimemodule.c - PyId_fromutc - +Modules/_datetimemodule.c - PyId_isoformat - +Modules/_datetimemodule.c - PyId_strftime - +Modules/_sqlite/connection.c - PyId_cursor - +Modules/cjkcodecs/multibytecodec.c - PyId_write - +Modules/_io/textio.c - PyId_close - +Modules/_io/textio.c - PyId__dealloc_warn - +Modules/_io/textio.c - PyId_decode - +Modules/_io/textio.c - PyId_fileno - +Modules/_io/textio.c - PyId_flush - +Modules/_io/textio.c - PyId_getpreferredencoding - +Modules/_io/textio.c - PyId_isatty - +Modules/_io/textio.c - PyId_mode - +Modules/_io/textio.c - PyId_name - +Modules/_io/textio.c - PyId_raw - +Modules/_io/textio.c - PyId_read - +Modules/_io/textio.c - PyId_readable - +Modules/_io/textio.c - PyId_replace - +Modules/_io/textio.c - PyId_reset - +Modules/_io/textio.c - PyId_seek - +Modules/_io/textio.c - PyId_seekable - +Modules/_io/textio.c - PyId_setstate - +Modules/_io/textio.c - PyId_strict - +Modules/_io/textio.c - PyId_tell - +Modules/_io/textio.c - PyId_writable - +Modules/_io/fileio.c - PyId_name - +Modules/_io/bufferedio.c - PyId_close - +Modules/_io/bufferedio.c - PyId__dealloc_warn - +Modules/_io/bufferedio.c - PyId_flush - +Modules/_io/bufferedio.c - PyId_isatty - +Modules/_io/bufferedio.c - PyId_mode - +Modules/_io/bufferedio.c - PyId_name - +Modules/_io/bufferedio.c - PyId_peek - +Modules/_io/bufferedio.c - PyId_read - +Modules/_io/bufferedio.c - PyId_read1 - +Modules/_io/bufferedio.c - PyId_readable - +Modules/_io/bufferedio.c - PyId_readinto - +Modules/_io/bufferedio.c - PyId_readinto1 - +Modules/_io/bufferedio.c - PyId_writable - +Modules/_io/bufferedio.c - PyId_write - +Modules/_io/iobase.c - PyId___IOBase_closed - +Modules/_io/iobase.c - PyId_read - + +# Py_IDENTIFIER (local) [] +Modules/_ssl.c fill_and_set_sslerror PyId_reason - +Modules/_ssl.c fill_and_set_sslerror PyId_library - +Modules/_ssl.c fill_and_set_sslerror PyId_verify_message - +Modules/_ssl.c fill_and_set_sslerror PyId_verify_code - +Modules/timemodule.c time_strptime PyId__strptime_time - +Modules/itertoolsmodule.c _grouper_reduce PyId_iter - +Modules/itertoolsmodule.c itertools_tee_impl PyId___copy__ - +Modules/itertoolsmodule.c cycle_reduce PyId___setstate__ - +Modules/itertoolsmodule.c zip_longest_new PyId_fillvalue - +Modules/mmapmodule.c mmap__exit__method PyId_close - +Modules/_gdbmmodule.c gdbm__exit__ PyId_close - +Modules/arraymodule.c array_array_fromfile_impl PyId_read - +Modules/arraymodule.c array_array_tofile PyId_write - +Modules/arraymodule.c array_array___reduce_ex__ PyId__array_reconstructor - +Modules/arraymodule.c array_array___reduce_ex__ PyId___dict__ - +Modules/arraymodule.c array_arrayiterator___reduce___impl PyId_iter - +Modules/_collectionsmodule.c deque_reduce PyId___dict__ - +Modules/_collectionsmodule.c defdict_reduce PyId_items - +Modules/_collectionsmodule.c _collections__count_elements_impl PyId_get - +Modules/_collectionsmodule.c _collections__count_elements_impl PyId___setitem__ - +Modules/_csv.c csv_writer PyId_write - +Modules/_asynciomodule.c get_future_loop PyId_get_loop - +Modules/_asynciomodule.c get_future_loop PyId__loop - +Modules/_asynciomodule.c future_init PyId_get_debug - +Modules/_asynciomodule.c FutureObj_get_state PyId_PENDING - +Modules/_asynciomodule.c FutureObj_get_state PyId_CANCELLED - +Modules/_asynciomodule.c FutureObj_get_state PyId_FINISHED - +Modules/_asynciomodule.c FutureObj_repr PyId__repr_info - +Modules/_asynciomodule.c FutureObj_finalize PyId_call_exception_handler - +Modules/_asynciomodule.c FutureObj_finalize PyId_message - +Modules/_asynciomodule.c FutureObj_finalize PyId_exception - +Modules/_asynciomodule.c FutureObj_finalize PyId_future - +Modules/_asynciomodule.c FutureObj_finalize PyId_source_traceback - +Modules/_asynciomodule.c register_task PyId_add - +Modules/_asynciomodule.c unregister_task PyId_discard - +Modules/_asynciomodule.c TaskObj_finalize PyId_call_exception_handler - +Modules/_asynciomodule.c TaskObj_finalize PyId_task - +Modules/_asynciomodule.c TaskObj_finalize PyId_message - +Modules/_asynciomodule.c TaskObj_finalize PyId_source_traceback - +Modules/mathmodule.c math_ceil PyId___ceil__ - +Modules/mathmodule.c math_floor PyId___floor__ - +Modules/mathmodule.c math_trunc PyId___trunc__ - +Modules/_operator.c methodcaller_reduce PyId_partial - +Modules/_lzmamodule.c build_filter_spec PyId_id - +Modules/_lzmamodule.c build_filter_spec PyId_lc - +Modules/_lzmamodule.c build_filter_spec PyId_lp - +Modules/_lzmamodule.c build_filter_spec PyId_pb - +Modules/_lzmamodule.c build_filter_spec PyId_dict_size - +Modules/_lzmamodule.c build_filter_spec PyId_dist - +Modules/_lzmamodule.c build_filter_spec PyId_start_offset - +Modules/pyexpat.c pyexpat_xmlparser_ParseFile PyId_read - +Modules/_threadmodule.c thread_excepthook_file PyId_name - +Modules/_elementtree.c _elementtree_Element_find_impl PyId_find - +Modules/_elementtree.c _elementtree_Element_findtext_impl PyId_findtext - +Modules/_elementtree.c _elementtree_Element_findall_impl PyId_findall - +Modules/_elementtree.c _elementtree_Element_iterfind_impl PyId_iterfind - +Modules/_elementtree.c treebuilder_flush_data PyId_text - +Modules/_elementtree.c treebuilder_flush_data PyId_tail - +Modules/_elementtree.c treebuilder_add_subelement PyId_append - +Modules/_elementtree.c expat_start_doctype_handler PyId_doctype - +Modules/_pickle.c _Pickle_InitState PyId_getattr - +Modules/_pickle.c _Pickler_SetOutputStream PyId_write - +Modules/_pickle.c _Unpickler_SetInputStream PyId_peek - +Modules/_pickle.c _Unpickler_SetInputStream PyId_read - +Modules/_pickle.c _Unpickler_SetInputStream PyId_readinto - +Modules/_pickle.c _Unpickler_SetInputStream PyId_readline - +Modules/_pickle.c whichmodule PyId___module__ - +Modules/_pickle.c whichmodule PyId_modules - +Modules/_pickle.c whichmodule PyId___main__ - +Modules/_pickle.c save_bytes PyId_latin1 - +Modules/_pickle.c save_dict PyId_items - +Modules/_pickle.c save_global PyId___name__ - +Modules/_pickle.c save_global PyId___qualname__ - +Modules/_pickle.c get_class PyId___class__ - +Modules/_pickle.c save_reduce PyId___name__ - +Modules/_pickle.c save_reduce PyId___newobj_ex__ - +Modules/_pickle.c save_reduce PyId___newobj__ - +Modules/_pickle.c save_reduce PyId___new__ - +Modules/_pickle.c save PyId___reduce__ - +Modules/_pickle.c save PyId___reduce_ex__ - +Modules/_pickle.c dump PyId_reducer_override - +Modules/_pickle.c _pickle_Pickler___init___impl PyId_persistent_id - +Modules/_pickle.c _pickle_Pickler___init___impl PyId_dispatch_table - +Modules/_pickle.c find_class PyId_find_class - +Modules/_pickle.c instantiate PyId___getinitargs__ - +Modules/_pickle.c instantiate PyId___new__ - +Modules/_pickle.c do_append PyId_extend - +Modules/_pickle.c do_append PyId_append - +Modules/_pickle.c load_additems PyId_add - +Modules/_pickle.c load_build PyId___setstate__ - +Modules/_pickle.c load_build PyId___dict__ - +Modules/_pickle.c _pickle_Unpickler___init___impl PyId_persistent_load - +Modules/_cursesmodule.c _curses_window_putwin PyId_write - +Modules/_cursesmodule.c _curses_getwin PyId_read - +Modules/_cursesmodule.c update_lines_cols PyId_LINES - +Modules/_cursesmodule.c update_lines_cols PyId_COLS - +Modules/_datetimemodule.c call_tzname PyId_tzname - +Modules/_datetimemodule.c make_Zreplacement PyId_replace - +Modules/_datetimemodule.c time_time PyId_time - +Modules/_datetimemodule.c build_struct_time PyId_struct_time - +Modules/_datetimemodule.c date_today PyId_fromtimestamp - +Modules/_datetimemodule.c date_strftime PyId_timetuple - +Modules/_datetimemodule.c tzinfo_reduce PyId___getinitargs__ - +Modules/_datetimemodule.c tzinfo_reduce PyId___getstate__ - +Modules/_datetimemodule.c datetime_strptime PyId__strptime_datetime - +Modules/ossaudiodev.c oss_exit PyId_close - +Modules/main.c pymain_sys_path_add_path0 PyId_path - +Modules/_sqlite/microprotocols.c pysqlite_microprotocols_adapt PyId___adapt__ - +Modules/_sqlite/microprotocols.c pysqlite_microprotocols_adapt PyId___conform__ - +Modules/_sqlite/connection.c _pysqlite_final_callback PyId_finalize - +Modules/_sqlite/connection.c pysqlite_connection_set_isolation_level PyId_upper - +Modules/_sqlite/connection.c pysqlite_connection_iterdump PyId__iterdump - +Modules/_sqlite/connection.c pysqlite_connection_create_collation PyId_upper - +Modules/_sqlite/module.c module_register_converter PyId_upper - +Modules/_sqlite/cursor.c _pysqlite_get_converter PyId_upper - +Modules/_io/_iomodule.c _io_open_impl PyId__blksize - +Modules/_io/_iomodule.c _io_open_impl PyId_isatty - +Modules/_io/_iomodule.c _io_open_impl PyId_mode - +Modules/_io/_iomodule.c _io_open_impl PyId_close - +Modules/_io/fileio.c _io_FileIO_close_impl PyId_close - +Modules/_io/iobase.c _io__IOBase_tell_impl PyId_seek - +Modules/_io/iobase.c iobase_finalize PyId__finalizing - +Modules/_io/iobase.c _io__IOBase_readlines_impl PyId_extend - +Modules/_io/iobase.c _io__RawIOBase_read_impl PyId_readall - +Modules/_ctypes/stgdict.c MakeAnonFields PyId__anonymous_ - +Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__swappedbytes_ - +Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__use_broken_old_ctypes_structure_semantics_ - +Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__pack_ - +Modules/_ctypes/callproc.c ConvParam PyId__as_parameter_ - +Modules/_ctypes/callproc.c unpickle PyId___new__ - +Modules/_ctypes/callproc.c unpickle PyId___setstate__ - +Modules/_ctypes/_ctypes.c StructUnionType_new PyId__abstract_ - +Modules/_ctypes/_ctypes.c StructUnionType_new PyId__fields_ - +Modules/_ctypes/_ctypes.c CDataType_from_param PyId__as_parameter_ - +Modules/_ctypes/_ctypes.c PyCPointerType_new PyId__type_ - +Modules/_ctypes/_ctypes.c PyCPointerType_set_type PyId__type_ - +Modules/_ctypes/_ctypes.c PyCArrayType_new PyId__length_ - +Modules/_ctypes/_ctypes.c PyCArrayType_new PyId__type_ - +Modules/_ctypes/_ctypes.c c_wchar_p_from_param PyId__as_parameter_ - +Modules/_ctypes/_ctypes.c c_char_p_from_param PyId__as_parameter_ - +Modules/_ctypes/_ctypes.c c_void_p_from_param PyId__as_parameter_ - +Modules/_ctypes/_ctypes.c PyCSimpleType_new PyId__type_ - +Modules/_ctypes/_ctypes.c PyCSimpleType_from_param PyId__as_parameter_ - +Modules/_ctypes/_ctypes.c converters_from_argtypes PyId_from_param - +Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__flags_ - +Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__argtypes_ - +Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__restype_ - +Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__check_retval_ - +Modules/_ctypes/_ctypes.c PyCFuncPtr_set_restype PyId__check_retval_ - +Modules/_ctypes/_ctypes.c _build_result PyId___ctypes_from_outparam__ - +Modules/_ctypes/_ctypes.c _init_pos_args PyId__fields_ - + +# _Py_static_string [] +Modules/_pickle.c get_dotted_path PyId_dot - + +# manually cached PyUnicodeOjbect [] +Modules/_asynciomodule.c - context_kwname - +Modules/_ctypes/callproc.c _ctypes_get_errobj error_object_name - +Modules/_ctypes/_ctypes.c CreateSwappedType suffix - +Modules/_io/_iomodule.c - _PyIO_str_close - +Modules/_io/_iomodule.c - _PyIO_str_closed - +Modules/_io/_iomodule.c - _PyIO_str_decode - +Modules/_io/_iomodule.c - _PyIO_str_encode - +Modules/_io/_iomodule.c - _PyIO_str_fileno - +Modules/_io/_iomodule.c - _PyIO_str_flush - +Modules/_io/_iomodule.c - _PyIO_str_getstate - +Modules/_io/_iomodule.c - _PyIO_str_isatty - +Modules/_io/_iomodule.c - _PyIO_str_newlines - +Modules/_io/_iomodule.c - _PyIO_str_nl - +Modules/_io/_iomodule.c - _PyIO_str_peek - +Modules/_io/_iomodule.c - _PyIO_str_read - +Modules/_io/_iomodule.c - _PyIO_str_read1 - +Modules/_io/_iomodule.c - _PyIO_str_readable - +Modules/_io/_iomodule.c - _PyIO_str_readall - +Modules/_io/_iomodule.c - _PyIO_str_readinto - +Modules/_io/_iomodule.c - _PyIO_str_readline - +Modules/_io/_iomodule.c - _PyIO_str_reset - +Modules/_io/_iomodule.c - _PyIO_str_seek - +Modules/_io/_iomodule.c - _PyIO_str_seekable - +Modules/_io/_iomodule.c - _PyIO_str_setstate - +Modules/_io/_iomodule.c - _PyIO_str_tell - +Modules/_io/_iomodule.c - _PyIO_str_truncate - +Modules/_io/_iomodule.c - _PyIO_str_writable - +Modules/_io/_iomodule.c - _PyIO_str_write - +Modules/_io/_iomodule.c - _PyIO_empty_str - +Modules/_json.c _encoded_const s_null - +Modules/_json.c _encoded_const s_true - +Modules/_json.c _encoded_const s_false - +Modules/_json.c encoder_listencode_dict open_dict - +Modules/_json.c encoder_listencode_dict close_dict - +Modules/_json.c encoder_listencode_dict empty_dict - +Modules/_json.c encoder_listencode_list open_array - +Modules/_json.c encoder_listencode_list close_array - +Modules/_json.c encoder_listencode_list empty_array - +Modules/_threadmodule.c - str_dict - +Modules/_tracemalloc.c - unknown_filename - + +#----------------------- +# module initialized once - other PyObject +# [] + +# cached during module init [] +Modules/_asynciomodule.c - asyncio_mod - +Modules/_asynciomodule.c - traceback_extract_stack - +Modules/_asynciomodule.c - asyncio_get_event_loop_policy - +Modules/_asynciomodule.c - asyncio_future_repr_info_func - +Modules/_asynciomodule.c - asyncio_iscoroutine_func - +Modules/_asynciomodule.c - asyncio_task_get_stack_func - +Modules/_asynciomodule.c - asyncio_task_print_stack_func - +Modules/_asynciomodule.c - asyncio_task_repr_info_func - +Modules/_asynciomodule.c - asyncio_InvalidStateError - +Modules/_asynciomodule.c - asyncio_CancelledError - +Modules/_zoneinfo.c - io_open - +Modules/_zoneinfo.c - _tzpath_find_tzfile - +Modules/_zoneinfo.c - _common_mod - + +# other [] +Modules/_ctypes/_ctypes.c - _unpickle - +Modules/_ctypes/_ctypes.c PyCArrayType_from_ctype cache - +Modules/_cursesmodule.c - ModDict - +Modules/_datetimemodule.c datetime_strptime module - +Modules/_datetimemodule.c - PyDateTime_TimeZone_UTC - +Modules/_datetimemodule.c - PyDateTime_Epoch - +Modules/_datetimemodule.c - us_per_ms - +Modules/_datetimemodule.c - us_per_second - +Modules/_datetimemodule.c - us_per_minute - +Modules/_datetimemodule.c - us_per_hour - +Modules/_datetimemodule.c - us_per_day - +Modules/_datetimemodule.c - us_per_week - +Modules/_datetimemodule.c - seconds_per_day - +Modules/_decimal/_decimal.c PyInit__decimal capsule - +Modules/_decimal/_decimal.c - basic_context_template - +Modules/_decimal/_decimal.c - current_context_var - +Modules/_decimal/_decimal.c - default_context_template - +Modules/_decimal/_decimal.c - extended_context_template - +Modules/_decimal/_decimal.c - round_map - +Modules/_decimal/_decimal.c - Rational - +Modules/_decimal/_decimal.c - SignalTuple - +Modules/_functoolsmodule.c - kwd_mark - +Modules/_io/_iomodule.c - _PyIO_empty_bytes - +Modules/_json.c raise_errmsg JSONDecodeError - +Modules/_sqlite/microprotocols.c - psyco_adapters - +Modules/_sqlite/module.h - _pysqlite_converters - +Modules/_ssl.c - err_codes_to_names - +Modules/_ssl.c - err_names_to_codes - +Modules/_ssl.c - lib_codes_to_names - +# XXX This should have been found by the analyzer but wasn't: +Modules/_ssl.c - _ssl_locks - +Modules/_struct.c - cache - +Modules/_tracemalloc.c - tracemalloc_empty_traceback - +Modules/arraymodule.c array_array___reduce_ex__ array_reconstructor - +Modules/cjkcodecs/cjkcodecs.h getmultibytecodec cofunc - +Modules/signalmodule.c - DefaultHandler - +Modules/signalmodule.c - IgnoreHandler - +Modules/signalmodule.c - IntHandler - + +#----------------------- +# module initialized once - non-PyObject +# [] + +# pre-allocated buffer [] +Modules/getbuildinfo.c Py_GetBuildInfo buildinfo - +Modules/nismodule.c nisproc_maplist_2 res - +Modules/pyexpat.c PyUnknownEncodingHandler template_buffer - + +# other [] +Include/datetime.h - PyDateTimeAPI - +Modules/_asynciomodule.c - module_initialized - +Modules/_ctypes/cfield.c _ctypes_get_fielddesc initialized - +Modules/_ctypes/malloc_closure.c - _pagesize - +Modules/_cursesmodule.c - initialised - +Modules/_cursesmodule.c - initialised_setupterm - +Modules/_cursesmodule.c - initialisedcolors - +Modules/_cursesmodule.c - screen_encoding - +Modules/_cursesmodule.c PyInit__curses PyCurses_API - +Modules/_datetimemodule.c - CAPI - +Modules/_decimal/_decimal.c PyInit__decimal initialized - +Modules/_decimal/_decimal.c - _py_long_multiply - +Modules/_decimal/_decimal.c - _py_long_floor_divide - +Modules/_decimal/_decimal.c - _py_long_power - +Modules/_decimal/_decimal.c - _py_float_abs - +Modules/_decimal/_decimal.c - _py_long_bit_length - +Modules/_decimal/_decimal.c - _py_float_as_integer_ratio - +Modules/_decimal/_decimal.c - _decimal_api - +Modules/_elementtree.c - expat_capi - +Modules/_io/bufferedio.c _PyIO_trap_eintr eintr_int - +Modules/_sqlite/module.h - _pysqlite_enable_callback_tracebacks - +Modules/_sqlite/module.h - pysqlite_BaseTypeAdapted - +Modules/_ssl.c - _ssl_locks_count - +Modules/cjkcodecs/cjkcodecs.h - codec_list - +Modules/cjkcodecs/cjkcodecs.h - mapping_list - +# XXX This should have been found by the analyzer but wasn't: +Python/fileutils.c - _Py_open_cloexec_works - +Modules/getaddrinfo.c - gai_afdl - +Modules/posixmodule.c os_dup2_impl dup3_works - +Modules/posixmodule.c - structseq_new - +Modules/posixmodule.c - ticks_per_second - +Modules/pyexpat.c PyInit_pyexpat capi - +Modules/readline.c - using_libedit_emulation - +Modules/readline.c - libedit_history_start - +Modules/resource.c - initialized - +Modules/signalmodule.c - initialized - +Modules/socketmodule.c - accept4_works - +Modules/socketmodule.c - sock_cloexec_works - +Modules/socketmodule.c - PySocketModuleAPI - +Modules/spwdmodule.c - initialized - +Modules/timemodule.c - initialized - +Modules/timemodule.c _PyTime_GetClockWithInfo initialized - +Modules/timemodule.c _PyTime_GetProcessTimeWithInfo ticks_per_second - + +#----------------------- +# module state +# [] + +Modules/posixmodule.c - environ - + +# PyObject [] +Modules/_asynciomodule.c - cached_running_holder - +Modules/_asynciomodule.c - fi_freelist - +Modules/_asynciomodule.c - fi_freelist_len - +Modules/_asynciomodule.c - all_tasks - +Modules/_asynciomodule.c - current_tasks - +Modules/_asynciomodule.c - iscoroutine_typecache - +Modules/_ctypes/_ctypes.c - _ctypes_ptrtype_cache - +Modules/_tkinter.c - tcl_lock - +Modules/_tkinter.c - excInCmd - +Modules/_tkinter.c - valInCmd - +Modules/_tkinter.c - trbInCmd - +Modules/_zoneinfo.c - TIMEDELTA_CACHE - +Modules/_zoneinfo.c - ZONEINFO_WEAK_CACHE - +Modules/faulthandler.c - fatal_error - +Modules/faulthandler.c - thread - +Modules/faulthandler.c - user_signals - +Modules/faulthandler.c - stack - +Modules/faulthandler.c - old_stack - +Modules/signalmodule.c - Handlers - +Modules/syslogmodule.c - S_ident_o - + +# other [] +Modules/_asynciomodule.c - cached_running_holder_tsid - +Modules/_asynciomodule.c - task_name_counter - +Modules/_ctypes/cfield.c - formattable - +Modules/_ctypes/malloc_closure.c - free_list - +Modules/_curses_panel.c - lop - +Modules/_tkinter.c - quitMainLoop - +Modules/_tkinter.c - errorInCmd - +Modules/_tkinter.c - Tkinter_busywaitinterval - +Modules/_tkinter.c - call_mutex - +Modules/_tkinter.c - var_mutex - +Modules/_tkinter.c - command_mutex - +Modules/_tkinter.c - HeadFHCD - +Modules/_tkinter.c - stdin_ready - +Modules/_tkinter.c - event_tstate - +Modules/_tracemalloc.c - allocators - +Modules/_tracemalloc.c - tables_lock - +Modules/_tracemalloc.c - tracemalloc_traced_memory - +Modules/_tracemalloc.c - tracemalloc_peak_traced_memory - +Modules/_tracemalloc.c - tracemalloc_filenames - +Modules/_tracemalloc.c - tracemalloc_traceback - +Modules/_tracemalloc.c - tracemalloc_tracebacks - +Modules/_tracemalloc.c - tracemalloc_traces - +Modules/_tracemalloc.c - tracemalloc_domains - +Modules/_tracemalloc.c - tracemalloc_reentrant_key - +Modules/_xxsubinterpretersmodule.c - _globals - +Modules/_zoneinfo.c - ZONEINFO_STRONG_CACHE - +Modules/_zoneinfo.c - ZONEINFO_STRONG_CACHE_MAX_SIZE - +Modules/_zoneinfo.c - NO_TTINFO - +Modules/faulthandler.c faulthandler_dump_traceback reentrant - +Modules/readline.c - completer_word_break_characters - +Modules/readline.c - _history_length - +Modules/readline.c - should_auto_add_history - +Modules/readline.c - sigwinch_received - +Modules/readline.c - sigwinch_ohandler - +Modules/readline.c - completed_input_string - +Modules/rotatingtree.c - random_stream - +Modules/rotatingtree.c - random_value - +Modules/signalmodule.c - is_tripped - +Modules/signalmodule.c - wakeup - +Modules/socketmodule.c - defaulttimeout - +Modules/syslogmodule.c - S_log_open - + +#----------------------- +# runtime state +# [] + +# PyObject [] +Objects/typeobject.c resolve_slotdups pname - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c - extensions - + +# allocator [] +Objects/obmalloc.c - _Py_tracemalloc_config - +Objects/obmalloc.c - _PyObject_Arena - +Objects/obmalloc.c - arenas - +Objects/obmalloc.c - maxarenas - +Objects/obmalloc.c - unused_arena_objects - +Objects/obmalloc.c - usable_arenas - +Objects/obmalloc.c - nfp2lasta - +Objects/obmalloc.c - narenas_currently_allocated - +Objects/obmalloc.c - ntimes_arena_allocated - +Objects/obmalloc.c - narenas_highwater - +Objects/obmalloc.c - raw_allocated_blocks - +Objects/obmalloc.c new_arena debug_stats - + +# REPL [] +Parser/myreadline.c - _PyOS_ReadlineLock - +Parser/myreadline.c - _PyOS_ReadlineTState - +Parser/myreadline.c - PyOS_InputHook - +Parser/myreadline.c - PyOS_ReadlineFunctionPointer - + +# other [] +Objects/dictobject.c - pydict_global_version - +Objects/floatobject.c - double_format - +Objects/floatobject.c - float_format - +Objects/floatobject.c - detected_double_format - +Objects/floatobject.c - detected_float_format - +Objects/moduleobject.c - max_module_number - +Objects/object.c - _Py_RefTotal - +Objects/typeobject.c - next_version_tag - +Objects/typeobject.c resolve_slotdups ptrs - +Parser/pegen.c - memo_statistics - +# XXX This should have been found by the analyzer but wasn't: +Python/bootstrap_hash.c - urandom_cache - +# XXX This should have been found by the analyzer but wasn't: +Python/ceval.c - lltrace - +# XXX This should have been found by the analyzer but wasn't: +Python/ceval.c make_pending_calls busy - +Python/dynload_shlib.c - handles - +Python/dynload_shlib.c - nhandles - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c - import_lock_level - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c - import_lock_thread - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c import_find_and_load accumulated - +# XXX This should have been found by the analyzer but wasn't: +Python/import.c import_find_and_load import_level - +# XXX This should have been found by the analyzer but wasn't: +Python/pylifecycle.c - _Py_UnhandledKeyboardInterrupt - +# XXX This should have been found by the analyzer but wasn't: +Python/pylifecycle.c fatal_error reentrant - diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 5f2eb53e6a092a..d4d77952468547 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -1777,6 +1777,30 @@ def dump(self): # The callable should not call builtins.print. return_converters = {} + +def write_file(filename, new_contents): + try: + with open(filename, 'r', encoding="utf-8") as fp: + old_contents = fp.read() + + if old_contents == new_contents: + # no change: avoid modifying the file modification time + return + except FileNotFoundError: + pass + + # Atomic write using a temporary file and os.replace() + filename_new = f"{filename}.new" + with open(filename_new, "w", encoding="utf-8") as fp: + fp.write(new_contents) + + try: + os.replace(filename_new, filename) + except: + os.unlink(filename_new) + raise + + clinic = None class Clinic: @@ -1823,7 +1847,7 @@ class Clinic: """ - def __init__(self, language, printer=None, *, force=False, verify=True, filename=None): + def __init__(self, language, printer=None, *, verify=True, filename=None): # maps strings to Parser objects. # (instantiated from the "parsers" global.) self.parsers = {} @@ -1832,7 +1856,6 @@ def __init__(self, language, printer=None, *, force=False, verify=True, filename fail("Custom printers are broken right now") self.printer = printer or BlockPrinter(language) self.verify = verify - self.force = force self.filename = filename self.modules = collections.OrderedDict() self.classes = collections.OrderedDict() @@ -1965,8 +1988,7 @@ def parse(self, input): block.input = 'preserve\n' printer_2 = BlockPrinter(self.language) printer_2.print_block(block) - with open(destination.filename, "wt") as f: - f.write(printer_2.f.getvalue()) + write_file(destination.filename, printer_2.f.getvalue()) continue text = printer.f.getvalue() @@ -2018,7 +2040,10 @@ def _module_and_class(self, fields): return module, cls -def parse_file(filename, *, force=False, verify=True, output=None, encoding='utf-8'): +def parse_file(filename, *, verify=True, output=None): + if not output: + output = filename + extension = os.path.splitext(filename)[1][1:] if not extension: fail("Can't extract file type for file " + repr(filename)) @@ -2028,7 +2053,7 @@ def parse_file(filename, *, force=False, verify=True, output=None, encoding='utf except KeyError: fail("Can't identify file type for file " + repr(filename)) - with open(filename, 'r', encoding=encoding) as f: + with open(filename, 'r', encoding="utf-8") as f: raw = f.read() # exit quickly if there are no clinic markers in the file @@ -2036,19 +2061,10 @@ def parse_file(filename, *, force=False, verify=True, output=None, encoding='utf if not find_start_re.search(raw): return - clinic = Clinic(language, force=force, verify=verify, filename=filename) + clinic = Clinic(language, verify=verify, filename=filename) cooked = clinic.parse(raw) - if (cooked == raw) and not force: - return - - directory = os.path.dirname(filename) or '.' - with tempfile.TemporaryDirectory(prefix="clinic", dir=directory) as tmpdir: - bytes = cooked.encode(encoding) - tmpfilename = os.path.join(tmpdir, os.path.basename(filename)) - with open(tmpfilename, "wb") as f: - f.write(bytes) - os.replace(tmpfilename, output or filename) + write_file(output, cooked) def compute_checksum(input, length=None): @@ -5105,7 +5121,7 @@ def main(argv): path = os.path.join(root, filename) if ns.verbose: print(path) - parse_file(path, force=ns.force, verify=not ns.force) + parse_file(path, verify=not ns.force) return if not ns.filename: @@ -5121,7 +5137,7 @@ def main(argv): for filename in ns.filename: if ns.verbose: print(filename) - parse_file(filename, output=ns.output, force=ns.force, verify=not ns.force) + parse_file(filename, output=ns.output, verify=not ns.force) if __name__ == "__main__": diff --git a/Tools/msi/test/test_files.wxs b/Tools/msi/test/test_files.wxs index 82a9115f759023..9127ce894819e5 100644 --- a/Tools/msi/test/test_files.wxs +++ b/Tools/msi/test/test_files.wxs @@ -1,6 +1,6 @@ - + - + diff --git a/Tools/scripts/smelly.py b/Tools/scripts/smelly.py index 43d091654d2dc8..e8a375c808cdaa 100755 --- a/Tools/scripts/smelly.py +++ b/Tools/scripts/smelly.py @@ -1,17 +1,47 @@ #!/usr/bin/env python # Script checking that all symbols exported by libpython start with Py or _Py +import os.path import subprocess import sys import sysconfig -def get_exported_symbols(): - LIBRARY = sysconfig.get_config_var('LIBRARY') - if not LIBRARY: - raise Exception("failed to get LIBRARY") +ALLOWED_PREFIXES = ('Py', '_Py') +if sys.platform == 'darwin': + ALLOWED_PREFIXES += ('__Py',) + +IGNORED_EXTENSION = "_ctypes_test" +# Ignore constructor and destructor functions +IGNORED_SYMBOLS = {'_init', '_fini'} + + +def is_local_symbol_type(symtype): + # Ignore local symbols. + + # If lowercase, the symbol is usually local; if uppercase, the symbol + # is global (external). There are however a few lowercase symbols that + # are shown for special global symbols ("u", "v" and "w"). + if symtype.islower() and symtype not in "uvw": + return True + + # Ignore the initialized data section (d and D) and the BSS data + # section. For example, ignore "__bss_start (type: B)" + # and "_edata (type: D)". + if symtype in "bBdD": + return True + + return False - args = ('nm', '-p', LIBRARY) + +def get_exported_symbols(library, dynamic=False): + print(f"Check that {library} only exports symbols starting with Py or _Py") + + # Only look at dynamic symbols + args = ['nm', '--no-sort'] + if dynamic: + args.append('--dynamic') + args.append(library) print("+ %s" % ' '.join(args)) proc = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True) if proc.returncode: @@ -25,12 +55,9 @@ def get_exported_symbols(): def get_smelly_symbols(stdout): - symbols = [] - ignored_symtypes = set() - - allowed_prefixes = ('Py', '_Py') - if sys.platform == 'darwin': - allowed_prefixes += ('__Py',) + smelly_symbols = [] + python_symbols = [] + local_symbols = [] for line in stdout.splitlines(): # Split line '0000000000001b80 D PyTextIOWrapper_Type' @@ -42,41 +69,98 @@ def get_smelly_symbols(stdout): continue symtype = parts[1].strip() - # Ignore private symbols. - # - # If lowercase, the symbol is usually local; if uppercase, the symbol - # is global (external). There are however a few lowercase symbols that - # are shown for special global symbols ("u", "v" and "w"). - if symtype.islower() and symtype not in "uvw": - ignored_symtypes.add(symtype) + symbol = parts[-1] + result = '%s (type: %s)' % (symbol, symtype) + + if symbol.startswith(ALLOWED_PREFIXES): + python_symbols.append(result) continue - symbol = parts[-1] - if symbol.startswith(allowed_prefixes): + if is_local_symbol_type(symtype): + local_symbols.append(result) + elif symbol in IGNORED_SYMBOLS: + local_symbols.append(result) + else: + smelly_symbols.append(result) + + if local_symbols: + print(f"Ignore {len(local_symbols)} local symbols") + return smelly_symbols, python_symbols + + +def check_library(library, dynamic=False): + nm_output = get_exported_symbols(library, dynamic) + smelly_symbols, python_symbols = get_smelly_symbols(nm_output) + + if not smelly_symbols: + print(f"OK: no smelly symbol found ({len(python_symbols)} Python symbols)") + return 0 + + print() + smelly_symbols.sort() + for symbol in smelly_symbols: + print("Smelly symbol: %s" % symbol) + + print() + print("ERROR: Found %s smelly symbols!" % len(smelly_symbols)) + return len(smelly_symbols) + + +def check_extensions(): + print(__file__) + srcdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + filename = os.path.join(srcdir, "pybuilddir.txt") + try: + with open(filename, encoding="utf-8") as fp: + pybuilddir = fp.readline() + except FileNotFoundError: + print(f"Cannot check extensions because {filename} does not exist") + return True + + print(f"Check extension modules from {pybuilddir} directory") + builddir = os.path.join(srcdir, pybuilddir) + nsymbol = 0 + for name in os.listdir(builddir): + if not name.endswith(".so"): + continue + if IGNORED_EXTENSION in name: + print() + print(f"Ignore extension: {name}") continue - symbol = '%s (type: %s)' % (symbol, symtype) - symbols.append(symbol) - if ignored_symtypes: - print("Ignored symbol types: %s" % ', '.join(sorted(ignored_symtypes))) print() - return symbols + filename = os.path.join(builddir, name) + nsymbol += check_library(filename, dynamic=True) + + return nsymbol def main(): - nm_output = get_exported_symbols() - symbols = get_smelly_symbols(nm_output) + # static library + LIBRARY = sysconfig.get_config_var('LIBRARY') + if not LIBRARY: + raise Exception("failed to get LIBRARY variable from sysconfig") + nsymbol = check_library(LIBRARY) + + # dynamic library + LDLIBRARY = sysconfig.get_config_var('LDLIBRARY') + if not LDLIBRARY: + raise Exception("failed to get LDLIBRARY variable from sysconfig") + if LDLIBRARY != LIBRARY: + print() + nsymbol += check_library(LDLIBRARY, dynamic=True) - if not symbols: - print("OK: no smelly symbol found") - sys.exit(0) + # Check extension modules like _ssl.cpython-310d-x86_64-linux-gnu.so + nsymbol += check_extensions() + + if nsymbol: + print() + print(f"ERROR: Found {nsymbol} smelly symbols in total!") + sys.exit(1) - symbols.sort() - for symbol in symbols: - print("Smelly symbol: %s" % symbol) print() - print("ERROR: Found %s smelly symbols!" % len(symbols)) - sys.exit(1) + print(f"OK: all exported symbols of all libraries " + f"are prefixed with {' or '.join(map(repr, ALLOWED_PREFIXES))}") if __name__ == "__main__": diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py new file mode 100755 index 00000000000000..b3a46f985e0a2d --- /dev/null +++ b/Tools/scripts/stable_abi.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python + +import argparse +import glob +import re +import pathlib +import subprocess +import sys +import sysconfig + +EXCLUDED_HEADERS = { + "bytes_methods.h", + "cellobject.h", + "classobject.h", + "code.h", + "compile.h", + "datetime.h", + "dtoa.h", + "frameobject.h", + "funcobject.h", + "genobject.h", + "longintrepr.h", + "parsetok.h", + "pyarena.h", + "pyatomic.h", + "pyctype.h", + "pydebug.h", + "pytime.h", + "symtable.h", + "token.h", + "ucnhash.h", +} + + +def get_exported_symbols(library, dynamic=False): + # Only look at dynamic symbols + args = ["nm", "--no-sort"] + if dynamic: + args.append("--dynamic") + args.append(library) + proc = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True) + if proc.returncode: + sys.stdout.write(proc.stdout) + sys.exit(proc.returncode) + + stdout = proc.stdout.rstrip() + if not stdout: + raise Exception("command output is empty") + + for line in stdout.splitlines(): + # Split line '0000000000001b80 D PyTextIOWrapper_Type' + if not line: + continue + + parts = line.split(maxsplit=2) + if len(parts) < 3: + continue + + symbol = parts[-1] + yield symbol + + +def check_library(stable_abi_file, library, abi_funcs, dynamic=False): + available_symbols = set(get_exported_symbols(library, dynamic)) + missing_symbols = abi_funcs - available_symbols + if missing_symbols: + raise Exception( + f"""\ +Some symbols from the limited API are missing: {', '.join(missing_symbols)} + +This error means that there are some missing symbols among the ones exported +in the Python library ("libpythonx.x.a" or "libpythonx.x.so"). This normally +means that some symbol, function implementation or a prototype, belonging to +a symbol in the limited API has been deleted or is missing. + +Check if this was a mistake and if not, update the file containing the limited +API symbols. This file is located at: + +{stable_abi_file} + +You can read more about the limited API and its contracts at: + +https://docs.python.org/3/c-api/stable.html + +And in PEP 384: + +https://www.python.org/dev/peps/pep-0384/ +""" + ) + + +def generate_limited_api_symbols(args): + if hasattr(sys, "gettotalrefcount"): + print( + "Stable ABI symbols cannot be generated from a debug build", file=sys.stderr + ) + sys.exit(1) + library = sysconfig.get_config_var("LIBRARY") + ldlibrary = sysconfig.get_config_var("LDLIBRARY") + if ldlibrary != library: + raise Exception("Limited ABI symbols can only be generated from a static build") + available_symbols = { + symbol for symbol in get_exported_symbols(library) if symbol.startswith("Py") + } + + headers = [ + file + for file in pathlib.Path("Include").glob("*.h") + if file.name not in EXCLUDED_HEADERS + ] + stable_data, stable_exported_data, stable_functions = get_limited_api_definitions( + headers + ) + macros = get_limited_api_macros(headers) + + stable_symbols = { + symbol + for symbol in (stable_functions | stable_exported_data | stable_data | macros) + if symbol.startswith("Py") and symbol in available_symbols + } + with open(args.output_file, "w") as output_file: + output_file.write(f"# File generated by 'make regen-limited-abi'\n") + output_file.write( + f"# This is NOT an authoritative list of stable ABI symbols\n" + ) + for symbol in sorted(stable_symbols): + output_file.write(f"{symbol}\n") + + +def get_limited_api_macros(headers): + """Run the preprocesor over all the header files in "Include" setting + "-DPy_LIMITED_API" to the correct value for the running version of the interpreter + and extracting all macro definitions (via adding -dM to the compiler arguments). + """ + + preprocesor_output_with_macros = subprocess.check_output( + sysconfig.get_config_var("CC").split() + + [ + # Prevent the expansion of the exported macros so we can capture them later + "-DSIZEOF_WCHAR_T=4", # The actual value is not important + f"-DPy_LIMITED_API={sys.version_info.major << 24 | sys.version_info.minor << 16}", + "-I.", + "-I./Include", + "-dM", + "-E", + ] + + [str(file) for file in headers], + text=True, + stderr=subprocess.DEVNULL, + ) + + return { + target + for _, target in re.findall( + r"#define (\w+)\s*(?:\(.*?\))?\s+(\w+)", preprocesor_output_with_macros + ) + } + + +def get_limited_api_definitions(headers): + """Run the preprocesor over all the header files in "Include" setting + "-DPy_LIMITED_API" to the correct value for the running version of the interpreter. + + The limited API symbols will be extracted from the output of this command as it includes + the prototypes and definitions of all the exported symbols that are in the limited api. + + This function does *NOT* extract the macros defined on the limited API + """ + preprocesor_output = subprocess.check_output( + sysconfig.get_config_var("CC").split() + + [ + # Prevent the expansion of the exported macros so we can capture them later + "-DPyAPI_FUNC=__PyAPI_FUNC", + "-DPyAPI_DATA=__PyAPI_DATA", + "-DEXPORT_DATA=__EXPORT_DATA", + "-D_Py_NO_RETURN=", + "-DSIZEOF_WCHAR_T=4", # The actual value is not important + f"-DPy_LIMITED_API={sys.version_info.major << 24 | sys.version_info.minor << 16}", + "-I.", + "-I./Include", + "-E", + ] + + [str(file) for file in headers], + text=True, + stderr=subprocess.DEVNULL, + ) + stable_functions = set( + re.findall(r"__PyAPI_FUNC\(.*?\)\s*(.*?)\s*\(", preprocesor_output) + ) + stable_exported_data = set( + re.findall(r"__EXPORT_DATA\((.*?)\)", preprocesor_output) + ) + stable_data = set( + re.findall(r"__PyAPI_DATA\(.*?\)\s*\(?(.*?)\)?\s*;", preprocesor_output) + ) + return stable_data, stable_exported_data, stable_functions + + +def check_symbols(parser_args): + with open(parser_args.stable_abi_file, "r") as filename: + abi_funcs = { + symbol + for symbol in filename.read().splitlines() + if symbol and not symbol.startswith("#") + } + + try: + # static library + LIBRARY = sysconfig.get_config_var("LIBRARY") + if not LIBRARY: + raise Exception("failed to get LIBRARY variable from sysconfig") + check_library(parser_args.stable_abi_file, LIBRARY, abi_funcs) + + # dynamic library + LDLIBRARY = sysconfig.get_config_var("LDLIBRARY") + if not LDLIBRARY: + raise Exception("failed to get LDLIBRARY variable from sysconfig") + if LDLIBRARY != LIBRARY: + check_library( + parser_args.stable_abi_file, LDLIBRARY, abi_funcs, dynamic=True + ) + except Exception as e: + print(e, file=sys.stderr) + sys.exit(1) + + +def main(): + parser = argparse.ArgumentParser(description="Process some integers.") + subparsers = parser.add_subparsers() + check_parser = subparsers.add_parser( + "check", help="Check the exported symbols against a given ABI file" + ) + check_parser.add_argument( + "stable_abi_file", type=str, help="File with the stable abi functions" + ) + check_parser.set_defaults(func=check_symbols) + generate_parser = subparsers.add_parser( + "generate", + help="Generate symbols from the header files and the exported symbols", + ) + generate_parser.add_argument( + "output_file", type=str, help="File to dump the symbols to" + ) + generate_parser.set_defaults(func=generate_limited_api_symbols) + args = parser.parse_args() + if "func" not in args: + parser.error("Either 'check' or 'generate' must be used") + sys.exit(1) + + args.func(args) + + +if __name__ == "__main__": + main() diff --git a/aclocal.m4 b/aclocal.m4 index 99913e7f3b85cf..c003f3c7055389 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -67,7 +67,7 @@ AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 11 (pkg-config-0.29.1) +# serial 12 (pkg-config-0.29.2) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson @@ -109,7 +109,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -210,7 +210,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -220,11 +220,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -241,7 +241,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -342,73 +342,5 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR -dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------ -dnl -dnl Prepare a "--with-" configure option using the lowercase -dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and -dnl PKG_CHECK_MODULES in a single macro. -AC_DEFUN([PKG_WITH_MODULES], -[ -m4_pushdef([with_arg], m4_tolower([$1])) - -m4_pushdef([description], - [m4_default([$5], [build with ]with_arg[ support])]) - -m4_pushdef([def_arg], [m4_default([$6], [auto])]) -m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) -m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) - -m4_case(def_arg, - [yes],[m4_pushdef([with_without], [--without-]with_arg)], - [m4_pushdef([with_without],[--with-]with_arg)]) - -AC_ARG_WITH(with_arg, - AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, - [AS_TR_SH([with_]with_arg)=def_arg]) - -AS_CASE([$AS_TR_SH([with_]with_arg)], - [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], - [auto],[PKG_CHECK_MODULES([$1],[$2], - [m4_n([def_action_if_found]) $3], - [m4_n([def_action_if_not_found]) $4])]) - -m4_popdef([with_arg]) -m4_popdef([description]) -m4_popdef([def_arg]) - -])dnl PKG_WITH_MODULES - -dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ----------------------------------------------- -dnl -dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES -dnl check._[VARIABLE-PREFIX] is exported as make variable. -AC_DEFUN([PKG_HAVE_WITH_MODULES], -[ -PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) - -AM_CONDITIONAL([HAVE_][$1], - [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) -])dnl PKG_HAVE_WITH_MODULES - -dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------------------ -dnl -dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after -dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make -dnl and preprocessor variable. -AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], -[ -PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) - -AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], - [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) -])dnl PKG_HAVE_DEFINE_WITH_MODULES - m4_include([m4/ax_c_float_words_bigendian.m4]) m4_include([m4/ax_check_openssl.m4]) diff --git a/configure b/configure index 68d692d0f6785c..9ee750b70f4a19 100755 --- a/configure +++ b/configure @@ -3430,16 +3430,6 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h define_xopen_source=no;; Darwin/[12][0-9].*) define_xopen_source=no;; - # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but - # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined - # or has another value. By not (re)defining it, the defaults come in place. - AIX/4) - define_xopen_source=no;; - AIX/5) - if test `uname -r` -eq 1; then - define_xopen_source=no - fi - ;; # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from # defining NI_NUMERICHOST. QNX/6.3.2) @@ -5828,10 +5818,7 @@ $as_echo_n "checking EXPORTSYMS... " >&6; } case $ac_sys_system in AIX*) EXPORTSYMS="Modules/python.exp" - if test $ac_sys_release -ge 5 -o \ - $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then - EXPORTSFROM=. # the main executable - fi + EXPORTSFROM=. # the main executable ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5 @@ -7624,6 +7611,31 @@ $as_echo_n "checking which MACOSX_DEPLOYMENT_TARGET to use... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACOSX_DEPLOYMENT_TARGET" >&5 $as_echo "$MACOSX_DEPLOYMENT_TARGET" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if specified universal architectures work" >&5 +$as_echo_n "checking if specified universal architectures work... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +printf("%d", 42); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "check config.log and use the '--with-universal-archs' option" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # end of Darwin* tests ;; esac @@ -8032,7 +8044,8 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h +sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \ +sys/mman.h sys/eventfd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -11656,7 +11669,7 @@ fi DLINCLDIR=. # the dlopen() function means we might want to use dynload_shlib.o. some -# platforms, such as AIX, have dlopen(), but don't want to use it. +# platforms have dlopen(), but don't want to use it. for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" @@ -11738,7 +11751,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \ sched_rr_get_interval \ sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \ - sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \ + sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unlinkat utimensat utimes vfork waitid waitpid wait3 wait4 \ wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn @@ -12098,6 +12111,36 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for eventfd" >&5 +$as_echo_n "checking for eventfd... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_SYS_EVENTFD_H +#include +#endif + +int +main () +{ +int x = eventfd(0, EFD_CLOEXEC) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_EVENTFD 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # On some systems (eg. FreeBSD 5), we would find a definition of the # functions ctermid_r, setgroups in the library, but no prototype # (e.g. because we use _XOPEN_SOURCE). See whether we can take their diff --git a/configure.ac b/configure.ac index 1edafc342b7120..7f7dfa588a8144 100644 --- a/configure.ac +++ b/configure.ac @@ -512,16 +512,6 @@ case $ac_sys_system/$ac_sys_release in define_xopen_source=no;; Darwin/@<:@[12]@:>@@<:@0-9@:>@.*) define_xopen_source=no;; - # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but - # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined - # or has another value. By not (re)defining it, the defaults come in place. - AIX/4) - define_xopen_source=no;; - AIX/5) - if test `uname -r` -eq 1; then - define_xopen_source=no - fi - ;; # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from # defining NI_NUMERICHOST. QNX/6.3.2) @@ -1048,10 +1038,7 @@ AC_MSG_CHECKING(EXPORTSYMS) case $ac_sys_system in AIX*) EXPORTSYMS="Modules/python.exp" - if test $ac_sys_release -ge 5 -o \ - $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then - EXPORTSFROM=. # the main executable - fi + EXPORTSFROM=. # the main executable ;; esac AC_MSG_RESULT($EXPORTSYMS) @@ -1991,6 +1978,13 @@ yes) EXPORT_MACOSX_DEPLOYMENT_TARGET='' AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET) + AC_MSG_CHECKING(if specified universal architectures work) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%d", 42);]])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_MSG_ERROR(check config.log and use the '--with-universal-archs' option) + ]) + # end of Darwin* tests ;; esac @@ -2210,7 +2204,8 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h) +sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \ +sys/mman.h sys/eventfd.h) AC_HEADER_DIRENT AC_HEADER_MAJOR @@ -3630,7 +3625,7 @@ AC_SUBST(DLINCLDIR) DLINCLDIR=. # the dlopen() function means we might want to use dynload_shlib.o. some -# platforms, such as AIX, have dlopen(), but don't want to use it. +# platforms have dlopen(), but don't want to use it. AC_CHECK_FUNCS(dlopen) # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic @@ -3696,7 +3691,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \ sched_rr_get_interval \ sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \ - sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \ + sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unlinkat utimensat utimes vfork waitid waitpid wait3 wait4 \ wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn) @@ -3803,6 +3798,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ [AC_MSG_RESULT(no) ]) +AC_MSG_CHECKING(for eventfd) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_SYS_EVENTFD_H +#include +#endif +]], [[int x = eventfd(0, EFD_CLOEXEC)]])], + [AC_DEFINE(HAVE_EVENTFD, 1, Define if you have the 'eventfd' function.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) +]) + # On some systems (eg. FreeBSD 5), we would find a definition of the # functions ctermid_r, setgroups in the library, but no prototype # (e.g. because we use _XOPEN_SOURCE). See whether we can take their diff --git a/pyconfig.h.in b/pyconfig.h.in index d71ad3fdc8684c..6ff5fc968a30c2 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -308,6 +308,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H +/* Define if you have the 'eventfd' function. */ +#undef HAVE_EVENTFD + /* Define to 1 if you have the `execv' function. */ #undef HAVE_EXECV @@ -1015,6 +1018,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SPAWN_H +/* Define to 1 if you have the `splice' function. */ +#undef HAVE_SPLICE + /* Define if your compiler provides ssize_t */ #undef HAVE_SSIZE_T @@ -1119,6 +1125,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_EPOLL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENTFD_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_EVENT_H diff --git a/setup.py b/setup.py index c12b5f5042551a..ca5a04d2ae0d7f 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ import sys import sysconfig from glob import glob, escape +import _osx_support try: @@ -178,32 +179,9 @@ def macosx_sdk_root(): MACOS_SDK_ROOT = m.group(1) MACOS_SDK_SPECIFIED = MACOS_SDK_ROOT != '/' else: - MACOS_SDK_ROOT = '/' + MACOS_SDK_ROOT = _osx_support._default_sysroot( + sysconfig.get_config_var('CC')) MACOS_SDK_SPECIFIED = False - cc = sysconfig.get_config_var('CC') - tmpfile = '/tmp/setup_sdk_root.%d' % os.getpid() - try: - os.unlink(tmpfile) - except: - pass - ret = run_command('%s -E -v - %s 1>/dev/null' % (cc, tmpfile)) - in_incdirs = False - try: - if ret == 0: - with open(tmpfile) as fp: - for line in fp.readlines(): - if line.startswith("#include <...>"): - in_incdirs = True - elif line.startswith("End of search list"): - in_incdirs = False - elif in_incdirs: - line = line.strip() - if line == '/usr/include': - MACOS_SDK_ROOT = '/' - elif line.endswith(".sdk/usr/include"): - MACOS_SDK_ROOT = line[:-12] - finally: - os.unlink(tmpfile) return MACOS_SDK_ROOT @@ -241,7 +219,7 @@ def is_macosx_sdk_path(path): def grep_headers_for(function, headers): for header in headers: - with open(header, 'r') as f: + with open(header, 'r', errors='surrogateescape') as f: if function in f.read(): return True return False @@ -1037,7 +1015,7 @@ def detect_readline_curses(self): os_release = int(os.uname()[2].split('.')[0]) dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') if (dep_target and - (tuple(int(n) for n in dep_target.split('.')[0:2]) + (tuple(int(n) for n in str(dep_target).split('.')[0:2]) < (10, 5) ) ): os_release = 8 if os_release < 9: @@ -1154,18 +1132,12 @@ def detect_crypt(self): def detect_socket(self): # socket(2) - if not VXWORKS: - kwargs = {'depends': ['socketmodule.h']} - if MACOS: - # Issue #35569: Expose RFC 3542 socket options. - kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542'] - - self.add(Extension('_socket', ['socketmodule.c'], **kwargs)) - elif self.compiler.find_library_file(self.lib_dirs, 'net'): - libs = ['net'] - self.add(Extension('_socket', ['socketmodule.c'], - depends=['socketmodule.h'], - libraries=libs)) + kwargs = {'depends': ['socketmodule.h']} + if MACOS: + # Issue #35569: Expose RFC 3542 socket options. + kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542'] + + self.add(Extension('_socket', ['socketmodule.c'], **kwargs)) def detect_dbm_gdbm(self): # Modules that provide persistent dictionary-like semantics. You will @@ -1831,8 +1803,16 @@ def detect_modules(self): ## self.add(Extension('xx', ['xxmodule.c'])) if 'd' not in sysconfig.get_config_var('ABIFLAGS'): + # Non-debug mode: Build xxlimited with limited API self.add(Extension('xxlimited', ['xxlimited.c'], + define_macros=[('Py_LIMITED_API', '0x03100000')])) + self.add(Extension('xxlimited_35', ['xxlimited_35.c'], define_macros=[('Py_LIMITED_API', '0x03050000')])) + else: + # Debug mode: Build xxlimited with the full API + # (which is compatible with the limited one) + self.add(Extension('xxlimited', ['xxlimited.c'])) + self.add(Extension('xxlimited_35', ['xxlimited_35.c'])) def detect_tkinter_explicitly(self): # Build _tkinter using explicit locations for Tcl/Tk. From 16e218ad4c595f202243a2857a651409d39ba7fa Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 10 Dec 2020 15:53:27 -0800 Subject: [PATCH 200/218] Fix compiler warning --- Python/ast_opt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 724067946e6c08..7ce97f75ed4934 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -593,6 +593,10 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) case Constant_kind: // Already a constant, nothing further to do break; + case MatchAs_kind: + case MatchOr_kind: + // These can't occur outside of patterns. + Py_UNREACHABLE(); // No default case, so the compiler will emit a warning if new expression // kinds are added without being handled here } From 47c9218996401c916efb0bcc57216c7d7c0c994b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Feb 2021 08:53:45 -0800 Subject: [PATCH 201/218] CHECK -> RETURN_IF_FASLE --- Python/compile.c | 70 ++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 1125ec462282de..3d055474a08690 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1599,7 +1599,7 @@ compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b) } \ } -#define CHECK(X) \ +#define RETURN_IF_FALSE(X) \ if (!(X)) { \ return 0; \ } @@ -5474,12 +5474,12 @@ pattern_helper_load_attr(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); if (p->v.Attribute.value->kind == Attribute_kind) { - CHECK(pattern_helper_load_attr(c, p->v.Attribute.value, pc)); + RETURN_IF_FALSE(pattern_helper_load_attr(c, p->v.Attribute.value, pc)); } else { assert(p->v.Attribute.value->kind == Name_kind); assert(p->v.Attribute.value->v.Name.ctx == Load); - CHECK(compiler_nameop(c, p->v.Attribute.value->v.Name.id, Load)); + RETURN_IF_FALSE(compiler_nameop(c, p->v.Attribute.value->v.Name.id, Load)); } ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); return 1; @@ -5508,7 +5508,7 @@ pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) assert(!_PyUnicode_EqualToASCIIString(n, "_")); // Can't assign to the same name twice: if (!pc->stores) { - CHECK(pc->stores = PySet_New(NULL)); + RETURN_IF_FALSE(pc->stores = PySet_New(NULL)); } else { int duplicate = PySet_Contains(pc->stores, n); @@ -5520,8 +5520,8 @@ pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) return compiler_error(c, e, n); } } - CHECK(!PySet_Add(pc->stores, n)); - CHECK(compiler_nameop(c, n, Store)); + RETURN_IF_FALSE(!PySet_Add(pc->stores, n)); + RETURN_IF_FALSE(compiler_nameop(c, n, Store)); return 1; } @@ -5532,7 +5532,7 @@ compiler_pattern_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) // Like compiler_pattern, but turn off checks for irrefutability. int allow_irrefutable = pc->allow_irrefutable; pc->allow_irrefutable = 1; - CHECK(compiler_pattern(c, p, pc)); + RETURN_IF_FALSE(compiler_pattern(c, p, pc)); pc->allow_irrefutable = allow_irrefutable; return 1; } @@ -5543,12 +5543,12 @@ compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == MatchAs_kind); basicblock *end; - CHECK(end = compiler_new_block(c)); - CHECK(compiler_pattern(c, p->v.MatchAs.pattern, pc)); + RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(compiler_pattern(c, p->v.MatchAs.pattern, pc)); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); ADDOP(c, DUP_TOP); - CHECK(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); + RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; @@ -5567,7 +5567,7 @@ compiler_pattern_capture(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_error(c, e, p->v.Name.id); } ADDOP(c, DUP_TOP); - CHECK(pattern_helper_store_name(c, p->v.Name.id, pc)); + RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.Name.id, pc)); ADDOP_LOAD_CONST(c, Py_True); return 1; } @@ -5584,20 +5584,20 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) const char *e = "too many sub-patterns in class pattern %R"; return compiler_error(c, e, p->v.Call.func); } - CHECK(!validate_keywords(c, kwargs)); + RETURN_IF_FALSE(!validate_keywords(c, kwargs)); basicblock *end; - CHECK(end = compiler_new_block(c)); + RETURN_IF_FALSE(end = compiler_new_block(c)); // The name of the class can only be an (optionally dotted) name: if (p->v.Call.func->kind == Attribute_kind) { - CHECK(pattern_helper_load_attr(c, p->v.Call.func, pc)); + RETURN_IF_FALSE(pattern_helper_load_attr(c, p->v.Call.func, pc)); } else { assert(p->v.Call.func->kind == Name_kind); assert(p->v.Call.func->v.Name.ctx == Load); - CHECK(compiler_nameop(c, p->v.Call.func->v.Name.id, Load)); + RETURN_IF_FALSE(compiler_nameop(c, p->v.Call.func->v.Name.id, Load)); } PyObject *kwnames; - CHECK(kwnames = PyTuple_New(nkwargs)); + RETURN_IF_FALSE(kwnames = PyTuple_New(nkwargs)); Py_ssize_t i; for (i = 0; i < nkwargs; i++) { PyObject *name = ((keyword_ty) asdl_seq_GET(kwargs, i))->arg; @@ -5624,7 +5624,7 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) } // Get the i-th attribute, and match it against the i-th pattern: ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_pattern_subpattern(c, arg, pc)); + RETURN_IF_FALSE(compiler_pattern_subpattern(c, arg, pc)); // TOS is True or False, with the attribute beneath. Pop the attribute, // we're done with it: ADDOP(c, ROT_TWO); @@ -5648,7 +5648,7 @@ compiler_pattern_literal(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); ADDOP(c, DUP_TOP); - CHECK(pattern_helper_load_constant(c, p, pc)); + RETURN_IF_FALSE(pattern_helper_load_constant(c, p, pc)); PyObject *v = p->v.Constant.value; // Literal True, False, and None are compared by identity. All others use // equality: @@ -5661,8 +5661,8 @@ static int compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) { basicblock *fail, *end; - CHECK(fail = compiler_new_block(c)); - CHECK(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail = compiler_new_block(c)); + RETURN_IF_FALSE(end = compiler_new_block(c)); asdl_expr_seq *keys = p->v.Dict.keys; asdl_expr_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); @@ -5702,11 +5702,11 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_error(c, e); } if (key->kind == Attribute_kind) { - CHECK(pattern_helper_load_attr(c, key, pc)); + RETURN_IF_FALSE(pattern_helper_load_attr(c, key, pc)); } else { assert(key->kind == Constant_kind); - CHECK(pattern_helper_load_constant(c, key, pc)); + RETURN_IF_FALSE(pattern_helper_load_constant(c, key, pc)); } } ADDOP_I(c, BUILD_TUPLE, size - star); @@ -5721,7 +5721,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) continue; } ADDOP_I(c, GET_INDEX, i); - CHECK(compiler_pattern_subpattern(c, value, pc)); + RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); // TOS is True or False. Don't care about the value underneath anymore: ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); @@ -5734,7 +5734,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) // There's now one of two things on TOS. If we had a starred name, it's // a dict of remaining items to bind: PyObject *id = asdl_seq_GET(values, size - 1)->v.Name.id; - CHECK(pattern_helper_store_name(c, id, pc)); + RETURN_IF_FALSE(pattern_helper_store_name(c, id, pc)); } else { // Otherwise, it's just another reference to the subject underneath. @@ -5760,7 +5760,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) // others bind the same names (they should), then this becomes pc->stores. PyObject *control = NULL; basicblock *end; - CHECK(end = compiler_new_block(c)); + RETURN_IF_FALSE(end = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns); assert(size > 1); // We're going to be messing with pc. Keep the original info handy: @@ -5838,7 +5838,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) star = i; } basicblock *end; - CHECK(end = compiler_new_block(c)); + RETURN_IF_FALSE(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); @@ -5851,7 +5851,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) return 1; } basicblock *wrong_size; - CHECK(wrong_size = compiler_new_block(c)); + RETURN_IF_FALSE(wrong_size = compiler_new_block(c)); // Duplicate the length, since both the length check and the GET_INDEX_* // instructions need it: ADDOP(c, DUP_TOP) @@ -5869,7 +5869,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_error(c, "too many sub-patterns in sequence pattern"); } basicblock *fail; - CHECK(fail = compiler_new_block(c)); + RETURN_IF_FALSE(fail = compiler_new_block(c)); ADDOP(c, ROT_TWO); // TOS is subject, length underneath. for (Py_ssize_t i = 0; i < size; i++) { @@ -5900,7 +5900,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) // Basically a negative index: ADDOP_I(c, GET_INDEX_END, size - 1 - i); } - CHECK(compiler_pattern_subpattern(c, value, pc)); + RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); // TOS is True or False. We're done with the item underneath: ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); @@ -5930,7 +5930,7 @@ compiler_pattern_value(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); ADDOP(c, DUP_TOP); - CHECK(pattern_helper_load_attr(c, p, pc)); + RETURN_IF_FALSE(pattern_helper_load_attr(c, p, pc)); ADDOP_COMPARE(c, Eq); return 1; } @@ -5994,7 +5994,7 @@ compiler_match(struct compiler *c, stmt_ty s) { VISIT(c, expr, s->v.Match.subject); basicblock *next, *end; - CHECK(end = compiler_new_block(c)); + RETURN_IF_FALSE(end = compiler_new_block(c)); Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases); assert(cases); pattern_context pc; @@ -6008,18 +6008,18 @@ compiler_match(struct compiler *c, stmt_ty s) for (Py_ssize_t i = 0; i < cases - has_default; i++) { m = asdl_seq_GET(s->v.Match.cases, i); SET_LOC(c, m->pattern); - CHECK(next = compiler_new_block(c)); + RETURN_IF_FALSE(next = compiler_new_block(c)); // If pc.allow_irrefutable is 0, any name captures against our subject // will raise. Irrefutable cases must be either guarded, last, or both: pc.allow_irrefutable = !!m->guard || (i == cases - 1); int result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); - CHECK(result); + RETURN_IF_FALSE(result); // TOS is either True or False, with the subject still waiting beneath: ADDOP_JUMP(c, POP_JUMP_IF_FALSE, next); NEXT_BLOCK(c); if (m->guard) { - CHECK(compiler_jump_if(c, m->guard, next, 0)); + RETURN_IF_FALSE(compiler_jump_if(c, m->guard, next, 0)); } // Success! Pop the subject off, we're done with it: ADDOP(c, POP_TOP); @@ -6035,7 +6035,7 @@ compiler_match(struct compiler *c, stmt_ty s) m = asdl_seq_GET(s->v.Match.cases, cases - 1); SET_LOC(c, m->pattern); if (m->guard) { - CHECK(compiler_jump_if(c, m->guard, end, 0)); + RETURN_IF_FALSE(compiler_jump_if(c, m->guard, end, 0)); } VISIT_SEQ(c, stmt, m->body); } From 193f037dc19f8034c42526ee0f2c9ac7e91696ec Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 9 Feb 2021 22:39:59 -0800 Subject: [PATCH 202/218] Cleanup --- Python/compile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 3d055474a08690..6a3d15adeb9bc4 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1600,8 +1600,8 @@ compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b) } #define RETURN_IF_FALSE(X) \ - if (!(X)) { \ - return 0; \ + if (!(X)) { \ + return 0; \ } /* Search if variable annotations are present statically in a block. */ @@ -5783,7 +5783,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) } if (!i) { // If this is the first alternative, save its stores as a "control" - // for the others (they can't bind a different set names): + // for the others (they can't bind a different set of names): control = pc->stores; continue; } From b748e414c148fe4c087825c2fd6aa87b5e95d341 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 09:46:28 -0800 Subject: [PATCH 203/218] pattern_helper_load_constant -> ADDOP_LOAD_CONST --- Python/compile.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index c10f72e6ce2936..9aa762a68ab636 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5486,22 +5486,6 @@ pattern_helper_load_attr(struct compiler *c, expr_ty p, pattern_context *pc) } -static int -pattern_helper_load_constant(struct compiler *c, expr_ty p, pattern_context *pc) -{ - assert(p->kind == Constant_kind); - assert(p->v.Constant.value == Py_None || - PyBool_Check(p->v.Constant.value) || - PyBytes_CheckExact(p->v.Constant.value) || - PyComplex_CheckExact(p->v.Constant.value) || - PyFloat_CheckExact(p->v.Constant.value) || - PyLong_CheckExact(p->v.Constant.value) || - PyUnicode_CheckExact(p->v.Constant.value)); - ADDOP_LOAD_CONST(c, p->v.Constant.value); - return 1; -} - - static int pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) { @@ -5647,9 +5631,9 @@ static int compiler_pattern_literal(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); - ADDOP(c, DUP_TOP); - RETURN_IF_FALSE(pattern_helper_load_constant(c, p, pc)); PyObject *v = p->v.Constant.value; + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST(c, v); // Literal True, False, and None are compared by identity. All others use // equality: ADDOP_COMPARE(c, (v == Py_None || PyBool_Check(v)) ? Is : Eq); @@ -5706,7 +5690,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } else { assert(key->kind == Constant_kind); - RETURN_IF_FALSE(pattern_helper_load_constant(c, key, pc)); + ADDOP_LOAD_CONST(c, key->v.Constant.value); } } ADDOP_I(c, BUILD_TUPLE, size - star); From cc3357ce51f5f867a521e95ce9d364e013edf246 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 10:23:30 -0800 Subject: [PATCH 204/218] !x -> x == NULL --- Python/ast_opt.c | 4 ++-- Python/ceval.c | 50 ++++++++++++++++++++++++------------------------ Python/compile.c | 16 ++++++++-------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 7ce97f75ed4934..6ad00dcf93cbdf 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -768,7 +768,7 @@ astfold_pattern_negative(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat PyFloat_CheckExact(value) || PyLong_CheckExact(value)); PyObject *negated = PyNumber_Negative(value); - if (!negated) { + if (negated == NULL) { return 0; } assert(PyComplex_CheckExact(negated) || @@ -803,7 +803,7 @@ astfold_pattern_complex(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state assert(node_->v.BinOp.op == Sub); new = PyNumber_Subtract(left->v.Constant.value, right->v.Constant.value); } - if (!new) { + if (new == NULL) { return 0; } assert(PyComplex_CheckExact(new)); diff --git a/Python/ceval.c b/Python/ceval.c index 2d6fdfdc1b6002..40051422e940a7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -902,22 +902,22 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // collections.defaultdict that define __missing__ (or similar). _Py_IDENTIFIER(get); PyObject *get = _PyObject_GetAttrId(map, &PyId_get); - if (!get) { + if (get == NULL) { return NULL; } PyObject *seen = NULL; PyObject *values = NULL; // dummy = object() PyObject *dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); - if (!dummy) { + if (dummy == NULL) { goto fail; } seen = PySet_New(NULL); - if (!seen) { + if (seen == NULL) { goto fail; } values = PyTuple_New(nkeys); - if (!values) { + if (values == NULL) { goto fail; } for (Py_ssize_t i = 0; i < nkeys; i++) { @@ -931,7 +931,7 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) goto fail; } PyObject *value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); - if (!value || value == dummy) { + if (value == NULL || value == dummy) { // Key not in map. Py_XDECREF(value); goto fail; @@ -959,7 +959,7 @@ dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // del copy[key] // return copy PyObject *copy = PyDict_New(); - if (!copy || PyDict_Update(copy, map)) { + if (copy == NULL || PyDict_Update(copy, map)) { Py_XDECREF(copy); return NULL; } @@ -990,7 +990,7 @@ get_match_args(PyThreadState *tstate, PyObject *type, PyObject **match_args, // elif match_args.__class__ is not tuple: // raise TypeError *match_args = PyObject_GetAttrString(type, "__match_args__"); - if (!*match_args) { + if (*match_args == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); // _Py_TPFLAGS_MATCH_SELF is only acknowledged if the type does not @@ -1039,7 +1039,7 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, return NULL; } PyObject *attr = PyObject_GetAttr(subject, name); - if (!attr && _PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { + if (attr == NULL && _PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { _PyErr_Clear(tstate); } return attr; @@ -1063,11 +1063,11 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, } // So far so good: PyObject *attrs = PyTuple_New(nargs + PyTuple_GET_SIZE(kwargs)); - if (!attrs) { + if (attrs == NULL) { return NULL; } PyObject *seen = PySet_New(NULL); - if (!seen) { + if (seen == NULL) { Py_DECREF(attrs); return NULL; } @@ -1108,7 +1108,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, } PyObject *attr = match_class_attr(tstate, subject, type, name, seen); - if (!attr) { + if (attr == NULL) { goto fail; } PyTuple_SET_ITEM(attrs, i, attr); @@ -1120,7 +1120,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(kwargs); i++) { PyObject *name = PyTuple_GET_ITEM(kwargs, i); PyObject *attr = match_class_attr(tstate, subject, type, name, seen); - if (!attr) { + if (attr == NULL) { goto fail; } PyTuple_SET_ITEM(attrs, nargs + i, attr); @@ -3873,7 +3873,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) goto error; } PyObject *len_o = PyLong_FromSsize_t(len_i); - if (!len_o) { + if (len_o == NULL) { goto error; } PUSH(len_o); @@ -3914,13 +3914,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // Lazily import _collections_abc.Mapping, and keep it handy on the // PyInterpreterState struct (it gets cleaned up at exit): PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->map_abc) { + if (interp->map_abc == NULL) { PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { + if (abc == NULL) { goto error; } interp->map_abc = PyObject_GetAttrString(abc, "Mapping"); - if (!interp->map_abc) { + if (interp->map_abc == NULL) { goto error; } } @@ -3958,13 +3958,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // Lazily import _collections_abc.Sequence, and keep it handy on the // PyInterpreterState struct (it gets cleaned up at exit): PyInterpreterState *interp = PyInterpreterState_Get(); - if (!interp->seq_abc) { + if (interp->seq_abc == NULL) { PyObject *abc = PyImport_ImportModule("_collections_abc"); - if (!abc) { + if (abc == NULL) { goto error; } interp->seq_abc = PyObject_GetAttrString(abc, "Sequence"); - if (!interp->seq_abc) { + if (interp->seq_abc == NULL) { goto error; } } @@ -3983,7 +3983,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PyObject *subject = SECOND(); assert(PyTuple_CheckExact(keys)); PyObject *values = match_keys(tstate, subject, keys); - if (!values) { + if (values == NULL) { if (_PyErr_Occurred(tstate)) { goto error; } @@ -3996,7 +3996,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // If oparg is nonzero, collect the remaining items into a dict // and put it on the stack where the subject used to be: PyObject *rest = dict_without_keys(tstate, subject, keys); - if (!rest) { + if (rest == NULL) { goto error; } assert(PyDict_CheckExact(rest)); @@ -4013,7 +4013,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) case TARGET(GET_INDEX): { // PUSH(TOS[oparg]) PyObject *item = PySequence_GetItem(TOP(), oparg); - if (!item) { + if (item == NULL) { goto error; } PUSH(item); @@ -4034,7 +4034,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } assert(0 <= len - 1 - oparg); PyObject *item = PySequence_GetItem(TOP(), len - 1 - oparg); - if (!item) { + if (item == NULL) { goto error; } PUSH(item); @@ -4054,7 +4054,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) Py_ssize_t size = len - (oparg >> 8) - start; assert(0 <= size); PyObject *slice = PyList_New(size); - if (!slice) { + if (slice == NULL) { goto error; } PyObject *subject = TOP(); @@ -4065,7 +4065,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // subjects. A fast path could pay off, if so. for (Py_ssize_t i = 0; i < size; i++) { PyObject *item = PySequence_GetItem(subject, start + i); - if (!item) { + if (item == NULL) { Py_DECREF(slice); goto error; } diff --git a/Python/compile.c b/Python/compile.c index 9aa762a68ab636..c56bb56169cac0 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5340,18 +5340,18 @@ compiler_error(struct compiler *c, const char *format, ...) #endif PyObject *msg = PyUnicode_FromFormatV(format, vargs); va_end(vargs); - if (!msg) { + if (msg == NULL) { return 0; } PyObject *loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno); - if (!loc) { + if (loc == NULL) { Py_INCREF(Py_None); loc = Py_None; } PyObject *args = Py_BuildValue("O(OiiO)", msg, c->c_filename, c->u->u_lineno, c->u->u_col_offset + 1, loc); Py_DECREF(msg); - if (!args) { + if (args == NULL) { goto exit; } PyErr_SetObject(PyExc_SyntaxError, args); @@ -5491,7 +5491,7 @@ pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) { assert(!_PyUnicode_EqualToASCIIString(n, "_")); // Can't assign to the same name twice: - if (!pc->stores) { + if (pc->stores == NULL) { RETURN_IF_FALSE(pc->stores = PySet_New(NULL)); } else { @@ -5680,7 +5680,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) // dotted names or literals: for (Py_ssize_t i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); - if (!key) { + if (key == NULL) { const char *e = "can't use starred name here " "(consider moving to end)"; return compiler_error(c, e); @@ -5758,7 +5758,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) pc->allow_irrefutable = allow_irrefutable && (i == size - 1); SET_LOC(c, alt); // The actual control flow is simple: - if (!pc->stores || + if (pc->stores == NULL || !compiler_pattern(c, alt, pc) || !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || !compiler_next_block(c)) @@ -5774,7 +5774,7 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) if (PySet_GET_SIZE(pc->stores) || PySet_GET_SIZE(control)) { // Otherwise, check to see if we differ from the control set: PyObject *diff = PyNumber_InPlaceXor(pc->stores, control); - if (!diff) { + if (diff == NULL) { goto fail; } if (PySet_GET_SIZE(diff)) { @@ -5995,7 +5995,7 @@ compiler_match(struct compiler *c, stmt_ty s) RETURN_IF_FALSE(next = compiler_new_block(c)); // If pc.allow_irrefutable is 0, any name captures against our subject // will raise. Irrefutable cases must be either guarded, last, or both: - pc.allow_irrefutable = !!m->guard || (i == cases - 1); + pc.allow_irrefutable = m->guard != NULL || i == cases - 1; int result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); RETURN_IF_FALSE(result); From 72b623c8157cd30e543d1ff8ff6ea4c79861c4f6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 10:43:30 -0800 Subject: [PATCH 205/218] pattern_helper_load_attr -> compiler_visit_expr --- Python/compile.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index c56bb56169cac0..62fc18a3c99e70 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5468,24 +5468,6 @@ compiler_slice(struct compiler *c, expr_ty s) _PyUnicode_EqualToASCIIString((N)->v.Name.id, "_")) -static int -pattern_helper_load_attr(struct compiler *c, expr_ty p, pattern_context *pc) -{ - assert(p->kind == Attribute_kind); - assert(p->v.Attribute.ctx == Load); - if (p->v.Attribute.value->kind == Attribute_kind) { - RETURN_IF_FALSE(pattern_helper_load_attr(c, p->v.Attribute.value, pc)); - } - else { - assert(p->v.Attribute.value->kind == Name_kind); - assert(p->v.Attribute.value->v.Name.ctx == Load); - RETURN_IF_FALSE(compiler_nameop(c, p->v.Attribute.value->v.Name.id, Load)); - } - ADDOP_NAME(c, LOAD_ATTR, p->v.Attribute.attr, names); - return 1; -} - - static int pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) { @@ -5571,15 +5553,7 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) RETURN_IF_FALSE(!validate_keywords(c, kwargs)); basicblock *end; RETURN_IF_FALSE(end = compiler_new_block(c)); - // The name of the class can only be an (optionally dotted) name: - if (p->v.Call.func->kind == Attribute_kind) { - RETURN_IF_FALSE(pattern_helper_load_attr(c, p->v.Call.func, pc)); - } - else { - assert(p->v.Call.func->kind == Name_kind); - assert(p->v.Call.func->v.Name.ctx == Load); - RETURN_IF_FALSE(compiler_nameop(c, p->v.Call.func->v.Name.id, Load)); - } + VISIT(c, expr, p->v.Call.func); PyObject *kwnames; RETURN_IF_FALSE(kwnames = PyTuple_New(nkwargs)); Py_ssize_t i; @@ -5685,13 +5659,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) "(consider moving to end)"; return compiler_error(c, e); } - if (key->kind == Attribute_kind) { - RETURN_IF_FALSE(pattern_helper_load_attr(c, key, pc)); - } - else { - assert(key->kind == Constant_kind); - ADDOP_LOAD_CONST(c, key->v.Constant.value); - } + VISIT(c, expr, key); } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP_I(c, MATCH_KEYS, star); @@ -5914,7 +5882,7 @@ compiler_pattern_value(struct compiler *c, expr_ty p, pattern_context *pc) assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); ADDOP(c, DUP_TOP); - RETURN_IF_FALSE(pattern_helper_load_attr(c, p, pc)); + VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); return 1; } From 93cefc16a92607d44b4471f25e06ef8c1684813c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 11:59:21 -0800 Subject: [PATCH 206/218] GET_INDEX/GET_INDEX_END -> BINARY_SUBSCR --- Doc/library/dis.rst | 15 --------------- Include/opcode.h | 2 -- Lib/opcode.py | 3 +-- Python/ceval.c | 34 +++------------------------------- Python/compile.c | 25 ++++++++++++++++--------- Python/opcode_targets.h | 4 ++-- 6 files changed, 22 insertions(+), 61 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index b370ff31a77c68..2c8ca27015bc74 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1216,21 +1216,6 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: GET_INDEX (i) - - TOS is a sequence. Push ``TOS[i]`` onto the stack. - - .. versionadded:: 3.10 - - -.. opcode:: GET_INDEX_END (i) - - TOS is a sequence, and TOS1 is its length. Push ``TOS[TOS1 - 1 - i]`` onto - the stack. - - .. versionadded:: 3.10 - - .. opcode:: GET_INDEX_SLICE (i) TOS is a sequence, and TOS1 is its length. Push a list formed from diff --git a/Include/opcode.h b/Include/opcode.h index dd437b2778dbff..b42e2a51cb2554 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -120,8 +120,6 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 -#define GET_INDEX 149 -#define GET_INDEX_END 150 #define GET_INDEX_SLICE 151 #define MATCH_CLASS 152 #define MATCH_KEYS 153 diff --git a/Lib/opcode.py b/Lib/opcode.py index 42ff52d44db953..6a2a31f76317d7 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -195,8 +195,7 @@ def jabs_op(name, op): def_op('MAP_ADD', 147) def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('GET_INDEX', 149) -def_op('GET_INDEX_END', 150) + def_op('GET_INDEX_SLICE', 151) def_op('MATCH_CLASS', 152) def_op('MATCH_KEYS', 153) diff --git a/Python/ceval.c b/Python/ceval.c index 40051422e940a7..2ef25a1c28927a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4010,19 +4010,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(GET_INDEX): { - // PUSH(TOS[oparg]) - PyObject *item = PySequence_GetItem(TOP(), oparg); - if (item == NULL) { - goto error; - } - PUSH(item); - DISPATCH(); - } - - case TARGET(GET_INDEX_END): { - // PUSH(TOS[TOS1 - 1 - oparg]) - // NOTE: We can't rely on support for negative indexing! + case TARGET(GET_INDEX_SLICE): { + // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) + // NOTE: We can't rely on support for slicing or negative indexing! // Although PySequence_GetItem tries to correct negative indexes, we // just use the length we already have at TOS1. In addition to // avoiding tons of redundant __len__ calls, this also handles @@ -4032,24 +4022,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (len < 0) { goto error; } - assert(0 <= len - 1 - oparg); - PyObject *item = PySequence_GetItem(TOP(), len - 1 - oparg); - if (item == NULL) { - goto error; - } - PUSH(item); - DISPATCH(); - } - - case TARGET(GET_INDEX_SLICE): { - // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) - // NOTE: We can't rely on support for slicing or negative indexing! - // Ditto GET_INDEX_END's length handling. - assert(PyLong_CheckExact(SECOND())); - Py_ssize_t len = PyLong_AsSsize_t(SECOND()); - if (len < 0) { - goto error; - } Py_ssize_t start = oparg & 0xFF; Py_ssize_t size = len - (oparg >> 8) - start; assert(0 <= size); diff --git a/Python/compile.c b/Python/compile.c index 62fc18a3c99e70..49005cb8ce4cc4 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1162,8 +1162,6 @@ stack_effect(int opcode, int oparg, int jump) return 1; case MATCH_CLASS: return 0; - case GET_INDEX: - case GET_INDEX_END: case GET_INDEX_SLICE: case MATCH_KEYS: case MATCH_MAPPING: @@ -5581,7 +5579,9 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) continue; } // Get the i-th attribute, and match it against the i-th pattern: - ADDOP_I(c, GET_INDEX, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); RETURN_IF_FALSE(compiler_pattern_subpattern(c, arg, pc)); // TOS is True or False, with the attribute beneath. Pop the attribute, // we're done with it: @@ -5666,13 +5666,15 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); NEXT_BLOCK(c); // So far so good. There's now a tuple of values on the stack to match - // sub-patterns against. Extract them using GET_INDEX: + // sub-patterns against: for (Py_ssize_t i = 0; i < size - star; i++) { expr_ty value = asdl_seq_GET(values, i); if (WILDCARD_CHECK(value)) { continue; } - ADDOP_I(c, GET_INDEX, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); // TOS is True or False. Don't care about the value underneath anymore: ADDOP(c, ROT_TWO); @@ -5804,7 +5806,7 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) } basicblock *wrong_size; RETURN_IF_FALSE(wrong_size = compiler_new_block(c)); - // Duplicate the length, since both the length check and the GET_INDEX_* + // Duplicate the length, since both the length check and the BINARY_SUBSCR // instructions need it: ADDOP(c, DUP_TOP) if (star < 0) { @@ -5830,7 +5832,9 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) continue; } if (star < 0 || i < star) { - ADDOP_I(c, GET_INDEX, i); + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + ADDOP(c, BINARY_SUBSCR); } else if (i == star) { assert(value->kind == Starred_kind); @@ -5849,8 +5853,11 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_I(c, GET_INDEX_SLICE, end_items + i); } else { - // Basically a negative index: - ADDOP_I(c, GET_INDEX_END, size - 1 - i); + ADDOP(c, DUP_TOP_TWO); + ADDOP(c, ROT_TWO); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i)); + ADDOP(c, BINARY_SUBTRACT); + ADDOP(c, BINARY_SUBSCR); } RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); // TOS is True or False. We're done with the item underneath: diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 2f6cbca2992d4d..f568b4a3a95e73 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -148,8 +148,8 @@ static void *opcode_targets[256] = { &&TARGET_SET_ADD, &&TARGET_MAP_ADD, &&TARGET_LOAD_CLASSDEREF, - &&TARGET_GET_INDEX, - &&TARGET_GET_INDEX_END, + &&_unknown_opcode, + &&_unknown_opcode, &&TARGET_GET_INDEX_SLICE, &&TARGET_MATCH_CLASS, &&TARGET_MATCH_KEYS, From 62372c26d9238348cad4c6a67d1088e3d477a591 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 14:33:06 -0800 Subject: [PATCH 207/218] MATCH_KEYS -> MATCH_KEYS/COPY_DICT_WITHOUT_KEYS --- Doc/library/dis.rst | 31 +++++++++------- Include/opcode.h | 3 +- Lib/opcode.py | 4 ++- Python/ceval.c | 79 ++++++++++++++++++----------------------- Python/compile.c | 26 +++++++------- Python/opcode_targets.h | 6 ++-- 6 files changed, 74 insertions(+), 75 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 2c8ca27015bc74..165b6395a5dc15 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -752,6 +752,15 @@ iterations of the loop. .. versionadded:: 3.2 +.. opcode:: COPY_DICT_WITHOUT_KEYS + + TOS is a tuple of mapping keys, and TOS1 is the match subject. Replace TOS + with a :class:`dict` formed from the items of TOS1, but without any of the + keys in TOS. + + .. versionadded:: 3.10 + + .. opcode:: GET_LEN Push ``len(TOS)`` onto the stack. @@ -776,6 +785,16 @@ iterations of the loop. .. versionadded:: 3.10 +.. opcode:: MATCH_KEYS + + TOS is a tuple of mapping keys, and TOS1 is the match subject. If TOS1 + contains all of the keys in TOS, push a :class:`tuple` containing the + corresponding values, followed by ``True``. Otherwise, push ``None``, + followed by ``False``. + + .. versionadded:: 3.10 + + All of the following opcodes use their arguments. .. opcode:: STORE_NAME (namei) @@ -1238,18 +1257,6 @@ All of the following opcodes use their arguments. .. versionadded:: 3.10 -.. opcode:: MATCH_KEYS (copy) - - TOS is a tuple of mapping keys, and TOS1 is the match subject. If TOS1 - contains all of the keys in TOS, replace TOS with a tuple containing the - corresponding values and push ``True``. Otherwise, push ``False``. - - If *copy* is non-zero, gather remaining items into a :class:`dict` and put it - on the stack where the subject used to be. - - .. versionadded:: 3.10 - - .. opcode:: HAVE_ARGUMENT This is not really an opcode. It identifies the dividing line between diff --git a/Include/opcode.h b/Include/opcode.h index b42e2a51cb2554..ac6919bdf07200 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -33,6 +33,8 @@ extern "C" { #define GET_LEN 30 #define MATCH_MAPPING 31 #define MATCH_SEQUENCE 32 +#define MATCH_KEYS 33 +#define COPY_DICT_WITHOUT_KEYS 34 #define WITH_EXCEPT_START 49 #define GET_AITER 50 #define GET_ANEXT 51 @@ -122,7 +124,6 @@ extern "C" { #define LOAD_CLASSDEREF 148 #define GET_INDEX_SLICE 151 #define MATCH_CLASS 152 -#define MATCH_KEYS 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 diff --git a/Lib/opcode.py b/Lib/opcode.py index 6a2a31f76317d7..30693c64311885 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -84,6 +84,8 @@ def jabs_op(name, op): def_op('GET_LEN', 30) def_op('MATCH_MAPPING', 31) def_op('MATCH_SEQUENCE', 32) +def_op('MATCH_KEYS', 33) +def_op('COPY_DICT_WITHOUT_KEYS', 34) def_op('WITH_EXCEPT_START', 49) def_op('GET_AITER', 50) @@ -198,7 +200,7 @@ def jabs_op(name, op): def_op('GET_INDEX_SLICE', 151) def_op('MATCH_CLASS', 152) -def_op('MATCH_KEYS', 153) + jrel_op('SETUP_ASYNC_WITH', 154) def_op('FORMAT_VALUE', 155) def_op('BUILD_CONST_KEY_MAP', 156) diff --git a/Python/ceval.c b/Python/ceval.c index 2ef25a1c28927a..2f901298c597e7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -951,29 +951,6 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } -static PyObject* -dict_without_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) -{ - // copy = dict(map) - // for key in keys: - // del copy[key] - // return copy - PyObject *copy = PyDict_New(); - if (copy == NULL || PyDict_Update(copy, map)) { - Py_XDECREF(copy); - return NULL; - } - // This may seem a bit inefficient, but keys is rarely big enough to - // actually impact runtime. - for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(keys); i++) { - if (PyDict_DelItem(copy, PyTuple_GET_ITEM(keys, i))) { - Py_DECREF(copy); - return NULL; - } - } - return copy; -} - static int get_match_args(PyThreadState *tstate, PyObject *type, PyObject **match_args, int *match_self) @@ -3977,36 +3954,50 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_KEYS): { - // Final stage of mapping pattern matches (after Mapping and length - // checks): extract the desired values for further destructuring. + // On successful match for all keys, PUSH(values) and PUSH(True). + // Otherwise, PUSH(None) and PUSH(False). PyObject *keys = TOP(); PyObject *subject = SECOND(); - assert(PyTuple_CheckExact(keys)); PyObject *values = match_keys(tstate, subject, keys); - if (values == NULL) { - if (_PyErr_Occurred(tstate)) { - goto error; - } - Py_INCREF(Py_False); - PUSH(Py_False); + if (values) { + Py_INCREF(Py_True); + PUSH(values); + PUSH(Py_True); DISPATCH(); } - // Success! - if (oparg) { - // If oparg is nonzero, collect the remaining items into a dict - // and put it on the stack where the subject used to be: - PyObject *rest = dict_without_keys(tstate, subject, keys); - if (rest == NULL) { + if (_PyErr_Occurred(tstate)) { + goto error; + } + Py_INCREF(Py_None); + Py_INCREF(Py_False); + PUSH(Py_None); + PUSH(Py_False); + DISPATCH(); + } + + case TARGET(COPY_DICT_WITHOUT_KEYS): { + // rest = dict(TOS1) + // for key in TOS: + // del rest[key] + // SET_TOP(rest) + PyObject *keys = TOP(); + PyObject *subject = SECOND(); + PyObject *rest = PyDict_New(); + if (rest == NULL || PyDict_Update(rest, subject)) { + Py_XDECREF(rest); + goto error; + } + // This may seem a bit inefficient, but keys is rarely big enough to + // actually impact runtime. + assert(PyTuple_CheckExact(keys)); + for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(keys); i++) { + if (PyDict_DelItem(rest, PyTuple_GET_ITEM(keys, i))) { + Py_DECREF(rest); goto error; } - assert(PyDict_CheckExact(rest)); - SET_SECOND(rest); - Py_DECREF(subject); } - SET_TOP(values); Py_DECREF(keys); - Py_INCREF(Py_True); - PUSH(Py_True); + SET_TOP(rest); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index 49005cb8ce4cc4..4406d89a5e0ea6 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1158,15 +1158,16 @@ stack_effect(int opcode, int oparg, int jump) case DICT_MERGE: case DICT_UPDATE: return -1; - case GET_LEN: - return 1; + case COPY_DICT_WITHOUT_KEYS: case MATCH_CLASS: return 0; case GET_INDEX_SLICE: - case MATCH_KEYS: + case GET_LEN: case MATCH_MAPPING: case MATCH_SEQUENCE: return 1; + case MATCH_KEYS: + return 2; default: return PY_INVALID_STACK_EFFECT; } @@ -5646,12 +5647,8 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) if (INT_MAX < size - star - 1) { return compiler_error(c, "too many sub-patterns in mapping pattern"); } - // If we have a starred pattern, MATCH_KEYS *could* replace the subject on - // the stack with a dict of remaining keys. Duplicate it so we don't lose - // the subject: - ADDOP(c, DUP_TOP); - // Collect all of the keys into a tuple for MATCH_KEYS. They can either be - // dotted names or literals: + // Collect all of the keys into a tuple for MATCH_KEYS and + // COPY_DICT_WITHOUT_KEYS. They can either be dotted names or literals: for (Py_ssize_t i = 0; i < size - star; i++) { expr_ty key = asdl_seq_GET(keys, i); if (key == NULL) { @@ -5662,7 +5659,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) VISIT(c, expr, key); } ADDOP_I(c, BUILD_TUPLE, size - star); - ADDOP_I(c, MATCH_KEYS, star); + ADDOP(c, MATCH_KEYS); ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); NEXT_BLOCK(c); // So far so good. There's now a tuple of values on the stack to match @@ -5685,19 +5682,20 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) // If we get this far, it's a match! We're done with that tuple of values. ADDOP(c, POP_TOP); if (star) { - // There's now one of two things on TOS. If we had a starred name, it's - // a dict of remaining items to bind: + // If we had a starred name, bind a dict of remaining items to it: + ADDOP(c, COPY_DICT_WITHOUT_KEYS); PyObject *id = asdl_seq_GET(values, size - 1)->v.Name.id; RETURN_IF_FALSE(pattern_helper_store_name(c, id, pc)); } else { - // Otherwise, it's just another reference to the subject underneath. + // Otherwise, we don't care about this tuple of keys anymore: ADDOP(c, POP_TOP); } ADDOP_LOAD_CONST(c, Py_True); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, fail); - // The top two items are a tuple of values, and a mapping. Pop them both: + // The top two items are a tuple of values or None, followed by a tuple of + // keys. Pop them both: ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_False); diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index f568b4a3a95e73..96196fa172cb99 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -32,8 +32,8 @@ static void *opcode_targets[256] = { &&TARGET_GET_LEN, &&TARGET_MATCH_MAPPING, &&TARGET_MATCH_SEQUENCE, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_MATCH_KEYS, + &&TARGET_COPY_DICT_WITHOUT_KEYS, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, @@ -152,7 +152,7 @@ static void *opcode_targets[256] = { &&_unknown_opcode, &&TARGET_GET_INDEX_SLICE, &&TARGET_MATCH_CLASS, - &&TARGET_MATCH_KEYS, + &&_unknown_opcode, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, From 2a5d0dd0537386f19b944228b2e04b7a3aec252a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 15:33:42 -0800 Subject: [PATCH 208/218] Clean up MATCH_KEYS --- Python/ceval.c | 61 ++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 2f901298c597e7..f088e2d66b000a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -896,6 +896,9 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // No keys means no items. return PyTuple_New(0); } + PyObject *seen = NULL; + PyObject *dummy = NULL; + PyObject *values = NULL; // We use the two argument form of map.get(key, default) for two reasons: // - Atomically check for a key and get its value without error handling. // - Don't cause key creation or resizing in dict subclasses like @@ -903,19 +906,17 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) _Py_IDENTIFIER(get); PyObject *get = _PyObject_GetAttrId(map, &PyId_get); if (get == NULL) { - return NULL; - } - PyObject *seen = NULL; - PyObject *values = NULL; - // dummy = object() - PyObject *dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); - if (dummy == NULL) { goto fail; } seen = PySet_New(NULL); if (seen == NULL) { goto fail; } + // dummy = object() + dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); + if (dummy == NULL) { + goto fail; + } values = PyTuple_New(nkeys); if (values == NULL) { goto fail; @@ -931,20 +932,27 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) goto fail; } PyObject *value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL); - if (value == NULL || value == dummy) { - // Key not in map. - Py_XDECREF(value); + if (value == NULL) { goto fail; } + if (value == dummy) { + // key not in map! + Py_DECREF(value); + Py_DECREF(values); + // Return None: + Py_INCREF(Py_None); + values = Py_None; + break; + } PyTuple_SET_ITEM(values, i, value); } - // Success. + // Success: Py_DECREF(get); Py_DECREF(dummy); Py_DECREF(seen); return values; fail: - Py_DECREF(get); + Py_XDECREF(get); Py_XDECREF(dummy); Py_XDECREF(seen); Py_XDECREF(values); @@ -956,10 +964,10 @@ get_match_args(PyThreadState *tstate, PyObject *type, PyObject **match_args, int *match_self) { // try: - // match_args = type.__match_args__ + // match_args = type.__match_args__ // except AttributeError: - // match_self = type.__flags__ & _Py_TPFLAGS_MATCH_SELF - // match_args = () + // match_self = type.__flags__ & _Py_TPFLAGS_MATCH_SELF + // match_args = () // else: // match_self = 0 // if match_args.__class__ is list: @@ -3958,20 +3966,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) // Otherwise, PUSH(None) and PUSH(False). PyObject *keys = TOP(); PyObject *subject = SECOND(); - PyObject *values = match_keys(tstate, subject, keys); - if (values) { - Py_INCREF(Py_True); - PUSH(values); - PUSH(Py_True); - DISPATCH(); - } - if (_PyErr_Occurred(tstate)) { + PyObject *values_or_none = match_keys(tstate, subject, keys); + if (values_or_none == NULL) { goto error; } - Py_INCREF(Py_None); - Py_INCREF(Py_False); - PUSH(Py_None); - PUSH(Py_False); + PUSH(values_or_none); + if (values_or_none == Py_None) { + Py_INCREF(Py_False); + PUSH(Py_False); + DISPATCH(); + } + assert(PyTuple_CheckExact(values_or_none)); + Py_INCREF(Py_True); + PUSH(Py_True); DISPATCH(); } From fa97ee3ae1cf154407926507aedea5437253a9cb Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 12 Feb 2021 22:52:14 -0800 Subject: [PATCH 209/218] Refactor sequence matches to use existing ops --- Doc/library/dis.rst | 9 --- Include/opcode.h | 1 - Lib/opcode.py | 1 - Lib/test/test_patma.py | 37 +++++++-- Python/ceval.c | 37 --------- Python/compile.c | 170 ++++++++++++++++++++++++++-------------- Python/opcode_targets.h | 2 +- 7 files changed, 142 insertions(+), 115 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 165b6395a5dc15..6f94ee61bff49f 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1235,15 +1235,6 @@ All of the following opcodes use their arguments. .. versionadded:: 3.6 -.. opcode:: GET_INDEX_SLICE (i) - - TOS is a sequence, and TOS1 is its length. Push a list formed from - ``TOS[x:TOS1 - 1 - y]`` onto the stack, where *x* is the low byte of *i* and - *y* is the high bytes of *i*. - - .. versionadded:: 3.10 - - .. opcode:: MATCH_CLASS (count) TOS is a tuple of keyword attribute names, TOS1 is the class being matched diff --git a/Include/opcode.h b/Include/opcode.h index ac6919bdf07200..ea484c5a68fc96 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -122,7 +122,6 @@ extern "C" { #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 -#define GET_INDEX_SLICE 151 #define MATCH_CLASS 152 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 diff --git a/Lib/opcode.py b/Lib/opcode.py index 30693c64311885..b1197129571cd3 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -198,7 +198,6 @@ def jabs_op(name, op): def_op('LOAD_CLASSDEREF', 148) hasfree.append(148) -def_op('GET_INDEX_SLICE', 151) def_op('MATCH_CLASS', 152) jrel_op('SETUP_ASYNC_WITH', 154) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index ac53093f857f58..29d70c7fee1c87 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -1840,12 +1840,11 @@ def __getitem__(self, i): def __len__(self): return 42 match Seq(): - case [x, *y, z]: - w = 0 - self.assertEqual(w, 0) + case [x, *_, y]: + z = 0 self.assertEqual(x, 0) - self.assertEqual(y, list(range(1, 41))) - self.assertEqual(z, 41) + self.assertEqual(y, 41) + self.assertEqual(z, 0) def test_patma_187(self): w = range(10) @@ -2803,6 +2802,34 @@ def test_patma_277(self): self.assertEqual(y, 0) self.assertEqual(z, 0) + def test_patma_278(self): + x = range(3) + match x: + case [y, *_, z]: + w = 0 + self.assertEqual(w, 0) + self.assertEqual(x, range(3)) + self.assertEqual(y, 0) + self.assertEqual(z, 2) + + def test_patma_279(self): + x = range(3) + match x: + case [_, *_, y]: + z = 0 + self.assertEqual(x, range(3)) + self.assertEqual(y, 2) + self.assertEqual(z, 0) + + def test_patma_280(self): + x = range(3) + match x: + case [*_, y]: + z = 0 + self.assertEqual(x, range(3)) + self.assertEqual(y, 2) + self.assertEqual(z, 0) + class PerfPatma(TestPatma): diff --git a/Python/ceval.c b/Python/ceval.c index f088e2d66b000a..5b52e0e8ec30d4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4008,43 +4008,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) DISPATCH(); } - case TARGET(GET_INDEX_SLICE): { - // PUSH(list(TOS[oparg & 0xFF: TOS1 - (oparg >> 8)])) - // NOTE: We can't rely on support for slicing or negative indexing! - // Although PySequence_GetItem tries to correct negative indexes, we - // just use the length we already have at TOS1. In addition to - // avoiding tons of redundant __len__ calls, this also handles - // length changes during extraction more intuitively. - assert(PyLong_CheckExact(SECOND())); - Py_ssize_t len = PyLong_AsSsize_t(SECOND()); - if (len < 0) { - goto error; - } - Py_ssize_t start = oparg & 0xFF; - Py_ssize_t size = len - (oparg >> 8) - start; - assert(0 <= size); - PyObject *slice = PyList_New(size); - if (slice == NULL) { - goto error; - } - PyObject *subject = TOP(); - // NOTE: Fast path for lists and tuples showed no perf improvement, - // likely because test_patma's star-unpacking examples are too small - // to make a difference. It will be interesting to see if real-world - // code commonly uses star-unpacking in patterns with big list/tuple - // subjects. A fast path could pay off, if so. - for (Py_ssize_t i = 0; i < size; i++) { - PyObject *item = PySequence_GetItem(subject, start + i); - if (item == NULL) { - Py_DECREF(slice); - goto error; - } - PyList_SET_ITEM(slice, i, item); - } - PUSH(slice); - DISPATCH(); - } - case TARGET(GET_ITER): { /* before: [obj]; after [getiter(obj)] */ PyObject *iterable = TOP(); diff --git a/Python/compile.c b/Python/compile.c index 4406d89a5e0ea6..2bbbe6bdb6c01a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1161,7 +1161,6 @@ stack_effect(int opcode, int oparg, int jump) case COPY_DICT_WITHOUT_KEYS: case MATCH_CLASS: return 0; - case GET_INDEX_SLICE: case GET_LEN: case MATCH_MAPPING: case MATCH_SEQUENCE: @@ -3783,12 +3782,11 @@ starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed, } static int -assignment_helper(struct compiler *c, asdl_expr_seq *elts) +unpack_helper(struct compiler *c, asdl_expr_seq *elts) { Py_ssize_t n = asdl_seq_LEN(elts); - Py_ssize_t i; int seen_star = 0; - for (i = 0; i < n; i++) { + for (Py_ssize_t i = 0; i < n; i++) { expr_ty elt = asdl_seq_GET(elts, i); if (elt->kind == Starred_kind && !seen_star) { if ((i >= (1 << 8)) || @@ -3807,7 +3805,15 @@ assignment_helper(struct compiler *c, asdl_expr_seq *elts) if (!seen_star) { ADDOP_I(c, UNPACK_SEQUENCE, n); } - for (i = 0; i < n; i++) { + return 1; +} + +static int +assignment_helper(struct compiler *c, asdl_expr_seq *elts) +{ + Py_ssize_t n = asdl_seq_LEN(elts); + RETURN_IF_FALSE(unpack_helper(c, elts)); + for (Py_ssize_t i = 0; i < n; i++) { expr_ty elt = asdl_seq_GET(elts, i); VISIT(c, expr, elt->kind != Starred_kind ? elt : elt->v.Starred.value); } @@ -5778,105 +5784,147 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) Py_ssize_t size = asdl_seq_LEN(values); // Find a starred name, if it exists. There may be at most one: Py_ssize_t star = -1; + int star_wildcard = 0; + int all_wildcard = 1; + int needs_len = 0; for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); if (value->kind != Starred_kind) { + int wildcard = WILDCARD_CHECK(value); + all_wildcard &= wildcard; + needs_len |= 0 <= star && !wildcard; continue; } - if (star >= 0) { + if (0 <= star) { const char *e = "multiple starred names in sequence pattern"; return compiler_error(c, e); } + star_wildcard = WILDCARD_CHECK(value->v.Starred.value); + all_wildcard &= star_wildcard; star = i; } + needs_len &= star_wildcard && star != size - 1; basicblock *end; RETURN_IF_FALSE(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + basicblock *needs_len_fail = NULL; + if (needs_len) { + RETURN_IF_FALSE(needs_len_fail = compiler_new_block(c)); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, needs_len_fail); + } + else { + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); //* + } + NEXT_BLOCK(c); - ADDOP(c, GET_LEN); - if (!size) { - // Empty sequences only require a length check: - ADDOP_LOAD_CONST(c, _PyLong_GetZero()); - ADDOP_COMPARE(c, Eq); + if (size == 1 && 0 <= star) { + // [*_] or [*x] + if (!star_wildcard) { + // [*x] + ADDOP_I(c, UNPACK_EX, 0); + expr_ty value = asdl_seq_GET(values, 0)->v.Starred.value; + RETURN_IF_FALSE(compiler_pattern_capture(c, value, pc)); + } + else { + ADDOP_LOAD_CONST(c, Py_True); + } compiler_use_next_block(c, end); return 1; } - basicblock *wrong_size; - RETURN_IF_FALSE(wrong_size = compiler_new_block(c)); - // Duplicate the length, since both the length check and the BINARY_SUBSCR - // instructions need it: - ADDOP(c, DUP_TOP) + ADDOP(c, GET_LEN); + if (needs_len) { + // Duplicate the length and put it underneath the subject (at TOS2), + // since both the length check and BINARY_SUBSCR need it: + ADDOP(c, DUP_TOP); + ADDOP(c, ROT_THREE); + } if (star < 0) { + // No star: len(subject) == size ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); } else { + // Star: len(subject) >= size - 1 ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); } - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, wrong_size); + if (all_wildcard) { + // [], [_], [_, _], [_, *_], [_, _, *_], etc. + compiler_use_next_block(c, end); + return 1; + } + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); - if (INT_MAX < size - 1) { - return compiler_error(c, "too many sub-patterns in sequence pattern"); + basicblock **fails = NULL; + if (!star_wildcard) { + ADDOP(c, DUP_TOP); + RETURN_IF_FALSE(unpack_helper(c, values)); + fails = (basicblock **)PyObject_Malloc(sizeof(basicblock *) * (size)); + for (Py_ssize_t i = 0; i < size; i++) { + RETURN_IF_FALSE(fails[i] = compiler_new_block(c)); + } } - basicblock *fail; - RETURN_IF_FALSE(fail = compiler_new_block(c)); - ADDOP(c, ROT_TWO); - // TOS is subject, length underneath. for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); - if (WILDCARD_CHECK(value)) { - continue; - } - if (star < 0 || i < star) { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + if (star_wildcard) { + if (i == star || WILDCARD_CHECK(value)) { + continue; + } + if (i < star) { + ADDOP(c, DUP_TOP); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + } + else { + assert(needs_len); + // TOS is subject, length underneath. + ADDOP(c, DUP_TOP_TWO); + ADDOP(c, ROT_TWO); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i)); + ADDOP(c, BINARY_SUBTRACT); + } ADDOP(c, BINARY_SUBSCR); } + else if (WILDCARD_CHECK(value)) { + ADDOP(c, POP_TOP); + continue; + } else if (i == star) { assert(value->kind == Starred_kind); value = value->v.Starred.value; - if (WILDCARD_CHECK(value)) { - continue; - } - Py_ssize_t end_items = ((size - 1 - i) << 8); - if (0xFF <= i || INT_MAX <= end_items) { - // Technical limits are 0xFF patterns to the left of the star, - // one starred pattern, and 0xFFFFFF patterns to the right of - // the star... same as UNPACK_EX. - const char* e = "too many sub-patterns in sequence pattern"; - return compiler_error(c, e); - } - ADDOP_I(c, GET_INDEX_SLICE, end_items + i); - } - else { - ADDOP(c, DUP_TOP_TWO); - ADDOP(c, ROT_TWO); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i)); - ADDOP(c, BINARY_SUBTRACT); - ADDOP(c, BINARY_SUBSCR); } RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); // TOS is True or False. We're done with the item underneath: ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail) + if (star_wildcard) { + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + } + else { + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fails[i]); + } NEXT_BLOCK(c); } - // Success! TOS is subject, length undeneath. Pop the length: - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); + // Success! ADDOP_LOAD_CONST(c, Py_True); - ADDOP_JUMP(c, JUMP_FORWARD, end); - compiler_use_next_block(c, fail); - // TOS is subject, length undeneath. Pop the length: - ADDOP(c, ROT_TWO); - compiler_use_next_block(c, wrong_size); - // TOS is the subject's length. Pop it: - ADDOP(c, POP_TOP); - ADDOP_LOAD_CONST(c, Py_False); + if (!star_wildcard) { + ADDOP_JUMP(c, JUMP_FORWARD, end); + for (Py_ssize_t i = 0; i < size - 1; i++) { + compiler_use_next_block(c, fails[i]); + ADDOP(c, POP_TOP); + } + compiler_use_next_block(c, fails[size - 1]); + ADDOP_LOAD_CONST(c, Py_False); + PyObject_Free(fails); + } compiler_use_next_block(c, end); + if (needs_len) { + // TOS is True/False, subject underneath, length underneath (at TOS2). + // Pop the length: + ADDOP(c, ROT_THREE); + ADDOP(c, ROT_THREE); + ADDOP(c, POP_TOP); + compiler_use_next_block(c, needs_len_fail); + } return 1; } diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 96196fa172cb99..692442ac8c1b82 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -150,7 +150,7 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_CLASSDEREF, &&_unknown_opcode, &&_unknown_opcode, - &&TARGET_GET_INDEX_SLICE, + &&_unknown_opcode, &&TARGET_MATCH_CLASS, &&_unknown_opcode, &&TARGET_SETUP_ASYNC_WITH, From 0de83a2181fddaa28f7517a2f0317e816b92629c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 15 Feb 2021 12:55:29 -0800 Subject: [PATCH 210/218] Clean up compiler_pattern_sequence --- Python/compile.c | 271 ++++++++++++++++++++++++++--------------------- 1 file changed, 153 insertions(+), 118 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 2bbbe6bdb6c01a..22c19d60f69737 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -255,6 +255,8 @@ static int compiler_async_comprehension_generator( static int compiler_pattern(struct compiler *, expr_ty, pattern_context *); static int compiler_match(struct compiler *, stmt_ty); +static int compiler_pattern_subpattern(struct compiler *, expr_ty, + pattern_context *); static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__, *__annotations__; @@ -5497,6 +5499,131 @@ pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc) } +static int +pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, + Py_ssize_t star, pattern_context *pc) +{ + ADDOP(c, DUP_TOP); + RETURN_IF_FALSE(unpack_helper(c, values)); + // We've now got a bunch of new subjects on the stack. If any of them fail + // to match, we need to pop everything else off, then finally push False. + // fails is an array of blocks that correspond to the necessary amount of + // popping for each element: + basicblock **fails; + Py_ssize_t size = asdl_seq_LEN(values); + fails = (basicblock **)PyObject_Malloc(sizeof(basicblock*) * size); + if (fails == NULL) { + PyErr_NoMemory(); + return 0; + } + // NOTE: Can't use our nice returning macros anymore: they'll leak memory! + // goto error on error. + for (Py_ssize_t i = 0; i < size; i++) { + fails[i] = compiler_new_block(c); + if (fails[i] == NULL) { + goto error; + } + } + for (Py_ssize_t i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (i == star) { + assert(value->kind == Starred_kind); + value = value->v.Starred.value; + } + if (WILDCARD_CHECK(value)) { + if (!compiler_addop(c, POP_TOP)) { + goto error; + } + continue; + } + if (!compiler_pattern_subpattern(c, value, pc) || + // TOS is True or False. We're done with the item underneath: + !compiler_addop(c, ROT_TWO) || + !compiler_addop(c, POP_TOP) || + !compiler_addop_j(c, POP_JUMP_IF_FALSE, fails[i]) || + compiler_next_block(c) == NULL) + { + goto error; + } + } + // Success! + basicblock *end; + RETURN_IF_FALSE(end = compiler_new_block(c)); + if (!compiler_addop_load_const(c, Py_True) || + !compiler_addop_j(c, JUMP_FORWARD, end)) + { + goto error; + } + // This is where we handle failed sub-patterns. For a sequence pattern like + // [a, b, c, d], this will look like: + // fails[0]: POP_TOP # <- Jump here if a fails, and fall through. + // fails[1]: POP_TOP # <- Jump here if b fails, and fall through. + // fails[2]: POP_TOP # <- Jump here if c fails, and fall through. + // fails[3]: LOAD_CONST False # <- Jump here if d fails, and fall through. + for (Py_ssize_t i = 0; i < size - 1; i++) { + compiler_use_next_block(c, fails[i]); + if (!compiler_addop(c, POP_TOP)) { + goto error; + } + } + compiler_use_next_block(c, fails[size - 1]); + if (!compiler_addop_load_const(c, Py_False)) { + goto error; + } + compiler_use_next_block(c, end); + PyObject_Free(fails); + return 1; +error: + PyObject_Free(fails); + return 0; +} + + +static int +pattern_helper_sequence_subscr(struct compiler *c, asdl_expr_seq *values, + Py_ssize_t star, pattern_context *pc) +{ + // Like pattern_helper_sequence_unpack, but uses BINARY_SUBSCR instead of + // UNPACK_SEQUENCE / UNPACK_EX. This is more efficient for patterns with a + // starred wildcard like [first, *_] / [first, *_, last] / [*_, last] / etc. + basicblock *end; + RETURN_IF_FALSE(end = compiler_new_block(c)); + Py_ssize_t size = asdl_seq_LEN(values); + for (Py_ssize_t i = 0; i < size; i++) { + expr_ty value = asdl_seq_GET(values, i); + if (WILDCARD_CHECK(value)) { + continue; + } + if (i == star) { + assert(value->kind == Starred_kind); + assert(WILDCARD_CHECK(value->v.Starred.value)); + continue; + } + ADDOP(c, DUP_TOP); + if (i < star) { + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); + } + else { + // The subject may not support negative indexing! Compute a + // nonnegative index: + ADDOP(c, GET_LEN); + ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i)); + ADDOP(c, BINARY_SUBTRACT); + } + ADDOP(c, BINARY_SUBSCR); + RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); + // TOS is True or False. We're done with the item underneath: + ADDOP(c, ROT_TWO); + ADDOP(c, POP_TOP); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); + } + ADDOP_LOAD_CONST(c, Py_True); + compiler_use_next_block(c, end); + return 1; +} + + static int compiler_pattern_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) { @@ -5782,149 +5909,57 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) asdl_expr_seq *values = (p->kind == Tuple_kind) ? p->v.Tuple.elts : p->v.List.elts; Py_ssize_t size = asdl_seq_LEN(values); - // Find a starred name, if it exists. There may be at most one: Py_ssize_t star = -1; + int only_wildcard = 1; int star_wildcard = 0; - int all_wildcard = 1; - int needs_len = 0; + // Find a starred name, if it exists. There may be at most one: for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); - if (value->kind != Starred_kind) { - int wildcard = WILDCARD_CHECK(value); - all_wildcard &= wildcard; - needs_len |= 0 <= star && !wildcard; - continue; - } - if (0 <= star) { - const char *e = "multiple starred names in sequence pattern"; - return compiler_error(c, e); + if (value->kind == Starred_kind) { + value = value->v.Starred.value; + if (star >= 0) { + const char *e = "multiple starred names in sequence pattern"; + return compiler_error(c, e); + } + star_wildcard = WILDCARD_CHECK(value); + star = i; } - star_wildcard = WILDCARD_CHECK(value->v.Starred.value); - all_wildcard &= star_wildcard; - star = i; + only_wildcard &= WILDCARD_CHECK(value); } - needs_len &= star_wildcard && star != size - 1; basicblock *end; RETURN_IF_FALSE(end = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); - basicblock *needs_len_fail = NULL; - if (needs_len) { - RETURN_IF_FALSE(needs_len_fail = compiler_new_block(c)); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, needs_len_fail); - } - else { - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); //* - } - + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); NEXT_BLOCK(c); - if (size == 1 && 0 <= star) { - // [*_] or [*x] - if (!star_wildcard) { - // [*x] - ADDOP_I(c, UNPACK_EX, 0); - expr_ty value = asdl_seq_GET(values, 0)->v.Starred.value; - RETURN_IF_FALSE(compiler_pattern_capture(c, value, pc)); - } - else { - ADDOP_LOAD_CONST(c, Py_True); - } - compiler_use_next_block(c, end); - return 1; - } - ADDOP(c, GET_LEN); - if (needs_len) { - // Duplicate the length and put it underneath the subject (at TOS2), - // since both the length check and BINARY_SUBSCR need it: - ADDOP(c, DUP_TOP); - ADDOP(c, ROT_THREE); - } if (star < 0) { // No star: len(subject) == size + ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); } - else { + else if (size > 1) { // Star: len(subject) >= size - 1 + ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); + ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + NEXT_BLOCK(c); } - if (all_wildcard) { - // [], [_], [_, _], [_, *_], [_, _, *_], etc. + if (only_wildcard) { + // Patterns like: [] / [_] / [_, _] / [*_] / [_, *_] / [_, _, *_] / etc. + ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; } - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); - NEXT_BLOCK(c); - basicblock **fails = NULL; - if (!star_wildcard) { - ADDOP(c, DUP_TOP); - RETURN_IF_FALSE(unpack_helper(c, values)); - fails = (basicblock **)PyObject_Malloc(sizeof(basicblock *) * (size)); - for (Py_ssize_t i = 0; i < size; i++) { - RETURN_IF_FALSE(fails[i] = compiler_new_block(c)); - } + if (star_wildcard) { + RETURN_IF_FALSE(pattern_helper_sequence_subscr(c, values, star, pc)); } - for (Py_ssize_t i = 0; i < size; i++) { - expr_ty value = asdl_seq_GET(values, i); - if (star_wildcard) { - if (i == star || WILDCARD_CHECK(value)) { - continue; - } - if (i < star) { - ADDOP(c, DUP_TOP); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); - } - else { - assert(needs_len); - // TOS is subject, length underneath. - ADDOP(c, DUP_TOP_TWO); - ADDOP(c, ROT_TWO); - ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i)); - ADDOP(c, BINARY_SUBTRACT); - } - ADDOP(c, BINARY_SUBSCR); - } - else if (WILDCARD_CHECK(value)) { - ADDOP(c, POP_TOP); - continue; - } - else if (i == star) { - assert(value->kind == Starred_kind); - value = value->v.Starred.value; - } - RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); - // TOS is True or False. We're done with the item underneath: - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - if (star_wildcard) { - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); - } - else { - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fails[i]); - } - NEXT_BLOCK(c); - } - // Success! - ADDOP_LOAD_CONST(c, Py_True); - if (!star_wildcard) { - ADDOP_JUMP(c, JUMP_FORWARD, end); - for (Py_ssize_t i = 0; i < size - 1; i++) { - compiler_use_next_block(c, fails[i]); - ADDOP(c, POP_TOP); - } - compiler_use_next_block(c, fails[size - 1]); - ADDOP_LOAD_CONST(c, Py_False); - PyObject_Free(fails); + else { + RETURN_IF_FALSE(pattern_helper_sequence_unpack(c, values, star, pc)); } compiler_use_next_block(c, end); - if (needs_len) { - // TOS is True/False, subject underneath, length underneath (at TOS2). - // Pop the length: - ADDOP(c, ROT_THREE); - ADDOP(c, ROT_THREE); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, needs_len_fail); - } return 1; } From 162f9b6d67d500071f48700c52286b423b6a82c1 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 15 Feb 2021 14:24:59 -0800 Subject: [PATCH 211/218] Clean up comment --- Python/compile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 22c19d60f69737..3b405d7a029183 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5556,10 +5556,10 @@ pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, } // This is where we handle failed sub-patterns. For a sequence pattern like // [a, b, c, d], this will look like: - // fails[0]: POP_TOP # <- Jump here if a fails, and fall through. - // fails[1]: POP_TOP # <- Jump here if b fails, and fall through. - // fails[2]: POP_TOP # <- Jump here if c fails, and fall through. - // fails[3]: LOAD_CONST False # <- Jump here if d fails, and fall through. + // fails[0]: POP_TOP + // fails[1]: POP_TOP + // fails[2]: POP_TOP + // fails[3]: LOAD_CONST False for (Py_ssize_t i = 0; i < size - 1; i++) { compiler_use_next_block(c, fails[i]); if (!compiler_addop(c, POP_TOP)) { From 49b28231474a8dcaab2ec26e9e08bb4fbda3d69a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 15 Feb 2021 14:25:37 -0800 Subject: [PATCH 212/218] Factor out get_match_args --- Python/ceval.c | 81 ++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 52 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 5b52e0e8ec30d4..f60ca34211f4c1 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -959,51 +959,6 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } -static int -get_match_args(PyThreadState *tstate, PyObject *type, PyObject **match_args, - int *match_self) -{ - // try: - // match_args = type.__match_args__ - // except AttributeError: - // match_self = type.__flags__ & _Py_TPFLAGS_MATCH_SELF - // match_args = () - // else: - // match_self = 0 - // if match_args.__class__ is list: - // match_args = tuple(match_args) - // elif match_args.__class__ is not tuple: - // raise TypeError - *match_args = PyObject_GetAttrString(type, "__match_args__"); - if (*match_args == NULL) { - if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { - _PyErr_Clear(tstate); - // _Py_TPFLAGS_MATCH_SELF is only acknowledged if the type does not - // define __match_args__. This is natural behavior for subclasses: - // it's as if __match_args__ is some "magic" value that is lost as - // soon as they redefine it. - *match_self = PyType_HasFeature((PyTypeObject*)type, - _Py_TPFLAGS_MATCH_SELF); - *match_args = PyTuple_New(0); - return 0; - } - return 1; - } - *match_self = 0; - if (PyTuple_CheckExact(*match_args)) { - return 0; - } - if (PyList_CheckExact(*match_args)) { - Py_SETREF(*match_args, PyList_AsTuple(*match_args)); - return 0; - } - const char *e = "%s.__match_args__ must be a list or tuple (got %s)"; - _PyErr_Format(tstate, PyExc_TypeError, e, ((PyTypeObject *)type)->tp_name, - Py_TYPE(*match_args)->tp_name); - Py_CLEAR(*match_args); - return 1; -} - static PyObject* match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, PyObject *name, PyObject *seen) @@ -1060,14 +1015,37 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, PyObject *match_args = NULL; // First, the positional subpatterns: if (nargs) { - int match_self; - if (get_match_args(tstate, type, &match_args, &match_self)) { + int match_self = 0; + match_args = PyObject_GetAttrString(type, "__match_args__"); + if (match_args) { + if (PyList_CheckExact(match_args)) { + Py_SETREF(match_args, PyList_AsTuple(match_args)); + } + if (match_args == NULL) { + goto fail; + } + if (!PyTuple_CheckExact(match_args)) { + const char *e = "%s.__match_args__ must be a list or tuple " + "(got %s)"; + _PyErr_Format(tstate, PyExc_TypeError, e, + ((PyTypeObject *)type)->tp_name, + Py_TYPE(match_args)->tp_name); + goto fail; + } + } + else if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { + _PyErr_Clear(tstate); + // _Py_TPFLAGS_MATCH_SELF is only acknowledged if the type does not + // define __match_args__. This is natural behavior for subclasses: + // it's as if __match_args__ is some "magic" value that is lost as + // soon as they redefine it. + match_self = PyType_HasFeature((PyTypeObject*)type, + _Py_TPFLAGS_MATCH_SELF); + } + else { goto fail; } - assert(PyTuple_CheckExact(match_args)); - // If match_self, no __match_args__: - assert(match_self ? !PyTuple_GET_SIZE(match_args) : 1); - Py_ssize_t allowed = PyTuple_GET_SIZE(match_args) + match_self; + Py_ssize_t allowed = match_self ? 1 : PyTuple_GET_SIZE(match_args); if (allowed < nargs) { const char *plural = (allowed == 1) ? "" : "s"; _PyErr_Format(tstate, PyExc_TypeError, @@ -1078,7 +1056,6 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, } if (match_self) { // Easy. Copy the subject itself, and move on to kwargs. - assert(!PyTuple_GET_SIZE(match_args)); Py_INCREF(subject); PyTuple_SET_ITEM(attrs, 0, subject); } From 3f8fdaf81be508236125c8c32560f1db38e1efc6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 15 Feb 2021 20:31:43 -0800 Subject: [PATCH 213/218] Replace TOS instead of pushing onto it --- Doc/library/dis.rst | 8 +-- Python/ceval.c | 10 +-- Python/compile.c | 152 +++++++++++++++++++++++++------------------- 3 files changed, 96 insertions(+), 74 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 6f94ee61bff49f..481961231eb55a 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1238,12 +1238,12 @@ All of the following opcodes use their arguments. .. opcode:: MATCH_CLASS (count) TOS is a tuple of keyword attribute names, TOS1 is the class being matched - against, and TOS2 is the match subject. *count* is the number of positional + against, and TOS2 is the match subject. *count* is the number of positional sub-patterns. - If TOS2 is an instance of TOS1 and has the positional and keyword attributes - required by *count* and TOS, replace TOS with ``True`` and TOS1 with a tuple - of extracted attributes. Otherwise, replace TOS with ``False``. + Pop TOS. If TOS2 is an instance of TOS1 and has the positional and keyword + attributes required by *count* and TOS, set TOS to ``True`` and TOS1 to a + tuple of extracted attributes. Otherwise, set TOS to ``False``. .. versionadded:: 3.10 diff --git a/Python/ceval.c b/Python/ceval.c index f60ca34211f4c1..f4e1911aada1b5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3843,11 +3843,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) } case TARGET(MATCH_CLASS): { - // On success, replace TOS with True and TOS1 with a tuple of - // attributes. On failure, replace TOS with False. - PyObject *names = TOP(); - PyObject *type = SECOND(); - PyObject *subject = THIRD(); + // Pop TOS. On success, set TOS to True and TOS1 to a tuple of + // attributes. On failure, set TOS to False. + PyObject *names = POP(); + PyObject *type = TOP(); + PyObject *subject = SECOND(); assert(PyTuple_CheckExact(names)); PyObject *attrs = match_class(tstate, subject, type, oparg, names); if (attrs) { diff --git a/Python/compile.c b/Python/compile.c index 3b405d7a029183..f166b5c5466f90 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1161,8 +1161,9 @@ stack_effect(int opcode, int oparg, int jump) case DICT_UPDATE: return -1; case COPY_DICT_WITHOUT_KEYS: - case MATCH_CLASS: return 0; + case MATCH_CLASS: + return -1; case GET_LEN: case MATCH_MAPPING: case MATCH_SEQUENCE: @@ -5463,11 +5464,10 @@ compiler_slice(struct compiler *c, expr_ty s) // PEP 634: Structural Pattern Matching // To keep things simple, all compiler_pattern_* routines follow the convention -// of preserving TOS (the subject for the given pattern) and pushing either True -// (match) or False (no match) on top of it. We do this even for irrefutable -// patterns; the idea is that it's much easier to smooth out any redundant -// pushing, popping, and jumping in the peephole optimizer than to detect or -// predict it here. +// of replacing TOS (the subject for the given pattern) with either True (match) +// or False (no match). We do this even for irrefutable patterns; the idea is +// that it's much easier to smooth out any redundant pushing, popping, and +// jumping in the peephole optimizer than to detect or predict it here. #define WILDCARD_CHECK(N) \ @@ -5503,7 +5503,6 @@ static int pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, Py_ssize_t star, pattern_context *pc) { - ADDOP(c, DUP_TOP); RETURN_IF_FALSE(unpack_helper(c, values)); // We've now got a bunch of new subjects on the stack. If any of them fail // to match, we need to pop everything else off, then finally push False. @@ -5530,16 +5529,7 @@ pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, assert(value->kind == Starred_kind); value = value->v.Starred.value; } - if (WILDCARD_CHECK(value)) { - if (!compiler_addop(c, POP_TOP)) { - goto error; - } - continue; - } if (!compiler_pattern_subpattern(c, value, pc) || - // TOS is True or False. We're done with the item underneath: - !compiler_addop(c, ROT_TWO) || - !compiler_addop(c, POP_TOP) || !compiler_addop_j(c, POP_JUMP_IF_FALSE, fails[i]) || compiler_next_block(c) == NULL) { @@ -5586,8 +5576,9 @@ pattern_helper_sequence_subscr(struct compiler *c, asdl_expr_seq *values, // Like pattern_helper_sequence_unpack, but uses BINARY_SUBSCR instead of // UNPACK_SEQUENCE / UNPACK_EX. This is more efficient for patterns with a // starred wildcard like [first, *_] / [first, *_, last] / [*_, last] / etc. - basicblock *end; + basicblock *end, *fail_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(values); for (Py_ssize_t i = 0; i < size; i++) { expr_ty value = asdl_seq_GET(values, i); @@ -5612,13 +5603,15 @@ pattern_helper_sequence_subscr(struct compiler *c, asdl_expr_seq *values, } ADDOP(c, BINARY_SUBSCR); RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); - // TOS is True or False. We're done with the item underneath: - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); } + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail_pop_1); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } @@ -5640,14 +5633,21 @@ static int compiler_pattern_as(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == MatchAs_kind); - basicblock *end; + basicblock *end, *fail_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); + // Need to make a copy for (possibly) storing later: + ADDOP(c, DUP_TOP); RETURN_IF_FALSE(compiler_pattern(c, p->v.MatchAs.pattern, pc)); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); - ADDOP(c, DUP_TOP); RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchAs.name, pc)); ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail_pop_1); + // Need to pop that unused copy from before: + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } @@ -5664,7 +5664,6 @@ compiler_pattern_capture(struct compiler *c, expr_ty p, pattern_context *pc) const char *e = "name capture %R makes remaining patterns unreachable"; return compiler_error(c, e, p->v.Name.id); } - ADDOP(c, DUP_TOP); RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.Name.id, pc)); ADDOP_LOAD_CONST(c, Py_True); return 1; @@ -5683,8 +5682,9 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) return compiler_error(c, e, p->v.Call.func); } RETURN_IF_FALSE(!validate_keywords(c, kwargs)); - basicblock *end; + basicblock *end, *fail_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); VISIT(c, expr, p->v.Call.func); PyObject *kwnames; RETURN_IF_FALSE(kwnames = PyTuple_New(nkwargs)); @@ -5696,7 +5696,7 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_LOAD_CONST_NEW(c, kwnames); ADDOP_I(c, MATCH_CLASS, nargs); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); // TOS is now a tuple of (nargs + nkwargs) attributes. for (i = 0; i < nargs + nkwargs; i++) { @@ -5717,20 +5717,17 @@ compiler_pattern_class(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); RETURN_IF_FALSE(compiler_pattern_subpattern(c, arg, pc)); - // TOS is True or False, with the attribute beneath. Pop the attribute, - // we're done with it: - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); } - // If we made it this far, it's a match! + // Success! Pop the tuple of attributes: + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); - compiler_use_next_block(c, end); - // TOS is True or False, but we've still got either a class or a tuple of - // attributes beneath it. Pop it, we're done. - ADDOP(c, ROT_TWO); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail_pop_1); ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); + compiler_use_next_block(c, end); return 1; } @@ -5740,7 +5737,6 @@ compiler_pattern_literal(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Constant_kind); PyObject *v = p->v.Constant.value; - ADDOP(c, DUP_TOP); ADDOP_LOAD_CONST(c, v); // Literal True, False, and None are compared by identity. All others use // equality: @@ -5752,20 +5748,26 @@ compiler_pattern_literal(struct compiler *c, expr_ty p, pattern_context *pc) static int compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) { - basicblock *fail, *end; - RETURN_IF_FALSE(fail = compiler_new_block(c)); + basicblock *end, *fail_pop_1, *fail_pop_3; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_3 = compiler_new_block(c)); asdl_expr_seq *keys = p->v.Dict.keys; asdl_expr_seq *values = p->v.Dict.values; Py_ssize_t size = asdl_seq_LEN(values); // A starred pattern will be a keyless value. It is guranteed to be last: int star = size ? !asdl_seq_GET(keys, size - 1) : 0; ADDOP(c, MATCH_MAPPING); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); if (!size) { // If the pattern is just "{}", we're done! + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail_pop_1); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } @@ -5774,7 +5776,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - star)); ADDOP_COMPARE(c, GtE); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); } if (INT_MAX < size - star - 1) { @@ -5793,7 +5795,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) } ADDOP_I(c, BUILD_TUPLE, size - star); ADDOP(c, MATCH_KEYS); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_3); NEXT_BLOCK(c); // So far so good. There's now a tuple of values on the stack to match // sub-patterns against: @@ -5806,10 +5808,7 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i)); ADDOP(c, BINARY_SUBSCR); RETURN_IF_FALSE(compiler_pattern_subpattern(c, value, pc)); - // TOS is True or False. Don't care about the value underneath anymore: - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_3); NEXT_BLOCK(c); } // If we get this far, it's a match! We're done with that tuple of values. @@ -5824,13 +5823,18 @@ compiler_pattern_mapping(struct compiler *c, expr_ty p, pattern_context *pc) // Otherwise, we don't care about this tuple of keys anymore: ADDOP(c, POP_TOP); } + // Pop the subject: + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); ADDOP_JUMP(c, JUMP_FORWARD, end); - compiler_use_next_block(c, fail); // The top two items are a tuple of values or None, followed by a tuple of // keys. Pop them both: + compiler_use_next_block(c, fail_pop_3); ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); + compiler_use_next_block(c, fail_pop_1); + // Pop the subject: + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; @@ -5844,8 +5848,9 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) // control is the set of names bound by the first alternative. If all of the // others bind the same names (they should), then this becomes pc->stores. PyObject *control = NULL; - basicblock *end; + basicblock *end, *pass_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(pass_pop_1 = compiler_new_block(c)); Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns); assert(size > 1); // We're going to be messing with pc. Keep the original info handy: @@ -5856,12 +5861,15 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) expr_ty alt = asdl_seq_GET(p->v.MatchOr.patterns, i); pc->stores = PySet_New(stores_init); // An irrefutable sub-pattern must be last, if it is allowed at all: - pc->allow_irrefutable = allow_irrefutable && (i == size - 1); + int is_last = i == size - 1; + pc->allow_irrefutable = allow_irrefutable && is_last; SET_LOC(c, alt); - // The actual control flow is simple: if (pc->stores == NULL || + // Only copy the subject if we're *not* on the last alternative: + (!is_last && !compiler_addop(c, DUP_TOP)) || !compiler_pattern(c, alt, pc) || - !compiler_addop_j(c, JUMP_IF_TRUE_OR_POP, end) || + // Only jump if we're *not* on the last alternative: + (!is_last && !compiler_addop_j(c, POP_JUMP_IF_TRUE, pass_pop_1)) || !compiler_next_block(c)) { goto fail; @@ -5892,7 +5900,10 @@ compiler_pattern_or(struct compiler *c, expr_ty p, pattern_context *pc) // Update pc->stores and restore pc->allow_irrefutable: pc->stores = control; pc->allow_irrefutable = allow_irrefutable; - ADDOP_LOAD_CONST(c, Py_False); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, pass_pop_1); + ADDOP(c, POP_TOP); + ADDOP_LOAD_CONST(c, Py_True); compiler_use_next_block(c, end); return 1; fail: @@ -5926,17 +5937,18 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) } only_wildcard &= WILDCARD_CHECK(value); } - basicblock *end; + basicblock *end, *fail_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); + RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); ADDOP(c, MATCH_SEQUENCE); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); if (star < 0) { // No star: len(subject) == size ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size)); ADDOP_COMPARE(c, Eq); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); } else if (size > 1) { @@ -5944,21 +5956,24 @@ compiler_pattern_sequence(struct compiler *c, expr_ty p, pattern_context *pc) ADDOP(c, GET_LEN); ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1)); ADDOP_COMPARE(c, GtE); - ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, end); + ADDOP_JUMP(c, POP_JUMP_IF_FALSE, fail_pop_1); NEXT_BLOCK(c); } if (only_wildcard) { // Patterns like: [] / [_] / [_, _] / [*_] / [_, *_] / [_, _, *_] / etc. + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); - compiler_use_next_block(c, end); - return 1; } - if (star_wildcard) { + else if (star_wildcard) { RETURN_IF_FALSE(pattern_helper_sequence_subscr(c, values, star, pc)); } else { RETURN_IF_FALSE(pattern_helper_sequence_unpack(c, values, star, pc)); } + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, fail_pop_1); + ADDOP(c, POP_TOP) + ADDOP_LOAD_CONST(c, Py_False); compiler_use_next_block(c, end); return 1; } @@ -5969,7 +5984,6 @@ compiler_pattern_value(struct compiler *c, expr_ty p, pattern_context *pc) { assert(p->kind == Attribute_kind); assert(p->v.Attribute.ctx == Load); - ADDOP(c, DUP_TOP); VISIT(c, expr, p); ADDOP_COMPARE(c, Eq); return 1; @@ -5987,6 +6001,7 @@ compiler_pattern_wildcard(struct compiler *c, expr_ty p, pattern_context *pc) const char *e = "wildcard makes remaining patterns unreachable"; return compiler_error(c, e); } + ADDOP(c, POP_TOP); ADDOP_LOAD_CONST(c, Py_True); return 1; } @@ -6052,24 +6067,31 @@ compiler_match(struct compiler *c, stmt_ty s) // If pc.allow_irrefutable is 0, any name captures against our subject // will raise. Irrefutable cases must be either guarded, last, or both: pc.allow_irrefutable = m->guard != NULL || i == cases - 1; + // Only copy the subject if we're *not* on the last case: + if (i != cases - has_default - 1) { + ADDOP(c, DUP_TOP); + } int result = compiler_pattern(c, m->pattern, &pc); Py_CLEAR(pc.stores); RETURN_IF_FALSE(result); - // TOS is either True or False, with the subject still waiting beneath: ADDOP_JUMP(c, POP_JUMP_IF_FALSE, next); NEXT_BLOCK(c); if (m->guard) { RETURN_IF_FALSE(compiler_jump_if(c, m->guard, next, 0)); } // Success! Pop the subject off, we're done with it: - ADDOP(c, POP_TOP); + if (i != cases - has_default - 1) { + ADDOP(c, POP_TOP); + } VISIT_SEQ(c, stmt, m->body); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, next); } - // No matches. Done with the subject: - ADDOP(c, POP_TOP); if (has_default) { + if (cases == 1) { + // No matches. Done with the subject: + ADDOP(c, POP_TOP); + } // A trailing "case _" is common, and lets us save a bit of redundant // pushing and popping in the loop above: m = asdl_seq_GET(s->v.Match.cases, cases - 1); From 69fa421115525c868520ffe37086b93169cf4e83 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 19 Feb 2021 21:59:57 -0800 Subject: [PATCH 214/218] Fix NULL pointer error --- Lib/test/test_patma.py | 11 +++++++++++ Python/ceval.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py index 29d70c7fee1c87..286b190adcf3d8 100644 --- a/Lib/test/test_patma.py +++ b/Lib/test/test_patma.py @@ -2830,6 +2830,17 @@ def test_patma_280(self): self.assertEqual(y, 2) self.assertEqual(z, 0) + @no_perf + def test_patma_281(self): + x = range(10) + y = None + with self.assertRaises(TypeError): + match x: + case range(10): + y = 0 + self.assertEqual(x, range(10)) + self.assertIs(y, None) + class PerfPatma(TestPatma): diff --git a/Python/ceval.c b/Python/ceval.c index c5898212dc5069..ca819d08e38b1f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1039,12 +1039,14 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, // define __match_args__. This is natural behavior for subclasses: // it's as if __match_args__ is some "magic" value that is lost as // soon as they redefine it. + match_args = PyTuple_New(0); match_self = PyType_HasFeature((PyTypeObject*)type, _Py_TPFLAGS_MATCH_SELF); } else { goto fail; } + assert(PyTuple_CheckExact(match_args)); Py_ssize_t allowed = match_self ? 1 : PyTuple_GET_SIZE(match_args); if (allowed < nargs) { const char *plural = (allowed == 1) ? "" : "s"; From 1711207fef21fd5fe0e19cc17d2d637ea202b450 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 20 Feb 2021 09:51:56 -0800 Subject: [PATCH 215/218] Don't keep uninitialized tuples hanging around --- Python/ceval.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index ca819d08e38b1f..a4900b1ffeb547 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -917,7 +917,7 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) if (dummy == NULL) { goto fail; } - values = PyTuple_New(nkeys); + values = PyList_New(0); if (values == NULL) { goto fail; } @@ -942,11 +942,13 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) // Return None: Py_INCREF(Py_None); values = Py_None; - break; + goto done; } - PyTuple_SET_ITEM(values, i, value); + PyList_Append(values, value); } + Py_SETREF(values, PyList_AsTuple(values)); // Success: +done: Py_DECREF(get); Py_DECREF(dummy); Py_DECREF(seen); @@ -1002,7 +1004,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, return NULL; } // So far so good: - PyObject *attrs = PyTuple_New(nargs + PyTuple_GET_SIZE(kwargs)); + PyObject *attrs = PyList_New(0); if (attrs == NULL) { return NULL; } @@ -1059,7 +1061,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, if (match_self) { // Easy. Copy the subject itself, and move on to kwargs. Py_INCREF(subject); - PyTuple_SET_ITEM(attrs, 0, subject); + PyList_Append(attrs, subject); } else { for (Py_ssize_t i = 0; i < nargs; i++) { @@ -1075,7 +1077,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, if (attr == NULL) { goto fail; } - PyTuple_SET_ITEM(attrs, i, attr); + PyList_Append(attrs, attr); } } Py_CLEAR(match_args); @@ -1087,9 +1089,10 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, if (attr == NULL) { goto fail; } - PyTuple_SET_ITEM(attrs, nargs + i, attr); + PyList_Append(attrs, attr); } Py_DECREF(seen); + Py_SETREF(attrs, PyList_AsTuple(attrs)); return attrs; fail: // We really don't care whether an error was raised or not... that's our From 77620990734eb8262645aa1aa77ddc53b01dfe79 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Feb 2021 12:12:21 -0800 Subject: [PATCH 216/218] Fix new refleaks ("-R 3:3" is clean again) --- Python/ceval.c | 29 ++++++++++++++++------------- Python/compile.c | 6 +++--- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index c4a807461ca37d..a8859ea5c5efc0 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -944,18 +944,19 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) goto done; } PyList_Append(values, value); + Py_DECREF(value); } Py_SETREF(values, PyList_AsTuple(values)); // Success: done: Py_DECREF(get); - Py_DECREF(dummy); Py_DECREF(seen); + Py_DECREF(dummy); return values; fail: Py_XDECREF(get); - Py_XDECREF(dummy); Py_XDECREF(seen); + Py_XDECREF(dummy); Py_XDECREF(values); return NULL; } @@ -1003,13 +1004,13 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, return NULL; } // So far so good: - PyObject *attrs = PyList_New(0); - if (attrs == NULL) { - return NULL; - } PyObject *seen = PySet_New(NULL); if (seen == NULL) { - Py_DECREF(attrs); + return NULL; + } + PyObject *attrs = PyList_New(0); + if (attrs == NULL) { + Py_DECREF(seen); return NULL; } // NOTE: From this point on, goto fail on failure: @@ -1059,7 +1060,6 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, } if (match_self) { // Easy. Copy the subject itself, and move on to kwargs. - Py_INCREF(subject); PyList_Append(attrs, subject); } else { @@ -1077,6 +1077,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, goto fail; } PyList_Append(attrs, attr); + Py_DECREF(attr); } } Py_CLEAR(match_args); @@ -1089,16 +1090,17 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, goto fail; } PyList_Append(attrs, attr); + Py_DECREF(attr); } - Py_DECREF(seen); Py_SETREF(attrs, PyList_AsTuple(attrs)); + Py_DECREF(seen); return attrs; fail: // We really don't care whether an error was raised or not... that's our // caller's problem. All we know is that the match failed. - Py_DECREF(attrs); - Py_DECREF(seen); Py_XDECREF(match_args); + Py_DECREF(seen); + Py_DECREF(attrs); return NULL; } @@ -3863,16 +3865,17 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) PyObject *subject = SECOND(); assert(PyTuple_CheckExact(names)); PyObject *attrs = match_class(tstate, subject, type, oparg, names); + Py_DECREF(names); if (attrs) { // Success! assert(PyTuple_CheckExact(attrs)); - Py_DECREF(type); + Py_DECREF(subject); SET_SECOND(attrs); } else if (_PyErr_Occurred(tstate)) { goto error; } - Py_DECREF(names); + Py_DECREF(type); SET_TOP(PyBool_FromLong(!!attrs)); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c index f166b5c5466f90..88e73ac200e713 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5537,9 +5537,9 @@ pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, } } // Success! - basicblock *end; - RETURN_IF_FALSE(end = compiler_new_block(c)); - if (!compiler_addop_load_const(c, Py_True) || + basicblock *end = compiler_new_block(c); + if (end == NULL || + !compiler_addop_load_const(c, Py_True) || !compiler_addop_j(c, JUMP_FORWARD, end)) { goto error; From 5e269fb1dca523c409deee6e6a964645526051d6 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Feb 2021 12:24:44 -0800 Subject: [PATCH 217/218] Use PySet_CheckExact (thanks Pablo!) --- Python/ceval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index a8859ea5c5efc0..8b37950c05249c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -969,8 +969,7 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, // to raise TypeErrors for repeated lookups. On failure, return NULL (with // no error set). Use _PyErr_Occurred(tstate) to disambiguate. assert(PyUnicode_CheckExact(name)); - // XXX: Why doesn't PySet_CheckExact exist? - assert(Py_IS_TYPE(seen, &PySet_Type)); + assert(PySet_CheckExact(seen)); if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { if (!_PyErr_Occurred(tstate)) { // Seen it before! From ca6e332b917342ee67b36aa7315efa4d203be112 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 22 Feb 2021 18:43:38 -0800 Subject: [PATCH 218/218] Move some comments --- Python/ceval.c | 14 +++++++------- Python/compile.c | 9 ++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 8b37950c05249c..7862643983e086 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -884,11 +884,11 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where) // PEP 634: Structural Pattern Matching +// Return a tuple of values corresponding to keys, with error checks for +// duplicate/missing keys. static PyObject* match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) { - // Return a tuple of values corresponding to keys, with error checks for - // duplicate/missing keys. assert(PyTuple_CheckExact(keys)); Py_ssize_t nkeys = PyTuple_GET_SIZE(keys); if (!nkeys) { @@ -961,13 +961,13 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys) return NULL; } +// Extract a named attribute from the subject, with additional bookkeeping to +// raise TypeErrors for repeated lookups. On failure, return NULL (with no +// error set). Use _PyErr_Occurred(tstate) to disambiguate. static PyObject* match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, PyObject *name, PyObject *seen) { - // Extract a named attribute from the subject, with additional bookkeeping - // to raise TypeErrors for repeated lookups. On failure, return NULL (with - // no error set). Use _PyErr_Occurred(tstate) to disambiguate. assert(PyUnicode_CheckExact(name)); assert(PySet_CheckExact(seen)); if (PySet_Contains(seen, name) || PySet_Add(seen, name)) { @@ -986,12 +986,12 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type, return attr; } +// On success (match), return a tuple of extracted attributes. On failure (no +// match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate. static PyObject* match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs) { - // On success (match), return a tuple of extracted attributes. On failure - // (no match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate. if (!PyType_Check(type)) { const char *e = "called match pattern must be a type"; _PyErr_Format(tstate, PyExc_TypeError, e); diff --git a/Python/compile.c b/Python/compile.c index 88e73ac200e713..454005eb7b0cbe 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5568,14 +5568,13 @@ pattern_helper_sequence_unpack(struct compiler *c, asdl_expr_seq *values, return 0; } - +// Like pattern_helper_sequence_unpack, but uses BINARY_SUBSCR instead of +// UNPACK_SEQUENCE / UNPACK_EX. This is more efficient for patterns with a +// starred wildcard like [first, *_] / [first, *_, last] / [*_, last] / etc. static int pattern_helper_sequence_subscr(struct compiler *c, asdl_expr_seq *values, Py_ssize_t star, pattern_context *pc) { - // Like pattern_helper_sequence_unpack, but uses BINARY_SUBSCR instead of - // UNPACK_SEQUENCE / UNPACK_EX. This is more efficient for patterns with a - // starred wildcard like [first, *_] / [first, *_, last] / [*_, last] / etc. basicblock *end, *fail_pop_1; RETURN_IF_FALSE(end = compiler_new_block(c)); RETURN_IF_FALSE(fail_pop_1 = compiler_new_block(c)); @@ -5617,10 +5616,10 @@ pattern_helper_sequence_subscr(struct compiler *c, asdl_expr_seq *values, } +// Like compiler_pattern, but turn off checks for irrefutability. static int compiler_pattern_subpattern(struct compiler *c, expr_ty p, pattern_context *pc) { - // Like compiler_pattern, but turn off checks for irrefutability. int allow_irrefutable = pc->allow_irrefutable; pc->allow_irrefutable = 1; RETURN_IF_FALSE(compiler_pattern(c, p, pc));