mirror of
https://github.com/python/cpython.git
synced 2025-08-09 03:19:15 +00:00
[3.12] gh-109120: Fix syntax error in handlinh of incorrect star expressions… (#117465)
gh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444)
(cherry picked from commit c97d3af239
)
This commit is contained in:
parent
663e7bc2ee
commit
a49426afaa
4 changed files with 3241 additions and 3038 deletions
|
@ -1816,22 +1816,22 @@ A[*(1:2)]
|
|||
>>> A[*(1:2)]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
>>> A[*(1:2)] = 1
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
>>> del A[*(1:2)]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
A[*:] and A[:*]
|
||||
|
||||
>>> A[*:]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
>>> A[:*]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
|
@ -1842,7 +1842,7 @@ A[*]
|
|||
>>> A[*]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
A[**]
|
||||
|
||||
|
@ -1986,11 +1986,23 @@ Invalid expressions in type scopes:
|
|||
|
||||
>>> f(**x, *)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: iterable argument unpacking follows keyword argument unpacking
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
>>> f(x, *:)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
>>> f(x, *)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
>>> f(x = 5, *)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Invalid star expression
|
||||
|
||||
>>> f(x = 5, *:)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: Invalid star expression
|
||||
"""
|
||||
|
||||
import re
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue