[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:
Pablo Galindo 2021-06-18 22:15:57 +01:00 committed by GitHub
parent bf55a799e0
commit a8c418d5ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 332 additions and 213 deletions

View file

@ -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