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

Black adds unexpected trailing comma in return type wrapped in parenthesis #3638

Closed
yilei opened this issue Apr 3, 2023 · 0 comments · Fixed by #3735
Closed

Black adds unexpected trailing comma in return type wrapped in parenthesis #3638

yilei opened this issue Apr 3, 2023 · 0 comments · Fixed by #3735
Labels
T: bug Something isn't working

Comments

@yilei
Copy link
Contributor

yilei commented Apr 3, 2023

Code before:

def asdf_asdf_asdf_asdf_asdf() -> my_module.Asdf | my_module.AnotherType | my_module.YetAnotherType | None:
    pass

Black formatted to:

def asdf_asdf_asdf_asdf_asdf() -> (
    my_module.Asdf | my_module.AnotherType | my_module.YetAnotherType | None,
):
    pass

The trailing comma is incorrect, see playground.

@yilei yilei added the T: bug Something isn't working label Apr 3, 2023
yilei added a commit to yilei/black that referenced this issue Jun 15, 2023
JelleZijlstra pushed a commit that referenced this issue Jun 16, 2023
…nions (#3735)

Fix #3638: Do not add trailing commas to return type annotations using PEP 604 unions.
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