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

[3.10] Match formatting does not support multiple value #2637

Closed
titouanfreville opened this issue Nov 23, 2021 · 1 comment · Fixed by #2639
Closed

[3.10] Match formatting does not support multiple value #2637

titouanfreville opened this issue Nov 23, 2021 · 1 comment · Fixed by #2639
Labels
C: parser How we parse code. Or fail to parse it. C: target version Related to --target-version, e.g. autodetection T: bug Something isn't working

Comments

@titouanfreville
Copy link

titouanfreville commented Nov 23, 2021

Hello and thanks for this library and the reactivity to support python 3.10 new syntaxes.

Describe the bug

While running with the latest version (gotten from git),basic match on a single pattern is correctly supported <3
But it seems that it does not support multiple match value.

I tried on a simple example after observing it on my real code:

To Reproduce

a = 11
b = 12

match a, b:
    case _, 5:
        print("a5")
    case 11, 12:
        print("default")
    case _:
        print("badass")

Should be able to parse. It runs correctly:

python test_black.py 
default

But black fails :'(

black --target-version py310  test_black.py
error: cannot format test_black.py: Cannot parse: 4:6: match a, b:
Oh no! 💥 💔 💥
1 file failed to reformat.

Expected behavior

Should format without errors

Environment

  • Black's version: black, 21.11b2.dev3+g4075944 (compiled: no)
  • OS and Python version: Linux[DevContainer]/3.10

Additional context

@titouanfreville titouanfreville added the T: bug Something isn't working label Nov 23, 2021
@ichard26 ichard26 added C: blib2to3 C: parser How we parse code. Or fail to parse it. C: target version Related to --target-version, e.g. autodetection labels Nov 23, 2021
@titouanfreville
Copy link
Author

Thanks for the fix <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: parser How we parse code. Or fail to parse it. C: target version Related to --target-version, e.g. autodetection T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants