Skip to content

Empty line and ... and "unindent does not match any outer indentation level" #4291

Closed
@Azureblade3808

Description

Describe the bug

If the first line inside an indented function is empty and the body is ..., black fails to format it.

To Reproduce
https://black.vercel.app/?version=main&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4ACQAFxdAD2IimZxl1N_WlXnON2nzNJyA7rxEz3ITq0Rr8lcyuT-7lJq6-30yBPNldub44lXXOBKYonCShOJuW7cuZ_9TCCgKPjpZqqogwanJNRK0YrZc4gHqvyNL22TtygAACOiGQzKhfHyAAF4kQEAAAC0Mv5wscRn-wIAAAAABFla

class C:
    def f(self):

        ...

Expected behavior

The snippet above can be formatted.

Environment

  • Black's version: Stable: 24.1.0 | Main: @ed770b
  • OS and Python version: irrelevant

Additional context

None.

Edit

Function body being ... is a key condition.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C: crashBlack is crashingT: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions