Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sterliakov opened this issue Oct 24, 2024 · 0 comments · Fixed by #18854
Closed

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

sterliakov opened this issue Oct 24, 2024 · 0 comments · Fixed by #18854
Labels
bug mypy got something wrong topic-paramspec PEP 612, ParamSpec, Concatenate

Comments

@sterliakov
Copy link
Collaborator

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-paramspec PEP 612, ParamSpec, Concatenate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants