mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-133999: Fix except
parsing regression in 3.14 (#134035)
This commit is contained in:
parent
7a9d46295a
commit
84914ad0e5
4 changed files with 43 additions and 12 deletions
|
@ -1431,6 +1431,23 @@ Better error message for using `except as` with not a name:
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: cannot use except* statement with literal
|
||||
|
||||
Regression tests for gh-133999:
|
||||
|
||||
>>> try: pass
|
||||
... except TypeError as name: raise from None
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> try: pass
|
||||
... except* TypeError as name: raise from None
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> match 1:
|
||||
... case 1 | 2 as abc: raise from None
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
Ensure that early = are not matched by the parser as invalid comparisons
|
||||
>>> f(2, 4, x=34); 1 $ 2
|
||||
Traceback (most recent call last):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue