Skip to content

ParamSpec accepts multiple copies of *args and **kwargs #18035

Closed
@sterliakov

Description

@sterliakov

Bug Report

ParamSpec checker does not enforce that *args or **kwargs are only provided once.

The following code (or playground) should not check:

To Reproduce

[case testRepeatedArgs]
from typing_extensions import ParamSpec
from typing import Callable

P = ParamSpec("P")

def run(func: Callable[P, None], *args: P.args, **kwargs: P.kwargs) -> None:
    func(*args, *args, **kwargs)
    func(*args, **kwargs, **kwargs)

[builtins fixtures/paramspec.pyi]

Expected Behavior

Should produce errors for both func calls.

Actual Behavior

Green output: 0 errors.

Your Environment

  • Mypy version used: master, 1.13.0, 1.0.0
  • Mypy command-line flags: --strict or without it
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.11 (irrelevant)

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