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

Dan Halbert report at bugs.python.org
Sun May 12 20:44:00 EDT 2019


Dan Halbert <halbert at halwitz.org> added the comment:

Fix tested and works! Comment from PR duplicated here.

I tested this fix by editing the 3.7.3 IDLE code by hand, and editing this test program as code.py on a CIRCUITPY drive on Windows 10:

import time
i = 0
while True:
    print(i)
    i += 1
    print("""\
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
""")
    time.sleep(1)

I typically test write flushing by editing a short program like this, and duplicating the print lines so that the size of the program grows by >512 bytes. This forces a rewrite of the FAT12 information because the program has increased in size by one or more filesystem blocks. Then I shrink it back down again. If file flushing doesn't happen immediately, the program will often throw a syntax error (because it's missing some blocks), or CircuitPython will get an I/O error, which is what happened before I patched IDLE.

So this looks good!

----------

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


More information about the Python-bugs-list mailing list