]> granicus.if.org Git - python/commitdiff
bpo-36807: When saving a file in IDLE, call flush and fsync (#13102)
authorGuido van Rossum <guido@python.org>
Mon, 13 May 2019 12:31:30 +0000 (05:31 -0700)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 13 May 2019 12:31:29 +0000 (08:31 -0400)
Lib/idlelib/iomenu.py
Misc/NEWS.d/next/IDLE/2019-05-05-16-27-53.bpo-13102.AGNWYJ.rst [new file with mode: 0644]

index f5bced597aa82156b5e5569e4ddc7ff24e041cc1..b9e813be0630e2c385160916d3d9630427f96fcf 100644 (file)
@@ -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 (file)
index 0000000..18b31b1
--- /dev/null
@@ -0,0 +1 @@
+When saving a file, call os.flush() so bits are flushed to e.g. USB drive.