8000 bpo-40067 : Improve error messages for multiple star expressions in assignment by furkanonder · Pull Request #19168 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40067 : Improve error messages for multiple star expressions in assignment #19168

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Lib/test/test_unpack_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,17 @@
>>> a, *b, c, *d, e = range(10) # doctest:+ELLIPSIS
Traceback (most recent call last):
...
SyntaxError: two starred expressions in assignment
SyntaxError: multiple starred expressions in assignment
10000
>>> [*b, *c] = range(10) # doctest:+ELLIPSIS
Traceback (most recent call last):
...
SyntaxError: two starred expressions in assignment
SyntaxError: multiple starred expressions in assignment

>>> a,*b,*c,*d = range(4) # doctest:+ELLIPSIS
Traceback (most recent call last):
...
SyntaxError: multiple starred expressions in assignment

>>> *a = range(10) # doctest:+ELLIPSIS
Traceback (most recent call last):
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ Jeffrey Ollie
Adam Olsen
Bryan Olson
Grant Olson
Furkan Onder
Koray Oner
Piet van Oostrum
Tomas Oppelstrup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Improve the error message for multiple star expressions in an assignment.
Patch by Furkan Onder
2 changes: 1 addition & 1 deletion Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ assignment_helper(struct compiler *c, asdl_seq *elts)
}
else if (elt->kind == Starred_kind) {
return compiler_error(c,
"two starred expressions in assignment");
"multiple starred expressions in assignment");
}
}
if (!seen_star) {
Expand Down
0