bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)

This commit is contained in:
Pablo Galindo 2021-06-10 23:50:32 +01:00 committed by GitHub
parent e7b4644607
commit 05073036dc
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