Skip to content

Commit d1f01bd

Browse files
author
Guido van Rossum
committed
The platform option totally affects the cache!
1 parent ebca0cb commit d1f01bd

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
@@ -304,7 +304,7 @@ def default_lib_path(data_dir: str,
304304
('data_json', str), # path of <id>.data.json
305305
('suppressed', List[str]), # dependencies that weren't imported
306306
('child_modules', List[str]), # all submodules of the given module
307-
('options', Optional[Dict[str, bool]]), # build options
307+
('options', Optional[Dict[str, object]]), # build options
308308
('dep_prios', List[int]),
309309
('interface_hash', str), # hash representing the public interface
310310
('version_id', str), # mypy version for cache invalidation
@@ -903,6 +903,9 @@ def find_cache_meta(id: str, path: str, manager: BuildManager) -> Optional[Cache
903903
if manager.options.quick_and_dirty:
904904
# In quick_and_dirty mode allow non-quick_and_dirty cache files.
905905
cached_options['quick_and_dirty'] = True
906+
if not cached_options.get('platform') and manager.options.skip_version_check:
907+
# Older versions didn't write platform.
908+
cached_options['platform'] = manager.options.platform
906909
if cached_options != current_options:
907910
manager.trace('Metadata abandoned for {}: options differ'.format(id))
908911
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)