[issue36807] IDLE doesn't call os.fsync()

Terry J. Reedy report at bugs.python.org
Mon May 6 03:23:58 EDT 2019


Terry J. Reedy <tjreedy at udel.edu> added the comment:

OS and disk interaction is not something I know a lot about.  I don't know how long different OSes take to write things out by themselves, and therefore how much real danger there is of loosing data.  However, IDLE is used in places where power is less reliable than it is for me, and if not doing this makes IDLE look bad, and if it does not noticeably delay running a file (and I expect not), then it seems like a good idea.

Digging further, Kurt Kaiser added f.flush in 3/19/2006.  On 2013-08-04, for #18151, Serhiy submitted a patch for 3.3 with the comment "Here is a patch which replace the "open ... close" idiom to the "with open" idiom in IDLE."  It replaced
            f = open(filename, "wb")
            f.write(chars)
            f.flush()
            f.close()
with
            with open(filename, "wb") as f:
                f.write(chars)

I have no idea why f.flush was deleted.  An oversight?  There is no discussion on the issue. I merged Serhiy's patch and backported to 2.7.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36807>
_______________________________________


More information about the Python-bugs-list mailing list