Skip to content

Commit

Permalink
[1.10 backport] Fix error reporting on cached run after uninstallatio…
Browse files Browse the repository at this point in the history
…n of third party library (#17422)
  • Loading branch information
hauntsaninja committed Jun 23, 2024
1 parent 3faf0fc commit c28b525
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
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

0 comments on commit c28b525

Please sign in to comment.