mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser (GH-20697)
Automerge-Triggered-By: @pablogsal
This commit is contained in:
parent
843c277656
commit
9f495908c5
5 changed files with 558 additions and 342 deletions
|
@ -63,6 +63,10 @@ SyntaxError: cannot assign to __debug__
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: cannot assign to function call
|
||||
|
||||
>>> yield = 1
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to yield expression not possible
|
||||
|
||||
>>> del f()
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: cannot delete function call
|
||||
|
@ -136,6 +140,18 @@ SyntaxError: cannot assign to operator
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: cannot assign to conditional expression
|
||||
|
||||
>>> True = True = 3
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: cannot assign to True
|
||||
|
||||
>>> x = y = True = z = 3
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: cannot assign to True
|
||||
|
||||
>>> x = y = yield = 1
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: assignment to yield expression not possible
|
||||
|
||||
>>> a, b += 1, 2
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: 'tuple' is an illegal expression for augmented assignment
|
||||
|
@ -148,6 +164,10 @@ SyntaxError: 'tuple' is an illegal expression for augmented assignment
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: 'list' is an illegal expression for augmented assignment
|
||||
|
||||
>>> p = p =
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
From compiler_complex_args():
|
||||
|
||||
>>> def f(None=1):
|
||||
|
@ -155,7 +175,6 @@ From compiler_complex_args():
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
|
||||
From ast_for_arguments():
|
||||
|
||||
>>> def f(x, y=1, z):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue