mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
[3.10] bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632) (GH-26792)
(cherry picked from commit 05073036dc
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
bf55a799e0
commit
a8c418d5ed
4 changed files with 332 additions and 213 deletions
|
@ -1226,6 +1226,20 @@ Corner-cases that used to crash:
|
|||
>>> import ä £
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid character '£' (U+00A3)
|
||||
|
||||
Invalid pattern matching constructs:
|
||||
|
||||
>>> match ...:
|
||||
... case 42 as _:
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: cannot use '_' as a target
|
||||
|
||||
>>> match ...:
|
||||
... case 42 as 1+2+4:
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid pattern target
|
||||
"""
|
||||
|
||||
import re
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue