[2.7] bpo-36807: When saving a file in IDLE, call flush and fsync (GH… · python/cpython@353f8d2 (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 353f8d2
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 |
---|---|---|
@@ -383,6 +383,8 @@ def writefile(self, filename): | ||
383 | 383 | try: |
384 | 384 | with open(filename, "wb") as f: |
385 | 385 | f.write(chars) |
386 | +f.flush() | |
387 | +os.fsync(f.fileno()) | |
386 | 388 | return True |
387 | 389 | except IOError as msg: |
388 | 390 | 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. |