From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 13 May 2019 16:58:42 +0000 (-0700) Subject: [3.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (#13288) X-Git-Tag: v3.7.4rc1~160 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68a11b6e6a73cd2e9b49e5df9973877b2fed6277;p=thirdparty%2FPython%2Fcpython.git [3.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (#13288) Includes blurb fix in 85c69d5 (cherry picked from commit 4f098b35f58e911639f8e9adc393d5cf5c792e7f) --- diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py index f5bced597aa8..b9e813be0630 100644 --- a/Lib/idlelib/iomenu.py +++ b/Lib/idlelib/iomenu.py @@ -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), 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 000000000000..2a905bf0eecf --- /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.