diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 2aba46e0df4..872bece4767 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -383,6 +383,8 @@ class IOBinding: try: with open(filename, "wb") as f: f.write(chars) + f.flush() + os.fsync(f.fileno()) return True except IOError as msg: tkMessageBox.showerror("I/O Error", str(msg), diff --git a/Misc/NEWS.d/next/IDLE/2019-05-05-16-27-53.bpo-13102.AGNWYJ.rst b/Misc/NEWS.d/next/IDLE/2019-05-05-16-27-53.bpo-13102.AGNWYJ.rst new file mode 100644 index 00000000000..2a905bf0eec --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-05-05-16-27-53.bpo-13102.AGNWYJ.rst @@ -0,0 +1 @@ +When saving a file, call os.fsync() so bits are flushed to e.g. USB drive.