Skip to content

(🐞) Crash with ParamSpec and Unpack in Generic #16695

@KotlinIsland

Description

@KotlinIsland

This should not be a crash, it should be handled properly and show an error.

from typing import Generic, ParamSpec, TypeVarTuple, Unpack

P = ParamSpec("P")
Ts = TypeVarTuple("Ts")


class C(Generic[P, Unpack[Ts]]): ...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "mypy/semanal.py", line 6525, in accept
  File "mypy/nodes.py", line 1140, in accept
  File "mypy/semanal.py", line 1608, in visit_class_def
  File "mypy/semanal.py", line 1680, in analyze_class
  File "mypy/semanal.py", line 1699, in setup_type_vars
  File "mypy/nodes.py", line 3088, in add_type_vars
AssertionError: Mixing type var tuples and param specs not supported yet
main.py:6: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.7.1
main.py:6: : note: use --pdb to drop into pdb

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions