Skip to content

Bug: fails to properly format constrained generics with new 3.12 syntax #4740

@dominiquegarmier

Description

@dominiquegarmier

Describe the bug
when formatting the following snippet

def func1[T: (int, str)](a,): ...

we get

def func1[T: (
    int,
    str,
)](a,): ...

we would expect:

def func[T: (int, str)](
    a,
): ...

black version

black --version
black, 25.1.0 (compiled: yes)
Python (CPython) 3.12.7

This is more specific case of a bug discussed in #4254 (which has been fixed in 25.1.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions