]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332) ...
authorPablo Galindo <Pablogsal@gmail.com>
Wed, 18 Nov 2020 23:44:30 +0000 (23:44 +0000)
committerGitHub <noreply@github.com>
Wed, 18 Nov 2020 23:44:30 +0000 (23:44 +0000)
commit87c87b5bd6f6a5924b485398f353308410f9d8c1
tree6760033eee437c188edf6b52b71b3469086a7623
parent36619e1bc49d2e5dbfc86a9f0a54f478fe4a8c2b
[3.9] bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332) (GH-23333)

Currently walruses are not allowerd in set literals and set comprehensions:

>>> {y := 4, 4**2, 3**3}
  File "<stdin>", line 1
    {y := 4, 4**2, 3**3}
       ^
SyntaxError: invalid syntax

but they should be allowed as well per PEP 572.
(cherry picked from commit b0aba1fcdc3da952698d99aec2334faa79a8b68c)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Grammar/python.gram
Lib/test/test_named_expressions.py
Misc/NEWS.d/next/Core and Builtins/2020-11-16-23-45-56.bpo-42381.G4AWxL.rst [new file with mode: 0644]
Parser/pegen/parse.c