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

Crash in preview style with multiline quoted return-position type hint #3435

Closed
intgr opened this issue Dec 12, 2022 · 3 comments · Fixed by #3462
Closed

Crash in preview style with multiline quoted return-position type hint #3435

intgr opened this issue Dec 12, 2022 · 3 comments · Fixed by #3462
Labels
C: crash Black is crashing C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. T: bug Something isn't working

Comments

@intgr
Copy link

intgr commented Dec 12, 2022

Describe the bug

When using --preview, this input causes error message "Unable to match a closing bracket to the following opening bracket: )". No issues when running without --preview

Looks similar to #3414, but I can still reproduce this issue in main branch.

To Reproduce

from typing import Generic, TypeVar

T = TypeVar("T")


class VeryLongClassNameWithAwkwardGenericSubtype(Generic[T]):
    pass


def something(
    argument: (
        "VeryLongClassNameWithAwkwardGenericSubtype[int] |"
        "VeryLongClassNameWithAwkwardGenericSubtype[str]"
    ),
) -> (
    "VeryLongClassNameWithAwkwardGenericSubtype[int] |"
    "VeryLongClassNameWithAwkwardGenericSubtype[str]"
):
    ...

Environment

  • Black's version: 22.12.1.dev7+gabd2b25
  • OS and Python version: 3.10.8, macOS
@intgr intgr added the T: bug Something isn't working label Dec 12, 2022
@JelleZijlstra
Copy link
Collaborator

thanks, cc @yilei as for the previous similar crash

@JelleZijlstra JelleZijlstra added the C: crash Black is crashing label Dec 12, 2022
@yilei
Copy link
Contributor

yilei commented Dec 12, 2022

Quick note: this bug exists in v22.1.0 so it's pretty old.

@JelleZijlstra JelleZijlstra added the C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. label Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: crash Black is crashing C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants