mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
pyon/store_file: do not erase file when encoding fails
This commit is contained in:
parent
cda394e0ce
commit
0aa450ad5d
@ -156,8 +156,9 @@ def store_file(filename, x):
|
||||
"""Encodes a Python object and writes it to the specified file.
|
||||
|
||||
"""
|
||||
contents = encode(x, True)
|
||||
with open(filename, "w") as f:
|
||||
f.write(encode(x, True))
|
||||
f.write(contents)
|
||||
|
||||
|
||||
def load_file(filename):
|
||||
|
Loading…
Reference in New Issue
Block a user