Closed
Description
mypy crashes on a recursive definition if --disallow-any-generics
is enabled.
Here's a sample:
$ cat crash.py
from typing import NamedTuple
N = NamedTuple('N', [('x', N)])
n: N
$ mypy crash.py --disallow-any-generics --show-traceback > out.txt
crash.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.580-dev-51b4e0cb3726d03e2d17c8a0de4d56110e30c5e5
crash.py:1: : note: use --pdb to drop into pdb
The full stacktrace is here.
Error comes from mypy trying to collect all types of N
in collect_any_types
and ends up stuck in a cycle. The crash was discovered in #4225.