Skip to content

Paramspec cannot be used as tuple/dict #12386

Closed
@kasium

Description

@kasium

Bug Report

I face issues, when using ParamSpec.args as a tuple and ParamSpec.kwargs as a dict

To Reproduce

Execute mypy on the following code

from typing_extensions import ParamSpec
from typing import Callable

P = ParamSpec("P")

def foo(func: Callable[P, None]):
    def _inner(*args: P.args, **kwargs: P.kwargs):
        x = kwargs.pop("x")

Expected Behavior

It works

Actual Behavior

Error: test.py:8:13: error: "P.kwargs" has no attribute "pop" [attr-defined]

Your Environment

  • Mypy version used: 0.941
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.7.1
  • Operating system and version: Linux

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