Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fec0c46

Browse files
committed
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.
1 parent 8ffc141 commit fec0c46

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Python/compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
32743274
}
32753275
if (assigning > OP_APPLY) {
32763276
com_error(c, PyExc_SyntaxError,
3277-
"augmented assign to tuple literal not possible");
3277+
"augmented assign to tuple literal or generator expression not possible");
32783278
return;
32793279
}
32803280
break;
@@ -3287,7 +3287,7 @@ com_assign(struct compiling *c, node *n, int assigning, node *augn)
32873287
}
32883288
if (assigning > OP_APPLY) {
32893289
com_error(c, PyExc_SyntaxError,
3290-
"augmented assign to list literal not possible");
3290+
"augmented assign to list literal or comprehension not possible");
32913291
return;
32923292
}
32933293
if (NCH(n) > 1

0 commit comments

Comments
 (0)