mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)
This commit is contained in:
parent
e7b4644607
commit
05073036dc
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