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

[1.10 backport] Fix error reporting on cached run after uninstallation of third party library #17422

Merged
merged 3 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3459,11 +3459,12 @@ def process_stale_scc(graph: Graph, scc: list[str], manager: BuildManager) -> No
for id in stale:
graph[id].transitive_error = True
for id in stale:
manager.flush_errors(
manager.errors.simplify_path(graph[id].xpath),
manager.errors.file_messages(graph[id].xpath),
False,
)
if graph[id].xpath not in manager.errors.ignored_files:
manager.flush_errors(
manager.errors.simplify_path(graph[id].xpath),
manager.errors.file_messages(graph[id].xpath),
False,
)
graph[id].write_cache()
graph[id].mark_as_rechecked()

Expand Down
2 changes: 1 addition & 1 deletion mypy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def blocker_module(self) -> str | None:

def is_errors_for_file(self, file: str) -> bool:
"""Are there any errors for the given file?"""
return file in self.error_info_map
return file in self.error_info_map and file not in self.ignored_files

def prefer_simple_messages(self) -> bool:
"""Should we generate simple/fast error messages?
Expand Down
2 changes: 1 addition & 1 deletion mypy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# - Release versions have the form "1.2.3".
# - Dev versions have the form "1.2.3+dev" (PLUS sign to conform to PEP 440).
# - Before 1.0 we had the form "0.NNN".
__version__ = "1.10.0"
__version__ = "1.10.1"
base_version = __version__

mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
Expand Down
15 changes: 15 additions & 0 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,21 @@ main:3: note: Revealed type is "builtins.int"
main:3: note: Revealed type is "Any"


[case testIncrementalIgnoreErrors]
# flags: --config-file tmp/mypy.ini
import a
[file a.py]
import module_that_will_be_deleted
[file module_that_will_be_deleted.py]

[file mypy.ini]
\[mypy]
\[mypy-a]
ignore_errors = True
[delete module_that_will_be_deleted.py.2]
[out1]
[out2]

[case testIncrementalNamedTupleInMethod]
from ntcrash import nope
[file ntcrash.py]
Expand Down
Loading