Skip to content

fix: make _merge_toml_fragment and _remove_toml_entries use atomic writes - #3972

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/toml-merge-atomic-write
Open

fix: make _merge_toml_fragment and _remove_toml_entries use atomic writes#3972
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/toml-merge-atomic-write

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

Both _merge_toml_fragment and _remove_toml_entries used write_text() which truncates the file before writing. A crash or power loss mid-write leaves a partial TOML file.

Fix

Now uses empfile.mkstemp + os.replace for atomic writes, matching the pattern used elsewhere in the codebase.

…ites

Both functions used write_text() which truncates before writing. A crash
or power loss mid-write leaves a partial TOML file. Now uses
tempfile.mkstemp + os.replace for atomic writes.
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

Successfully merging this pull request may close these issues.

1 participant