Skip to content

Recursive use of ParamSpec #13191

@ikonst

Description

@ikonst

Bug Report

Passing ParamSpec'd function (e.g. named spawn) to itself results in an error:

Argument 1 to "spawn" has incompatible type "Callable[[Arg(Callable[P, T], 'f'), **P], str]";
                                   expected "Callable[[Arg(Callable[P, T], 'f'), **P], str]"

^ indentation added to highlight that the 'actual' and 'expected' types are the same (at least in their rendered form)

My motivation was to type-annotate Greenlet.spawn of the gevent library.

To Reproduce

Gist URL: https://gist.github.com/05a7c5bb1a380684d82210e5589fb048
Playground URL: https://mypy-play.net/?mypy=latest&python=3.10&gist=05a7c5bb1a380684d82210e5589fb048

Your Environment

  • Mypy version used: 0.961
  • Python version used: 3.10

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