diff options
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index d50cb80..b48471e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -115,7 +115,7 @@ validate_arguments(arguments_ty args) } if (!validate_args(args->kwonlyargs)) return 0; - if (args->kwarg && args->kwarg->annotation + if (args->kwarg && args->kwarg->annotation && !validate_expr(args->kwarg->annotation, Load)) { return 0; } @@ -164,6 +164,8 @@ validate_expr(expr_ty exp, expr_context_ty ctx) return 0; } check_ctx = 0; + /* set actual_ctx to prevent gcc warning */ + actual_ctx = 0; } if (check_ctx && actual_ctx != ctx) { PyErr_Format(PyExc_ValueError, "expression must have %s context but has %s instead", @@ -451,7 +453,7 @@ validate_exprs(asdl_seq *exprs, expr_context_ty ctx, int null_ok) "None disallowed in expression list"); return 0; } - + } return 1; } @@ -825,6 +827,8 @@ get_operator(const node *n) return Sub; case STAR: return Mult; + case AT: + return MatMult; case SLASH: return Div; case DOUBLESLASH: @@ -1030,6 +1034,8 @@ ast_for_augassign(struct compiling *c, const node *n) return Pow; else return Mult; + case '@': + return MatMult; default: PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n)); return (operator_ty)0; @@ -2257,7 +2263,7 @@ ast_for_expr(struct compiling *c, const node *n) and_expr: shift_expr ('&' shift_expr)* shift_expr: arith_expr (('<<'|'>>') arith_expr)* arith_expr: term (('+'|'-') term)* - term: factor (('*'|'/'|'%'|'//') factor)* + term: factor (('*'|'@'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: atom trailer* ('**' factor)* */ @@ -2568,7 +2574,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n) /* expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) | ('=' (yield_expr|testlist))*) testlist_star_expr: (test|star_expr) (',' test|star_expr)* [','] - augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' + augassign: '+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=' test: ... here starts the operator precendence dance */ |