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 hangs when using fmt:on/off improperly #3129

Closed
vhoulbreque opened this issue Jun 20, 2022 · 0 comments · Fixed by #3158
Closed

Black hangs when using fmt:on/off improperly #3129

vhoulbreque opened this issue Jun 20, 2022 · 0 comments · Fixed by #3158
Labels
F: fmtoff fmt: off implementation T: bug Something isn't working

Comments

@vhoulbreque
Copy link

vhoulbreque commented Jun 20, 2022

Description

The following code fails:

# -*- coding: utf-8 -*-

setup(
    entry_points={
        # fmt: off
        "console_scripts": [
            "foo-bar"
            "=foo.bar.:main",
        # fmt: on
        ]
    },
)

The following code works:

# -*- coding: utf-8 -*-

setup(
    entry_points={
        # fmt: off
        "console_scripts": [
            "foo-bar"
            "=foo.bar.:main",
        ]
    # fmt: on
    },
)

While running it with these arguments:

$ black file.py

For the first code, there is no error: it just hangs indefinitely. It is also impossible to "CTRL + C" the command.

Expected behavior

Either:

  • a fail ("You are using fmt wrong")
  • or change the "fmt" functionality to make the first snippet above work.

Environment

  • Black's version: 22.3.0
  • OS and Python version: Ubuntu 20.04 / 21.04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: fmtoff fmt: off implementation T: bug Something isn't working
Projects
None yet
2 participants