Skip to content

Commit b4ec387

Browse files
authored
The platform option totally affects the cache! (#3663)
1 parent 324f68f commit b4ec387

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mypy/build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def default_lib_path(data_dir: str,
308308
('data_json', str), # path of <id>.data.json
309309
('suppressed', List[str]), # dependencies that weren't imported
310310
('child_modules', List[str]), # all submodules of the given module
311-
('options', Optional[Dict[str, bool]]), # build options
311+
('options', Optional[Dict[str, object]]), # build options
312312
('dep_prios', List[int]),
313313
('interface_hash', str), # hash representing the public interface
314314
('version_id', str), # mypy version for cache invalidation
@@ -907,6 +907,9 @@ def find_cache_meta(id: str, path: str, manager: BuildManager) -> Optional[Cache
907907
if manager.options.quick_and_dirty:
908908
# In quick_and_dirty mode allow non-quick_and_dirty cache files.
909909
cached_options['quick_and_dirty'] = True
910+
if not cached_options.get('platform') and manager.options.skip_version_check:
911+
# Older versions didn't write platform.
912+
cached_options['platform'] = manager.options.platform
910913
if cached_options != current_options:
911914
manager.trace('Metadata abandoned for {}: options differ'.format(id))
912915
return None

mypy/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Options:
3434
"strict_optional",
3535
}
3636

37-
OPTIONS_AFFECTING_CACHE = PER_MODULE_OPTIONS | {"quick_and_dirty"}
37+
OPTIONS_AFFECTING_CACHE = (PER_MODULE_OPTIONS | {"quick_and_dirty", "platform"})
3838

3939
def __init__(self) -> None:
4040
# -- build options --

0 commit comments

Comments
 (0)