8000 Internal error when specialization for TypeVarTuple contains multiple unpacked tuples · Issue #18856 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
Internal error when specialization for TypeVarTuple contains multiple unpacked tuples #18856
Closed
@erictraut

Description

@erictraut

The following code results in a mypy "INTERNAL ERROR".

class A[*Ts]: ...

A[*tuple[int, ...], *tuple[int, ...]]  # no error, fails at runtime:
# TypeError: More than one unpacked arbitrary-length tuple argument

b: tuple[*tuple[int, ...], *tuple[int, ...]]  # error, as expected

Here's the stack trace for the crash:

version: 1.15.0
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5903, in accept
  File "mypy/nodes.py", line 2488, in accept
  File "mypy/checkexpr.py", line 4768, in visit_type_application
  File "mypy/checkexpr.py", line 4963, in apply_type_arguments_to_callable
  File "mypy/checkexpr.py", line 4899, in split_for_callable
  File "mypy/typeanal.py", line 2532, in validate_instance
  File "mypy/types.py", line 3732, in find_unpack_in_list
AssertionError: 

I found this when diagnosing a bug reported against pyright.

It may be related to #17755.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongcrashtopic-pep-646PEP 646 (TypeVarTuple, Unpack)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0