Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grammar: match subject can include starred expression #2647

Closed
isidentical opened this issue Nov 26, 2021 · 0 comments · Fixed by #2659
Closed

grammar: match subject can include starred expression #2647

isidentical opened this issue Nov 26, 2021 · 0 comments · Fixed by #2659
Labels
T: bug Something isn't working

Comments

@isidentical
Copy link
Collaborator

E.g:

(.venv) (3.9.5) [  6:51ÖS ]  [ isidentical@msi:~ ]
 $ cat t.py                                                                                                   122ms
match x, *something:
    case _:
        pass
        
(.venv) (3.9.5) [  6:51ÖS ]  [ isidentical@msi:~ ]
 $ black -tpy310 --fast t.py                                                                                    2ms
error: cannot format t.py: Cannot parse: 1:6: match x, *something:
Oh no! 💥 💔 💥
1 file failed to reformat.
(.venv) (3.9.5) [  6:51ÖS ]  [ isidentical@msi:~ ]
 $ .venv310/bin/python -m ast t.py                                                                            135ms
Module(
   body=[
      Match(
         subject=Tuple(
            elts=[
               Name(id='x', ctx=Load()),
               Starred(
                  value=Name(id='something', ctx=Load()),
                  ctx=Load())],
            ctx=Load()),
         cases=[
            match_case(
               pattern=MatchAs(),
               body=[
                  Pass()])])],
   type_ignores=[])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant