Skip to content

No error when mutating ParamSpec **kwargs #16157

Description

@kmurphy4

Bug Report

Even though it fails at runtime, mypy doesn't complain if I mutate ParamSpec.kwargs.

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.11&gist=f5cea6637a9ea13c48b8ba75aa8d73dd

If I run this same code in an interpreter, I get

Traceback (most recent call last):
  File "/tmp/repro.py", line 16, in <module>
    print(bar(foo))
  File "/tmp/repro.py", line 13, in bar
    return f(*args, **kwargs)
TypeError: foo() got an unexpected keyword argument 'ka'

Expected Behavior

I would expect this to trigger an error on line 12.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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