Skip to content

Commit b1a5a25

Browse files
committed
Fix some bugs in fg cache loading
1 parent e5afefd commit b1a5a25

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

mypy/dmypy_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def initialize_fine_grained(self, sources: List[mypy.build.BuildSource]) -> Dict
265265
messages = result.errors
266266
manager = result.manager
267267
graph = result.graph
268+
manager.options.cache_dir = os.devnull # XXX: HACK
268269
self.fine_grained_manager = mypy.server.update.FineGrainedBuildManager(manager, graph)
269270
self.fine_grained_initialized = True
270271
self.previous_sources = sources
@@ -285,7 +286,7 @@ def initialize_fine_grained(self, sources: List[mypy.build.BuildSource]) -> Dict
285286
# Run an update
286287
changed = self.find_changed(sources)
287288
if changed:
288-
messages += self.fine_grained_manager.update(changed)
289+
messages = self.fine_grained_manager.update(changed)
289290

290291
status = 1 if messages else 0
291292
self.previous_messages = messages[:]

mypy/server/update.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def update_single_isolated(module: str,
378378
sources = get_sources(previous_modules, [(module, path)])
379379
invalidate_stale_cache_entries(manager.saved_cache, [(module, path)])
380380

381-
manager.missing_modules = set()
381+
manager.missing_modules.clear()
382382
try:
383383
graph = load_graph(sources, manager)
384384
except CompileError as err:
@@ -497,7 +497,8 @@ def delete_module(module_id: str,
497497
# TODO: Remove deps for the module (this only affects memory use, not correctness)
498498
assert module_id not in graph
499499
new_graph = graph.copy()
500-
del manager.modules[module_id]
500+
if module_id in manager.modules:
501+
del manager.modules[module_id]
501502
if module_id in manager.saved_cache:
502503
del manager.saved_cache[module_id]
503504
components = module_id.split('.')

test-data/unit/fine-grained-modules.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ from p import q
245245
main:1: error: Cannot find module named 'p.q'
246246
-- TODO: The following messages are different compared to non-incremental mode
247247
main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
248-
main:1: error: Module 'p' has no attribute 'q'
249248
==
250249

251250
[case testDeletionOfSubmoduleTriggersImportFrom2]

0 commit comments

Comments
 (0)