Skip to content

ParamSpec too many arguments #12844

@markedwards

Description

@markedwards

Bug Report

Passing list to a function which implements ParamSpec results in mypy throwing Too many arguments when trying to use the result.

To Reproduce

Example:

from typing import Callable, TypeVar

from typing_extensions import ParamSpec

P = ParamSpec('P')
R = TypeVar('R')


def wrapper(func: Callable[P, R]) -> Callable[P, R]:
    return func


wrapper(list)([1, 2, 3])  # "Too many arguments"

Expected Behavior

mypy should treat wrapper(list) exactly the same as list in this case.

Actual Behavior

"Too many arguments" is thrown when using the result of wrapper(list)

Your Environment

  • Mypy version used: 0.950
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files): follow_imports = silent, ignore_missing_imports = True, strict = True
  • Python version used: 3.10.4
  • Operating system and version: Debian bullseye

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions