]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
lib2to3: Support named assignment expressions (GH-12702)
authorTim Hatch <tim@timhatch.com>
Thu, 2 Apr 2020 22:34:54 +0000 (15:34 -0700)
committerGitHub <noreply@github.com>
Thu, 2 Apr 2020 22:34:54 +0000 (15:34 -0700)
commit3c3aa4516c70753de06bb142b6793d01330fcf0f
treecea6e6cc2cfc646d8ff84aff0c5bf596417e598c
parent45217af29c7f380089af17beb48a5ea0560bbb9d
lib2to3: Support named assignment expressions (GH-12702)

There are two copies of the grammar -- the one used by Python itself as
Grammar/Grammar, and the one used by lib2to3 which has necessarily diverged at
Lib/lib2to3/Grammar.txt because it needs to support older syntax an we want it
to be reasonable stable to avoid requiring fixer rewrites.

This brings suport for syntax like `if x:= foo():` to match what the live
Python grammar does.

This should've been added at the time of the walrus operator itself, but lib2to3 being
independent is often overlooked.  So we do consider this a bugfix rather than enhancement.
Lib/lib2to3/Grammar.txt
Lib/lib2to3/pgen2/grammar.py
Lib/lib2to3/pgen2/token.py
Lib/lib2to3/pgen2/tokenize.py
Lib/lib2to3/tests/test_parser.py
Misc/NEWS.d/next/Library/2019-06-18-19-38-27.bpo-36541.XI8mi1.rst [new file with mode: 0644]