]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40334: Produce better error messages on invalid targets (GH-20106)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Thu, 18 Jun 2020 23:10:43 +0000 (02:10 +0300)
committerGitHub <noreply@github.com>
Thu, 18 Jun 2020 23:10:43 +0000 (00:10 +0100)
commit01ece63d42b830df106948db0aefa6c1ba24416a
tree0bb2f932d4604c12507dd79b12b06d4dafc46e8b
parentd906f0ec1a5f4ec29a4de74240acf43139886514
bpo-40334: Produce better error messages on invalid targets (GH-20106)

The following error messages get produced:
- `cannot delete ...` for invalid `del` targets
- `... is an illegal 'for' target` for invalid targets in for
  statements
- `... is an illegal 'with' target` for invalid targets in
  with statements

Additionally, a few `cut`s were added in various places before the
invocation of the `invalid_*` rule, in order to speed things
up.

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