Skip to content

Commit 353f8d2

Browse files
authored
[2.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (GH-13293)
1 parent 7346a16 commit 353f8d2

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/idlelib/IOBinding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ def writefile(self, filename):
383383
try:
384384
with open(filename, "wb") as f:
385385
f.write(chars)
386+
f.flush()
387+
os.fsync(f.fileno())
386388
return True
387389
except IOError as msg:
388390
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.fsync() so bits are flushed to e.g. USB drive.

0 commit comments

Comments
 (0)