Improve error message for augmented assignments to genexps or listcomps.
Rather than introduce new logic, took the approach of making the message itself more general.
This commit is contained in:
parent
8ffc1410e2
commit
fec0c466ad
|
@ -3274,7 +3274,7 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
|
||||||
}
|
}
|
||||||
if (assigning > OP_APPLY) {
|
if (assigning > OP_APPLY) {
|
||||||
com_error(c, PyExc_SyntaxError,
|
com_error(c, PyExc_SyntaxError,
|
||||||
"augmented assign to tuple literal not possible");
|
"augmented assign to tuple literal or generator expression not possible");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3287,7 +3287,7 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
|
||||||
}
|
}
|
||||||
if (assigning > OP_APPLY) {
|
if (assigning > OP_APPLY) {
|
||||||
com_error(c, PyExc_SyntaxError,
|
com_error(c, PyExc_SyntaxError,
|
||||||
"augmented assign to list literal not possible");
|
"augmented assign to list literal or comprehension not possible");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NCH(n) > 1
|
if (NCH(n) > 1
|
||||||
|
|
Loading…
Reference in New Issue