#3946·black

Black puts "pyright: ignore" comments on the wrong line

Author: RobinFrcdCreated Oct 16, 2023Updated Sep 13, 2026
LabelsT: bugF: comments

Hi, I've switched to VS code and pyright recently, and I realized black is breaking a lot of # pyright: ignore comments.

Input (both are valid for pyright):

python
asm_client: SecretsManagerClient = boto3.client("secretsmanager") # pyright: ignore[reportUnknownMemberType]
asm_client: SecretsManagerClient = boto3.client( # pyright: ignore[reportUnknownMemberType]
    "secretsmanager"
)  

Output:

python
asm_client: SecretsManagerClient = boto3.client(
    "secretsmanager"
)  # pyright: ignore[reportUnknownMemberType]
asm_client: SecretsManagerClient = boto3.client(
    "secretsmanager"
)  # pyright: ignore[reportUnknownMemberType]

Is there a way to stick the pyright comment to the original line ?

I'm using:

black, 23.9.1 (compiled: yes)
Python (CPython) 3.11.6

Thanks