mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
bpo-44456: Improve the syntax error when mixing keyword and positional patterns (GH-26793)
(cherry picked from commit 0acc258fe6
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
b3fac2926b
commit
11f1a30cdb
6 changed files with 843 additions and 635 deletions
|
@ -1240,6 +1240,30 @@ Corner-cases that used to crash:
|
|||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid pattern target
|
||||
|
||||
>>> match ...:
|
||||
... case Foo(z=1, y=2, x):
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: positional patterns follow keyword patterns
|
||||
|
||||
>>> match ...:
|
||||
... case Foo(a, z=1, y=2, x):
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: positional patterns follow keyword patterns
|
||||
|
||||
>>> match ...:
|
||||
... case Foo(z=1, x, y=2):
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: positional patterns follow keyword patterns
|
||||
|
||||
>>> match ...:
|
||||
... case C(a=b, c, d=e, f, g=h, i, j=k, ...):
|
||||
... ...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: positional patterns follow keyword patterns
|
||||
"""
|
||||
|
||||
import re
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue