[3.9] bpo-40769: Allow extra surrounding parentheses for invalid annotated assignment rule (GH-20387) (GH-21186)

(cherry picked from commit c8f29ad986)
This commit is contained in:
Pablo Galindo 2020-06-28 00:40:41 +01:00 committed by GitHub
parent cb0dc52d37
commit 102ca529ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 284 additions and 207 deletions

View file

@ -725,6 +725,19 @@ SyntaxError: trailing comma not allowed without surrounding parentheses
Traceback (most recent call last):
SyntaxError: trailing comma not allowed without surrounding parentheses
>>> (): int
Traceback (most recent call last):
SyntaxError: only single target (not tuple) can be annotated
>>> []: int
Traceback (most recent call last):
SyntaxError: only single target (not list) can be annotated
>>> (()): int
Traceback (most recent call last):
SyntaxError: only single target (not tuple) can be annotated
>>> ([]): int
Traceback (most recent call last):
SyntaxError: only single target (not list) can be annotated
Corner-cases that used to fail to raise the correct error:
>>> def f(*, x=lambda __debug__:0): pass