]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Thu, 14 May 2020 20:13:50 +0000 (23:13 +0300)
committerGitHub <noreply@github.com>
Thu, 14 May 2020 20:13:50 +0000 (21:13 +0100)
commitce21cfca7bb2d18921bc4ac27cb064726996c519
tree04a1dad07cbb70619149b3dc867b515ed64b62f5
parentbcc30360951a303aa72b0502b77aad2c5f09f30d
bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)

This commit fixes the new parser to disallow invalid targets in the
following scenarios:
- Augmented assignments must only accept a single target (Name,
  Attribute or Subscript), but no tuples or lists.
- `except` clauses should only accept a single `Name` as a target.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Grammar/python.gram
Lib/test/test_grammar.py
Lib/test/test_peg_parser.py
Lib/test/test_syntax.py
Parser/pegen/parse.c