mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
[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:
parent
cb0dc52d37
commit
102ca529ef
3 changed files with 284 additions and 207 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue