Skip to content

Commit

Permalink
[mypyc] Don't crash on --cache-dir=/dev/null and the like (#8101)
Browse files Browse the repository at this point in the history
  • Loading branch information
msullivan authored Dec 7, 2019
1 parent 6a83e71 commit a2a5147
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mypyc/emitmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,16 @@ def write_cache(
st = result.graph[id]

meta_path, _, _ = get_cache_names(id, st.xpath, result.manager.options)
# If the metadata isn't there, skip writing the cache.
try:
meta_data = result.manager.metastore.read(meta_path)
except IOError:
continue

newpath = get_state_ir_cache_name(st)
ir_data = {
'ir': module.serialize(),
'meta_hash': compute_hash(result.manager.metastore.read(meta_path)),
'meta_hash': compute_hash(meta_data),
'src_hashes': hashes[group_map[id]],
}

Expand Down

0 comments on commit a2a5147

Please sign in to comment.