mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
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:
parent
5352d8c0c6
commit
05ab2e693c
2 changed files with 40 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue