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

mypyc crashes with ParamSpec #15409

Closed
kasium opened this issue Jun 10, 2023 · 1 comment
Closed

mypyc crashes with ParamSpec #15409

kasium opened this issue Jun 10, 2023 · 1 comment
Labels
crash topic-mypyc mypyc bugs topic-paramspec PEP 612, ParamSpec, Concatenate

Comments

@kasium
Copy link

kasium commented Jun 10, 2023

I did my first try with mypyc but it directly crashes when I use ParamSpec

To Reproduce

from __future__ import annotations
from typing import Any, Callable, TypeVar, ParamSpec

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:
            return function(*args, **kwargs)

        return _inner

    return _wrapper

Expected Behavior
Works

Actual Behavior

Traceback (most recent call last):
  File "mypyc/irbuild/builder.py", line 265, in accept
  File "mypy/nodes.py", line 774, in accept
  File "mypyc/irbuild/visitor.py", line 179, in visit_func_def
  File "mypyc/irbuild/function.py", line 98, in transform_func_def
  File "mypyc/irbuild/function.py", line 275, 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 1236, in type_to_rtype
  File "mypyc/irbuild/mapper.py", line 143, in type_to_rtype
foo.py:11: AssertionError: unexpected type <class 'mypy.types.ParamSpecType'>

Your Environment

  • Mypy version used: 1.3.0
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: 3.11.0
@kasium kasium added the bug mypy got something wrong label Jun 10, 2023
@AlexWaygood AlexWaygood added crash topic-paramspec PEP 612, ParamSpec, Concatenate topic-mypyc mypyc bugs and removed bug mypy got something wrong labels Jun 10, 2023
@ilevkivskyi
Copy link
Member

The original example works on master, likely fixed by #15837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash topic-mypyc mypyc bugs topic-paramspec PEP 612, ParamSpec, Concatenate
Projects
None yet
Development

No branches or pull requests

3 participants