[3.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH… · python/cpython@68a11b6 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 68a11b6
authored and
committed
File tree
2 files changed
lines changed
2 files changed
lines changed
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -384,6 +384,8 @@ def writefile(self, filename): | ||
384 | 384 | try: |
385 | 385 | with open(filename, "wb") as f: |
386 | 386 | f.write(chars) |
387 | +f.flush() | |
388 | +os.fsync(f.fileno()) | |
387 | 389 | return True |
388 | 390 | except OSError as msg: |
389 | 391 | tkMessageBox.showerror("I/O Error", str(msg), |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 | +When saving a file, call os.fsync() so bits are flushed to e.g. USB drive. |