bpo-36807: When saving a file in IDLE, call flush and fsync (#13102)

This commit is contained in:
Guido van Rossum 2019-05-13 05:31:30 -07:00 committed by Terry Jan Reedy
parent 3e2afd78ba
commit 4f098b35f5
2 changed files with 3 additions and 0 deletions

View File

@ -384,6 +384,8 @@ class IOBinding:
try:
with open(filename, "wb") as f:
f.write(chars)
f.flush()
os.fsync(f.fileno())
return True
except OSError as msg:
tkMessageBox.showerror("I/O Error", str(msg),

View File

@ -0,0 +1 @@
When saving a file, call os.flush() so bits are flushed to e.g. USB drive.