[Python-checkins] (no subject)

Furkan Önder webhook-mailer at python.org
Wed Mar 25 21:54:55 EDT 2020




To: python-checkins at python.org
Subject: bpo-40067: Improve error messages for multiple star expressions in
 assignments (GH-19168)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

https://github.com/python/cpython/commit/cb6534e1a8833b3f20bd88f52cf62a003426=
e855
commit: cb6534e1a8833b3f20bd88f52cf62a003426e855
branch: master
author: Furkan =C3=96nder <furkanonder at protonmail.com>
committer: GitHub <noreply at github.com>
date: 2020-03-26T01:54:31Z
summary:

bpo-40067: Improve error messages for multiple star expressions in assignment=
s (GH-19168)

Co-Authored-By: Batuhan Ta=C5=9Fkaya <isidentical at gmail.com>
Co-Authored-By: Pablo Galindo <Pablogsal at gmail.com>

files:
A Misc/NEWS.d/next/Core and Builtins/2020-03-25-20-34-01.bpo-40067.0bFda2.rst
M Lib/test/test_unpack_ex.py
M Misc/ACKS
M Python/compile.c

diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py
index 46f70c2b98c70..e333af78f1d2c 100644
--- a/Lib/test/test_unpack_ex.py
+++ b/Lib/test/test_unpack_ex.py
@@ -308,12 +308,17 @@
     >>> a, *b, c, *d, e =3D range(10) # doctest:+ELLIPSIS
     Traceback (most recent call last):
       ...
-    SyntaxError: two starred expressions in assignment
+    SyntaxError: multiple starred expressions in assignment
=20
     >>> [*b, *c] =3D 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 =3D range(4) # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: multiple starred expressions in assignment
=20
     >>> *a =3D range(10) # doctest:+ELLIPSIS
     Traceback (most recent call last):
diff --git a/Misc/ACKS b/Misc/ACKS
index 129db952d885f..a4db5a547039d 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1236,6 +1236,7 @@ Jeffrey Ollie
 Adam Olsen
 Bryan Olson
 Grant Olson
+Furkan Onder
 Koray Oner
 Piet van Oostrum
 Tomas Oppelstrup
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-03-25-20-34-01.bpo-40067=
.0bFda2.rst b/Misc/NEWS.d/next/Core and Builtins/2020-03-25-20-34-01.bpo-4006=
7.0bFda2.rst
new file mode 100644
index 0000000000000..2e1b20d293770
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-03-25-20-34-01.bpo-40067.0bFda2=
.rst=09
@@ -0,0 +1,2 @@
+Improve the error message for multiple star expressions in an assignment.
+Patch by Furkan Onder
diff --git a/Python/compile.c b/Python/compile.c
index 0b3926c436c6a..01700e0e78cc9 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3708,7 +3708,7 @@ assignment_helper(struct compiler *c, asdl_seq *elts)
         }
         else if (elt->kind =3D=3D Starred_kind) {
             return compiler_error(c,
-                "two starred expressions in assignment");
+                "multiple starred expressions in assignment");
         }
     }
     if (!seen_star) {



More information about the Python-checkins mailing list