Skip to content

Fix dmypy suggest crash after flushed diagnostics#21767

Open
vetrovk wants to merge 1 commit into
python:masterfrom
vetrovk:fix/dmypy-suggest-flushed-errors
Open

Fix dmypy suggest crash after flushed diagnostics#21767
vetrovk wants to merge 1 commit into
python:masterfrom
vetrovk:fix/dmypy-suggest-flushed-errors

Conversation

@vetrovk

@vetrovk vetrovk commented Jul 23, 2026

Copy link
Copy Markdown

Fixes #21765.

dmypy suggest could reload an automatically loaded module after a prior check had flushed diagnostics. If that reload reprocessed a user module, adding a new diagnostic violated the flushed_files invariant and crashed the daemon.

Reset the suggestion reload error accumulator before the fine-grained update, matching the existing fine-grained trigger behavior. Add a daemon regression test covering stdlib suggestions after a note, repeated suggestions, daemon status, and a subsequent incremental check.

Validation:

  • mypy/test/testdaemon.py
  • mypy/test/testfinegrained.py -k Suggest
  • mypy/test/testfinegrained.py
  • python runtests.py self
  • python runtests.py lint
  • git diff --check

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dmypy suggest crashes if the checked files emit messages and suggesting a stdlib function (?)

1 participant