Skip to content

ParamSpec P.args not Iterable; P.kwags does not have "Items" #12660

Closed
@rbroderi

Description

@rbroderi
P = ParamSpec("P")
R = TypeVar("R")
  def dec_test(func: Callable[P, R]) -> Callable[P, R]:
      @wraps(func)
      def inner(*args: P.args, **kwargs: P.kwargs) -> R:
          for a in args:
              print(a)
          for arg_k, arg_v in kwargs.items():
              print(f"{arg_k},{arg_v}"
          return func(*args, **kwargs)
  
      return inner

Expected Behavior
P.args should be iterable
P.kwargs should have items()

Actual Behavior
"P.args" has no attribute "iter" (not iterable)
"P.kwargs" has no attribute "items"
Your Environment

  • Mypy version used: 0.931
  • Python version used: 3.10.4
  • Operating system and version: Windows 10

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