Skip to content

mypyc crashes when working on ParamSpec.kwargs #18784

@kasium

Description

@kasium

Bug Report

When using mypyc on code using ParamSpec.kwargs, a crash occurs

To Reproduce

from __future__ import annotations

from typing import Any, Callable, ParamSpec, TypeVar

PARAM = ParamSpec("PARAM")
RET = TypeVar("RET")


def decorator() -> Callable[[Callable[PARAM, RET]], Callable[PARAM, RET]]:
    def _wrapper(function: Callable[PARAM, RET]) -> Callable[PARAM, RET]:
        def _inner(*args: PARAM.args, **kwargs: PARAM.kwargs) -> Any:
            data = {key: arg for key, arg in kwargs.items()}
            function(*args, **kwargs)

        return _inner

    return _wrapper

Expected Behavior

no crash

Actual Behavior

Traceback (most recent call last):
foo.py:13: AssertionError: PARAM.kwargs`-1

Your Environment

  • Mypy version used: mypy 1.15.0 (compiled: yes)
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: 3.13.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions