]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

black/parser: support as-exprs within call args (#2608)
authorBatuhan Taskaya <isidentical@gmail.com>
Sun, 14 Nov 2021 14:04:31 +0000 (17:04 +0300)
committerGitHub <noreply@github.com>
Sun, 14 Nov 2021 14:04:31 +0000 (06:04 -0800)
src/blib2to3/Grammar.txt
tests/data/pattern_matching_extras.py [new file with mode: 0644]
tests/test_format.py

index 49680323d8b8fe83c98bee1940ee4e1d1e1f94d1..c2a62543abb41cdd5e3427804468809389e7da63 100644 (file)
@@ -186,6 +186,7 @@ arglist: argument (',' argument)* [',']
 # that precede iterable unpackings are blocked; etc.
 argument: ( test [comp_for] |
             test ':=' test |
+            test 'as' test |
             test '=' test |
            '**' test |
             '*' test )
diff --git a/tests/data/pattern_matching_extras.py b/tests/data/pattern_matching_extras.py
new file mode 100644 (file)
index 0000000..b17922d
--- /dev/null
@@ -0,0 +1,9 @@
+match something:
+    case [a as b]:
+        print(b)
+    case [a as b, c, d, e as f]:
+        print(f)
+    case Point(a as b):
+        print(b)
+    case Point(int() as x, int() as y):
+        print(x, y)
index 4359deea92ba0b290fee3ac32fdf0fb5b0eefbdd..8f8ffb3610e6951a426049a31beb20bc44e07015 100644 (file)
@@ -73,6 +73,7 @@ EXPERIMENTAL_STRING_PROCESSING_CASES = [
 PY310_CASES = [
     "pattern_matching_simple",
     "pattern_matching_complex",
+    "pattern_matching_extras",
     "parenthesized_context_managers",
 ]