diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2021-01-02 23:14:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-02 23:14:21 (GMT) |
commit | 2ea320dddd553298038bb7d6789e50e199332f66 (patch) | |
tree | e0388038b94c848cc18922f86ff0cb82e4c44465 /Lib | |
parent | 8f8de7380cd7fee4972a10240ad2b0fdc332b14d (diff) | |
download | cpython-2ea320dddd553298038bb7d6789e50e199332f66.zip cpython-2ea320dddd553298038bb7d6789e50e199332f66.tar.gz cpython-2ea320dddd553298038bb7d6789e50e199332f66.tar.bz2 |
bpo-40631: Disallow single parenthesized star target (GH-24027)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unpack_ex.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index fcc9382..049e48b 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -346,6 +346,31 @@ Now some general starred expressions (all fail). ... SyntaxError: can't use starred expression here + >>> (*x),y = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> (((*x))),y = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> z,(*x),y = 1, 2, 4 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> z,(*x) = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> ((*x),y) = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + Some size constraints (all fail.) >>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)" |