KEMBAR78
(🐞) Wrong column number for "Invalid location for ParamSpec" · Issue #12274 · python/mypy · GitHub
Skip to content

(🐞) Wrong column number for "Invalid location for ParamSpec" #12274

@KotlinIsland

Description

@KotlinIsland
from typing import List, ParamSpec

P = ParamSpec('P')

def foo(x: List[P]) -> None: ...
test.py:5:13: error: Invalid location for ParamSpec "P"  [misc]
test.py:5:18: note: You can use ParamSpec as the first argument to Callable, e.g., 'Callable[P, int]'
Found 2 errors in 1 file (checked 1 source file)

Column 13 is the L in List. The error and the note don't match up.

Notice that the error and the note specify different column numbers.

An internal error with the correct column number is generated, but is removed as a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions