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 on recursive NamedTuple definition #4780

Closed
ilinum opened this issue Mar 22, 2018 · 0 comments · Fixed by #5434
Closed

Crash on recursive NamedTuple definition #4780

ilinum opened this issue Mar 22, 2018 · 0 comments · Fixed by #5434

Comments

@ilinum
Copy link
Collaborator

ilinum commented Mar 22, 2018

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.

@ilinum ilinum added the crash label Mar 22, 2018
ilevkivskyi added a commit that referenced this issue Aug 8, 2018
Fixes #5357
Fixes #4780

This might potentially fix similar crashes on recursive types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants