Skip to content

Reset errors before reloading dmypy suggestion targets - #21810

Open
daleselaji-dev wants to merge 1 commit into
python:masterfrom
daleselaji-dev:codex/fix-dmypy-suggest-errors
Open

Reset errors before reloading dmypy suggestion targets#21810
daleselaji-dev wants to merge 1 commit into
python:masterfrom
daleselaji-dev:codex/fix-dmypy-suggest-errors

Conversation

@daleselaji-dev

Copy link
Copy Markdown

Summary

  • Reset the shared error state before reloading a module after a suggestion run.
  • Add a daemon regression test covering a note emitted by a checked file followed by dmypy suggest --callsites.

The suggestion engine temporarily rechecks modules and flushes their messages. Reloading the module without resetting Errors left the flushed-file bookkeeping populated, so the next check could assert in Errors._add_error_info. This fixes #21765.

Tests

  • py -3.10 -m pytest -q mypy/test/testdaemon.py
  • py -3.10 -m ruff check mypy/suggestions.py
  • git diff --check

This change was prepared with Codex assistance and reviewed and verified by the submitting contributor.

@daleselaji-dev
daleselaji-dev marked this pull request as ready for review August 5, 2026 03:23
@github-actions

github-actions Bot commented Aug 5, 2026

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