diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-13 17:08:53 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-13 17:08:53 (GMT) |
commit | 52c4bec76bdcb962e883eac1e55f98df488b558c (patch) | |
tree | 2e9aa28b526bc958a3c65099975f79cc59221ba7 /Python | |
parent | 5d1ff94b9ef3052b4938c55b196c3594369e252a (diff) | |
download | cpython-52c4bec76bdcb962e883eac1e55f98df488b558c.zip cpython-52c4bec76bdcb962e883eac1e55f98df488b558c.tar.gz cpython-52c4bec76bdcb962e883eac1e55f98df488b558c.tar.bz2 |
give a better error message when deleting ()
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index a415495..4a85164 100644 --- a/Python/ast.c +++ b/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"; |