mirror of
https://github.com/python/cpython.git
synced 2025-09-25 09:50:37 +00:00
[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 01ece63d42
)
This commit is contained in:
parent
b1e7361134
commit
a5442b26f4
6 changed files with 2649 additions and 2258 deletions
|
@ -253,7 +253,7 @@ class ExceptionTests(unittest.TestCase):
|
|||
check('foo(x for x in range(10), 100)', 1, 5)
|
||||
check('(yield i) = 2', 1, 1 if support.use_old_parser() else 2)
|
||||
check('def f(*):\n pass', 1, 7 if support.use_old_parser() else 8)
|
||||
check('for 1 in []: pass', 1, 5 if support.use_old_parser() else 7)
|
||||
check('for 1 in []: pass', 1, 5)
|
||||
|
||||
@cpython_only
|
||||
def testSettingException(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue