Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
itamarst opened this issue Apr 12, 2024 · 2 comments · May be fixed by python/mypy#17309
Open

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

itamarst opened this issue Apr 12, 2024 · 2 comments · May be fixed by python/mypy#17309

Comments

@itamarst
Copy link

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)
@kai3341
Copy link

kai3341 commented Jun 1, 2024

Bump. Same issue on:

Python 3.11.2
mypy==1.10.0 (compiled: yes)

hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Jun 1, 2024
@hauntsaninja hauntsaninja linked a pull request Jun 1, 2024 that will close this issue
@hauntsaninja
Copy link
Collaborator

Fix is trivial, I think python/mypy#17309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants