Skip to content

Commit 4f098b3

Browse files
gvanrossumterryjreedy
authored andcommitted
bpo-36807: When saving a file in IDLE, call flush and fsync (#13102)
1 parent 3e2afd7 commit 4f098b3

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/idlelib/iomenu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ def writefile(self, filename):
384384
try:
385385
with open(filename, "wb") as f:
386386
f.write(chars)
387+
f.flush()
388+
os.fsync(f.fileno())
387389
return True
388390
except OSError as msg:
389391
tkMessageBox.showerror("I/O Error", str(msg),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
When saving a file, call os.flush() so bits are flushed to e.g. USB drive.

0 commit comments

Comments
 (0)