Skip to content

AssertionError: unexpected type <class 'mypy.types.ParamSpecType'> #1051

Closed
python/mypy
#17309
@itamarst

Description

@itamarst

Consider the following module:

from typing import Callable, ParamSpec, TypeVar

_P = ParamSpec("_P")
_T = TypeVar("_T")

def execute(
    func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs
) -> _T:
    return func(*args, **kwargs)

I can check it with mypy, but not compile it with mypyc:

$ mypy repro.py 
Success: no issues found in 1 source file
$ mypyc repro.py 
Traceback (most recent call last):
  File "mypyc/irbuild/builder.py", line 266, in accept
  File "mypy/nodes.py", line 787, in accept
  File "mypyc/irbuild/visitor.py", line 179, in visit_func_def
  File "mypyc/irbuild/function.py", line 99, in transform_func_def
  File "mypyc/irbuild/function.py", line 284, in gen_func_item
  File "mypyc/irbuild/env_class.py", line 102, in load_env_registers
  File "mypyc/irbuild/env_class.py", line 179, in add_args_to_env
  File "mypyc/irbuild/env_class.py", line 165, in num_bitmap_args
  File "mypyc/irbuild/builder.py", line 1233, in type_to_rtype
  File "mypyc/irbuild/mapper.py", line 153, in type_to_rtype
repro.py:6: AssertionError: unexpected type <class 'mypy.types.ParamSpecType'>

Versions:

Python 3.11.9
mypy 1.9.0 (compiled: yes)
mypyc 1.9.0 (compiled: yes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions