]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-40334: Produce better error messages on invalid targets (GH-20106) (GH...
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Fri, 19 Jun 2020 00:03:58 +0000 (03:03 +0300)
committerGitHub <noreply@github.com>
Fri, 19 Jun 2020 00:03:58 +0000 (01:03 +0100)
commita5442b26f46f1073d1eb78895d554be520105ecb
tree1a379f5da5dfe6875985fae1c57c6a35ffbf1014
parentb1e736113484c99acb57e4acb417b91a9e58e7ff
[3.9] bpo-40334: Produce better error messages on invalid targets (GH-20106) (GH-20973)

* 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>
(cherry picked from commit 01ece63d42b830df106948db0aefa6c1ba24416a)
Grammar/python.gram
Lib/test/test_exceptions.py
Lib/test/test_syntax.py
Parser/pegen/parse.c
Parser/pegen/pegen.c
Parser/pegen/pegen.h