Type ignore comments erroneously marked as unused by dmypy by meshy · Pull Request #15043 · python/mypy

@meshy changed the title Type ignores comments erroneously marked as unused by dmypy Type ignore comments erroneously marked as unused by dmypy

Apr 12, 2023

@meshy meshy mentioned this pull request

Apr 13, 2023

@meshy meshy mentioned this pull request

Apr 27, 2023

meshy

@meshy meshy mentioned this pull request

Jan 8, 2024

@meshy meshy mentioned this pull request

Jan 11, 2024

@meshy

The problem this solved has been addressed in another way, so we don't
need to do this re-analysis any more in order to fix the bug we've been
chasing.

This change is a partial revert of "Fix disappearing errors when
re-running dmypy check" from a few commits back.

@hauntsaninja

@meshy meshy mentioned this pull request

Apr 28, 2025

@ilevkivskyi

@pre-commit-ci

@ilevkivskyi

ilevkivskyi

esarp pushed a commit that referenced this pull request

Jul 3, 2025
There is currently a misbehaviour where "type: ignore" comments are
erroneously marked as unused in re-runs of dmypy. There are also cases
where errors disappear on the re-run.

As far as I can tell, this only happens in modules which contain an
import that we don't know how to type (such as a module which does not
exist), and a submodule which is unused.

There was a lot of commenting and investigation on this PR, but I hope
that the committed tests and fixes illustrate and address the issue.

Related to #9655

---------

Co-authored-by: David Seddon <david@seddonym.me>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>