Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-36807: When saving a file in IDLE, call flush and fsync #13102
Conversation
gvanrossum
requested a review
from
terryjreedy
as a
code owner
May 5, 2019
the-knights-who-say-ni
added
the
CLA signed
label
May 5, 2019
bedevere-bot
added
the
awaiting core review
label
May 5, 2019
gvanrossum
changed the title
[idle] When saving a file, call flush and fsync
bpo-36807 When saving a file, call flush and fsync
May 5, 2019
gvanrossum
changed the title
bpo-36807 When saving a file, call flush and fsync
bpo-36807 When saving a file in IDLE, call flush and fsync
May 5, 2019
gvanrossum
changed the title
bpo-36807 When saving a file in IDLE, call flush and fsync
bpo-36807: When saving a file in IDLE, call flush and fsync
May 5, 2019
terryjreedy
added
needs backport to 3.7
type-bugfix
labels
May 6, 2019
This comment has been minimized.
This comment has been minimized.
@dhalbert Can you test this on Windows? Thanks for finding this issue in the first place! |
This comment has been minimized.
This comment has been minimized.
dhalbert
commented
May 13, 2019
I tested this fix by editing the 3.7.3 IDLE code by hand, and editing this test program as
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! |
This comment has been minimized.
This comment has been minimized.
@terryjreedy I personally think this is good to go in. The standard builtin |
This comment has been minimized.
This comment has been minimized.
I am most worried about an exception from pulling the usb plug, in which case ignoring it should be fine. I will merge this tomorrow with try:...except:pass added. |
This comment has been minimized.
This comment has been minimized.
I don't see why anything extra is needed. There's already a try/except OSError that puts up a dialog box. I just tried this on Mac (edit file, remove USB plug, try to save) and it worked as expected. |
serhiy-storchaka
approved these changes
May 13, 2019
bedevere-bot
added
awaiting merge
and removed
awaiting core review
labels
May 13, 2019
terryjreedy
merged commit 4f098b3
into
python:master
May 13, 2019
5 checks passed
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
May 13, 2019
@terryjreedy: Please replace |
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
May 13, 2019
Thanks @gvanrossum for the PR, and @terryjreedy for merging it |
bedevere-bot
removed
the
awaiting merge
label
May 13, 2019
terryjreedy
added
needs backport to 3.7
and removed
needs backport to 3.7
labels
May 13, 2019
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
May 13, 2019
Thanks @gvanrossum for the PR, and @terryjreedy for merging it |
miss-islington
added a commit
to miss-islington/cpython
that referenced
this pull request
May 13, 2019
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
May 13, 2019
GH-13280 is a backport of this pull request to the 3.7 branch. |
bedevere-bot
removed
the
needs backport to 3.7
label
May 13, 2019
gvanrossum
deleted the
gvanrossum:flush-fsync-idle
branch
May 13, 2019
This comment has been minimized.
This comment has been minimized.
OK, I'll send a fix for the NEW typo. |
This comment has been minimized.
This comment has been minimized.
Typo fix is here: #13284 |
terryjreedy
added
the
needs backport to 3.7
label
May 13, 2019
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
May 13, 2019
Thanks @gvanrossum for the PR, and @terryjreedy for merging it |
miss-islington
added a commit
to miss-islington/cpython
that referenced
this pull request
May 13, 2019
bedevere-bot
removed
the
needs backport to 3.7
label
May 13, 2019
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
May 13, 2019
GH-13288 is a backport of this pull request to the 3.7 branch. |
gvanrossum commentedMay 5, 2019
•
edited by bedevere-bot
This came up during today's final PyCon keynote -- IDLE was called out
as one of the two editors not to use when live-coding on Adafruit's
Circuit Playground Express (https://www.adafruit.com/product/3333).
I think that the problem referred to is that IDLE doesn't guarantee
that the bits are actually flushed to disk -- they may linger in the
OS filesystem cache. And I think this PR fixes the issue.
I've tested that this doesn't break things, but I don't have the right
cable around so I cannot test this with the hardware handed out to
PyCon attendees until Wednesday at the earliest.
https://bugs.python.org/issue36807