]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH-13102) (GH...
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 13 May 2019 22:29:15 +0000 (18:29 -0400)
committerGitHub <noreply@github.com>
Mon, 13 May 2019 22:29:15 +0000 (18:29 -0400)
Lib/idlelib/IOBinding.py
Misc/NEWS.d/next/IDLE/2019-05-05-16-27-53.bpo-13102.AGNWYJ.rst [new file with mode: 0644]

index 2aba46e0df460b682fb3caa77485335f475d25bf..872bece4767446b02c807437bd13e481b87a5acf 100644 (file)
@@ -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 (file)
index 0000000..2a905bf
--- /dev/null
@@ -0,0 +1 @@
+When saving a file, call os.fsync() so bits are flushed to e.g. USB drive.