mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
give a better error message when deleting ()
This commit is contained in:
11
Python/ast.c
11
Python/ast.c
@@ -402,10 +402,13 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
|
||||
s = e->v.List.elts;
|
||||
break;
|
||||
case Tuple_kind:
|
||||
if (asdl_seq_LEN(e->v.Tuple.elts) == 0)
|
||||
return ast_error(n, "can't assign to ()");
|
||||
e->v.Tuple.ctx = ctx;
|
||||
s = e->v.Tuple.elts;
|
||||
if (asdl_seq_LEN(e->v.Tuple.elts)) {
|
||||
e->v.Tuple.ctx = ctx;
|
||||
s = e->v.Tuple.elts;
|
||||
}
|
||||
else {
|
||||
expr_name = "()";
|
||||
}
|
||||
break;
|
||||
case Lambda_kind:
|
||||
expr_name = "lambda";
|
||||
|
||||
Reference in New Issue
Block a user