mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft keywords (GH-26630)
This commit is contained in:
parent
878d7e4ee4
commit
457ce60fc7
3 changed files with 31 additions and 5 deletions
|
@ -267,7 +267,7 @@ Traceback (most recent call last):
|
|||
SyntaxError: invalid syntax. Perhaps you forgot a comma?
|
||||
|
||||
# Make sure soft keywords constructs don't raise specialized
|
||||
# errors regarding missing commas
|
||||
# errors regarding missing commas or other spezialiced errors
|
||||
|
||||
>>> match x:
|
||||
... y = 3
|
||||
|
@ -280,6 +280,24 @@ SyntaxError: invalid syntax
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> match x:
|
||||
... case $:
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> match ...:
|
||||
... case {**rest, "key": value}:
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> match ...:
|
||||
... case {**_}:
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
From compiler_complex_args():
|
||||
|
||||
>>> def f(None=1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue