Commit c808bec0 authored by Robert Bradshaw's avatar Robert Bradshaw

Write cycache files atomically.

This fixes #1393.
parent 5bd3fd90
...@@ -1149,11 +1149,12 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, ...@@ -1149,11 +1149,12 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None,
elif fingerprint: elif fingerprint:
f = open(c_file, 'rb') f = open(c_file, 'rb')
try: try:
g = gzip_open(fingerprint_file, 'wb') g = gzip_open(fingerprint_file + '.tmp', 'wb')
try: try:
shutil.copyfileobj(f, g) shutil.copyfileobj(f, g)
finally: finally:
g.close() g.close()
os.rename(fingerprint_file + '.tmp', fingerprint_file)
finally: finally:
f.close() f.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment