Skip to content

TypeVarTuple causes mypy crash #17127

@kdkavanagh

Description

@kdkavanagh

Crash Report

mypy crashes when it encounters an overload signature containing a TypeVarTuple like:

@overload
    def cast(
        self, typ: type[MyType[SomeOtherTypeVar, *TheTupleTs]]
    ) -> MyType[SomeOtherTypeVar, *TheTupleTs]: ...

Traceback

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.9.0
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5742, in accept
  File "mypy/nodes.py", line 1904, in accept
  File "mypy/checkexpr.py", line 476, in visit_call_expr
  File "mypy/checkexpr.py", line 605, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1443, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1549, in check_call
  File "mypy/checkexpr.py", line 2633, in check_overload_call
  File "mypy/checkexpr.py", line 2979, in union_overload_result
  File "mypy/checkexpr.py", line 2816, in infer_overload_return_type
  File "mypy/checkexpr.py", line 1538, in check_call
  File "mypy/checkexpr.py", line 1723, in check_callable_call
  File "mypy/checkexpr.py", line 2136, in infer_function_type_arguments
  File "mypy/expandtype.py", line 68, in expand_type
  File "mypy/types.py", line 859, in accept
  File "mypy/expandtype.py", line 263, in visit_type_var_tuple
NotImplementedError:

Your Environment

  • Mypy version used: 1.9.0
  • Mypy command-line flags: mypy --install-types --show-traceback --non-interactive src/$(PACKAGE_NAME)
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.11.7
  • Operating system and version: rhel8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions