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

Mypy hangs indefinitely trying to analyse a file with huge nested dicts #14970

Open
AlexWaygood opened this issue Mar 28, 2023 · 2 comments
Open
Labels
bug mypy got something wrong performance

Comments

@AlexWaygood
Copy link
Member

Bug Report

Mypy hangs indefinitely when trying to analyse a file with huge nested dicts.

To Reproduce

  1. Copy and paste the contents of this file into a .py file: repro.txt
  2. Run mypy on the file
  3. Wait

Comments

This is similar to #14636. However, the dicts aren't nearly as deeply nested as in #14636, they're just very, very big.

The dicts are so huge because this is a partially generated file, the result of a codemod by stubdefaulter. Mypy is far from the only tool to have difficulty with this file: it also made black and flake8 hang, and crashed IDLE. Pyright did manage to analyse the file, but also took a lot longer than usual.

Your Environment

  • Mypy version used: 1.1.1; also master branch @ 2e75cba
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.11.2
@dgellow
Copy link

dgellow commented Aug 27, 2024

We are facing this exact issue for a ~10k lines dictionary we codegen. Pyright and other tools don't have issues.

@njgrisafi
Copy link

+1 seeing most performance hits come from deeply nested dictionaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong performance
Projects
None yet
Development

No branches or pull requests

3 participants