[2.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (GH-13293)

This commit is contained in:
Terry Jan Reedy 2019-05-13 18:29:15 -04:00 committed by GitHub
parent 7346a16ed5
commit 353f8d2282
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

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

View File

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