Fix SF bug [ 561825 ] Confusing error for "del f()"

In the error message, say del for del and assign for everything else.
This commit is contained in:
Jeremy Hylton 2002-05-31 14:08:29 +00:00
parent 5352d8c0c6
commit 05ab2e693c
2 changed files with 40 additions and 2 deletions

View file

@ -2417,8 +2417,12 @@ com_assign_trailer(struct compiling *c, node *n, int assigning, node *augn)
REQ(n, trailer);
switch (TYPE(CHILD(n, 0))) {
case LPAR: /* '(' [exprlist] ')' */
com_error(c, PyExc_SyntaxError,
"can't assign to function call");
if (assigning == OP_DELETE)
com_error(c, PyExc_SyntaxError,
"can't delete function call");
else
com_error(c, PyExc_SyntaxError,
"can't assign to function call");
break;
case DOT: /* '.' NAME */
if (assigning > OP_APPLY)