KEMBAR78
Incompletely defining a `TypeAliasType` causes mypy to crash · Issue #18307 · python/mypy · GitHub
Skip to content

Incompletely defining a TypeAliasType causes mypy to crash #18307

@bzoracler

Description

@bzoracler

Crash Report, Reproduction, & Traceback

See mypy Playground. This causes usability issues with the mypy daemon, as the session would need to be relaunched with a long startup wait.

from typing_extensions import TypeAliasType

MyType = TypeAliasType("MyType")
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 7113, in accept
  File "mypy/nodes.py", line 1351, in accept
  File "mypy/semanal.py", line 3119, in visit_assignment_stmt
  File "mypy/semanal.py", line 3863, in check_and_set_up_type_alias
IndexError: list index out of range

main.py:3: 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.13.0
main.py:3: : note: use --pdb to drop into pdb

Your Environment

  • Mypy version used: 1.13
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions