Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make write atomic #180

Open
ctoth opened this issue Feb 15, 2019 · 1 comment
Open

Make write atomic #180

ctoth opened this issue Feb 15, 2019 · 1 comment
Milestone

Comments

@ctoth
Copy link

ctoth commented Feb 15, 2019

Currently if you call write, it directly calls write on the underlying file object.
If then the power fails or the process crashes the file is left in a garbage state.
I recommend writing to a temporary file, then using rename as this is the accepted practice for atomic writes.

Alternatively you could depend on https://github.com/untitaker/python-atomicwrites

Let me know which approach you prefer and I will open a PR implementing it.

@robdennis
Copy link
Member

Thanks for offering to make a PR for this, though clearly this is 4 years late. I don't feel up to this being in 5.1.0, but seems like a good idea.

If this comes back around, I'd prefer the temp file appraoch.

@robdennis robdennis added this to the Someday milestone Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants