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

Crash with TypeVarTuple feature enabled #15633

Closed
wrobell opened this issue Jul 10, 2023 · 1 comment · Fixed by #15924
Closed

Crash with TypeVarTuple feature enabled #15633

wrobell opened this issue Jul 10, 2023 · 1 comment · Fixed by #15924
Labels
crash topic-pep-646 PEP 646 (TypeVarTuple, Unpack)

Comments

@wrobell
Copy link

wrobell commented Jul 10, 2023

Mypy crashes with a simple script (valid or not) when using TypeVarTuple feature.

Python 3.11.3, Mypy 1.4.1.

$ cat ann.py
import typing as tp

Ts = tp.TypeVarTuple('Ts')

def f(x: Ts) -> Ts:
    return x

v = f(1, 2, "A")
reveal_type(v)

$ mypy ann.py
ann.py:3: error: "TypeVarTuple" support is experimental, use --enable-incomplete-feature=TypeVarTuple to enable  [misc]
ann.py:5: error: Variable "ann.Ts" is not valid as a type  [valid-type]
ann.py:5: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
ann.py:8: error: Too many arguments for "f"  [call-arg]
ann.py:9: note: Revealed type is "Ts?"
Found 3 errors in 1 file (checked 1 source file)

$ mypy --enable-incomplete-feature=TypeVarTuple ann.py
ann.py:8: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 1.4.1
ann.py:8: : note: please use --show-traceback to print a traceback when reporting a bug

$ mypy --show-traceback --enable-incomplete-feature=TypeVarTuple ann.py
ann.py:8: 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.4.1
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 4961, in accept
  File "mypy/nodes.py", line 1901, in accept
  File "mypy/checkexpr.py", line 428, in visit_call_expr
  File "mypy/checkexpr.py", line 548, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1208, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1291, in check_call
  File "mypy/checkexpr.py", line 1431, in check_callable_call
  File "mypy/expandtype.py", line 136, in freshen_function_type_vars
  File "mypy/expandtype.py", line 71, in expand_type
  File "mypy/types.py", line 1917, in accept
  File "mypy/expandtype.py", line 429, in visit_callable_type
  File "mypy/expandtype.py", line 536, in expand_types
  File "mypy/types.py", line 841, in accept
  File "mypy/expandtype.py", line 274, in visit_type_var_tuple
NotImplementedError:
ann.py:8: : note: use --pdb to drop into pdb
@hauntsaninja
Copy link
Collaborator

@wrobell is your project open source? Would love some coverage of TypeVarTuple in mypy_primer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash topic-pep-646 PEP 646 (TypeVarTuple, Unpack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants