Skip to content

False-negative: ParamSpec.args annotating non-*args #14622

Closed
@ikonst

Description

@ikonst

Per the docs, "P.args ... should only be used to annotate *args":

from typing import ParamSpec

P = ParamSpec('P')


def f(args: P.args) -> None:
    g(*args)


def g(a: str) -> None:
    print(type(a))
    
    

f(42)

Gist:
https://mypy-play.net/?mypy=latest&python=3.11&gist=28f03ed1b30e9707edfd080095b6a868

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-paramspecPEP 612, ParamSpec, Concatenate

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions